diff --git a/samples/airline/client/axis1/build.xml b/samples/airline/client/axis1/build.xml index 3d2a26ad..1d94af0c 100644 --- a/samples/airline/client/axis1/build.xml +++ b/samples/airline/client/axis1/build.xml @@ -10,13 +10,10 @@ - + - - - @@ -25,11 +22,7 @@ - - - - - + diff --git a/samples/airline/client/jaxws/build.xml b/samples/airline/client/jaxws/build.xml index d3f8e694..47166fa6 100644 --- a/samples/airline/client/jaxws/build.xml +++ b/samples/airline/client/jaxws/build.xml @@ -9,15 +9,11 @@ - + - - - @@ -27,12 +23,10 @@ - - diff --git a/samples/airline/client/readme.txt b/samples/airline/client/readme.txt index 09c4ac41..f8037cbc 100644 --- a/samples/airline/client/readme.txt +++ b/samples/airline/client/readme.txt @@ -2,7 +2,7 @@ SPRING WEB SERVICES Client table of contents --------------------------------------------------- -* axis - A client for the airline service written in Java using JAX-RPC (Axis 1). +* axis1 - A client for the airline service written in Java using JAX-RPC (Axis 1). * cs - A client for the airline service written in C#. * jax-ws - A client for the airline service written in Java using JAX-WS. * saaj - Two clients that are written in Java and use SAAJ. diff --git a/samples/airline/client/saaj/build.xml b/samples/airline/client/saaj/build.xml index 09701933..b819bb93 100644 --- a/samples/airline/client/saaj/build.xml +++ b/samples/airline/client/saaj/build.xml @@ -8,22 +8,17 @@ - + - - - - diff --git a/samples/airline/hsqldb/build.xml b/samples/airline/hsqldb/build.xml new file mode 100644 index 00000000..5488845a --- /dev/null +++ b/samples/airline/hsqldb/build.xml @@ -0,0 +1,35 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/samples/airline/pom.xml b/samples/airline/pom.xml index a41c4b9d..367fee52 100644 --- a/samples/airline/pom.xml +++ b/samples/airline/pom.xml @@ -9,7 +9,148 @@ airline war Spring WS Airline Sample + + + hsqldb + + true + + + + hsqldb + hsqldb + 1.8.0.7 + runtime + + + + + org.hsqldb.jdbcDriver + sa + + jdbc:hsqldb:hsql://localhost/airline + org.hibernate.dialect.HSQLDialect + + + + + org.codehaus.mojo + sql-maven-plugin + + + hsqldb + hsqldb + 1.8.0.7 + + + + ${jdbc.driverClassName} + ${jdbc.url} + ${jdbc.username} + ${jdbc.password} + + ${basedir}/src/main/sql/hsqldb/airline-schema.sql + ${basedir}/src/main/sql/airline-dataload.sql + + + + + + + + mysql + + + mysql + mysql-connector-java + 5.0.4 + + + + + com.mysql.jdbc.Driver + airline + airline + jdbc:mysql://localhost/airline + org.hibernate.dialect.MySQLInnoDBDialect + + + + + org.codehaus.mojo + sql-maven-plugin + + + mysql + mysql-connector-java + 5.0.4 + + + + ${jdbc.driverClassName} + ${jdbc.url} + ${jdbc.username} + ${jdbc.password} + + ${basedir}/src/main/sql/mysql/airline-schema.sql + ${basedir}/src/main/sql/airline-dataload.sql + + + + + + + + postgresql + + + postgresql + postgresql + 8.1-407.jdbc3 + + + + + org.postgresql.Driver + airline + airline + jdbc:postgresql://localhost/airline + org.hibernate.dialect.PostgreSQLDialect + + + + + org.codehaus.mojo + sql-maven-plugin + + + postgresql + postgresql + 8.1-407.jdbc3 + + + + ${jdbc.driverClassName} + ${jdbc.url} + ${jdbc.username} + ${jdbc.password} + + ${basedir}/src/main/sql/postgresql/airline-schema.sql + ${basedir}/src/main/sql/airline-dataload.sql + + + + + + + + + + src/main/resources + true + + org.apache.maven.plugins @@ -155,9 +296,10 @@ - mysql - mysql-connector-java - 5.0.4 + hsqldb + hsqldb + 1.8.0.7 + test diff --git a/samples/airline/readme.txt b/samples/airline/readme.txt index 1699a78e..60c6c05d 100644 --- a/samples/airline/readme.txt +++ b/samples/airline/readme.txt @@ -8,29 +8,34 @@ Features a web service on top of an airline reservation system, backed by a data Marshalling techniques (JAXB 1), and JDOM in combination with XPath queries to pull information from a message. All messages follow the airline.xsd schema in src/main/webapp. -Multiple clients are available, showing interoperability with Axis 1, SAAJ, C#, JMS and more. +Multiple clients are available, showing interoperability with Axis 1, SAAJ, C#, and more. 2. INSTALLATION -The Airline sample is a normal web application that connects to a database of your choice. +The Airline sample is a normal web application that connects to a database of your choice. By using Maven2 profiles, it +supports three databases: HSQLDB (the easiest to setup), MySQL, or PostgreSQL. -1. Create a database using one of the scripts in src/etc/db. First, initialize the database using either the MySQL or - PostgreSQL initDB.sql script, and after that run src/etc/db/populateDb.sql. -2. Adjust the jdbc.properties in src/main/resources/org/springframework/ws/samples/airline/dao - to reflect your database connection settings. By default MySQL is used. -3. Adjust the hibernate.properties in src/main/resources/org/springframework/ws/samples/airline/dao/hibernate. By - default MySQL is used. -4. (Optional) Adjust the applicationContext-ws-jms.xml in src/main/resources/org/springframework/ws/samples/airline/ws/ - to reflect your JMS connections settings. By default ActiveMQ 2.1 is used. Make sure to start ActiveMQ before -4. run "mvn package" and deploy the war file generated in target; or run "mvn jetty:run" to run the sample - using the Jetty Web container built into Maven 2. -5. +To execute the sample with the supplied HSQLDB: -Note that both MySQL drivers are linked in using Maven so you don't have include these in your server if you're using -this database. +1. Start a command shell in the subdirectory hsqldb, and run "ant". This starts a HSQLDB server with a database named + airline. +2. Run "mvn sql:execute" to create the schema and insert data into the database. +3. Run "mvn jetty:run" to run the sample in the Jetty6 Web container. + +To execute the sample with MySQL or PostgreSQL: + +1. Change the properties in the pom.xml file to reflect your database connection settings. There are three profiles + (one for each supported database), so make sure to edit the right section. The areas to change are indicated with + comments. +2. Run "mvn -P sql:execute", where is "mysql" or "postgresql", to create the schema and insert + data into the database. +3. Run "mvn -P jetty:run", where is "mysql" or "postgresql", to run the sample in the Jetty6 + Web container. + +To create a war file instead of running in Jetty, follow the steps above, but replace the "jetty:run" with "package" in +the last step. 3. THE CLIENTS The client directory contains a number of sample clients. More instructions are provided in the readme files in the -directories. - +directories. \ No newline at end of file diff --git a/samples/airline/src/etc/db/mysql/dropDB.sql b/samples/airline/src/etc/db/mysql/dropDB.sql deleted file mode 100644 index c91a0015..00000000 --- a/samples/airline/src/etc/db/mysql/dropDB.sql +++ /dev/null @@ -1 +0,0 @@ -DROP DATABASE IF EXISTS airline; diff --git a/samples/airline/src/etc/db/postgresql/dropDB.sql b/samples/airline/src/etc/db/postgresql/dropDB.sql deleted file mode 100644 index 1ea5d56d..00000000 --- a/samples/airline/src/etc/db/postgresql/dropDB.sql +++ /dev/null @@ -1,6 +0,0 @@ -DROP TABLE FREQUENT_FLYER; -DROP TABLE PASSENGER_TICKET; -DROP TABLE PASSENGER; -DROP TABLE TICKET; -DROP TABLE FLIGHT; -DROP TABLE AIRPORT; diff --git a/samples/airline/src/main/resources/org/springframework/ws/samples/airline/dao/hibernate/hibernate.properties b/samples/airline/src/main/resources/org/springframework/ws/samples/airline/dao/hibernate/hibernate.properties index ee1d84fe..de246a14 100644 --- a/samples/airline/src/main/resources/org/springframework/ws/samples/airline/dao/hibernate/hibernate.properties +++ b/samples/airline/src/main/resources/org/springframework/ws/samples/airline/dao/hibernate/hibernate.properties @@ -1,8 +1,6 @@ # Properties file with hibernate-related settings. -#hibernate.dialect=org.hibernate.dialect.HSQLDialect -hibernate.dialect=org.hibernate.dialect.MySQLInnoDBDialect -#hibernate.dialect=org.hibernate.dialect.PostgreSQLDialect +hibernate.dialect=${hibernate.dialect} hibernate.cache.provider_class=org.hibernate.cache.HashtableCacheProvider #hibernate.hbm2ddl.auto=create-drop #hibernate.show_sql=true diff --git a/samples/airline/src/main/resources/org/springframework/ws/samples/airline/dao/jdbc.properties b/samples/airline/src/main/resources/org/springframework/ws/samples/airline/dao/jdbc.properties index e71f5bb9..b566d1f0 100644 --- a/samples/airline/src/main/resources/org/springframework/ws/samples/airline/dao/jdbc.properties +++ b/samples/airline/src/main/resources/org/springframework/ws/samples/airline/dao/jdbc.properties @@ -1,14 +1,4 @@ -#jdbc.driverClassName=org.hsqldb.jdbcDriver -#jdbc.username=sa -#jdbc.password= -#jdbc.url=jdbc:hsqldb:mem:airline - -jdbc.driverClassName=com.mysql.jdbc.Driver -jdbc.username=airline -jdbc.password=airline -jdbc.url=jdbc:mysql://localhost/airline - -#jdbc.driverClassName=org.postgresql.Driver -#jdbc.username=airline -#jdbc.password=airline -#jdbc.url=jdbc:postgresql://localhost/airline \ No newline at end of file +jdbc.driverClassName=${jdbc.driverClassName} +jdbc.username=${jdbc.username} +jdbc.password=${jdbc.password} +jdbc.url=${jdbc.url} \ No newline at end of file diff --git a/samples/airline/src/etc/db/populateDB.sql b/samples/airline/src/main/sql/airline-dataload.sql similarity index 100% rename from samples/airline/src/etc/db/populateDB.sql rename to samples/airline/src/main/sql/airline-dataload.sql diff --git a/samples/airline/src/main/sql/hsqldb/airline-schema.sql b/samples/airline/src/main/sql/hsqldb/airline-schema.sql new file mode 100644 index 00000000..c51d829e --- /dev/null +++ b/samples/airline/src/main/sql/hsqldb/airline-schema.sql @@ -0,0 +1,61 @@ +DROP TABLE FREQUENT_FLYER IF EXISTS; +DROP TABLE PASSENGER_TICKET IF EXISTS; +DROP TABLE PASSENGER IF EXISTS; +DROP TABLE TICKET IF EXISTS; +DROP TABLE FLIGHT IF EXISTS; +DROP TABLE AIRPORT IF EXISTS; + +CREATE TABLE AIRPORT ( + CODE char(3) NOT NULL, + NAME varchar(20) NOT NULL, + CITY varchar(255) NOT NULL, + PRIMARY KEY (CODE) +); + +CREATE TABLE FLIGHT ( + ID BIGINT GENERATED BY DEFAULT AS IDENTITY (START WITH 1), + NUMBER VARCHAR(20) NOT NULL, + DEPARTURE_TIME TIMESTAMP NOT NULL, + FROM_AIRPORT_CODE CHAR(3) NOT NULL, + ARRIVAL_TIME TIMESTAMP NOT NULL, + TO_AIRPORT_CODE CHAR(3) NOT NULL, + SEATS_AVAILABLE INT NOT NULL, + SERVICE_CLASS VARCHAR(10) NOT NULL, + MILES INT NOT NULL, + PRIMARY KEY (ID), + UNIQUE (NUMBER, DEPARTURE_TIME), + CONSTRAINT FK_FLIGHT_AIRPORT_FROM FOREIGN KEY (FROM_AIRPORT_CODE) REFERENCES AIRPORT, + CONSTRAINT FK_FLIGHT_AIRPORT_TO FOREIGN KEY (TO_AIRPORT_CODE) REFERENCES AIRPORT +); + +CREATE TABLE TICKET ( + ID BIGINT GENERATED BY DEFAULT AS IDENTITY (START WITH 1), + ISSUE_DATE DATE NOT NULL, + FLIGHT_ID BIGINT NOT NULL, + PRIMARY KEY (ID), + CONSTRAINT FK_TICKET_FLIGHT FOREIGN KEY (FLIGHT_ID) REFERENCES FLIGHT +); + +CREATE TABLE PASSENGER ( + ID BIGINT GENERATED BY DEFAULT AS IDENTITY (START WITH 1), + FIRST_NAME VARCHAR(30), + LAST_NAME VARCHAR(30), + PRIMARY KEY (ID) +); + +CREATE TABLE PASSENGER_TICKET ( + TICKET_ID BIGINT NOT NULL, + PASSENGER_ID BIGINT NOT NULL, + PRIMARY KEY (TICKET_ID, PASSENGER_ID), + CONSTRAINT PASSENGER_TICKET_TICKET FOREIGN KEY (TICKET_ID) REFERENCES TICKET, + CONSTRAINT PASSENGER_TICKET_PASSENGER FOREIGN KEY (PASSENGER_ID) REFERENCES PASSENGER +); + +CREATE TABLE FREQUENT_FLYER ( + PASSENGER_ID BIGINT NOT NULL, + MILES INTEGER, + PASSWORD VARCHAR(255), + USERNAME VARCHAR(255), + PRIMARY KEY (PASSENGER_ID), + CONSTRAINT FREQUENT_FLYER_PASSENGER FOREIGN KEY (PASSENGER_ID) REFERENCES PASSENGER +) \ No newline at end of file diff --git a/samples/airline/src/etc/db/mysql/initDB.sql b/samples/airline/src/main/sql/mysql/airline-schema.sql similarity index 81% rename from samples/airline/src/etc/db/mysql/initDB.sql rename to samples/airline/src/main/sql/mysql/airline-schema.sql index 7d16f9ce..f9a48ee5 100644 --- a/samples/airline/src/etc/db/mysql/initDB.sql +++ b/samples/airline/src/main/sql/mysql/airline-schema.sql @@ -1,14 +1,17 @@ -CREATE DATABASE IF NOT EXISTS airline; +USE AIRLINE; -GRANT ALL ON airline.* TO airline@localhost IDENTIFIED BY 'airline'; - -USE airline; +DROP TABLE IF EXISTS FREQUENT_FLYER; +DROP TABLE IF EXISTS PASSENGER_TICKET; +DROP TABLE IF EXISTS PASSENGER; +DROP TABLE IF EXISTS TICKET; +DROP TABLE IF EXISTS FLIGHT; +DROP TABLE IF EXISTS AIRPORT; CREATE TABLE AIRPORT ( CODE CHAR(3) NOT NULL PRIMARY KEY, NAME VARCHAR(20) NOT NULL, CITY VARCHAR(20) NOT NULL -); +) TYPE=INNODB; CREATE TABLE FLIGHT ( ID INT(4) UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY, @@ -21,24 +24,24 @@ CREATE TABLE FLIGHT ( SEATS_AVAILABLE INT(4) UNSIGNED NOT NULL, MILES INT(4) UNSIGNED NOT NULL, UNIQUE KEY IDX_NUMBER_DEPARTURE_TIME (NUMBER, DEPARTURE_TIME) -); +) TYPE=INNODB; CREATE TABLE TICKET ( ID INT(4) UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY, ISSUE_DATE DATE NOT NULL, FLIGHT_ID INT(4) UNSIGNED NOT NULL REFERENCES FLIGHT(ID) -); +) TYPE=INNODB; CREATE TABLE PASSENGER ( ID INT(4) UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY, FIRST_NAME VARCHAR(30), LAST_NAME VARCHAR(30) -); +) TYPE=INNODB; CREATE TABLE PASSENGER_TICKET ( PASSENGER_ID INT(4) UNSIGNED NOT NULL REFERENCES PASSENGER(ID), TICKET_ID INT(4) UNSIGNED NOT NULL REFERENCES TICKET(ID) -); +) TYPE=INNODB; CREATE TABLE FREQUENT_FLYER ( PASSENGER_ID INT(4) UNSIGNED NOT NULL PRIMARY KEY REFERENCES PASSENGER(ID), @@ -46,7 +49,7 @@ CREATE TABLE FREQUENT_FLYER ( PASSWORD VARCHAR(10) NOT NULL, MILES INT(4) UNSIGNED NOT NULL, UNIQUE KEY IDX_USERNAME (USERNAME) -); +) TYPE=INNODB; diff --git a/samples/airline/src/etc/db/postgresql/initDB.sql b/samples/airline/src/main/sql/postgresql/airline-schema.sql similarity index 89% rename from samples/airline/src/etc/db/postgresql/initDB.sql rename to samples/airline/src/main/sql/postgresql/airline-schema.sql index 63bd12ee..ba9039c3 100644 --- a/samples/airline/src/etc/db/postgresql/initDB.sql +++ b/samples/airline/src/main/sql/postgresql/airline-schema.sql @@ -1,5 +1,9 @@ -CREATE DATABASE airline; -GRANT ALL ON DATABASE airline to airline; +DROP TABLE FREQUENT_FLYER; +DROP TABLE PASSENGER_TICKET; +DROP TABLE PASSENGER; +DROP TABLE TICKET; +DROP TABLE FLIGHT; +DROP TABLE AIRPORT; CREATE TABLE AIRPORT ( CODE CHAR(3) NOT NULL PRIMARY KEY, diff --git a/samples/airline/src/test/resources/org/springframework/ws/samples/airline/dao/hibernate/hibernate.properties b/samples/airline/src/test/resources/org/springframework/ws/samples/airline/dao/hibernate/hibernate.properties new file mode 100644 index 00000000..19aee7d9 --- /dev/null +++ b/samples/airline/src/test/resources/org/springframework/ws/samples/airline/dao/hibernate/hibernate.properties @@ -0,0 +1,6 @@ +# Test-specific settings for the DAO layer +# Uses an in-memory HSQL database + +hibernate.dialect=org.hibernate.dialect.HSQLDialect +hibernate.cache.provider_class=org.hibernate.cache.HashtableCacheProvider +hibernate.hbm2ddl.auto=create-drop \ No newline at end of file diff --git a/samples/airline/src/test/resources/org/springframework/ws/samples/airline/dao/jdbc.properties b/samples/airline/src/test/resources/org/springframework/ws/samples/airline/dao/jdbc.properties new file mode 100644 index 00000000..0f470851 --- /dev/null +++ b/samples/airline/src/test/resources/org/springframework/ws/samples/airline/dao/jdbc.properties @@ -0,0 +1,7 @@ +# Test-specific settings for the DAO layer +# Uses an in-memory HSQL database + +jdbc.driverClassName=org.hsqldb.jdbcDriver +jdbc.username=sa +jdbc.password= +jdbc.url=jdbc:hsqldb:mem:airline diff --git a/samples/echo/client/maven-artifact-ant-2.0.4-dep.jar b/samples/echo/client/maven-artifact-ant-2.0.4-dep.jar deleted file mode 100644 index 4c18c9a5..00000000 Binary files a/samples/echo/client/maven-artifact-ant-2.0.4-dep.jar and /dev/null differ diff --git a/samples/echo/client/saaj/build.xml b/samples/echo/client/saaj/build.xml index d62ce8d6..777cc079 100644 --- a/samples/echo/client/saaj/build.xml +++ b/samples/echo/client/saaj/build.xml @@ -7,7 +7,7 @@ - + diff --git a/samples/echo/client/spring-ws/build.xml b/samples/echo/client/spring-ws/build.xml index 4757875d..f984d82f 100644 --- a/samples/echo/client/spring-ws/build.xml +++ b/samples/echo/client/spring-ws/build.xml @@ -7,7 +7,7 @@ - + diff --git a/samples/airline/client/maven-artifact-ant-2.0.4-dep.jar b/samples/maven-artifact-ant-2.0.4-dep.jar similarity index 100% rename from samples/airline/client/maven-artifact-ant-2.0.4-dep.jar rename to samples/maven-artifact-ant-2.0.4-dep.jar