diff --git a/org.springframework.samples.petclinic/.classpath b/org.springframework.samples.petclinic/.classpath deleted file mode 100644 index b60cdffa6b5..00000000000 --- a/org.springframework.samples.petclinic/.classpath +++ /dev/null @@ -1,43 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/org.springframework.samples.petclinic/.project b/org.springframework.samples.petclinic/.project deleted file mode 100644 index a13e65aab77..00000000000 --- a/org.springframework.samples.petclinic/.project +++ /dev/null @@ -1,36 +0,0 @@ - - - org.springframework.samples.petclinic - - - - - - org.eclipse.wst.jsdt.core.javascriptValidator - - - - - org.eclipse.jdt.core.javabuilder - - - - - org.eclipse.wst.common.project.facet.core.builder - - - - - org.eclipse.wst.validation.validationbuilder - - - - - - org.eclipse.wst.common.project.facet.core.nature - org.eclipse.jdt.core.javanature - org.eclipse.wst.common.modulecore.ModuleCoreNature - org.eclipse.jem.workbench.JavaEMFNature - org.eclipse.wst.jsdt.core.jsNature - - diff --git a/org.springframework.samples.petclinic/.settings/.jsdtscope b/org.springframework.samples.petclinic/.settings/.jsdtscope deleted file mode 100644 index bbb8e68be8f..00000000000 --- a/org.springframework.samples.petclinic/.settings/.jsdtscope +++ /dev/null @@ -1,11 +0,0 @@ - - - - - - - - - - - diff --git a/org.springframework.samples.petclinic/.settings/com.springsource.server.ide.jdt.core.xml b/org.springframework.samples.petclinic/.settings/com.springsource.server.ide.jdt.core.xml deleted file mode 100644 index 0a4413c52ce..00000000000 --- a/org.springframework.samples.petclinic/.settings/com.springsource.server.ide.jdt.core.xml +++ /dev/null @@ -1,2 +0,0 @@ - - diff --git a/org.springframework.samples.petclinic/.settings/org.eclipse.jdt.core.prefs b/org.springframework.samples.petclinic/.settings/org.eclipse.jdt.core.prefs deleted file mode 100644 index 05a6a07cb3a..00000000000 --- a/org.springframework.samples.petclinic/.settings/org.eclipse.jdt.core.prefs +++ /dev/null @@ -1,12 +0,0 @@ -#Sun Oct 04 15:30:45 PDT 2009 -eclipse.preferences.version=1 -org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5 -org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve -org.eclipse.jdt.core.compiler.compliance=1.5 -org.eclipse.jdt.core.compiler.debug.lineNumber=generate -org.eclipse.jdt.core.compiler.debug.localVariable=generate -org.eclipse.jdt.core.compiler.debug.sourceFile=generate -org.eclipse.jdt.core.compiler.problem.assertIdentifier=error -org.eclipse.jdt.core.compiler.problem.enumIdentifier=error -org.eclipse.jdt.core.compiler.source=1.5 diff --git a/org.springframework.samples.petclinic/.settings/org.eclipse.jst.common.project.facet.core.prefs b/org.springframework.samples.petclinic/.settings/org.eclipse.jst.common.project.facet.core.prefs deleted file mode 100644 index a280a863d9e..00000000000 --- a/org.springframework.samples.petclinic/.settings/org.eclipse.jst.common.project.facet.core.prefs +++ /dev/null @@ -1,3 +0,0 @@ -#Mon Mar 02 16:00:20 PST 2009 -classpath.helper/org.eclipse.jdt.launching.JRE_CONTAINER\:\:org.eclipse.jdt.internal.launching.macosx.MacOSXType\:\:JVM\ 1.6/owners=jst.java\:5.0 -eclipse.preferences.version=1 diff --git a/org.springframework.samples.petclinic/.settings/org.eclipse.jst.jsp.core.prefs b/org.springframework.samples.petclinic/.settings/org.eclipse.jst.jsp.core.prefs deleted file mode 100644 index 6113940c3c3..00000000000 --- a/org.springframework.samples.petclinic/.settings/org.eclipse.jst.jsp.core.prefs +++ /dev/null @@ -1,29 +0,0 @@ -#Mon Mar 02 16:00:20 PST 2009 -eclipse.preferences.version=1 -validateFragments=false -validation.actions-missing-required-attribute=1 -validation.actions-non-empty-inline-tag=2 -validation.actions-unknown-attribute=2 -validation.directive-include-fragment-file-not-found=1 -validation.directive-include-fragment-file-not-specified=1 -validation.directive-taglib-duplicate-prefixes-different-uris=1 -validation.directive-taglib-duplicate-prefixes-same-uris=-1 -validation.directive-taglib-missing-prefix=1 -validation.directive-taglib-missing-uri-or-tagdir=1 -validation.directive-taglib-unresolvable-uri-or-tagdir=2 -validation.el-general-syntax=1 -validation.el-lexical-failure=-1 -validation.java-=-1 -validation.java-local-variable-is-never-used=-1 -validation.java-null-local-variable-reference=-1 -validation.java-potential-null-local-variable-reference=-1 -validation.java-unused-import=-1 -validation.translation-tag-class-not-found=2 -validation.translation-tei-class-not-found=2 -validation.translation-tei-class-not-instantiated=2 -validation.translation-tei-class-runtime-exception=2 -validation.translation-tei-message=1 -validation.translation-usebean-ambiguous-type-info=2 -validation.translation-usebean-invalid-id=1 -validation.translation-usebean-missing-type-info=1 -validation.use-project-settings=true diff --git a/org.springframework.samples.petclinic/.settings/org.eclipse.wst.common.component b/org.springframework.samples.petclinic/.settings/org.eclipse.wst.common.component deleted file mode 100644 index b24fdeedbc2..00000000000 --- a/org.springframework.samples.petclinic/.settings/org.eclipse.wst.common.component +++ /dev/null @@ -1,13 +0,0 @@ - - - - - - - - - - - - - diff --git a/org.springframework.samples.petclinic/.settings/org.eclipse.wst.common.project.facet.core.xml b/org.springframework.samples.petclinic/.settings/org.eclipse.wst.common.project.facet.core.xml deleted file mode 100644 index c477e06156e..00000000000 --- a/org.springframework.samples.petclinic/.settings/org.eclipse.wst.common.project.facet.core.xml +++ /dev/null @@ -1,7 +0,0 @@ - - - - - - - diff --git a/org.springframework.samples.petclinic/.settings/org.eclipse.wst.html.core.prefs b/org.springframework.samples.petclinic/.settings/org.eclipse.wst.html.core.prefs deleted file mode 100644 index e12d34f8b18..00000000000 --- a/org.springframework.samples.petclinic/.settings/org.eclipse.wst.html.core.prefs +++ /dev/null @@ -1,37 +0,0 @@ -#Mon Mar 02 18:15:04 PST 2009 -attrDuplicate=2 -attrInvalidName=2 -attrInvalidValue=2 -attrNameMismatch=2 -attrUndefName=2 -attrUndefValue=2 -attrValueMismatch=1 -attrValueUnclosed=2 -cdataInvalidContent=2 -cdataUnclosed=1 -commentInvalidContent=2 -commentUnclosed=1 -docDoctypeUnclosed=1 -docDuplicateTag=1 -docInvalidChar=2 -docInvalidContent=2 -eclipse.preferences.version=1 -elemCoexistence=2 -elemDuplicate=2 -elemEndInvalidCase=1 -elemInvalidContent=2 -elemInvalidDirective=1 -elemInvalidEmptyTag=2 -elemInvalidName=1 -elemMissingEnd=2 -elemMissingStart=2 -elemStartInvalidCase=2 -elemUnclosedEndTag=1 -elemUnclosedStartTag=1 -elemUnknownName=2 -elemUnnecessaryEnd=2 -piInvalidContent=2 -piUnclosed=1 -piUndefined=2 -refInvalidContent=2 -use-project-settings=true diff --git a/org.springframework.samples.petclinic/.settings/org.eclipse.wst.jsdt.ui.superType.container b/org.springframework.samples.petclinic/.settings/org.eclipse.wst.jsdt.ui.superType.container deleted file mode 100644 index 3bd5d0a4803..00000000000 --- a/org.springframework.samples.petclinic/.settings/org.eclipse.wst.jsdt.ui.superType.container +++ /dev/null @@ -1 +0,0 @@ -org.eclipse.wst.jsdt.launching.baseBrowserLibrary \ No newline at end of file diff --git a/org.springframework.samples.petclinic/.settings/org.eclipse.wst.jsdt.ui.superType.name b/org.springframework.samples.petclinic/.settings/org.eclipse.wst.jsdt.ui.superType.name deleted file mode 100644 index 05bd71b6ec2..00000000000 --- a/org.springframework.samples.petclinic/.settings/org.eclipse.wst.jsdt.ui.superType.name +++ /dev/null @@ -1 +0,0 @@ -Window \ No newline at end of file diff --git a/org.springframework.samples.petclinic/build.xml b/org.springframework.samples.petclinic/build.xml deleted file mode 100644 index 5a9d4bb381f..00000000000 --- a/org.springframework.samples.petclinic/build.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - diff --git a/org.springframework.samples.petclinic/db/build.xml b/org.springframework.samples.petclinic/db/build.xml deleted file mode 100644 index b6d09936b01..00000000000 --- a/org.springframework.samples.petclinic/db/build.xml +++ /dev/null @@ -1,85 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/org.springframework.samples.petclinic/db/dropTables.txt b/org.springframework.samples.petclinic/db/dropTables.txt deleted file mode 100644 index 90ae6329f90..00000000000 --- a/org.springframework.samples.petclinic/db/dropTables.txt +++ /dev/null @@ -1,7 +0,0 @@ -DROP TABLE visits; -DROP TABLE pets; -DROP TABLE owners; -DROP TABLE types; -DROP TABLE vet_specialties; -DROP TABLE specialties; -DROP TABLE vets; diff --git a/org.springframework.samples.petclinic/db/emptyDB.txt b/org.springframework.samples.petclinic/db/emptyDB.txt deleted file mode 100644 index d5dd8728c0e..00000000000 --- a/org.springframework.samples.petclinic/db/emptyDB.txt +++ /dev/null @@ -1,7 +0,0 @@ -DELETE FROM vets; -DELETE FROM specialties; -DELETE FROM vet_specialties; -DELETE FROM types; -DELETE FROM owners; -DELETE FROM pets; -DELETE FROM visits; diff --git a/org.springframework.samples.petclinic/db/mysql/createDB.txt b/org.springframework.samples.petclinic/db/mysql/createDB.txt deleted file mode 100644 index 5b4b3859e9a..00000000000 --- a/org.springframework.samples.petclinic/db/mysql/createDB.txt +++ /dev/null @@ -1,3 +0,0 @@ -CREATE DATABASE petclinic; - -GRANT ALL PRIVILEGES ON petclinic.* TO pc@localhost IDENTIFIED BY 'pc'; \ No newline at end of file diff --git a/org.springframework.samples.petclinic/db/mysql/dropDB.txt b/org.springframework.samples.petclinic/db/mysql/dropDB.txt deleted file mode 100644 index e1209da0e5e..00000000000 --- a/org.springframework.samples.petclinic/db/mysql/dropDB.txt +++ /dev/null @@ -1 +0,0 @@ -DROP DATABASE petclinic; diff --git a/org.springframework.samples.petclinic/db/mysql/initDB.txt b/org.springframework.samples.petclinic/db/mysql/initDB.txt deleted file mode 100644 index 0007ee3a339..00000000000 --- a/org.springframework.samples.petclinic/db/mysql/initDB.txt +++ /dev/null @@ -1,58 +0,0 @@ -USE petclinic; - -CREATE TABLE vets ( - id INT(4) UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY, - first_name VARCHAR(30), - last_name VARCHAR(30), - INDEX(last_name) -) engine=InnoDB; - -CREATE TABLE specialties ( - id INT(4) UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY, - name VARCHAR(80), - INDEX(name) -) engine=InnoDB; - -CREATE TABLE vet_specialties ( - vet_id INT(4) UNSIGNED NOT NULL, - specialty_id INT(4) UNSIGNED NOT NULL -) engine=InnoDB; -ALTER TABLE vet_specialties ADD CONSTRAINT fk_vet_specialties_vets FOREIGN KEY (vet_id) REFERENCES vets(id); -ALTER TABLE vet_specialties ADD CONSTRAINT fk_vet_specialties_specialties FOREIGN KEY (specialty_id) REFERENCES specialties(id); - -CREATE TABLE types ( - id INT(4) UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY, - name VARCHAR(80), - INDEX(name) -) engine=InnoDB; - -CREATE TABLE owners ( - id INT(4) UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY, - first_name VARCHAR(30), - last_name VARCHAR(30), - address VARCHAR(255), - city VARCHAR(80), - telephone VARCHAR(20), - INDEX(last_name) -) engine=InnoDB; - -CREATE TABLE pets ( - id INT(4) UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY, - name VARCHAR(30), - birth_date DATE, - type_id INT(4) UNSIGNED NOT NULL, - owner_id INT(4) UNSIGNED NOT NULL, - INDEX(name) -) engine=InnoDB; -ALTER TABLE pets ADD CONSTRAINT fk_pets_owners FOREIGN KEY (owner_id) REFERENCES owners(id); -ALTER TABLE pets ADD CONSTRAINT fk_pets_types FOREIGN KEY (type_id) REFERENCES types(id); -CREATE INDEX pets_name ON pets(name); - -CREATE TABLE visits ( - id INT(4) UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY, - pet_id INT(4) UNSIGNED NOT NULL, - visit_date DATE, - description VARCHAR(255), - INDEX(pet_id) -) engine=InnoDB; -ALTER TABLE visits ADD CONSTRAINT fk_visits_pets FOREIGN KEY (pet_id) REFERENCES pets(id); diff --git a/org.springframework.samples.petclinic/db/mysql/petclinic_db_setup_mysql.txt b/org.springframework.samples.petclinic/db/mysql/petclinic_db_setup_mysql.txt deleted file mode 100644 index 66727e190aa..00000000000 --- a/org.springframework.samples.petclinic/db/mysql/petclinic_db_setup_mysql.txt +++ /dev/null @@ -1,22 +0,0 @@ -================================================================================ -=== Spring PetClinic sample application - MySQL Configuration === -================================================================================ - -@author Sam Brannen - --------------------------------------------------------------------------------- - -1) Download and install the MySQL database (e.g., MySQL Community Server 5.1.x), - which can be found here: http://dev.mysql.com/downloads/ - -2) Download Connector/J, the MySQL JDBC driver (e.g., Connector/J 5.1.x), which - can be found here: http://dev.mysql.com/downloads/connector/j/ - Copy the Connector/J JAR file (e.g., mysql-connector-java-5.1.5-bin.jar) into - the db/mysql directory. - -3) Create the PetClinic database and user by executing the "db/mysql/createDB.txt" - script. - -4) Open "src/main/resources/jdbc.properties"; comment out all properties in the - "HSQL Settings" section; uncomment all properties in the "MySQL Settings" - section. \ No newline at end of file diff --git a/org.springframework.samples.petclinic/db/mysql/petclinic_tomcat_mysql.xml b/org.springframework.samples.petclinic/db/mysql/petclinic_tomcat_mysql.xml deleted file mode 100644 index d1c5a3b04e3..00000000000 --- a/org.springframework.samples.petclinic/db/mysql/petclinic_tomcat_mysql.xml +++ /dev/null @@ -1,64 +0,0 @@ - - - - - - - - - - factory - org.apache.commons.dbcp.BasicDataSourceFactory - - - - driverClassName - org.gjt.mm.mysql.Driver - - - - url - jdbc:mysql://localhost:3306/petclinic?autoReconnect=true - - - username - pc - - - password - pc - - - - maxActive - 50 - - - maxIdle - 10 - - - maxWait - 10000 - - - removeAbandoned - true - - - removeAbandonedTimeout - 60 - - - logAbandoned - true - - - - - diff --git a/org.springframework.samples.petclinic/db/petclinic_tomcat_all.xml b/org.springframework.samples.petclinic/db/petclinic_tomcat_all.xml deleted file mode 100644 index ed45c5cd339..00000000000 --- a/org.springframework.samples.petclinic/db/petclinic_tomcat_all.xml +++ /dev/null @@ -1,112 +0,0 @@ - - - - - - - - - - - factory - org.apache.commons.dbcp.BasicDataSourceFactory - - - - driverClassName - org.hsqldb.jdbcDriver - - - url - jdbc:hsqldb:hsql://localhost:9001 - - - username - sa - - - - maxActive - 50 - - - maxIdle - 10 - - - maxWait - 10000 - - - removeAbandoned - true - - - removeAbandonedTimeout - 60 - - - logAbandoned - true - - - - - - - - factory - org.apache.commons.dbcp.BasicDataSourceFactory - - - - driverClassName - org.gjt.mm.mysql.Driver - - - - url - jdbc:mysql://localhost:3306/petclinic?autoReconnect=true - - - username - pc - - - password - pc - - - - maxActive - 50 - - - maxIdle - 10 - - - maxWait - 10000 - - - removeAbandoned - true - - - removeAbandonedTimeout - 60 - - - logAbandoned - true - - - - - diff --git a/org.springframework.samples.petclinic/db/populateDB.txt b/org.springframework.samples.petclinic/db/populateDB.txt deleted file mode 100644 index 1bf0c4a6edb..00000000000 --- a/org.springframework.samples.petclinic/db/populateDB.txt +++ /dev/null @@ -1,53 +0,0 @@ -INSERT INTO vets VALUES (1, 'James', 'Carter'); -INSERT INTO vets VALUES (2, 'Helen', 'Leary'); -INSERT INTO vets VALUES (3, 'Linda', 'Douglas'); -INSERT INTO vets VALUES (4, 'Rafael', 'Ortega'); -INSERT INTO vets VALUES (5, 'Henry', 'Stevens'); -INSERT INTO vets VALUES (6, 'Sharon', 'Jenkins'); - -INSERT INTO specialties VALUES (1, 'radiology'); -INSERT INTO specialties VALUES (2, 'surgery'); -INSERT INTO specialties VALUES (3, 'dentistry'); - -INSERT INTO vet_specialties VALUES (2, 1); -INSERT INTO vet_specialties VALUES (3, 2); -INSERT INTO vet_specialties VALUES (3, 3); -INSERT INTO vet_specialties VALUES (4, 2); -INSERT INTO vet_specialties VALUES (5, 1); - -INSERT INTO types VALUES (1, 'cat'); -INSERT INTO types VALUES (2, 'dog'); -INSERT INTO types VALUES (3, 'lizard'); -INSERT INTO types VALUES (4, 'snake'); -INSERT INTO types VALUES (5, 'bird'); -INSERT INTO types VALUES (6, 'hamster'); - -INSERT INTO owners VALUES (1, 'George', 'Franklin', '110 W. Liberty St.', 'Madison', '6085551023'); -INSERT INTO owners VALUES (2, 'Betty', 'Davis', '638 Cardinal Ave.', 'Sun Prairie', '6085551749'); -INSERT INTO owners VALUES (3, 'Eduardo', 'Rodriquez', '2693 Commerce St.', 'McFarland', '6085558763'); -INSERT INTO owners VALUES (4, 'Harold', 'Davis', '563 Friendly St.', 'Windsor', '6085553198'); -INSERT INTO owners VALUES (5, 'Peter', 'McTavish', '2387 S. Fair Way', 'Madison', '6085552765'); -INSERT INTO owners VALUES (6, 'Jean', 'Coleman', '105 N. Lake St.', 'Monona', '6085552654'); -INSERT INTO owners VALUES (7, 'Jeff', 'Black', '1450 Oak Blvd.', 'Monona', '6085555387'); -INSERT INTO owners VALUES (8, 'Maria', 'Escobito', '345 Maple St.', 'Madison', '6085557683'); -INSERT INTO owners VALUES (9, 'David', 'Schroeder', '2749 Blackhawk Trail', 'Madison', '6085559435'); -INSERT INTO owners VALUES (10, 'Carlos', 'Estaban', '2335 Independence La.', 'Waunakee', '6085555487'); - -INSERT INTO pets VALUES (1, 'Leo', '2000-09-07', 1, 1); -INSERT INTO pets VALUES (2, 'Basil', '2002-08-06', 6, 2); -INSERT INTO pets VALUES (3, 'Rosy', '2001-04-17', 2, 3); -INSERT INTO pets VALUES (4, 'Jewel', '2000-03-07', 2, 3); -INSERT INTO pets VALUES (5, 'Iggy', '2000-11-30', 3, 4); -INSERT INTO pets VALUES (6, 'George', '2000-01-20', 4, 5); -INSERT INTO pets VALUES (7, 'Samantha', '1995-09-04', 1, 6); -INSERT INTO pets VALUES (8, 'Max', '1995-09-04', 1, 6); -INSERT INTO pets VALUES (9, 'Lucky', '1999-08-06', 5, 7); -INSERT INTO pets VALUES (10, 'Mulligan', '1997-02-24', 2, 8); -INSERT INTO pets VALUES (11, 'Freddy', '2000-03-09', 5, 9); -INSERT INTO pets VALUES (12, 'Lucky', '2000-06-24', 2, 10); -INSERT INTO pets VALUES (13, 'Sly', '2002-06-08', 1, 10); - -INSERT INTO visits VALUES (1, 7, '1996-03-04', 'rabies shot'); -INSERT INTO visits VALUES (2, 8, '1996-03-04', 'rabies shot'); -INSERT INTO visits VALUES (3, 8, '1996-06-04', 'neutered'); -INSERT INTO visits VALUES (4, 7, '1996-09-04', 'spayed'); diff --git a/org.springframework.samples.petclinic/ivy.xml b/org.springframework.samples.petclinic/ivy.xml deleted file mode 100644 index 07676225b46..00000000000 --- a/org.springframework.samples.petclinic/ivy.xml +++ /dev/null @@ -1,55 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/org.springframework.samples.petclinic/petclinic.iml b/org.springframework.samples.petclinic/petclinic.iml deleted file mode 100644 index 134ccb6324c..00000000000 --- a/org.springframework.samples.petclinic/petclinic.iml +++ /dev/null @@ -1,211 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - jar://$IVY_CACHE$/org.apache.taglibs/com.springsource.org.apache.taglibs.standard/1.1.2/com.springsource.org.apache.taglibs.standard-1.1.2.jar!/ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/org.springframework.samples.petclinic/readme.txt b/org.springframework.samples.petclinic/readme.txt deleted file mode 100644 index aee19b7ffee..00000000000 --- a/org.springframework.samples.petclinic/readme.txt +++ /dev/null @@ -1,105 +0,0 @@ -========================================================================== -=== Spring PetClinic Sample Application -========================================================================== - -@author Ken Krebs -@author Juergen Hoeller -@author Rob Harrop -@author Costin Leau -@author Sam Brannen -@author Scott Andrews - -========================================================================== -=== Data Access Strategies -========================================================================== - -PetClinic features alternative DAO implementations and application -configurations for JDBC, Hibernate, and JPA, with HSQLDB and MySQL as -target databases. The default PetClinic configuration is JDBC on HSQLDB. -See "src/main/resources/jdbc.properties" as well as web.xml and -applicationContext-*.xml in the "src/main/webapp/WEB-INF" folder for -details. A simple comment change in web.xml switches between the data -access strategies. - -The JDBC and Hibernate versions of PetClinic also demonstrate JMX support -via the use of for exporting MBeans. -SimpleJdbcClinic exposes the SimpleJdbcClinicMBean management interface -via JMX through the use of the @ManagedResource and @ManagedOperation -annotations; whereas, the HibernateStatistics service is exposed via JMX -through auto-detection of the service MBean. You can start up the JDK's -JConsole to manage the exported bean. - -All data access strategies can work with JTA for transaction management by -activating the JtaTransactionManager and a JndiObjectFactoryBean that -refers to a transactional container DataSource. The default for JDBC is -DataSourceTransactionManager; for Hibernate, HibernateTransactionManager; -for JPA, JpaTransactionManager. Those local strategies allow for working -with any locally defined DataSource. - -Note that the sample configurations for JDBC, Hibernate, and JPA configure -a BasicDataSource from the Apache Commons DBCP project for connection -pooling. - -========================================================================== -=== Build and Deployment -========================================================================== - -The Spring PetClinic sample application is built using Spring Build, which -is a custom build solution based on Ant and Ivy for dependency management. -For deployment, the web application needs to be built with Apache Ant 1.6 -or higher. When the project is first built, Spring Build will use Ivy to -automatically download all required dependencies. Thus the initial build -may take a few minutes depending on the speed of your Internet connection, -but subsequent builds will be much faster. - -Available build commands: - -- ant clean --> cleans the project -- ant clean test --> cleans the project and runs all tests -- ant clean jar --> cleans the project and builds the WAR - -After building the project with "ant clean jar", you will find the -resulting WAR file in the "target/artifacts" directory. By default, an -embedded HSQLDB instance in configured. No other steps are necessary to -get the data source up and running: you can simply deploy the built WAR -file directly to your Servlet container. - -For MySQL, you'll need to use the corresponding schema and SQL scripts in -the "db/mysql" subdirectory. Follow the steps outlined in -"db/mysql/petclinic_db_setup_mysql.txt" for explicit details. - -In you intend to use a local DataSource, the JDBC settings can be adapted -in "src/main/resources/jdbc.properties". To use a JTA DataSource, you need -to set up corresponding DataSources in your Java EE container. - -Notes on enabling Log4J: - - Log4J is disabled by default due to issues with JBoss. - - Uncomment the Log4J listener in "WEB-INF/web.xml" to enable logging. - -========================================================================== -=== JPA on Tomcat -========================================================================== - -This section provides tips on using the Java Persistence API (JPA) on -Apache Tomcat 4.x or higher with a persistence provider that requires -class instrumentation (such as TopLink Essentials). - -To use JPA class instrumentation, Tomcat has to be instructed to use a -custom class loader which supports instrumentation. See the JPA section of -the Spring reference manual for complete details. - -The basic steps are: - - Copy "org.springframework.instrument.tomcat-3.0.0.RELEASE.jar" from the - Spring distribution to "TOMCAT_HOME/server/lib". - - If you're running on Tomcat 5.x, modify "TOMCAT_HOME/conf/server.xml" - and add a new "" element for 'petclinic' (see below). You can - alternatively deploy the WAR including "META-INF/context.xml" from this - sample application's "src/main/webapp" directory, in which case you - will need to uncomment the Loader element in that file to enable the - use of the TomcatInstrumentableClassLoader. - - - - - ... - diff --git a/org.springframework.samples.petclinic/src/main/java/org/springframework/samples/petclinic/BaseEntity.java b/org.springframework.samples.petclinic/src/main/java/org/springframework/samples/petclinic/BaseEntity.java deleted file mode 100644 index bb68af4fc01..00000000000 --- a/org.springframework.samples.petclinic/src/main/java/org/springframework/samples/petclinic/BaseEntity.java +++ /dev/null @@ -1,27 +0,0 @@ -package org.springframework.samples.petclinic; - -/** - * Simple JavaBean domain object with an id property. - * Used as a base class for objects needing this property. - * - * @author Ken Krebs - * @author Juergen Hoeller - */ -public class BaseEntity { - - private Integer id; - - - public void setId(Integer id) { - this.id = id; - } - - public Integer getId() { - return id; - } - - public boolean isNew() { - return (this.id == null); - } - -} diff --git a/org.springframework.samples.petclinic/src/main/java/org/springframework/samples/petclinic/Clinic.java b/org.springframework.samples.petclinic/src/main/java/org/springframework/samples/petclinic/Clinic.java deleted file mode 100644 index e48e8507b35..00000000000 --- a/org.springframework.samples.petclinic/src/main/java/org/springframework/samples/petclinic/Clinic.java +++ /dev/null @@ -1,82 +0,0 @@ -package org.springframework.samples.petclinic; - -import java.util.Collection; - -import org.springframework.dao.DataAccessException; - -/** - * The high-level PetClinic business interface. - * - *

This is basically a data access object. - * PetClinic doesn't have a dedicated business facade. - * - * @author Ken Krebs - * @author Juergen Hoeller - * @author Sam Brannen - */ -public interface Clinic { - - /** - * Retrieve all Vets from the data store. - * @return a Collection of Vets - */ - Collection getVets() throws DataAccessException; - - /** - * Retrieve all PetTypes from the data store. - * @return a Collection of PetTypes - */ - Collection getPetTypes() throws DataAccessException; - - /** - * Retrieve Owners from the data store by last name, - * returning all owners whose last name starts with the given name. - * @param lastName Value to search for - * @return a Collection of matching Owners - * (or an empty Collection if none found) - */ - Collection findOwners(String lastName) throws DataAccessException; - - /** - * Retrieve an Owner from the data store by id. - * @param id the id to search for - * @return the Owner if found - * @throws org.springframework.dao.DataRetrievalFailureException if not found - */ - Owner loadOwner(int id) throws DataAccessException; - - /** - * Retrieve a Pet from the data store by id. - * @param id the id to search for - * @return the Pet if found - * @throws org.springframework.dao.DataRetrievalFailureException if not found - */ - Pet loadPet(int id) throws DataAccessException; - - /** - * Save an Owner to the data store, either inserting or updating it. - * @param owner the Owner to save - * @see BaseEntity#isNew - */ - void storeOwner(Owner owner) throws DataAccessException; - - /** - * Save a Pet to the data store, either inserting or updating it. - * @param pet the Pet to save - * @see BaseEntity#isNew - */ - void storePet(Pet pet) throws DataAccessException; - - /** - * Save a Visit to the data store, either inserting or updating it. - * @param visit the Visit to save - * @see BaseEntity#isNew - */ - void storeVisit(Visit visit) throws DataAccessException; - - /** - * Deletes a Pet from the data store. - */ - void deletePet(int id) throws DataAccessException; - -} diff --git a/org.springframework.samples.petclinic/src/main/java/org/springframework/samples/petclinic/NamedEntity.java b/org.springframework.samples.petclinic/src/main/java/org/springframework/samples/petclinic/NamedEntity.java deleted file mode 100644 index 40c5931d86d..00000000000 --- a/org.springframework.samples.petclinic/src/main/java/org/springframework/samples/petclinic/NamedEntity.java +++ /dev/null @@ -1,28 +0,0 @@ -package org.springframework.samples.petclinic; - -/** - * Simple JavaBean domain object adds a name property to BaseEntity. - * Used as a base class for objects needing these properties. - * - * @author Ken Krebs - * @author Juergen Hoeller - */ -public class NamedEntity extends BaseEntity { - - private String name; - - - public void setName(String name) { - this.name = name; - } - - public String getName() { - return this.name; - } - - @Override - public String toString() { - return this.getName(); - } - -} diff --git a/org.springframework.samples.petclinic/src/main/java/org/springframework/samples/petclinic/Owner.java b/org.springframework.samples.petclinic/src/main/java/org/springframework/samples/petclinic/Owner.java deleted file mode 100644 index 75ea3bc064c..00000000000 --- a/org.springframework.samples.petclinic/src/main/java/org/springframework/samples/petclinic/Owner.java +++ /dev/null @@ -1,127 +0,0 @@ -package org.springframework.samples.petclinic; - -import java.util.ArrayList; -import java.util.Collections; -import java.util.HashSet; -import java.util.List; -import java.util.Set; - -import org.springframework.beans.support.MutableSortDefinition; -import org.springframework.beans.support.PropertyComparator; -import org.springframework.core.style.ToStringCreator; - -/** - * Simple JavaBean domain object representing an owner. - * - * @author Ken Krebs - * @author Juergen Hoeller - * @author Sam Brannen - */ -public class Owner extends Person { - - private String address; - - private String city; - - private String telephone; - - private Set pets; - - - public String getAddress() { - return this.address; - } - - public void setAddress(String address) { - this.address = address; - } - - public String getCity() { - return this.city; - } - - public void setCity(String city) { - this.city = city; - } - - public String getTelephone() { - return this.telephone; - } - - public void setTelephone(String telephone) { - this.telephone = telephone; - } - - protected void setPetsInternal(Set pets) { - this.pets = pets; - } - - protected Set getPetsInternal() { - if (this.pets == null) { - this.pets = new HashSet(); - } - return this.pets; - } - - public List getPets() { - List sortedPets = new ArrayList(getPetsInternal()); - PropertyComparator.sort(sortedPets, new MutableSortDefinition("name", true, true)); - return Collections.unmodifiableList(sortedPets); - } - - public void addPet(Pet pet) { - getPetsInternal().add(pet); - pet.setOwner(this); - } - - /** - * Return the Pet with the given name, or null if none found for this Owner. - * - * @param name to test - * @return true if pet name is already in use - */ - public Pet getPet(String name) { - return getPet(name, false); - } - - /** - * Return the Pet with the given name, or null if none found for this Owner. - * - * @param name to test - * @return true if pet name is already in use - */ - public Pet getPet(String name, boolean ignoreNew) { - name = name.toLowerCase(); - for (Pet pet : getPetsInternal()) { - if (!ignoreNew || !pet.isNew()) { - String compName = pet.getName(); - compName = compName.toLowerCase(); - if (compName.equals(name)) { - return pet; - } - } - } - return null; - } - - @Override - public String toString() { - return new ToStringCreator(this) - - .append("id", this.getId()) - - .append("new", this.isNew()) - - .append("lastName", this.getLastName()) - - .append("firstName", this.getFirstName()) - - .append("address", this.address) - - .append("city", this.city) - - .append("telephone", this.telephone) - - .toString(); - } -} diff --git a/org.springframework.samples.petclinic/src/main/java/org/springframework/samples/petclinic/Person.java b/org.springframework.samples.petclinic/src/main/java/org/springframework/samples/petclinic/Person.java deleted file mode 100644 index da7974a7de7..00000000000 --- a/org.springframework.samples.petclinic/src/main/java/org/springframework/samples/petclinic/Person.java +++ /dev/null @@ -1,32 +0,0 @@ -package org.springframework.samples.petclinic; - -/** - * Simple JavaBean domain object representing an person. - * - * @author Ken Krebs - */ -public class Person extends BaseEntity { - - private String firstName; - - private String lastName; - - public String getFirstName() { - return this.firstName; - } - - public void setFirstName(String firstName) { - this.firstName = firstName; - } - - public String getLastName() { - return this.lastName; - } - - public void setLastName(String lastName) { - this.lastName = lastName; - } - - - -} diff --git a/org.springframework.samples.petclinic/src/main/java/org/springframework/samples/petclinic/Pet.java b/org.springframework.samples.petclinic/src/main/java/org/springframework/samples/petclinic/Pet.java deleted file mode 100644 index f5294b5ca9f..00000000000 --- a/org.springframework.samples.petclinic/src/main/java/org/springframework/samples/petclinic/Pet.java +++ /dev/null @@ -1,77 +0,0 @@ -package org.springframework.samples.petclinic; - -import java.util.ArrayList; -import java.util.Collections; -import java.util.Date; -import java.util.HashSet; -import java.util.List; -import java.util.Set; - -import org.springframework.beans.support.MutableSortDefinition; -import org.springframework.beans.support.PropertyComparator; - -/** - * Simple JavaBean business object representing a pet. - * - * @author Ken Krebs - * @author Juergen Hoeller - * @author Sam Brannen - */ -public class Pet extends NamedEntity { - - private Date birthDate; - - private PetType type; - - private Owner owner; - - private Set visits; - - - public void setBirthDate(Date birthDate) { - this.birthDate = birthDate; - } - - public Date getBirthDate() { - return this.birthDate; - } - - public void setType(PetType type) { - this.type = type; - } - - public PetType getType() { - return this.type; - } - - protected void setOwner(Owner owner) { - this.owner = owner; - } - - public Owner getOwner() { - return this.owner; - } - - protected void setVisitsInternal(Set visits) { - this.visits = visits; - } - - protected Set getVisitsInternal() { - if (this.visits == null) { - this.visits = new HashSet(); - } - return this.visits; - } - - public List getVisits() { - List sortedVisits = new ArrayList(getVisitsInternal()); - PropertyComparator.sort(sortedVisits, new MutableSortDefinition("date", false, false)); - return Collections.unmodifiableList(sortedVisits); - } - - public void addVisit(Visit visit) { - getVisitsInternal().add(visit); - visit.setPet(this); - } - -} diff --git a/org.springframework.samples.petclinic/src/main/java/org/springframework/samples/petclinic/PetType.java b/org.springframework.samples.petclinic/src/main/java/org/springframework/samples/petclinic/PetType.java deleted file mode 100644 index aaadc5c44d0..00000000000 --- a/org.springframework.samples.petclinic/src/main/java/org/springframework/samples/petclinic/PetType.java +++ /dev/null @@ -1,8 +0,0 @@ -package org.springframework.samples.petclinic; - -/** - * @author Juergen Hoeller - */ -public class PetType extends NamedEntity { - -} diff --git a/org.springframework.samples.petclinic/src/main/java/org/springframework/samples/petclinic/Specialty.java b/org.springframework.samples.petclinic/src/main/java/org/springframework/samples/petclinic/Specialty.java deleted file mode 100644 index d19ccaba96e..00000000000 --- a/org.springframework.samples.petclinic/src/main/java/org/springframework/samples/petclinic/Specialty.java +++ /dev/null @@ -1,10 +0,0 @@ -package org.springframework.samples.petclinic; - -/** - * Models a {@link Vet Vet's} specialty (for example, dentistry). - * - * @author Juergen Hoeller - */ -public class Specialty extends NamedEntity { - -} diff --git a/org.springframework.samples.petclinic/src/main/java/org/springframework/samples/petclinic/Vet.java b/org.springframework.samples.petclinic/src/main/java/org/springframework/samples/petclinic/Vet.java deleted file mode 100644 index 9c7c8da0b1c..00000000000 --- a/org.springframework.samples.petclinic/src/main/java/org/springframework/samples/petclinic/Vet.java +++ /dev/null @@ -1,52 +0,0 @@ -package org.springframework.samples.petclinic; - -import java.util.ArrayList; -import java.util.Collections; -import java.util.HashSet; -import java.util.List; -import java.util.Set; -import javax.xml.bind.annotation.XmlElement; - -import org.springframework.beans.support.MutableSortDefinition; -import org.springframework.beans.support.PropertyComparator; - -/** - * Simple JavaBean domain object representing a veterinarian. - * - * @author Ken Krebs - * @author Juergen Hoeller - * @author Sam Brannen - * @author Arjen Poutsma - */ -public class Vet extends Person { - - private Set specialties; - - - protected void setSpecialtiesInternal(Set specialties) { - this.specialties = specialties; - } - - protected Set getSpecialtiesInternal() { - if (this.specialties == null) { - this.specialties = new HashSet(); - } - return this.specialties; - } - - @XmlElement - public List getSpecialties() { - List sortedSpecs = new ArrayList(getSpecialtiesInternal()); - PropertyComparator.sort(sortedSpecs, new MutableSortDefinition("name", true, true)); - return Collections.unmodifiableList(sortedSpecs); - } - - public int getNrOfSpecialties() { - return getSpecialtiesInternal().size(); - } - - public void addSpecialty(Specialty specialty) { - getSpecialtiesInternal().add(specialty); - } - -} diff --git a/org.springframework.samples.petclinic/src/main/java/org/springframework/samples/petclinic/Vets.java b/org.springframework.samples.petclinic/src/main/java/org/springframework/samples/petclinic/Vets.java deleted file mode 100644 index 2e3b25e270a..00000000000 --- a/org.springframework.samples.petclinic/src/main/java/org/springframework/samples/petclinic/Vets.java +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Copyright 2002-2009 the original author or authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.springframework.samples.petclinic; - -import java.util.ArrayList; -import java.util.List; -import javax.xml.bind.annotation.XmlElement; -import javax.xml.bind.annotation.XmlRootElement; - -/** - * Simple JavaBean domain object representing a list of veterinarians. Mostly here to be used for the 'vets' - * {@link org.springframework.web.servlet.view.xml.MarshallingView}. - * - * @author Arjen Poutsma - */ -@XmlRootElement -public class Vets { - - private List vets; - - @XmlElement - public List getVetList() { - if (vets == null) { - vets = new ArrayList(); - } - return vets; - } - -} diff --git a/org.springframework.samples.petclinic/src/main/java/org/springframework/samples/petclinic/Visit.java b/org.springframework.samples.petclinic/src/main/java/org/springframework/samples/petclinic/Visit.java deleted file mode 100644 index c42bdcee5e5..00000000000 --- a/org.springframework.samples.petclinic/src/main/java/org/springframework/samples/petclinic/Visit.java +++ /dev/null @@ -1,70 +0,0 @@ -package org.springframework.samples.petclinic; - -import java.util.Date; - -/** - * Simple JavaBean domain object representing a visit. - * - * @author Ken Krebs - */ -public class Visit extends BaseEntity { - - /** Holds value of property date. */ - private Date date; - - /** Holds value of property description. */ - private String description; - - /** Holds value of property pet. */ - private Pet pet; - - - /** Creates a new instance of Visit for the current date */ - public Visit() { - this.date = new Date(); - } - - - /** Getter for property date. - * @return Value of property date. - */ - public Date getDate() { - return this.date; - } - - /** Setter for property date. - * @param date New value of property date. - */ - public void setDate(Date date) { - this.date = date; - } - - /** Getter for property description. - * @return Value of property description. - */ - public String getDescription() { - return this.description; - } - - /** Setter for property description. - * @param description New value of property description. - */ - public void setDescription(String description) { - this.description = description; - } - - /** Getter for property pet. - * @return Value of property pet. - */ - public Pet getPet() { - return this.pet; - } - - /** Setter for property pet. - * @param pet New value of property pet. - */ - public void setPet(Pet pet) { - this.pet = pet; - } - -} diff --git a/org.springframework.samples.petclinic/src/main/java/org/springframework/samples/petclinic/aspects/AbstractTraceAspect.java b/org.springframework.samples.petclinic/src/main/java/org/springframework/samples/petclinic/aspects/AbstractTraceAspect.java deleted file mode 100644 index 26d32359fc4..00000000000 --- a/org.springframework.samples.petclinic/src/main/java/org/springframework/samples/petclinic/aspects/AbstractTraceAspect.java +++ /dev/null @@ -1,31 +0,0 @@ -package org.springframework.samples.petclinic.aspects; - -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.aspectj.lang.JoinPoint; -import org.aspectj.lang.annotation.Aspect; -import org.aspectj.lang.annotation.Before; -import org.aspectj.lang.annotation.Pointcut; - -/** - * Aspect to illustrate Spring-driven load-time weaving. - * - * @author Ramnivas Laddad - * @since 2.5 - */ -@Aspect -public abstract class AbstractTraceAspect { - - private static final Log logger = LogFactory.getLog(AbstractTraceAspect.class); - - @Pointcut - public abstract void traced(); - - @Before("traced()") - public void trace(JoinPoint.StaticPart jpsp) { - if (logger.isTraceEnabled()) { - logger.trace("Entering " + jpsp.getSignature().toLongString()); - } - } - -} diff --git a/org.springframework.samples.petclinic/src/main/java/org/springframework/samples/petclinic/aspects/CallMonitoringAspect.java b/org.springframework.samples.petclinic/src/main/java/org/springframework/samples/petclinic/aspects/CallMonitoringAspect.java deleted file mode 100644 index 2de4cb41d0a..00000000000 --- a/org.springframework.samples.petclinic/src/main/java/org/springframework/samples/petclinic/aspects/CallMonitoringAspect.java +++ /dev/null @@ -1,81 +0,0 @@ -package org.springframework.samples.petclinic.aspects; - -import org.aspectj.lang.ProceedingJoinPoint; -import org.aspectj.lang.annotation.Around; -import org.aspectj.lang.annotation.Aspect; - -import org.springframework.jmx.export.annotation.ManagedAttribute; -import org.springframework.jmx.export.annotation.ManagedOperation; -import org.springframework.jmx.export.annotation.ManagedResource; -import org.springframework.util.StopWatch; - -/** - * Simple AspectJ aspect that monitors call count and call invocation time. - * Implements the CallMonitor management interface. - * - * @author Rob Harrop - * @author Juergen Hoeller - * @since 2.5 - */ -@ManagedResource("petclinic:type=CallMonitor") -@Aspect -public class CallMonitoringAspect { - - private boolean isEnabled = true; - - private int callCount = 0; - - private long accumulatedCallTime = 0; - - - @ManagedAttribute - public void setEnabled(boolean enabled) { - isEnabled = enabled; - } - - @ManagedAttribute - public boolean isEnabled() { - return isEnabled; - } - - @ManagedOperation - public void reset() { - this.callCount = 0; - this.accumulatedCallTime = 0; - } - - @ManagedAttribute - public int getCallCount() { - return callCount; - } - - @ManagedAttribute - public long getCallTime() { - return (this.callCount > 0 ? this.accumulatedCallTime / this.callCount : 0); - } - - - @Around("within(@org.springframework.stereotype.Service *)") - public Object invoke(ProceedingJoinPoint joinPoint) throws Throwable { - if (this.isEnabled) { - StopWatch sw = new StopWatch(joinPoint.toShortString()); - - sw.start("invoke"); - try { - return joinPoint.proceed(); - } - finally { - sw.stop(); - synchronized (this) { - this.callCount++; - this.accumulatedCallTime += sw.getTotalTimeMillis(); - } - } - } - - else { - return joinPoint.proceed(); - } - } - -} diff --git a/org.springframework.samples.petclinic/src/main/java/org/springframework/samples/petclinic/aspects/UsageLogAspect.java b/org.springframework.samples.petclinic/src/main/java/org/springframework/samples/petclinic/aspects/UsageLogAspect.java deleted file mode 100644 index e326abfb755..00000000000 --- a/org.springframework.samples.petclinic/src/main/java/org/springframework/samples/petclinic/aspects/UsageLogAspect.java +++ /dev/null @@ -1,48 +0,0 @@ -package org.springframework.samples.petclinic.aspects; - -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; - -import org.aspectj.lang.annotation.Aspect; -import org.aspectj.lang.annotation.Before; - -/** - * Sample AspectJ annotation-style aspect that saves - * every owner name requested to the clinic. - * - * @author Rod Johnson - * @author Juergen Hoeller - * @since 2.0 - */ -@Aspect -public class UsageLogAspect { - - private int historySize = 100; - - // Of course saving all names is not suitable for - // production use, but this is a simple example. - private List namesRequested = new ArrayList(this.historySize); - - - public synchronized void setHistorySize(int historySize) { - this.historySize = historySize; - this.namesRequested = new ArrayList(historySize); - } - - @Before("execution(* *.findOwners(String)) && args(name)") - public synchronized void logNameRequest(String name) { - // Not the most efficient implementation, - // but we're aiming to illustrate the power of - // @AspectJ AOP, not write perfect code here :-) - if (this.namesRequested.size() > this.historySize) { - this.namesRequested.remove(0); - } - this.namesRequested.add(name); - } - - public synchronized List getNamesRequested() { - return Collections.unmodifiableList(this.namesRequested); - } - -} diff --git a/org.springframework.samples.petclinic/src/main/java/org/springframework/samples/petclinic/config/DbcpDataSourceFactory.java b/org.springframework.samples.petclinic/src/main/java/org/springframework/samples/petclinic/config/DbcpDataSourceFactory.java deleted file mode 100644 index 0454161e65f..00000000000 --- a/org.springframework.samples.petclinic/src/main/java/org/springframework/samples/petclinic/config/DbcpDataSourceFactory.java +++ /dev/null @@ -1,261 +0,0 @@ -/* - * Copyright 2002-2008 the original author or authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.springframework.samples.petclinic.config; - -import java.io.BufferedReader; -import java.io.BufferedWriter; -import java.io.IOException; -import java.io.InputStream; -import java.io.InputStreamReader; -import java.io.StringWriter; -import java.sql.Connection; -import java.sql.SQLException; -import java.sql.Statement; - -import javax.sql.DataSource; - -import org.apache.commons.dbcp.BasicDataSource; -import org.springframework.beans.factory.DisposableBean; -import org.springframework.beans.factory.FactoryBean; -import org.springframework.core.io.Resource; - -/** - * A factory that creates a data source fit for use in a system environment. Creates a DBCP simple data source - * from the provided connection properties. - * - * This factory returns a fully-initialized DataSource implementation. When the DataSource is returned, callers are - * guaranteed that the database schema and data will have been loaded by that time. - * - * Is a FactoryBean, for exposing the fully-initialized DataSource as a Spring bean. See {@link #getObject()}. - * - * @author Chris Beams - * @author Scott Andrews - */ -public class DbcpDataSourceFactory implements FactoryBean, DisposableBean { - - // configurable properties - - private String driverClassName; - - private String url; - - private String username; - - private String password; - - private boolean populate; - - private Resource schemaLocation; - - private Resource dataLocation; - - private Resource dropLocation; - - /** - * The object created by this factory. - */ - private BasicDataSource dataSource; - - public void setDriverClassName(String driverClassName) { - this.driverClassName = driverClassName; - } - - /** - * The data source connection URL - */ - public void setUrl(String url) { - this.url = url; - } - - /** - * The data source username - */ - public void setUsername(String username) { - this.username = username; - } - - /** - *The data source password - */ - public void setPassword(String password) { - this.password = password; - } - - /** - * Indicates that the data base should be populated from the schema and data locations - */ - public void setPopulate(boolean populate) { - this.populate = populate; - } - - /** - * Sets the location of the file containing the schema DDL to export to the database. - * @param schemaLocation the location of the database schema DDL - */ - public void setSchemaLocation(Resource schemaLocation) { - this.schemaLocation = schemaLocation; - } - - /** - * Sets the location of the file containing the data to load into the database. - * @param testDataLocation the location of the data file - */ - public void setDataLocation(Resource testDataLocation) { - this.dataLocation = testDataLocation; - } - - /** - * Sets the location of the file containing the drop scripts for the database. - * @param testDataLocation the location of the data file - */ - public void setDropLocation(Resource testDropLocation) { - this.dropLocation = testDropLocation; - } - - // implementing FactoryBean - - // this method is called by Spring to expose the DataSource as a bean - public DataSource getObject() throws Exception { - if (dataSource == null) { - initDataSource(); - } - return dataSource; - } - - public Class getObjectType() { - return DataSource.class; - } - - public boolean isSingleton() { - return true; - } - - // implementing DisposableBean - - public void destroy() throws Exception { - dataSource.close(); - } - - // internal helper methods - - // encapsulates the steps involved in initializing the data source: creating it, and populating it - private void initDataSource() { - // create the database source first - this.dataSource = createDataSource(); - - if (this.populate) { - // now populate the database by loading the schema and data - populateDataSource(); - } - } - - private BasicDataSource createDataSource() { - BasicDataSource dataSource = new BasicDataSource(); - dataSource.setDriverClassName(this.driverClassName); - dataSource.setUrl(this.url); - dataSource.setUsername(this.username); - dataSource.setPassword(this.password); - return dataSource; - } - - private void populateDataSource() { - DatabasePopulator populator = new DatabasePopulator(dataSource); - if (dropLocation != null) { - try { - populator.populate(this.dropLocation); - } - catch (Exception e) { - // ignore - } - } - populator.populate(this.schemaLocation); - populator.populate(this.dataLocation); - } - - /** - * Populates a in memory data source with data. - */ - private class DatabasePopulator { - - private DataSource dataSource; - - /** - * Creates a new database populator. - * @param dataSource the data source that will be populated. - */ - public DatabasePopulator(DataSource dataSource) { - this.dataSource = dataSource; - } - - /** - * Populate the database executing the statements in the provided resource against the database - * @param sqlFile spring resource containing SQL to run against the db - */ - public void populate(Resource sqlFile) { - Connection connection = null; - try { - connection = dataSource.getConnection(); - try { - String sql = parseSqlIn(sqlFile); - executeSql(sql, connection); - } catch (IOException e) { - throw new RuntimeException("I/O exception occurred accessing the database schema file", e); - } catch (SQLException e) { - throw new RuntimeException("SQL exception occurred exporting database schema", e); - } - } catch (SQLException e) { - throw new RuntimeException("SQL exception occurred acquiring connection", e); - } finally { - if (connection != null) { - try { - connection.close(); - } catch (SQLException e) { - } - } - } - } - - // utility method to read a .sql txt input stream - private String parseSqlIn(Resource resource) throws IOException { - InputStream is = null; - try { - is = resource.getInputStream(); - BufferedReader reader = new BufferedReader(new InputStreamReader(is)); - - StringWriter sw = new StringWriter(); - BufferedWriter writer = new BufferedWriter(sw); - - for (int c=reader.read(); c != -1; c=reader.read()) { - writer.write(c); - } - writer.flush(); - return sw.toString(); - - } finally { - if (is != null) { - is.close(); - } - } - } - - // utility method to run the parsed sql - private void executeSql(String sql, Connection connection) throws SQLException { - Statement statement = connection.createStatement(); - statement.execute(sql); - } - } - -} diff --git a/org.springframework.samples.petclinic/src/main/java/org/springframework/samples/petclinic/hibernate/HibernateClinic.java b/org.springframework.samples.petclinic/src/main/java/org/springframework/samples/petclinic/hibernate/HibernateClinic.java deleted file mode 100644 index 41163856281..00000000000 --- a/org.springframework.samples.petclinic/src/main/java/org/springframework/samples/petclinic/hibernate/HibernateClinic.java +++ /dev/null @@ -1,98 +0,0 @@ -package org.springframework.samples.petclinic.hibernate; - -import java.util.Collection; - -import org.hibernate.SessionFactory; - -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.dao.DataAccessException; -import org.springframework.samples.petclinic.Clinic; -import org.springframework.samples.petclinic.Owner; -import org.springframework.samples.petclinic.Pet; -import org.springframework.samples.petclinic.PetType; -import org.springframework.samples.petclinic.Vet; -import org.springframework.samples.petclinic.Visit; -import org.springframework.stereotype.Repository; -import org.springframework.transaction.annotation.Transactional; - -/** - * Hibernate implementation of the Clinic interface. - * - *

The mappings are defined in "petclinic.hbm.xml", located in the root of the - * class path. - * - *

Note that transactions are declared with annotations and that some methods - * contain "readOnly = true" which is an optimization that is particularly - * valuable when using Hibernate (to suppress unnecessary flush attempts for - * read-only operations). - * - * @author Juergen Hoeller - * @author Sam Brannen - * @author Mark Fisher - * @since 19.10.2003 - */ -@Repository -@Transactional -public class HibernateClinic implements Clinic { - - private SessionFactory sessionFactory; - - @Autowired - public HibernateClinic(SessionFactory sessionFactory) { - this.sessionFactory = sessionFactory; - } - - @Transactional(readOnly = true) - @SuppressWarnings("unchecked") - public Collection getVets() { - return sessionFactory.getCurrentSession().createQuery("from Vet vet order by vet.lastName, vet.firstName").list(); - } - - @Transactional(readOnly = true) - @SuppressWarnings("unchecked") - public Collection getPetTypes() { - return sessionFactory.getCurrentSession().createQuery("from PetType type order by type.name").list(); - } - - @Transactional(readOnly = true) - @SuppressWarnings("unchecked") - public Collection findOwners(String lastName) { - return sessionFactory.getCurrentSession().createQuery("from Owner owner where owner.lastName like :lastName") - .setString("lastName", lastName + "%").list(); - } - - @Transactional(readOnly = true) - public Owner loadOwner(int id) { - return (Owner) sessionFactory.getCurrentSession().load(Owner.class, id); - } - - @Transactional(readOnly = true) - public Pet loadPet(int id) { - return (Pet) sessionFactory.getCurrentSession().load(Pet.class, id); - } - - public void storeOwner(Owner owner) { - // Note: Hibernate3's merge operation does not reassociate the object - // with the current Hibernate Session. Instead, it will always copy the - // state over to a registered representation of the entity. In case of a - // new entity, it will register a copy as well, but will not update the - // id of the passed-in object. To still update the ids of the original - // objects too, we need to register Spring's - // IdTransferringMergeEventListener on our SessionFactory. - sessionFactory.getCurrentSession().merge(owner); - } - - public void storePet(Pet pet) { - sessionFactory.getCurrentSession().merge(pet); - } - - public void storeVisit(Visit visit) { - sessionFactory.getCurrentSession().merge(visit); - } - - public void deletePet(int id) throws DataAccessException { - Pet pet = loadPet(id); - sessionFactory.getCurrentSession().delete(pet); - } - -} diff --git a/org.springframework.samples.petclinic/src/main/java/org/springframework/samples/petclinic/hibernate/package-info.java b/org.springframework.samples.petclinic/src/main/java/org/springframework/samples/petclinic/hibernate/package-info.java deleted file mode 100644 index 704598b4c74..00000000000 --- a/org.springframework.samples.petclinic/src/main/java/org/springframework/samples/petclinic/hibernate/package-info.java +++ /dev/null @@ -1,9 +0,0 @@ - -/** - * - * The classes in this package represent the Hibernate implementation - * of PetClinic's persistence layer. - * - */ -package org.springframework.samples.petclinic.hibernate; - diff --git a/org.springframework.samples.petclinic/src/main/java/org/springframework/samples/petclinic/jdbc/JdbcPet.java b/org.springframework.samples.petclinic/src/main/java/org/springframework/samples/petclinic/jdbc/JdbcPet.java deleted file mode 100644 index 963ffdfe033..00000000000 --- a/org.springframework.samples.petclinic/src/main/java/org/springframework/samples/petclinic/jdbc/JdbcPet.java +++ /dev/null @@ -1,35 +0,0 @@ -package org.springframework.samples.petclinic.jdbc; - -import org.springframework.samples.petclinic.Pet; - -/** - * Subclass of Pet that carries temporary id properties which - * are only relevant for a JDBC implmentation of the Clinic. - * - * @author Juergen Hoeller - * @see SimpleJdbcClinic - */ -class JdbcPet extends Pet { - - private int typeId; - - private int ownerId; - - - public void setTypeId(int typeId) { - this.typeId = typeId; - } - - public int getTypeId() { - return this.typeId; - } - - public void setOwnerId(int ownerId) { - this.ownerId = ownerId; - } - - public int getOwnerId() { - return this.ownerId; - } - -} diff --git a/org.springframework.samples.petclinic/src/main/java/org/springframework/samples/petclinic/jdbc/SimpleJdbcClinic.java b/org.springframework.samples.petclinic/src/main/java/org/springframework/samples/petclinic/jdbc/SimpleJdbcClinic.java deleted file mode 100644 index 587acecb951..00000000000 --- a/org.springframework.samples.petclinic/src/main/java/org/springframework/samples/petclinic/jdbc/SimpleJdbcClinic.java +++ /dev/null @@ -1,342 +0,0 @@ -package org.springframework.samples.petclinic.jdbc; - -import java.sql.ResultSet; -import java.sql.SQLException; -import java.util.ArrayList; -import java.util.Collection; -import java.util.List; - -import javax.sql.DataSource; - -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; - -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.dao.DataAccessException; -import org.springframework.dao.EmptyResultDataAccessException; -import org.springframework.jdbc.core.namedparam.BeanPropertySqlParameterSource; -import org.springframework.jdbc.core.namedparam.MapSqlParameterSource; -import org.springframework.jdbc.core.simple.ParameterizedBeanPropertyRowMapper; -import org.springframework.jdbc.core.simple.ParameterizedRowMapper; -import org.springframework.jdbc.core.simple.SimpleJdbcInsert; -import org.springframework.jdbc.core.simple.SimpleJdbcTemplate; -import org.springframework.jmx.export.annotation.ManagedOperation; -import org.springframework.jmx.export.annotation.ManagedResource; -import org.springframework.orm.ObjectRetrievalFailureException; -import org.springframework.samples.petclinic.Clinic; -import org.springframework.samples.petclinic.Owner; -import org.springframework.samples.petclinic.Pet; -import org.springframework.samples.petclinic.PetType; -import org.springframework.samples.petclinic.Specialty; -import org.springframework.samples.petclinic.Vet; -import org.springframework.samples.petclinic.Visit; -import org.springframework.samples.petclinic.util.EntityUtils; -import org.springframework.stereotype.Service; -import org.springframework.transaction.annotation.Transactional; - -/** - * A simple JDBC-based implementation of the {@link Clinic} interface. - * - *

This class uses Java 5 language features and the {@link SimpleJdbcTemplate} - * plus {@link SimpleJdbcInsert}. It also takes advantage of classes like - * {@link BeanPropertySqlParameterSource} and - * {@link ParameterizedBeanPropertyRowMapper} which provide automatic mapping - * between JavaBean properties and JDBC parameters or query results. - * - *

SimpleJdbcClinic is a rewrite of the AbstractJdbcClinic which was the base - * class for JDBC implementations of the Clinic interface for Spring 2.0. - * - * @author Ken Krebs - * @author Juergen Hoeller - * @author Rob Harrop - * @author Sam Brannen - * @author Thomas Risberg - * @author Mark Fisher - */ -@Service -@ManagedResource("petclinic:type=Clinic") -public class SimpleJdbcClinic implements Clinic, SimpleJdbcClinicMBean { - - private final Log logger = LogFactory.getLog(getClass()); - - private SimpleJdbcTemplate simpleJdbcTemplate; - - private SimpleJdbcInsert insertOwner; - private SimpleJdbcInsert insertPet; - private SimpleJdbcInsert insertVisit; - - private final List vets = new ArrayList(); - - - @Autowired - public void init(DataSource dataSource) { - this.simpleJdbcTemplate = new SimpleJdbcTemplate(dataSource); - - this.insertOwner = new SimpleJdbcInsert(dataSource) - .withTableName("owners") - .usingGeneratedKeyColumns("id"); - this.insertPet = new SimpleJdbcInsert(dataSource) - .withTableName("pets") - .usingGeneratedKeyColumns("id"); - this.insertVisit = new SimpleJdbcInsert(dataSource) - .withTableName("visits") - .usingGeneratedKeyColumns("id"); - } - - - /** - * Refresh the cache of Vets that the Clinic is holding. - * @see org.springframework.samples.petclinic.Clinic#getVets() - */ - @ManagedOperation - @Transactional(readOnly = true) - public void refreshVetsCache() throws DataAccessException { - synchronized (this.vets) { - this.logger.info("Refreshing vets cache"); - - // Retrieve the list of all vets. - this.vets.clear(); - this.vets.addAll(this.simpleJdbcTemplate.query( - "SELECT id, first_name, last_name FROM vets ORDER BY last_name,first_name", - ParameterizedBeanPropertyRowMapper.newInstance(Vet.class))); - - // Retrieve the list of all possible specialties. - final List specialties = this.simpleJdbcTemplate.query( - "SELECT id, name FROM specialties", - ParameterizedBeanPropertyRowMapper.newInstance(Specialty.class)); - - // Build each vet's list of specialties. - for (Vet vet : this.vets) { - final List vetSpecialtiesIds = this.simpleJdbcTemplate.query( - "SELECT specialty_id FROM vet_specialties WHERE vet_id=?", - new ParameterizedRowMapper() { - public Integer mapRow(ResultSet rs, int row) throws SQLException { - return Integer.valueOf(rs.getInt(1)); - }}, - vet.getId().intValue()); - for (int specialtyId : vetSpecialtiesIds) { - Specialty specialty = EntityUtils.getById(specialties, Specialty.class, specialtyId); - vet.addSpecialty(specialty); - } - } - } - } - - - // START of Clinic implementation section ******************************* - - @Transactional(readOnly = true) - public Collection getVets() throws DataAccessException { - synchronized (this.vets) { - if (this.vets.isEmpty()) { - refreshVetsCache(); - } - return this.vets; - } - } - - @Transactional(readOnly = true) - public Collection getPetTypes() throws DataAccessException { - return this.simpleJdbcTemplate.query( - "SELECT id, name FROM types ORDER BY name", - ParameterizedBeanPropertyRowMapper.newInstance(PetType.class)); - } - - /** - * Loads {@link Owner Owners} from the data store by last name, returning - * all owners whose last name starts with the given name; also loads - * the {@link Pet Pets} and {@link Visit Visits} for the corresponding - * owners, if not already loaded. - */ - @Transactional(readOnly = true) - public Collection findOwners(String lastName) throws DataAccessException { - List owners = this.simpleJdbcTemplate.query( - "SELECT id, first_name, last_name, address, city, telephone FROM owners WHERE last_name like ?", - ParameterizedBeanPropertyRowMapper.newInstance(Owner.class), - lastName + "%"); - loadOwnersPetsAndVisits(owners); - return owners; - } - - /** - * Loads the {@link Owner} with the supplied id; also loads - * the {@link Pet Pets} and {@link Visit Visits} for the corresponding - * owner, if not already loaded. - */ - @Transactional(readOnly = true) - public Owner loadOwner(int id) throws DataAccessException { - Owner owner; - try { - owner = this.simpleJdbcTemplate.queryForObject( - "SELECT id, first_name, last_name, address, city, telephone FROM owners WHERE id=?", - ParameterizedBeanPropertyRowMapper.newInstance(Owner.class), - id); - } - catch (EmptyResultDataAccessException ex) { - throw new ObjectRetrievalFailureException(Owner.class, new Integer(id)); - } - loadPetsAndVisits(owner); - return owner; - } - - @Transactional(readOnly = true) - public Pet loadPet(int id) throws DataAccessException { - JdbcPet pet; - try { - pet = this.simpleJdbcTemplate.queryForObject( - "SELECT id, name, birth_date, type_id, owner_id FROM pets WHERE id=?", - new JdbcPetRowMapper(), - id); - } - catch (EmptyResultDataAccessException ex) { - throw new ObjectRetrievalFailureException(Pet.class, new Integer(id)); - } - Owner owner = loadOwner(pet.getOwnerId()); - owner.addPet(pet); - pet.setType(EntityUtils.getById(getPetTypes(), PetType.class, pet.getTypeId())); - loadVisits(pet); - return pet; - } - - @Transactional - public void storeOwner(Owner owner) throws DataAccessException { - if (owner.isNew()) { - Number newKey = this.insertOwner.executeAndReturnKey( - new BeanPropertySqlParameterSource(owner)); - owner.setId(newKey.intValue()); - } - else { - this.simpleJdbcTemplate.update( - "UPDATE owners SET first_name=:firstName, last_name=:lastName, address=:address, " + - "city=:city, telephone=:telephone WHERE id=:id", - new BeanPropertySqlParameterSource(owner)); - } - } - - @Transactional - public void storePet(Pet pet) throws DataAccessException { - if (pet.isNew()) { - Number newKey = this.insertPet.executeAndReturnKey( - createPetParameterSource(pet)); - pet.setId(newKey.intValue()); - } - else { - this.simpleJdbcTemplate.update( - "UPDATE pets SET name=:name, birth_date=:birth_date, type_id=:type_id, " + - "owner_id=:owner_id WHERE id=:id", - createPetParameterSource(pet)); - } - } - - @Transactional - public void storeVisit(Visit visit) throws DataAccessException { - if (visit.isNew()) { - Number newKey = this.insertVisit.executeAndReturnKey( - createVisitParameterSource(visit)); - visit.setId(newKey.intValue()); - } - else { - throw new UnsupportedOperationException("Visit update not supported"); - } - } - - public void deletePet(int id) throws DataAccessException { - this.simpleJdbcTemplate.update("DELETE FROM pets WHERE id=?", id); - } - - // END of Clinic implementation section ************************************ - - - /** - * Creates a {@link MapSqlParameterSource} based on data values from the - * supplied {@link Pet} instance. - */ - private MapSqlParameterSource createPetParameterSource(Pet pet) { - return new MapSqlParameterSource() - .addValue("id", pet.getId()) - .addValue("name", pet.getName()) - .addValue("birth_date", pet.getBirthDate()) - .addValue("type_id", pet.getType().getId()) - .addValue("owner_id", pet.getOwner().getId()); - } - - /** - * Creates a {@link MapSqlParameterSource} based on data values from the - * supplied {@link Visit} instance. - */ - private MapSqlParameterSource createVisitParameterSource(Visit visit) { - return new MapSqlParameterSource() - .addValue("id", visit.getId()) - .addValue("visit_date", visit.getDate()) - .addValue("description", visit.getDescription()) - .addValue("pet_id", visit.getPet().getId()); - } - - /** - * Loads the {@link Visit} data for the supplied {@link Pet}. - */ - private void loadVisits(JdbcPet pet) { - final List visits = this.simpleJdbcTemplate.query( - "SELECT id, visit_date, description FROM visits WHERE pet_id=?", - new ParameterizedRowMapper() { - public Visit mapRow(ResultSet rs, int row) throws SQLException { - Visit visit = new Visit(); - visit.setId(rs.getInt("id")); - visit.setDate(rs.getTimestamp("visit_date")); - visit.setDescription(rs.getString("description")); - return visit; - } - }, - pet.getId().intValue()); - for (Visit visit : visits) { - pet.addVisit(visit); - } - } - - /** - * Loads the {@link Pet} and {@link Visit} data for the supplied - * {@link Owner}. - */ - private void loadPetsAndVisits(final Owner owner) { - final List pets = this.simpleJdbcTemplate.query( - "SELECT id, name, birth_date, type_id, owner_id FROM pets WHERE owner_id=?", - new JdbcPetRowMapper(), - owner.getId().intValue()); - for (JdbcPet pet : pets) { - owner.addPet(pet); - pet.setType(EntityUtils.getById(getPetTypes(), PetType.class, pet.getTypeId())); - loadVisits(pet); - } - } - - /** - * Loads the {@link Pet} and {@link Visit} data for the supplied - * {@link List} of {@link Owner Owners}. - * - * @param owners the list of owners for whom the pet and visit data should be loaded - * @see #loadPetsAndVisits(Owner) - */ - private void loadOwnersPetsAndVisits(List owners) { - for (Owner owner : owners) { - loadPetsAndVisits(owner); - } - } - - /** - * {@link ParameterizedRowMapper} implementation mapping data from a - * {@link ResultSet} to the corresponding properties of the {@link JdbcPet} class. - */ - private class JdbcPetRowMapper implements ParameterizedRowMapper { - - public JdbcPet mapRow(ResultSet rs, int rownum) throws SQLException { - JdbcPet pet = new JdbcPet(); - pet.setId(rs.getInt("id")); - pet.setName(rs.getString("name")); - pet.setBirthDate(rs.getDate("birth_date")); - pet.setTypeId(rs.getInt("type_id")); - pet.setOwnerId(rs.getInt("owner_id")); - return pet; - } - } - -} diff --git a/org.springframework.samples.petclinic/src/main/java/org/springframework/samples/petclinic/jdbc/SimpleJdbcClinicMBean.java b/org.springframework.samples.petclinic/src/main/java/org/springframework/samples/petclinic/jdbc/SimpleJdbcClinicMBean.java deleted file mode 100644 index c9a7a78478b..00000000000 --- a/org.springframework.samples.petclinic/src/main/java/org/springframework/samples/petclinic/jdbc/SimpleJdbcClinicMBean.java +++ /dev/null @@ -1,20 +0,0 @@ -package org.springframework.samples.petclinic.jdbc; - -/** - * Interface that defines a cache refresh operation. - * To be exposed for management via JMX. - * - * @author Rob Harrop - * @author Juergen Hoeller - * @see SimpleJdbcClinic - */ -public interface SimpleJdbcClinicMBean { - - /** - * Refresh the cache of Vets that the Clinic is holding. - * @see org.springframework.samples.petclinic.Clinic#getVets() - * @see SimpleJdbcClinic#refreshVetsCache() - */ - void refreshVetsCache(); - -} diff --git a/org.springframework.samples.petclinic/src/main/java/org/springframework/samples/petclinic/jdbc/package-info.java b/org.springframework.samples.petclinic/src/main/java/org/springframework/samples/petclinic/jdbc/package-info.java deleted file mode 100644 index 73ea741fe53..00000000000 --- a/org.springframework.samples.petclinic/src/main/java/org/springframework/samples/petclinic/jdbc/package-info.java +++ /dev/null @@ -1,9 +0,0 @@ - -/** - * - * The classes in this package represent the JDBC implementation - * of PetClinic's persistence layer. - * - */ -package org.springframework.samples.petclinic.jdbc; - diff --git a/org.springframework.samples.petclinic/src/main/java/org/springframework/samples/petclinic/jpa/EntityManagerClinic.java b/org.springframework.samples.petclinic/src/main/java/org/springframework/samples/petclinic/jpa/EntityManagerClinic.java deleted file mode 100644 index 92fe1e24771..00000000000 --- a/org.springframework.samples.petclinic/src/main/java/org/springframework/samples/petclinic/jpa/EntityManagerClinic.java +++ /dev/null @@ -1,96 +0,0 @@ -package org.springframework.samples.petclinic.jpa; - -import java.util.Collection; - -import javax.persistence.EntityManager; -import javax.persistence.PersistenceContext; -import javax.persistence.Query; - -import org.springframework.samples.petclinic.Clinic; -import org.springframework.samples.petclinic.Owner; -import org.springframework.samples.petclinic.Pet; -import org.springframework.samples.petclinic.PetType; -import org.springframework.samples.petclinic.Vet; -import org.springframework.samples.petclinic.Visit; -import org.springframework.stereotype.Repository; -import org.springframework.transaction.annotation.Transactional; -import org.springframework.dao.DataAccessException; - -/** - * JPA implementation of the Clinic interface using EntityManager. - * - *

The mappings are defined in "orm.xml" located in the META-INF directory. - * - * @author Mike Keith - * @author Rod Johnson - * @author Sam Brannen - * @since 22.4.2006 - */ -@Repository -@Transactional -public class EntityManagerClinic implements Clinic { - - @PersistenceContext - private EntityManager em; - - - @Transactional(readOnly = true) - @SuppressWarnings("unchecked") - public Collection getVets() { - return this.em.createQuery("SELECT vet FROM Vet vet ORDER BY vet.lastName, vet.firstName").getResultList(); - } - - @Transactional(readOnly = true) - @SuppressWarnings("unchecked") - public Collection getPetTypes() { - return this.em.createQuery("SELECT ptype FROM PetType ptype ORDER BY ptype.name").getResultList(); - } - - @Transactional(readOnly = true) - @SuppressWarnings("unchecked") - public Collection findOwners(String lastName) { - Query query = this.em.createQuery("SELECT owner FROM Owner owner WHERE owner.lastName LIKE :lastName"); - query.setParameter("lastName", lastName + "%"); - return query.getResultList(); - } - - @Transactional(readOnly = true) - public Owner loadOwner(int id) { - return this.em.find(Owner.class, id); - } - - @Transactional(readOnly = true) - public Pet loadPet(int id) { - return this.em.find(Pet.class, id); - } - - public void storeOwner(Owner owner) { - // Consider returning the persistent object here, for exposing - // a newly assigned id using any persistence provider... - Owner merged = this.em.merge(owner); - this.em.flush(); - owner.setId(merged.getId()); - } - - public void storePet(Pet pet) { - // Consider returning the persistent object here, for exposing - // a newly assigned id using any persistence provider... - Pet merged = this.em.merge(pet); - this.em.flush(); - pet.setId(merged.getId()); - } - - public void storeVisit(Visit visit) { - // Consider returning the persistent object here, for exposing - // a newly assigned id using any persistence provider... - Visit merged = this.em.merge(visit); - this.em.flush(); - visit.setId(merged.getId()); - } - - public void deletePet(int id) throws DataAccessException { - Pet pet = loadPet(id); - this.em.remove(pet); - } - -} diff --git a/org.springframework.samples.petclinic/src/main/java/org/springframework/samples/petclinic/jpa/package-info.java b/org.springframework.samples.petclinic/src/main/java/org/springframework/samples/petclinic/jpa/package-info.java deleted file mode 100644 index a03239538e7..00000000000 --- a/org.springframework.samples.petclinic/src/main/java/org/springframework/samples/petclinic/jpa/package-info.java +++ /dev/null @@ -1,9 +0,0 @@ - -/** - * - * The classes in this package represent the JPA implementation - * of PetClinic's persistence layer. - * - */ -package org.springframework.samples.petclinic.jpa; - diff --git a/org.springframework.samples.petclinic/src/main/java/org/springframework/samples/petclinic/package-info.java b/org.springframework.samples.petclinic/src/main/java/org/springframework/samples/petclinic/package-info.java deleted file mode 100644 index a287c4efdac..00000000000 --- a/org.springframework.samples.petclinic/src/main/java/org/springframework/samples/petclinic/package-info.java +++ /dev/null @@ -1,8 +0,0 @@ - -/** - * - * The classes in this package represent PetClinic's business layer. - * - */ -package org.springframework.samples.petclinic; - diff --git a/org.springframework.samples.petclinic/src/main/java/org/springframework/samples/petclinic/toplink/EssentialsHSQLPlatformWithNativeSequence.java b/org.springframework.samples.petclinic/src/main/java/org/springframework/samples/petclinic/toplink/EssentialsHSQLPlatformWithNativeSequence.java deleted file mode 100644 index 1086591decd..00000000000 --- a/org.springframework.samples.petclinic/src/main/java/org/springframework/samples/petclinic/toplink/EssentialsHSQLPlatformWithNativeSequence.java +++ /dev/null @@ -1,56 +0,0 @@ -package org.springframework.samples.petclinic.toplink; - -import java.io.IOException; -import java.io.Writer; - -import oracle.toplink.essentials.exceptions.ValidationException; -import oracle.toplink.essentials.platform.database.HSQLPlatform; -import oracle.toplink.essentials.queryframework.ValueReadQuery; - -/** - * Subclass of the TopLink Essentials default HSQLPlatform class, using native - * HSQLDB identity columns for id generation. - * - *

Necessary for PetClinic's default data model, which relies on identity - * columns: this is uniformly used across all persistence layer implementations - * (JDBC, Hibernate, and JPA). - * - * @author Juergen Hoeller - * @author James Clark - * @since 1.2 - */ -public class EssentialsHSQLPlatformWithNativeSequence extends HSQLPlatform { - - private static final long serialVersionUID = -55658009691346735L; - - - public EssentialsHSQLPlatformWithNativeSequence() { - // setUsesNativeSequencing(true); - } - - @Override - public boolean supportsNativeSequenceNumbers() { - return true; - } - - @Override - public boolean shouldNativeSequenceAcquireValueAfterInsert() { - return true; - } - - @Override - public ValueReadQuery buildSelectQueryForNativeSequence() { - return new ValueReadQuery("CALL IDENTITY()"); - } - - @Override - public void printFieldIdentityClause(Writer writer) throws ValidationException { - try { - writer.write(" IDENTITY"); - } - catch (IOException ex) { - throw ValidationException.fileError(ex); - } - } - -} diff --git a/org.springframework.samples.petclinic/src/main/java/org/springframework/samples/petclinic/toplink/package-info.java b/org.springframework.samples.petclinic/src/main/java/org/springframework/samples/petclinic/toplink/package-info.java deleted file mode 100644 index 0b945fa012b..00000000000 --- a/org.springframework.samples.petclinic/src/main/java/org/springframework/samples/petclinic/toplink/package-info.java +++ /dev/null @@ -1,10 +0,0 @@ - -/** - * - * The classes in this package provide support for using the TopLink - * implementation with PetClinic's EntityManagerClinic. - * - * - */ -package org.springframework.samples.petclinic.toplink; - diff --git a/org.springframework.samples.petclinic/src/main/java/org/springframework/samples/petclinic/util/EntityUtils.java b/org.springframework.samples.petclinic/src/main/java/org/springframework/samples/petclinic/util/EntityUtils.java deleted file mode 100644 index 16df5fa9a91..00000000000 --- a/org.springframework.samples.petclinic/src/main/java/org/springframework/samples/petclinic/util/EntityUtils.java +++ /dev/null @@ -1,41 +0,0 @@ - -package org.springframework.samples.petclinic.util; - -import java.util.Collection; - -import org.springframework.orm.ObjectRetrievalFailureException; -import org.springframework.samples.petclinic.BaseEntity; - -/** - * Utility methods for handling entities. Separate from the BaseEntity class - * mainly because of dependency on the ORM-associated - * ObjectRetrievalFailureException. - * - * @author Juergen Hoeller - * @author Sam Brannen - * @since 29.10.2003 - * @see org.springframework.samples.petclinic.BaseEntity - */ -public abstract class EntityUtils { - - /** - * Look up the entity of the given class with the given id in the given - * collection. - * - * @param entities the collection to search - * @param entityClass the entity class to look up - * @param entityId the entity id to look up - * @return the found entity - * @throws ObjectRetrievalFailureException if the entity was not found - */ - public static T getById(Collection entities, Class entityClass, int entityId) - throws ObjectRetrievalFailureException { - for (T entity : entities) { - if (entity.getId().intValue() == entityId && entityClass.isInstance(entity)) { - return entity; - } - } - throw new ObjectRetrievalFailureException(entityClass, new Integer(entityId)); - } - -} diff --git a/org.springframework.samples.petclinic/src/main/java/org/springframework/samples/petclinic/validation/OwnerValidator.java b/org.springframework.samples.petclinic/src/main/java/org/springframework/samples/petclinic/validation/OwnerValidator.java deleted file mode 100644 index 04b6b7d58af..00000000000 --- a/org.springframework.samples.petclinic/src/main/java/org/springframework/samples/petclinic/validation/OwnerValidator.java +++ /dev/null @@ -1,43 +0,0 @@ -package org.springframework.samples.petclinic.validation; - -import org.springframework.samples.petclinic.Owner; -import org.springframework.util.StringUtils; -import org.springframework.validation.Errors; - -/** - * Validator for Owner forms. - * - * @author Ken Krebs - * @author Juergen Hoeller - */ -public class OwnerValidator { - - public void validate(Owner owner, Errors errors) { - if (!StringUtils.hasLength(owner.getFirstName())) { - errors.rejectValue("firstName", "required", "required"); - } - if (!StringUtils.hasLength(owner.getLastName())) { - errors.rejectValue("lastName", "required", "required"); - } - if (!StringUtils.hasLength(owner.getAddress())) { - errors.rejectValue("address", "required", "required"); - } - if (!StringUtils.hasLength(owner.getCity())) { - errors.rejectValue("city", "required", "required"); - } - - String telephone = owner.getTelephone(); - if (!StringUtils.hasLength(telephone)) { - errors.rejectValue("telephone", "required", "required"); - } - else { - for (int i = 0; i < telephone.length(); ++i) { - if ((Character.isDigit(telephone.charAt(i))) == false) { - errors.rejectValue("telephone", "nonNumeric", "non-numeric"); - break; - } - } - } - } - -} diff --git a/org.springframework.samples.petclinic/src/main/java/org/springframework/samples/petclinic/validation/PetValidator.java b/org.springframework.samples.petclinic/src/main/java/org/springframework/samples/petclinic/validation/PetValidator.java deleted file mode 100644 index 8ad6eb0ac03..00000000000 --- a/org.springframework.samples.petclinic/src/main/java/org/springframework/samples/petclinic/validation/PetValidator.java +++ /dev/null @@ -1,25 +0,0 @@ -package org.springframework.samples.petclinic.validation; - -import org.springframework.samples.petclinic.Pet; -import org.springframework.util.StringUtils; -import org.springframework.validation.Errors; - -/** - * Validator for Pet forms. - * - * @author Ken Krebs - * @author Juergen Hoeller - */ -public class PetValidator { - - public void validate(Pet pet, Errors errors) { - String name = pet.getName(); - if (!StringUtils.hasLength(name)) { - errors.rejectValue("name", "required", "required"); - } - else if (pet.isNew() && pet.getOwner().getPet(name, true) != null) { - errors.rejectValue("name", "duplicate", "already exists"); - } - } - -} diff --git a/org.springframework.samples.petclinic/src/main/java/org/springframework/samples/petclinic/validation/VisitValidator.java b/org.springframework.samples.petclinic/src/main/java/org/springframework/samples/petclinic/validation/VisitValidator.java deleted file mode 100644 index 35c80bafa10..00000000000 --- a/org.springframework.samples.petclinic/src/main/java/org/springframework/samples/petclinic/validation/VisitValidator.java +++ /dev/null @@ -1,21 +0,0 @@ -package org.springframework.samples.petclinic.validation; - -import org.springframework.samples.petclinic.Visit; -import org.springframework.util.StringUtils; -import org.springframework.validation.Errors; - -/** - * Validator for Visit forms. - * - * @author Ken Krebs - * @author Juergen Hoeller - */ -public class VisitValidator { - - public void validate(Visit visit, Errors errors) { - if (!StringUtils.hasLength(visit.getDescription())) { - errors.rejectValue("description", "required", "required"); - } - } - -} diff --git a/org.springframework.samples.petclinic/src/main/java/org/springframework/samples/petclinic/validation/package-info.java b/org.springframework.samples.petclinic/src/main/java/org/springframework/samples/petclinic/validation/package-info.java deleted file mode 100644 index b919a0a12a8..00000000000 --- a/org.springframework.samples.petclinic/src/main/java/org/springframework/samples/petclinic/validation/package-info.java +++ /dev/null @@ -1,9 +0,0 @@ - -/** - * - * The classes in this package represent the set of Validator objects - * the Business Layer makes available to the Presentation Layer. - * - */ -package org.springframework.samples.petclinic.validation; - diff --git a/org.springframework.samples.petclinic/src/main/java/org/springframework/samples/petclinic/web/AddOwnerForm.java b/org.springframework.samples.petclinic/src/main/java/org/springframework/samples/petclinic/web/AddOwnerForm.java deleted file mode 100644 index cd830aff6fb..00000000000 --- a/org.springframework.samples.petclinic/src/main/java/org/springframework/samples/petclinic/web/AddOwnerForm.java +++ /dev/null @@ -1,65 +0,0 @@ - -package org.springframework.samples.petclinic.web; - -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.samples.petclinic.Clinic; -import org.springframework.samples.petclinic.Owner; -import org.springframework.samples.petclinic.validation.OwnerValidator; -import org.springframework.stereotype.Controller; -import org.springframework.ui.Model; -import org.springframework.validation.BindingResult; -import org.springframework.web.bind.WebDataBinder; -import org.springframework.web.bind.annotation.InitBinder; -import org.springframework.web.bind.annotation.ModelAttribute; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RequestMethod; -import org.springframework.web.bind.annotation.SessionAttributes; -import org.springframework.web.bind.support.SessionStatus; - -/** - * JavaBean form controller that is used to add a new Owner to the - * system. - * - * @author Juergen Hoeller - * @author Ken Krebs - * @author Arjen Poutsma - */ -@Controller -@RequestMapping("/owners/new") -@SessionAttributes(types = Owner.class) -public class AddOwnerForm { - - private final Clinic clinic; - - - @Autowired - public AddOwnerForm(Clinic clinic) { - this.clinic = clinic; - } - - @InitBinder - public void setAllowedFields(WebDataBinder dataBinder) { - dataBinder.setDisallowedFields("id"); - } - - @RequestMapping(method = RequestMethod.GET) - public String setupForm(Model model) { - Owner owner = new Owner(); - model.addAttribute(owner); - return "owners/form"; - } - - @RequestMapping(method = RequestMethod.POST) - public String processSubmit(@ModelAttribute Owner owner, BindingResult result, SessionStatus status) { - new OwnerValidator().validate(owner, result); - if (result.hasErrors()) { - return "owners/form"; - } - else { - this.clinic.storeOwner(owner); - status.setComplete(); - return "redirect:/owners/" + owner.getId(); - } - } - -} diff --git a/org.springframework.samples.petclinic/src/main/java/org/springframework/samples/petclinic/web/AddPetForm.java b/org.springframework.samples.petclinic/src/main/java/org/springframework/samples/petclinic/web/AddPetForm.java deleted file mode 100644 index 586cf3d67c5..00000000000 --- a/org.springframework.samples.petclinic/src/main/java/org/springframework/samples/petclinic/web/AddPetForm.java +++ /dev/null @@ -1,77 +0,0 @@ - -package org.springframework.samples.petclinic.web; - -import java.util.Collection; - -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.samples.petclinic.Clinic; -import org.springframework.samples.petclinic.Owner; -import org.springframework.samples.petclinic.Pet; -import org.springframework.samples.petclinic.PetType; -import org.springframework.samples.petclinic.validation.PetValidator; -import org.springframework.stereotype.Controller; -import org.springframework.ui.Model; -import org.springframework.validation.BindingResult; -import org.springframework.web.bind.WebDataBinder; -import org.springframework.web.bind.annotation.InitBinder; -import org.springframework.web.bind.annotation.ModelAttribute; -import org.springframework.web.bind.annotation.PathVariable; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RequestMethod; -import org.springframework.web.bind.annotation.SessionAttributes; -import org.springframework.web.bind.support.SessionStatus; - -/** - * JavaBean form controller that is used to add a new Pet to the - * system. - * - * @author Juergen Hoeller - * @author Ken Krebs - * @author Arjen Poutsma - */ -@Controller -@RequestMapping("/owners/{ownerId}/pets/new") -@SessionAttributes("pet") -public class AddPetForm { - - private final Clinic clinic; - - - @Autowired - public AddPetForm(Clinic clinic) { - this.clinic = clinic; - } - - @ModelAttribute("types") - public Collection populatePetTypes() { - return this.clinic.getPetTypes(); - } - - @InitBinder - public void setAllowedFields(WebDataBinder dataBinder) { - dataBinder.setDisallowedFields("id"); - } - - @RequestMapping(method = RequestMethod.GET) - public String setupForm(@PathVariable("ownerId") int ownerId, Model model) { - Owner owner = this.clinic.loadOwner(ownerId); - Pet pet = new Pet(); - owner.addPet(pet); - model.addAttribute("pet", pet); - return "pets/form"; - } - - @RequestMapping(method = RequestMethod.POST) - public String processSubmit(@ModelAttribute("pet") Pet pet, BindingResult result, SessionStatus status) { - new PetValidator().validate(pet, result); - if (result.hasErrors()) { - return "pets/form"; - } - else { - this.clinic.storePet(pet); - status.setComplete(); - return "redirect:/owners/" + pet.getOwner().getId(); - } - } - -} diff --git a/org.springframework.samples.petclinic/src/main/java/org/springframework/samples/petclinic/web/AddVisitForm.java b/org.springframework.samples.petclinic/src/main/java/org/springframework/samples/petclinic/web/AddVisitForm.java deleted file mode 100644 index 68368644026..00000000000 --- a/org.springframework.samples.petclinic/src/main/java/org/springframework/samples/petclinic/web/AddVisitForm.java +++ /dev/null @@ -1,69 +0,0 @@ - -package org.springframework.samples.petclinic.web; - -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.samples.petclinic.Clinic; -import org.springframework.samples.petclinic.Pet; -import org.springframework.samples.petclinic.Visit; -import org.springframework.samples.petclinic.validation.VisitValidator; -import org.springframework.stereotype.Controller; -import org.springframework.ui.Model; -import org.springframework.validation.BindingResult; -import org.springframework.web.bind.WebDataBinder; -import org.springframework.web.bind.annotation.InitBinder; -import org.springframework.web.bind.annotation.ModelAttribute; -import org.springframework.web.bind.annotation.PathVariable; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RequestMethod; -import org.springframework.web.bind.annotation.SessionAttributes; -import org.springframework.web.bind.support.SessionStatus; - -/** - * JavaBean form controller that is used to add a new Visit to the - * system. - * - * @author Juergen Hoeller - * @author Ken Krebs - * @author Arjen Poutsma - */ -@Controller -@RequestMapping("/owners/*/pets/{petId}/visits/new") -@SessionAttributes("visit") -public class AddVisitForm { - - private final Clinic clinic; - - - @Autowired - public AddVisitForm(Clinic clinic) { - this.clinic = clinic; - } - - @InitBinder - public void setAllowedFields(WebDataBinder dataBinder) { - dataBinder.setDisallowedFields("id"); - } - - @RequestMapping(method = RequestMethod.GET) - public String setupForm(@PathVariable("petId") int petId, Model model) { - Pet pet = this.clinic.loadPet(petId); - Visit visit = new Visit(); - pet.addVisit(visit); - model.addAttribute("visit", visit); - return "pets/visitForm"; - } - - @RequestMapping(method = RequestMethod.POST) - public String processSubmit(@ModelAttribute("visit") Visit visit, BindingResult result, SessionStatus status) { - new VisitValidator().validate(visit, result); - if (result.hasErrors()) { - return "pets/visitForm"; - } - else { - this.clinic.storeVisit(visit); - status.setComplete(); - return "redirect:/owners/" + visit.getPet().getOwner().getId(); - } - } - -} diff --git a/org.springframework.samples.petclinic/src/main/java/org/springframework/samples/petclinic/web/ClinicBindingInitializer.java b/org.springframework.samples.petclinic/src/main/java/org/springframework/samples/petclinic/web/ClinicBindingInitializer.java deleted file mode 100644 index 2d2a8bdc15f..00000000000 --- a/org.springframework.samples.petclinic/src/main/java/org/springframework/samples/petclinic/web/ClinicBindingInitializer.java +++ /dev/null @@ -1,37 +0,0 @@ -package org.springframework.samples.petclinic.web; - -import java.text.SimpleDateFormat; -import java.util.Date; - -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.beans.propertyeditors.CustomDateEditor; -import org.springframework.beans.propertyeditors.StringTrimmerEditor; -import org.springframework.samples.petclinic.Clinic; -import org.springframework.samples.petclinic.PetType; -import org.springframework.web.bind.WebDataBinder; -import org.springframework.web.bind.support.WebBindingInitializer; -import org.springframework.web.context.request.WebRequest; - -/** - * Shared WebBindingInitializer for PetClinic's custom editors. - * - *

Alternatively, such init-binder code may be put into - * {@link org.springframework.web.bind.annotation.InitBinder} - * annotated methods on the controller classes themselves. - * - * @author Juergen Hoeller - */ -public class ClinicBindingInitializer implements WebBindingInitializer { - - @Autowired - private Clinic clinic; - - public void initBinder(WebDataBinder binder, WebRequest request) { - SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd"); - dateFormat.setLenient(false); - binder.registerCustomEditor(Date.class, new CustomDateEditor(dateFormat, false)); - binder.registerCustomEditor(String.class, new StringTrimmerEditor(false)); - binder.registerCustomEditor(PetType.class, new PetTypeEditor(this.clinic)); - } - -} diff --git a/org.springframework.samples.petclinic/src/main/java/org/springframework/samples/petclinic/web/ClinicController.java b/org.springframework.samples.petclinic/src/main/java/org/springframework/samples/petclinic/web/ClinicController.java deleted file mode 100644 index e93ae8f6663..00000000000 --- a/org.springframework.samples.petclinic/src/main/java/org/springframework/samples/petclinic/web/ClinicController.java +++ /dev/null @@ -1,89 +0,0 @@ - -package org.springframework.samples.petclinic.web; - -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.samples.petclinic.Clinic; -import org.springframework.samples.petclinic.Vets; -import org.springframework.stereotype.Controller; -import org.springframework.ui.ModelMap; -import org.springframework.web.bind.annotation.PathVariable; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RequestMethod; -import org.springframework.web.servlet.ModelAndView; - -/** - * Annotation-driven MultiActionController that handles all non-form - * URL's. - * - * @author Juergen Hoeller - * @author Mark Fisher - * @author Ken Krebs - * @author Arjen Poutsma - */ -@Controller -public class ClinicController { - - private final Clinic clinic; - - - @Autowired - public ClinicController(Clinic clinic) { - this.clinic = clinic; - } - - /** - * Custom handler for the welcome view. - *

- * Note that this handler relies on the RequestToViewNameTranslator to - * determine the logical view name based on the request URL: "/welcome.do" - * -> "welcome". - */ - @RequestMapping("/") - public String welcomeHandler() { - return "welcome"; - } - - /** - * Custom handler for displaying vets. - * - *

Note that this handler returns a plain {@link ModelMap} object instead of - * a ModelAndView, thus leveraging convention-based model attribute names. - * It relies on the RequestToViewNameTranslator to determine the logical - * view name based on the request URL: "/vets.do" -> "vets". - * - * @return a ModelMap with the model attributes for the view - */ - @RequestMapping("/vets") - public ModelMap vetsHandler() { - Vets vets = new Vets(); - vets.getVetList().addAll(this.clinic.getVets()); - return new ModelMap(vets); - } - - /** - * Custom handler for displaying an owner. - * - * @param ownerId the ID of the owner to display - * @return a ModelMap with the model attributes for the view - */ - @RequestMapping("/owners/{ownerId}") - public ModelAndView ownerHandler(@PathVariable("ownerId") int ownerId) { - ModelAndView mav = new ModelAndView("owners/show"); - mav.addObject(this.clinic.loadOwner(ownerId)); - return mav; - } - - /** - * Custom handler for displaying an list of visits. - * - * @param petId the ID of the pet whose visits to display - * @return a ModelMap with the model attributes for the view - */ - @RequestMapping(value="/owners/*/pets/{petId}/visits", method=RequestMethod.GET) - public ModelAndView visitsHandler(@PathVariable int petId) { - ModelAndView mav = new ModelAndView("visits"); - mav.addObject("visits", this.clinic.loadPet(petId).getVisits()); - return mav; - } - -} diff --git a/org.springframework.samples.petclinic/src/main/java/org/springframework/samples/petclinic/web/EditOwnerForm.java b/org.springframework.samples.petclinic/src/main/java/org/springframework/samples/petclinic/web/EditOwnerForm.java deleted file mode 100644 index 0b65de51bf6..00000000000 --- a/org.springframework.samples.petclinic/src/main/java/org/springframework/samples/petclinic/web/EditOwnerForm.java +++ /dev/null @@ -1,65 +0,0 @@ - -package org.springframework.samples.petclinic.web; - -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.samples.petclinic.Clinic; -import org.springframework.samples.petclinic.Owner; -import org.springframework.samples.petclinic.validation.OwnerValidator; -import org.springframework.stereotype.Controller; -import org.springframework.ui.Model; -import org.springframework.validation.BindingResult; -import org.springframework.web.bind.WebDataBinder; -import org.springframework.web.bind.annotation.InitBinder; -import org.springframework.web.bind.annotation.ModelAttribute; -import org.springframework.web.bind.annotation.PathVariable; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RequestMethod; -import org.springframework.web.bind.annotation.SessionAttributes; -import org.springframework.web.bind.support.SessionStatus; - -/** - * JavaBean Form controller that is used to edit an existing Owner. - * - * @author Juergen Hoeller - * @author Ken Krebs - * @author Arjen Poutsma - */ -@Controller -@RequestMapping("/owners/{ownerId}/edit") -@SessionAttributes(types = Owner.class) -public class EditOwnerForm { - - private final Clinic clinic; - - - @Autowired - public EditOwnerForm(Clinic clinic) { - this.clinic = clinic; - } - - @InitBinder - public void setAllowedFields(WebDataBinder dataBinder) { - dataBinder.setDisallowedFields("id"); - } - - @RequestMapping(method = RequestMethod.GET) - public String setupForm(@PathVariable("ownerId") int ownerId, Model model) { - Owner owner = this.clinic.loadOwner(ownerId); - model.addAttribute(owner); - return "owners/form"; - } - - @RequestMapping(method = RequestMethod.PUT) - public String processSubmit(@ModelAttribute Owner owner, BindingResult result, SessionStatus status) { - new OwnerValidator().validate(owner, result); - if (result.hasErrors()) { - return "owners/form"; - } - else { - this.clinic.storeOwner(owner); - status.setComplete(); - return "redirect:/owners/" + owner.getId(); - } - } - -} diff --git a/org.springframework.samples.petclinic/src/main/java/org/springframework/samples/petclinic/web/EditPetForm.java b/org.springframework.samples.petclinic/src/main/java/org/springframework/samples/petclinic/web/EditPetForm.java deleted file mode 100644 index 1a7fd6ed3c6..00000000000 --- a/org.springframework.samples.petclinic/src/main/java/org/springframework/samples/petclinic/web/EditPetForm.java +++ /dev/null @@ -1,80 +0,0 @@ - -package org.springframework.samples.petclinic.web; - -import java.util.Collection; - -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.samples.petclinic.Clinic; -import org.springframework.samples.petclinic.Pet; -import org.springframework.samples.petclinic.PetType; -import org.springframework.samples.petclinic.validation.PetValidator; -import org.springframework.stereotype.Controller; -import org.springframework.ui.Model; -import org.springframework.validation.BindingResult; -import org.springframework.web.bind.WebDataBinder; -import org.springframework.web.bind.annotation.InitBinder; -import org.springframework.web.bind.annotation.ModelAttribute; -import org.springframework.web.bind.annotation.PathVariable; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RequestMethod; -import org.springframework.web.bind.annotation.SessionAttributes; -import org.springframework.web.bind.support.SessionStatus; - -/** - * JavaBean Form controller that is used to edit an existing Pet. - * - * @author Juergen Hoeller - * @author Ken Krebs - * @author Arjen Poutsma - */ -@Controller -@RequestMapping("/owners/*/pets/{petId}/edit") -@SessionAttributes("pet") -public class EditPetForm { - - private final Clinic clinic; - - - @Autowired - public EditPetForm(Clinic clinic) { - this.clinic = clinic; - } - - @ModelAttribute("types") - public Collection populatePetTypes() { - return this.clinic.getPetTypes(); - } - - @InitBinder - public void setAllowedFields(WebDataBinder dataBinder) { - dataBinder.setDisallowedFields("id"); - } - - @RequestMapping(method = RequestMethod.GET) - public String setupForm(@PathVariable("petId") int petId, Model model) { - Pet pet = this.clinic.loadPet(petId); - model.addAttribute("pet", pet); - return "pets/form"; - } - - @RequestMapping(method = { RequestMethod.PUT, RequestMethod.POST }) - public String processSubmit(@ModelAttribute("pet") Pet pet, BindingResult result, SessionStatus status) { - new PetValidator().validate(pet, result); - if (result.hasErrors()) { - return "pets/form"; - } - else { - this.clinic.storePet(pet); - status.setComplete(); - return "redirect:/owners/" + pet.getOwner().getId(); - } - } - - @RequestMapping(method = RequestMethod.DELETE) - public String deletePet(@PathVariable int petId) { - Pet pet = this.clinic.loadPet(petId); - this.clinic.deletePet(petId); - return "redirect:/owners/" + pet.getOwner().getId(); - } - -} diff --git a/org.springframework.samples.petclinic/src/main/java/org/springframework/samples/petclinic/web/FindOwnersForm.java b/org.springframework.samples.petclinic/src/main/java/org/springframework/samples/petclinic/web/FindOwnersForm.java deleted file mode 100644 index eb93fabad0a..00000000000 --- a/org.springframework.samples.petclinic/src/main/java/org/springframework/samples/petclinic/web/FindOwnersForm.java +++ /dev/null @@ -1,74 +0,0 @@ - -package org.springframework.samples.petclinic.web; - -import java.util.Collection; - -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.samples.petclinic.Clinic; -import org.springframework.samples.petclinic.Owner; -import org.springframework.stereotype.Controller; -import org.springframework.ui.Model; -import org.springframework.validation.BindingResult; -import org.springframework.web.bind.WebDataBinder; -import org.springframework.web.bind.annotation.InitBinder; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RequestMethod; - -/** - * JavaBean Form controller that is used to search for Owners by - * last name. - * - * @author Juergen Hoeller - * @author Ken Krebs - * @author Arjen Poutsma - */ -@Controller -public class FindOwnersForm { - - private final Clinic clinic; - - - @Autowired - public FindOwnersForm(Clinic clinic) { - this.clinic = clinic; - } - - @InitBinder - public void setAllowedFields(WebDataBinder dataBinder) { - dataBinder.setDisallowedFields("id"); - } - - @RequestMapping(value = "/owners/search", method = RequestMethod.GET) - public String setupForm(Model model) { - model.addAttribute("owner", new Owner()); - return "owners/search"; - } - - @RequestMapping(value = "/owners", method = RequestMethod.GET) - public String processSubmit(Owner owner, BindingResult result, Model model) { - - // allow parameterless GET request for /owners to return all records - if (owner.getLastName() == null) { - owner.setLastName(""); // empty string signifies broadest possible search - } - - // find owners by last name - Collection results = this.clinic.findOwners(owner.getLastName()); - if (results.size() < 1) { - // no owners found - result.rejectValue("lastName", "notFound", "not found"); - return "owners/search"; - } - if (results.size() > 1) { - // multiple owners found - model.addAttribute("selections", results); - return "owners/list"; - } - else { - // 1 owner found - owner = results.iterator().next(); - return "redirect:/owners/" + owner.getId(); - } - } - -} diff --git a/org.springframework.samples.petclinic/src/main/java/org/springframework/samples/petclinic/web/PetTypeEditor.java b/org.springframework.samples.petclinic/src/main/java/org/springframework/samples/petclinic/web/PetTypeEditor.java deleted file mode 100644 index 812b648d711..00000000000 --- a/org.springframework.samples.petclinic/src/main/java/org/springframework/samples/petclinic/web/PetTypeEditor.java +++ /dev/null @@ -1,30 +0,0 @@ -package org.springframework.samples.petclinic.web; - -import java.beans.PropertyEditorSupport; - -import org.springframework.samples.petclinic.Clinic; -import org.springframework.samples.petclinic.PetType; - -/** - * @author Mark Fisher - * @author Juergen Hoeller - */ -public class PetTypeEditor extends PropertyEditorSupport { - - private final Clinic clinic; - - - public PetTypeEditor(Clinic clinic) { - this.clinic = clinic; - } - - @Override - public void setAsText(String text) throws IllegalArgumentException { - for (PetType type : this.clinic.getPetTypes()) { - if (type.getName().equals(text)) { - setValue(type); - } - } - } - -} diff --git a/org.springframework.samples.petclinic/src/main/java/org/springframework/samples/petclinic/web/VisitsAtomView.java b/org.springframework.samples.petclinic/src/main/java/org/springframework/samples/petclinic/web/VisitsAtomView.java deleted file mode 100644 index e9da832e4d7..00000000000 --- a/org.springframework.samples.petclinic/src/main/java/org/springframework/samples/petclinic/web/VisitsAtomView.java +++ /dev/null @@ -1,82 +0,0 @@ -/* - * Copyright 2002-2009 the original author or authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.springframework.samples.petclinic.web; - -import java.util.ArrayList; -import java.util.Date; -import java.util.List; -import java.util.Map; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -import com.sun.syndication.feed.atom.Content; -import com.sun.syndication.feed.atom.Entry; -import com.sun.syndication.feed.atom.Feed; - -import org.springframework.samples.petclinic.Visit; -import org.springframework.web.servlet.view.feed.AbstractAtomFeedView; - -/** - * A view creating a Atom representation from a list of Visit objects. - * - * @author Alef Arendsen - * @author Arjen Poutsma - */ -public class VisitsAtomView extends AbstractAtomFeedView { - - @Override - protected void buildFeedMetadata(Map model, Feed feed, HttpServletRequest request) { - feed.setId("tag:springsource.com"); - feed.setTitle("Pet Clinic Visits"); - @SuppressWarnings("unchecked") - List visits = (List) model.get("visits"); - for (Visit visit : visits) { - Date date = visit.getDate(); - if (feed.getUpdated() == null || date.compareTo(feed.getUpdated()) > 0) { - feed.setUpdated(date); - } - } - } - - @Override - protected List buildFeedEntries(Map model, - HttpServletRequest request, HttpServletResponse response) throws Exception { - - @SuppressWarnings("unchecked") - List visits = (List) model.get("visits"); - List entries = new ArrayList(visits.size()); - - for (Visit visit : visits) { - Entry entry = new Entry(); - String date = String.format("%1$tY-%1$tm-%1$td", visit.getDate()); - // see http://diveintomark.org/archives/2004/05/28/howto-atom-id#other - entry.setId(String.format("tag:springsource.com,%s:%d", date, visit.getId())); - entry.setTitle(String.format("%s visit on %s", visit.getPet().getName(), date)); - entry.setUpdated(visit.getDate()); - - Content summary = new Content(); - summary.setValue(visit.getDescription()); - entry.setSummary(summary); - - entries.add(entry); - } - - return entries; - - } - -} diff --git a/org.springframework.samples.petclinic/src/main/java/org/springframework/samples/petclinic/web/package-info.java b/org.springframework.samples.petclinic/src/main/java/org/springframework/samples/petclinic/web/package-info.java deleted file mode 100644 index 36018d1b1b9..00000000000 --- a/org.springframework.samples.petclinic/src/main/java/org/springframework/samples/petclinic/web/package-info.java +++ /dev/null @@ -1,8 +0,0 @@ - -/** - * - * The classes in this package represent PetClinic's web presentation layer. - * - */ -package org.springframework.samples.petclinic.web; - diff --git a/org.springframework.samples.petclinic/src/main/java/overview.html b/org.springframework.samples.petclinic/src/main/java/overview.html deleted file mode 100644 index 1eb7a2e8c19..00000000000 --- a/org.springframework.samples.petclinic/src/main/java/overview.html +++ /dev/null @@ -1,7 +0,0 @@ - - -

-The Spring Data Binding framework, an internal library used by Spring Web Flow. -

- - \ No newline at end of file diff --git a/org.springframework.samples.petclinic/src/main/resources/META-INF/aop.xml b/org.springframework.samples.petclinic/src/main/resources/META-INF/aop.xml deleted file mode 100644 index b49ffd8b19a..00000000000 --- a/org.springframework.samples.petclinic/src/main/resources/META-INF/aop.xml +++ /dev/null @@ -1,18 +0,0 @@ - - - - - - - - - - - - - - - - - diff --git a/org.springframework.samples.petclinic/src/main/resources/META-INF/hsqldb/dropTables.txt b/org.springframework.samples.petclinic/src/main/resources/META-INF/hsqldb/dropTables.txt deleted file mode 100644 index 90ae6329f90..00000000000 --- a/org.springframework.samples.petclinic/src/main/resources/META-INF/hsqldb/dropTables.txt +++ /dev/null @@ -1,7 +0,0 @@ -DROP TABLE visits; -DROP TABLE pets; -DROP TABLE owners; -DROP TABLE types; -DROP TABLE vet_specialties; -DROP TABLE specialties; -DROP TABLE vets; diff --git a/org.springframework.samples.petclinic/src/main/resources/META-INF/hsqldb/initDB.txt b/org.springframework.samples.petclinic/src/main/resources/META-INF/hsqldb/initDB.txt deleted file mode 100644 index a75bfbbd86d..00000000000 --- a/org.springframework.samples.petclinic/src/main/resources/META-INF/hsqldb/initDB.txt +++ /dev/null @@ -1,55 +0,0 @@ -CREATE TABLE vets ( - id INTEGER NOT NULL IDENTITY PRIMARY KEY, - first_name VARCHAR(30), - last_name VARCHAR(30) -); -CREATE INDEX vets_last_name ON vets(last_name); - -CREATE TABLE specialties ( - id INTEGER NOT NULL IDENTITY PRIMARY KEY, - name VARCHAR(80) -); -CREATE INDEX specialties_name ON specialties(name); - -CREATE TABLE vet_specialties ( - vet_id INTEGER NOT NULL, - specialty_id INTEGER NOT NULL -); -alter table vet_specialties add constraint fk_vet_specialties_vets foreign key (vet_id) references vets(id); -alter table vet_specialties add constraint fk_vet_specialties_specialties foreign key (specialty_id) references specialties(id); - -CREATE TABLE types ( - id INTEGER NOT NULL IDENTITY PRIMARY KEY, - name VARCHAR(80) -); -CREATE INDEX types_name ON types(name); - -CREATE TABLE owners ( - id INTEGER NOT NULL IDENTITY PRIMARY KEY, - first_name VARCHAR(30), - last_name VARCHAR(30), - address VARCHAR(255), - city VARCHAR(80), - telephone VARCHAR(20) -); -CREATE INDEX owners_last_name ON owners(last_name); - -CREATE TABLE pets ( - id INTEGER NOT NULL IDENTITY PRIMARY KEY, - name VARCHAR(30), - birth_date DATE, - type_id INTEGER NOT NULL, - owner_id INTEGER NOT NULL -); -alter table pets add constraint fk_pets_owners foreign key (owner_id) references owners(id); -alter table pets add constraint fk_pets_types foreign key (type_id) references types(id); -CREATE INDEX pets_name ON pets(name); - -CREATE TABLE visits ( - id INTEGER NOT NULL IDENTITY PRIMARY KEY, - pet_id INTEGER NOT NULL, - visit_date DATE, - description VARCHAR(255) -); -alter table visits add constraint fk_visits_pets foreign key (pet_id) references pets(id); -CREATE INDEX visits_pet_id ON visits(pet_id); diff --git a/org.springframework.samples.petclinic/src/main/resources/META-INF/hsqldb/populateDB.txt b/org.springframework.samples.petclinic/src/main/resources/META-INF/hsqldb/populateDB.txt deleted file mode 100644 index 1bf0c4a6edb..00000000000 --- a/org.springframework.samples.petclinic/src/main/resources/META-INF/hsqldb/populateDB.txt +++ /dev/null @@ -1,53 +0,0 @@ -INSERT INTO vets VALUES (1, 'James', 'Carter'); -INSERT INTO vets VALUES (2, 'Helen', 'Leary'); -INSERT INTO vets VALUES (3, 'Linda', 'Douglas'); -INSERT INTO vets VALUES (4, 'Rafael', 'Ortega'); -INSERT INTO vets VALUES (5, 'Henry', 'Stevens'); -INSERT INTO vets VALUES (6, 'Sharon', 'Jenkins'); - -INSERT INTO specialties VALUES (1, 'radiology'); -INSERT INTO specialties VALUES (2, 'surgery'); -INSERT INTO specialties VALUES (3, 'dentistry'); - -INSERT INTO vet_specialties VALUES (2, 1); -INSERT INTO vet_specialties VALUES (3, 2); -INSERT INTO vet_specialties VALUES (3, 3); -INSERT INTO vet_specialties VALUES (4, 2); -INSERT INTO vet_specialties VALUES (5, 1); - -INSERT INTO types VALUES (1, 'cat'); -INSERT INTO types VALUES (2, 'dog'); -INSERT INTO types VALUES (3, 'lizard'); -INSERT INTO types VALUES (4, 'snake'); -INSERT INTO types VALUES (5, 'bird'); -INSERT INTO types VALUES (6, 'hamster'); - -INSERT INTO owners VALUES (1, 'George', 'Franklin', '110 W. Liberty St.', 'Madison', '6085551023'); -INSERT INTO owners VALUES (2, 'Betty', 'Davis', '638 Cardinal Ave.', 'Sun Prairie', '6085551749'); -INSERT INTO owners VALUES (3, 'Eduardo', 'Rodriquez', '2693 Commerce St.', 'McFarland', '6085558763'); -INSERT INTO owners VALUES (4, 'Harold', 'Davis', '563 Friendly St.', 'Windsor', '6085553198'); -INSERT INTO owners VALUES (5, 'Peter', 'McTavish', '2387 S. Fair Way', 'Madison', '6085552765'); -INSERT INTO owners VALUES (6, 'Jean', 'Coleman', '105 N. Lake St.', 'Monona', '6085552654'); -INSERT INTO owners VALUES (7, 'Jeff', 'Black', '1450 Oak Blvd.', 'Monona', '6085555387'); -INSERT INTO owners VALUES (8, 'Maria', 'Escobito', '345 Maple St.', 'Madison', '6085557683'); -INSERT INTO owners VALUES (9, 'David', 'Schroeder', '2749 Blackhawk Trail', 'Madison', '6085559435'); -INSERT INTO owners VALUES (10, 'Carlos', 'Estaban', '2335 Independence La.', 'Waunakee', '6085555487'); - -INSERT INTO pets VALUES (1, 'Leo', '2000-09-07', 1, 1); -INSERT INTO pets VALUES (2, 'Basil', '2002-08-06', 6, 2); -INSERT INTO pets VALUES (3, 'Rosy', '2001-04-17', 2, 3); -INSERT INTO pets VALUES (4, 'Jewel', '2000-03-07', 2, 3); -INSERT INTO pets VALUES (5, 'Iggy', '2000-11-30', 3, 4); -INSERT INTO pets VALUES (6, 'George', '2000-01-20', 4, 5); -INSERT INTO pets VALUES (7, 'Samantha', '1995-09-04', 1, 6); -INSERT INTO pets VALUES (8, 'Max', '1995-09-04', 1, 6); -INSERT INTO pets VALUES (9, 'Lucky', '1999-08-06', 5, 7); -INSERT INTO pets VALUES (10, 'Mulligan', '1997-02-24', 2, 8); -INSERT INTO pets VALUES (11, 'Freddy', '2000-03-09', 5, 9); -INSERT INTO pets VALUES (12, 'Lucky', '2000-06-24', 2, 10); -INSERT INTO pets VALUES (13, 'Sly', '2002-06-08', 1, 10); - -INSERT INTO visits VALUES (1, 7, '1996-03-04', 'rabies shot'); -INSERT INTO visits VALUES (2, 8, '1996-03-04', 'rabies shot'); -INSERT INTO visits VALUES (3, 8, '1996-06-04', 'neutered'); -INSERT INTO visits VALUES (4, 7, '1996-09-04', 'spayed'); diff --git a/org.springframework.samples.petclinic/src/main/resources/META-INF/orm.xml b/org.springframework.samples.petclinic/src/main/resources/META-INF/orm.xml deleted file mode 100644 index d7c8f7040a1..00000000000 --- a/org.springframework.samples.petclinic/src/main/resources/META-INF/orm.xml +++ /dev/null @@ -1,122 +0,0 @@ - - - - - - - PROPERTY - - - - org.springframework.samples.petclinic - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - -
- - - - - - - - - - - - - - -
- - - - DATE - - - - - - - - - - - - - - - - - - - - - -
- - - -
- - - - DATE - - - - - - - - - - diff --git a/org.springframework.samples.petclinic/src/main/resources/META-INF/persistence.xml b/org.springframework.samples.petclinic/src/main/resources/META-INF/persistence.xml deleted file mode 100644 index 86bf7c115d8..00000000000 --- a/org.springframework.samples.petclinic/src/main/resources/META-INF/persistence.xml +++ /dev/null @@ -1,16 +0,0 @@ - - - - - - META-INF/orm.xml - - - true - - - - diff --git a/org.springframework.samples.petclinic/src/main/resources/jdbc.properties b/org.springframework.samples.petclinic/src/main/resources/jdbc.properties deleted file mode 100644 index e039cdf1b6c..00000000000 --- a/org.springframework.samples.petclinic/src/main/resources/jdbc.properties +++ /dev/null @@ -1,63 +0,0 @@ -# Properties file with JDBC and JPA settings. -# -# Applied by from -# various application context XML files (e.g., "applicationContext-*.xml"). -# Targeted at system administrators, to avoid touching the context XML files. - - -#------------------------------------------------------------------------------- -# Common Settings - -hibernate.generate_statistics=true -hibernate.show_sql=true -jpa.showSql=true - - -#------------------------------------------------------------------------------- -# HSQL Settings - -jdbc.driverClassName=org.hsqldb.jdbcDriver -jdbc.url=jdbc:hsqldb:mem:petclinic -jdbc.username=sa -jdbc.password= - -# Properties that control the population of schema and data for a new data source -jdbc.populate=true -jdbc.schemaLocation=classpath:/META-INF/hsqldb/initDB.txt -jdbc.dataLocation=classpath:/META-INF/hsqldb/populateDB.txt -jdbc.dropLocation=classpath:/META-INF/hsqldb/dropTables.txt - -# Property that determines which Hibernate dialect to use -# (only applied with "applicationContext-hibernate.xml") -hibernate.dialect=org.hibernate.dialect.HSQLDialect - -# Property that determines which JPA DatabasePlatform to use with TopLink Essentials -jpa.databasePlatform=org.springframework.samples.petclinic.toplink.EssentialsHSQLPlatformWithNativeSequence - -# Property that determines which database to use with an AbstractJpaVendorAdapter -jpa.database=HSQL - - -#------------------------------------------------------------------------------- -# MySQL Settings - -#jdbc.driverClassName=com.mysql.jdbc.Driver -#jdbc.url=jdbc:mysql://localhost:3306/petclinic -#jdbc.username=pc -#jdbc.password=pc - -# Properties that control the population of schema and data for a new data source -#jdbc.populate=false -#jdbc.schemaLocation= -#jdbc.dataLocation= -#jdbc.dropLocation= - -# Property that determines which Hibernate dialect to use -# (only applied with "applicationContext-hibernate.xml") -#hibernate.dialect=org.hibernate.dialect.MySQLDialect - -# Property that determines which JPA DatabasePlatform to use with TopLink Essentials -#jpa.databasePlatform=oracle.toplink.essentials.platform.database.MySQL4Platform - -# Property that determines which database to use with an AbstractJpaVendorAdapter -#jpa.database=MYSQL diff --git a/org.springframework.samples.petclinic/src/main/resources/log4j.properties b/org.springframework.samples.petclinic/src/main/resources/log4j.properties deleted file mode 100644 index ebee551aa88..00000000000 --- a/org.springframework.samples.petclinic/src/main/resources/log4j.properties +++ /dev/null @@ -1,18 +0,0 @@ -# For JBoss: Avoid to setup Log4J outside $JBOSS_HOME/server/default/deploy/log4j.xml! -# For all other servers: Comment out the Log4J listener in web.xml to activate Log4J. -log4j.rootLogger=INFO, stdout, logfile - -log4j.appender.stdout=org.apache.log4j.ConsoleAppender -log4j.appender.stdout.layout=org.apache.log4j.PatternLayout -log4j.appender.stdout.layout.ConversionPattern=%d %p [%c] - <%m>%n - -log4j.appender.logfile=org.apache.log4j.RollingFileAppender -log4j.appender.logfile.File=${petclinic.root}/WEB-INF/petclinic.log -log4j.appender.logfile.MaxFileSize=512KB -# Keep three backup files. -log4j.appender.logfile.MaxBackupIndex=3 -# Pattern to output: date priority [category] - message -log4j.appender.logfile.layout=org.apache.log4j.PatternLayout -log4j.appender.logfile.layout.ConversionPattern=%d %p [%c] - %m%n - -log4j.logger.org.springframework.samples.petclinic.aspects=DEBUG diff --git a/org.springframework.samples.petclinic/src/main/resources/messages.properties b/org.springframework.samples.petclinic/src/main/resources/messages.properties deleted file mode 100644 index 173417a1014..00000000000 --- a/org.springframework.samples.petclinic/src/main/resources/messages.properties +++ /dev/null @@ -1,8 +0,0 @@ -welcome=Welcome -required=is required -notFound=has not been found -duplicate=is already in use -nonNumeric=must be all numeric -duplicateFormSubmission=Duplicate form submission is not allowed -typeMismatch.date=invalid date -typeMismatch.birthDate=invalid date diff --git a/org.springframework.samples.petclinic/src/main/resources/messages_de.properties b/org.springframework.samples.petclinic/src/main/resources/messages_de.properties deleted file mode 100644 index 124bee48b2c..00000000000 --- a/org.springframework.samples.petclinic/src/main/resources/messages_de.properties +++ /dev/null @@ -1,8 +0,0 @@ -welcome=Willkommen -required=muss angegeben werden -notFound=wurde nicht gefunden -duplicate=ist bereits vergeben -nonNumeric=darf nur numerisch sein -duplicateFormSubmission=Wiederholtes Absenden des Formulars ist nicht erlaubt -typeMismatch.date=ungültiges Datum -typeMismatch.birthDate=ungültiges Datum diff --git a/org.springframework.samples.petclinic/src/main/resources/messages_en.properties b/org.springframework.samples.petclinic/src/main/resources/messages_en.properties deleted file mode 100644 index 05d519bb86d..00000000000 --- a/org.springframework.samples.petclinic/src/main/resources/messages_en.properties +++ /dev/null @@ -1 +0,0 @@ -# This file is intentionally empty. Message look-ups will fall back to the default "messages.properties" file. \ No newline at end of file diff --git a/org.springframework.samples.petclinic/src/main/resources/petclinic.hbm.xml b/org.springframework.samples.petclinic/src/main/resources/petclinic.hbm.xml deleted file mode 100644 index f9a993cf121..00000000000 --- a/org.springframework.samples.petclinic/src/main/resources/petclinic.hbm.xml +++ /dev/null @@ -1,74 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/org.springframework.samples.petclinic/src/main/webapp/META-INF/context.xml b/org.springframework.samples.petclinic/src/main/webapp/META-INF/context.xml deleted file mode 100644 index d5deabaf701..00000000000 --- a/org.springframework.samples.petclinic/src/main/webapp/META-INF/context.xml +++ /dev/null @@ -1,7 +0,0 @@ - - - - - diff --git a/org.springframework.samples.petclinic/src/main/webapp/WEB-INF/applicationContext-hibernate.xml b/org.springframework.samples.petclinic/src/main/webapp/WEB-INF/applicationContext-hibernate.xml deleted file mode 100644 index bfc166db625..00000000000 --- a/org.springframework.samples.petclinic/src/main/webapp/WEB-INF/applicationContext-hibernate.xml +++ /dev/null @@ -1,89 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - ${hibernate.dialect} - ${hibernate.show_sql} - ${hibernate.generate_statistics} - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/org.springframework.samples.petclinic/src/main/webapp/WEB-INF/applicationContext-jdbc.xml b/org.springframework.samples.petclinic/src/main/webapp/WEB-INF/applicationContext-jdbc.xml deleted file mode 100644 index 69a2b1f5dcc..00000000000 --- a/org.springframework.samples.petclinic/src/main/webapp/WEB-INF/applicationContext-jdbc.xml +++ /dev/null @@ -1,85 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/org.springframework.samples.petclinic/src/main/webapp/WEB-INF/applicationContext-jpa.xml b/org.springframework.samples.petclinic/src/main/webapp/WEB-INF/applicationContext-jpa.xml deleted file mode 100644 index 25374e9abe2..00000000000 --- a/org.springframework.samples.petclinic/src/main/webapp/WEB-INF/applicationContext-jpa.xml +++ /dev/null @@ -1,101 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/org.springframework.samples.petclinic/src/main/webapp/WEB-INF/classes/log4j.properties b/org.springframework.samples.petclinic/src/main/webapp/WEB-INF/classes/log4j.properties deleted file mode 100644 index ebee551aa88..00000000000 --- a/org.springframework.samples.petclinic/src/main/webapp/WEB-INF/classes/log4j.properties +++ /dev/null @@ -1,18 +0,0 @@ -# For JBoss: Avoid to setup Log4J outside $JBOSS_HOME/server/default/deploy/log4j.xml! -# For all other servers: Comment out the Log4J listener in web.xml to activate Log4J. -log4j.rootLogger=INFO, stdout, logfile - -log4j.appender.stdout=org.apache.log4j.ConsoleAppender -log4j.appender.stdout.layout=org.apache.log4j.PatternLayout -log4j.appender.stdout.layout.ConversionPattern=%d %p [%c] - <%m>%n - -log4j.appender.logfile=org.apache.log4j.RollingFileAppender -log4j.appender.logfile.File=${petclinic.root}/WEB-INF/petclinic.log -log4j.appender.logfile.MaxFileSize=512KB -# Keep three backup files. -log4j.appender.logfile.MaxBackupIndex=3 -# Pattern to output: date priority [category] - message -log4j.appender.logfile.layout=org.apache.log4j.PatternLayout -log4j.appender.logfile.layout.ConversionPattern=%d %p [%c] - %m%n - -log4j.logger.org.springframework.samples.petclinic.aspects=DEBUG diff --git a/org.springframework.samples.petclinic/src/main/webapp/WEB-INF/classes/messages.properties b/org.springframework.samples.petclinic/src/main/webapp/WEB-INF/classes/messages.properties deleted file mode 100644 index 173417a1014..00000000000 --- a/org.springframework.samples.petclinic/src/main/webapp/WEB-INF/classes/messages.properties +++ /dev/null @@ -1,8 +0,0 @@ -welcome=Welcome -required=is required -notFound=has not been found -duplicate=is already in use -nonNumeric=must be all numeric -duplicateFormSubmission=Duplicate form submission is not allowed -typeMismatch.date=invalid date -typeMismatch.birthDate=invalid date diff --git a/org.springframework.samples.petclinic/src/main/webapp/WEB-INF/classes/messages_de.properties b/org.springframework.samples.petclinic/src/main/webapp/WEB-INF/classes/messages_de.properties deleted file mode 100644 index 124bee48b2c..00000000000 --- a/org.springframework.samples.petclinic/src/main/webapp/WEB-INF/classes/messages_de.properties +++ /dev/null @@ -1,8 +0,0 @@ -welcome=Willkommen -required=muss angegeben werden -notFound=wurde nicht gefunden -duplicate=ist bereits vergeben -nonNumeric=darf nur numerisch sein -duplicateFormSubmission=Wiederholtes Absenden des Formulars ist nicht erlaubt -typeMismatch.date=ungültiges Datum -typeMismatch.birthDate=ungültiges Datum diff --git a/org.springframework.samples.petclinic/src/main/webapp/WEB-INF/classes/messages_en.properties b/org.springframework.samples.petclinic/src/main/webapp/WEB-INF/classes/messages_en.properties deleted file mode 100644 index 05d519bb86d..00000000000 --- a/org.springframework.samples.petclinic/src/main/webapp/WEB-INF/classes/messages_en.properties +++ /dev/null @@ -1 +0,0 @@ -# This file is intentionally empty. Message look-ups will fall back to the default "messages.properties" file. \ No newline at end of file diff --git a/org.springframework.samples.petclinic/src/main/webapp/WEB-INF/geronimo-web.xml b/org.springframework.samples.petclinic/src/main/webapp/WEB-INF/geronimo-web.xml deleted file mode 100644 index b5d88e1ecd2..00000000000 --- a/org.springframework.samples.petclinic/src/main/webapp/WEB-INF/geronimo-web.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - /petclinic - true - \ No newline at end of file diff --git a/org.springframework.samples.petclinic/src/main/webapp/WEB-INF/jsp/dataAccessFailure.jsp b/org.springframework.samples.petclinic/src/main/webapp/WEB-INF/jsp/dataAccessFailure.jsp deleted file mode 100644 index 256cca17786..00000000000 --- a/org.springframework.samples.petclinic/src/main/webapp/WEB-INF/jsp/dataAccessFailure.jsp +++ /dev/null @@ -1,19 +0,0 @@ -<%@ include file="/WEB-INF/jsp/includes.jsp" %> -<%@ include file="/WEB-INF/jsp/header.jsp" %> - -<% -Exception ex = (Exception) request.getAttribute("exception"); -%> - -

Data access failure: <%= ex.getMessage() %>

-

- -<% -ex.printStackTrace(new java.io.PrintWriter(out)); -%> - -

-
-">Home - -<%@ include file="/WEB-INF/jsp/footer.jsp" %> diff --git a/org.springframework.samples.petclinic/src/main/webapp/WEB-INF/jsp/footer.jsp b/org.springframework.samples.petclinic/src/main/webapp/WEB-INF/jsp/footer.jsp deleted file mode 100644 index 52aaffc47e7..00000000000 --- a/org.springframework.samples.petclinic/src/main/webapp/WEB-INF/jsp/footer.jsp +++ /dev/null @@ -1,12 +0,0 @@ - -

- - - - - - - - - - diff --git a/org.springframework.samples.petclinic/src/main/webapp/WEB-INF/jsp/header.jsp b/org.springframework.samples.petclinic/src/main/webapp/WEB-INF/jsp/header.jsp deleted file mode 100644 index 49393d364c9..00000000000 --- a/org.springframework.samples.petclinic/src/main/webapp/WEB-INF/jsp/header.jsp +++ /dev/null @@ -1,14 +0,0 @@ - - - - - - " type="text/css"/> - PetClinic :: a Spring Framework demonstration - - - - -
diff --git a/org.springframework.samples.petclinic/src/main/webapp/WEB-INF/jsp/includes.jsp b/org.springframework.samples.petclinic/src/main/webapp/WEB-INF/jsp/includes.jsp deleted file mode 100644 index 96c3e304cdb..00000000000 --- a/org.springframework.samples.petclinic/src/main/webapp/WEB-INF/jsp/includes.jsp +++ /dev/null @@ -1,5 +0,0 @@ -<%@ taglib prefix="spring" uri="http://www.springframework.org/tags" %> -<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form" %> -<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> -<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %> -<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %> diff --git a/org.springframework.samples.petclinic/src/main/webapp/WEB-INF/jsp/owners/form.jsp b/org.springframework.samples.petclinic/src/main/webapp/WEB-INF/jsp/owners/form.jsp deleted file mode 100644 index 1670a7c1bf5..00000000000 --- a/org.springframework.samples.petclinic/src/main/webapp/WEB-INF/jsp/owners/form.jsp +++ /dev/null @@ -1,61 +0,0 @@ -<%@ include file="/WEB-INF/jsp/includes.jsp" %> -<%@ include file="/WEB-INF/jsp/header.jsp" %> - - - - - -

New Owner:

- - - - - - - - - - - - - - - - - - - - -
- First Name: -
- -
- Last Name: -
- -
- Address: -
- -
- City: -
- -
- Telephone: -
- -
- - -

-
- -

-
-
-
-
- -<%@ include file="/WEB-INF/jsp/footer.jsp" %> diff --git a/org.springframework.samples.petclinic/src/main/webapp/WEB-INF/jsp/owners/list.jsp b/org.springframework.samples.petclinic/src/main/webapp/WEB-INF/jsp/owners/list.jsp deleted file mode 100644 index 44fc3cac0b8..00000000000 --- a/org.springframework.samples.petclinic/src/main/webapp/WEB-INF/jsp/owners/list.jsp +++ /dev/null @@ -1,34 +0,0 @@ -<%@ include file="/WEB-INF/jsp/includes.jsp" %> -<%@ include file="/WEB-INF/jsp/header.jsp" %> - -

Owners:

- - - - - - - - - - - - - - - - - - -
NameAddressCityTelephonePets
- - - - ${owner.firstName} ${owner.lastName} - ${owner.address}${owner.city}${owner.telephone} - - ${pet.name}   - -
- -<%@ include file="/WEB-INF/jsp/footer.jsp" %> diff --git a/org.springframework.samples.petclinic/src/main/webapp/WEB-INF/jsp/owners/search.jsp b/org.springframework.samples.petclinic/src/main/webapp/WEB-INF/jsp/owners/search.jsp deleted file mode 100644 index b972390a19f..00000000000 --- a/org.springframework.samples.petclinic/src/main/webapp/WEB-INF/jsp/owners/search.jsp +++ /dev/null @@ -1,26 +0,0 @@ -<%@ include file="/WEB-INF/jsp/includes.jsp" %> -<%@ include file="/WEB-INF/jsp/header.jsp" %> - - -

Find Owners:

- - - - - - - - - - -
- Last Name: -
- -

-
- -
-Add Owner - -<%@ include file="/WEB-INF/jsp/footer.jsp" %> diff --git a/org.springframework.samples.petclinic/src/main/webapp/WEB-INF/jsp/owners/show.jsp b/org.springframework.samples.petclinic/src/main/webapp/WEB-INF/jsp/owners/show.jsp deleted file mode 100644 index 9767c18ae17..00000000000 --- a/org.springframework.samples.petclinic/src/main/webapp/WEB-INF/jsp/owners/show.jsp +++ /dev/null @@ -1,108 +0,0 @@ -<%@ include file="/WEB-INF/jsp/includes.jsp" %> -<%@ include file="/WEB-INF/jsp/header.jsp" %> -<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %> - -

Owner Information

- - - - - - - - - - - - - - - - - - -
Name${owner.firstName} ${owner.lastName}
Address${owner.address}
City${owner.city}
Telephone ${owner.telephone}
- - - - - -
- - - - Edit Owner - - - - - Add New Pet -
- -

Pets and Visits

- - - - - - - -
- - - - - - - - - - - - - -
Name${pet.name}
Birth Date
Type${pet.type.name}
-
- - - - - - - - - - - -
Visit DateDescription
${visit.description}
-
- - - - - - - - -
- - - - - Edit Pet - - - - - - Add Visit - - - - - - Atom Feed -
-
- -<%@ include file="/WEB-INF/jsp/footer.jsp" %> diff --git a/org.springframework.samples.petclinic/src/main/webapp/WEB-INF/jsp/pets/form.jsp b/org.springframework.samples.petclinic/src/main/webapp/WEB-INF/jsp/pets/form.jsp deleted file mode 100644 index 459ec63b35d..00000000000 --- a/org.springframework.samples.petclinic/src/main/webapp/WEB-INF/jsp/pets/form.jsp +++ /dev/null @@ -1,56 +0,0 @@ -<%@ include file="/WEB-INF/jsp/includes.jsp" %> -<%@ include file="/WEB-INF/jsp/header.jsp" %> - - - - - -

New Pet

- -Owner: ${pet.owner.firstName} ${pet.owner.lastName} -
- - - - - - - - - - - - - - -
- Name: -
- -
- Birth Date: -
- (yyyy-mm-dd) -
- Type: -
- -
- - -

-
- -

-
-
-
-
- - - -

-
-
- -<%@ include file="/WEB-INF/jsp/footer.jsp" %> diff --git a/org.springframework.samples.petclinic/src/main/webapp/WEB-INF/jsp/pets/visitForm.jsp b/org.springframework.samples.petclinic/src/main/webapp/WEB-INF/jsp/pets/visitForm.jsp deleted file mode 100644 index b1207a00f3e..00000000000 --- a/org.springframework.samples.petclinic/src/main/webapp/WEB-INF/jsp/pets/visitForm.jsp +++ /dev/null @@ -1,68 +0,0 @@ -<%@ include file="/WEB-INF/jsp/includes.jsp" %> -<%@ include file="/WEB-INF/jsp/header.jsp" %> - -

New Visit:

- - - Pet: - - - - - - - - - - - - - -
NameBirth DateTypeOwner
${visit.pet.name}${visit.pet.type.name}${visit.pet.owner.firstName} ${visit.pet.owner.lastName}
- - - - - - - - - - - - - -
- Date: -
-
- (yyyy-mm-dd) -
- Description: -
-
- -
- -

-
-
- -
-Previous Visits: - - - - - - - - - - - - - -
DateDescription
${visit.description}
- -<%@ include file="/WEB-INF/jsp/footer.jsp" %> diff --git a/org.springframework.samples.petclinic/src/main/webapp/WEB-INF/jsp/uncaughtException.jsp b/org.springframework.samples.petclinic/src/main/webapp/WEB-INF/jsp/uncaughtException.jsp deleted file mode 100644 index e97fdf37889..00000000000 --- a/org.springframework.samples.petclinic/src/main/webapp/WEB-INF/jsp/uncaughtException.jsp +++ /dev/null @@ -1,49 +0,0 @@ -<%@ include file="/WEB-INF/jsp/includes.jsp" %> -<%@ include file="/WEB-INF/jsp/header.jsp" %> - -

Internal error

-

- -<% -try { - // The Servlet spec guarantees this attribute will be available - Throwable exception = (Throwable) request.getAttribute("javax.servlet.error.exception"); - - if (exception != null) { - if (exception instanceof ServletException) { - // It's a ServletException: we should extract the root cause - ServletException sex = (ServletException) exception; - Throwable rootCause = sex.getRootCause(); - if (rootCause == null) - rootCause = sex; - out.println("** Root cause is: "+ rootCause.getMessage()); - rootCause.printStackTrace(new java.io.PrintWriter(out)); - } - else { - // It's not a ServletException, so we'll just show it - exception.printStackTrace(new java.io.PrintWriter(out)); - } - } - else { - out.println("No error information available"); - } - - // Display cookies - out.println("\nCookies:\n"); - Cookie[] cookies = request.getCookies(); - if (cookies != null) { - for (int i = 0; i < cookies.length; i++) { - out.println(cookies[i].getName() + "=[" + cookies[i].getValue() + "]"); - } - } - -} catch (Exception ex) { - ex.printStackTrace(new java.io.PrintWriter(out)); -} -%> - -

-
- - -<%@ include file="/WEB-INF/jsp/footer.jsp" %> diff --git a/org.springframework.samples.petclinic/src/main/webapp/WEB-INF/jsp/vets.jsp b/org.springframework.samples.petclinic/src/main/webapp/WEB-INF/jsp/vets.jsp deleted file mode 100644 index cff2154f290..00000000000 --- a/org.springframework.samples.petclinic/src/main/webapp/WEB-INF/jsp/vets.jsp +++ /dev/null @@ -1,31 +0,0 @@ -<%@ include file="/WEB-INF/jsp/includes.jsp" %> -<%@ include file="/WEB-INF/jsp/header.jsp" %> - -

Veterinarians:

- - - - - - - - - - - - -
NameSpecialties
${vet.firstName} ${vet.lastName} - - ${specialty.name} - - none -
- - - - -
- ">View as XML -
- -<%@ include file="/WEB-INF/jsp/footer.jsp" %> diff --git a/org.springframework.samples.petclinic/src/main/webapp/WEB-INF/jsp/welcome.jsp b/org.springframework.samples.petclinic/src/main/webapp/WEB-INF/jsp/welcome.jsp deleted file mode 100644 index 1b07c65c3c2..00000000000 --- a/org.springframework.samples.petclinic/src/main/webapp/WEB-INF/jsp/welcome.jsp +++ /dev/null @@ -1,15 +0,0 @@ -<%@ include file="/WEB-INF/jsp/includes.jsp" %> -<%@ include file="/WEB-INF/jsp/header.jsp" %> - -" align="right" style="position:relative;right:30px;"> -

- - - -

 

- -<%@ include file="/WEB-INF/jsp/footer.jsp" %> diff --git a/org.springframework.samples.petclinic/src/main/webapp/WEB-INF/petclinic-servlet.xml b/org.springframework.samples.petclinic/src/main/webapp/WEB-INF/petclinic-servlet.xml deleted file mode 100644 index 3c05fc30003..00000000000 --- a/org.springframework.samples.petclinic/src/main/webapp/WEB-INF/petclinic-servlet.xml +++ /dev/null @@ -1,110 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - pageNotFound - dataAccessFailure - dataAccessFailure - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/org.springframework.samples.petclinic/src/main/webapp/WEB-INF/web.xml b/org.springframework.samples.petclinic/src/main/webapp/WEB-INF/web.xml deleted file mode 100644 index 06a6a311086..00000000000 --- a/org.springframework.samples.petclinic/src/main/webapp/WEB-INF/web.xml +++ /dev/null @@ -1,161 +0,0 @@ - - - - Spring PetClinic - - Spring PetClinic sample application - - - - webAppRootKey - petclinic.root - - - - - - - log4jConfigLocation - /WEB-INF/classes/log4j.properties - - - - - contextConfigLocation - - /WEB-INF/applicationContext-jdbc.xml - - - - - - - - - - - - org.springframework.web.context.ContextLoaderListener - - - - - default - /static/* - - - - - petclinic - org.springframework.web.servlet.DispatcherServlet - 2 - - - - - petclinic - / - - - - httpMethodFilter - org.springframework.web.filter.HiddenHttpMethodFilter - - - - httpMethodFilter - petclinic - - - - 10 - - - - java.lang.Exception - - /WEB-INF/jsp/uncaughtException.jsp - - - - - - diff --git a/org.springframework.samples.petclinic/src/main/webapp/html/tutorial.html b/org.springframework.samples.petclinic/src/main/webapp/html/tutorial.html deleted file mode 100644 index 27bd0f37591..00000000000 --- a/org.springframework.samples.petclinic/src/main/webapp/html/tutorial.html +++ /dev/null @@ -1,1149 +0,0 @@ - - - - The Spring PetClinic Application - - - - - - -
- -

The Spring PetClinic Application

- - - - - - - -
Updated:11.OCT.2009Sam Brannen (Work In Progress: not yet fully updated regarding Spring 3.0)
21.OCT.2007Sam Brannen
30.JUN.2006Costin Leau
01.DEC.2004Ken Krebs
16.AUG.2003Ken Krebs
- - - -

Introduction

- -

- The Spring Framework is a collection of small, well-focused, loosely coupled Java - frameworks that can be used independently or collectively to build - industrial strength applications of many different types. The PetClinic - sample application is designed to show how the Spring - application frameworks can be used to build simple, but powerful - database-oriented applications. It will demonstrate the use - of Spring's core functionality: -

- -
    -
  • JavaBeans based application configuration using Inversion-Of-Control
  • -
  • Model-View-Controller web Presentation Layer
  • -
  • Practical database access through JDBC, Hibernate, or Java Persistence API
  • -
  • Application monitoring based on JMX
  • -
  • Declarative Transaction Management using AOP
  • -
  • Data Validation that supports but is not dependent on the Presentation Layer
  • -
- -

- The Spring frameworks provide a great deal of useful infrastructure to - simplify the tasks faced by application developers. This infrastructure - helps developers to create applications that are: -

- -
    -
  • - concise - by handling a lot of the complex control flow that is needed to use the - Java API's, such as JDBC, JNDI, JTA, RMI, and EJB. -
  • -
  • - flexible - by simplifying the process of external application configuration - through the use of Reflection and JavaBeans. This allows the developer to - achieve a clean separation of configuration data from application code. - All application and web application objects, including validators, - workflow controllers, and views, are JavaBeans that can be configured - externally.
  • -
  • - testable - by supplying an interface based design to maximize pluggability. This - facilitates unit testing of Business Logic without requiring the - presence of application or live database servers.
  • -
  • - maintainable - by facilitating a clean separation of the application layers. It most - importantly helps maintain the independence of the Business Layer - from the Presentation layer. PetClinic demonstrates the use of a - Model-View-Controller - based web presentation framework that can work seamlessly with many - different types of view technologies. The Spring web application - framework helps developers to implement their Presentation as a clean - and thin layer focused on its main missions of translating user actions - into application events and rendering model data.
  • -
- -

- It is assumed that users of this tutorial will have a basic knowledge - of object-oriented design, Java, Servlets, JSP, and relational - databases. It also assumes a basic knowledge of the use of a Java EE web - application container. -

- -

- Since the purpose of the sample application is tutorial in nature, the - implementation presented here will of course provide only a small - subset of the functionality that would be needed by a real world version of a - PetClinic application. -

- - -

PetClinic Sample Application Requirements

- -

- The application requirement is for an information system that is - accessible through a web browser. The users of the application are - employees of the clinic who in the course of their work need to view - and manage information regarding the veterinarians, the clients, and their - pets. The sample application supports the following: -

- -

Use Cases

-
    -
  • View a list of veterinarians and their specialties
  • -
  • View information pertaining to a pet owner
  • -
  • Update the information pertaining to a pet owner
  • -
  • Add a new pet owner to the system
  • -
  • View information pertaining to a pet
  • -
  • Update the information pertaining to a pet
  • -
  • Add a new pet to the system
  • -
  • View information pertaining to a pet's visitation history
  • -
  • Add information pertaining to a visit to the pet's visitation history
  • -
- -

Business Rules

-
    -
  1. An owner may not have multiple pets with the same case-insensitive name.
  2. -
- - -

PetClinic Sample Application Design & Implementation

- -

Server Technology

-

- The sample application should be usable with any Java EE web application - container that is compatible with the Servlet 2.4 and JSP 2.0 - specifications. Some of the deployment files provided are designed - specifically for Apache Tomcat. These files specify container-supplied - connection-pooled data sources. It is not necessary to use these files. - The application has been configured by default to use a data source - with connection pooling. Configuration details are - provided in the Developer Instructions section. The view technologies - that are to be used for rendering the application are Java Server Pages - (JSP) along with the Java Standard Tag Library (JSTL). -

- -

Database Technology

-

- The sample application uses a relational database for data storage. - Support has been provided for a choice of 1 of 2 database selections, - MySql or HypersonicSQL. HypersonicSQL version 1.8.0 is the default - choice. It is possible to - easily configure the application to use either database. Configuration - details are provided in the Developer Instructions section. -

- -

Development Environment

-

- A copy of the Spring runtime library jar file is provided with the - sample application along with some of the other required jar files. The - developer will need to obtain the following tools externally, all of - which are freely available: -

- -
    -
  • Java SDK 1.5.x
  • -
  • Ant 1.7.x
  • -
  • Tomcat 6.x.x, or some other Java Servlet container
  • -
  • (Optional) MySQL 5.x with MySQL Connector/J 5.x
  • -
- -

- NOTE: The version numbers listed are those that were used - in the development of the PetClinic application. Other versions of the same - tools may or may not work. -

- -

- Download links for the various tools needed are provided in the Developer - Instructions section. -

- -

PetClinic Database

-

- The following is an overview of the database schema used in PetClinic. - Detailed field descriptions can be found in the - "initDB.txt" - SQL script files in the database-specific "db" sub-directories. All "id" key - fields are of Java type int. -

- -

- TABLE: owners
-     PRIMARY KEY id -

- -

- TABLE: types
-     PRIMARY KEY id -

- -

- TABLE: pets
-     PRIMARY KEY id
-     FOREIGN KEY type_id - references the types - table id field
-     FOREIGN KEY owner_id - references the owners - table id field -

- -

- TABLE: vets
-     PRIMARY KEY id -

- -

- TABLE: specialties
-     PRIMARY KEY id
-

- -

- TABLE: vet_specialties - - a link table for vets - and their specialties
-     FOREIGN KEY vet_id - references the vets - table id field
-     FOREIGN KEY specialty_id - references the specialties - table id field -

- -

- TABLE: visits
-     PRIMARY KEY id
-     FOREIGN KEY pet_id - references the pets - table id field -

- -

Directory Structure

- -

- d-- indicates a directory holding source code, configuration files, etc.
- D-- indicates a directory that is created by the build script -

- -

- d-- petclinic: - the root directory of the project contains build related files
- -     d-- src: contains - Java source code files and ORM configuration files
- -     d-- war: contains - the web application resource files
- -         d-- html: contains - tutorial files
- -         D-- docs: contains - Javadoc files
- -         d-- web-inf: - contains web application configuration files and application context - files
- -               - d-- jsp: - contains Java Server Page files
- -               - D-- lib: - contains application dependencies
- -     d-- test: contains - testing related - Java source code files
- -     d-- db: contains - database SQL scripts and other related files/directories
- -         d-- hsqldb: - contains files related to HSQL, contains scripts and a Tomcat - context definition file
- -         d-- mysql: - contains files related to MySQL, contains scripts and a Tomcat context - definition file
- -     D-- .classes: - contains compiled Java class files
- -     D-- .testclasses: - contains compiled testing related Java class files
- -     D-- junit-reports: - contains generated xml-formatted test reports
- -          D-- reports/html: - contains generated html-formatted test reports
- -     D-- dist: contains - packaged archives of files -

- - -

PetClinic Application Design

- -

Logging

-

- Spring supports the use of the Apache Commons Logging API. This API - provides the ability to use Java 1.4 loggers, the simple Commons loggers, - and Apache log4j loggers. PetClinic uses log4j to provide sophisticated - and configurable logging capabilities. The file, - src/main/resources/log4j.properties - configures the definition of log4jloggers. -

- -

Business Layer

-

- The Business Layer consists of a number of basic JavaBean classes - representing the application domain objects and associated validation - objects that are used by the Presentation Layer. The validation objects - used in PetClinic are all implementations of the - org.springframework.validation.Validator interface. -

- -
    -
  • org.springframework.samples.petclinic.Entity - is a simple JavaBean superclass used for all persistable objects.
  • -
  • org.springframework.samples.petclinic.NamedEntity - is an extension of Entity that adds a name property.
  • -
  • org.springframework.samples.petclinic.Specialty - is an extension of NamedEntity.
  • -
  • org.springframework.samples.petclinic.PetType - is an extension of NamedEntity.
  • -
  • org.springframework.samples.petclinic.Person is - an extension of Entity that provides a superclass for all objects that - implement the notion of a person.
  • -
  • org.springframework.samples.petclinic.Vet is - an extension of Person that implements a - veterinarian. It holds a List of - specialties that the Vet is capable of.
  • -
  • org.springframework.samples.petclinic.Owner - is an extension of Person that implements a pet owner. - It holds a List of pets owned.
  • -
  • org.springframework.samples.petclinic.Pet - is an extension of NamedEntity that - implements a pet. It holds a List of - visits made concerning the pet.
  • -
  • org.springframework.samples.petclinic.Visit - is a simple JavaBean that implements the notion of a clinic visit - for a pet.
  • -
  • org.springframework.samples.petclinic.util.EntityUtils - provides utility methods for handling entities.
  • -
- -
    -
  • org.springframework.samples.petclinic.validation.OwnerValidator - is a Spring Validator that - verifies correct data entry for the Add and Edit Owner forms.
  • -
  • org.springframework.samples.petclinic.validation.PetValidator - is a Spring Validator that - verifies correct data entry for the Add and Edit Pet forms.
  • -
  • org.springframework.samples.petclinic.validation.VisitValidator - is a Spring Validator that - verifies correct data entry for the AddVisit form.
  • -
- -

Business / Persistence Layer

- -

- Since the PetClinic application is all about database access and there is - very little business logic in the application outside of that, there is - no separation of the primary Business and Persistence Layer API's. - While this design technique should not be used for an application with more - complex business logic, it is acceptable here because all of the - non-persistence related business rules have been implemented in - business objects and have not leaked into the Persistence Layer. The most - important facet of the design is that the Business and Persistence - Layers are COMPLETELY independent of the Presentation Layer. -

- -

- The Persistence Layer can be configured to use either HSQL or MySQL - with any one of the following data access technologies aided by - infrastructure provided by Spring: -

- -
    -
  • JDBC
  • -
  • Hibernate 3
  • -
  • Java Persistence API
  • -
- -

- NOTE: Spring also provides - infrastructure for using other - Object/Relational Mapping - frameworks such as JDO and iBATIS SqlMaps, but these are not demonstrated in PetClinic. - (See the 'jpetstore' sample application that ships with the full Spring Framework - distribution for an example of using iBatis and Spring.) -

- -

- One of the key elements provided by Spring is the use of a common set - of meaningful data access exceptions that can be used regardless of - which database or access strategy is used. All of these exceptions - derive from org.springframework.dao.DataAccessException. - Since most exceptions encountered during database access are indicative - of programming errors, DataAccessException is an - abstract RuntimeException whose derivatives only need - to be caught by application code to handle recoverable errors when it - makes sense to do so. This greatly simplifies application code compared - to, for example, code using JDBC directly where SqlExceptions - must be caught and database specific error codes must be decoded. - Examination of the PetClinic source code will show that the - persistence-oriented code is completely focused on the relevant - transfer of data to/from the referenced objects without extraneous - error handling. -

- -

- The high-level business/persistence API for PetClinic is the - org.springframework.samples.petclinic.Clinic - interface. Each persistence strategy in PetClinic is a different implementation of the - Clinic interface. In each case, the - Clinic implementation is fronted by - a transactional proxy, configured via the - @Transactional annotation, that also - implements Clinic. These objects - are standard Java dynamic proxies which are created by an instance of - org.springframework.transaction.interceptor.TransactionProxyFactoryBean. - These proxies are configured in the respective application context file - via <tx:annotation-driven /> and specify that all - Clinic methods are run in a - transactional context. The transaction managers used in PetClinic are all - implementations of the - org.springframework.transaction.PlatformTransactionManager - interface. All of the implementations are by default configured - to use a local DataSource that - will work in any environment through the use of an instance of - org.springframework.jdbc.datasource.DriverManagerDataSource. - While this is appropriate for use in a demo or single user - program, a connection pooling DataSource, - such as an instance of org.apache.commons.dbcp.BasicDataSource, - is more appropriate for use in a multi-user application. Another - alternative is to obtain one through the Java EE environment - using an instance of - org.springframework.jndi.JndiObjectFactoryBean. -

- -

JDBC Clinic Implementation

-

- Spring provides a number of high-level database - access convenience classes in the package - org.springframework.jdbc.object. - These classes and the lower-level Spring classes that they use in the - org.springframework.jdbc.core package - provide a higher level of abstraction for using JDBC that keeps the developer - from having to correctly implement the handling of the checked - SqlExceptions with ugly error-prone - nested try-catch-finally blocks. Using the classes in this package - allows the developer to focus efforts on the functionality being - implemented rather than the mechanics of error handling. When using - these classes, it is the responsibility of the developer to provide the - SQL needed and to map the parameters to/from the respective domain - object. This typically is done by extending one of the - org.springframework.jdbc.object classes, - initializing its SQL, and overriding a method that takes care of - the mapping. In this way, the developer gets to focus on implementing - functionality rather than application plumbing. These classes also - take care of closing connections to prevent hard to find resource - leakage problems. It should be noted that instances of these classes - are lightweight, reusable, and threadsafe. -

- -

- The JDBC implementation of the Clinic interface is - org.springframework.samples.petclinic.jdbc.SimpleJdbcClinic, - which uses Java 5 language features, - org.springframework.jdbc.core.simple.SimpleJdbcTemplate, and - org.springframework.jdbc.core.simple.SimpleJdbcInsert. - It also takes advantage of classes like - org.springframework.jdbc.core.namedparam.BeanPropertySqlParameterSource and - org.springframework.jdbc.core.simple.ParameterizedBeanPropertyRowMapper - which provide automatic mapping between JavaBean properties and JDBC - parameters or query results. SimpleJdbcClinic is a rewrite of the - AbstractJdbcClinic which was the base class for JDBC implementations of - the Clinic interface for Spring 2.0. -

- -

- The transaction manager used in the JDBC Clinic Implementation is an - instance of org.springframework.jdbc.datasource.DataSourceTransactionManager - that can be used for local transactions. -

- -

Hibernate 3 Clinic Implementation

-

- The Hibernate 3 implementation of the Clinic - interface is - org.springframework.samples.petclinic.hibernate.HibernateClinic. - To simplify using Hibernate, Spring provides the - org.springframework.orm.hibernate3.LocalSessionFactoryBean. - The Hibernate configuration is provided by the file src/main/resources/petclinic.hbm.xml. -

- -

Java Persistence API (JPA) Clinic Implementation

-

- The JPA implementation of the Clinic - interface is - org.springframework.samples.petclinic.jpa.EntityManagerClinic, - which is based on native JPA usage combined with Spring's - @Repository and - @Transactional annotations but - otherwise has no dependencies on any Spring API's. - To simplify JPA usage, Spring provides (among other classes) the - org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean. - The JPA configuration is provided by - src/main/resources/META-INF/orm.xml and - src/main/resources/META-INF/persistence.xml. -

- -

ApplicationContext

-

- A Spring org.springframework.context.ApplicationContext object - provides a map of user-defined JavaBeans that specify either a singleton - object or the initial construction of prototype instances. These beans - constitute the Business/Persistence - Layer of PetClinic. The following beans are defined in all 3 - versions (1 per access strategy) of the PetClinic - src/main/webapp/WEB-INF/applicationContext-*.xml - file: -

- -
    -
  1. A PropertyPlaceholderConfigurer, - which is configured via - <context:property-placeholder ... /> and - is a singleton bean that replaces ${...} placeholders with values from a - properties file, in this case, JDBC-related settings for the - dataSource bean - described below - (see src/main/resources/jdbc.properties). -
  2. -
  3. dataSource, - which is a singleton bean that defines the implementation of the source - of database connections used by the application. -
  4. -
  5. transactionManager, - which is a singleton bean that defines the implementation of the transaction - management strategy for the application. -
  6. -
  7. clinic, - which is a singleton bean that defines the implementation of the - Clinic interface that provides the - primary Business Layer API of the application. -
  8. -
- -

Presentation Layer

-

- The Presentation Layer is implemented as a Java EE Web Application and - provides a very thin and concise Model-View-Controller type user - interface to the Business and Persistence Layers. -

- -

- The PetClinic web application is configured via the following files: -

- -
    -
  • src/main/webapp/WEB-INF/web.xml: - the web application configuration file.
  • -
  • src/main/webapp/WEB-INF/petclinic-servlet.xml: - configures the petclinic dispatcher servlet and the other controllers - and forms that it uses. The beans defined in this file reference the - Business/Persistence Layer beans defined in - applicationContext-*.xml.
  • -
  • src/main/resources/messages*.properties: - configures the definition of internationalizable message resources.
  • -
- -

- Examine the comments provided in each of these files for a more - in-depth understanding of the details of how the application is - configured. -

- -

General

- -
    -
  • In web.xml, - a context-param, "webAppRootkey", - provides the key for a system property that specifies the root directory - for the web application. This parameter, - "petclinic.root", can be used to aid - in configuring the application.
  • -
  • In web.xml, - a org.springframework.web.context.ContextLoaderListener - is defined that loads the root ApplicationContext - object of this webapp at startup, by default from the designated - /WEB-INF/applicationContext-*.xml. - The root org.springframework.web.context.WebApplicationContext - of PetClinic is an instance of - org.springframework.web.context.support.XmlWebApplicationContext - and is the parent of all servlet-specific ApplicationContexts. - The Spring root ApplicationContext object - provides a map of user-defined JavaBeans that can be used in any and - all layers of the application. Beans defined in the root - ApplicationContext are automatically - available in all child ApplicationContext - objects as (external) bean references. Beans defined in an - ApplicationContext can also be - accessed directly by Java code through - getBean(name) method calls. -
  • - -
  • In web.xml, - a Servlet named - "petclinic" is specified to act as - a dispatcher for the entire application. This - org.springframework.web.servlet.DispatcherServlet - is used to handle all URL's matching the pattern "*.do". - As with any Servlet, multiple URL mappings may - be defined. It is also possible to define multiple instances of - DispatcherServlet. Each - DispatcherServlet dispatches - requests to registered handlers (Controller - interface implementations or POJOs annotated with @Controller) - indirectly through a - org.springframework.web.servlet.handler.HandlerMapping - implementation. Each DispatcherServlet - has its own ApplicationContext, - by default defined in "{servlet-name}-servlet.xml". - In this case, it is in the file "petclinic-servlet.xml". - This ApplicationContext is - used to specify the various web application user interface beans and - the URL mappings that are used by the DispatcherServlet - to control the handling of requests. -
  • -
- -

- The files web.xml and - log4j.properties specify - the configuration of logging in the system: -

- -
    -
  • In web.xml, - a "log4jConfigLocation" context-param - is specified that sets the location of the - log4j configuration file. The - default location for this file is - /WEB-INF/classes/log4j.properties. - Specifying this parameter explicitly allows the location to be changed - from the default and is also used to cause periodic - log4j configuration refresh checks.
  • -
  • In web.xml, - a Log4jConfigListener is - specified that will initialize log4j using - the specified configuration file when the web app starts. The - Log4jConfigListener is commented out - in the file because of a conflict when using JBoss. It should also be - noted that if the container initializes Servlets before Listeners as - some pre-Servlet 2.4 containers do, a Log4jConfigServlet should - be used instead.
  • -
  • In log4j.properties, - the following loggers are specified: -
      -
    • "stdout" provides - logging messages to the container's log file.
    • -
    • "logfile" provides - logging messages to a rolling file that is specified using the - previously defined "petclinic.root".
    • -
    -
  • -
- -

- Examination and study of these logging files will provide insight into - the operation of the Spring framework and the application as well as - valuable troubleshooting information should something not work - correctly. -

- -

DispatcherServlet

-

- The following beans are accessible to the - DispatcherServlet and are defined - in the PetClinic - petclinic-servlet.xml - file. This dispatcher uses these definitions to delegate actual display - and form processing tasks to implementations of the Spring - org.springframework.web.servlet.mvc.Controller - interface. The DispatcherServlet - acts as the main application Front Controller - and is responsible for dispatching all requests to the appropriate - Controller indirectly through a URL - mapping handler. These Controllers are - responsible for the mechanics of interaction with the user and ultimately - delegate action to the Business/Persistence Layers. -

- -
    -
  • - messageSource - is a singleton bean that defines a message source for this - ApplicationContext. Messages are - loaded from localized "messages_xx" - files in the classpath, such as - "/WEB-INF/classes/messages.properties" - or "/WEB-INF/classes/messages_de.properties". - getMessage() calls to this context - will use this source. Child contexts can have their own message sources, - which will inherit all messages from this source and are able to define new - messages and override ones defined in the primary message source. -
  • -
  • - InternalResourceViewResolver - is a singleton bean that defines the view mappings used by the dispatcher. - Specifically, logical view names returned by Controllers will be mapped to - physical paths using the configured 'prefix' and 'suffix' properties. For - example, a logical view name of "vets" will be mapped to "/WEB-INF/jsp/vets.jsp". -
  • -
  • - SimpleMappingExceptionResolver - is a singleton bean that defines how exceptions are propagated. Exceptions - encountered that are not specified are propagated to the servlet container. -
  • -
  • - <context:component-scan ... /> - is used to autodetect the controllers in the - org.springframework.samples.petclinic.web package, which - are POJOs labeled with the @Controller annotation. -
      -
    • - ClinicController is a singleton, annotation-driven - MultiActionController that is used by the dispatcher to handle - non-form based display tasks. A method is provided to handle each - type of request that is supported. -
    • -
    • - In addition, there are 6 singleton, annotation-driven Form controllers, - which are used to handle the various Search, Add and Edit form processing - tasks for the dispatcher. -
    • -
    -
  • -
  • - The form-based controllers within the PetClinic application provide - @RequestMapping annotations at the type level for path - mapping URLs and @RequestMapping at the method level for request type - mappings (e.g., GET and POST). In contrast, ClinicController - – which is not form-based – provides @RequestMapping only at - the method level for path mapping URLs. - DefaultAnnotationHandlerMapping is driven by these - annotations and is enabled by default with Java 5+. -
  • -
- -

Views

-

- The Controllers used by the - dispatcher handle the work flow of the application. The actual display - tasks are delegated by the Controllers - to implementations of the Spring View - interface. These View objects are - themselves beans that can render a particular type of view. The - handling Controller supplies the - View with a data model to render. - The data model is provided to the View - as a Map of objects. - Views are only responsible for - rendering a display of the data model and performing any display logic - that is particular to the type of View - being rendered. Spring provides support for rendering many different types of - views: JSP, XSLT, PDF, Velocity templates, Excel files, and others. By - using a View mapping strategy, - Spring supplies the developer with a great deal of flexibility in supporting - easily configurable view substitution. -

-

- ClinicController relies on - RequestToViewNameTranslator to automatically infer the - logical view name from the incoming request URL; whereas, all Form - controllers in the PetClinic application return logical view names as Strings. - These logical view names are then mapped to physical paths via the - configured InternalResourceViewResolver (see the - DispatcherServlet section above for further details). Logical view names that - are prepended with "redirect:" will be resolved to instances - of RedirectView, which simply redirects to another URL. - The other resolved Views will be instances of - JstlView, which provides some handy support for - internationalization & localization in JSP pages that use JSTL. -

- -

Messages

-

- The messages*.properties - files are loaded from the classpath to provide localized messages for - the supported languages. PetClinic supplies a localized - "welcome" message as well as localized form entry error - messages in the default (i.e., English) and German properties files. - See the "countries" sample application for a more detailed example of Spring's - support for internationalization. -

- -

Presentation Layer classes

-
    -
  • - org.springframework.samples.petclinic.web.ClinicController - is an annotation-driven, POJO MultiActionController - that is used to handle simple display-oriented URLs. -
  • -
  • - org.springframework.samples.petclinic.web.FindOwnersForm - is an annotation-driven, POJO Form controller that is used to search for - Owners by last name. -
  • -
  • - org.springframework.samples.petclinic.web.AddOwnerForm - is an annotation-driven, POJO Form controller that is used to add a new Owner - to the system. -
  • -
  • - org.springframework.samples.petclinic.web.EditOwnerForm - is an annotation-driven, POJO Form controller that is used to edit an existing Owner. - A copy of the existing Owner is used for editing. -
  • -
  • - org.springframework.samples.petclinic.web.AddPetForm - is an annotation-driven, POJO Form controller that is used to add a new Pet - to an existing Owner. -
  • -
  • - org.springframework.samples.petclinic.web.EditPetForm - is an annotation-driven, POJO Form controller that is used to edit an existing Pet. - A copy of the existing Pet is used for editing. -
  • -
  • - org.springframework.samples.petclinic.web.AddVisitForm - is an annotation-driven, POJO Form controller that is used to add a new Visit - to an existing Pet. -
  • -
- -

Logical Views & Implemented Use Cases

- -
    -
  • welcome is - the "home" screen. It provides links to display a list of all vets, - find an owner, or view documentation.
  • -
  • vets displays - all vets and their specialties.
  • -
  • findOwners - is used to find owners by last name.
  • -
  • findOwnersRedirect - redirects to findOwner.
  • -
  • selectOwner - allows user to select from a list of multiple owners with the same last - name.
  • -
  • owner displays - a owner's data and a list of the owner's pets and their data.
  • -
  • ownerRedirect - redirects to owner.
  • -
  • owner supports - AddOwnerForm - and EditOwnerForm
  • -
  • pet supports - AddPetForm - and web.EditPetForm
  • -
  • visit supports - AddVisitForm
  • -
  • dataAccessFailure - displays a stacktrace
  • -
- -

Java Server Pages

- -
    -
  • index.jsp - redirects to the "welcome" page.
  • -
  • includes.jsp is - statically included in all - JSP's used in the application. It specifies the taglibs that are in use.
  • -
  • header.jsp and - footer.jsp - display info common to virtually all pages. Spring also supplies - support for the integration of Tiles - (included in Struts) but this is not used in PetClinic.
  • -
  • dataAccessFailure.jsp - is the error page configured via - SimpleMappingExceptionResolver, - which displays a stack trace and normally wouldn't be used in a production - version of an application. It can be seen in action by entering a URL of - "editOwner.do" or "editPet.do" with an invalid request parameter, for example: - /petclinic/owner.do?ownerId=-1. - The handlers for these URLs normally expect to see a respective "ownerId" or "petId" - request parameter corresponding to an Owner or Pet in the database. Thus, - these handlers will throw a DataAccessException when such - a request parameter is provided which references a non-existing entity.
  • -
  • uncaughtException.jsp - is the web.xml configured - "error-page". It displays a stack trace and normally wouldn't be used - in a production version of an application. It can be seen in action by - entering a URL of "editOwner.do" or "editPet.do" without a valid request - parameter, for example: - /petclinic/owner.do. - The handlers for these URLs normally expect to see a respective "ownerId" or "petId" - request parameter and throw a ServletException when such - a request parameter is not found.
  • -
  • welcome.jsp implements - welcome.
  • -
  • vets.jsp implements - vets.
  • -
  • findOwners.jsp implements - findOwners.
  • -
  • owners.jsp implements - selectOwner.
  • -
  • owner.jsp implements - owner.
  • -
  • ownerForm.jsp implements - ownerForm.
  • -
  • petForm.jsp implements - petForm.
  • -
  • visitForm.jsp implements - visitForm.
  • -
- -

- The following items should be noted regarding the web application - implementation design: -

- -
    -
  1. all JSP's are stored under /WEB-INF/jsp except - for index.jsp which - is the configured "welcome-file"
  2. -
  3. The use of JSP technology in the application is not exposed to - the user, i.e., the end user never sees a URL ending in - ".jsp".
  4. -
  5. By convention, all URL's in the application ending in - ".do" are - handled by web application controllers. Static html pages ending in - ".html", such as - Javadoc, will be directly served to the end user.
  6. -
  7. The results of all form entries are handled using browser round - trip redirection to minimize possible end user confusion.
  8. -
  9. All pages are extremely simple JSP implementations that focus - only on providing the necessary functionality.
  10. -
  11. References to Entity objects - are passed around in the application by supplying the object's ID - as a request parameter.
  12. -
- -

Testing

-
    -
  • org.springframework.samples.petclinic.OwnerTests - is a simple JUnit 4 based TestCase that supports Business Rule #1.
  • -
  • org.springframework.samples.petclinic.AbstractClinicTests - is a JUnit 4 based TestCase requiring a live database connection that is - used to confirm correct operation of the database access objects in the - various implementations of the Clinic interface. - "AbstractClinicTests-context.xml" declares a common - javax.sql.DataSource. Subclasses specify additional - context locations which declare a - org.springframework.transaction.PlatformTransactionManager - and a concrete implementation of Clinic. -

    - AbstractClinicTests extends - AbstractTransactionalJUnit4SpringContextTests, - one of the valuable testing support classes provided by the - Spring TestContext Framework found in the - org.springframework.test.context package. The - annotation-driven configuration used here represents best practice for - integration tests with Spring. Note, however, that - AbstractTransactionalJUnit4SpringContextTests serves only as a convenience - for extension. For example, if you do not wish for your test classes to be - tied to a Spring-specific class hierarchy, you may configure your tests with - annotations such as @ContextConfiguration, - @TestExecutionListeners, @Transactional, etc. -

    -

    - AbstractClinicTests and its subclasses benefit from the following services - provided by the Spring TestContext Framework: -

    -
      -
    • Spring IoC container caching which spares us - unnecessary set up time between test execution.
    • -
    • Dependency Injection of test fixture instances, - meaning that we don't need to perform application context lookups. See the - use of @Autowired on the clinic instance - variable, which uses autowiring by type. As an alternative, we - could annotate clinic with JSR 250's - @Resource to achieve dependency injection by name. - (see: @ContextConfiguration, - DependencyInjectionTestExecutionListener)
    • -
    • Transaction management, meaning each test method is - executed in its own transaction, which is automatically rolled back by - default. Thus, even if tests insert or otherwise change database state, there - is no need for a teardown or cleanup script. - (see: @TransactionConfiguration, - @Transactional, TransactionalTestExecutionListener)
    • -
    • Useful inherited protected fields, such as a - SimpleJdbcTemplate that can be used to verify - database state after test operations or to verify the results of - queries performed by application code. An - ApplicationContext is also inherited and can be - used for explicit bean lookup if necessary. - (see: AbstractJUnit4SpringContextTests, - AbstractTransactionalJUnit4SpringContextTests)
    • -
    -

    - The Spring TestContext Framework and related unit and - integration testing support classes are shipped in - spring-test.jar. -

    - -
  • -
- -

Downloads

-
    -
  • Download and install the - Spring Framework - (the PetClinic sample application is included)
  • -
  • Download and install a Java - Software Developer Kit, version 1.5 or later
  • -
  • Download and install Apache Ant, - preferably version 1.7.1 or later
  • -
  • Download and install Apache Tomcat, - preferably version 6.0.20 or later
  • -
  • Download and install MySQL, - preferably version 5.1.x or later (optional)
  • -
  • Hypersonic SQL, and - Hibernate are provided with the - application.
  • -
  • PetClinic and Spring use the Apache - Commons Logging - and log4j - packages.
  • -
- -

Ant Setup

-

- Make sure that the Ant executable is in your command shell path. -

- -

MYSQL Setup (optional)

-

- Add the PetClinic database to a running MySQL server by following the - explicit instructions found in - db/mysql/petclinic_db_setup_mysql.txt. - PetClinic expects by default to be able to access the server via the - standard port 3306. To use a different port, it will be - necessary to change the PetClinic Database Setup. -

- -

PetClinic Database Setup

-

- To use a Java EE server supplied connection-pooled data source with - Tomcat, it will be necessary to use and possibly edit the appropriate - context definition file for the petclinic webapp. To use it, deploy a - copy of the appropriate context definition file in Tomcat's webapps - directory and restart the server. Consult the Tomcat log files if - something goes wrong when starting either Tomcat or the PetClinic - application. The context files are named - petclinic_tomcat_*.xml, - where * is either "hsqldb" or "mysql". - There is a context file supplied for each - database in its respective directory. There is also a context file - db/petclinic_tomcat_all.xml - that will provide a JNDI connection-pooled DataSource for all supported - databases. Should you use this file, you must of course make sure that all the - database servers are running when you restart Tomcat. -

- -

- - NOTES: -

- -
    -
  1. Should you deploy one of the context files or define a context in - Tomcat's server.xml, - Tomcat will not automatically deploy the webapp from the - petclinic.war file. - The webapp will then need to be manually extracted to the target - directory.
  2. -
  3. The context files will also configure logging to supply a - separate log file for the petclinic context. This will separate the - container logging for petclinic from that of the other webapps. This - should not be confused with the application log file provided through - log4j.
  4. -
  5. An Ant script (db/build.xml) - has been provided that can be used to re-initialize either database. To - select or configure the data source and database used for the webapp and - for testing, you will need to edit the following files: -
      -
    • src/main/webapp/WEB-INF/applicationContext-*.xml: - for configuring the DataSource in the webapp
    • -
    • src/main/resources/jdbc.properties: - for configuring JDBC connection settings for both the webapp and testing
    • -
    • build.properties: - for running the "tests" target in Ant
    • -
    -
  6. -
- -

Building the PetClinic Application

-

- Open a command line shell and navigate to the directory containing - PetClinic and execute "ant -p". This will display a list of the Ant - targets that are available. Make sure the database is running and execute - "ant clean test". This will run clean and compile everything - and execute the tests, including integration tests against an in-memory - database. -

- -

Deploying the PetClinic Application

-

- Deploy the web application to the server in the usual way (see - notes regarding database setup). If you need - instructions for web application deployment, see the Tomcat - documentation for details. The Web Application aRrchive file is - org.springframework.samples.petclinic.war - and can be found in the - target/artifacts directory. -

- -

Using the PetClinic Application

-

- Make sure the PetClinic web application is running and browse to - http://localhost:8080/org.springframework.samples.petclinic/. -

- - - - - - - -
- - - diff --git a/org.springframework.samples.petclinic/src/main/webapp/images/banner-graphic.png b/org.springframework.samples.petclinic/src/main/webapp/images/banner-graphic.png deleted file mode 100644 index e6d01d58852..00000000000 Binary files a/org.springframework.samples.petclinic/src/main/webapp/images/banner-graphic.png and /dev/null differ diff --git a/org.springframework.samples.petclinic/src/main/webapp/images/bullet-arrow.png b/org.springframework.samples.petclinic/src/main/webapp/images/bullet-arrow.png deleted file mode 100644 index 5909c25b397..00000000000 Binary files a/org.springframework.samples.petclinic/src/main/webapp/images/bullet-arrow.png and /dev/null differ diff --git a/org.springframework.samples.petclinic/src/main/webapp/images/pets.png b/org.springframework.samples.petclinic/src/main/webapp/images/pets.png deleted file mode 100644 index 0fe63c282b1..00000000000 Binary files a/org.springframework.samples.petclinic/src/main/webapp/images/pets.png and /dev/null differ diff --git a/org.springframework.samples.petclinic/src/main/webapp/images/springsource-logo.png b/org.springframework.samples.petclinic/src/main/webapp/images/springsource-logo.png deleted file mode 100644 index e170f8abf77..00000000000 Binary files a/org.springframework.samples.petclinic/src/main/webapp/images/springsource-logo.png and /dev/null differ diff --git a/org.springframework.samples.petclinic/src/main/webapp/images/submit-bg.png b/org.springframework.samples.petclinic/src/main/webapp/images/submit-bg.png deleted file mode 100644 index 10a94371b64..00000000000 Binary files a/org.springframework.samples.petclinic/src/main/webapp/images/submit-bg.png and /dev/null differ diff --git a/org.springframework.samples.petclinic/src/main/webapp/styles/petclinic.css b/org.springframework.samples.petclinic/src/main/webapp/styles/petclinic.css deleted file mode 100644 index e12f96af780..00000000000 --- a/org.springframework.samples.petclinic/src/main/webapp/styles/petclinic.css +++ /dev/null @@ -1,234 +0,0 @@ -/* main elements */ - -body,div,td { - font-family: Arial, Helvetica, sans-serif; - font-size: 12px; - color: #666; -} - -body { - background-color: #fff; - background-image: url(../images/banner-graphic.png); - background-position: top center; - background-repeat: no-repeat; - text-align: center; - min-width: 600px; - margin-top: 60px; - margin-left: auto; - margin-right: auto; -} - -div { - margin: 5px 25px 5px 25px; - text-align: left; -} - -/* header and footer elements */ - -#main { - margin:0 auto; - position:relative; - top: 35px; - left:0px; - width:560px; - text-align:left; -} - -.footer { - background:#fff; - border:none; - margin-top:20px; - border-top:1px solid #999999; - width:100%; -} - -.footer td {color:#999999;} - -.footer a:link {color: #7db223;} - - -/* text styles */ - -h1,h2,h3 { - font-family: Helvetica, sans-serif; - color: #7db223; -} - -h1 { - font-size: 20px; - line-height: 26px; -} - -h2 { - font-size: 18px; - line-height: 24px; -} - -h3 { - font-size: 15px; - line-height: 21px; - color:#555; -} - -h4 { - font-size: 14px; - line-height: 20px; -} - -.errors { - color: red; - font-weight: bold; -} - -a { - text-decoration: underline; - font-size: 13px; -} - -a:link { - color: #7db223; -} - -a:hover { - color: #456314; -} - -a:active { - color: #7db223; -} - -a:visited { - color: #7db223; -} - -ul { - list-style: disc url(../images/bullet-arrow.png); -} - -li { - padding-top: 5px; - text-align: left; -} - -li ul { - list-style: square url(../images/bullet-arrow.png); -} - -li ul li ul { - list-style: circle none; -} - -/* table elements */ - -table { - background: #d6e2c3; - margin: 3px 0 0 0; - border: 4px solid #d6e2c3; - border-collapse: collapse; -} - -table table { - margin: -5px 0; - border: 0px solid #e0e7d3; - width: 100%; -} - -table td,table th { - padding: 8px; -} - -table th { - font-size: 12px; - text-align: left; - font-weight: bold; -} - -table thead { - font-weight: bold; - font-style: italic; - background-color: #c2ceaf; -} - -table a:link {color: #303030;} - -caption { - caption-side: top; - width: auto; - text-align: left; - font-size: 12px; - color: #848f73; - padding-bottom: 4px; -} - -fieldset { - background: #e0e7d3; - padding: 8px; - padding-bottom: 22px; - border: none; - width: 560px; -} - -fieldset label { - width: 70px; - float: left; - margin-top: 1.7em; - margin-left: 20px; -} - -fieldset textfield { - margin: 3px; - height: 20px; - background: #e0e7d3; -} - -fieldset textarea { - margin: 3px; - height: 165px; - background: #e0e7d3; -} - -fieldset input { - margin: 3px; - height: 20px; - background: #e0e7d3; -} - -fieldset table { - width: 100%; -} - -fieldset th { - padding-left: 25px; -} - -.table-buttons { - background-color:#fff; - border:none; -} - -.table-buttons td { - border:none; -} - -.submit input { - background:url(../images/submit-bg.png) repeat-x; - border: 2px outset #d7b9c9; - color:#383838; - padding:2px 10px; - font-size:11px; - text-transform:uppercase; - font-weight:bold; -} - -.updated { - background:#ecf1e5; - font-size:11px; - margin-left:2px; - border:4px solid #ecf1e5; -} - -.updated td { - padding:2px 8px; - font-size:11px; - color:#888888; -} diff --git a/org.springframework.samples.petclinic/src/test/java/org/springframework/samples/petclinic/AbstractClinicTests.java b/org.springframework.samples.petclinic/src/test/java/org/springframework/samples/petclinic/AbstractClinicTests.java deleted file mode 100644 index a698691867a..00000000000 --- a/org.springframework.samples.petclinic/src/test/java/org/springframework/samples/petclinic/AbstractClinicTests.java +++ /dev/null @@ -1,224 +0,0 @@ -package org.springframework.samples.petclinic; - -import java.util.Collection; -import java.util.Date; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertTrue; -import org.junit.Test; - -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.samples.petclinic.util.EntityUtils; -import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.junit4.AbstractTransactionalJUnit4SpringContextTests; - -/** - *

- * Base class for {@link Clinic} integration tests. - *

- *

- * "AbstractClinicTests-context.xml" declares a common - * {@link javax.sql.DataSource DataSource}. Subclasses should specify - * additional context locations which declare a - * {@link org.springframework.transaction.PlatformTransactionManager PlatformTransactionManager} - * and a concrete implementation of {@link Clinic}. - *

- *

- * This class extends {@link AbstractTransactionalJUnit4SpringContextTests}, - * one of the valuable testing support classes provided by the - * Spring TestContext Framework found in the - * org.springframework.test.context package. The - * annotation-driven configuration used here represents best practice for - * integration tests with Spring. Note, however, that - * AbstractTransactionalJUnit4SpringContextTests serves only as a convenience - * for extension. For example, if you do not wish for your test classes to be - * tied to a Spring-specific class hierarchy, you may configure your tests with - * annotations such as {@link ContextConfiguration @ContextConfiguration}, - * {@link org.springframework.test.context.TestExecutionListeners @TestExecutionListeners}, - * {@link org.springframework.transaction.annotation.Transactional @Transactional}, - * etc. - *

- *

- * AbstractClinicTests and its subclasses benefit from the following services - * provided by the Spring TestContext Framework: - *

- *
    - *
  • Spring IoC container caching which spares us - * unnecessary set up time between test execution.
  • - *
  • Dependency Injection of test fixture instances, - * meaning that we don't need to perform application context lookups. See the - * use of {@link Autowired @Autowired} on the clinic instance - * variable, which uses autowiring by type. As an alternative, we - * could annotate clinic with - * {@link javax.annotation.Resource @Resource} to achieve dependency injection - * by name. - * (see: {@link ContextConfiguration @ContextConfiguration}, - * {@link org.springframework.test.context.support.DependencyInjectionTestExecutionListener DependencyInjectionTestExecutionListener})
  • - *
  • Transaction management, meaning each test method is - * executed in its own transaction, which is automatically rolled back by - * default. Thus, even if tests insert or otherwise change database state, there - * is no need for a teardown or cleanup script. - * (see: {@link org.springframework.test.context.transaction.TransactionConfiguration @TransactionConfiguration}, - * {@link org.springframework.transaction.annotation.Transactional @Transactional}, - * {@link org.springframework.test.context.transaction.TransactionalTestExecutionListener TransactionalTestExecutionListener})
  • - *
  • Useful inherited protected fields, such as a - * {@link org.springframework.jdbc.core.simple.SimpleJdbcTemplate SimpleJdbcTemplate} - * that can be used to verify database state after test operations or to verify - * the results of queries performed by application code. An - * {@link org.springframework.context.ApplicationContext ApplicationContext} is - * also inherited and can be used for explicit bean lookup if necessary. - * (see: {@link org.springframework.test.context.junit4.AbstractJUnit4SpringContextTests AbstractJUnit4SpringContextTests}, - * {@link AbstractTransactionalJUnit4SpringContextTests})
  • - *
- *

- * The Spring TestContext Framework and related unit and integration testing - * support classes are shipped in spring-test.jar. - *

- * - * @author Ken Krebs - * @author Rod Johnson - * @author Juergen Hoeller - * @author Sam Brannen - */ -@ContextConfiguration -public abstract class AbstractClinicTests extends AbstractTransactionalJUnit4SpringContextTests { - - @Autowired - protected Clinic clinic; - - - @Test - public void getVets() { - Collection vets = this.clinic.getVets(); - // Use the inherited countRowsInTable() convenience method (from - // AbstractTransactionalJUnit4SpringContextTests) to verify the results. - assertEquals("JDBC query must show the same number of vets", super.countRowsInTable("VETS"), vets.size()); - Vet v1 = EntityUtils.getById(vets, Vet.class, 2); - assertEquals("Leary", v1.getLastName()); - assertEquals(1, v1.getNrOfSpecialties()); - assertEquals("radiology", (v1.getSpecialties().get(0)).getName()); - Vet v2 = EntityUtils.getById(vets, Vet.class, 3); - assertEquals("Douglas", v2.getLastName()); - assertEquals(2, v2.getNrOfSpecialties()); - assertEquals("dentistry", (v2.getSpecialties().get(0)).getName()); - assertEquals("surgery", (v2.getSpecialties().get(1)).getName()); - } - - @Test - public void getPetTypes() { - Collection petTypes = this.clinic.getPetTypes(); - assertEquals("JDBC query must show the same number of pet types", super.countRowsInTable("TYPES"), - petTypes.size()); - PetType t1 = EntityUtils.getById(petTypes, PetType.class, 1); - assertEquals("cat", t1.getName()); - PetType t4 = EntityUtils.getById(petTypes, PetType.class, 4); - assertEquals("snake", t4.getName()); - } - - @Test - public void findOwners() { - Collection owners = this.clinic.findOwners("Davis"); - assertEquals(2, owners.size()); - owners = this.clinic.findOwners("Daviss"); - assertEquals(0, owners.size()); - } - - @Test - public void loadOwner() { - Owner o1 = this.clinic.loadOwner(1); - assertTrue(o1.getLastName().startsWith("Franklin")); - Owner o10 = this.clinic.loadOwner(10); - assertEquals("Carlos", o10.getFirstName()); - - // XXX: Add programmatic support for ending transactions with the - // TestContext Framework. - - // Check lazy loading, by ending the transaction: - // endTransaction(); - - // Now Owners are "disconnected" from the data store. - // We might need to touch this collection if we switched to lazy loading - // in mapping files, but this test would pick this up. - o1.getPets(); - } - - @Test - public void insertOwner() { - Collection owners = this.clinic.findOwners("Schultz"); - int found = owners.size(); - Owner owner = new Owner(); - owner.setLastName("Schultz"); - this.clinic.storeOwner(owner); - // assertTrue(!owner.isNew()); -- NOT TRUE FOR TOPLINK (before commit) - owners = this.clinic.findOwners("Schultz"); - assertEquals("Verifying number of owners after inserting a new one.", found + 1, owners.size()); - } - - @Test - public void updateOwner() throws Exception { - Owner o1 = this.clinic.loadOwner(1); - String old = o1.getLastName(); - o1.setLastName(old + "X"); - this.clinic.storeOwner(o1); - o1 = this.clinic.loadOwner(1); - assertEquals(old + "X", o1.getLastName()); - } - - @Test - public void loadPet() { - Collection types = this.clinic.getPetTypes(); - Pet p7 = this.clinic.loadPet(7); - assertTrue(p7.getName().startsWith("Samantha")); - assertEquals(EntityUtils.getById(types, PetType.class, 1).getId(), p7.getType().getId()); - assertEquals("Jean", p7.getOwner().getFirstName()); - Pet p6 = this.clinic.loadPet(6); - assertEquals("George", p6.getName()); - assertEquals(EntityUtils.getById(types, PetType.class, 4).getId(), p6.getType().getId()); - assertEquals("Peter", p6.getOwner().getFirstName()); - } - - @Test - public void insertPet() { - Owner o6 = this.clinic.loadOwner(6); - int found = o6.getPets().size(); - Pet pet = new Pet(); - pet.setName("bowser"); - Collection types = this.clinic.getPetTypes(); - pet.setType(EntityUtils.getById(types, PetType.class, 2)); - pet.setBirthDate(new Date()); - o6.addPet(pet); - assertEquals(found + 1, o6.getPets().size()); - // both storePet and storeOwner are necessary to cover all ORM tools - this.clinic.storePet(pet); - this.clinic.storeOwner(o6); - // assertTrue(!pet.isNew()); -- NOT TRUE FOR TOPLINK (before commit) - o6 = this.clinic.loadOwner(6); - assertEquals(found + 1, o6.getPets().size()); - } - - @Test - public void updatePet() throws Exception { - Pet p7 = this.clinic.loadPet(7); - String old = p7.getName(); - p7.setName(old + "X"); - this.clinic.storePet(p7); - p7 = this.clinic.loadPet(7); - assertEquals(old + "X", p7.getName()); - } - - @Test - public void insertVisit() { - Pet p7 = this.clinic.loadPet(7); - int found = p7.getVisits().size(); - Visit visit = new Visit(); - p7.addVisit(visit); - visit.setDescription("test"); - // both storeVisit and storePet are necessary to cover all ORM tools - this.clinic.storeVisit(visit); - this.clinic.storePet(p7); - // assertTrue(!visit.isNew()); -- NOT TRUE FOR TOPLINK (before commit) - p7 = this.clinic.loadPet(7); - assertEquals(found + 1, p7.getVisits().size()); - } - -} diff --git a/org.springframework.samples.petclinic/src/test/java/org/springframework/samples/petclinic/OwnerTests.java b/org.springframework.samples.petclinic/src/test/java/org/springframework/samples/petclinic/OwnerTests.java deleted file mode 100644 index 84b5f62c6c2..00000000000 --- a/org.springframework.samples.petclinic/src/test/java/org/springframework/samples/petclinic/OwnerTests.java +++ /dev/null @@ -1,27 +0,0 @@ -package org.springframework.samples.petclinic; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNull; - -import org.junit.Test; - -/** - * JUnit test for the {@link Owner} class. - * - * @author Ken Krebs - */ -public class OwnerTests { - - @Test - public void testHasPet() { - Owner owner = new Owner(); - Pet fido = new Pet(); - fido.setName("Fido"); - assertNull(owner.getPet("Fido")); - assertNull(owner.getPet("fido")); - owner.addPet(fido); - assertEquals(fido, owner.getPet("Fido")); - assertEquals(fido, owner.getPet("fido")); - } - -} diff --git a/org.springframework.samples.petclinic/src/test/java/org/springframework/samples/petclinic/PetClinicTestSuite.java b/org.springframework.samples.petclinic/src/test/java/org/springframework/samples/petclinic/PetClinicTestSuite.java deleted file mode 100644 index d5619939937..00000000000 --- a/org.springframework.samples.petclinic/src/test/java/org/springframework/samples/petclinic/PetClinicTestSuite.java +++ /dev/null @@ -1,29 +0,0 @@ -package org.springframework.samples.petclinic; - -import org.junit.runner.RunWith; -import org.junit.runners.Suite; -import org.junit.runners.Suite.SuiteClasses; -import org.springframework.samples.petclinic.hibernate.HibernateClinicTests; -import org.springframework.samples.petclinic.jdbc.SimpleJdbcClinicTests; -import org.springframework.samples.petclinic.jpa.EntityManagerClinicTests; -import org.springframework.samples.petclinic.jpa.HibernateEntityManagerClinicTests; -import org.springframework.samples.petclinic.jpa.OpenJpaEntityManagerClinicTests; -import org.springframework.samples.petclinic.web.VisitsAtomViewTest; - -/** - * JUnit 4 based test suite for all PetClinic tests. - * - * @author Sam Brannen - */ -@RunWith(Suite.class) -@SuiteClasses({ - OwnerTests.class, - SimpleJdbcClinicTests.class, - HibernateClinicTests.class, - EntityManagerClinicTests.class, - HibernateEntityManagerClinicTests.class, - OpenJpaEntityManagerClinicTests.class, - VisitsAtomViewTest.class -}) -public class PetClinicTestSuite { -} diff --git a/org.springframework.samples.petclinic/src/test/java/org/springframework/samples/petclinic/hibernate/HibernateClinicTests.java b/org.springframework.samples.petclinic/src/test/java/org/springframework/samples/petclinic/hibernate/HibernateClinicTests.java deleted file mode 100644 index 3c275c820b2..00000000000 --- a/org.springframework.samples.petclinic/src/test/java/org/springframework/samples/petclinic/hibernate/HibernateClinicTests.java +++ /dev/null @@ -1,20 +0,0 @@ -package org.springframework.samples.petclinic.hibernate; - -import org.springframework.samples.petclinic.AbstractClinicTests; -import org.springframework.test.context.ContextConfiguration; - -/** - *

- * Integration tests for the {@link HibernateClinic} implementation. - *

- *

- * "HibernateClinicTests-context.xml" determines the actual beans to test. - *

- * - * @author Juergen Hoeller - * @author Sam Brannen - */ -@ContextConfiguration -public class HibernateClinicTests extends AbstractClinicTests { - -} diff --git a/org.springframework.samples.petclinic/src/test/java/org/springframework/samples/petclinic/jdbc/SimpleJdbcClinicTests.java b/org.springframework.samples.petclinic/src/test/java/org/springframework/samples/petclinic/jdbc/SimpleJdbcClinicTests.java deleted file mode 100644 index 709100d1a12..00000000000 --- a/org.springframework.samples.petclinic/src/test/java/org/springframework/samples/petclinic/jdbc/SimpleJdbcClinicTests.java +++ /dev/null @@ -1,19 +0,0 @@ -package org.springframework.samples.petclinic.jdbc; - -import org.springframework.samples.petclinic.AbstractClinicTests; -import org.springframework.test.context.ContextConfiguration; - -/** - *

- * Integration tests for the {@link SimpleJdbcClinic} implementation. - *

- *

- * "SimpleJdbcClinicTests-context.xml" determines the actual beans to test. - *

- * - * @author Thomas Risberg - */ -@ContextConfiguration -public class SimpleJdbcClinicTests extends AbstractClinicTests { - -} diff --git a/org.springframework.samples.petclinic/src/test/java/org/springframework/samples/petclinic/jpa/AbstractJpaClinicTests.java b/org.springframework.samples.petclinic/src/test/java/org/springframework/samples/petclinic/jpa/AbstractJpaClinicTests.java deleted file mode 100644 index 251af819d16..00000000000 --- a/org.springframework.samples.petclinic/src/test/java/org/springframework/samples/petclinic/jpa/AbstractJpaClinicTests.java +++ /dev/null @@ -1,199 +0,0 @@ - -package org.springframework.samples.petclinic.jpa; - -import java.util.Collection; -import java.util.Date; - -import javax.persistence.EntityManager; - -import org.springframework.jdbc.core.simple.SimpleJdbcTemplate; -import org.springframework.samples.petclinic.Clinic; -import org.springframework.samples.petclinic.Owner; -import org.springframework.samples.petclinic.Pet; -import org.springframework.samples.petclinic.PetType; -import org.springframework.samples.petclinic.Vet; -import org.springframework.samples.petclinic.Visit; -import org.springframework.samples.petclinic.util.EntityUtils; -import org.springframework.test.annotation.ExpectedException; -import org.springframework.test.jpa.AbstractJpaTests; - -/** - *

- * This class extends {@link AbstractJpaTests}, one of the valuable test - * superclasses provided in the org.springframework.test package. - * This represents best practice for integration tests with Spring for JPA based - * tests which require shadow class loading. For all other types of - * integration testing, the Spring TestContext Framework is - * preferred. - *

- *

- * AbstractJpaTests and its superclasses provide the following services: - *

    - *
  • Injects test dependencies, meaning that we don't need to perform - * application context lookups. See the setClinic() method. Injection uses - * autowiring by type.
  • - *
  • Executes each test method in its own transaction, which is automatically - * rolled back by default. This means that even if tests insert or otherwise - * change database state, there is no need for a teardown or cleanup script.
  • - *
  • Provides useful inherited protected fields, such as a - * {@link SimpleJdbcTemplate} that can be used to verify database state after - * test operations, or verify the results of queries performed by application - * code. Alternatively, you can use protected convenience methods such as - * {@link #countRowsInTable(String)}, {@link #deleteFromTables(String[])}, - * etc. An ApplicationContext is also inherited, and can be used for explicit - * lookup if necessary.
  • - *
- *

- * {@link AbstractJpaTests} and related classes are shipped in - * spring-test.jar. - *

- * - * @author Rod Johnson - * @author Sam Brannen - * @see AbstractJpaTests - */ -public abstract class AbstractJpaClinicTests extends AbstractJpaTests { - - protected Clinic clinic; - - - /** - * This method is provided to set the Clinic instance being tested by the - * Dependency Injection injection behaviour of the superclass from the - * org.springframework.test package. - * - * @param clinic clinic to test - */ - public void setClinic(Clinic clinic) { - this.clinic = clinic; - } - - @ExpectedException(IllegalArgumentException.class) - public void testBogusJpql() { - this.sharedEntityManager.createQuery("SELECT RUBBISH FROM RUBBISH HEAP").executeUpdate(); - } - - public void testApplicationManaged() { - EntityManager appManaged = this.entityManagerFactory.createEntityManager(); - appManaged.joinTransaction(); - } - - public void testGetVets() { - Collection vets = this.clinic.getVets(); - // Use the inherited countRowsInTable() convenience method (from - // AbstractTransactionalDataSourceSpringContextTests) to verify the - // results. - assertEquals("JDBC query must show the same number of vets", super.countRowsInTable("VETS"), vets.size()); - Vet v1 = EntityUtils.getById(vets, Vet.class, 2); - assertEquals("Leary", v1.getLastName()); - assertEquals(1, v1.getNrOfSpecialties()); - assertEquals("radiology", (v1.getSpecialties().get(0)).getName()); - Vet v2 = EntityUtils.getById(vets, Vet.class, 3); - assertEquals("Douglas", v2.getLastName()); - assertEquals(2, v2.getNrOfSpecialties()); - assertEquals("dentistry", (v2.getSpecialties().get(0)).getName()); - assertEquals("surgery", (v2.getSpecialties().get(1)).getName()); - } - - public void testGetPetTypes() { - Collection petTypes = this.clinic.getPetTypes(); - assertEquals("JDBC query must show the same number of pet types", super.countRowsInTable("TYPES"), - petTypes.size()); - PetType t1 = EntityUtils.getById(petTypes, PetType.class, 1); - assertEquals("cat", t1.getName()); - PetType t4 = EntityUtils.getById(petTypes, PetType.class, 4); - assertEquals("snake", t4.getName()); - } - - public void testFindOwners() { - Collection owners = this.clinic.findOwners("Davis"); - assertEquals(2, owners.size()); - owners = this.clinic.findOwners("Daviss"); - assertEquals(0, owners.size()); - } - - public void testLoadOwner() { - Owner o1 = this.clinic.loadOwner(1); - assertTrue(o1.getLastName().startsWith("Franklin")); - Owner o10 = this.clinic.loadOwner(10); - assertEquals("Carlos", o10.getFirstName()); - - // Check lazy loading, by ending the transaction - endTransaction(); - - // Now Owners are "disconnected" from the data store. - // We might need to touch this collection if we switched to lazy loading - // in mapping files, but this test would pick this up. - o1.getPets(); - } - - public void testInsertOwner() { - Collection owners = this.clinic.findOwners("Schultz"); - int found = owners.size(); - Owner owner = new Owner(); - owner.setLastName("Schultz"); - this.clinic.storeOwner(owner); - // assertTrue(!owner.isNew()); -- NOT TRUE FOR TOPLINK (before commit) - owners = this.clinic.findOwners("Schultz"); - assertEquals(found + 1, owners.size()); - } - - public void testUpdateOwner() throws Exception { - Owner o1 = this.clinic.loadOwner(1); - String old = o1.getLastName(); - o1.setLastName(old + "X"); - this.clinic.storeOwner(o1); - o1 = this.clinic.loadOwner(1); - assertEquals(old + "X", o1.getLastName()); - } - - public void testLoadPet() { - Collection types = this.clinic.getPetTypes(); - Pet p7 = this.clinic.loadPet(7); - assertTrue(p7.getName().startsWith("Samantha")); - assertEquals(EntityUtils.getById(types, PetType.class, 1).getId(), p7.getType().getId()); - assertEquals("Jean", p7.getOwner().getFirstName()); - Pet p6 = this.clinic.loadPet(6); - assertEquals("George", p6.getName()); - assertEquals(EntityUtils.getById(types, PetType.class, 4).getId(), p6.getType().getId()); - assertEquals("Peter", p6.getOwner().getFirstName()); - } - - public void testInsertPet() { - Owner o6 = this.clinic.loadOwner(6); - int found = o6.getPets().size(); - Pet pet = new Pet(); - pet.setName("bowser"); - Collection types = this.clinic.getPetTypes(); - pet.setType(EntityUtils.getById(types, PetType.class, 2)); - pet.setBirthDate(new Date()); - o6.addPet(pet); - assertEquals(found + 1, o6.getPets().size()); - this.clinic.storeOwner(o6); - // assertTrue(!pet.isNew()); -- NOT TRUE FOR TOPLINK (before commit) - o6 = this.clinic.loadOwner(6); - assertEquals(found + 1, o6.getPets().size()); - } - - public void testUpdatePet() throws Exception { - Pet p7 = this.clinic.loadPet(7); - String old = p7.getName(); - p7.setName(old + "X"); - this.clinic.storePet(p7); - p7 = this.clinic.loadPet(7); - assertEquals(old + "X", p7.getName()); - } - - public void testInsertVisit() { - Pet p7 = this.clinic.loadPet(7); - int found = p7.getVisits().size(); - Visit visit = new Visit(); - p7.addVisit(visit); - visit.setDescription("test"); - this.clinic.storePet(p7); - // assertTrue(!visit.isNew()); -- NOT TRUE FOR TOPLINK (before commit) - p7 = this.clinic.loadPet(7); - assertEquals(found + 1, p7.getVisits().size()); - } - -} diff --git a/org.springframework.samples.petclinic/src/test/java/org/springframework/samples/petclinic/jpa/EntityManagerClinicTests.java b/org.springframework.samples.petclinic/src/test/java/org/springframework/samples/petclinic/jpa/EntityManagerClinicTests.java deleted file mode 100644 index 67c472fdeea..00000000000 --- a/org.springframework.samples.petclinic/src/test/java/org/springframework/samples/petclinic/jpa/EntityManagerClinicTests.java +++ /dev/null @@ -1,51 +0,0 @@ -package org.springframework.samples.petclinic.jpa; - -import java.util.List; - -import org.springframework.samples.petclinic.aspects.UsageLogAspect; - -/** - *

- * Tests for the DAO variant based on the shared EntityManager approach. Uses - * TopLink Essentials (the reference implementation) for testing. - *

- *

- * Specifically tests usage of an orm.xml file, loaded by the - * persistence provider through the Spring-provided persistence unit root URL. - *

- * - * @author Rod Johnson - * @author Juergen Hoeller - */ -public class EntityManagerClinicTests extends AbstractJpaClinicTests { - - private UsageLogAspect usageLogAspect; - - public void setUsageLogAspect(UsageLogAspect usageLogAspect) { - this.usageLogAspect = usageLogAspect; - } - - @Override - protected String[] getConfigPaths() { - return new String[] { - "applicationContext-jpaCommon.xml", - "applicationContext-toplinkAdapter.xml", - "applicationContext-entityManager.xml" - }; - } - - public void testUsageLogAspectIsInvoked() { - String name1 = "Schuurman"; - String name2 = "Greenwood"; - String name3 = "Leau"; - - assertTrue(this.clinic.findOwners(name1).isEmpty()); - assertTrue(this.clinic.findOwners(name2).isEmpty()); - - List namesRequested = this.usageLogAspect.getNamesRequested(); - assertTrue(namesRequested.contains(name1)); - assertTrue(namesRequested.contains(name2)); - assertFalse(namesRequested.contains(name3)); - } - -} diff --git a/org.springframework.samples.petclinic/src/test/java/org/springframework/samples/petclinic/jpa/HibernateEntityManagerClinicTests.java b/org.springframework.samples.petclinic/src/test/java/org/springframework/samples/petclinic/jpa/HibernateEntityManagerClinicTests.java deleted file mode 100644 index d95b452e17c..00000000000 --- a/org.springframework.samples.petclinic/src/test/java/org/springframework/samples/petclinic/jpa/HibernateEntityManagerClinicTests.java +++ /dev/null @@ -1,26 +0,0 @@ -package org.springframework.samples.petclinic.jpa; - -/** - *

- * Tests for the DAO variant based on the shared EntityManager approach, using - * Hibernate EntityManager for testing instead of the reference implementation. - *

- *

- * Specifically tests usage of an orm.xml file, loaded by the - * persistence provider through the Spring-provided persistence unit root URL. - *

- * - * @author Juergen Hoeller - */ -public class HibernateEntityManagerClinicTests extends EntityManagerClinicTests { - - @Override - protected String[] getConfigPaths() { - return new String[] { - "applicationContext-jpaCommon.xml", - "applicationContext-hibernateAdapter.xml", - "applicationContext-entityManager.xml" - }; - } - -} diff --git a/org.springframework.samples.petclinic/src/test/java/org/springframework/samples/petclinic/jpa/OpenJpaEntityManagerClinicTests.java b/org.springframework.samples.petclinic/src/test/java/org/springframework/samples/petclinic/jpa/OpenJpaEntityManagerClinicTests.java deleted file mode 100644 index 98e38ed6134..00000000000 --- a/org.springframework.samples.petclinic/src/test/java/org/springframework/samples/petclinic/jpa/OpenJpaEntityManagerClinicTests.java +++ /dev/null @@ -1,27 +0,0 @@ - -package org.springframework.samples.petclinic.jpa; - -/** - *

- * Tests for the DAO variant based on the shared EntityManager approach, using - * Apache OpenJPA for testing instead of the reference implementation. - *

- *

- * Specifically tests usage of an orm.xml file, loaded by the - * persistence provider through the Spring-provided persistence unit root URL. - *

- * - * @author Juergen Hoeller - */ -public class OpenJpaEntityManagerClinicTests extends EntityManagerClinicTests { - - @Override - protected String[] getConfigPaths() { - return new String[] { - "applicationContext-jpaCommon.xml", - "applicationContext-openJpaAdapter.xml", - "applicationContext-entityManager.xml" - }; - } - -} diff --git a/org.springframework.samples.petclinic/src/test/java/org/springframework/samples/petclinic/web/VisitsAtomViewTest.java b/org.springframework.samples.petclinic/src/test/java/org/springframework/samples/petclinic/web/VisitsAtomViewTest.java deleted file mode 100644 index 1e82e1d5bb1..00000000000 --- a/org.springframework.samples.petclinic/src/test/java/org/springframework/samples/petclinic/web/VisitsAtomViewTest.java +++ /dev/null @@ -1,90 +0,0 @@ -/* - * Copyright 2002-2009 the original author or authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.springframework.samples.petclinic.web; - -import java.util.ArrayList; -import java.util.Date; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import com.sun.syndication.feed.atom.Entry; -import com.sun.syndication.feed.atom.Feed; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; -import org.junit.Before; -import org.junit.Test; - -import org.springframework.samples.petclinic.Pet; -import org.springframework.samples.petclinic.PetType; -import org.springframework.samples.petclinic.Visit; - -/** - * @author Arjen Poutsma - */ -public class VisitsAtomViewTest { - - private VisitsAtomView visitView; - - private Map model; - - private Feed feed; - - @Before - public void setUp() { - visitView = new VisitsAtomView(); - PetType dog = new PetType(); - dog.setName("dog"); - Pet bello = new Pet(); - bello.setName("Bello"); - bello.setType(dog); - Visit belloVisit = new Visit(); - belloVisit.setPet(bello); - belloVisit.setDate(new Date(2009, 0, 1)); - belloVisit.setDescription("Bello visit"); - Pet wodan = new Pet(); - wodan.setName("Wodan"); - wodan.setType(dog); - Visit wodanVisit = new Visit(); - wodanVisit.setPet(wodan); - wodanVisit.setDate(new Date(2009, 0, 2)); - wodanVisit.setDescription("Wodan visit"); - List visits = new ArrayList(); - visits.add(belloVisit); - visits.add(wodanVisit); - - model = new HashMap(); - model.put("visits", visits); - feed = new Feed(); - - } - - @Test - public void buildFeedMetadata() { - visitView.buildFeedMetadata(model, feed, null); - - assertNotNull("No id set", feed.getId()); - assertNotNull("No title set", feed.getTitle()); - assertEquals("Invalid update set", new Date(2009, 0, 2), feed.getUpdated()); - } - - @Test - public void buildFeedEntries() throws Exception { - List entries = visitView.buildFeedEntries(model, null, null); - assertEquals("Invalid amount of entries", 2, entries.size()); - } -} diff --git a/org.springframework.samples.petclinic/src/test/resources/log4j.xml b/org.springframework.samples.petclinic/src/test/resources/log4j.xml deleted file mode 100644 index 767b96d6206..00000000000 --- a/org.springframework.samples.petclinic/src/test/resources/log4j.xml +++ /dev/null @@ -1,28 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/org.springframework.samples.petclinic/src/test/resources/org/springframework/samples/petclinic/AbstractClinicTests-context.xml b/org.springframework.samples.petclinic/src/test/resources/org/springframework/samples/petclinic/AbstractClinicTests-context.xml deleted file mode 100644 index 3f79cbc0939..00000000000 --- a/org.springframework.samples.petclinic/src/test/resources/org/springframework/samples/petclinic/AbstractClinicTests-context.xml +++ /dev/null @@ -1,22 +0,0 @@ - - - - - - - - - - - - diff --git a/org.springframework.samples.petclinic/src/test/resources/org/springframework/samples/petclinic/hibernate/HibernateClinicTests-context.xml b/org.springframework.samples.petclinic/src/test/resources/org/springframework/samples/petclinic/hibernate/HibernateClinicTests-context.xml deleted file mode 100644 index 7320035cece..00000000000 --- a/org.springframework.samples.petclinic/src/test/resources/org/springframework/samples/petclinic/hibernate/HibernateClinicTests-context.xml +++ /dev/null @@ -1,32 +0,0 @@ - - - - - - - - - - - ${hibernate.dialect} - ${hibernate.show_sql} - - - - - - - - - - - - - - - - diff --git a/org.springframework.samples.petclinic/src/test/resources/org/springframework/samples/petclinic/jdbc/SimpleJdbcClinicTests-context.xml b/org.springframework.samples.petclinic/src/test/resources/org/springframework/samples/petclinic/jdbc/SimpleJdbcClinicTests-context.xml deleted file mode 100644 index 81a536988bc..00000000000 --- a/org.springframework.samples.petclinic/src/test/resources/org/springframework/samples/petclinic/jdbc/SimpleJdbcClinicTests-context.xml +++ /dev/null @@ -1,11 +0,0 @@ - - - - - - - - diff --git a/org.springframework.samples.petclinic/src/test/resources/org/springframework/samples/petclinic/jpa/applicationContext-entityManager.xml b/org.springframework.samples.petclinic/src/test/resources/org/springframework/samples/petclinic/jpa/applicationContext-entityManager.xml deleted file mode 100644 index a9d25738584..00000000000 --- a/org.springframework.samples.petclinic/src/test/resources/org/springframework/samples/petclinic/jpa/applicationContext-entityManager.xml +++ /dev/null @@ -1,16 +0,0 @@ - - - - - - - - - - - - diff --git a/org.springframework.samples.petclinic/src/test/resources/org/springframework/samples/petclinic/jpa/applicationContext-hibernateAdapter.xml b/org.springframework.samples.petclinic/src/test/resources/org/springframework/samples/petclinic/jpa/applicationContext-hibernateAdapter.xml deleted file mode 100644 index 447d1bce08f..00000000000 --- a/org.springframework.samples.petclinic/src/test/resources/org/springframework/samples/petclinic/jpa/applicationContext-hibernateAdapter.xml +++ /dev/null @@ -1,9 +0,0 @@ - - - - - - diff --git a/org.springframework.samples.petclinic/src/test/resources/org/springframework/samples/petclinic/jpa/applicationContext-jpaCommon.xml b/org.springframework.samples.petclinic/src/test/resources/org/springframework/samples/petclinic/jpa/applicationContext-jpaCommon.xml deleted file mode 100644 index b873dfc47ed..00000000000 --- a/org.springframework.samples.petclinic/src/test/resources/org/springframework/samples/petclinic/jpa/applicationContext-jpaCommon.xml +++ /dev/null @@ -1,31 +0,0 @@ - - - - - - - - - - - - - - - - - - - diff --git a/org.springframework.samples.petclinic/src/test/resources/org/springframework/samples/petclinic/jpa/applicationContext-openJpaAdapter.xml b/org.springframework.samples.petclinic/src/test/resources/org/springframework/samples/petclinic/jpa/applicationContext-openJpaAdapter.xml deleted file mode 100644 index 8f6f7c4427c..00000000000 --- a/org.springframework.samples.petclinic/src/test/resources/org/springframework/samples/petclinic/jpa/applicationContext-openJpaAdapter.xml +++ /dev/null @@ -1,9 +0,0 @@ - - - - - - diff --git a/org.springframework.samples.petclinic/src/test/resources/org/springframework/samples/petclinic/jpa/applicationContext-toplinkAdapter.xml b/org.springframework.samples.petclinic/src/test/resources/org/springframework/samples/petclinic/jpa/applicationContext-toplinkAdapter.xml deleted file mode 100644 index ac031de8e14..00000000000 --- a/org.springframework.samples.petclinic/src/test/resources/org/springframework/samples/petclinic/jpa/applicationContext-toplinkAdapter.xml +++ /dev/null @@ -1,9 +0,0 @@ - - - - - -