Skip to content

Commit

Permalink
[Maven] HSQL profile
Browse files Browse the repository at this point in the history
-Added Maven HSQL profile for automatic build with the embedded HSQL
dbms
-Minor formatting and import fixes
  • Loading branch information
guido committed Feb 7, 2013
1 parent 9fbf29d commit a05bc10
Show file tree
Hide file tree
Showing 18 changed files with 87 additions and 162 deletions.
2 changes: 1 addition & 1 deletion .settings/org.eclipse.wst.common.project.facet.core.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<faceted-project>
<runtime name="Apache Tomcat v7.0"/>
<installed facet="java" version="1.6"/>
<installed facet="jst.web" version="3.0"/>
<installed facet="java" version="1.7"/>
</faceted-project>
12 changes: 9 additions & 3 deletions build_instructions.txt
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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:

<server>
<id>tomcat_server</id>
<username>tomcat</username>
<password>tomcat</password>
</server>


-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

28 changes: 15 additions & 13 deletions hsql/README
Original file line number Diff line number Diff line change
@@ -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 ""
Expand All @@ -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
87 changes: 55 additions & 32 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@
<groupId>labos</groupId>
<artifactId>locanda</artifactId>
<version>0.3</version>

<properties>
<resource.folder>${project.build.directory}/${project.name}_resources</resource.folder>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>

<profiles>
<profile>
<id>hsql</id>
Expand All @@ -18,10 +18,57 @@
<filter>global.properties</filter>
<filter>hsql.properties</filter>
</filters>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>1.2.1</version>
<executions>
<!-- <execution>
<phase>compile</phase>
<goals>
<goal>java</goal>
</goals>
<configuration>
<mainClass>org.hsqldb.server.Server</mainClass>
<arguments>
<argument>-database.0</argument>
<argument>file:hsql/locanda.sql</argument>
<argument>-dbname.0</argument>
<argument>locanda</argument>
<argument>&amp;</argument>
</arguments>
</configuration>
</execution> -->
<!-- <execution>
<phase>compile</phase>
<goals>
<goal>exec</goal>
</goals>
<configuration>
<executable>hsql/runserver.sh</executable>
<arguments>
<argument>locanda.sql</argument>
<argument>&amp;</argument>
</arguments>
</configuration>
</execution> -->
</executions>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>org.hsqldb</groupId>
<artifactId>hsqldb</artifactId>
<version>2.2.9</version>
<scope>runtime</scope>
</dependency>
</dependencies>

</profile>
</profiles>

<build>
<sourceDirectory>src</sourceDirectory>
<directory>${basedir}/${project.name}_target</directory>
Expand All @@ -43,24 +90,6 @@
</resource>
</resources>
<plugins>
<!-- <plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>properties-maven-plugin</artifactId>
<version>1.0-alpha-2</version>
<executions>
<execution>
<phase>initialize</phase>
<goals>
<goal>read-project-properties</goal>
</goals>
<configuration>
<files>
<file>global.properties</file>
</files>
</configuration>
</execution>
</executions>
</plugin> -->
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.3.2</version>
Expand All @@ -75,10 +104,10 @@
<version>2.3</version>
<configuration>
<archive>
<manifest>
<addClasspath>true</addClasspath>
</manifest>
</archive>
<manifest>
<addClasspath>true</addClasspath>
</manifest>
</archive>
<webXml>webroot\WEB-INF\web.xml</webXml>
<webResources>
<resource>
Expand All @@ -103,7 +132,7 @@
</plugin>
</plugins>
</build>

<dependencies>
<dependency>
<groupId>org.apache.struts</groupId>
Expand Down Expand Up @@ -361,12 +390,6 @@
<version>7.0.33</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.hsqldb</groupId>
<artifactId>hsqldb</artifactId>
<version>2.2.9</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.apache.tomcat</groupId>
<artifactId>tomcat-jdbc</artifactId>
Expand Down
5 changes: 0 additions & 5 deletions src/resources/ConventionResource.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -42,7 +40,6 @@
@Component
@Scope("prototype")
public class ConventionResource {

@Autowired
private ConventionService conventionService = null;
@Autowired
Expand Down Expand Up @@ -267,6 +264,4 @@ public void setSolrServerConvention(SolrServer solrServerConvention) {
this.solrServerConvention = solrServerConvention;
}



}
1 change: 0 additions & 1 deletion src/resources/ExtraResource.java
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@
@Component
@Scope("prototype")
public class ExtraResource {

@Autowired
private ExtraService extraService = null;
@Autowired
Expand Down
4 changes: 1 addition & 3 deletions src/resources/FileResource.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -105,8 +105,6 @@ public String updateIe(
// TODO Auto-generated catch block
e.printStackTrace();
}


return str;
}

Expand Down
1 change: 0 additions & 1 deletion src/resources/GuestResource.java
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@
@Component
@Scope("prototype")
public class GuestResource {

@Autowired
private GuestService guestService = null;
@Autowired
Expand Down
1 change: 0 additions & 1 deletion src/resources/PeriodResource.java
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@
@Component
@Scope("prototype")
public class PeriodResource {

@Autowired
private PeriodService periodService = null;
@Autowired
Expand Down
26 changes: 1 addition & 25 deletions src/resources/RoomFacilityResource.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
}






}
}
Loading

0 comments on commit a05bc10

Please sign in to comment.