first step of migration to Spring 3.2 (still in process)
34
.classpath
|
@ -1,15 +1,37 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<classpath>
|
||||
<classpathentry kind="src" output="target/classes" path="src/main/java"/>
|
||||
<classpathentry kind="src" output="target/classes" path="src/main/resources"/>
|
||||
<classpathentry kind="src" output="target/test-classes" path="src/test/java"/>
|
||||
<classpathentry kind="src" output="target/test-classes" path="src/test/resources"/>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
|
||||
<classpathentry kind="src" output="target/classes" path="src/main/java">
|
||||
<attributes>
|
||||
<attribute name="optional" value="true"/>
|
||||
<attribute name="maven.pomderived" value="true"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry excluding="**" kind="src" output="target/classes" path="src/main/resources">
|
||||
<attributes>
|
||||
<attribute name="maven.pomderived" value="true"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="src" output="target/test-classes" path="src/test/java">
|
||||
<attributes>
|
||||
<attribute name="optional" value="true"/>
|
||||
<attribute name="maven.pomderived" value="true"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry excluding="**" kind="src" output="target/test-classes" path="src/test/resources">
|
||||
<attributes>
|
||||
<attribute name="maven.pomderived" value="true"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6">
|
||||
<attributes>
|
||||
<attribute name="maven.pomderived" value="true"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
|
||||
<attributes>
|
||||
<attribute name="maven.pomderived" value="true"/>
|
||||
<attribute name="org.eclipse.jst.component.dependency" value="/WEB-INF/lib"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="con" path="org.eclipse.jst.j2ee.internal.web.container"/>
|
||||
<classpathentry kind="output" path="target/classes"/>
|
||||
</classpath>
|
||||
|
|
15
.project
|
@ -1,9 +1,8 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<projectDescription>
|
||||
<name>org.springframework.samples.petclinic</name>
|
||||
<comment></comment>
|
||||
<name>spring-petclinic</name>
|
||||
<comment>NO_M2ECLIPSE_SUPPORT: Project files created with the maven-eclipse-plugin are not supported in M2Eclipse.</comment>
|
||||
<projects>
|
||||
<project>Servers</project>
|
||||
</projects>
|
||||
<buildSpec>
|
||||
<buildCommand>
|
||||
|
@ -38,12 +37,12 @@
|
|||
</buildCommand>
|
||||
</buildSpec>
|
||||
<natures>
|
||||
<nature>org.eclipse.jem.workbench.JavaEMFNature</nature>
|
||||
<nature>org.springframework.ide.eclipse.core.springnature</nature>
|
||||
<nature>org.eclipse.jdt.core.javanature</nature>
|
||||
<nature>org.eclipse.wst.common.project.facet.core.nature</nature>
|
||||
<nature>org.eclipse.wst.common.modulecore.ModuleCoreNature</nature>
|
||||
<nature>org.eclipse.wst.jsdt.core.jsNature</nature>
|
||||
<nature>org.eclipse.m2e.core.maven2Nature</nature>
|
||||
<nature>org.eclipse.wst.common.project.facet.core.nature</nature>
|
||||
<nature>org.eclipse.jdt.core.javanature</nature>
|
||||
<nature>org.eclipse.wst.common.modulecore.ModuleCoreNature</nature>
|
||||
<nature>org.eclipse.jem.workbench.JavaEMFNature</nature>
|
||||
<nature>org.eclipse.wst.jsdt.core.jsNature</nature>
|
||||
</natures>
|
||||
</projectDescription>
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<classpath>
|
||||
<classpathentry kind="src" path="src/main/webapp"/>
|
||||
<classpathentry kind="src" path="target/m2e-wtp/web-resources"/>
|
||||
<classpathentry kind="con" path="org.eclipse.wst.jsdt.launching.JRE_CONTAINER"/>
|
||||
<classpathentry kind="con" path="org.eclipse.wst.jsdt.launching.WebProject">
|
||||
<attributes>
|
||||
|
|
|
@ -1,12 +1,8 @@
|
|||
#Tue Mar 17 10:00:21 EDT 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.codegen.targetPlatform=1.6
|
||||
org.eclipse.jdt.core.compiler.compliance=1.6
|
||||
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
|
||||
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
|
||||
org.eclipse.jdt.core.compiler.source=1.5
|
||||
org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
|
||||
org.eclipse.jdt.core.compiler.source=1.6
|
||||
|
|
|
@ -1,3 +0,0 @@
|
|||
#Tue Mar 17 09:59:19 EDT 2009
|
||||
classpath.helper/org.eclipse.jdt.launching.JRE_CONTAINER\:\:org.eclipse.jdt.internal.launching.macosx.MacOSXType\:\:JVM\ 1.5.0\ (MacOS\ X\ Default)/owners=jst.java\:5.0
|
||||
eclipse.preferences.version=1
|
4
.settings/org.eclipse.m2e.core.prefs
Normal file
|
@ -0,0 +1,4 @@
|
|||
activeProfiles=
|
||||
eclipse.preferences.version=1
|
||||
resolveWorkspaceProjects=true
|
||||
version=1
|
2
.settings/org.eclipse.m2e.wtp.prefs
Normal file
|
@ -0,0 +1,2 @@
|
|||
eclipse.preferences.version=1
|
||||
org.eclipse.m2e.wtp.enabledProjectSpecificPrefs=false
|
|
@ -1,10 +1,11 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project-modules id="moduleCoreId" project-version="1.5.0">
|
||||
<wb-module deploy-name="org.springframework.samples.petclinic">
|
||||
<wb-resource deploy-path="/" source-path="/src/main/webapp"/>
|
||||
<wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/java"/>
|
||||
<wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/resources"/>
|
||||
<property name="java-output-path" value="target/classes"/>
|
||||
<property name="context-root" value="petclinic"/>
|
||||
</wb-module>
|
||||
<wb-module deploy-name="spring-petclinic">
|
||||
<wb-resource deploy-path="/" source-path="/target/m2e-wtp/web-resources"/>
|
||||
<wb-resource deploy-path="/" source-path="/src/main/webapp" tag="defaultRootSource"/>
|
||||
<wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/java"/>
|
||||
<wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/resources"/>
|
||||
<property name="context-root" value="petclinic"/>
|
||||
<property name="java-output-path" value="/spring-petclinic/target/classes"/>
|
||||
</wb-module>
|
||||
</project-modules>
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<faceted-project>
|
||||
<fixed facet="jst.web"/>
|
||||
<fixed facet="jst.java"/>
|
||||
<installed facet="jst.java" version="5.0"/>
|
||||
<installed facet="jst.web" version="2.5"/>
|
||||
<fixed facet="wst.jsdt.web"/>
|
||||
<installed facet="java" version="1.6"/>
|
||||
<installed facet="jst.web" version="2.4"/>
|
||||
<installed facet="wst.jsdt.web" version="1.0"/>
|
||||
</faceted-project>
|
||||
|
|
|
@ -1,4 +0,0 @@
|
|||
spring-petclinic
|
||||
================
|
||||
|
||||
sample application for the Spring framework
|
|
@ -1,14 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<classpath>
|
||||
<classpathentry kind="src" path="src/main/java"/>
|
||||
<classpathentry kind="src" output="target/test-classes" path="src/test/java"/>
|
||||
<classpathentry kind="src" output="target/test-classes" path="src/test/resources"/>
|
||||
<classpathentry kind="src" path="src/main/resources"/>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
|
||||
<classpathentry exported="true" kind="con" path="org.maven.ide.eclipse.MAVEN2_CLASSPATH_CONTAINER">
|
||||
<attributes>
|
||||
<attribute name="org.eclipse.jst.component.dependency" value="/WEB-INF/lib"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="output" path="target/classes"/>
|
||||
</classpath>
|
|
@ -1,42 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<projectDescription>
|
||||
<name>org.springframework.samples.petclinic</name>
|
||||
<comment></comment>
|
||||
<projects>
|
||||
<project>Servers</project>
|
||||
</projects>
|
||||
<buildSpec>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.jdt.core.javabuilder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.wst.common.project.facet.core.builder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.wst.validation.validationbuilder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
<buildCommand>
|
||||
<name>org.springframework.ide.eclipse.core.springbuilder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
<buildCommand>
|
||||
<name>org.maven.ide.eclipse.maven2Builder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
</buildSpec>
|
||||
<natures>
|
||||
<nature>org.maven.ide.eclipse.maven2Nature</nature>
|
||||
<nature>org.springframework.ide.eclipse.core.springnature</nature>
|
||||
<nature>org.eclipse.jdt.core.javanature</nature>
|
||||
<nature>org.eclipse.wst.common.project.facet.core.nature</nature>
|
||||
<nature>org.eclipse.wst.common.modulecore.ModuleCoreNature</nature>
|
||||
</natures>
|
||||
</projectDescription>
|
|
@ -1,2 +0,0 @@
|
|||
<classpath>
|
||||
</classpath>
|
|
@ -1,12 +0,0 @@
|
|||
#Tue Mar 17 10:00:21 EDT 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
|
|
@ -1,3 +0,0 @@
|
|||
#Tue Mar 17 09:59:19 EDT 2009
|
||||
classpath.helper/org.eclipse.jdt.launching.JRE_CONTAINER\:\:org.eclipse.jdt.internal.launching.macosx.MacOSXType\:\:JVM\ 1.5.0\ (MacOS\ X\ Default)/owners=jst.java\:5.0
|
||||
eclipse.preferences.version=1
|
|
@ -1,10 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project-modules id="moduleCoreId" project-version="1.5.0">
|
||||
<wb-module deploy-name="org.springframework.samples.petclinic">
|
||||
<wb-resource deploy-path="/" source-path="/src/main/webapp"/>
|
||||
<wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/java"/>
|
||||
<wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/resources"/>
|
||||
<property name="java-output-path" value="target/classes"/>
|
||||
<property name="context-root" value="petclinic"/>
|
||||
</wb-module>
|
||||
</project-modules>
|
|
@ -1,7 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<faceted-project>
|
||||
<fixed facet="jst.web"/>
|
||||
<fixed facet="jst.java"/>
|
||||
<installed facet="jst.java" version="5.0"/>
|
||||
<installed facet="jst.web" version="2.5"/>
|
||||
</faceted-project>
|
|
@ -1,6 +0,0 @@
|
|||
#Fri Jun 06 17:00:12 BST 2008
|
||||
DELEGATES_PREFERENCE=delegateValidatorListorg.eclipse.wst.wsdl.validation.internal.eclipse.WSDLDelegatingValidator\=org.eclipse.wst.wsdl.validation.internal.eclipse.Validator;org.eclipse.wst.xsd.core.internal.validation.eclipse.XSDDelegatingValidator\=org.eclipse.wst.xsd.core.internal.validation.eclipse.Validator;
|
||||
USER_BUILD_PREFERENCE=enabledBuildValidatorListorg.eclipse.wst.wsdl.validation.internal.eclipse.WSDLDelegatingValidator;org.eclipse.wst.xsd.core.internal.validation.eclipse.XSDDelegatingValidator;org.eclipse.jst.jsf.validation.internal.JSPSemanticsValidator;org.eclipse.wst.dtd.core.internal.validation.eclipse.Validator;org.eclipse.wst.xml.core.internal.validation.eclipse.Validator;org.eclipse.wst.common.componentcore.internal.ModuleCoreValidator;org.eclipse.jst.jsf.validation.internal.appconfig.AppConfigValidator;org.eclipse.jst.jsp.core.internal.validation.JSPBatchValidator;org.eclipse.wst.html.internal.validation.HTMLValidator;org.eclipse.jst.jsp.core.internal.validation.JSPContentValidator;org.eclipse.jst.j2ee.internal.classpathdep.ClasspathDependencyValidator;org.eclipse.wst.wsi.ui.internal.WSIMessageValidator;
|
||||
USER_MANUAL_PREFERENCE=enabledManualValidatorListorg.eclipse.wst.wsdl.validation.internal.eclipse.WSDLDelegatingValidator;org.eclipse.wst.xsd.core.internal.validation.eclipse.XSDDelegatingValidator;org.eclipse.jst.jsf.validation.internal.JSPSemanticsValidator;org.eclipse.wst.dtd.core.internal.validation.eclipse.Validator;org.eclipse.wst.xml.core.internal.validation.eclipse.Validator;org.eclipse.wst.common.componentcore.internal.ModuleCoreValidator;org.eclipse.jst.jsf.validation.internal.appconfig.AppConfigValidator;org.eclipse.jst.jsp.core.internal.validation.JSPBatchValidator;org.eclipse.wst.html.internal.validation.HTMLValidator;org.eclipse.jst.jsp.core.internal.validation.JSPContentValidator;org.eclipse.jst.j2ee.internal.classpathdep.ClasspathDependencyValidator;org.eclipse.wst.wsi.ui.internal.WSIMessageValidator;
|
||||
USER_PREFERENCE=overrideGlobalPreferencesfalse
|
||||
eclipse.preferences.version=1
|
|
@ -1,9 +0,0 @@
|
|||
#Tue Mar 17 14:28:16 EDT 2009
|
||||
activeProfiles=
|
||||
eclipse.preferences.version=1
|
||||
fullBuildGoals=process-test-resources
|
||||
includeModules=false
|
||||
resolveWorkspaceProjects=true
|
||||
resourceFilterGoals=process-resources resources\:testResources
|
||||
skipCompilerPlugin=true
|
||||
version=1
|
|
@ -1,3 +0,0 @@
|
|||
#Wed Dec 17 01:09:03 EST 2008
|
||||
eclipse.preferences.version=1
|
||||
org.springframework.ide.eclipse.beans.core.ignoreMissingNamespaceHandler=false
|
|
@ -1,67 +0,0 @@
|
|||
#Tue Mar 17 10:00:21 EDT 2009
|
||||
eclipse.preferences.version=1
|
||||
org.springframework.ide.eclipse.core.builders.enable.aopreferencemodelbuilder=true
|
||||
org.springframework.ide.eclipse.core.builders.enable.beanmetadatabuilder=false
|
||||
org.springframework.ide.eclipse.core.builders.enable.osgibundleupdater=true
|
||||
org.springframework.ide.eclipse.core.enable.project.preferences=false
|
||||
org.springframework.ide.eclipse.core.validator.enable.com.springsource.server.ide.manifest.core.manifestvalidator=true
|
||||
org.springframework.ide.eclipse.core.validator.enable.com.springsource.sts.bestpractices.beansvalidator=true
|
||||
org.springframework.ide.eclipse.core.validator.enable.com.springsource.sts.server.quickfix.manifestvalidator=true
|
||||
org.springframework.ide.eclipse.core.validator.enable.org.springframework.ide.eclipse.beans.core.beansvalidator=true
|
||||
org.springframework.ide.eclipse.core.validator.enable.org.springframework.ide.eclipse.core.springvalidator=false
|
||||
org.springframework.ide.eclipse.core.validator.enable.org.springframework.ide.eclipse.webflow.core.validator=true
|
||||
org.springframework.ide.eclipse.core.validator.rule.enable.com.springsource.server.ide.manifest.core.applicationSymbolicNameRule-com.springsource.server.ide.manifest.core.manifestvalidator=true
|
||||
org.springframework.ide.eclipse.core.validator.rule.enable.com.springsource.server.ide.manifest.core.applicationVersionRule-com.springsource.server.ide.manifest.core.manifestvalidator=true
|
||||
org.springframework.ide.eclipse.core.validator.rule.enable.com.springsource.server.ide.manifest.core.bundleActivationPolicyRule-com.springsource.server.ide.manifest.core.manifestvalidator=true
|
||||
org.springframework.ide.eclipse.core.validator.rule.enable.com.springsource.server.ide.manifest.core.bundleActivatorRule-com.springsource.server.ide.manifest.core.manifestvalidator=true
|
||||
org.springframework.ide.eclipse.core.validator.rule.enable.com.springsource.server.ide.manifest.core.bundleManifestVersionRule-com.springsource.server.ide.manifest.core.manifestvalidator=true
|
||||
org.springframework.ide.eclipse.core.validator.rule.enable.com.springsource.server.ide.manifest.core.bundleNameRule-com.springsource.server.ide.manifest.core.manifestvalidator=true
|
||||
org.springframework.ide.eclipse.core.validator.rule.enable.com.springsource.server.ide.manifest.core.bundleSymbolicNameRule-com.springsource.server.ide.manifest.core.manifestvalidator=true
|
||||
org.springframework.ide.eclipse.core.validator.rule.enable.com.springsource.server.ide.manifest.core.bundleVersionRule-com.springsource.server.ide.manifest.core.manifestvalidator=true
|
||||
org.springframework.ide.eclipse.core.validator.rule.enable.com.springsource.server.ide.manifest.core.exportPackageRule-com.springsource.server.ide.manifest.core.manifestvalidator=true
|
||||
org.springframework.ide.eclipse.core.validator.rule.enable.com.springsource.server.ide.manifest.core.importRule-com.springsource.server.ide.manifest.core.manifestvalidator=true
|
||||
org.springframework.ide.eclipse.core.validator.rule.enable.com.springsource.server.ide.manifest.core.parsingProblemsRule-com.springsource.server.ide.manifest.core.manifestvalidator=true
|
||||
org.springframework.ide.eclipse.core.validator.rule.enable.com.springsource.server.ide.manifest.core.requireBundleRule-com.springsource.server.ide.manifest.core.manifestvalidator=true
|
||||
org.springframework.ide.eclipse.core.validator.rule.enable.com.springsource.sts.bestpractices.com.springsource.sts.bestpractices.AvoidDriverManagerDataSource-com.springsource.sts.bestpractices.beansvalidator=true
|
||||
org.springframework.ide.eclipse.core.validator.rule.enable.com.springsource.sts.bestpractices.com.springsource.sts.bestpractices.ImportElementsAtTopRulee-com.springsource.sts.bestpractices.beansvalidator=true
|
||||
org.springframework.ide.eclipse.core.validator.rule.enable.com.springsource.sts.bestpractices.com.springsource.sts.bestpractices.ParentBeanSpecifiesAbstractClassRule-com.springsource.sts.bestpractices.beansvalidator=true
|
||||
org.springframework.ide.eclipse.core.validator.rule.enable.com.springsource.sts.bestpractices.com.springsource.sts.bestpractices.RefElementRule-com.springsource.sts.bestpractices.beansvalidator=true
|
||||
org.springframework.ide.eclipse.core.validator.rule.enable.com.springsource.sts.bestpractices.com.springsource.sts.bestpractices.TooManyBeansInFileRule-com.springsource.sts.bestpractices.beansvalidator=true
|
||||
org.springframework.ide.eclipse.core.validator.rule.enable.com.springsource.sts.bestpractices.com.springsource.sts.bestpractices.UnnecessaryValueElementRule-com.springsource.sts.bestpractices.beansvalidator=true
|
||||
org.springframework.ide.eclipse.core.validator.rule.enable.com.springsource.sts.bestpractices.com.springsource.sts.bestpractices.UseBeanInheritance-com.springsource.sts.bestpractices.beansvalidator=true
|
||||
org.springframework.ide.eclipse.core.validator.rule.enable.com.springsource.sts.bestpractices.legacyxmlusage.jndiobjectfactory-com.springsource.sts.bestpractices.beansvalidator=true
|
||||
org.springframework.ide.eclipse.core.validator.rule.enable.com.springsource.sts.server.quickfix.importBundleVersionRule-com.springsource.sts.server.quickfix.manifestvalidator=true
|
||||
org.springframework.ide.eclipse.core.validator.rule.enable.com.springsource.sts.server.quickfix.importLibraryVersionRule-com.springsource.sts.server.quickfix.manifestvalidator=true
|
||||
org.springframework.ide.eclipse.core.validator.rule.enable.com.springsource.sts.server.quickfix.importPackageVersionRule-com.springsource.sts.server.quickfix.manifestvalidator=true
|
||||
org.springframework.ide.eclipse.core.validator.rule.enable.com.springsource.sts.server.quickfix.requireBundleVersionRule-com.springsource.sts.server.quickfix.manifestvalidator=true
|
||||
org.springframework.ide.eclipse.core.validator.rule.enable.org.springframework.ide.eclipse.beans.core.beanAlias-org.springframework.ide.eclipse.beans.core.beansvalidator=true
|
||||
org.springframework.ide.eclipse.core.validator.rule.enable.org.springframework.ide.eclipse.beans.core.beanClass-org.springframework.ide.eclipse.beans.core.beansvalidator=true
|
||||
org.springframework.ide.eclipse.core.validator.rule.enable.org.springframework.ide.eclipse.beans.core.beanConstructorArgument-org.springframework.ide.eclipse.beans.core.beansvalidator=true
|
||||
org.springframework.ide.eclipse.core.validator.rule.enable.org.springframework.ide.eclipse.beans.core.beanDefinition-org.springframework.ide.eclipse.beans.core.beansvalidator=true
|
||||
org.springframework.ide.eclipse.core.validator.rule.enable.org.springframework.ide.eclipse.beans.core.beanDefinitionHolder-org.springframework.ide.eclipse.beans.core.beansvalidator=true
|
||||
org.springframework.ide.eclipse.core.validator.rule.enable.org.springframework.ide.eclipse.beans.core.beanFactory-org.springframework.ide.eclipse.beans.core.beansvalidator=true
|
||||
org.springframework.ide.eclipse.core.validator.rule.enable.org.springframework.ide.eclipse.beans.core.beanInitDestroyMethod-org.springframework.ide.eclipse.beans.core.beansvalidator=true
|
||||
org.springframework.ide.eclipse.core.validator.rule.enable.org.springframework.ide.eclipse.beans.core.beanProperty-org.springframework.ide.eclipse.beans.core.beansvalidator=true
|
||||
org.springframework.ide.eclipse.core.validator.rule.enable.org.springframework.ide.eclipse.beans.core.beanReference-org.springframework.ide.eclipse.beans.core.beansvalidator=true
|
||||
org.springframework.ide.eclipse.core.validator.rule.enable.org.springframework.ide.eclipse.beans.core.methodOverride-org.springframework.ide.eclipse.beans.core.beansvalidator=true
|
||||
org.springframework.ide.eclipse.core.validator.rule.enable.org.springframework.ide.eclipse.beans.core.parsingProblems-org.springframework.ide.eclipse.beans.core.beansvalidator=true
|
||||
org.springframework.ide.eclipse.core.validator.rule.enable.org.springframework.ide.eclipse.beans.core.requiredProperty-org.springframework.ide.eclipse.beans.core.beansvalidator=false
|
||||
org.springframework.ide.eclipse.core.validator.rule.enable.org.springframework.ide.eclipse.core.springClasspath-org.springframework.ide.eclipse.core.springvalidator=false
|
||||
org.springframework.ide.eclipse.core.validator.rule.enable.org.springframework.ide.eclipse.webflow.core.validation.action-org.springframework.ide.eclipse.webflow.core.validator=true
|
||||
org.springframework.ide.eclipse.core.validator.rule.enable.org.springframework.ide.eclipse.webflow.core.validation.actionstate-org.springframework.ide.eclipse.webflow.core.validator=true
|
||||
org.springframework.ide.eclipse.core.validator.rule.enable.org.springframework.ide.eclipse.webflow.core.validation.attribute-org.springframework.ide.eclipse.webflow.core.validator=true
|
||||
org.springframework.ide.eclipse.core.validator.rule.enable.org.springframework.ide.eclipse.webflow.core.validation.attributemapper-org.springframework.ide.eclipse.webflow.core.validator=true
|
||||
org.springframework.ide.eclipse.core.validator.rule.enable.org.springframework.ide.eclipse.webflow.core.validation.beanaction-org.springframework.ide.eclipse.webflow.core.validator=true
|
||||
org.springframework.ide.eclipse.core.validator.rule.enable.org.springframework.ide.eclipse.webflow.core.validation.evaluationaction-org.springframework.ide.eclipse.webflow.core.validator=true
|
||||
org.springframework.ide.eclipse.core.validator.rule.enable.org.springframework.ide.eclipse.webflow.core.validation.evaluationresult-org.springframework.ide.eclipse.webflow.core.validator=true
|
||||
org.springframework.ide.eclipse.core.validator.rule.enable.org.springframework.ide.eclipse.webflow.core.validation.exceptionhandler-org.springframework.ide.eclipse.webflow.core.validator=true
|
||||
org.springframework.ide.eclipse.core.validator.rule.enable.org.springframework.ide.eclipse.webflow.core.validation.import-org.springframework.ide.eclipse.webflow.core.validator=true
|
||||
org.springframework.ide.eclipse.core.validator.rule.enable.org.springframework.ide.eclipse.webflow.core.validation.inputattribute-org.springframework.ide.eclipse.webflow.core.validator=true
|
||||
org.springframework.ide.eclipse.core.validator.rule.enable.org.springframework.ide.eclipse.webflow.core.validation.mapping-org.springframework.ide.eclipse.webflow.core.validator=true
|
||||
org.springframework.ide.eclipse.core.validator.rule.enable.org.springframework.ide.eclipse.webflow.core.validation.outputattribute-org.springframework.ide.eclipse.webflow.core.validator=true
|
||||
org.springframework.ide.eclipse.core.validator.rule.enable.org.springframework.ide.eclipse.webflow.core.validation.set-org.springframework.ide.eclipse.webflow.core.validator=true
|
||||
org.springframework.ide.eclipse.core.validator.rule.enable.org.springframework.ide.eclipse.webflow.core.validation.state-org.springframework.ide.eclipse.webflow.core.validator=true
|
||||
org.springframework.ide.eclipse.core.validator.rule.enable.org.springframework.ide.eclipse.webflow.core.validation.subflowstate-org.springframework.ide.eclipse.webflow.core.validator=true
|
||||
org.springframework.ide.eclipse.core.validator.rule.enable.org.springframework.ide.eclipse.webflow.core.validation.transition-org.springframework.ide.eclipse.webflow.core.validator=true
|
||||
org.springframework.ide.eclipse.core.validator.rule.enable.org.springframework.ide.eclipse.webflow.core.validation.variable-org.springframework.ide.eclipse.webflow.core.validator=true
|
||||
org.springframework.ide.eclipse.core.validator.rule.enable.org.springframework.ide.eclipse.webflow.core.validation.webflowstate-org.springframework.ide.eclipse.webflow.core.validator=true
|
|
@ -1,13 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<beansProjectDescription>
|
||||
<version>1</version>
|
||||
<pluginVersion><![CDATA[2.2.3.RELEASE]]></pluginVersion>
|
||||
<configSuffixes>
|
||||
<configSuffix><![CDATA[xml]]></configSuffix>
|
||||
</configSuffixes>
|
||||
<enableImports><![CDATA[true]]></enableImports>
|
||||
<configs>
|
||||
</configs>
|
||||
<configSets>
|
||||
</configSets>
|
||||
</beansProjectDescription>
|
|
@ -1,149 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>org.springframework.samples</groupId>
|
||||
<artifactId>org.springframework.samples.petclinic</artifactId>
|
||||
<name>org.springframework.samples.petclinic</name>
|
||||
<packaging>war</packaging>
|
||||
<version>1.0.0-SNAPSHOT</version>
|
||||
<properties>
|
||||
<spring.version>3.0.0.M3</spring.version>
|
||||
</properties>
|
||||
<dependencies>
|
||||
<!-- Compile dependencies -->
|
||||
<dependency>
|
||||
<groupId>javax.servlet</groupId>
|
||||
<artifactId>jstl</artifactId>
|
||||
<version>1.2</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>log4j</groupId>
|
||||
<artifactId>log4j</artifactId>
|
||||
<version>1.2.14</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>commons-fileupload</groupId>
|
||||
<artifactId>commons-fileupload</artifactId>
|
||||
<version>1.2.1</version>
|
||||
</dependency>
|
||||
<!-- Needed for fileupload -->
|
||||
<dependency>
|
||||
<groupId>commons-io</groupId>
|
||||
<artifactId>commons-io</artifactId>
|
||||
<version>1.3.2</version>
|
||||
</dependency>
|
||||
<!-- Embedded database -->
|
||||
<dependency>
|
||||
<groupId>hsqldb</groupId>
|
||||
<artifactId>hsqldb</artifactId>
|
||||
<version>1.8.0.7</version>
|
||||
</dependency>
|
||||
<!-- Composite-view & layout framework -->
|
||||
<dependency>
|
||||
<groupId>org.apache.tiles</groupId>
|
||||
<artifactId>tiles-core</artifactId>
|
||||
<version>2.0.7</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.tiles</groupId>
|
||||
<artifactId>tiles-jsp</artifactId>
|
||||
<version>2.0.7</version>
|
||||
</dependency>
|
||||
<!-- Clean URLs with JSPs -->
|
||||
<dependency>
|
||||
<groupId>org.tuckey</groupId>
|
||||
<artifactId>urlrewritefilter</artifactId>
|
||||
<version>3.1.0</version>
|
||||
</dependency>
|
||||
<!-- Spring Framework Project libraries -->
|
||||
<dependency>
|
||||
<groupId>org.springframework</groupId>
|
||||
<artifactId>spring-core</artifactId>
|
||||
<version>${spring.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework</groupId>
|
||||
<artifactId>spring-beans</artifactId>
|
||||
<version>${spring.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework</groupId>
|
||||
<artifactId>spring-context</artifactId>
|
||||
<version>${spring.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework</groupId>
|
||||
<artifactId>spring-web</artifactId>
|
||||
<version>${spring.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework</groupId>
|
||||
<artifactId>spring-webmvc</artifactId>
|
||||
<version>${spring.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework</groupId>
|
||||
<artifactId>spring-jdbc</artifactId>
|
||||
<version>${spring.version}</version>
|
||||
</dependency>
|
||||
<!-- Spring JavaScript Project -->
|
||||
<dependency>
|
||||
<groupId>org.springframework.webflow</groupId>
|
||||
<artifactId>spring-js</artifactId>
|
||||
<version>2.0.7.RELEASE</version>
|
||||
</dependency>
|
||||
<!-- Container-provided dependencies-->
|
||||
<dependency>
|
||||
<groupId>javax.servlet</groupId>
|
||||
<artifactId>servlet-api</artifactId>
|
||||
<version>2.5</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>javax.servlet.jsp</groupId>
|
||||
<artifactId>jsp-api</artifactId>
|
||||
<version>2.1</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<!-- Test dependencies -->
|
||||
<dependency>
|
||||
<groupId>junit</groupId>
|
||||
<artifactId>junit</artifactId>
|
||||
<version>4.5</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
<repositories>
|
||||
<repository>
|
||||
<id>org.springsource.maven.snapshot</id>
|
||||
<name>SpringSource Maven Central-compatible Milestone Repository</name>
|
||||
<url>http://maven.springframework.org/milestone</url>
|
||||
</repository>
|
||||
</repositories>
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<configuration>
|
||||
<source>1.5</source>
|
||||
<target>1.5</target>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-dependency-plugin</artifactId>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>install</id>
|
||||
<phase>install</phase>
|
||||
<goals>
|
||||
<goal>sources</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</project>
|
|
@ -1,15 +0,0 @@
|
|||
package org.springframework.samples.petclinic;
|
||||
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMethod;
|
||||
|
||||
@Controller
|
||||
public class HomeController {
|
||||
|
||||
@RequestMapping(value="/", method = RequestMethod.GET)
|
||||
public String get() {
|
||||
return "home";
|
||||
}
|
||||
|
||||
}
|
|
@ -1,37 +0,0 @@
|
|||
package org.springframework.samples.petclinic.appointments;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
public class Appointment {
|
||||
|
||||
private String owner;
|
||||
|
||||
private String ownerPhone;
|
||||
|
||||
private String pet;
|
||||
|
||||
private String notes;
|
||||
|
||||
private Date dateTime;
|
||||
|
||||
public String getOwner() {
|
||||
return owner;
|
||||
}
|
||||
|
||||
public String getOwnerPhone() {
|
||||
return ownerPhone;
|
||||
}
|
||||
|
||||
public String getPet() {
|
||||
return pet;
|
||||
}
|
||||
|
||||
public Date getDateTime() {
|
||||
return dateTime;
|
||||
}
|
||||
|
||||
public String getNotes() {
|
||||
return notes;
|
||||
}
|
||||
|
||||
}
|
|
@ -1,13 +0,0 @@
|
|||
package org.springframework.samples.petclinic.appointments;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
public interface AppointmentBook {
|
||||
|
||||
Appointments getAppointmentsForToday();
|
||||
|
||||
Appointments getAppointmentsForDay(Date day);
|
||||
|
||||
Long createAppointment(AppointmentForm form);
|
||||
|
||||
}
|
|
@ -1,67 +0,0 @@
|
|||
package org.springframework.samples.petclinic.appointments;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
public class AppointmentForm {
|
||||
|
||||
private Long doctor;
|
||||
|
||||
private Long owner;
|
||||
|
||||
private String pet;
|
||||
|
||||
private Date date;
|
||||
|
||||
private Date time;
|
||||
|
||||
private String notes;
|
||||
|
||||
public Long getDoctor() {
|
||||
return doctor;
|
||||
}
|
||||
|
||||
public void setDoctor(Long doctor) {
|
||||
this.doctor = doctor;
|
||||
}
|
||||
|
||||
public Long getOwner() {
|
||||
return owner;
|
||||
}
|
||||
|
||||
public void setOwner(Long owner) {
|
||||
this.owner = owner;
|
||||
}
|
||||
|
||||
public String getPet() {
|
||||
return pet;
|
||||
}
|
||||
|
||||
public void setPet(String pet) {
|
||||
this.pet = pet;
|
||||
}
|
||||
|
||||
public Date getDate() {
|
||||
return date;
|
||||
}
|
||||
|
||||
public void setDate(Date date) {
|
||||
this.date = date;
|
||||
}
|
||||
|
||||
public Date getTime() {
|
||||
return time;
|
||||
}
|
||||
|
||||
public void setTime(Date time) {
|
||||
this.time = time;
|
||||
}
|
||||
|
||||
public String getNotes() {
|
||||
return notes;
|
||||
}
|
||||
|
||||
public void setNotes(String notes) {
|
||||
this.notes = notes;
|
||||
}
|
||||
|
||||
}
|
|
@ -1,15 +0,0 @@
|
|||
package org.springframework.samples.petclinic.appointments;
|
||||
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public class Appointments {
|
||||
|
||||
private Map<String, List<Appointment>> vetAppointments = new LinkedHashMap<String, List<Appointment>>();
|
||||
|
||||
public Map<String, List<Appointment>> getAllByVet() {
|
||||
return vetAppointments;
|
||||
}
|
||||
|
||||
}
|
|
@ -1,42 +0,0 @@
|
|||
package org.springframework.samples.petclinic.appointments;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMethod;
|
||||
|
||||
@Controller
|
||||
@RequestMapping("/appointments")
|
||||
public class AppointmentsController {
|
||||
|
||||
private AppointmentBook appointmentBook;
|
||||
|
||||
@Autowired
|
||||
public AppointmentsController(AppointmentBook appointmentBook) {
|
||||
this.appointmentBook = appointmentBook;
|
||||
}
|
||||
|
||||
@RequestMapping(method = RequestMethod.GET)
|
||||
public Appointments get() {
|
||||
return appointmentBook.getAppointmentsForToday();
|
||||
}
|
||||
|
||||
@RequestMapping(value="/{day}", method = RequestMethod.GET)
|
||||
public Appointments getForDay(@PathVariable Date day) {
|
||||
return appointmentBook.getAppointmentsForDay(day);
|
||||
}
|
||||
|
||||
@RequestMapping(value="/new", method = RequestMethod.GET)
|
||||
public AppointmentForm getNewForm() {
|
||||
return new AppointmentForm();
|
||||
}
|
||||
|
||||
@RequestMapping(method = RequestMethod.POST)
|
||||
public String post(AppointmentForm form) {
|
||||
appointmentBook.createAppointment(form);
|
||||
return "redirect:/appointments";
|
||||
}
|
||||
}
|
|
@ -1,23 +0,0 @@
|
|||
package org.springframework.samples.petclinic.appointments;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
@Repository
|
||||
public class StubAppointmentBook implements AppointmentBook {
|
||||
|
||||
public Appointments getAppointmentsForDay(Date day) {
|
||||
return new Appointments();
|
||||
}
|
||||
|
||||
public Appointments getAppointmentsForToday() {
|
||||
return new Appointments();
|
||||
}
|
||||
|
||||
public Long createAppointment(AppointmentForm form) {
|
||||
return 1L;
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -1,69 +0,0 @@
|
|||
package org.springframework.samples.petclinic.owners;
|
||||
|
||||
public class Owner {
|
||||
|
||||
private Long id;
|
||||
|
||||
private String firstName;
|
||||
|
||||
private String lastName;
|
||||
|
||||
private String address;
|
||||
|
||||
private String city;
|
||||
|
||||
private String phone;
|
||||
|
||||
public Owner() {
|
||||
|
||||
}
|
||||
|
||||
public Owner(Long id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public Long getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public String getFirstName() {
|
||||
return firstName;
|
||||
}
|
||||
|
||||
public void setFirstName(String firstName) {
|
||||
this.firstName = firstName;
|
||||
}
|
||||
|
||||
public String getLastName() {
|
||||
return lastName;
|
||||
}
|
||||
|
||||
public void setLastName(String lastName) {
|
||||
this.lastName = lastName;
|
||||
}
|
||||
|
||||
public String getAddress() {
|
||||
return address;
|
||||
}
|
||||
|
||||
public void setAddress(String address) {
|
||||
this.address = address;
|
||||
}
|
||||
|
||||
public String getCity() {
|
||||
return city;
|
||||
}
|
||||
|
||||
public void setCity(String city) {
|
||||
this.city = city;
|
||||
}
|
||||
|
||||
public String getPhone() {
|
||||
return phone;
|
||||
}
|
||||
|
||||
public void setPhone(String phone) {
|
||||
this.phone = phone;
|
||||
}
|
||||
|
||||
}
|
|
@ -1,39 +0,0 @@
|
|||
package org.springframework.samples.petclinic.owners;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.samples.petclinic.util.ExternalContext;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.Model;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMethod;
|
||||
|
||||
@Controller
|
||||
@RequestMapping(value="/owners/{owner}")
|
||||
public class OwnerController {
|
||||
|
||||
private final OwnerRepository repository;
|
||||
|
||||
@Autowired
|
||||
public OwnerController(OwnerRepository repository) {
|
||||
this.repository = repository;
|
||||
}
|
||||
|
||||
@RequestMapping(method=RequestMethod.GET)
|
||||
public String get(@PathVariable Long owner, Model model) {
|
||||
model.addAttribute(repository.getOwner(owner));
|
||||
return "owner";
|
||||
}
|
||||
|
||||
@RequestMapping(value="/edit", method=RequestMethod.GET)
|
||||
public Owner getEditForm(@PathVariable Long owner) {
|
||||
return repository.getOwner(owner);
|
||||
}
|
||||
|
||||
@RequestMapping(method = RequestMethod.PUT)
|
||||
public void put(Owner owner, ExternalContext response) {
|
||||
repository.saveOwner(owner);
|
||||
response.redirect(owner.getId());
|
||||
}
|
||||
|
||||
}
|
|
@ -1,13 +0,0 @@
|
|||
package org.springframework.samples.petclinic.owners;
|
||||
|
||||
import java.util.Collection;
|
||||
|
||||
public interface OwnerRepository {
|
||||
|
||||
Collection<Owner> findOwnersByLastName(String lastName);
|
||||
|
||||
Owner getOwner(Long id);
|
||||
|
||||
Long saveOwner(Owner owner);
|
||||
|
||||
}
|
|
@ -1,15 +0,0 @@
|
|||
package org.springframework.samples.petclinic.owners;
|
||||
|
||||
public class OwnerSearchForm {
|
||||
|
||||
private String lastName;
|
||||
|
||||
public String getLastName() {
|
||||
return lastName;
|
||||
}
|
||||
|
||||
public void setLastName(String lastName) {
|
||||
this.lastName = lastName;
|
||||
}
|
||||
|
||||
}
|
|
@ -1,43 +0,0 @@
|
|||
package org.springframework.samples.petclinic.owners;
|
||||
|
||||
import java.util.Collection;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMethod;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
|
||||
@Controller
|
||||
@RequestMapping("/owners")
|
||||
public class OwnersController {
|
||||
|
||||
private final OwnerRepository repository;
|
||||
|
||||
@Autowired
|
||||
public OwnersController(OwnerRepository repository) {
|
||||
this.repository = repository;
|
||||
}
|
||||
|
||||
@RequestMapping(method = RequestMethod.GET)
|
||||
public OwnerSearchForm get() {
|
||||
return new OwnerSearchForm();
|
||||
}
|
||||
|
||||
@RequestMapping(value="/search", method = RequestMethod.GET)
|
||||
public Collection<Owner> getSearchResults(@RequestParam String lastName) {
|
||||
return repository.findOwnersByLastName(lastName);
|
||||
}
|
||||
|
||||
@RequestMapping(value="/new", method = RequestMethod.GET)
|
||||
public Owner getNewForm() {
|
||||
return new Owner();
|
||||
}
|
||||
|
||||
@RequestMapping(method = RequestMethod.POST)
|
||||
public String post(Owner owner) {
|
||||
Long ownerId = repository.saveOwner(owner);
|
||||
return "redirect:/owners/" + ownerId;
|
||||
}
|
||||
|
||||
}
|
|
@ -1,22 +0,0 @@
|
|||
package org.springframework.samples.petclinic.owners;
|
||||
|
||||
import java.util.Collection;
|
||||
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
@Repository
|
||||
public class StubOwnerRepository implements OwnerRepository {
|
||||
|
||||
public Collection<Owner> findOwnersByLastName(String lastName) {
|
||||
return null;
|
||||
}
|
||||
|
||||
public Owner getOwner(Long id) {
|
||||
return new Owner(id);
|
||||
}
|
||||
|
||||
public Long saveOwner(Owner owner) {
|
||||
return 1L;
|
||||
}
|
||||
|
||||
}
|
|
@ -1,5 +0,0 @@
|
|||
package org.springframework.samples.petclinic.owners.pets;
|
||||
|
||||
public enum Gender {
|
||||
MALE, FEMALE
|
||||
}
|
|
@ -1,25 +0,0 @@
|
|||
package org.springframework.samples.petclinic.owners.pets;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
import org.springframework.samples.petclinic.util.Measurement;
|
||||
|
||||
public class Pet {
|
||||
|
||||
private String name;
|
||||
|
||||
private String species;
|
||||
|
||||
private String breed;
|
||||
|
||||
private Gender gender;
|
||||
|
||||
private Date birthDate;
|
||||
|
||||
private Measurement weight;
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
}
|
|
@ -1,41 +0,0 @@
|
|||
package org.springframework.samples.petclinic.owners.pets;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.samples.petclinic.util.ExternalContext;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMethod;
|
||||
|
||||
@Controller
|
||||
@RequestMapping(value="/owners/{owner}/pets/{pet}")
|
||||
public class PetController {
|
||||
|
||||
private final PetRepository repository;
|
||||
|
||||
@Autowired
|
||||
public PetController(PetRepository repository) {
|
||||
this.repository = repository;
|
||||
}
|
||||
|
||||
@RequestMapping(method=RequestMethod.GET)
|
||||
public Pet get(Long owner, String pet) {
|
||||
return repository.getPet(owner, pet);
|
||||
}
|
||||
|
||||
@RequestMapping(value="/edit", method=RequestMethod.GET)
|
||||
public Pet getEditForm(Long owner, String pet) {
|
||||
return repository.getPet(owner, pet);
|
||||
}
|
||||
|
||||
@RequestMapping(method = RequestMethod.PUT)
|
||||
public void put(Pet pet, ExternalContext response) {
|
||||
repository.savePet(pet);
|
||||
response.redirect(pet.getName());
|
||||
}
|
||||
|
||||
@RequestMapping(method = RequestMethod.DELETE)
|
||||
public void delete(Long owner, String pet, ExternalContext context) {
|
||||
context.forResource("owners").redirect(owner);
|
||||
}
|
||||
|
||||
}
|
|
@ -1,9 +0,0 @@
|
|||
package org.springframework.samples.petclinic.owners.pets;
|
||||
|
||||
public interface PetRepository {
|
||||
|
||||
Pet getPet(Long owner, String name);
|
||||
|
||||
void savePet(Pet pet);
|
||||
|
||||
}
|
|
@ -1,15 +0,0 @@
|
|||
package org.springframework.samples.petclinic.owners.pets;
|
||||
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
@Repository
|
||||
public class StubPetRepository implements PetRepository {
|
||||
|
||||
public Pet getPet(Long owner, String name) {
|
||||
return null;
|
||||
}
|
||||
|
||||
public void savePet(Pet pet) {
|
||||
}
|
||||
|
||||
}
|
|
@ -1,22 +0,0 @@
|
|||
package org.springframework.samples.petclinic.util;
|
||||
|
||||
import org.springframework.ui.Model;
|
||||
|
||||
// This is an idea as a context object to make avail to @Controller methods to interact with Dispatcher
|
||||
public interface ExternalContext {
|
||||
|
||||
Model getModel();
|
||||
|
||||
void selectView(String viewName);
|
||||
|
||||
void renderFragment(String fragment);
|
||||
|
||||
void redirect(Object resource);
|
||||
|
||||
ExternalContext forResource(Object resource);
|
||||
|
||||
Object getNativeRequest();
|
||||
|
||||
Object getNativeResponse();
|
||||
|
||||
}
|
|
@ -1,10 +0,0 @@
|
|||
package org.springframework.samples.petclinic.util;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
public class Measurement {
|
||||
|
||||
private BigDecimal amount;
|
||||
|
||||
private Unit unit;
|
||||
}
|
|
@ -1,5 +0,0 @@
|
|||
package org.springframework.samples.petclinic.util;
|
||||
|
||||
public enum Unit {
|
||||
POUNDS
|
||||
}
|
|
@ -1,42 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE log4j:configuration PUBLIC "-//LOGGER" "log4j.dtd">
|
||||
|
||||
<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/">
|
||||
|
||||
<!-- Appenders -->
|
||||
<appender name="console" class="org.apache.log4j.ConsoleAppender">
|
||||
<param name="Target" value="System.out" />
|
||||
<layout class="org.apache.log4j.PatternLayout">
|
||||
<param name="ConversionPattern" value="%-5p: %c - %m%n" />
|
||||
</layout>
|
||||
</appender>>
|
||||
|
||||
<!-- Application Loggers -->
|
||||
<logger name="org.springframework.samples.petclinic">
|
||||
<level value="info" />
|
||||
</logger>
|
||||
|
||||
<!-- 3rdparty Loggers -->
|
||||
<logger name="org.springframework.core">
|
||||
<level value="info" />
|
||||
</logger>
|
||||
|
||||
<logger name="org.springframework.beans">
|
||||
<level value="info" />
|
||||
</logger>
|
||||
|
||||
<logger name="org.springframework.context">
|
||||
<level value="info" />
|
||||
</logger>
|
||||
|
||||
<logger name="org.springframework.web">
|
||||
<level value="info" />
|
||||
</logger>
|
||||
|
||||
<!-- Root Logger -->
|
||||
<root>
|
||||
<priority value="warn" />
|
||||
<appender-ref ref="console" />
|
||||
</root>
|
||||
|
||||
</log4j:configuration>
|
|
@ -1,31 +0,0 @@
|
|||
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
|
||||
<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form" %>
|
||||
<h2>Add New Appointment</h2>
|
||||
|
||||
<form:form id="addNewForm" action="${pageContext.request.contextPath}/appointments" modelAttribute="appointment" method="post">
|
||||
<form:label for="doctor" path="doctor">
|
||||
Doctor
|
||||
<form:input path="doctor" />
|
||||
</form:label>
|
||||
<form:label for="owner" path="owner">
|
||||
Owner
|
||||
<form:input path="owner" />
|
||||
</form:label>
|
||||
<form:label for="pet" path="pet">
|
||||
Pet
|
||||
<form:input path="pet" />
|
||||
</form:label>
|
||||
<form:label for="date" path="date">
|
||||
Date
|
||||
<form:input path="date" />
|
||||
</form:label>
|
||||
<form:label for="time" path="time">
|
||||
Time
|
||||
<form:input path="time" />
|
||||
</form:label>
|
||||
<form:label for="notes" path="notes">
|
||||
Notes
|
||||
<form:input path="notes" />
|
||||
</form:label>
|
||||
<input type="submit" value="Add" />
|
||||
</form:form>
|
|
@ -1,2 +0,0 @@
|
|||
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
|
||||
<h2>Appointment Calendar</h2>
|
|
@ -1,11 +0,0 @@
|
|||
<%@ taglib prefix="tiles" uri="http://tiles.apache.org/tags-tiles" %>
|
||||
|
||||
<div id="sidebar">
|
||||
<ul id="sub-nav">
|
||||
<li><a href="${pageContext.request.contextPath}/appointments">Calendar</a></li>
|
||||
<li><a href="${pageContext.request.contextPath}/appointments/new">Add New</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
<div id="main">
|
||||
<tiles:insertAttribute name="main" />
|
||||
</div>
|
|
@ -1,6 +0,0 @@
|
|||
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
|
||||
<h2>Welcome to the Spring 3 Petclinic</h2>
|
||||
<img id="petlogo" src="${pageContext.request.contextPath}/resources/images/pets.png" />
|
||||
<p>
|
||||
This sample application demonstrates many of the features Spring provides for web application development.
|
||||
</p>
|
|
@ -1,43 +0,0 @@
|
|||
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
|
||||
<%@ taglib prefix="tiles" uri="http://tiles.apache.org/tags-tiles" %>
|
||||
<%@ page session="false" %>
|
||||
<html>
|
||||
<head>
|
||||
<title><tiles:insertAttribute name="title"/></title>
|
||||
<link type="text/css" rel="stylesheet" href="${pageContext.request.contextPath}/resources/styles/main.css"/>
|
||||
</head>
|
||||
<body id="page-body">
|
||||
<div id="page">
|
||||
<div id="header">
|
||||
<ul id="signin">
|
||||
<c:choose>
|
||||
<c:when test="${pageContext.request.userPrincipal != null}">
|
||||
<p>Welcome ${pageContext.request.userPrincipal.name}</p>
|
||||
<li><a href="<c:url value="/account/signout"/>">Sign Out</a></li>
|
||||
</c:when>
|
||||
<c:otherwise>
|
||||
<li><a href="<c:url value="/account/signin"/>">Sign In</a></li>
|
||||
</c:otherwise>
|
||||
</c:choose>
|
||||
</ul>
|
||||
<div id="nav">
|
||||
<ul>
|
||||
<li><a href="${pageContext.request.contextPath}">Home</a></li>
|
||||
<li><a href="${pageContext.request.contextPath}/appointments">Appointments</a></li>
|
||||
<li><a href="${pageContext.request.contextPath}/owners">Owners</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
<div id="content">
|
||||
<tiles:insertAttribute name="content"/>
|
||||
</div>
|
||||
<div id="footer">
|
||||
<ul id="legal">
|
||||
<li>Privacy Policy</li>
|
||||
<li>Terms of Service</li>
|
||||
</ul>
|
||||
<p>(c) 2009 <a href="http://www.springsource.org">springsource.org</a></p>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
|
@ -1,15 +0,0 @@
|
|||
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
|
||||
<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form" %>
|
||||
<h2>Add New Owner</h2>
|
||||
|
||||
<form:form id="addNewForm" action="${pageContext.request.contextPath}/owners" modelAttribute="owner" method="post">
|
||||
<form:label for="firstName" path="firstName">
|
||||
First Name
|
||||
<form:input path="firstName" />
|
||||
</form:label>
|
||||
<form:label for="lastName" path="lastName">
|
||||
Last Name
|
||||
<form:input path="lastName" />
|
||||
</form:label>
|
||||
<input type="submit" value="Add" />
|
||||
</form:form>
|
|
@ -1,11 +0,0 @@
|
|||
<%@ taglib prefix="tiles" uri="http://tiles.apache.org/tags-tiles" %>
|
||||
|
||||
<div id="sidebar">
|
||||
<ul id="sub-nav">
|
||||
<li><a href="${pageContext.request.contextPath}/owners">Search</a></li>
|
||||
<li><a href="${pageContext.request.contextPath}/owners/new">Add New</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
<div id="main">
|
||||
<tiles:insertAttribute name="main" />
|
||||
</div>
|
|
@ -1,2 +0,0 @@
|
|||
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
|
||||
<h2>Owner Details</h2>
|
|
@ -1,12 +0,0 @@
|
|||
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
|
||||
<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form" %>
|
||||
|
||||
<h2>Search Owners</h2>
|
||||
|
||||
<form:form id="searchForm" action="owners/search" modelAttribute="ownerSearchForm" method="get">
|
||||
<form:label for="lastName" path="lastName">
|
||||
Last Name
|
||||
<form:input path="lastName" />
|
||||
</form:label>
|
||||
<input type="submit" value="Search" />
|
||||
</form:form>
|
|
@ -1,2 +0,0 @@
|
|||
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
|
||||
<h2>Search Results</h2>
|
|
@ -1,14 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<beans xmlns="http://www.springframework.org/schema/beans"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xmlns:context="http://www.springframework.org/schema/context"
|
||||
xsi:schemaLocation="
|
||||
http://www.springframework.org/schema/beans
|
||||
http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
|
||||
http://www.springframework.org/schema/context
|
||||
http://www.springframework.org/schema/context/spring-context-2.5.xsd">
|
||||
|
||||
<!-- Scans within the base package of the application for @Components to configure as beans -->
|
||||
<context:component-scan base-package="org.springframework.samples.petclinic" />
|
||||
|
||||
</beans>
|
|
@ -1,37 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<beans xmlns="http://www.springframework.org/schema/beans"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xmlns:context="http://www.springframework.org/schema/context"
|
||||
xsi:schemaLocation="
|
||||
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
|
||||
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-2.5.xsd">
|
||||
|
||||
<!-- HANDLER MAPPING RULES -->
|
||||
|
||||
<!-- Maps requests to @Controllers based on @RequestMapping("path") annotation values
|
||||
If no annotation-based path mapping is found, Spring MVC sends a 404 response and logs a pageNotFound warning. -->
|
||||
<bean class="org.springframework.web.servlet.mvc.annotation.DefaultAnnotationHandlerMapping">
|
||||
<property name="order" value="1" />
|
||||
</bean>
|
||||
|
||||
<!-- REGISTERED HANDLER TYPES -->
|
||||
|
||||
<!-- Enables annotated @Controllers; responsible for invoking an annotated POJO @Controller when one is mapped. -->
|
||||
<bean class="org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter" />
|
||||
|
||||
<!-- VIEW RESOLUTION AND RENDERING -->
|
||||
|
||||
<!-- Resolves view names to tiles definitions in /WEB-INF/tiles.xml -->
|
||||
<bean class="org.springframework.web.servlet.view.UrlBasedViewResolver">
|
||||
<property name="viewClass" value="org.springframework.web.servlet.view.tiles2.TilesView" />
|
||||
</bean>
|
||||
|
||||
<!-- Initializes the Apache Tiles CompositeView system -->
|
||||
<bean id="tilesConfigurer" class="org.springframework.web.servlet.view.tiles2.TilesConfigurer" />
|
||||
|
||||
<!-- Configures Apache Commons Fileupload -->
|
||||
<bean id="multipartResolver" class="org.springframework.web.multipart.commons.CommonsMultipartResolver">
|
||||
<property name="maxUploadSize" value="10000000"/>
|
||||
</bean>
|
||||
|
||||
</beans>
|
|
@ -1,85 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE tiles-definitions PUBLIC
|
||||
"-//Apache Software Foundation//DTD Tiles Configuration 2.0//EN"
|
||||
"http://tiles.apache.org/dtds/tiles-config_2_0.dtd">
|
||||
|
||||
<tiles-definitions>
|
||||
|
||||
<!-- ABSTRACT PAGE TEMPLATES -->
|
||||
|
||||
<definition name="page" template="/WEB-INF/layouts/page.jsp"/>
|
||||
|
||||
<!-- PAGES -->
|
||||
|
||||
<definition name="home" extends="page">
|
||||
<put-attribute name="title" value="Welcome to Petclinic" type="string" />
|
||||
<put-attribute name="content" value="/WEB-INF/home.jsp" type="template" />
|
||||
</definition>
|
||||
|
||||
<!-- APPOINTMENTS PAGES -->
|
||||
|
||||
<!-- CALENDAR PAGE -->
|
||||
<definition name="appointments" extends="page">
|
||||
<put-attribute name="title" value="Appointments" type="string" />
|
||||
<put-attribute name="content" value="appointments.content" type="definition" />
|
||||
</definition>
|
||||
|
||||
<definition name="appointments.content" template="/WEB-INF/appointments/content.jsp">
|
||||
<put-attribute name="main" value="/WEB-INF/appointments/calendar.jsp" type="template" />
|
||||
</definition>
|
||||
|
||||
<!-- ADD NEW PAGE -->
|
||||
<definition name="appointments/new" extends="page">
|
||||
<put-attribute name="title" value="Add New Appointment" type="string" />
|
||||
<put-attribute name="content" value="appointments/new.content" type="definition" />
|
||||
</definition>
|
||||
|
||||
<definition name="appointments/new.content" template="/WEB-INF/appointments/content.jsp">
|
||||
<put-attribute name="main" value="/WEB-INF/appointments/addNewForm.jsp" type="template" />
|
||||
</definition>
|
||||
|
||||
<!-- OWNERS PAGES -->
|
||||
|
||||
|
||||
<!-- SEARCH PAGE -->
|
||||
<definition name="owners" extends="page">
|
||||
<put-attribute name="title" value="Owners" type="string" />
|
||||
<put-attribute name="content" value="owners.content" type="definition" />
|
||||
</definition>
|
||||
|
||||
<definition name="owners.content" template="/WEB-INF/owners/content.jsp">
|
||||
<put-attribute name="main" value="/WEB-INF/owners/searchForm.jsp" type="template" />
|
||||
</definition>
|
||||
|
||||
<!-- ADD NEW PAGE -->
|
||||
<definition name="owners/new" extends="page">
|
||||
<put-attribute name="title" value="Add New Owner" type="string" />
|
||||
<put-attribute name="content" value="owners/new.content" type="definition" />
|
||||
</definition>
|
||||
|
||||
<definition name="owners/new.content" template="/WEB-INF/owners/content.jsp">
|
||||
<put-attribute name="main" value="/WEB-INF/owners/addNewForm.jsp" type="template" />
|
||||
</definition>
|
||||
|
||||
<!-- SEARCH RESULTS PAGE -->
|
||||
<definition name="owners/search" extends="page">
|
||||
<put-attribute name="title" value="Owner Search" type="string" />
|
||||
<put-attribute name="content" value="owners/search.content" type="definition" />
|
||||
</definition>
|
||||
|
||||
<definition name="owners/search.content" template="/WEB-INF/owners/content.jsp">
|
||||
<put-attribute name="main" value="/WEB-INF/owners/searchResults.jsp" type="template" />
|
||||
</definition>
|
||||
|
||||
<!-- DETAIL PAGE -->
|
||||
<definition name="owner" extends="page">
|
||||
<put-attribute name="title" value="Owner" type="string" />
|
||||
<put-attribute name="content" value="owner.content" type="definition" />
|
||||
</definition>
|
||||
|
||||
<definition name="owner.content" template="/WEB-INF/owners/content.jsp">
|
||||
<put-attribute name="main" value="/WEB-INF/owners/owner.jsp" type="template" />
|
||||
</definition>
|
||||
|
||||
|
||||
</tiles-definitions>
|
|
@ -1,16 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!DOCTYPE urlrewrite PUBLIC "-//tuckey.org//DTD UrlRewrite 3.0//EN" "http://tuckey.org/res/dtds/urlrewrite3.0.dtd">
|
||||
<urlrewrite default-match-type="wildcard">
|
||||
<rule>
|
||||
<from>/resources/**</from>
|
||||
<to>/resources/$1</to>
|
||||
</rule>
|
||||
<rule>
|
||||
<from>/**</from>
|
||||
<to>/app/$1</to>
|
||||
</rule>
|
||||
<outbound-rule>
|
||||
<from>/app/**</from>
|
||||
<to>/$1</to>
|
||||
</outbound-rule>
|
||||
</urlrewrite>
|
|
@ -1,49 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<web-app version="2.5" xmlns="http://java.sun.com/xml/ns/javaee"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
|
||||
|
||||
<!-- Enables clean URLs with JSP views e.g. /welcome instead of /app/welcome -->
|
||||
<filter>
|
||||
<filter-name>UrlRewriteFilter</filter-name>
|
||||
<filter-class>org.tuckey.web.filters.urlrewrite.UrlRewriteFilter</filter-class>
|
||||
</filter>
|
||||
|
||||
<filter-mapping>
|
||||
<filter-name>UrlRewriteFilter</filter-name>
|
||||
<url-pattern>/*</url-pattern>
|
||||
</filter-mapping>
|
||||
|
||||
<!-- Handles all requests into the application -->
|
||||
<servlet>
|
||||
<servlet-name>Spring MVC Dispatcher Servlet</servlet-name>
|
||||
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
|
||||
<init-param>
|
||||
<param-name>contextConfigLocation</param-name>
|
||||
<param-value>
|
||||
/WEB-INF/spring/*.xml
|
||||
</param-value>
|
||||
</init-param>
|
||||
<load-on-startup>1</load-on-startup>
|
||||
</servlet>
|
||||
|
||||
<!-- Maps all /app requests to the DispatcherServlet for handling -->
|
||||
<servlet-mapping>
|
||||
<servlet-name>Spring MVC Dispatcher Servlet</servlet-name>
|
||||
<url-pattern>/app/*</url-pattern>
|
||||
</servlet-mapping>
|
||||
|
||||
<!-- Serves static resource content from the webapp root & .jar files such as spring-js.jar -->
|
||||
<servlet>
|
||||
<servlet-name>Resources Servlet</servlet-name>
|
||||
<servlet-class>org.springframework.js.resource.ResourceServlet</servlet-class>
|
||||
<load-on-startup>0</load-on-startup>
|
||||
</servlet>
|
||||
|
||||
<!-- Map all /resources requests to the Resource Servlet for handling -->
|
||||
<servlet-mapping>
|
||||
<servlet-name>Resources Servlet</servlet-name>
|
||||
<url-pattern>/resources/*</url-pattern>
|
||||
</servlet-mapping>
|
||||
|
||||
</web-app>
|
|
@ -1,42 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE log4j:configuration PUBLIC "-//LOGGER" "log4j.dtd">
|
||||
|
||||
<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/">
|
||||
|
||||
<!-- Appenders -->
|
||||
<appender name="console" class="org.apache.log4j.ConsoleAppender">
|
||||
<param name="Target" value="System.out" />
|
||||
<layout class="org.apache.log4j.PatternLayout">
|
||||
<param name="ConversionPattern" value="%-5p: %c - %m%n" />
|
||||
</layout>
|
||||
</appender>>
|
||||
|
||||
<!-- Application Loggers -->
|
||||
<logger name="org.springframework.samples.petclinic">
|
||||
<level value="debug" />
|
||||
</logger>
|
||||
|
||||
<!-- 3rdparty Loggers -->
|
||||
<logger name="org.springframework.core">
|
||||
<level value="debug" />
|
||||
</logger>
|
||||
|
||||
<logger name="org.springframework.beans">
|
||||
<level value="debug" />
|
||||
</logger>
|
||||
|
||||
<logger name="org.springframework.context">
|
||||
<level value="debug" />
|
||||
</logger>
|
||||
|
||||
<logger name="org.springframework.web">
|
||||
<level value="debug" />
|
||||
</logger>
|
||||
|
||||
<!-- Root Logger -->
|
||||
<root>
|
||||
<priority value="warn" />
|
||||
<appender-ref ref="console" />
|
||||
</root>
|
||||
|
||||
</log4j:configuration>
|
252
pom.xml
|
@ -3,98 +3,89 @@
|
|||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>org.springframework.samples</groupId>
|
||||
<artifactId>org.springframework.samples.petclinic</artifactId>
|
||||
<artifactId>spring-petclinic</artifactId>
|
||||
<name>petclinic</name>
|
||||
<packaging>war</packaging>
|
||||
<version>1.0.0-SNAPSHOT</version>
|
||||
<properties>
|
||||
<spring.version>3.0.0.RELEASE</spring.version>
|
||||
<slf4j.version>1.5.6</slf4j.version>
|
||||
<spring.version>3.2.0.RELEASE</spring.version>
|
||||
<slf4j.version>1.7.0</slf4j.version>
|
||||
<log4j.version>1.2.17</log4j.version>
|
||||
<hibernate.version>4.1.4.Final</hibernate.version>
|
||||
<aspectj.version>1.7.1</aspectj.version>
|
||||
</properties>
|
||||
<dependencies>
|
||||
<dependencies>
|
||||
|
||||
<!-- Spring -->
|
||||
<dependency>
|
||||
<groupId>org.springframework</groupId>
|
||||
<artifactId>org.springframework.context</artifactId>
|
||||
<artifactId>spring-context</artifactId>
|
||||
<version>${spring.version}</version>
|
||||
<exclusions>
|
||||
<!-- Exclude Commons Logging in favor of SLF4j -->
|
||||
<exclusion>
|
||||
<groupId>org.apache.commons</groupId>
|
||||
<artifactId>com.springsource.org.apache.commons.logging</artifactId>
|
||||
<artifactId>commons-logging</artifactId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework</groupId>
|
||||
<artifactId>org.springframework.orm</artifactId>
|
||||
<artifactId>spring-orm</artifactId>
|
||||
<version>${spring.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework</groupId>
|
||||
<artifactId>org.springframework.oxm</artifactId>
|
||||
<artifactId>spring-oxm</artifactId>
|
||||
<version>${spring.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework</groupId>
|
||||
<artifactId>org.springframework.web.servlet</artifactId>
|
||||
<version>${spring.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework</groupId>
|
||||
<artifactId>org.springframework.aspects</artifactId>
|
||||
<version>${spring.version}</version>
|
||||
</dependency>
|
||||
<!-- AspectJ -->
|
||||
<dependency>
|
||||
<groupId>org.aspectj</groupId>
|
||||
<artifactId>com.springsource.org.aspectj.weaver</artifactId>
|
||||
<version>1.6.8.RELEASE</version>
|
||||
<artifactId>spring-webmvc</artifactId>
|
||||
<version>${spring.version}</version>
|
||||
</dependency>
|
||||
|
||||
<!-- Logging -->
|
||||
<dependency>
|
||||
<groupId>org.slf4j</groupId>
|
||||
<artifactId>com.springsource.slf4j.api</artifactId>
|
||||
<version>${slf4j.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.slf4j</groupId>
|
||||
<artifactId>com.springsource.slf4j.org.apache.commons.logging</artifactId>
|
||||
<version>${slf4j.version}</version>
|
||||
<scope>runtime</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.slf4j</groupId>
|
||||
<artifactId>com.springsource.slf4j.log4j</artifactId>
|
||||
<version>${slf4j.version}</version>
|
||||
<scope>runtime</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.log4j</groupId>
|
||||
<artifactId>com.springsource.org.apache.log4j</artifactId>
|
||||
<version>1.2.15</version>
|
||||
<scope>runtime</scope>
|
||||
</dependency>
|
||||
<groupId>org.slf4j</groupId>
|
||||
<artifactId>jcl-over-slf4j</artifactId>
|
||||
<version>${slf4j.version}</version>
|
||||
<scope>runtime</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.slf4j</groupId>
|
||||
<artifactId>slf4j-api</artifactId>
|
||||
<version>${slf4j.version}</version>
|
||||
<scope>runtime</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.slf4j</groupId>
|
||||
<artifactId>slf4j-log4j12</artifactId>
|
||||
<version>${slf4j.version}</version>
|
||||
<scope>runtime</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>log4j</groupId>
|
||||
<artifactId>log4j</artifactId>
|
||||
<version>${log4j.version}</version>
|
||||
<scope>runtime</scope>
|
||||
</dependency>
|
||||
|
||||
<!-- DataSource -->
|
||||
<dependency>
|
||||
<groupId>org.apache.commons</groupId>
|
||||
<artifactId>com.springsource.org.apache.commons.dbcp</artifactId>
|
||||
<version>1.2.2.osgi</version>
|
||||
<scope>runtime</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.commons</groupId>
|
||||
<artifactId>com.springsource.org.apache.commons.pool</artifactId>
|
||||
<version>1.5.3</version>
|
||||
<groupId>commons-dbcp</groupId>
|
||||
<artifactId>commons-dbcp</artifactId>
|
||||
<version>1.4</version>
|
||||
<scope>runtime</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.hsqldb</groupId>
|
||||
<artifactId>com.springsource.org.hsqldb</artifactId>
|
||||
<version>1.8.0.9</version>
|
||||
<artifactId>hsqldb</artifactId>
|
||||
<version>1.8.0.10</version>
|
||||
<scope>runtime</scope>
|
||||
</dependency>
|
||||
<!-- MySQL JDBC Connector -->
|
||||
|
@ -103,153 +94,87 @@
|
|||
<artifactId>com.springsource.com.mysql.jdbc</artifactId>
|
||||
<version>5.1.6</version> </dependency>
|
||||
-->
|
||||
|
||||
<!-- AOP -->
|
||||
<dependency>
|
||||
<groupId>org.aspectj</groupId>
|
||||
<artifactId>aspectjrt</artifactId>
|
||||
<version>${aspectj.version}</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.aspectj</groupId>
|
||||
<artifactId>aspectjweaver</artifactId>
|
||||
<version>${aspectj.version}</version>
|
||||
</dependency>
|
||||
|
||||
<!-- Hibernate -->
|
||||
<dependency>
|
||||
<groupId>org.hibernate</groupId>
|
||||
<artifactId>com.springsource.org.hibernate</artifactId>
|
||||
<version>3.3.2.GA</version>
|
||||
</dependency>
|
||||
|
||||
<!-- JPA -->
|
||||
<dependency>
|
||||
<groupId>javax.persistence</groupId>
|
||||
<artifactId>com.springsource.javax.persistence</artifactId>
|
||||
<version>1.0.0</version>
|
||||
</dependency>
|
||||
<!-- Toplink JPA Provider -->
|
||||
<dependency>
|
||||
<groupId>com.oracle.toplink.essentials</groupId>
|
||||
<artifactId>com.springsource.oracle.toplink.essentials</artifactId>
|
||||
<version>2.0.0.b41-beta2</version>
|
||||
</dependency>
|
||||
<!-- Hibernate JPA Provider -->
|
||||
<dependency>
|
||||
<groupId>org.hibernate</groupId>
|
||||
<artifactId>com.springsource.org.hibernate.ejb</artifactId>
|
||||
<version>3.4.0.GA</version>
|
||||
<exclusions>
|
||||
<!-- Exclude Commons Logging in favor of SLF4j -->
|
||||
<exclusion>
|
||||
<groupId>org.apache.commons</groupId>
|
||||
<artifactId>com.springsource.org.apache.commons.logging</artifactId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.hibernate</groupId>
|
||||
<artifactId>com.springsource.org.hibernate.annotations</artifactId>
|
||||
<version>3.4.0.GA</version>
|
||||
<exclusions>
|
||||
<!-- Exclude Commons Logging in favor of SLF4j -->
|
||||
<exclusion>
|
||||
<groupId>org.apache.commons</groupId>
|
||||
<artifactId>com.springsource.org.apache.commons.logging</artifactId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
<!-- Open JPA Provider -->
|
||||
<dependency>
|
||||
<groupId>org.apache.openjpa</groupId>
|
||||
<artifactId>com.springsource.org.apache.openjpa</artifactId>
|
||||
<version>1.1.0</version>
|
||||
<exclusions>
|
||||
<!-- Exclude Commons Logging in favor of SLF4j -->
|
||||
<exclusion>
|
||||
<groupId>org.apache.commons</groupId>
|
||||
<artifactId>com.springsource.org.apache.commons.logging</artifactId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
<artifactId>hibernate-entitymanager</artifactId>
|
||||
<version>${hibernate.version}</version>
|
||||
</dependency>
|
||||
|
||||
|
||||
<!-- Servlet -->
|
||||
<dependency>
|
||||
<groupId>javax.servlet</groupId>
|
||||
<artifactId>com.springsource.javax.servlet</artifactId>
|
||||
<version>2.5.0</version>
|
||||
<artifactId>servlet-api</artifactId>
|
||||
<version>2.5</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>javax.servlet</groupId>
|
||||
<artifactId>com.springsource.javax.servlet.jsp</artifactId>
|
||||
<version>2.1.0</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>javax.servlet</groupId>
|
||||
<artifactId>com.springsource.javax.servlet.jsp.jstl</artifactId>
|
||||
<version>1.2.0</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.taglibs</groupId>
|
||||
<artifactId>com.springsource.org.apache.taglibs.standard</artifactId>
|
||||
<version>1.1.2</version>
|
||||
<artifactId>jstl</artifactId>
|
||||
<version>1.2</version>
|
||||
</dependency>
|
||||
|
||||
<!-- Rome RSS -->
|
||||
<dependency>
|
||||
<groupId>com.sun.syndication</groupId>
|
||||
<artifactId>com.springsource.com.sun.syndication</artifactId>
|
||||
<version>1.0.0</version>
|
||||
<groupId>rome</groupId>
|
||||
<artifactId>rome</artifactId>
|
||||
<version>1.0</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.jdom</groupId>
|
||||
<artifactId>com.springsource.org.jdom</artifactId>
|
||||
<version>1.1.0</version>
|
||||
<artifactId>jdom</artifactId>
|
||||
<version>2.0.2</version>
|
||||
<scope>runtime</scope>
|
||||
</dependency>
|
||||
|
||||
<!-- JAXB -->
|
||||
<dependency>
|
||||
<groupId>javax.xml.bind</groupId>
|
||||
<artifactId>com.springsource.javax.xml.bind</artifactId>
|
||||
<version>2.1.7</version>
|
||||
<groupId>com.sun.xml.bind</groupId>
|
||||
<artifactId>jaxb-impl</artifactId>
|
||||
<version>2.2.6</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
<!-- Test dependencies -->
|
||||
<dependency>
|
||||
<groupId>org.junit</groupId>
|
||||
<artifactId>com.springsource.org.junit</artifactId>
|
||||
<version>4.7.0</version>
|
||||
<groupId>junit</groupId>
|
||||
<artifactId>junit</artifactId>
|
||||
<version>4.10</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework</groupId>
|
||||
<artifactId>org.springframework.test</artifactId>
|
||||
<artifactId>spring-test</artifactId>
|
||||
<version>${spring.version}</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>javax.transaction</groupId>
|
||||
<artifactId>com.springsource.javax.transaction</artifactId>
|
||||
<version>1.1.0</version>
|
||||
<artifactId>jta</artifactId>
|
||||
<version>1.1</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
<repositories>
|
||||
<repository>
|
||||
<id>com.springsource.repository.bundles.release</id>
|
||||
<name>SpringSource Enterprise Bundle Repository - SpringSource Releases</name>
|
||||
<url>http://repository.springsource.com/maven/bundles/release</url>
|
||||
</repository>
|
||||
<repository>
|
||||
<id>com.springsource.repository.bundles.external</id>
|
||||
<name>SpringSource Enterprise Bundle Repository - External Releases</name>
|
||||
<url>http://repository.springsource.com/maven/bundles/external</url>
|
||||
</repository>
|
||||
<repository>
|
||||
<id>com.springsource.repository.bundles.milestone</id>
|
||||
<name>SpringSource Enterprise Bundle Repository - SpringSource Milestones</name>
|
||||
<url>http://repository.springsource.com/maven/bundles/milestone</url>
|
||||
</repository>
|
||||
<repository>
|
||||
<id>com.springsource.repository.bundles.snapshot</id>
|
||||
<name>SpringSource Enterprise Bundle Repository - Snapshot Releases</name>
|
||||
<url>http://repository.springsource.com/maven/bundles/snapshot</url>
|
||||
</repository>
|
||||
</repositories>
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
|
@ -257,8 +182,8 @@
|
|||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<configuration>
|
||||
<verbose>true</verbose>
|
||||
<source>1.5</source>
|
||||
<target>1.5</target>
|
||||
<source>1.6</source>
|
||||
<target>1.6</target>
|
||||
<showWarnings>true</showWarnings>
|
||||
</configuration>
|
||||
</plugin>
|
||||
|
@ -278,6 +203,19 @@
|
|||
<warName>petclinic</warName>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-eclipse-plugin</artifactId>
|
||||
<version>2.8</version>
|
||||
<configuration>
|
||||
<downloadSources>true</downloadSources>
|
||||
<downloadJavadocs>true</downloadJavadocs>
|
||||
<wtpversion>2.0</wtpversion>
|
||||
<sourceIncludes>
|
||||
<sourceInclude>**/*.*</sourceInclude>
|
||||
</sourceIncludes>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-dependency-plugin</artifactId>
|
||||
|
|
|
@ -18,7 +18,7 @@ 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.jdbc.core.JdbcTemplate;
|
||||
import org.springframework.jmx.export.annotation.ManagedOperation;
|
||||
import org.springframework.jmx.export.annotation.ManagedResource;
|
||||
import org.springframework.orm.ObjectRetrievalFailureException;
|
||||
|
@ -58,7 +58,7 @@ public class SimpleJdbcClinic implements Clinic, SimpleJdbcClinicMBean {
|
|||
|
||||
private final Logger logger = LoggerFactory.getLogger(getClass());
|
||||
|
||||
private SimpleJdbcTemplate simpleJdbcTemplate;
|
||||
private JdbcTemplate simpleJdbcTemplate;
|
||||
|
||||
private SimpleJdbcInsert insertOwner;
|
||||
private SimpleJdbcInsert insertPet;
|
||||
|
@ -69,7 +69,7 @@ public class SimpleJdbcClinic implements Clinic, SimpleJdbcClinicMBean {
|
|||
|
||||
@Autowired
|
||||
public void init(DataSource dataSource) {
|
||||
this.simpleJdbcTemplate = new SimpleJdbcTemplate(dataSource);
|
||||
this.simpleJdbcTemplate = new JdbcTemplate(dataSource);
|
||||
|
||||
this.insertOwner = new SimpleJdbcInsert(dataSource)
|
||||
.withTableName("owners")
|
||||
|
|
|
@ -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.
|
||||
*
|
||||
* <p>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 <a href="mailto:james.x.clark@oracle.com">James Clark</a>
|
||||
* @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);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -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;
|
||||
|
166
src/main/resources/log4j.dtd
Executable file
|
@ -0,0 +1,166 @@
|
|||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
|
||||
<!-- Authors: Chris Taylor, Ceki Gulcu. -->
|
||||
|
||||
<!-- Version: 1.2 -->
|
||||
|
||||
<!-- A configuration element consists of optional renderer
|
||||
elements,appender elements, categories and an optional root
|
||||
element. -->
|
||||
|
||||
<!ELEMENT log4j:configuration (renderer*, appender*,(category|logger)*,root?,
|
||||
categoryFactory?)>
|
||||
|
||||
<!-- The "threshold" attribute takes a level value such that all -->
|
||||
<!-- logging statements with a level equal or below this value are -->
|
||||
<!-- disabled. -->
|
||||
|
||||
<!-- Setting the "debug" enable the printing of internal log4j logging -->
|
||||
<!-- statements. -->
|
||||
|
||||
<!-- By default, debug attribute is "null", meaning that we not do touch -->
|
||||
<!-- internal log4j logging settings. The "null" value for the threshold -->
|
||||
<!-- attribute can be misleading. The threshold field of a repository -->
|
||||
<!-- cannot be set to null. The "null" value for the threshold attribute -->
|
||||
<!-- simply means don't touch the threshold field, the threshold field -->
|
||||
<!-- keeps its old value. -->
|
||||
|
||||
<!ATTLIST log4j:configuration
|
||||
xmlns:log4j CDATA #FIXED "http://jakarta.apache.org/log4j/"
|
||||
threshold (all|debug|info|warn|error|fatal|off|null) "null"
|
||||
debug (true|false|null) "null"
|
||||
>
|
||||
|
||||
<!-- renderer elements allow the user to customize the conversion of -->
|
||||
<!-- message objects to String. -->
|
||||
|
||||
<!ELEMENT renderer EMPTY>
|
||||
<!ATTLIST renderer
|
||||
renderedClass CDATA #REQUIRED
|
||||
renderingClass CDATA #REQUIRED
|
||||
>
|
||||
|
||||
<!-- Appenders must have a name and a class. -->
|
||||
<!-- Appenders may contain an error handler, a layout, optional parameters -->
|
||||
<!-- and filters. They may also reference (or include) other appenders. -->
|
||||
<!ELEMENT appender (errorHandler?, param*, layout?, filter*, appender-ref*)>
|
||||
<!ATTLIST appender
|
||||
name ID #REQUIRED
|
||||
class CDATA #REQUIRED
|
||||
>
|
||||
|
||||
<!ELEMENT layout (param*)>
|
||||
<!ATTLIST layout
|
||||
class CDATA #REQUIRED
|
||||
>
|
||||
|
||||
<!ELEMENT filter (param*)>
|
||||
<!ATTLIST filter
|
||||
class CDATA #REQUIRED
|
||||
>
|
||||
|
||||
<!-- ErrorHandlers can be of any class. They can admit any number of -->
|
||||
<!-- parameters. -->
|
||||
|
||||
<!ELEMENT errorHandler (param*, root-ref?, logger-ref*, appender-ref?)>
|
||||
<!ATTLIST errorHandler
|
||||
class CDATA #REQUIRED
|
||||
>
|
||||
|
||||
<!ELEMENT root-ref EMPTY>
|
||||
|
||||
<!ELEMENT logger-ref EMPTY>
|
||||
<!ATTLIST logger-ref
|
||||
ref IDREF #REQUIRED
|
||||
>
|
||||
|
||||
<!ELEMENT param EMPTY>
|
||||
<!ATTLIST param
|
||||
name CDATA #REQUIRED
|
||||
value CDATA #REQUIRED
|
||||
>
|
||||
|
||||
|
||||
<!-- The priority class is org.apache.log4j.Level by default -->
|
||||
<!ELEMENT priority (param*)>
|
||||
<!ATTLIST priority
|
||||
class CDATA #IMPLIED
|
||||
value CDATA #REQUIRED
|
||||
>
|
||||
|
||||
<!-- The level class is org.apache.log4j.Level by default -->
|
||||
<!ELEMENT level (param*)>
|
||||
<!ATTLIST level
|
||||
class CDATA #IMPLIED
|
||||
value CDATA #REQUIRED
|
||||
>
|
||||
|
||||
|
||||
<!-- If no level element is specified, then the configurator MUST not -->
|
||||
<!-- touch the level of the named category. -->
|
||||
<!ELEMENT category (param*,(priority|level)?,appender-ref*)>
|
||||
<!ATTLIST category
|
||||
class CDATA #IMPLIED
|
||||
name CDATA #REQUIRED
|
||||
additivity (true|false) "true"
|
||||
>
|
||||
|
||||
<!-- If no level element is specified, then the configurator MUST not -->
|
||||
<!-- touch the level of the named logger. -->
|
||||
<!ELEMENT logger (level?,appender-ref*)>
|
||||
<!ATTLIST logger
|
||||
name ID #REQUIRED
|
||||
additivity (true|false) "true"
|
||||
>
|
||||
|
||||
|
||||
<!ELEMENT categoryFactory (param*)>
|
||||
<!ATTLIST categoryFactory
|
||||
class CDATA #REQUIRED>
|
||||
|
||||
<!ELEMENT appender-ref EMPTY>
|
||||
<!ATTLIST appender-ref
|
||||
ref IDREF #REQUIRED
|
||||
>
|
||||
|
||||
<!-- If no priority element is specified, then the configurator MUST not -->
|
||||
<!-- touch the priority of root. -->
|
||||
<!-- The root category always exists and cannot be subclassed. -->
|
||||
<!ELEMENT root (param*, (priority|level)?, appender-ref*)>
|
||||
|
||||
|
||||
<!-- ==================================================================== -->
|
||||
<!-- A logging event -->
|
||||
<!-- ==================================================================== -->
|
||||
<!ELEMENT log4j:eventSet (log4j:event*)>
|
||||
<!ATTLIST log4j:eventSet
|
||||
xmlns:log4j CDATA #FIXED "http://jakarta.apache.org/log4j/"
|
||||
version (1.1|1.2) "1.2"
|
||||
includesLocationInfo (true|false) "true"
|
||||
>
|
||||
|
||||
|
||||
|
||||
<!ELEMENT log4j:event (log4j:message, log4j:NDC?, log4j:throwable?,
|
||||
log4j:locationInfo?) >
|
||||
|
||||
<!-- The timestamp format is application dependent. -->
|
||||
<!ATTLIST log4j:event
|
||||
logger CDATA #REQUIRED
|
||||
level CDATA #REQUIRED
|
||||
thread CDATA #REQUIRED
|
||||
timestamp CDATA #REQUIRED
|
||||
>
|
||||
|
||||
<!ELEMENT log4j:message (#PCDATA)>
|
||||
<!ELEMENT log4j:NDC (#PCDATA)>
|
||||
|
||||
<!ELEMENT log4j:throwable (#PCDATA)>
|
||||
|
||||
<!ELEMENT log4j:locationInfo EMPTY>
|
||||
<!ATTLIST log4j:locationInfo
|
||||
class CDATA #REQUIRED
|
||||
method CDATA #REQUIRED
|
||||
file CDATA #REQUIRED
|
||||
line CDATA #REQUIRED
|
||||
>
|
|
@ -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
|
27
src/main/resources/log4j.xml
Executable file
|
@ -0,0 +1,27 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
|
||||
|
||||
<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/">
|
||||
|
||||
<!-- Appenders -->
|
||||
<appender name="console" class="org.apache.log4j.ConsoleAppender">
|
||||
<param name="Target" value="System.out" />
|
||||
<layout class="org.apache.log4j.PatternLayout">
|
||||
<param name="ConversionPattern" value="%-5p: %c - %m%n" />
|
||||
</layout>
|
||||
</appender>
|
||||
|
||||
<logger name="org.springframework.samples.petclinic.aspects">
|
||||
<level value="DEBUG" />
|
||||
</logger>
|
||||
|
||||
|
||||
|
||||
<!-- Root Logger -->
|
||||
<root>
|
||||
<priority value="info" /><!--
|
||||
<level value="info"></level>
|
||||
--><appender-ref ref="console" />
|
||||
</root>
|
||||
|
||||
</log4j:configuration>
|
|
@ -1,12 +1,10 @@
|
|||
<%@ taglib prefix="spring" uri="http://www.springframework.org/tags" %>
|
||||
|
||||
<table class="footer">
|
||||
<tr>
|
||||
<td><a href="<spring:url value="/" htmlEscape="true" />">Home</a></td>
|
||||
<td align="right"><img src="<spring:url value="/static/images/springsource-logo.png" htmlEscape="true" />" alt="Sponsored by SpringSource"/></td>
|
||||
<td align="right"><img src="<spring:url value="/resources/images/springsource-logo.png" htmlEscape="true" />" alt="Sponsored by SpringSource"/></td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
</div>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
<%@ taglib prefix="spring" uri="http://www.springframework.org/tags" %>
|
||||
|
||||
<!--
|
||||
PetClinic :: a Spring Framework demonstration
|
||||
-->
|
||||
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
||||
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
|
||||
|
@ -9,6 +10,4 @@
|
|||
<title>PetClinic :: a Spring Framework demonstration</title>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
||||
<div id="main">
|
||||
|
|
|
@ -1,26 +1,38 @@
|
|||
<%@ include file="/WEB-INF/jsp/includes.jsp" %>
|
||||
<%@ include file="/WEB-INF/jsp/header.jsp" %>
|
||||
<%@ taglib prefix="spring" uri="http://www.springframework.org/tags" %>
|
||||
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
|
||||
<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form" %>
|
||||
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
|
||||
|
||||
<html lang="en">
|
||||
|
||||
<h2>Find Owners:</h2>
|
||||
<jsp:include page="../header.jsp"/>
|
||||
|
||||
<spring:url value="/owners" var="formUrl"/>
|
||||
<form:form modelAttribute="owner" action="${fn:escapeXml(formUrl)}" method="get">
|
||||
<table>
|
||||
<tr>
|
||||
<th>
|
||||
Last Name: <form:errors path="*" cssClass="errors"/>
|
||||
<br/>
|
||||
<form:input path="lastName" size="30" maxlength="80" />
|
||||
</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><p class="submit"><input type="submit" value="Find Owners"/></p></td>
|
||||
</tr>
|
||||
</table>
|
||||
</form:form>
|
||||
<body>
|
||||
|
||||
<br/>
|
||||
<a href='<spring:url value="/owners/new" htmlEscape="true"/>'>Add Owner</a>
|
||||
<div id="main">
|
||||
|
||||
<%@ include file="/WEB-INF/jsp/footer.jsp" %>
|
||||
<h2>Find Owners:</h2>
|
||||
|
||||
<spring:url value="/owners" var="formUrl"/>
|
||||
<form:form modelAttribute="owner" action="${fn:escapeXml(formUrl)}" method="get">
|
||||
<fieldset>
|
||||
<label class="control-label">Last name:</label>
|
||||
<div class="controls">
|
||||
<form:input path="lastName" size="30" maxlength="80"/>
|
||||
<form:errors path="*" cssClass="errors"/>
|
||||
</div>
|
||||
<div>
|
||||
<button type="submit">Find Owner</button>
|
||||
</div>
|
||||
</fieldset>
|
||||
</form:form>
|
||||
|
||||
<br/>
|
||||
<a href='<spring:url value="/owners/new" htmlEscape="true"/>'>Add Owner</a>
|
||||
|
||||
<jsp:include page="../footer.jsp"/>
|
||||
|
||||
</div>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
|
|
|
@ -1,7 +1,16 @@
|
|||
<%@ include file="/WEB-INF/jsp/includes.jsp" %>
|
||||
<%@ include file="/WEB-INF/jsp/header.jsp" %>
|
||||
<%@ taglib prefix="spring" uri="http://www.springframework.org/tags" %>
|
||||
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
|
||||
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
|
||||
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
|
||||
|
||||
<html xmlns="http://www.w3.org/1999/xhtml" lang="en">
|
||||
|
||||
<jsp:include page="../header.jsp"/>
|
||||
|
||||
<body>
|
||||
|
||||
<div id="main">
|
||||
|
||||
<h2>Owner Information</h2>
|
||||
|
||||
<table>
|
||||
|
@ -105,4 +114,9 @@
|
|||
</table>
|
||||
</c:forEach>
|
||||
|
||||
<%@ include file="/WEB-INF/jsp/footer.jsp" %>
|
||||
<jsp:include page="../footer.jsp"/>
|
||||
|
||||
</div>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
|
|
|
@ -1,16 +1,29 @@
|
|||
<%@ include file="/WEB-INF/jsp/includes.jsp" %>
|
||||
<%@ include file="/WEB-INF/jsp/header.jsp" %>
|
||||
<%@ taglib prefix="spring" uri="http://www.springframework.org/tags" %>
|
||||
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
|
||||
|
||||
<img src="<spring:url value="/static/images/pets.png" htmlEscape="true" />" align="right" style="position:relative;right:30px;">
|
||||
|
||||
<html xmlns="http://www.w3.org/1999/xhtml" lang="en">
|
||||
|
||||
<jsp:include page="header.jsp"/>
|
||||
|
||||
<body>
|
||||
|
||||
<div id="main">
|
||||
<img src="<spring:url value="/resources/images/pets.png" htmlEscape="true" />" align="right" style="position:relative;right:30px;"></img>
|
||||
<h2><fmt:message key="welcome"/></h2>
|
||||
|
||||
<ul>
|
||||
<li><a href="<spring:url value="/owners/search" htmlEscape="true" />">Find owner</a></li>
|
||||
<li><a href="<spring:url value="/vets" htmlEscape="true" />">Display all veterinarians</a></li>
|
||||
<li><a href="<spring:url value="/static/html/tutorial.html" htmlEscape="true" />">Tutorial</a></li>
|
||||
<li><a href="<spring:url value="/resources/html/tutorial.html" htmlEscape="true" />">Tutorial</a></li>
|
||||
</ul>
|
||||
|
||||
<p> </p>
|
||||
<p> </p>
|
||||
|
||||
<%@ include file="/WEB-INF/jsp/footer.jsp" %>
|
||||
<jsp:include page="footer.jsp"/>
|
||||
|
||||
</div>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
|
|
|
@ -3,11 +3,12 @@
|
|||
- DispatcherServlet application context for PetClinic's web tier.
|
||||
-->
|
||||
<beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xmlns:p="http://www.springframework.org/schema/p" xmlns:context="http://www.springframework.org/schema/context"
|
||||
xmlns:oxm="http://www.springframework.org/schema/oxm"
|
||||
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
|
||||
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd
|
||||
http://www.springframework.org/schema/oxm http://www.springframework.org/schema/oxm/spring-oxm-3.0.xsd">
|
||||
xmlns:p="http://www.springframework.org/schema/p" xmlns:context="http://www.springframework.org/schema/context"
|
||||
xmlns:oxm="http://www.springframework.org/schema/oxm" xmlns:mvc="http://www.springframework.org/schema/mvc"
|
||||
xsi:schemaLocation="http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-3.2.xsd
|
||||
http://www.springframework.org/schema/oxm http://www.springframework.org/schema/oxm/spring-oxm.xsd
|
||||
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
|
||||
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd">
|
||||
|
||||
<!--
|
||||
- The controllers are autodetected POJOs labeled with the @Controller annotation.
|
||||
|
@ -30,7 +31,7 @@
|
|||
- for request parameter binding. It overrides the default AnnotationMethodHandlerAdapter.
|
||||
-->
|
||||
<bean class="org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter">
|
||||
<property name="webBindingInitializer">
|
||||
<property name="webBindingInitializer">
|
||||
<bean class="org.springframework.samples.petclinic.web.ClinicBindingInitializer"/>
|
||||
</property>
|
||||
</bean>
|
||||
|
@ -58,15 +59,21 @@
|
|||
- BeanNameViewResolver. Note the use of the expression language to refer to the contentType
|
||||
- property of the vets view bean, setting it to 'application/vnd.springsource.samples.petclinic+xml'.
|
||||
-->
|
||||
<bean class="org.springframework.web.servlet.view.ContentNegotiatingViewResolver">
|
||||
<property name="mediaTypes">
|
||||
<map>
|
||||
<entry key="xml" value="#{vets.contentType}"/>
|
||||
<entry key="atom" value="#{visits.contentType}"/>
|
||||
</map>
|
||||
</property>
|
||||
<property name="order" value="0"/>
|
||||
|
||||
<mvc:annotation-driven content-negotiation-manager="contentNegotiationManager" />
|
||||
<mvc:resources mapping="/resources/**" location="/resources/"/>
|
||||
|
||||
<bean id="contentNegotiationManager" class="org.springframework.web.accept.ContentNegotiationManagerFactoryBean">
|
||||
<property name="favorPathExtension" value="false" />
|
||||
<property name="favorParameter" value="true" />
|
||||
<property name="mediaTypes">
|
||||
<value>
|
||||
atom=application/atom+xml
|
||||
xml=#{vets.contentType}
|
||||
</value>
|
||||
</property>
|
||||
</bean>
|
||||
|
||||
|
||||
<!--
|
||||
- The BeanNameViewResolver is used to pick up the visits view name (below).
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
<context:property-placeholder location="classpath:jdbc.properties"/>
|
||||
|
||||
<!-- Hibernate SessionFactory -->
|
||||
<bean id="sessionFactory" class="org.springframework.orm.hibernate3.LocalSessionFactoryBean"
|
||||
<bean id="sessionFactory" class="org.springframework.orm.hibernate4.LocalSessionFactoryBean"
|
||||
p:dataSource-ref="dataSource" p:mappingResources="petclinic.hbm.xml">
|
||||
<property name="hibernateProperties">
|
||||
<props>
|
||||
|
@ -32,14 +32,14 @@
|
|||
<property name="eventListeners">
|
||||
<map>
|
||||
<entry key="merge">
|
||||
<bean class="org.springframework.orm.hibernate3.support.IdTransferringMergeEventListener"/>
|
||||
<bean class="org.springframework.orm.hibernate4.support.IdTransferringMergeEventListener"/>
|
||||
</entry>
|
||||
</map>
|
||||
</property>
|
||||
</bean>
|
||||
|
||||
<!-- Transaction manager for a single Hibernate SessionFactory (alternative to JTA) -->
|
||||
<bean id="transactionManager" class="org.springframework.orm.hibernate3.HibernateTransactionManager"
|
||||
<bean id="transactionManager" class="org.springframework.orm.hibernate4.HibernateTransactionManager"
|
||||
p:sessionFactory-ref="sessionFactory"/>
|
||||
|
||||
<!-- Transaction manager that delegates to JTA (for a transactional JNDI DataSource) -->
|
||||
|
|
Before Width: | Height: | Size: 14 KiB |
Before Width: | Height: | Size: 54 KiB |
Before Width: | Height: | Size: 4.9 KiB |
Before Width: | Height: | Size: 14 KiB After Width: | Height: | Size: 14 KiB |
Before Width: | Height: | Size: 2.9 KiB After Width: | Height: | Size: 2.9 KiB |
Before Width: | Height: | Size: 54 KiB After Width: | Height: | Size: 54 KiB |
Before Width: | Height: | Size: 4.9 KiB After Width: | Height: | Size: 4.9 KiB |
Before Width: | Height: | Size: 2.8 KiB After Width: | Height: | Size: 2.8 KiB |
|
@ -11,6 +11,7 @@ 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;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
|
@ -81,18 +82,16 @@ import org.springframework.test.context.junit4.AbstractTransactionalJUnit4Spring
|
|||
* @author Sam Brannen
|
||||
*/
|
||||
@ContextConfiguration
|
||||
public abstract class AbstractClinicTests extends AbstractTransactionalJUnit4SpringContextTests {
|
||||
public abstract class AbstractClinicTests {
|
||||
|
||||
@Autowired
|
||||
protected Clinic clinic;
|
||||
|
||||
|
||||
@Test
|
||||
@Test @Transactional
|
||||
public void getVets() {
|
||||
Collection<Vet> 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());
|
||||
|
@ -107,8 +106,7 @@ public abstract class AbstractClinicTests extends AbstractTransactionalJUnit4Spr
|
|||
@Test
|
||||
public void getPetTypes() {
|
||||
Collection<PetType> 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);
|
||||
|
|
|
@ -1,8 +1,10 @@
|
|||
package org.springframework.samples.petclinic.hibernate;
|
||||
|
||||
import org.junit.runner.RunWith;
|
||||
import org.springframework.samples.petclinic.AbstractClinicTests;
|
||||
import org.springframework.test.annotation.DirtiesContext;
|
||||
import org.springframework.test.context.ContextConfiguration;
|
||||
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
|
@ -17,6 +19,7 @@ import org.springframework.test.context.ContextConfiguration;
|
|||
*/
|
||||
@ContextConfiguration
|
||||
@DirtiesContext
|
||||
@RunWith(SpringJUnit4ClassRunner.class)
|
||||
public class HibernateClinicTests extends AbstractClinicTests {
|
||||
|
||||
}
|
||||
|
|
|
@ -1,12 +1,18 @@
|
|||
|
||||
package org.springframework.samples.petclinic.jpa;
|
||||
|
||||
import static junit.framework.Assert.assertEquals;
|
||||
import static junit.framework.Assert.assertTrue;
|
||||
import static junit.framework.Assert.fail;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.Date;
|
||||
|
||||
import javax.persistence.EntityManager;
|
||||
import javax.persistence.PersistenceContext;
|
||||
|
||||
import org.springframework.jdbc.core.simple.SimpleJdbcTemplate;
|
||||
import org.junit.Test;
|
||||
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;
|
||||
|
@ -14,8 +20,6 @@ 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;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
|
@ -35,13 +39,6 @@ import org.springframework.test.jpa.AbstractJpaTests;
|
|||
* <li>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.</li>
|
||||
* <li>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.</li>
|
||||
* </ul>
|
||||
* <p>
|
||||
* {@link AbstractJpaTests} and related classes are shipped in
|
||||
|
@ -52,38 +49,30 @@ import org.springframework.test.jpa.AbstractJpaTests;
|
|||
* @author Sam Brannen
|
||||
* @see AbstractJpaTests
|
||||
*/
|
||||
public abstract class AbstractJpaClinicTests extends AbstractJpaTests {
|
||||
public abstract class AbstractJpaClinicTests {
|
||||
|
||||
@PersistenceContext
|
||||
private EntityManager entityManager;
|
||||
|
||||
@Autowired
|
||||
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
|
||||
* <code>org.springframework.test</code> package.
|
||||
*
|
||||
* @param clinic clinic to test
|
||||
*/
|
||||
public void setClinic(Clinic clinic) {
|
||||
this.clinic = clinic;
|
||||
}
|
||||
|
||||
@ExpectedException(IllegalArgumentException.class)
|
||||
@Test
|
||||
public void testBogusJpql() {
|
||||
this.sharedEntityManager.createQuery("SELECT RUBBISH FROM RUBBISH HEAP").executeUpdate();
|
||||
try {
|
||||
this.entityManager.createQuery("SELECT RUBBISH FROM RUBBISH HEAP").executeUpdate();
|
||||
fail("exception was expected because of incorrect SQL statement");
|
||||
} catch (Exception e) {
|
||||
// expected
|
||||
}
|
||||
}
|
||||
|
||||
public void testApplicationManaged() {
|
||||
EntityManager appManaged = this.entityManagerFactory.createEntityManager();
|
||||
appManaged.joinTransaction();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testGetVets() {
|
||||
Collection<Vet> 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());
|
||||
|
@ -95,16 +84,17 @@ public abstract class AbstractJpaClinicTests extends AbstractJpaTests {
|
|||
assertEquals("surgery", (v2.getSpecialties().get(1)).getName());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testGetPetTypes() {
|
||||
Collection<PetType> 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 testFindOwners() {
|
||||
Collection<Owner> owners = this.clinic.findOwners("Davis");
|
||||
assertEquals(2, owners.size());
|
||||
|
@ -112,21 +102,15 @@ public abstract class AbstractJpaClinicTests extends AbstractJpaTests {
|
|||
assertEquals(0, owners.size());
|
||||
}
|
||||
|
||||
@Test
|
||||
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();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testInsertOwner() {
|
||||
Collection<Owner> owners = this.clinic.findOwners("Schultz");
|
||||
int found = owners.size();
|
||||
|
@ -138,6 +122,7 @@ public abstract class AbstractJpaClinicTests extends AbstractJpaTests {
|
|||
assertEquals(found + 1, owners.size());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testUpdateOwner() throws Exception {
|
||||
Owner o1 = this.clinic.loadOwner(1);
|
||||
String old = o1.getLastName();
|
||||
|
@ -147,6 +132,7 @@ public abstract class AbstractJpaClinicTests extends AbstractJpaTests {
|
|||
assertEquals(old + "X", o1.getLastName());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testLoadPet() {
|
||||
Collection<PetType> types = this.clinic.getPetTypes();
|
||||
Pet p7 = this.clinic.loadPet(7);
|
||||
|
@ -159,6 +145,7 @@ public abstract class AbstractJpaClinicTests extends AbstractJpaTests {
|
|||
assertEquals("Peter", p6.getOwner().getFirstName());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testInsertPet() {
|
||||
Owner o6 = this.clinic.loadOwner(6);
|
||||
int found = o6.getPets().size();
|
||||
|
@ -175,6 +162,7 @@ public abstract class AbstractJpaClinicTests extends AbstractJpaTests {
|
|||
assertEquals(found + 1, o6.getPets().size());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testUpdatePet() throws Exception {
|
||||
Pet p7 = this.clinic.loadPet(7);
|
||||
String old = p7.getName();
|
||||
|
@ -184,6 +172,7 @@ public abstract class AbstractJpaClinicTests extends AbstractJpaTests {
|
|||
assertEquals(old + "X", p7.getName());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testInsertVisit() {
|
||||
Pet p7 = this.clinic.loadPet(7);
|
||||
int found = p7.getVisits().size();
|
||||
|
|
|
@ -2,7 +2,14 @@ package org.springframework.samples.petclinic.jpa;
|
|||
|
||||
import java.util.List;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.samples.petclinic.aspects.UsageLogAspect;
|
||||
import org.springframework.test.context.ContextConfiguration;
|
||||
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
|
||||
import static junit.framework.Assert.assertTrue;
|
||||
import static junit.framework.Assert.assertFalse;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
|
@ -17,23 +24,16 @@ import org.springframework.samples.petclinic.aspects.UsageLogAspect;
|
|||
* @author Rod Johnson
|
||||
* @author Juergen Hoeller
|
||||
*/
|
||||
@ContextConfiguration(locations={"applicationContext-jpaCommon.xml", "applicationContext-hibernateAdapter.xml",
|
||||
"applicationContext-entityManager.xml"})
|
||||
@RunWith(SpringJUnit4ClassRunner.class)
|
||||
public class EntityManagerClinicTests extends AbstractJpaClinicTests {
|
||||
|
||||
@Autowired
|
||||
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"
|
||||
};
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testUsageLogAspectIsInvoked() {
|
||||
String name1 = "Schuurman";
|
||||
String name2 = "Greenwood";
|
||||
|
|
|
@ -1,5 +1,9 @@
|
|||
package org.springframework.samples.petclinic.jpa;
|
||||
|
||||
import org.junit.runner.RunWith;
|
||||
import org.springframework.test.context.ContextConfiguration;
|
||||
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* Tests for the DAO variant based on the shared EntityManager approach, using
|
||||
|
@ -12,15 +16,9 @@ package org.springframework.samples.petclinic.jpa;
|
|||
*
|
||||
* @author Juergen Hoeller
|
||||
*/
|
||||
@ContextConfiguration(locations={"applicationContext-jpaCommon.xml", "applicationContext-hibernateAdapter.xml",
|
||||
"applicationContext-entityManager.xml"})
|
||||
@RunWith(SpringJUnit4ClassRunner.class)
|
||||
public class HibernateEntityManagerClinicTests extends EntityManagerClinicTests {
|
||||
|
||||
@Override
|
||||
protected String[] getConfigPaths() {
|
||||
return new String[] {
|
||||
"applicationContext-jpaCommon.xml",
|
||||
"applicationContext-hibernateAdapter.xml",
|
||||
"applicationContext-entityManager.xml"
|
||||
};
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,27 +0,0 @@
|
|||
|
||||
package org.springframework.samples.petclinic.jpa;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* Tests for the DAO variant based on the shared EntityManager approach, using
|
||||
* Apache OpenJPA for testing instead of the reference implementation.
|
||||
* </p>
|
||||
* <p>
|
||||
* Specifically tests usage of an <code>orm.xml</code> file, loaded by the
|
||||
* persistence provider through the Spring-provided persistence unit root URL.
|
||||
* </p>
|
||||
*
|
||||
* @author Juergen Hoeller
|
||||
*/
|
||||
public class OpenJpaEntityManagerClinicTests extends EntityManagerClinicTests {
|
||||
|
||||
@Override
|
||||
protected String[] getConfigPaths() {
|
||||
return new String[] {
|
||||
"applicationContext-jpaCommon.xml",
|
||||
"applicationContext-openJpaAdapter.xml",
|
||||
"applicationContext-entityManager.xml"
|
||||
};
|
||||
}
|
||||
|
||||
}
|
|
@ -1,13 +1,13 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xmlns:p="http://www.springframework.org/schema/p"
|
||||
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd">
|
||||
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd">
|
||||
|
||||
<bean class="org.springframework.samples.petclinic.hibernate.HibernateClinic">
|
||||
<constructor-arg ref="sessionFactory"/>
|
||||
</bean>
|
||||
|
||||
<bean id="sessionFactory" class="org.springframework.orm.hibernate3.LocalSessionFactoryBean"
|
||||
<bean id="sessionFactory" class="org.springframework.orm.hibernate4.LocalSessionFactoryBean"
|
||||
p:dataSource-ref="dataSource" p:mappingResources="petclinic.hbm.xml">
|
||||
<property name="hibernateProperties">
|
||||
<props>
|
||||
|
@ -15,16 +15,9 @@
|
|||
<prop key="hibernate.show_sql">${hibernate.show_sql}</prop>
|
||||
</props>
|
||||
</property>
|
||||
<property name="eventListeners">
|
||||
<map>
|
||||
<entry key="merge">
|
||||
<bean class="org.springframework.orm.hibernate3.support.IdTransferringMergeEventListener" />
|
||||
</entry>
|
||||
</map>
|
||||
</property>
|
||||
</bean>
|
||||
|
||||
<bean id="transactionManager" class="org.springframework.orm.hibernate3.HibernateTransactionManager"
|
||||
<bean id="transactionManager" class="org.springframework.orm.hibernate4.HibernateTransactionManager"
|
||||
p:sessionFactory-ref="sessionFactory" />
|
||||
|
||||
<bean class="org.springframework.dao.annotation.PersistenceExceptionTranslationPostProcessor" />
|
||||
|
|
|
@ -1,9 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xmlns:p="http://www.springframework.org/schema/p"
|
||||
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd">
|
||||
|
||||
<bean id="jpaAdapter" class="org.springframework.orm.jpa.vendor.OpenJpaVendorAdapter" p:database="${jpa.database}"
|
||||
p:showSql="${jpa.showSql}" />
|
||||
|
||||
</beans>
|
|
@ -1,9 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xmlns:p="http://www.springframework.org/schema/p"
|
||||
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd">
|
||||
|
||||
<bean id="jpaAdapter" class="org.springframework.orm.jpa.vendor.TopLinkJpaVendorAdapter"
|
||||
p:databasePlatform="${jpa.databasePlatform}" p:showSql="${jpa.showSql}" />
|
||||
|
||||
</beans>
|