From a05bc1087912624b4b9bfd32559a1eb15f903ec0 Mon Sep 17 00:00:00 2001 From: guido Date: Thu, 7 Feb 2013 10:46:41 +0100 Subject: [PATCH] [Maven] HSQL profile -Added Maven HSQL profile for automatic build with the embedded HSQL dbms -Minor formatting and import fixes --- ....eclipse.wst.common.project.facet.core.xml | 2 +- build_instructions.txt | 12 ++- hsql/README | 28 +++--- pom.xml | 87 ++++++++++++------- src/resources/ConventionResource.java | 5 -- src/resources/ExtraResource.java | 1 - src/resources/FileResource.java | 4 +- src/resources/GuestResource.java | 1 - src/resources/PeriodResource.java | 1 - src/resources/RoomFacilityResource.java | 26 +----- src/resources/RoomImageResource.java | 10 +-- src/resources/RoomResource.java | 1 - src/resources/RoomTypeFacilityResource.java | 21 +---- src/resources/RoomTypeImageResource.java | 41 +-------- src/resources/RoomTypeResource.java | 1 - src/resources/SeasonResource.java | 1 - src/resources/StructureFacilityResource.java | 1 - src/resources/StructureImageResource.java | 6 +- 18 files changed, 87 insertions(+), 162 deletions(-) diff --git a/.settings/org.eclipse.wst.common.project.facet.core.xml b/.settings/org.eclipse.wst.common.project.facet.core.xml index bec0f51c..d19d1f95 100644 --- a/.settings/org.eclipse.wst.common.project.facet.core.xml +++ b/.settings/org.eclipse.wst.common.project.facet.core.xml @@ -1,6 +1,6 @@ - + diff --git a/build_instructions.txt b/build_instructions.txt index e334330f..d2e8688c 100644 --- a/build_instructions.txt +++ b/build_instructions.txt @@ -1,6 +1,7 @@ Locanda Build Guide (with Maven) -Clone the project from GitHub (https://github.com/labos/locanda) + -In the project root, there are three .properties file to be customized: -global.properties -> resources paths -mysql.properties -> mySQL connection parameters @@ -10,14 +11,19 @@ Locanda Build Guide (with Maven) -mvn clean install to create the build in Locanda_Target folder -mvn clean tomcat7:deploy to create the build in Locanda_Target folder and deploy it in a running Tomcat7 server --to accomplish the latter task, you previously need to: +-To accomplish the latter task, you need to: -configure your Tomcat server in ${tomcat.home}/conf/tomcat-users.xml by adding a user with the roles "manager-script" and "manager-gui" - -edit the Maven user config file (${user.home}/.m2/settings.xml) uncommenting the "server" tag and putting "tomcat_server" as id and your manager username and password, like this: + -edit the Maven user config file (${user.home}/.m2/settings.xml) uncommenting the "server" tag and putting "tomcat_server" as id and your manager username and password, like this: tomcat_server tomcat tomcat - + +-If you wish to use the HSQL db, you can deploy Locanda using the HSQL profile. Just run Maven with the command: + -mvn clean tomcat7:deploy -Phsql + and the config files will be set with the proper HSQL parameters of hsql.properties. + By activating this profile, the exec plugin will start and populate the HSQL database. + *BUG TO BE FIXED* The db start is commented due to the fact that it locks the shell, preventing the successful deployment completion diff --git a/hsql/README b/hsql/README index c3e27aa3..b11cff09 100644 --- a/hsql/README +++ b/hsql/README @@ -1,27 +1,29 @@ -this file is the README of the dir hsql -this directory contains software that is only for dev purpose. +README for using HSQL db in Locanda + +*hsql directory contains software that is only for development purpose* + Contents: - dump.sh: - this is an unix utility for dumping you locanda database (when obviously the local server is running) - to write the current db status in a ascii hsql file you giust run - $ dump.sh outfile - where outfile is the file in wich you want to write the db + this is an unix utility for dumping your locanda database (provided that the local server is running) + to write the current db status in a ascii hsql file just run: + $ dump.sh outfile + where "outfile" is the file in which you want to write the db + - - locanda.hsql: - this file contain the locanda hsql db decription and the initialization values + this file contain the locanda hsql db description and the initialization values - runserver.sh: this is an unix utility for running you locanda database server - to run the db giust run - $ runserver.sh /my/path/mydatafileset - if is your first run time the empty locanda db is created, if you have alredy create your db in 'mydatafileset' + to run the db: + $ runserver.sh /my/path/mydatafileset + if it is the first time you run the db, the empty locanda db is created, if you have already created your db in 'mydatafileset' the server is restored. - the dafault values to connection are: + the default values to connection are: url localhost:3036 username SA password "" @@ -34,7 +36,7 @@ Contents: $ sqltool.sh ./locanda.hsql The lib directory contains the java hsql server used by shell programs -If you want call these file using your jvm, please refer hsql rdbms docs. +If you want call these file using your jvm, please refer to hsql rdbms docs. ./lib/: hsqldb.jar sqltool.jar diff --git a/pom.xml b/pom.xml index 955461c0..8592e2a1 100644 --- a/pom.xml +++ b/pom.xml @@ -4,12 +4,12 @@ labos locanda 0.3 - + ${project.build.directory}/${project.name}_resources UTF-8 - + hsql @@ -18,10 +18,57 @@ global.properties hsql.properties + + + org.codehaus.mojo + exec-maven-plugin + 1.2.1 + + + + + + + + + org.hsqldb + hsqldb + 2.2.9 + runtime + + + - + src ${basedir}/${project.name}_target @@ -43,24 +90,6 @@ - maven-compiler-plugin 2.3.2 @@ -75,10 +104,10 @@ 2.3 - - true - - + + true + + webroot\WEB-INF\web.xml @@ -103,7 +132,7 @@ - + org.apache.struts @@ -361,12 +390,6 @@ 7.0.33 provided - - org.hsqldb - hsqldb - 2.2.9 - runtime - org.apache.tomcat tomcat-jdbc diff --git a/src/resources/ConventionResource.java b/src/resources/ConventionResource.java index 0451ef23..a248d5b1 100644 --- a/src/resources/ConventionResource.java +++ b/src/resources/ConventionResource.java @@ -22,8 +22,6 @@ import org.apache.solr.client.solrj.SolrServerException; import org.apache.solr.client.solrj.response.FacetField.Count; import org.apache.solr.client.solrj.response.QueryResponse; -import org.apache.solr.client.solrj.response.TermsResponse; -import org.apache.solr.client.solrj.response.TermsResponse.Term; import org.apache.solr.common.SolrDocument; import org.apache.solr.common.SolrDocumentList; import org.springframework.beans.factory.annotation.Autowired; @@ -42,7 +40,6 @@ @Component @Scope("prototype") public class ConventionResource { - @Autowired private ConventionService conventionService = null; @Autowired @@ -267,6 +264,4 @@ public void setSolrServerConvention(SolrServer solrServerConvention) { this.solrServerConvention = solrServerConvention; } - - } \ No newline at end of file diff --git a/src/resources/ExtraResource.java b/src/resources/ExtraResource.java index bb7c2d0d..a2256693 100644 --- a/src/resources/ExtraResource.java +++ b/src/resources/ExtraResource.java @@ -39,7 +39,6 @@ @Component @Scope("prototype") public class ExtraResource { - @Autowired private ExtraService extraService = null; @Autowired diff --git a/src/resources/FileResource.java b/src/resources/FileResource.java index 3cbcabfd..2b230c9f 100644 --- a/src/resources/FileResource.java +++ b/src/resources/FileResource.java @@ -35,9 +35,9 @@ public class FileResource { @Autowired private FileService fileService; + @GET @Path("{id}") - public Response getFile(@PathParam("id") Integer id) { model.File file = null; @@ -105,8 +105,6 @@ public String updateIe( // TODO Auto-generated catch block e.printStackTrace(); } - - return str; } diff --git a/src/resources/GuestResource.java b/src/resources/GuestResource.java index 13fd69bb..f7eb9818 100644 --- a/src/resources/GuestResource.java +++ b/src/resources/GuestResource.java @@ -38,7 +38,6 @@ @Component @Scope("prototype") public class GuestResource { - @Autowired private GuestService guestService = null; @Autowired diff --git a/src/resources/PeriodResource.java b/src/resources/PeriodResource.java index 9be91391..2bd71caf 100644 --- a/src/resources/PeriodResource.java +++ b/src/resources/PeriodResource.java @@ -27,7 +27,6 @@ @Component @Scope("prototype") public class PeriodResource { - @Autowired private PeriodService periodService = null; @Autowired diff --git a/src/resources/RoomFacilityResource.java b/src/resources/RoomFacilityResource.java index 18095c3c..16eb1c53 100644 --- a/src/resources/RoomFacilityResource.java +++ b/src/resources/RoomFacilityResource.java @@ -15,27 +15,18 @@ import javax.ws.rs.core.MediaType; import model.Facility; -import model.Image; - import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.Scope; import org.springframework.stereotype.Component; import service.FacilityService; -import service.ImageService; import service.RoomFacilityService; import service.RoomService; -import service.RoomTypeFacilityService; -import service.RoomTypeService; -import service.StructureFacilityService; -import service.StructureImageService; - import com.sun.jersey.api.NotFoundException; @Path("/roomFacilities/") @Component @Scope("prototype") - public class RoomFacilityResource { @Autowired private FacilityService facilityService = null; @@ -106,35 +97,20 @@ public Integer deleteRoomFacility(@PathParam("id") Integer id){ public FacilityService getFacilityService() { return facilityService; } - - public void setFacilityService(FacilityService facilityService) { this.facilityService = facilityService; } - - public RoomFacilityService getRoomFacilityService() { return roomFacilityService; } - - public void setRoomFacilityService(RoomFacilityService roomFacilityService) { this.roomFacilityService = roomFacilityService; } - - public RoomService getRoomService() { return roomService; } - - public void setRoomService(RoomService roomService) { this.roomService = roomService; } - - - - - -} +} \ No newline at end of file diff --git a/src/resources/RoomImageResource.java b/src/resources/RoomImageResource.java index c96ea469..5cf55122 100644 --- a/src/resources/RoomImageResource.java +++ b/src/resources/RoomImageResource.java @@ -1,7 +1,5 @@ package resources; - -import java.io.IOException; import java.util.ArrayList; import java.util.HashMap; import java.util.List; @@ -31,7 +29,6 @@ @Path("/roomImages/") @Component @Scope("prototype") - public class RoomImageResource { @Autowired private ImageService imageService = null; @@ -101,25 +98,20 @@ public Integer deleteRoomImage(@PathParam("id") Integer id){ public ImageService getImageService() { return imageService; } - public void setImageService(ImageService imageService) { this.imageService = imageService; } - public RoomImageService getRoomImageService() { return roomImageService; } - public void setRoomImageService(RoomImageService roomImageService) { this.roomImageService = roomImageService; } - public RoomService getRoomService() { return roomService; } - public void setRoomService(RoomService roomService) { this.roomService = roomService; } -} +} \ No newline at end of file diff --git a/src/resources/RoomResource.java b/src/resources/RoomResource.java index 3a6f1e92..d1ea2377 100644 --- a/src/resources/RoomResource.java +++ b/src/resources/RoomResource.java @@ -40,7 +40,6 @@ @Component @Scope("prototype") public class RoomResource { - @Autowired private RoomService roomService = null; @Autowired diff --git a/src/resources/RoomTypeFacilityResource.java b/src/resources/RoomTypeFacilityResource.java index 6cd33515..7421eeef 100644 --- a/src/resources/RoomTypeFacilityResource.java +++ b/src/resources/RoomTypeFacilityResource.java @@ -15,25 +15,18 @@ import javax.ws.rs.core.MediaType; import model.Facility; -import model.Image; - import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.Scope; import org.springframework.stereotype.Component; import service.FacilityService; -import service.ImageService; import service.RoomTypeFacilityService; import service.RoomTypeService; -import service.StructureFacilityService; -import service.StructureImageService; - import com.sun.jersey.api.NotFoundException; @Path("/roomTypeFacilities/") @Component @Scope("prototype") - public class RoomTypeFacilityResource { @Autowired private FacilityService facilityService = null; @@ -104,33 +97,21 @@ public Integer deleteRoomTypeFacility(@PathParam("id") Integer id){ public FacilityService getFacilityService() { return facilityService; } - - public void setFacilityService(FacilityService facilityService) { this.facilityService = facilityService; } - - - public RoomTypeFacilityService getRoomTypeFacilityService() { return roomTypeFacilityService; } - - public void setRoomTypeFacilityService( RoomTypeFacilityService roomTypeFacilityService) { this.roomTypeFacilityService = roomTypeFacilityService; } - - public RoomTypeService getRoomTypeService() { return roomTypeService; } - - public void setRoomTypeService(RoomTypeService roomTypeService) { this.roomTypeService = roomTypeService; } - -} +} \ No newline at end of file diff --git a/src/resources/RoomTypeImageResource.java b/src/resources/RoomTypeImageResource.java index 2fbfbfd6..f189d801 100644 --- a/src/resources/RoomTypeImageResource.java +++ b/src/resources/RoomTypeImageResource.java @@ -1,8 +1,5 @@ package resources; - -import java.io.IOException; -import java.io.InputStream; import java.util.ArrayList; import java.util.HashMap; import java.util.List; @@ -12,49 +9,24 @@ import javax.ws.rs.DELETE; import javax.ws.rs.GET; import javax.ws.rs.POST; -import javax.ws.rs.PUT; import javax.ws.rs.Path; import javax.ws.rs.PathParam; import javax.ws.rs.Produces; -import javax.ws.rs.WebApplicationException; - import javax.ws.rs.core.MediaType; - -import model.File; import model.Image; - -import org.apache.commons.io.IOUtils; -import org.codehaus.jackson.JsonGenerationException; -import org.codehaus.jackson.jaxrs.JacksonJsonProvider; -import org.codehaus.jackson.map.JsonMappingException; -import org.codehaus.jackson.map.ObjectMapper; -import org.codehaus.jettison.json.JSONArray; -import org.codehaus.jettison.json.JSONException; -import org.codehaus.jettison.json.JSONObject; - import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.Scope; import org.springframework.stereotype.Component; -import org.springframework.stereotype.Service; - import com.sun.jersey.api.NotFoundException; -import com.sun.jersey.core.header.FormDataContentDisposition; -import com.sun.jersey.multipart.FormDataParam; - - -import service.FacilityImageService; import service.ImageService; -import service.RoomImageService; import service.RoomTypeImageService; import service.RoomTypeService; -import service.StructureImageService; @Path("/roomTypeImages/") @Component @Scope("prototype") - public class RoomTypeImageResource { @Autowired private ImageService imageService = null; @@ -104,7 +76,6 @@ public Map insertRoomTypeImage(Map map){ return map; } - @DELETE @Path("{id}") @Produces({MediaType.APPLICATION_JSON}) @@ -121,28 +92,20 @@ public Integer deleteRoomTypeImage(@PathParam("id") Integer id){ public ImageService getImageService() { return imageService; } - public void setImageService(ImageService imageService) { this.imageService = imageService; } - - public RoomTypeImageService getRoomTypeImageService() { return roomTypeImageService; } - public void setRoomTypeImageService(RoomTypeImageService roomTypeImageService) { this.roomTypeImageService = roomTypeImageService; } - public RoomTypeService getRoomTypeService() { return roomTypeService; } - public void setRoomTypeService(RoomTypeService roomTypeService) { this.roomTypeService = roomTypeService; } - - - -} + +} \ No newline at end of file diff --git a/src/resources/RoomTypeResource.java b/src/resources/RoomTypeResource.java index 7fbb9ecb..380cff8f 100644 --- a/src/resources/RoomTypeResource.java +++ b/src/resources/RoomTypeResource.java @@ -43,7 +43,6 @@ @Component @Scope("prototype") public class RoomTypeResource { - @Autowired private RoomTypeService roomTypeService = null; @Autowired diff --git a/src/resources/SeasonResource.java b/src/resources/SeasonResource.java index efd08c17..da5db093 100644 --- a/src/resources/SeasonResource.java +++ b/src/resources/SeasonResource.java @@ -43,7 +43,6 @@ @Component @Scope("prototype") public class SeasonResource { - @Autowired private SeasonService seasonService = null; @Autowired diff --git a/src/resources/StructureFacilityResource.java b/src/resources/StructureFacilityResource.java index a3eb03db..829a4c89 100644 --- a/src/resources/StructureFacilityResource.java +++ b/src/resources/StructureFacilityResource.java @@ -26,7 +26,6 @@ @Path("/structureFacilities/") @Component @Scope("prototype") - public class StructureFacilityResource { @Autowired private FacilityService facilityService = null; diff --git a/src/resources/StructureImageResource.java b/src/resources/StructureImageResource.java index 23648781..44701c09 100644 --- a/src/resources/StructureImageResource.java +++ b/src/resources/StructureImageResource.java @@ -28,7 +28,6 @@ @Path("/structureImages/") @Component @Scope("prototype") - public class StructureImageResource { @Autowired private ImageService imageService = null; @@ -93,17 +92,14 @@ public Integer deleteStructureImage(@PathParam("id") Integer id){ public ImageService getImageService() { return imageService; } - public void setImageService(ImageService imageService) { this.imageService = imageService; } - public StructureImageService getStructureImageService() { return structureImageService; } - public void setStructureImageService(StructureImageService structureImageService) { this.structureImageService = structureImageService; } -} +} \ No newline at end of file