eu.etaxonomy.taxeditor.printpublisher/src/main/java/eu/etaxonomy/taxeditor/printpublisher/wizard/SelectServiceWizardPage.java -text
eu.etaxonomy.taxeditor.printpublisher/src/main/java/eu/etaxonomy/taxeditor/printpublisher/wizard/SelectStylesheetWizardPage.java -text
eu.etaxonomy.taxeditor.printpublisher/src/main/java/eu/etaxonomy/taxeditor/printpublisher/wizard/SelectTaxaWizardPage.java -text
-eu.etaxonomy.taxeditor.remoting/.classpath -text
-eu.etaxonomy.taxeditor.remoting/.project -text
-eu.etaxonomy.taxeditor.remoting/.settings/org.eclipse.jdt.core.prefs -text
-eu.etaxonomy.taxeditor.remoting/.settings/org.eclipse.pde.core.prefs -text
-eu.etaxonomy.taxeditor.remoting/.svnignore -text
-eu.etaxonomy.taxeditor.remoting/META-INF/MANIFEST.MF -text
-eu.etaxonomy.taxeditor.remoting/build.properties -text
-eu.etaxonomy.taxeditor.remoting/lib/.svnignore -text
-eu.etaxonomy.taxeditor.remoting/pom.xml -text
-eu.etaxonomy.taxeditor.remoting/src/main/java/eu/etaxonomy/cdm/api/application/CdmApplicationRemoteConfiguration.java -text
-eu.etaxonomy.taxeditor.remoting/src/main/java/eu/etaxonomy/cdm/api/application/CdmApplicationRemoteController.java -text
-eu.etaxonomy.taxeditor.remoting/src/main/java/eu/etaxonomy/cdm/api/cache/CachedCommonServiceImpl.java -text
-eu.etaxonomy.taxeditor.remoting/src/main/java/eu/etaxonomy/cdm/api/cache/CdmEntityCacheManager.java -text
-eu.etaxonomy.taxeditor.remoting/src/main/java/eu/etaxonomy/cdm/api/cache/CdmServiceCacher.java -text
-eu.etaxonomy.taxeditor.remoting/src/main/java/eu/etaxonomy/cdm/api/cache/CdmTransientEntityCacher.java -text
-eu.etaxonomy.taxeditor.remoting/src/main/java/eu/etaxonomy/cdm/api/cache/ICachedCommonService.java -text
-eu.etaxonomy.taxeditor.remoting/src/main/java/eu/etaxonomy/cdm/api/cache/LazyLoadingCachingUtils.java -text
-eu.etaxonomy.taxeditor.remoting/src/main/java/eu/etaxonomy/cdm/remote/CdmPersistentRemoteSource.java -text
-eu.etaxonomy.taxeditor.remoting/src/main/java/eu/etaxonomy/cdm/remote/CdmRemoteSource.java -text
-eu.etaxonomy.taxeditor.remoting/src/main/java/eu/etaxonomy/cdm/remote/CdmRemoteSourceBase.java -text
-eu.etaxonomy.taxeditor.remoting/src/main/java/eu/etaxonomy/cdm/remote/CdmRemoteSourceException.java -text
-eu.etaxonomy.taxeditor.remoting/src/main/java/eu/etaxonomy/cdm/remote/ICdmRemoteSource.java -text
-eu.etaxonomy.taxeditor.remoting/src/main/java/eu/etaxonomy/taxeditor/remoting/RemotingTestPluginActivator.java -text
-eu.etaxonomy.taxeditor.remoting/src/main/java/org/hibernate/collection/internal/AbstractPersistentCollection.java -text
-eu.etaxonomy.taxeditor.remoting/src/main/java/org/hibernate/proxy/AbstractLazyInitializer.java -text
-eu.etaxonomy.taxeditor.remoting/src/main/resources/etc/jetty/.svnignore -text
-eu.etaxonomy.taxeditor.remoting/src/main/resources/etc/jetty/jetty-runner-9.2.3.v20140905.jar -text
-eu.etaxonomy.taxeditor.remoting/src/main/resources/etc/jetty/start-9.2.3.v20140905.jar -text
-eu.etaxonomy.taxeditor.remoting/src/main/resources/eu/etaxonomy/cdm/config.properties -text
-eu.etaxonomy.taxeditor.remoting/src/main/resources/eu/etaxonomy/cdm/httpInvokerServiceClients.xml -text
-eu.etaxonomy.taxeditor.remoting/src/main/resources/eu/etaxonomy/cdm/localApplicationContext.xml -text
-eu.etaxonomy.taxeditor.remoting/src/main/resources/eu/etaxonomy/cdm/remotingApplicationContext.xml -text
-eu.etaxonomy.taxeditor.remoting/src/main/resources/eu/etaxonomy/cdm/remoting_persistence_security.xml -text
-eu.etaxonomy.taxeditor.remoting/src/main/resources/eu/etaxonomy/cdm/remoting_services_security.xml -text
-eu.etaxonomy.taxeditor.remoting/src/test/java/eu/etaxonomy/cdm/polytomouskey/PolytomousKeyTest.java -text
-eu.etaxonomy.taxeditor.remoting/src/test/java/eu/etaxonomy/taxeditor/exception/CDMServerException.java -text
-eu.etaxonomy.taxeditor.remoting/src/test/java/eu/etaxonomy/taxeditor/httpinvoker/BaseRemotingTest.java -text
-eu.etaxonomy.taxeditor.remoting/src/test/java/eu/etaxonomy/taxeditor/httpinvoker/CDMServer.java -text
-eu.etaxonomy.taxeditor.remoting/src/test/java/eu/etaxonomy/taxeditor/httpinvoker/CdmPersistentRemoteSourceTest.java -text
-eu.etaxonomy.taxeditor.remoting/src/test/java/eu/etaxonomy/taxeditor/httpinvoker/CdmRemoteSourceTest.java -text
-eu.etaxonomy.taxeditor.remoting/src/test/java/eu/etaxonomy/taxeditor/httpinvoker/CdmServerTest.java -text
-eu.etaxonomy.taxeditor.remoting/src/test/java/eu/etaxonomy/taxeditor/httpinvoker/CdmServerTestManager.java -text
-eu.etaxonomy.taxeditor.remoting/src/test/java/eu/etaxonomy/taxeditor/httpinvoker/HttpInvokerServicesTest.java -text
-eu.etaxonomy.taxeditor.remoting/src/test/java/eu/etaxonomy/taxeditor/lazyloading/AbstractLazyInitializerTest.java -text
-eu.etaxonomy.taxeditor.remoting/src/test/java/eu/etaxonomy/taxeditor/lazyloading/CdmEntityCacherTest.java -text
-eu.etaxonomy.taxeditor.remoting/src/test/java/eu/etaxonomy/taxeditor/lazyloading/CdmServiceCacherTest.java -text
-eu.etaxonomy.taxeditor.remoting/src/test/java/eu/etaxonomy/taxeditor/lazyloading/RemoteLazyLoadingTest.java -text
-eu.etaxonomy.taxeditor.remoting/src/test/java/eu/etaxonomy/taxeditor/lazyloading/RemotePersistentCollectionTest.java -text
-eu.etaxonomy.taxeditor.remoting/src/test/resources/datasources.xml -text
-eu.etaxonomy.taxeditor.remoting/src/test/resources/eu/etaxonomy/cdm/cdm.datasources.xml -text
-eu.etaxonomy.taxeditor.remoting/src/test/resources/eu/etaxonomy/cdm/polytomouskey/PolytomousKeyTest.readPolytmousKeyData.xml -text
-eu.etaxonomy.taxeditor.remoting/src/test/resources/eu/etaxonomy/cdm/polytomouskey/PolytomousKeyTest.xml -text
-eu.etaxonomy.taxeditor.remoting/src/test/resources/eu/etaxonomy/cdm/testRemotingApplicationContext.xml -text
-eu.etaxonomy.taxeditor.remoting/src/test/resources/eu/etaxonomy/taxeditor/lazyloading/AbstractLazyInitializerTest.xml -text
-eu.etaxonomy.taxeditor.remoting/src/test/resources/eu/etaxonomy/taxeditor/lazyloading/CdmEntityCacherTest.xml -text
-eu.etaxonomy.taxeditor.remoting/src/test/resources/h2/cdmTest.h2.db -text
-eu.etaxonomy.taxeditor.remoting/src/test/resources/h2/cdmTest.trace.db -text
-eu.etaxonomy.taxeditor.remoting/src/test/resources/log4j.properties -text
-eu.etaxonomy.taxeditor.remoting/src/test/resources/unitils.properties -text
eu.etaxonomy.taxeditor.store/.classpath -text
eu.etaxonomy.taxeditor.store/.project -text
eu.etaxonomy.taxeditor.store/META-INF/MANIFEST.MF -text
eu.etaxonomy.taxeditor.navigation/target
eu.etaxonomy.taxeditor.printpublisher/.settings
eu.etaxonomy.taxeditor.printpublisher/target
-eu.etaxonomy.taxeditor.remoting/*.log
-eu.etaxonomy.taxeditor.remoting/.settings
-eu.etaxonomy.taxeditor.remoting/lib
-eu.etaxonomy.taxeditor.remoting/lib/*.jar
-eu.etaxonomy.taxeditor.remoting/src/main/resources/etc/jetty/cdmlib-remote-webapp.war
-eu.etaxonomy.taxeditor.remoting/target
eu.etaxonomy.taxeditor.store/.settings
eu.etaxonomy.taxeditor.store/hibernate.log
eu.etaxonomy.taxeditor.store/target
+++ /dev/null
-<?xml version="1.0" encoding="UTF-8"?>
-<classpath>
- <classpathentry including="**/*.java" kind="src" path="src/main/java"/>
- <classpathentry excluding="**/*.java" kind="src" path="src/main/resources"/>
- <classpathentry including="**/*.java" kind="src" output="target/test-classes" path="src/test/java"/>
- <classpathentry excluding="**/*.java" kind="src" output="target/test-classes" path="src/test/resources"/>
- <classpathentry exported="true" kind="lib" path="lib/opencsv-2.4.jar"/>
- <classpathentry exported="true" kind="lib" path="lib/dbunit-2.4.9.jar"/>
- <classpathentry exported="true" kind="lib" path="lib/cdmlib-persistence-3.3.8-SNAPSHOT.jar"/>
- <classpathentry exported="true" kind="lib" path="lib/org.springframework.aop-3.2.2.RELEASE.jar"/>
- <classpathentry exported="true" kind="lib" path="lib/org.springframework.aspects-3.2.2.RELEASE.jar"/>
- <classpathentry exported="true" kind="lib" path="lib/org.springframework.beans-3.2.2.RELEASE.jar"/>
- <classpathentry exported="true" kind="lib" path="lib/org.springframework.core-3.2.2.RELEASE.jar"/>
- <classpathentry exported="true" kind="lib" path="lib/org.springframework.expression-3.2.2.RELEASE.jar"/>
- <classpathentry exported="true" kind="lib" path="lib/org.springframework.jdbc-3.2.2.RELEASE.jar"/>
- <classpathentry exported="true" kind="lib" path="lib/org.springframework.orm-3.2.2.RELEASE.jar"/>
- <classpathentry exported="true" kind="lib" path="lib/org.springframework.transaction-3.2.2.RELEASE.jar"/>
- <classpathentry exported="true" kind="lib" path="lib/org.springframework.web-3.2.2.RELEASE.jar"/>
- <classpathentry exported="true" kind="lib" path="lib/org.springframework.context-3.2.2.RELEASE.jar"/>
- <classpathentry exported="true" kind="lib" path="lib/hibernate-commons-annotations-4.0.1.Final.jar"/>
- <classpathentry exported="true" kind="lib" path="lib/hibernate-core-4.1.10.Final.jar" sourcepath="/home/cmathew/Temp/hibernate-core-4.1.10.Final-sources.jar"/>
- <classpathentry exported="true" kind="lib" path="lib/hibernate-entitymanager-4.1.10.Final.jar"/>
- <classpathentry exported="true" kind="lib" path="lib/hibernate-envers-4.1.10.Final.jar"/>
- <classpathentry exported="true" kind="lib" path="lib/hibernate-search-engine-4.2.0.Final.jar"/>
- <classpathentry exported="true" kind="lib" path="lib/hibernate-jpa-2.0-api-1.0.1.Final.jar"/>
- <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
- <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
- <classpathentry exported="true" kind="lib" path="lib/aspectjrt-1.7.1.jar"/>
- <classpathentry exported="true" kind="lib" path="lib/c3p0-0.9.2.jar"/>
- <classpathentry exported="true" kind="lib" path="lib/cdmlib-commons-3.3.8-SNAPSHOT.jar"/>
- <classpathentry exported="true" kind="lib" path="lib/cdmlib-ext-3.3.8-SNAPSHOT.jar"/>
- <classpathentry exported="true" kind="lib" path="lib/cdmlib-model-3.3.8-SNAPSHOT.jar" sourcepath="/home/cmathew/Development/EDIT/taxeditor/eu.etaxonomy.taxeditor.cdmlib/lib/cdmlib-model-3.3.8-SNAPSHOT-sources.jar"/>
- <classpathentry exported="true" kind="lib" path="lib/cdmlib-services-3.3.8-SNAPSHOT.jar" sourcepath="/home/cmathew/.m2/repository/eu/etaxonomy/cdmlib-services/3.3.8-SNAPSHOT/cdmlib-services-3.3.8-SNAPSHOT-sources.jar"/>
- <classpathentry exported="true" kind="lib" path="lib/ehcache-core-2.4.3.jar"/>
- <classpathentry exported="true" kind="lib" path="lib/hamcrest-core-1.3.jar"/>
- <classpathentry exported="true" kind="lib" path="lib/jboss-logging-3.1.3.GA.jar"/>
- <classpathentry exported="true" kind="lib" path="lib/jboss-transaction-api_1.1_spec-1.0.0.Final.jar"/>
- <classpathentry exported="true" kind="lib" path="lib/jdom-1.1.3.jar"/>
- <classpathentry exported="true" kind="lib" path="lib/junit-4.11.jar" sourcepath="/home/cmathew/Downloads/junit-4.11-sources.jar"/>
- <classpathentry exported="true" kind="lib" path="lib/log4j-1.2.17.jar"/>
- <classpathentry exported="true" kind="lib" path="lib/spring-security-config-3.1.3.RELEASE.jar"/>
- <classpathentry exported="true" kind="lib" path="lib/spring-security-core-3.1.3.RELEASE.jar"/>
- <classpathentry exported="true" kind="lib" path="lib/spring-security-remoting-3.1.3.RELEASE.jar"/>
- <classpathentry exported="true" kind="lib" path="lib/unitils-core-3.4.2.jar"/>
- <classpathentry exported="true" kind="lib" path="lib/commons-logging-1.1.1.jar"/>
- <classpathentry exported="true" kind="lib" path="lib/commons-lang-2.6.jar"/>
- <classpathentry exported="true" kind="lib" path="lib/aopalliance-1.0.jar"/>
- <classpathentry exported="true" kind="lib" path="lib/joda-time-2.1.jar"/>
- <classpathentry exported="true" kind="lib" path="lib/lsid-client-1.1.2.jar"/>
- <classpathentry exported="true" kind="lib" path="lib/lucene-core-3.6.2.jar"/>
- <classpathentry exported="true" kind="lib" path="lib/lsid-server-1.1.2.jar"/>
- <classpathentry exported="true" kind="lib" path="lib/slf4j-api-1.7.2.jar"/>
- <classpathentry exported="true" kind="lib" path="lib/javassist-3.17.1-GA.jar"/>
- <classpathentry exported="true" kind="lib" path="lib/unitils-spring-3.4.2.jar"/>
- <classpathentry exported="true" kind="lib" path="lib/unitils-database-3.4.2.jar"/>
- <classpathentry exported="true" kind="lib" path="lib/commons-dbcp-1.4.jar"/>
- <classpathentry exported="true" kind="lib" path="lib/commons-pool-1.5.4.jar"/>
- <classpathentry exported="true" kind="lib" path="lib/unitils-dbmaintainer-3.4.2.jar"/>
- <classpathentry exported="true" kind="lib" path="lib/h2-1.4.181.jar"/>
- <classpathentry exported="true" kind="lib" path="lib/unitils-dbunit-3.4.2.jar"/>
- <classpathentry kind="output" path="target/classes"/>
-</classpath>
+++ /dev/null
-<?xml version="1.0" encoding="UTF-8"?>
-<projectDescription>
- <name>eu.etaxonomy.taxeditor.remoting</name>
- <comment>Holds all UI tests for the Taxonomic Editor. NO_M2ECLIPSE_SUPPORT: Project files created with the maven-eclipse-plugin are not supported in M2Eclipse.</comment>
- <projects>
- </projects>
- <buildSpec>
- <buildCommand>
- <name>org.eclipse.jdt.core.javabuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- <buildCommand>
- <name>org.eclipse.pde.ManifestBuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- <buildCommand>
- <name>org.eclipse.pde.SchemaBuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- </buildSpec>
- <natures>
- <nature>org.eclipse.jdt.core.javanature</nature>
- <nature>org.eclipse.pde.PluginNature</nature>
- </natures>
-</projectDescription>
+++ /dev/null
-eclipse.preferences.version=1
-org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
-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.6
+++ /dev/null
-eclipse.preferences.version=1
-pluginProject.extensions=false
-resolve.requirebundle=false
+++ /dev/null
-lib
-*.log
-target
-.settings
+++ /dev/null
-Manifest-Version: 1.0
-Bundle-ManifestVersion: 2
-Bundle-Name: UI Test Bundle
-Bundle-SymbolicName: eu.etaxonomy.taxeditor.remoting;singleton:=true
-Bundle-Version: 3.3.8.qualifier
-Bundle-Activator: eu.etaxonomy.taxeditor.remoting.RemotingTestPluginActivator
-Bundle-Vendor: EDIT
-Bundle-RequiredExecutionEnvironment: JavaSE-1.6
-Bundle-ActivationPolicy: lazy
-Export-Package: eu.etaxonomy.cdm.api.application,
- eu.etaxonomy.cdm.remote,
- eu.etaxonomy.taxeditor.httpinvoker,
- org.hibernate.collection.internal,
- org.hibernate.proxy
-Bundle-ClassPath: lib/aspectjrt-1.7.1.jar,
- lib/c3p0-0.9.2.jar,
- lib/cdmlib-commons-3.3.8-SNAPSHOT.jar,
- lib/cdmlib-ext-3.3.8-SNAPSHOT.jar,
- lib/cdmlib-model-3.3.8-SNAPSHOT.jar,
- lib/cdmlib-services-3.3.8-SNAPSHOT.jar,
- lib/ehcache-core-2.4.3.jar,
- lib/hamcrest-core-1.3.jar,
- lib/jboss-logging-3.1.3.GA.jar,
- lib/jboss-transaction-api_1.1_spec-1.0.0.Final.jar,
- lib/jdom-1.1.3.jar,
- lib/junit-4.11.jar,
- lib/log4j-1.2.17.jar,
- lib/spring-security-config-3.1.3.RELEASE.jar,
- lib/spring-security-core-3.1.3.RELEASE.jar,
- lib/spring-security-remoting-3.1.3.RELEASE.jar,
- lib/unitils-core-3.4.2.jar,
- lib/commons-logging-1.1.1.jar,
- lib/commons-lang-2.6.jar,
- lib/aopalliance-1.0.jar,
- lib/joda-time-2.1.jar,
- lib/lsid-client-1.1.2.jar,
- lib/lucene-core-3.6.2.jar,
- lib/lsid-server-1.1.2.jar,
- lib/slf4j-api-1.7.2.jar,
- lib/javassist-3.17.1-GA.jar,
- lib/unitils-spring-3.4.2.jar,
- lib/unitils-database-3.4.2.jar,
- lib/commons-dbcp-1.4.jar,
- lib/commons-pool-1.5.4.jar,
- lib/unitils-dbmaintainer-3.4.2.jar,
- lib/h2-1.4.181.jar,
- lib/unitils-dbunit-3.4.2.jar,
- lib/hibernate-jpa-2.0-api-1.0.1.Final.jar,
- lib/hibernate-commons-annotations-4.0.1.Final.jar,
- lib/hibernate-core-4.1.10.Final.jar,
- lib/hibernate-entitymanager-4.1.10.Final.jar,
- lib/hibernate-envers-4.1.10.Final.jar,
- lib/hibernate-search-engine-4.2.0.Final.jar,
- lib/org.springframework.context-3.2.2.RELEASE.jar,
- lib/org.springframework.aop-3.2.2.RELEASE.jar,
- lib/org.springframework.aspects-3.2.2.RELEASE.jar,
- lib/org.springframework.beans-3.2.2.RELEASE.jar,
- lib/org.springframework.core-3.2.2.RELEASE.jar,
- lib/org.springframework.expression-3.2.2.RELEASE.jar,
- lib/org.springframework.jdbc-3.2.2.RELEASE.jar,
- lib/org.springframework.orm-3.2.2.RELEASE.jar,
- lib/org.springframework.transaction-3.2.2.RELEASE.jar,
- lib/org.springframework.web-3.2.2.RELEASE.jar,
- lib/cdmlib-persistence-3.3.8-SNAPSHOT.jar,
- lib/dbunit-2.4.9.jar,
- lib/opencsv-2.4.jar
-Import-Package: org.osgi.framework
-Require-Bundle: org.eclipse.osgi
-
+++ /dev/null
-output.. = target/classes/
-bin.includes = META-INF/,\
- lib/aspectjrt-1.7.1.jar,\
- lib/c3p0-0.9.2.jar,\
- lib/cdmlib-commons-3.3.8-SNAPSHOT.jar,\
- lib/cdmlib-ext-3.3.8-SNAPSHOT.jar,\
- lib/cdmlib-model-3.3.8-SNAPSHOT.jar,\
- lib/cdmlib-services-3.3.8-SNAPSHOT.jar,\
- lib/ehcache-core-2.4.3.jar,\
- lib/hamcrest-core-1.3.jar,\
- lib/jboss-logging-3.1.3.GA.jar,\
- lib/jboss-transaction-api_1.1_spec-1.0.0.Final.jar,\
- lib/jdom-1.1.3.jar,\
- lib/junit-4.11.jar,\
- lib/log4j-1.2.17.jar,\
- lib/spring-security-config-3.1.3.RELEASE.jar,\
- lib/spring-security-core-3.1.3.RELEASE.jar,\
- lib/spring-security-remoting-3.1.3.RELEASE.jar,\
- lib/unitils-core-3.4.2.jar,\
- lib/commons-logging-1.1.1.jar,\
- lib/commons-lang-2.6.jar,\
- lib/aopalliance-1.0.jar,\
- lib/joda-time-2.1.jar,\
- lib/lsid-client-1.1.2.jar,\
- lib/lucene-core-3.6.2.jar,\
- lib/lsid-server-1.1.2.jar,\
- lib/slf4j-api-1.7.2.jar,\
- lib/javassist-3.17.1-GA.jar,\
- src/main/resources/etc/jetty/cdmlib-remote-webapp.war,\
- lib/unitils-spring-3.4.2.jar,\
- lib/unitils-database-3.4.2.jar,\
- lib/commons-dbcp-1.4.jar,\
- lib/commons-pool-1.5.4.jar,\
- lib/unitils-dbmaintainer-3.4.2.jar,\
- lib/h2-1.4.181.jar,\
- lib/unitils-dbunit-3.4.2.jar,\
- lib/hibernate-jpa-2.0-api-1.0.1.Final.jar,\
- lib/hibernate-commons-annotations-4.0.1.Final.jar,\
- lib/hibernate-core-4.1.10.Final.jar,\
- lib/hibernate-entitymanager-4.1.10.Final.jar,\
- lib/hibernate-envers-4.1.10.Final.jar,\
- lib/hibernate-search-engine-4.2.0.Final.jar,\
- lib/org.springframework.context-3.2.2.RELEASE.jar,\
- lib/org.springframework.aop-3.2.2.RELEASE.jar,\
- lib/org.springframework.aspects-3.2.2.RELEASE.jar,\
- lib/org.springframework.beans-3.2.2.RELEASE.jar,\
- lib/org.springframework.core-3.2.2.RELEASE.jar,\
- lib/org.springframework.expression-3.2.2.RELEASE.jar,\
- lib/org.springframework.jdbc-3.2.2.RELEASE.jar,\
- lib/org.springframework.orm-3.2.2.RELEASE.jar,\
- lib/org.springframework.transaction-3.2.2.RELEASE.jar,\
- lib/org.springframework.web-3.2.2.RELEASE.jar,\
- src/main/resources/etc/jetty/jetty-runner-9.1.5.v20140505.jar,\
- lib/cdmlib-persistence-3.3.8-SNAPSHOT.jar,\
- lib/dbunit-2.4.9.jar,\
- lib/opencsv-2.4.jar,\
- src/test/resources/h2/,\
- src/test/resources/log4j.properties
-bin.excludes = src/test/
+++ /dev/null
-<?xml version="1.0" encoding="UTF-8"?>
-<project>
-
- <parent>
- <groupId>eu.etaxonomy</groupId>
- <artifactId>taxeditor-parent</artifactId>
- <version>3.3.8-SNAPSHOT</version>
- </parent>
- <modelVersion>4.0.0</modelVersion>
- <artifactId>eu.etaxonomy.taxeditor.remoting</artifactId>
- <packaging>eclipse-plugin</packaging>
- <name>Remoting Bundle</name>
- <description>Remoting Plugin Taxonomic Editor</description>
-
- <build>
- <pluginManagement>
- <plugins>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-surefire-plugin</artifactId>
- <version>2.7</version>
- </plugin>
- </plugins>
- </pluginManagement>
- <plugins>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-dependency-plugin</artifactId>
- <version>2.4</version>
- <executions>
- <execution>
- <id>copy-dependencies</id>
- <phase>validate</phase>
- <goals>
- <goal>copy-dependencies</goal>
- </goals>
- <configuration>
- <excludeArtifactIds>
- cdmlib-remote-webapp
- </excludeArtifactIds>
- <includeArtifactIds>
- cdmlib-services,cdmlib-commons,cdmlib-persistence,cdmlib-ext,cdmlib-model
- </includeArtifactIds>
- <outputDirectory>${basedir}/lib</outputDirectory>
- <overWriteReleases>true</overWriteReleases>
- <overWriteSnapshots>true</overWriteSnapshots>
- <excludeTransitive>true</excludeTransitive>
- </configuration>
- </execution>
- <execution>
- <id>copy-dependency-war</id>
- <phase>validate</phase>
- <goals>
- <goal>copy-dependencies</goal>
- </goals>
- <configuration>
- <includeArtifactIds>
- cdmlib-remote-webapp
- </includeArtifactIds>
- <outputDirectory>
- ${basedir}/src/main/resources/etc/jetty
- </outputDirectory>
- <overWriteReleases>true</overWriteReleases>
- <overWriteSnapshots>true</overWriteSnapshots>
- <excludeTransitive>true</excludeTransitive>
- </configuration>
- </execution>
- </executions>
- </plugin>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-antrun-plugin</artifactId>
- <version>1.7</version>
- <executions>
- <execution>
- <id>update-snapshot-jar-names</id>
- <phase>validate</phase>
- <goals>
- <goal>run</goal>
- </goals>
- <configuration>
- <target>
- <echo>Anonymizing war</echo>
- <move todir="./src/main/resources/etc/jetty">
- <fileset dir="./src/main/resources/etc/jetty" />
- <mapper type="regexp"
- from="(^cdmlib\-.*)\-[0-9]\.[0-9]\.[0-9]\-SNAPSHOT(\.war)"
- to="\1\2" />
- </move>
- <move todir="./src/main/resources/etc/jetty">
- <fileset dir="./src/main/resources/etc/jetty" />
- <mapper type="regexp"
- from="(^cdmlib\-.*)\-[0-9]\.[0-9]\.[0-9]\-[0-9.-]+(\.war)"
- to="\1\2" />
- </move>
- <echo>Update cdmlib jars to SNAPSHOT when build with
- timestamp
- </echo>
- <move todir="./lib">
- <fileset dir="./lib" />
- <mapper type="regexp"
- from="(^cdmlib\-.*\-[0-9]\.[0-9]\.[0-9]\-)[0-9.-]+(\.jar)"
- to="\1SNAPSHOT\2" />
- </move>
- <move todir="./lib">
- <fileset dir="./lib" />
- <mapper type="regexp"
- from="(^cdmlib\-.*\-[0-9]\.[0-9]\.[0-9]\-)[0-9.-]+(\-sources\.jar)"
- to="\1SNAPSHOT\2" />
- </move>
- </target>
- </configuration>
- </execution>
- </executions>
- </plugin>
- </plugins>
- </build>
- <profiles>
- <profile>
- <id>cleanCdmlibJars</id>
- <build>
- <plugins>
- <plugin>
- <artifactId>maven-clean-plugin</artifactId>
- <version>2.3</version>
- <configuration>
- <filesets>
- <fileset>
- <directory>${basedir}/lib</directory>
- <includes>
- <include>cdmlib-*</include>
- </includes>
- <followSymlinks>false</followSymlinks>
- </fileset>
- </filesets>
- </configuration>
- </plugin>
- </plugins>
- </build>
- </profile>
- <profile>
- <id>cleanAllJars</id>
- <build>
- <plugins>
- <plugin>
- <artifactId>maven-clean-plugin</artifactId>
- <version>2.3</version>
- <configuration>
- <filesets>
- <fileset>
- <directory>${basedir}/lib</directory>
- <includes>
- <include>*</include>
- </includes>
- <followSymlinks>false</followSymlinks>
- </fileset>
- </filesets>
- </configuration>
- </plugin>
- </plugins>
- </build>
- </profile>
- <profile>
- <id>copyAllJars</id>
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-dependency-plugin</artifactId>
- <version>2.4</version>
- <executions>
- <execution>
- <id>copy-all-dependencies</id>
- <phase>validate</phase>
- <goals>
- <goal>copy-dependencies</goal>
- </goals>
- <configuration>
- <excludeArtifactIds>
- cdmlib-remote-webapp
- </excludeArtifactIds>
- <outputDirectory>${basedir}/lib</outputDirectory>
- <overWriteReleases>true</overWriteReleases>
- <overWriteSnapshots>true</overWriteSnapshots>
- <excludeTransitive>true</excludeTransitive>
- </configuration>
- </execution>
- </executions>
- </plugin>
- </plugins>
- </build>
- </profile>
- </profiles>
- <repositories>
- <repository>
- <id>SpringSource Enterprise Bundle Repository - External Bundle
- Milestones</id>
- <url>http://repository.springsource.com/maven/bundles/milestone
- </url>
- </repository>
- <repository>
- <id>SpringSource Enterprise Bundle Repository - SpringSource
- Bundle Releases</id>
- <url>http://repository.springsource.com/maven/bundles/release
- </url>
- </repository>
- <repository>
- <id>SpringSource Enterprise Bundle Repository - External Bundle
- Releases</id>
- <url>http://repository.springsource.com/maven/bundles/external
- </url>
- </repository>
- </repositories>
- <dependencies>
- <dependency>
- <groupId>eu.etaxonomy</groupId>
- <artifactId>cdmlib-remote-webapp</artifactId>
- <version>${cdmlib.version}</version>
- <type>war</type>
- </dependency>
- <dependency>
- <groupId>eu.etaxonomy</groupId>
- <artifactId>cdmlib-services</artifactId>
- <version>${cdmlib.version}</version>
- </dependency>
- <dependency>
- <groupId>eu.etaxonomy</groupId>
- <artifactId>cdmlib-commons</artifactId>
- <version>${cdmlib.version}</version>
- </dependency>
- <dependency>
- <groupId>eu.etaxonomy</groupId>
- <artifactId>cdmlib-persistence</artifactId>
- <version>${cdmlib.version}</version>
- </dependency>
- <dependency>
- <groupId>eu.etaxonomy</groupId>
- <artifactId>cdmlib-ext</artifactId>
- <version>${cdmlib.version}</version>
- </dependency>
- <dependency>
- <groupId>eu.etaxonomy</groupId>
- <artifactId>cdmlib-model</artifactId>
- <version>${cdmlib.version}</version>
- </dependency>
-
- <dependency>
- <groupId>org.unitils</groupId>
- <artifactId>unitils-core</artifactId>
- <version>3.4.2</version>
- </dependency>
- <!-- <dependency> -->
- <!-- <groupId>org.eclipse.jetty</groupId> -->
- <!-- <artifactId>jetty-server</artifactId> -->
- <!-- <version>9.1.3.v20140225</version> -->
- <!-- </dependency> -->
- <!-- <dependency> -->
- <!-- <groupId>org.eclipse.jetty</groupId> -->
- <!-- <artifactId>jetty-util</artifactId> -->
- <!-- <version>9.1.3.v20140225</version> -->
- <!-- </dependency> -->
- <!-- <dependency> -->
- <!-- <groupId>org.eclipse.jetty</groupId> -->
- <!-- <artifactId>jetty-xml</artifactId> -->
- <!-- <version>9.1.3.v20140225</version> -->
- <!-- </dependency> -->
- <!-- <dependency> -->
- <!-- <groupId>org.eclipse.jetty</groupId> -->
- <!-- <artifactId>jetty-servlet</artifactId> -->
- <!-- <version>9.1.3.v20140225</version> -->
- <!-- </dependency> -->
- <!-- <dependency> -->
- <!-- <groupId>org.eclipse.jetty</groupId> -->
- <!-- <artifactId>jetty-webapp</artifactId> -->
- <!-- <version>9.1.3.v20140225</version> -->
- <!-- </dependency> -->
- <!-- <dependency> -->
- <!-- <groupId>org.eclipse.jetty</groupId> -->
- <!-- <artifactId>jetty-security</artifactId> -->
- <!-- <version>9.1.3.v20140225</version> -->
- <!-- </dependency> -->
- <!-- <dependency> -->
- <!-- <groupId>org.eclipse.jetty</groupId> -->
- <!-- <artifactId>jetty-http</artifactId> -->
- <!-- <version>${jetty.version}</version> -->
- <!-- </dependency> -->
- <!-- <dependency> -->
- <!-- <groupId>org.eclipse.jetty</groupId> -->
- <!-- <artifactId>jetty-io</artifactId> -->
- <!-- <version>${jetty.version}</version> -->
- <!-- </dependency> -->
- <!-- <dependency> -->
- <!-- <groupId>javax.servlet</groupId> -->
- <!-- <artifactId>javax.servlet-api</artifactId> -->
- <!-- <version>3.1.0</version> -->
- <!-- </dependency> -->
-
- <!-- <dependency> -->
- <!-- <groupId>javax.servlet</groupId> -->
- <!-- <artifactId>jsp-api</artifactId> -->
- <!-- <version>2.0</version> -->
- <!-- </dependency> -->
-
- <dependency>
- <groupId>net.sf.ehcache</groupId>
- <artifactId>ehcache-core</artifactId>
- <version>2.4.3</version>
- </dependency>
- <dependency>
- <groupId>org.hibernate</groupId>
- <artifactId>hibernate-core</artifactId>
- <version>4.1.10.Final</version>
- </dependency>
- <dependency>
- <groupId>org.hibernate.common</groupId>
- <artifactId>hibernate-commons-annotations</artifactId>
- <version>4.0.1.Final</version>
- </dependency>
- <dependency>
- <groupId>org.hibernate</groupId>
- <artifactId>hibernate-search-engine</artifactId>
- <version>4.2.0.Final</version>
- </dependency>
- <dependency>
- <groupId>org.hibernate.javax.persistence</groupId>
- <artifactId>hibernate-jpa-2.0-api</artifactId>
- <version>1.0.1.Final</version>
- </dependency>
- <dependency>
- <groupId>org.hibernate</groupId>
- <artifactId>hibernate-envers</artifactId>
- <version>4.1.10.Final</version>
- </dependency>
- <dependency>
- <groupId>org.hibernate</groupId>
- <artifactId>hibernate-entitymanager</artifactId>
- <version>4.1.10.Final</version>
- </dependency>
- <dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <version>4.11</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>log4j</groupId>
- <artifactId>log4j</artifactId>
- <version>1.2.17</version>
- </dependency>
- <dependency>
- <groupId>org.jdom</groupId>
- <artifactId>jdom</artifactId>
- <version>1.1.3</version>
- </dependency>
- <dependency>
- <groupId>org.springframework</groupId>
- <artifactId>org.springframework.context</artifactId>
- <version>3.2.2.RELEASE</version>
- </dependency>
- <dependency>
- <groupId>org.springframework</groupId>
- <artifactId>org.springframework.aspects</artifactId>
- <version>3.2.2.RELEASE</version>
- </dependency>
- <dependency>
- <groupId>org.springframework</groupId>
- <artifactId>org.springframework.beans</artifactId>
- <version>3.2.2.RELEASE</version>
- </dependency>
- <dependency>
- <groupId>org.springframework</groupId>
- <artifactId>org.springframework.transaction</artifactId>
- <version>3.2.2.RELEASE</version>
- </dependency>
- <dependency>
- <groupId>org.springframework</groupId>
- <artifactId>org.springframework.web</artifactId>
- <version>3.2.2.RELEASE</version>
- </dependency>
- <dependency>
- <groupId>org.springframework</groupId>
- <artifactId>org.springframework.core</artifactId>
- <version>3.2.2.RELEASE</version>
- </dependency>
- <dependency>
- <groupId>org.springframework</groupId>
- <artifactId>org.springframework.aop</artifactId>
- <version>3.2.2.RELEASE</version>
- </dependency>
- <dependency>
- <groupId>org.springframework</groupId>
- <artifactId>org.springframework.expression</artifactId>
- <version>3.2.2.RELEASE</version>
- </dependency>
- <dependency>
- <groupId>org.springframework</groupId>
- <artifactId>org.springframework.orm</artifactId>
- <version>3.2.2.RELEASE</version>
- </dependency>
- <dependency>
- <groupId>org.springframework</groupId>
- <artifactId>org.springframework.jdbc</artifactId>
- <version>3.2.2.RELEASE</version>
- </dependency>
- <dependency>
- <groupId>org.springframework.security</groupId>
- <artifactId>spring-security-core</artifactId>
- <version>3.1.3.RELEASE</version>
- </dependency>
- <dependency>
- <groupId>org.springframework.security</groupId>
- <artifactId>spring-security-config</artifactId>
- <version>3.1.3.RELEASE</version>
- </dependency>
- <dependency>
- <groupId>org.springframework.security</groupId>
- <artifactId>spring-security-remoting</artifactId>
- <version>3.1.3.RELEASE</version>
- </dependency>
- <dependency>
- <groupId>org.jboss.logging</groupId>
- <artifactId>jboss-logging</artifactId>
- <version>3.1.3.GA</version>
- </dependency>
- <dependency>
- <groupId>org.hamcrest</groupId>
- <artifactId>hamcrest-core</artifactId>
- <version>1.3</version>
- </dependency>
- <dependency>
- <groupId>com.mchange</groupId>
- <artifactId>c3p0</artifactId>
- <version>0.9.2</version>
- </dependency>
- <dependency>
- <groupId>org.jboss.spec.javax.transaction</groupId>
- <artifactId>jboss-transaction-api_1.1_spec</artifactId>
- <version>1.0.0.Final</version>
- </dependency>
- <dependency>
- <groupId>org.aspectj</groupId>
- <artifactId>aspectjrt</artifactId>
- <version>1.7.1</version>
- </dependency>
- <dependency>
- <groupId>commons-logging</groupId>
- <artifactId>commons-logging</artifactId>
- <version>1.1.1</version>
- </dependency>
- <dependency>
- <groupId>commons-lang</groupId>
- <artifactId>commons-lang</artifactId>
- <version>2.6</version>
- </dependency>
- <dependency>
- <groupId>aopalliance</groupId>
- <artifactId>aopalliance</artifactId>
- <version>1.0</version>
- </dependency>
- <dependency>
- <groupId>joda-time</groupId>
- <artifactId>joda-time</artifactId>
- <version>2.1</version>
- </dependency>
- <dependency>
- <groupId>com.ibm.lsid</groupId>
- <artifactId>lsid-client</artifactId>
- <version>1.1.2</version>
- </dependency>
- <dependency>
- <groupId>com.ibm.lsid</groupId>
- <artifactId>lsid-server</artifactId>
- <version>1.1.2</version>
- </dependency>
- <dependency>
- <groupId>org.apache.lucene</groupId>
- <artifactId>lucene-core</artifactId>
- <version>3.6.2</version>
- </dependency>
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-api</artifactId>
- <version>1.7.2</version>
- </dependency>
- <dependency>
- <groupId>org.javassist</groupId>
- <artifactId>javassist</artifactId>
- <version>3.17.1-GA</version>
- </dependency>
- <dependency>
- <groupId>au.com.bytecode</groupId>
- <artifactId>opencsv</artifactId>
- <version>2.4</version>
- </dependency>
-
-
- <!-- For Unit Tests -->
- <dependency>
- <groupId>org.unitils</groupId>
- <artifactId>unitils-spring</artifactId>
- <version>3.4.2</version>
- </dependency>
- <dependency>
- <groupId>org.unitils</groupId>
- <artifactId>unitils-database</artifactId>
- <version>3.4.2</version>
- </dependency>
- <dependency>
- <groupId>commons-dbcp</groupId>
- <artifactId>commons-dbcp</artifactId>
- <version>1.4</version>
- </dependency>
- <dependency>
- <groupId>commons-pool</groupId>
- <artifactId>commons-pool</artifactId>
- <version>1.5.4</version>
- </dependency>
- <dependency>
- <groupId>org.unitils</groupId>
- <artifactId>unitils-dbmaintainer</artifactId>
- <version>3.4.2</version>
- </dependency>
- <dependency>
- <groupId>com.h2database</groupId>
- <artifactId>h2</artifactId>
- <version>1.4.181</version>
- </dependency>
- <dependency>
- <groupId>org.unitils</groupId>
- <artifactId>unitils-dbunit</artifactId>
- <version>3.4.2</version>
- </dependency>
- <dependency>
- <groupId>org.dbunit</groupId>
- <artifactId>dbunit</artifactId>
- <version>2.4.9</version>
- </dependency>
- </dependencies>
-</project>
\ No newline at end of file
+++ /dev/null
-/**\r
-* Copyright (C) 2014 EDIT\r
-* European Distributed Institute of Taxonomy\r
-* http://www.e-taxonomy.eu\r
-*\r
-* The contents of this file are subject to the Mozilla Public License Version 1.1\r
-* See LICENSE.TXT at the top of this package for the full license terms.\r
-*/\r
-\r
-package eu.etaxonomy.cdm.api.application;\r
-\r
-import javax.sql.DataSource;\r
-\r
-import org.apache.log4j.Logger;\r
-import org.hibernate.SessionFactory;\r
-import org.springframework.beans.factory.annotation.Autowired;\r
-import org.springframework.stereotype.Component;\r
-import org.springframework.transaction.PlatformTransactionManager;\r
-import org.springframework.transaction.TransactionStatus;\r
-\r
-import eu.etaxonomy.cdm.api.cache.ICachedCommonService;\r
-import eu.etaxonomy.cdm.api.conversation.ConversationHolder;\r
-import eu.etaxonomy.cdm.api.conversation.ConversationHolderMock;\r
-import eu.etaxonomy.cdm.api.service.ICommonService;\r
-import eu.etaxonomy.cdm.ext.geo.IEditGeoService;\r
-\r
-\r
-/**\r
- * CDM Application Configuration class which manages the configuration for remoting\r
- * clients\r
- *\r
- */\r
-@Component\r
-public class CdmApplicationRemoteConfiguration extends CdmApplicationDefaultConfiguration {\r
-\r
- @SuppressWarnings("unused")\r
- private static final Logger logger = Logger.getLogger(CdmApplicationRemoteConfiguration.class);\r
-\r
- @Autowired\r
- IEditGeoService editGeoService;\r
-\r
- @Autowired\r
- private ICachedCommonService cachedCommonService;\r
-\r
- public CdmApplicationRemoteConfiguration() {\r
- }\r
-\r
- /* (non-Javadoc)\r
- * @see eu.etaxonomy.cdm.api.application.CdmApplicationDefaultConfiguration#getTransactionManager()\r
- */\r
- @Override\r
- public PlatformTransactionManager getTransactionManager() throws UnsupportedOperationException {\r
- throw new UnsupportedOperationException("getTransactionManager is not implemented for CdmApplicationRemoteConfiguration");\r
- }\r
-\r
-\r
- /* (non-Javadoc)\r
- * @see eu.etaxonomy.cdm.api.application.ICdmApplicationConfiguration#startTransaction()\r
- */\r
- @Override\r
- public TransactionStatus startTransaction() throws UnsupportedOperationException {\r
- throw new UnsupportedOperationException("startTransaction is not implemented for CdmApplicationRemoteConfiguration");\r
- }\r
-\r
-\r
- /* (non-Javadoc)\r
- * @see eu.etaxonomy.cdm.api.application.ICdmApplicationConfiguration#startTransaction()\r
- */\r
- @Override\r
- public TransactionStatus startTransaction(Boolean readOnly) throws UnsupportedOperationException {\r
- throw new UnsupportedOperationException("startTransaction is not implemented for CdmApplicationRemoteConfiguration");\r
- }\r
-\r
-\r
- /* (non-Javadoc)\r
- * @see eu.etaxonomy.cdm.api.application.CdmApplicationDefaultConfiguration#commitTransaction(org.springframework.transaction.TransactionStatus)\r
- */\r
- @Override\r
- public void commitTransaction(TransactionStatus txStatus) throws UnsupportedOperationException {\r
- throw new UnsupportedOperationException("commitTransaction is not implemented for CdmApplicationRemoteConfiguration");\r
- }\r
-\r
- /* (non-Javadoc)\r
- * @see eu.etaxonomy.cdm.api.application.CdmApplicationDefaultConfiguration#NewConversation()\r
- */\r
- @Override\r
- public ConversationHolder NewConversation() {\r
- return new ConversationHolderMock();\r
- }\r
-\r
- /**\r
- * @return\r
- */\r
- public IEditGeoService getEditGeoService() {\r
- return this.editGeoService;\r
- }\r
-\r
- /**\r
- * @return\r
- */\r
- public ICachedCommonService getCachedCommonService(){\r
- return this.cachedCommonService;\r
- }\r
-\r
- /* (non-Javadoc)\r
- * @see eu.etaxonomy.cdm.api.application.CdmApplicationDefaultConfiguration#setDataSource(javax.sql.DataSource)\r
- */\r
- @Override\r
- public void setDataSource(DataSource dataSource) {\r
- }\r
-\r
- /* (non-Javadoc)\r
- * @see eu.etaxonomy.cdm.api.application.CdmApplicationDefaultConfiguration#setTransactionManager(org.springframework.transaction.PlatformTransactionManager)\r
- */\r
- @Override\r
- public void setTransactionManager(PlatformTransactionManager transactionManager) {\r
- }\r
-\r
- /* (non-Javadoc)\r
- * @see eu.etaxonomy.cdm.api.application.CdmApplicationDefaultConfiguration#setSessionFactory(org.hibernate.SessionFactory)\r
- */\r
- @Override\r
- public void setSessionFactory(SessionFactory sessionFactory) {\r
- }\r
-}\r
+++ /dev/null
-/**
-* Copyright (C) 2014 EDIT
-* European Distributed Institute of Taxonomy
-* http://www.e-taxonomy.eu
-*
-* The contents of this file are subject to the Mozilla Public License Version 1.1
-* See LICENSE.TXT at the top of this package for the full license terms.
-*/
-
-
-package eu.etaxonomy.cdm.api.application;
-
-import java.util.List;
-import java.util.Properties;
-
-import org.apache.log4j.Logger;
-import org.hibernate.collection.internal.AbstractPersistentCollection;
-import org.hibernate.proxy.AbstractLazyInitializer;
-import org.springframework.beans.MutablePropertyValues;
-import org.springframework.beans.factory.config.BeanDefinition;
-import org.springframework.beans.factory.xml.XmlBeanDefinitionReader;
-import org.springframework.context.ApplicationListener;
-import org.springframework.context.support.PropertySourcesPlaceholderConfigurer;
-import org.springframework.core.io.ClassPathResource;
-import org.springframework.core.io.Resource;
-
-import eu.etaxonomy.cdm.common.monitor.IProgressMonitor;
-import eu.etaxonomy.cdm.common.monitor.NullProgressMonitor;
-import eu.etaxonomy.cdm.common.monitor.SubProgressMonitor;
-import eu.etaxonomy.cdm.remote.ICdmRemoteSource;
-
-/**
- * CDM Application Controller class for remoting clients
- *
- * FIXME:Remoting extending {@link CdmApplicationController} is a temporary workaround.
- * The {@link CdmApplicationController} should be split into a CdmApplicationControllerBase
- * class with {@link CdmApplicationController} and this class as subclasses
- *
- */
-public class CdmApplicationRemoteController extends CdmApplicationController {
-
- private static final Logger logger = Logger.getLogger(CdmApplicationRemoteController.class);
-
- public static final Resource DEFAULT_REMOTE_APPLICATION_CONTEXT_RESOURCE =
- new ClassPathResource("/eu/etaxonomy/cdm/remotingApplicationContext.xml");
- private final Resource applicationContextResource;
- private final IProgressMonitor progressMonitor;
-
- /**
- * Creates new instance of CdmApplicationRemoteController
- *
- * @param applicationContextResource
- * @param remoteSource
- * @param omitTermLoading
- * @param progressMonitor
- * @param listeners
- * @return
- */
- public static CdmApplicationRemoteController NewInstance(Resource applicationContextResource,
- ICdmRemoteSource remoteSource,
- boolean omitTermLoading,
- IProgressMonitor progressMonitor,
- List<ApplicationListener> listeners) {
- return new CdmApplicationRemoteController(applicationContextResource,
- remoteSource,
- omitTermLoading,
- progressMonitor,
- listeners);
-
- }
- /**
- * Creates new instance of CdmApplicationRemoteController
- *
- * @param applicationContextResource
- * @param remoteSource
- * @param omitTermLoading
- * @param progressMonitor
- * @param listeners
- * @return
- */
- public static CdmApplicationRemoteController NewInstance(ICdmRemoteSource remoteSource,
- boolean omitTermLoading,
- IProgressMonitor progressMonitor,
- List<ApplicationListener> listeners) {
-
- return new CdmApplicationRemoteController(DEFAULT_REMOTE_APPLICATION_CONTEXT_RESOURCE,
- remoteSource,
- omitTermLoading,
- progressMonitor,
- listeners);
-
- }
-
- /**
- * Constructs CdmApplicationRemoteController
- *
- * @param applicationContextResource
- * @param remoteSource
- * @param omitTermLoading
- * @param progressMonitor
- * @param listeners
- */
- private CdmApplicationRemoteController(Resource applicationContextResource,
- ICdmRemoteSource remoteSource,
- boolean omitTermLoading,
- IProgressMonitor progressMonitor,
- List<ApplicationListener> listeners){
- logger.info("Start CdmApplicationRemoteController with remote source: " + remoteSource.getName());
- this.applicationContextResource =
- applicationContextResource != null ? applicationContextResource : DEFAULT_REMOTE_APPLICATION_CONTEXT_RESOURCE;
- this.progressMonitor = progressMonitor != null ? progressMonitor : new NullProgressMonitor();
-
- setNewRemoteSource(remoteSource, omitTermLoading, listeners);
-
- }
-
-
-
-
- /**
- * Creates and starts a new spring application context
- *
- * @param remoteSource object for connecting to an http-invoker server
- * @param omitTermLoading
- * @param listeners
- * @return
- */
- protected boolean setNewRemoteSource(ICdmRemoteSource remoteSource,
- boolean omitTermLoading,
- List<ApplicationListener> listeners){
-
- logger.info("Connecting to '" + remoteSource.getName() + "'");
-
- MonitoredGenericApplicationContext applicationContext = new MonitoredGenericApplicationContext();
- int refreshTasks = 45;
- int nTasks = 5 + refreshTasks;
-
- progressMonitor.beginTask("Connecting to '" + remoteSource.getName() + "'", nTasks);
-
- progressMonitor.subTask("Registering remote source.");
- PropertySourcesPlaceholderConfigurer pspc = new PropertySourcesPlaceholderConfigurer();
- Properties properties = new Properties();
- properties.setProperty("remoteServer", remoteSource.getServer());
- properties.setProperty("remotePort", String.valueOf(remoteSource.getPort()));
- properties.setProperty("remoteContext", remoteSource.getContextPath());
- pspc.setProperties(properties);
- applicationContext.addBeanFactoryPostProcessor(pspc);
- applicationContext.getEnvironment().setActiveProfiles("remoting");
- progressMonitor.worked(1);
-
- XmlBeanDefinitionReader xmlReader = new XmlBeanDefinitionReader(applicationContext);
- //xmlReader.setValidationMode(XmlBeanDefinitionReader.VALIDATION_NONE);
- progressMonitor.subTask("Registering resources.");
- xmlReader.loadBeanDefinitions(applicationContextResource);
- progressMonitor.worked(1);
-
- //omitTerms
- if (omitTermLoading == true){
- String initializerName = "persistentTermInitializer";
- BeanDefinition beanDef = applicationContext.getBeanDefinition(initializerName);
- MutablePropertyValues values = beanDef.getPropertyValues();
- values.addPropertyValue("omit", omitTermLoading);
- }
-
- if (listeners != null){
- for(ApplicationListener listener : listeners){
- applicationContext.addApplicationListener(listener);
- }
- }
-
-
- applicationContext.refresh(new SubProgressMonitor(progressMonitor, refreshTasks));
- applicationContext.start();
-
- progressMonitor.subTask("Cleaning up.");
- setApplicationContext(applicationContext);
- progressMonitor.worked(1);
-
- progressMonitor.done();
- return true;
- }
-
- /* (non-Javadoc)
- * @see eu.etaxonomy.cdm.api.application.CdmApplicationController#init()
- */
- @Override
- protected void init(){
- configuration = (ICdmApplicationConfiguration)applicationContext.getBean("cdmApplicationRemoteConfiguration");
- AbstractLazyInitializer.setConfiguration((CdmApplicationRemoteConfiguration)configuration);
- AbstractPersistentCollection.setConfiguration((CdmApplicationRemoteConfiguration)configuration);
-
- }
-
-}
+++ /dev/null
-// $Id$
-/**
-* Copyright (C) 2014 EDIT
-* European Distributed Institute of Taxonomy
-* http://www.e-taxonomy.eu
-*
-* The contents of this file are subject to the Mozilla Public License Version 1.1
-* See LICENSE.TXT at the top of this package for the full license terms.
-*/
-package eu.etaxonomy.cdm.api.cache;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import java.util.TreeMap;
-import java.util.TreeSet;
-
-import org.hibernate.collection.internal.PersistentList;
-import org.hibernate.collection.internal.PersistentMap;
-import org.hibernate.collection.internal.PersistentSet;
-import org.hibernate.collection.internal.PersistentSortedMap;
-import org.hibernate.collection.internal.PersistentSortedSet;
-import org.hibernate.collection.spi.PersistentCollection;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Component;
-
-import eu.etaxonomy.cdm.api.cache.LazyLoadingCachingUtils.CollectionType;
-import eu.etaxonomy.cdm.api.service.ICommonService;
-import eu.etaxonomy.cdm.model.common.CdmBase;
-import eu.etaxonomy.cdm.model.common.PersistentMultiLanguageText;
-
-/**
- * @author cmathew
- * @date 14 Oct 2014
- *
- */
-@Component
-public class CachedCommonServiceImpl implements ICachedCommonService {
-
-
- @Autowired
- private ICommonService commonService;
-
- private static boolean cacheEnabled = true;
-
- @Autowired
- private CdmEntityCacheManager cdmEntityCacheManager;
-
- @Autowired
- private LazyLoadingCachingUtils lazyLoadingCachingUtils;
-
-
- public static boolean isCacheEnabled() {
- return cacheEnabled;
- }
-
- public static void setCacheEnabled(boolean cacheEnabled) {
- CachedCommonServiceImpl.cacheEnabled = cacheEnabled;
- }
-
- /* (non-Javadoc)
- * @see eu.etaxonomy.taxeditor.remoting.service.ICachedCommonService#find(java.lang.Class, int)
- */
- @Override
- public CdmBase find(Class<? extends CdmBase> clazz, int id){
- if(cacheEnabled) {
- CdmBase cdmEntity = cdmEntityCacheManager.getCdmTransientEntityCacher().getFromCache(clazz, id);
- if(cdmEntity != null) {
- return cdmEntity;
- } else {
- cdmEntity = commonService.find(clazz, id);
- cdmEntity = cdmEntityCacheManager.getCdmTransientEntityCacher().put(clazz, id, cdmEntity);
- return cdmEntity;
- }
- } else {
- return commonService.find(clazz, id);
- }
- }
-
-
- /* (non-Javadoc)
- * @see eu.etaxonomy.taxeditor.remoting.service.ICachedCommonService#initializeCollection(org.hibernate.collection.spi.PersistentCollection)
- */
- @Override
- public PersistentCollection initializeCollection(PersistentCollection col) {
- PersistentCollection pc = commonService.initializeCollection(col);
-
- return pc;
- }
-
- @Override
- public void updatePersistentCollection(CollectionField colf) {
- switch(colf.getType()) {
- case MAP:
- lazyLoadingCachingUtils.updatePersistentCollection((Map)colf.getCollection());
- case SET:
- case LIST:
- default:
- }
- }
-
- /* (non-Javadoc)
- * @see eu.etaxonomy.taxeditor.remoting.service.ICachedCommonService#isEmpty(org.hibernate.collection.spi.PersistentCollection)
- */
- @Override
- public boolean isEmpty(PersistentCollection col) {
- return commonService.isEmpty(col);
-
- }
-
-
- /* (non-Javadoc)
- * @see eu.etaxonomy.taxeditor.remoting.service.ICachedCommonService#size(org.hibernate.collection.spi.PersistentCollection)
- */
- @Override
- public int size(PersistentCollection col) {
- return commonService.size(col);
- }
-
-
- /* (non-Javadoc)
- * @see eu.etaxonomy.taxeditor.remoting.service.ICachedCommonService#get(org.hibernate.collection.spi.PersistentCollection, int)
- */
- @Override
- public Object get(PersistentCollection col, int index) {
- return commonService.get(col, index);
- }
-
-
- /* (non-Javadoc)
- * @see eu.etaxonomy.taxeditor.remoting.service.ICachedCommonService#contains(org.hibernate.collection.spi.PersistentCollection, java.lang.Object)
- */
- @Override
- public boolean contains(PersistentCollection col, Object element) {
- return commonService.contains(col, element);
- }
-
-
- /* (non-Javadoc)
- * @see eu.etaxonomy.taxeditor.remoting.service.ICachedCommonService#containsKey(org.hibernate.collection.spi.PersistentCollection, java.lang.Object)
- */
- @Override
- public boolean containsKey(PersistentCollection col, Object key) {
- return commonService.containsKey(col, key);
- }
-
-
- /* (non-Javadoc)
- * @see eu.etaxonomy.taxeditor.remoting.service.ICachedCommonService#containsValue(org.hibernate.collection.spi.PersistentCollection, java.lang.Object)
- */
- @Override
- public boolean containsValue(PersistentCollection col, Object element) {
- return commonService.containsValue(col, element);
- }
-
- @Override
- public CollectionField getCollectionField(PersistentCollection pc) {
- if(pc != null) {
- if(pc instanceof PersistentSet) {
- return new CollectionField(new HashSet((Set)pc), CollectionType.SET);
- }
- if(pc instanceof PersistentSortedSet) {
- return new CollectionField(new TreeSet((Set)pc), CollectionType.SET);
- }
- if(pc instanceof PersistentList) {
- return new CollectionField(new ArrayList((List)pc), CollectionType.LIST);
- }
- if(pc instanceof PersistentMap || pc instanceof PersistentMultiLanguageText) {
- return new CollectionField(new HashMap((Map)pc), CollectionType.MAP);
- }
- if(pc instanceof PersistentSortedMap) {
- return new CollectionField(new TreeMap((Map)pc), CollectionType.MAP);
- }
- }
- return null;
- }
-
- public class CollectionField {
- private final Object col;
- private final CollectionType type;
- public CollectionField(Object col, CollectionType type) {
- this.col = col;
- this.type = type;
- }
-
- public Object getCollection() {
- return this.col;
- }
-
- public CollectionType getType() {
- return this.type;
- }
- }
-
-}
+++ /dev/null
-// $Id$
-/**
-* Copyright (C) 2014 EDIT
-* European Distributed Institute of Taxonomy
-* http://www.e-taxonomy.eu
-*
-* The contents of this file are subject to the Mozilla Public License Version 1.1
-* See LICENSE.TXT at the top of this package for the full license terms.
-*/
-package eu.etaxonomy.cdm.api.cache;
-
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Component;
-
-/**
- * @author cmathew
- * @date 16 Oct 2014
- *
- */
-@Component
-public class CdmEntityCacheManager {
-
- @Autowired
- private CdmTransientEntityCacher cdmTransientEntityCacher;
-
-
- public CdmTransientEntityCacher getCdmTransientEntityCacher() {
- return cdmTransientEntityCacher;
- }
-}
+++ /dev/null
-package eu.etaxonomy.cdm.api.cache;
-
-import java.util.UUID;
-
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Component;
-
-import eu.etaxonomy.cdm.api.cache.CdmCacher;
-import eu.etaxonomy.cdm.api.service.ITermService;
-import eu.etaxonomy.cdm.model.common.CdmBase;
-
-/**
- * Class which uses CDM services to cache cdm entities
- *
- * FIXME: Currently only handles terms entities. It would be
- * interesting to have a generic method which finds the
- * correct service to load / cache the entity.
- *
- * @author cmathew
- *
- * @param <T>
- */
-
-public class CdmServiceCacher<T extends CdmBase> extends CdmCacher<T> {
-
- @Autowired
- ITermService termService;
-
- @Override
- protected T findByUuid(UUID uuid) {
- T term = (T)termService.findWithoutFlush(uuid);
- return term;
- }
-
-}
+++ /dev/null
-// $Id$
-/**
-* Copyright (C) 2014 EDIT
-* European Distributed Institute of Taxonomy
-* http://www.e-taxonomy.eu
-*
-* The contents of this file are subject to the Mozilla Public License Version 1.1
-* See LICENSE.TXT at the top of this package for the full license terms.
-*/
-package eu.etaxonomy.cdm.api.cache;
-
-import java.util.UUID;
-
-import org.springframework.stereotype.Component;
-
-import net.sf.ehcache.Cache;
-import net.sf.ehcache.Element;
-import net.sf.ehcache.config.CacheConfiguration;
-import net.sf.ehcache.store.MemoryStoreEvictionPolicy;
-import eu.etaxonomy.cdm.model.common.CdmBase;
-
-/**
- * @author cmathew
- * @date 14 Oct 2014
- *
- */
-@Component
-public class CdmTransientEntityCacher<T extends CdmBase> extends CdmServiceCacher<T> {
-
- private static final String ENTITY_CACHE_NAME = "entityCache";
-
- public CdmTransientEntityCacher() {
- // Create entity cache
- getDefaultCacheManager().addCache(new Cache(getEntityCacheConfiguration()));
- }
- /**
- * Returns the default cache configuration.
- *
- * @return
- */
- private CacheConfiguration getEntityCacheConfiguration() {
- // For a better understanding on how to size caches, refer to
- // http://ehcache.org/documentation/configuration/cache-size
- return new CacheConfiguration(ENTITY_CACHE_NAME, 500)
- .memoryStoreEvictionPolicy(MemoryStoreEvictionPolicy.LFU)
- .eternal(false)
- // default ttl and tti set to 2 hours
- .timeToLiveSeconds(60*60*2)
- .timeToIdleSeconds(60*60*2);
- // This is 2.6.9 API
- //.maxEntriesLocalDisk(1000);
- //.persistence(new PersistenceConfiguration().strategy(Strategy.LOCALTEMPSWAP));
- }
-
- /**
- * Returns the cache corresponding to the cache id
- *
- * @param cacheId
- * @return
- */
- private static Cache getCache() {
- return getDefaultCacheManager().getCache(ENTITY_CACHE_NAME);
- }
-
-
- /**
- * Puts the (Key,Value) pair of ({@link java.util.UUID}, {@link eu.etaxonomy.cdm.model.common.CdmBase}),
- * in the cache corresponding to the given cache id
- *
- * @param cacheId
- * @param uuid
- * @param cdmEntity
- */
- public T put(String id, T cdmEntity) {
- T cachedCdmEntity = getFromCache(cdmEntity.getUuid());
- cachedCdmEntity = (cachedCdmEntity == null) ? getFromCache(id) : cachedCdmEntity;
- if(cachedCdmEntity != null) {
- return cachedCdmEntity;
- } else {
- getCache().put(new Element(id, cdmEntity));
- return cdmEntity;
- }
- }
-
- @Override
- public T put(UUID uuid, T cdmEntity) {
- T cachedCdmEntity = getFromCache(cdmEntity.getUuid());
- cachedCdmEntity = (cachedCdmEntity == null) ? getFromCache(uuid) : cachedCdmEntity;
- if(cachedCdmEntity != null) {
- return cachedCdmEntity;
- } else {
- getCache().put(new Element(uuid, cdmEntity));
- return cdmEntity;
- }
- }
-
- public T put(Class<? extends CdmBase> clazz, int id, T cdmEntity) {
- String cacheId = generateId(clazz,id);
- return put(cacheId, cdmEntity);
- }
-
- /**
- * Gets the cache element corresponding to the given {@link java.util.UUID}
- * in the cache corresponding to the given cache id.
- *
- * @param uuid
- * @return
- */
- @Override
- protected Element getCacheElement(UUID uuid) {
- return getCache().get(uuid);
- }
-
- private Element getCacheElement(String id) {
- return getCache().get(id);
- }
-
-
- /* (non-Javadoc)
- * @see eu.etaxonomy.cdm.model.ICdmCacher#getFromCache(java.util.UUID)
- */
- @Override
- public T getFromCache(UUID uuid) {
- Element e = getCacheElement(uuid);
- e = (getCacheElement(uuid) == null) ? super.getCacheElement(uuid) : e;
- if (e == null) {
- return null;
- } else {
- return(T)e.getObjectValue();
- }
- }
-
- public T getFromCache(String id) {
- Element e = getCacheElement(id);
- if (e == null) {
- return null;
- } else {
- return (T) e.getObjectValue();
- }
- }
-
-
- public T getFromCache(Class<? extends CdmBase> clazz, int id) {
- String cacheId = generateId(clazz,id);
- return getFromCache(cacheId);
- }
-
-
- /* (non-Javadoc)
- * @see eu.etaxonomy.cdm.model.ICdmCacher#exists(java.util.UUID)
- */
- @Override
- public boolean exists(UUID uuid) {
- return (getCacheElement(uuid) != null || super.getCacheElement(uuid) != null);
- }
-
- public boolean exists(String id) {
- return (getCacheElement(id) != null);
- }
-
-
- /* (non-Javadoc)
- * @see eu.etaxonomy.cdm.model.ICdmCacher#existsAndIsNotNull(java.util.UUID)
- */
- @Override
- public boolean existsAndIsNotNull(UUID uuid) {
- return getFromCache(uuid) != null;
- }
-
- public boolean existsAndIsNotNull(String id) {
- return getFromCache(id) != null;
- }
-
-
- private static String generateId(Class<? extends CdmBase> clazz, int id) {
- return clazz.getName() + String.valueOf(id);
- }
-
-}
+++ /dev/null
-// $Id$
-/**
- * Copyright (C) 2014 EDIT
- * European Distributed Institute of Taxonomy
- * http://www.e-taxonomy.eu
- *
- * The contents of this file are subject to the Mozilla Public License Version 1.1
- * See LICENSE.TXT at the top of this package for the full license terms.
- */
-package eu.etaxonomy.cdm.api.cache;
-
-import org.hibernate.collection.internal.PersistentMap;
-import org.hibernate.collection.spi.PersistentCollection;
-
-import eu.etaxonomy.cdm.api.cache.CachedCommonServiceImpl.CollectionField;
-import eu.etaxonomy.cdm.model.common.CdmBase;
-
-/**
- * @author cmathew
- * @date 14 Oct 2014
- *
- */
-public interface ICachedCommonService {
-
- public CdmBase find(Class<? extends CdmBase> clazz, int id);
-
- public PersistentCollection initializeCollection(PersistentCollection col);
-
- public void updatePersistentCollection(CollectionField colf);
-
- public boolean isEmpty(PersistentCollection col);
-
- public int size(PersistentCollection col);
-
- public Object get(PersistentCollection col, int index);
-
- public boolean contains(PersistentCollection col, Object element);
-
- public boolean containsKey(PersistentCollection col, Object key);
-
- public boolean containsValue(PersistentCollection col, Object element);
-
- public CollectionField getCollectionField(PersistentCollection pc);
-
-}
\ No newline at end of file
+++ /dev/null
-// $Id$
-/**
-* Copyright (C) 2014 EDIT
-* European Distributed Institute of Taxonomy
-* http://www.e-taxonomy.eu
-*
-* The contents of this file are subject to the Mozilla Public License Version 1.1
-* See LICENSE.TXT at the top of this package for the full license terms.
-*/
-package eu.etaxonomy.cdm.api.cache;
-
-import java.util.Iterator;
-import java.util.Map;
-
-import org.hibernate.collection.internal.PersistentMap;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Component;
-
-import eu.etaxonomy.cdm.model.common.CdmBase;
-
-/**
- * @author cmathew
- * @date 15 Oct 2014
- *
- */
-@Component
-public class LazyLoadingCachingUtils {
-
- @Autowired
- private CdmEntityCacheManager cdmEntityCacheManager;
-
- public static enum CollectionType {
- SET,
- LIST,
- MAP;
-
- @Override
- public String toString() {
- return this.name().toLowerCase();
- }
- }
-
- public void updatePersistentCollection(Map map) {
- if(map == null || map.isEmpty()) {
- return;
- }
-
- int originalMapSize = map.size();
- Object[] result = new Object[ map.size() * 2 ];
- Iterator iter = map.entrySet().iterator();
- int i=0;
- while ( iter.hasNext() ) {
- Map.Entry e = (Map.Entry) iter.next();
- result[i++] = e.getKey();
- result[i++] = e.getValue();
- }
-
- for(i=0; i<result.length;i++) {
- if(result[i] instanceof CdmBase) {
- CdmBase cdmBase = (CdmBase)result[i];
- CdmBase cachedCdmBase = cdmEntityCacheManager.getCdmTransientEntityCacher().put(cdmBase.getClass(),cdmBase.getId(), cdmBase);
- result[i] = cachedCdmBase;
- }
- }
- map.clear();
- for(i = 0; i < originalMapSize; i+=2 ) {
- map.put(
- result[i],
- result[i+1]
- );
- }
-
- }
-
-
-
-}
+++ /dev/null
-/**
-* Copyright (C) 2014 EDIT
-* European Distributed Institute of Taxonomy
-* http://www.e-taxonomy.eu
-*
-* The contents of this file are subject to the Mozilla Public License Version 1.1
-* See LICENSE.TXT at the top of this package for the full license terms.
-*/
-
-package eu.etaxonomy.cdm.remote;
-
-import static eu.etaxonomy.cdm.common.XmlHelp.getBeansRoot;
-import static eu.etaxonomy.cdm.common.XmlHelp.insertXmlBean;
-import static eu.etaxonomy.cdm.common.XmlHelp.insertXmlValueProperty;
-import static eu.etaxonomy.cdm.common.XmlHelp.saveToXml;
-
-import java.util.ArrayList;
-import java.util.Enumeration;
-import java.util.List;
-import java.util.Properties;
-
-import org.apache.log4j.Logger;
-import org.jdom.Attribute;
-import org.jdom.Element;
-
-import eu.etaxonomy.cdm.common.CdmUtils;
-import eu.etaxonomy.cdm.common.XmlHelp;
-import eu.etaxonomy.cdm.config.CdmPersistentSourceUtils;
-import eu.etaxonomy.cdm.config.CdmPersistentXMLSource;
-import eu.etaxonomy.cdm.config.CdmPersistentXMLSource.CdmSourceProperties;
-import eu.etaxonomy.cdm.config.ICdmPersistentSource;
-import eu.etaxonomy.cdm.model.name.NomenclaturalCode;
-
-/**
- * Class representing a CDM remote source which can be persisted to a source config file
- *
- */
-public class CdmPersistentRemoteSource extends CdmRemoteSourceBase implements ICdmPersistentSource{
- private static final Logger logger = Logger.getLogger(CdmPersistentRemoteSource.class);
-
- public static final String REMOTESOURCE_BEAN_POSTFIX = "RemoteSource";
- private String beanName;
- private Properties cdmSourceProperties;
- private List<Attribute> cdmSourceAttributes;
-
- /**
- * Creates a new instance of CdmPersistentRemoteSource
- *
- * @param name
- * @param server
- * @param port
- * @param contextPath
- * @param nomenclaturalCode
- * @return
- * @throws CdmRemoteSourceException
- */
- public static CdmPersistentRemoteSource NewInstance(String remoteSource) throws CdmRemoteSourceException {
- if(exists(remoteSource)) {
- return new CdmPersistentRemoteSource(remoteSource);
- } else {
- throw new CdmRemoteSourceException("Remote source '" + remoteSource + "' does not exist in sources setting file");
- }
-
- }
-
- /**S
- * Creates a new CdmPersistentRemoteSource
- *
- * @param name
- * @param server
- * @param port
- * @param contextPath
- * @param nomenclaturalCode
- * @throws CdmRemoteSourceException
- */
- private CdmPersistentRemoteSource(String remoteSource) throws CdmRemoteSourceException {
-
- CdmPersistentXMLSource cdmPersistentXMLSource = CdmPersistentXMLSource.NewInstance(remoteSource, REMOTESOURCE_BEAN_POSTFIX);
- if(cdmPersistentXMLSource.getElement() != null) {
- beanName = cdmPersistentXMLSource.getBeanName();
- // properties from the persistent xml file
- cdmSourceProperties = cdmPersistentXMLSource.getCdmSourceProperties();
- cdmSourceAttributes = cdmPersistentXMLSource.getCdmSourceAttributes();
- checkProperties(cdmSourceProperties);
- } else {
- throw new CdmRemoteSourceException("Remote source '" + remoteSource + "' does not exist in settings file");
- }
- initDatabaseConnection();
- }
-
- private static void checkProperties(Properties cdmSourceProperties) throws CdmRemoteSourceException {
- if(!cdmSourceProperties.containsKey(CdmSourceProperties.SERVER.toString())) {
- throw new CdmRemoteSourceException("Could not initialise remote source. Required property '" + CdmSourceProperties.SERVER.toString() + "' is missing");
- }
- String port = (String)cdmSourceProperties.get(CdmSourceProperties.PORT.toString());
- if(port == null || port.isEmpty()) {
- throw new CdmRemoteSourceException("Could not initialise remote source. Required property '" + CdmSourceProperties.SERVER.toString() + "' is missing");
- }
- if(!cdmSourceProperties.containsKey(CdmSourceProperties.CONTEXTPATH.toString())) {
- throw new CdmRemoteSourceException("Could not initialise remote source. Required property '" + CdmSourceProperties.SERVER.toString() + "' is missing");
- }
- // default NomenclaturalCode is always ICNAFP
- if(!cdmSourceProperties.containsKey(CdmSourceProperties.NOMENCLATURAL_CODE.toString())) {
- cdmSourceProperties.put(CdmSourceProperties.NOMENCLATURAL_CODE.toString(), NomenclaturalCode.ICNAFP.name());
- }
- }
-
- /* (non-Javadoc)
- * @see eu.etaxonomy.cdm.config.ICdmPersistentSource#getBeanName()
- */
- @Override
- public String getBeanName() {
- return beanName;
- }
-
- @Override
- public String getServer() {
- return cdmSourceProperties.getProperty(CdmSourceProperties.SERVER.toString());
- }
-
- @Override
- public int getPort() {
- String port = CdmUtils.Nz(cdmSourceProperties.getProperty(CdmSourceProperties.PORT.toString()));
- if (port == null || "".equals(port)){
- return -1;
- }else{
- //TODO exception if non integer
- return Integer.valueOf(port);
- }
- }
-
- @Override
- public String getContextPath() {
- return cdmSourceProperties.getProperty(CdmSourceProperties.CONTEXTPATH.toString());
- }
-
- @Override
- public NomenclaturalCode getNomenclaturalCode() {
- return NomenclaturalCode.fromString(cdmSourceProperties.getProperty(CdmSourceProperties.NOMENCLATURAL_CODE.toString()));
- }
-
- public static CdmPersistentRemoteSource save(String strRemoteSourceName, ICdmRemoteSource remoteSource) throws CdmRemoteSourceException {
- Properties cdmSourceProperties = new Properties();
- cdmSourceProperties.put(CdmSourceProperties.SERVER.toString(), remoteSource.getServer());
- cdmSourceProperties.put(CdmSourceProperties.PORT.toString(), String.valueOf(remoteSource.getPort()));
- cdmSourceProperties.put(CdmSourceProperties.CONTEXTPATH.toString(), remoteSource.getContextPath());
- cdmSourceProperties.put(CdmSourceProperties.NOMENCLATURAL_CODE.toString(), remoteSource.getNomenclaturalCode().name());
- checkProperties(cdmSourceProperties);
- return save(strRemoteSourceName, cdmSourceProperties);
- }
-
- private static CdmPersistentRemoteSource save(String strRemoteSourceName,Properties cdmSourceProperties) throws CdmRemoteSourceException {
-
- //root
- Element root = getBeansRoot(CdmPersistentSourceUtils.getCdmSourceInputStream());
- if (root == null){
- return null;
- }
- //bean
- Element bean = XmlHelp.getFirstAttributedChild(root, "bean", "id", CdmPersistentSourceUtils.getBeanName(strRemoteSourceName, REMOTESOURCE_BEAN_POSTFIX));
- if (bean != null){
- bean.detach(); //delete old version if necessary
- }
- bean = insertXmlBean(root, CdmPersistentSourceUtils.getBeanName(strRemoteSourceName, REMOTESOURCE_BEAN_POSTFIX), CdmPersistentRemoteSource.class.getName());
-
-
- Properties props = cdmSourceProperties;
- Enumeration e = props.propertyNames();
-
- while (e.hasMoreElements()) {
- String key = (String) e.nextElement();
- insertXmlValueProperty(bean, key, props.getProperty(key));
- }
-
- //save
- saveToXml(root.getDocument(),
- CdmPersistentSourceUtils.getResourceDirectory(),
- CdmPersistentXMLSource.CDMSOURCE_FILE_NAME,
- XmlHelp.prettyFormat );
-
- return NewInstance(strRemoteSourceName) ;
-
- }
-
- /**
- * @param strDataSourceName
- * @param dataSource
- * @param code
- * @return
- * the updated dataSource, null if not succesful
- */
- public static CdmPersistentRemoteSource update(String strRemoteSourceName,
- ICdmRemoteSource remoteSource) throws CdmRemoteSourceException {
- CdmPersistentSourceUtils.delete(CdmPersistentSourceUtils.getBeanName(strRemoteSourceName,REMOTESOURCE_BEAN_POSTFIX));
- return save(strRemoteSourceName, remoteSource);
- }
-
- /**
- * Tests existing of the datsource in the according config file.
- * @return true if a datasource with the given name exists in the according datasource config file.
- */
- public static boolean exists(String strRemoteSourceName){
- Element bean = CdmPersistentSourceUtils.getCdmSourceBeanXml(strRemoteSourceName, REMOTESOURCE_BEAN_POSTFIX);
- return (bean != null);
- }
-
- /**
- * Returns a list of all datasources stored in the datasource config file
- * @return all existing data sources
- * @throws CdmRemoteSourceException
- */
- @SuppressWarnings("unchecked")
- static public List<CdmPersistentRemoteSource> getAllRemoteSources() throws CdmRemoteSourceException{
- List<CdmPersistentRemoteSource> remoteSources = new ArrayList<CdmPersistentRemoteSource>();
-
- Element root = getBeansRoot(CdmPersistentSourceUtils.getCdmSourceInputStream());
- if (root == null){
- return null;
- }else{
- List<Element> lsChildren = root.getChildren("bean", root.getNamespace());
-
- for (Element elBean : lsChildren){
- String strId = elBean.getAttributeValue("id");
- if (strId != null && strId.endsWith(REMOTESOURCE_BEAN_POSTFIX)){
- strId = strId.replace(REMOTESOURCE_BEAN_POSTFIX, "");
- remoteSources.add(new CdmPersistentRemoteSource(strId));
- }
- }
- }
- return remoteSources;
- }
-
- @Override
- public String toString(){
- if (getName() != null){
- return getName();
- }else{
- return null;
- }
- }
-
-}
+++ /dev/null
-/**
-* Copyright (C) 2014 EDIT
-* European Distributed Institute of Taxonomy
-* http://www.e-taxonomy.eu
-*
-* The contents of this file are subject to the Mozilla Public License Version 1.1
-* See LICENSE.TXT at the top of this package for the full license terms.
-*/
-package eu.etaxonomy.cdm.remote;
-
-import eu.etaxonomy.cdm.model.name.NomenclaturalCode;
-
-/**
- * Class representing a CDM remote source
- *
- */
-public class CdmRemoteSource extends CdmRemoteSourceBase {
-
- /**
- * Creates a new instance of CdmRemoteSource
- *
- * @param name
- * @param server
- * @param port
- * @param contextPath
- * @param nomenclaturalCode
- * @return
- */
- public static CdmRemoteSource NewInstance() {
- return new CdmRemoteSource(DEFAULT_NAME, DEFAULT_SERVER, DEFAULT_PORT, DEFAULT_CONTEXT_PATH, DEFAULT_NOMENCLATURAL_CODE);
- }
-
- /**
- * Creates a new instance of CdmRemoteSource
- *
- * @param name
- * @param server
- * @param port
- * @param contextPath
- * @param nomenclaturalCode
- * @return
- */
- public static CdmRemoteSource NewInstance(String name, String server, int port, String contextPath, NomenclaturalCode nomenclaturalCode) {
- return new CdmRemoteSource(name, server, port, contextPath, nomenclaturalCode);
- }
-
- /**
- * Creates a new CdmRemoteSource
- *
- * @param name
- * @param server
- * @param port
- * @param contextPath
- * @param nomenclaturalCode
- */
- private CdmRemoteSource(String name, String server, int port, String contextPath, NomenclaturalCode nomenclaturalCode) {
- super(name, server, port, contextPath, nomenclaturalCode);
-
- }
-
-
-}
+++ /dev/null
-/**
-* Copyright (C) 2014 EDIT
-* European Distributed Institute of Taxonomy
-* http://www.e-taxonomy.eu
-*
-* The contents of this file are subject to the Mozilla Public License Version 1.1
-* See LICENSE.TXT at the top of this package for the full license terms.
-*/
-package eu.etaxonomy.cdm.remote;
-
-import java.util.Map;
-
-import org.springframework.remoting.httpinvoker.HttpInvokerProxyFactoryBean;
-
-import eu.etaxonomy.cdm.api.service.IDatabaseService;
-import eu.etaxonomy.cdm.config.CdmSource;
-import eu.etaxonomy.cdm.config.CdmSourceException;
-import eu.etaxonomy.cdm.model.metadata.CdmMetaData.MetaDataPropertyName;
-import eu.etaxonomy.cdm.model.name.NomenclaturalCode;
-
-/**
- * Base class representing a CDM remote source.
- * This class handles all the configuration relating to the remoting aspect of
- * a CDM source.
- *
- */
-public class CdmRemoteSourceBase extends CdmSource implements ICdmRemoteSource {
-
- protected static final String DEFAULT_NAME = "default";
- protected static final String DEFAULT_SERVER = "127.0.0.1";
- protected static final int DEFAULT_PORT = 8080;
- protected static final String DEFAULT_CONTEXT_PATH = "";
- protected static final NomenclaturalCode DEFAULT_NOMENCLATURAL_CODE = NomenclaturalCode.ICNAFP;
- private String contextPath;
- private String baseUrl;
-
- private IDatabaseService databaseService;
-
- /**
- * Constructs a CdmRemoteSourceBase object with default values.
- *
- */
- protected CdmRemoteSourceBase() {
- setName(DEFAULT_NAME);
- setServer(DEFAULT_SERVER);
- setPort(DEFAULT_PORT);
- setContextPath(DEFAULT_CONTEXT_PATH);
- setNomenclaturalCode(DEFAULT_NOMENCLATURAL_CODE);
- }
-
- /**
- * Constructs a CdmRemoteSourceBase
- *
- * @param name
- * @param server
- * @param port
- * @param contextPath
- * @param nomenclaturalCode
- */
- public CdmRemoteSourceBase(String name, String server, int port, String contextPath, NomenclaturalCode nomenclaturalCode) {
- setName(name);
- setServer(server);
- setPort(port);
- setContextPath(contextPath);
- setNomenclaturalCode(nomenclaturalCode);
- initDatabaseConnection();
- }
-
- protected void initDatabaseConnection() {
- if(getContextPath() == null || getContextPath().equals("")) {
- setBaseUrl("http://" + getServer() + ":" + String.valueOf(getPort()));
- } else {
- setBaseUrl("http://" + getServer() + ":" + String.valueOf(getPort()) + "/" + getContextPath());
- }
- // the database service needs to be initialised (before the spring
- // application context initialsation) since it is required to
- // to make queries related to the source database
- HttpInvokerProxyFactoryBean proxy = new HttpInvokerProxyFactoryBean();
- proxy.setServiceInterface(IDatabaseService.class);
- proxy.setServiceUrl(baseUrl + "/remoting/database.service");
- proxy.afterPropertiesSet();
- databaseService = (IDatabaseService) proxy.getObject();
-
- }
-
- /* (non-Javadoc)
- * @see eu.etaxonomy.cdm.remote.ICdmRemoteSource#getBaseUrl()
- */
- @Override
- public String getBaseUrl() {
- return baseUrl;
- }
-
- /**
- * Sets the base url for the http-invoker services as listed in
- * httpInvokerServicesClients.xml.
- * e.g. for 'http://127.0.0.1:8080/col/remoting/common.service', the
- * base url would be 'http://127.0.0.1:8080/col'
- *
- * @param baseUrl
- */
- public void setBaseUrl(String baseUrl) {
- this.baseUrl = baseUrl;
- }
-
- /* (non-Javadoc)
- * @see eu.etaxonomy.cdm.remote.ICdmRemoteSource#getContextPath()
- */
- @Override
- public String getContextPath() {
- return contextPath;
- }
-
- /**
- * Sets the context path.
- * e.g. for 'http://127.0.0.1:8080/col/remoting/common.service', the
- * context path would be 'col'
- *
- * @param contextPath
- */
- public void setContextPath(String contextPath) {
- this.contextPath = contextPath;
- }
-
- /* (non-Javadoc)
- * @see eu.etaxonomy.cdm.config.CdmSource#getDbSchemaVersion()
- */
- @Override
- public String getDbSchemaVersion() throws CdmSourceException {
- return databaseService.getDbSchemaVersion();
-
- }
-
- /* (non-Javadoc)
- * @see eu.etaxonomy.cdm.config.CdmSource#isDbEmpty()
- */
- @Override
- public boolean isDbEmpty() throws CdmSourceException {
- return databaseService.isDbEmpty();
-
- }
-
- /* (non-Javadoc)
- * @see eu.etaxonomy.cdm.config.CdmSource#checkConnection()
- */
- @Override
- public boolean checkConnection() throws CdmSourceException {
- // assuming that database service works implies
- // the connection is up
- // if no exception is thrown then we assume that the
- // connection is up
- // FIXME:Remoting is this really correct?
- databaseService.getDbSchemaVersion();
-
- return true;
- }
-
- /* (non-Javadoc)
- * @see eu.etaxonomy.cdm.config.CdmSource#getConnectionMessage()
- */
- @Override
- public String getConnectionMessage() {
- return "Conncting to Remote CDM Server " + getName();
- }
-
-
- @Override
- public Map<MetaDataPropertyName, String> getMetaDataMap() throws CdmSourceException {
- return databaseService.getCdmMetadataMap();
- }
-
-
-}
+++ /dev/null
-/**
- *
- */
-package eu.etaxonomy.cdm.remote;
-
-/**
- *
- *
- */
-public class CdmRemoteSourceException extends Exception {
-
- public CdmRemoteSourceException(String message) {
- super(message);
- }
-
- public CdmRemoteSourceException(Exception e) {
- super(e);
- }
-}
+++ /dev/null
-/**
-* Copyright (C) 2014 EDIT
-* European Distributed Institute of Taxonomy
-* http://www.e-taxonomy.eu
-*
-* The contents of this file are subject to the Mozilla Public License Version 1.1
-* See LICENSE.TXT at the top of this package for the full license terms.
-*/
-package eu.etaxonomy.cdm.remote;
-
-import eu.etaxonomy.cdm.config.ICdmSource;
-
-/**
- * Interface representing a CDM remote source
- *
- */
-public interface ICdmRemoteSource extends ICdmSource {
-
- /**
- * Gets the context path.
- * e.g. for 'http://127.0.0.1:8080/col/remoting/common.service', the
- * context path would be 'col'
- */
- public String getContextPath();
-
- /**
- * Gets the base url for the http-invoker services as listed in
- * httpInvokerServicesClients.xml.
- * e.g. for 'http://127.0.0.1:8080/col/remoting/common.service', the
- * base url would be 'http://127.0.0.1:8080/col'
- */
- public String getBaseUrl();
-
-}
+++ /dev/null
-package eu.etaxonomy.taxeditor.remoting;
-
-import org.osgi.framework.BundleActivator;
-import org.osgi.framework.BundleContext;
-
-public class RemotingTestPluginActivator implements BundleActivator {
-
- private static BundleContext context;
-
- static BundleContext getContext() {
- return context;
- }
-
- /*
- * (non-Javadoc)
- * @see org.osgi.framework.BundleActivator#start(org.osgi.framework.BundleContext)
- */
- public void start(BundleContext bundleContext) throws Exception {
- RemotingTestPluginActivator.context = bundleContext;
- }
-
- /*
- * (non-Javadoc)
- * @see org.osgi.framework.BundleActivator#stop(org.osgi.framework.BundleContext)
- */
- public void stop(BundleContext bundleContext) throws Exception {
- RemotingTestPluginActivator.context = null;
- }
-
-}
+++ /dev/null
-
-
-/*
- * Hibernate, Relational Persistence for Idiomatic Java
- *
- * Copyright (c) 2008-2011, Red Hat Inc. or third-party contributors as
- * indicated by the @author tags or express copyright attribution
- * statements applied by the authors. All third-party contributions are
- * distributed under license by Red Hat Inc.
- *
- * This copyrighted material is made available to anyone wishing to use, modify,
- * copy, or redistribute it subject to the terms and conditions of the GNU
- * Lesser General Public License, as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
- * for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this distribution; if not, write to:
- * Free Software Foundation, Inc.
- * 51 Franklin Street, Fifth Floor
- * Boston, MA 02110-1301 USA
- */
-package org.hibernate.collection.internal;
-
-import java.io.Serializable;
-import java.lang.reflect.Field;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.List;
-import java.util.ListIterator;
-import java.util.Map;
-import java.util.Set;
-import java.util.TreeMap;
-import java.util.TreeSet;
-
-import javax.naming.NamingException;
-
-import org.hibernate.AssertionFailure;
-import org.hibernate.HibernateException;
-import org.hibernate.LazyInitializationException;
-import org.hibernate.Session;
-import org.hibernate.collection.spi.PersistentCollection;
-import org.hibernate.engine.internal.ForeignKeys;
-import org.hibernate.engine.spi.CollectionEntry;
-import org.hibernate.engine.spi.EntityEntry;
-import org.hibernate.engine.spi.SessionFactoryImplementor;
-import org.hibernate.engine.spi.SessionImplementor;
-import org.hibernate.engine.spi.Status;
-import org.hibernate.engine.spi.TypedValue;
-import org.hibernate.internal.SessionFactoryRegistry;
-import org.hibernate.internal.util.MarkerObject;
-import org.hibernate.internal.util.collections.EmptyIterator;
-import org.hibernate.internal.util.collections.IdentitySet;
-import org.hibernate.persister.collection.CollectionPersister;
-import org.hibernate.persister.entity.EntityPersister;
-import org.hibernate.pretty.MessageHelper;
-import org.hibernate.type.Type;
-import org.jboss.logging.Logger;
-
-import eu.etaxonomy.cdm.api.application.CdmApplicationRemoteConfiguration;
-import eu.etaxonomy.cdm.api.application.CdmApplicationRemoteController;
-import eu.etaxonomy.cdm.api.application.ICdmApplicationConfiguration;
-import eu.etaxonomy.cdm.api.cache.ICachedCommonService;
-import eu.etaxonomy.cdm.api.cache.CachedCommonServiceImpl.CollectionField;
-import eu.etaxonomy.cdm.api.service.ICommonService;
-import eu.etaxonomy.cdm.model.common.PersistentMultiLanguageText;
-
-/**
- * Base class implementing {@link org.hibernate.collection.spi.PersistentCollection}
- *
- * @author Gavin King
- */
-public abstract class AbstractPersistentCollection implements Serializable, PersistentCollection {
- private static final Logger log = Logger.getLogger( AbstractPersistentCollection.class );
-
- private static final long serialVersionUID = -7238232378593030571L;
-
- private transient SessionImplementor session;
- private boolean initialized;
- private transient List<DelayedOperation> operationQueue;
- private transient boolean directlyAccessible;
- private transient boolean initializing;
- private Object owner;
- private int cachedSize = -1;
-
- private String role;
- private Serializable key;
- // collections detect changes made via their public interface and mark
- // themselves as dirty as a performance optimization
- private boolean dirty;
- private Serializable storedSnapshot;
-
- private String sessionFactoryUuid;
- private boolean specjLazyLoad = false;
-
- @Override
- public final String getRole() {
- return role;
- }
-
- @Override
- public final Serializable getKey() {
- return key;
- }
-
- @Override
- public final boolean isUnreferenced() {
- return role == null;
- }
-
- @Override
- public final boolean isDirty() {
- return dirty;
- }
-
- @Override
- public final void clearDirty() {
- dirty = false;
- }
-
- @Override
- public final void dirty() {
- dirty = true;
- }
-
- @Override
- public final Serializable getStoredSnapshot() {
- return storedSnapshot;
- }
-
- //Careful: these methods do not initialize the collection.
-
- /**
- * Is the initialized collection empty?
- */
- @Override
- public abstract boolean empty();
-
- /**
- * Called by any read-only method of the collection interface
- */
- protected final void read() {
- initialize( false );
- }
-
- /**
- * Called by the {@link Collection#size} method
- */
- @SuppressWarnings({"JavaDoc"})
- protected boolean readSize() {
- if ( !initialized ) {
- if ( cachedSize != -1 && !hasQueuedOperations() ) {
- return true;
- }
- else {
- // In remoting we are sure that session is null
- // both when using property paths and switching off conversations
- if(session == null && remoting) {
- log.info("--> readSize, of " + getRole() + " with key " + getKey());
- read();
- } else {
- boolean isExtraLazy = withTemporarySessionIfNeeded(
- new LazyInitializationWork<Boolean>() {
- @Override
- public Boolean doWork() {
- CollectionEntry entry = session.getPersistenceContext().getCollectionEntry( AbstractPersistentCollection.this );
-
- if ( entry != null ) {
- CollectionPersister persister = entry.getLoadedPersister();
- if ( persister.isExtraLazy() ) {
- if ( hasQueuedOperations() ) {
- session.flush();
- }
- cachedSize = persister.getSize( entry.getLoadedKey(), session );
- return true;
- }
- else {
- read();
- }
- }
- else{
- throwLazyInitializationExceptionIfNotConnected();
- }
- return false;
- }
- }
- );
- if ( isExtraLazy ) {
- return true;
- }
- }
- }
- }
- return false;
- }
-
- public static interface LazyInitializationWork<T> {
- public T doWork();
- }
-
- private <T> T withTemporarySessionIfNeeded(LazyInitializationWork<T> lazyInitializationWork) {
- SessionImplementor originalSession = null;
- boolean isTempSession = false;
- boolean isJTA = false;
-
- if ( session == null ) {
- if ( specjLazyLoad ) {
- session = openTemporarySessionForLoading();
- isTempSession = true;
- }
- else {
- throwLazyInitializationException( "could not initialize proxy - no Session" );
- }
- }
- else if ( !session.isOpen() ) {
- if ( specjLazyLoad ) {
- originalSession = session;
- session = openTemporarySessionForLoading();
- isTempSession = true;
- }
- else {
- throwLazyInitializationException( "could not initialize proxy - the owning Session was closed" );
- }
- }
- else if ( !session.isConnected() ) {
- if ( specjLazyLoad ) {
- originalSession = session;
- session = openTemporarySessionForLoading();
- isTempSession = true;
- }
- else {
- throwLazyInitializationException( "could not initialize proxy - the owning Session is disconnected" );
- }
- }
-
- if ( isTempSession ) {
- // TODO: On the next major release, add an
- // 'isJTA' or 'getTransactionFactory' method to Session.
- isJTA = session.getTransactionCoordinator()
- .getTransactionContext().getTransactionEnvironment()
- .getTransactionFactory()
- .compatibleWithJtaSynchronization();
-
- if ( !isJTA ) {
- // Explicitly handle the transactions only if we're not in
- // a JTA environment. A lazy loading temporary session can
- // be created even if a current session and transaction are
- // open (ex: session.clear() was used). We must prevent
- // multiple transactions.
- ( ( Session) session ).beginTransaction();
- }
-
- session.getPersistenceContext().addUninitializedDetachedCollection(
- session.getFactory().getCollectionPersister( getRole() ),
- this
- );
- }
-
- try {
- return lazyInitializationWork.doWork();
- }
- finally {
- if ( isTempSession ) {
- // make sure the just opened temp session gets closed!
- try {
- if ( !isJTA ) {
- ( ( Session) session ).getTransaction().commit();
- }
- ( (Session) session ).close();
- }
- catch (Exception e) {
- log.warn( "Unable to close temporary session used to load lazy collection associated to no session" );
- }
- session = originalSession;
- }
- }
- }
-
- private SessionImplementor openTemporarySessionForLoading() {
- if ( sessionFactoryUuid == null ) {
- throwLazyInitializationException( "SessionFactory UUID not known to create temporary Session for loading" );
- }
-
- SessionFactoryImplementor sf = (SessionFactoryImplementor)
- SessionFactoryRegistry.INSTANCE.getSessionFactory( sessionFactoryUuid );
- return (SessionImplementor) sf.openSession();
- }
-
- protected Boolean readIndexExistence(final Object index) {
- if ( !initialized ) {
- // In remoting we are sure that session is null
- // both when using property paths and switching off conversations
- if(session == null && remoting) {
- log.info("--> readIndexExistence, of " + getRole() + " with key " + getKey());
- read();
- } else {
- Boolean extraLazyExistenceCheck = withTemporarySessionIfNeeded(
- new LazyInitializationWork<Boolean>() {
- @Override
- public Boolean doWork() {
- CollectionEntry entry = session.getPersistenceContext().getCollectionEntry( AbstractPersistentCollection.this );
- CollectionPersister persister = entry.getLoadedPersister();
- if ( persister.isExtraLazy() ) {
- if ( hasQueuedOperations() ) {
- session.flush();
- }
- return persister.indexExists( entry.getLoadedKey(), index, session );
- }
- else {
- read();
- }
- return null;
- }
- }
- );
- if ( extraLazyExistenceCheck != null ) {
- return extraLazyExistenceCheck;
- }
- }
- }
- return null;
- }
-
- protected Boolean readElementExistence(final Object element) {
- if ( !initialized ) {
- // In remoting we are sure that session is null
- // both when using property paths and switching off conversations
- if(session == null && remoting) {
- log.info("--> readElementExistence, of " + getRole() + " with key " + getKey());
- read();
-
- } else {
- Boolean extraLazyExistenceCheck = withTemporarySessionIfNeeded(
- new LazyInitializationWork<Boolean>() {
- @Override
- public Boolean doWork() {
- CollectionEntry entry = session.getPersistenceContext().getCollectionEntry( AbstractPersistentCollection.this );
- CollectionPersister persister = entry.getLoadedPersister();
- if ( persister.isExtraLazy() ) {
- if ( hasQueuedOperations() ) {
- session.flush();
- }
- return persister.elementExists( entry.getLoadedKey(), element, session );
- }
- else {
- read();
- }
- return null;
- }
- }
- );
- if ( extraLazyExistenceCheck != null ) {
- return extraLazyExistenceCheck;
- }
- }
- }
- return null;
- }
-
- protected static final Object UNKNOWN = new MarkerObject( "UNKNOWN" );
-
- protected Object readElementByIndex(final Object index) {
- if ( !initialized ) {
- // In remoting we are sure that session is null
- // both when using property paths and switching off conversations
- if(session == null && remoting) {
- log.info("--> readElementByIndex, of " + getRole() + " with key " + getKey());
- read();
-
- } else {
- class ExtraLazyElementByIndexReader implements LazyInitializationWork {
- private boolean isExtraLazy;
- private Object element;
-
- @Override
- public Object doWork() {
- CollectionEntry entry = session.getPersistenceContext().getCollectionEntry( AbstractPersistentCollection.this );
- CollectionPersister persister = entry.getLoadedPersister();
- isExtraLazy = persister.isExtraLazy();
- if ( isExtraLazy ) {
- if ( hasQueuedOperations() ) {
- session.flush();
- }
- element = persister.getElementByIndex( entry.getLoadedKey(), index, session, owner );
- }
- else {
- read();
- }
- return null;
- }
- }
-
- ExtraLazyElementByIndexReader reader = new ExtraLazyElementByIndexReader();
- //noinspection unchecked
- withTemporarySessionIfNeeded( reader );
- if ( reader.isExtraLazy ) {
- return reader.element;
- }
- }
- }
- return UNKNOWN;
-
- }
-
- protected int getCachedSize() {
- return cachedSize;
- }
-
- private boolean isConnectedToSession() {
- return session != null &&
- session.isOpen() &&
- session.getPersistenceContext().containsCollection( this );
- }
-
- /**
- * Called by any writer method of the collection interface
- */
- protected final void write() {
- initialize( true );
- dirty();
- }
-
- /**
- * Is this collection in a state that would allow us to
- * "queue" operations?
- */
- @SuppressWarnings({"JavaDoc"})
- protected boolean isOperationQueueEnabled() {
- return !initialized &&
- isConnectedToSession() &&
- isInverseCollection();
- }
-
- /**
- * Is this collection in a state that would allow us to
- * "queue" puts? This is a special case, because of orphan
- * delete.
- */
- @SuppressWarnings({"JavaDoc"})
- protected boolean isPutQueueEnabled() {
- return !initialized &&
- isConnectedToSession() &&
- isInverseOneToManyOrNoOrphanDelete();
- }
-
- /**
- * Is this collection in a state that would allow us to
- * "queue" clear? This is a special case, because of orphan
- * delete.
- */
- @SuppressWarnings({"JavaDoc"})
- protected boolean isClearQueueEnabled() {
- return !initialized &&
- isConnectedToSession() &&
- isInverseCollectionNoOrphanDelete();
- }
-
- /**
- * Is this the "inverse" end of a bidirectional association?
- */
- @SuppressWarnings({"JavaDoc"})
- private boolean isInverseCollection() {
- CollectionEntry ce = session.getPersistenceContext().getCollectionEntry( this );
- return ce != null && ce.getLoadedPersister().isInverse();
- }
-
- /**
- * Is this the "inverse" end of a bidirectional association with
- * no orphan delete enabled?
- */
- @SuppressWarnings({"JavaDoc"})
- private boolean isInverseCollectionNoOrphanDelete() {
- CollectionEntry ce = session.getPersistenceContext().getCollectionEntry( this );
- return ce != null &&
- ce.getLoadedPersister().isInverse() &&
- !ce.getLoadedPersister().hasOrphanDelete();
- }
-
- /**
- * Is this the "inverse" end of a bidirectional one-to-many, or
- * of a collection with no orphan delete?
- */
- @SuppressWarnings({"JavaDoc"})
- private boolean isInverseOneToManyOrNoOrphanDelete() {
- CollectionEntry ce = session.getPersistenceContext().getCollectionEntry( this );
- return ce != null && ce.getLoadedPersister().isInverse() && (
- ce.getLoadedPersister().isOneToMany() ||
- !ce.getLoadedPersister().hasOrphanDelete()
- );
- }
-
- /**
- * Queue an addition
- */
- @SuppressWarnings({"JavaDoc"})
- protected final void queueOperation(DelayedOperation operation) {
- if ( operationQueue == null ) {
- operationQueue = new ArrayList<DelayedOperation>( 10 );
- }
- operationQueue.add( operation );
- dirty = true; //needed so that we remove this collection from the second-level cache
- }
-
- /**
- * After reading all existing elements from the database,
- * add the queued elements to the underlying collection.
- */
- protected final void performQueuedOperations() {
- for ( DelayedOperation operation : operationQueue ) {
- operation.operate();
- }
- }
-
- /**
- * After flushing, re-init snapshot state.
- */
- @Override
- public void setSnapshot(Serializable key, String role, Serializable snapshot) {
- this.key = key;
- this.role = role;
- this.storedSnapshot = snapshot;
- }
-
- /**
- * After flushing, clear any "queued" additions, since the
- * database state is now synchronized with the memory state.
- */
- @Override
- public void postAction() {
- operationQueue = null;
- cachedSize = -1;
- clearDirty();
- }
-
- /**
- * Not called by Hibernate, but used by non-JDK serialization,
- * eg. SOAP libraries.
- */
- public AbstractPersistentCollection() {
- }
-
- protected AbstractPersistentCollection(SessionImplementor session) {
- this.session = session;
- }
-
- /**
- * return the user-visible collection (or array) instance
- */
- @Override
- public Object getValue() {
- return this;
- }
-
- /**
- * Called just before reading any rows from the JDBC result set
- */
- @Override
- public void beginRead() {
- // override on some subclasses
- initializing = true;
- }
-
- /**
- * Called after reading all rows from the JDBC result set
- */
- @Override
- public boolean endRead() {
- //override on some subclasses
- return afterInitialize();
- }
-
- @Override
- public boolean afterInitialize() {
- setInitialized();
- //do this bit after setting initialized to true or it will recurse
- if ( operationQueue != null ) {
- performQueuedOperations();
- operationQueue = null;
- cachedSize = -1;
- return false;
- }
- else {
- return true;
- }
- }
-
- /**
- * Initialize the collection, if possible, wrapping any exceptions
- * in a runtime exception
- *
- * @param writing currently obsolete
- *
- * @throws LazyInitializationException if we cannot initialize
- */
- protected final void initialize(final boolean writing) {
- // In remoting we are sure that session is null
- // both when using property paths and switching off conversations
- if(session == null && remoting) {
- remoteInitialize();
- }
-
- if ( initialized ) {
- return;
- }
-
-
- withTemporarySessionIfNeeded(
- new LazyInitializationWork<Object>() {
- @Override
- public Object doWork() {
- session.initializeCollection( AbstractPersistentCollection.this, writing );
- return null;
- }
- }
- );
- }
-
- private void throwLazyInitializationExceptionIfNotConnected() {
- if ( !isConnectedToSession() ) {
- throwLazyInitializationException( "no session or session was closed" );
- }
- if ( !session.isConnected() ) {
- throwLazyInitializationException( "session is disconnected" );
- }
- }
-
- private void throwLazyInitializationException(String message) {
- throw new LazyInitializationException(
- "failed to lazily initialize a collection" +
- (role == null ? "" : " of role: " + role) +
- ", " + message
- );
- }
-
- protected final void setInitialized() {
- this.initializing = false;
- this.initialized = true;
- }
-
- protected final void setDirectlyAccessible(boolean directlyAccessible) {
- this.directlyAccessible = directlyAccessible;
- }
-
- /**
- * Could the application possibly have a direct reference to
- * the underlying collection implementation?
- */
- @Override
- public boolean isDirectlyAccessible() {
- return directlyAccessible;
- }
-
- /**
- * Disassociate this collection from the given session.
- *
- * @return true if this was currently associated with the given session
- */
- @Override
- public final boolean unsetSession(SessionImplementor currentSession) {
- prepareForPossibleSpecialSpecjInitialization();
- if ( currentSession == this.session ) {
- this.session = null;
- return true;
- }
- else {
- return false;
- }
- }
-
- protected void prepareForPossibleSpecialSpecjInitialization() {
- if ( session != null ) {
- specjLazyLoad = session.getFactory().getSettings().isInitializeLazyStateOutsideTransactionsEnabled();
-
- if ( specjLazyLoad && sessionFactoryUuid == null ) {
- try {
- sessionFactoryUuid = (String) session.getFactory().getReference().get( "uuid" ).getContent();
- }
- catch (NamingException e) {
- //not much we can do if this fails...
- }
- }
- }
- }
-
-
- /**
- * Associate the collection with the given session.
- *
- * @return false if the collection was already associated with the session
- *
- * @throws HibernateException if the collection was already associated
- * with another open session
- */
- @Override
- public final boolean setCurrentSession(SessionImplementor session) throws HibernateException {
- if ( session == this.session ) {
- return false;
- }
- else {
- if ( isConnectedToSession() ) {
- CollectionEntry ce = session.getPersistenceContext().getCollectionEntry( this );
- if ( ce == null ) {
- throw new HibernateException(
- "Illegal attempt to associate a collection with two open sessions"
- );
- }
- else {
- throw new HibernateException(
- "Illegal attempt to associate a collection with two open sessions: " +
- MessageHelper.collectionInfoString(
- ce.getLoadedPersister(), this,
- ce.getLoadedKey(), session
- )
- );
- }
- }
- else {
- this.session = session;
- return true;
- }
- }
- }
-
- /**
- * Do we need to completely recreate this collection when it changes?
- */
- @Override
- public boolean needsRecreate(CollectionPersister persister) {
- return false;
- }
-
- /**
- * To be called internally by the session, forcing
- * immediate initialization.
- */
- @Override
- public final void forceInitialization() throws HibernateException {
- if ( !initialized ) {
- if ( initializing ) {
- throw new AssertionFailure( "force initialize loading collection" );
- }
- if ( session == null ) {
- throw new HibernateException( "collection is not associated with any session" );
- }
- if ( !session.isConnected() ) {
- throw new HibernateException( "disconnected session" );
- }
- session.initializeCollection( this, false );
- }
- }
-
-
- /**
- * Get the current snapshot from the session
- */
- @SuppressWarnings({"JavaDoc"})
- protected final Serializable getSnapshot() {
- return session.getPersistenceContext().getSnapshot( this );
- }
-
- /**
- * Is this instance initialized?
- */
- @Override
- public final boolean wasInitialized() {
- return initialized;
- }
-
- @Override
- public boolean isRowUpdatePossible() {
- return true;
- }
-
- /**
- * Does this instance have any "queued" additions?
- */
- @Override
- public final boolean hasQueuedOperations() {
- return operationQueue != null;
- }
-
- /**
- * Iterate the "queued" additions
- */
- @Override
- public final Iterator queuedAdditionIterator() {
- if ( hasQueuedOperations() ) {
- return new Iterator() {
- int i = 0;
-
- @Override
- public Object next() {
- return operationQueue.get( i++ ).getAddedInstance();
- }
-
- @Override
- public boolean hasNext() {
- return i < operationQueue.size();
- }
-
- @Override
- public void remove() {
- throw new UnsupportedOperationException();
- }
- };
- }
- else {
- return EmptyIterator.INSTANCE;
- }
- }
-
- /**
- * Iterate the "queued" additions
- */
- @Override
- @SuppressWarnings({"unchecked"})
- public final Collection getQueuedOrphans(String entityName) {
- if ( hasQueuedOperations() ) {
- Collection additions = new ArrayList( operationQueue.size() );
- Collection removals = new ArrayList( operationQueue.size() );
- for ( DelayedOperation operation : operationQueue ) {
- additions.add( operation.getAddedInstance() );
- removals.add( operation.getOrphan() );
- }
- return getOrphans( removals, additions, entityName, session );
- }
- else {
- return Collections.EMPTY_LIST;
- }
- }
-
- /**
- * Called before inserting rows, to ensure that any surrogate keys
- * are fully generated
- */
- @Override
- public void preInsert(CollectionPersister persister) throws HibernateException {
- }
-
- /**
- * Called after inserting a row, to fetch the natively generated id
- */
- @Override
- public void afterRowInsert(CollectionPersister persister, Object entry, int i) throws HibernateException {
- }
-
- /**
- * get all "orphaned" elements
- */
- @Override
- public abstract Collection getOrphans(Serializable snapshot, String entityName) throws HibernateException;
-
- /**
- * Get the current session
- */
- @SuppressWarnings({"JavaDoc"})
- public final SessionImplementor getSession() {
- return session;
- }
-
- protected final class IteratorProxy implements Iterator {
- protected final Iterator itr;
-
- public IteratorProxy(Iterator itr) {
- this.itr = itr;
- }
-
- @Override
- public boolean hasNext() {
- return itr.hasNext();
- }
-
- @Override
- public Object next() {
- return itr.next();
- }
-
- @Override
- public void remove() {
- write();
- itr.remove();
- }
-
- }
-
- protected final class ListIteratorProxy implements ListIterator {
- protected final ListIterator itr;
-
- public ListIteratorProxy(ListIterator itr) {
- this.itr = itr;
- }
-
- @Override
- @SuppressWarnings({"unchecked"})
- public void add(Object o) {
- write();
- itr.add( o );
- }
-
- @Override
- public boolean hasNext() {
- return itr.hasNext();
- }
-
- @Override
- public boolean hasPrevious() {
- return itr.hasPrevious();
- }
-
- @Override
- public Object next() {
- return itr.next();
- }
-
- @Override
- public int nextIndex() {
- return itr.nextIndex();
- }
-
- @Override
- public Object previous() {
- return itr.previous();
- }
-
- @Override
- public int previousIndex() {
- return itr.previousIndex();
- }
-
- @Override
- public void remove() {
- write();
- itr.remove();
- }
-
- @Override
- @SuppressWarnings({"unchecked"})
- public void set(Object o) {
- write();
- itr.set( o );
- }
-
- }
-
- protected class SetProxy implements java.util.Set {
- protected final Collection set;
-
- public SetProxy(Collection set) {
- this.set = set;
- }
-
- @Override
- @SuppressWarnings({"unchecked"})
- public boolean add(Object o) {
- write();
- return set.add( o );
- }
-
- @Override
- @SuppressWarnings({"unchecked"})
- public boolean addAll(Collection c) {
- write();
- return set.addAll( c );
- }
-
- @Override
- public void clear() {
- write();
- set.clear();
- }
-
- @Override
- public boolean contains(Object o) {
- return set.contains( o );
- }
-
- @Override
- public boolean containsAll(Collection c) {
- return set.containsAll( c );
- }
-
- @Override
- public boolean isEmpty() {
- return set.isEmpty();
- }
-
- @Override
- public Iterator iterator() {
- return new IteratorProxy( set.iterator() );
- }
-
- @Override
- public boolean remove(Object o) {
- write();
- return set.remove( o );
- }
-
- @Override
- public boolean removeAll(Collection c) {
- write();
- return set.removeAll( c );
- }
-
- @Override
- public boolean retainAll(Collection c) {
- write();
- return set.retainAll( c );
- }
-
- @Override
- public int size() {
- return set.size();
- }
-
- @Override
- public Object[] toArray() {
- return set.toArray();
- }
-
- @Override
- @SuppressWarnings({"unchecked"})
- public Object[] toArray(Object[] array) {
- return set.toArray( array );
- }
-
- }
-
- protected final class ListProxy implements java.util.List {
- protected final List list;
-
- public ListProxy(List list) {
- this.list = list;
- }
-
- @Override
- @SuppressWarnings({"unchecked"})
- public void add(int index, Object value) {
- write();
- list.add( index, value );
- }
-
- @Override
- @SuppressWarnings({"unchecked"})
- public boolean add(Object o) {
- write();
- return list.add( o );
- }
-
- @Override
- @SuppressWarnings({"unchecked"})
- public boolean addAll(Collection c) {
- write();
- return list.addAll( c );
- }
-
- @Override
- @SuppressWarnings({"unchecked"})
- public boolean addAll(int i, Collection c) {
- write();
- return list.addAll( i, c );
- }
-
- @Override
- public void clear() {
- write();
- list.clear();
- }
-
- @Override
- public boolean contains(Object o) {
- return list.contains( o );
- }
-
- @Override
- public boolean containsAll(Collection c) {
- return list.containsAll( c );
- }
-
- @Override
- public Object get(int i) {
- return list.get( i );
- }
-
- @Override
- public int indexOf(Object o) {
- return list.indexOf( o );
- }
-
- @Override
- public boolean isEmpty() {
- return list.isEmpty();
- }
-
- @Override
- public Iterator iterator() {
- return new IteratorProxy( list.iterator() );
- }
-
- @Override
- public int lastIndexOf(Object o) {
- return list.lastIndexOf( o );
- }
-
- @Override
- public ListIterator listIterator() {
- return new ListIteratorProxy( list.listIterator() );
- }
-
- @Override
- public ListIterator listIterator(int i) {
- return new ListIteratorProxy( list.listIterator( i ) );
- }
-
- @Override
- public Object remove(int i) {
- write();
- return list.remove( i );
- }
-
- @Override
- public boolean remove(Object o) {
- write();
- return list.remove( o );
- }
-
- @Override
- public boolean removeAll(Collection c) {
- write();
- return list.removeAll( c );
- }
-
- @Override
- public boolean retainAll(Collection c) {
- write();
- return list.retainAll( c );
- }
-
- @Override
- @SuppressWarnings({"unchecked"})
- public Object set(int i, Object o) {
- write();
- return list.set( i, o );
- }
-
- @Override
- public int size() {
- return list.size();
- }
-
- @Override
- public List subList(int i, int j) {
- return list.subList( i, j );
- }
-
- @Override
- public Object[] toArray() {
- return list.toArray();
- }
-
- @Override
- @SuppressWarnings({"unchecked"})
- public Object[] toArray(Object[] array) {
- return list.toArray( array );
- }
-
- }
-
- /**
- * Contract for operations which are part of a collection's operation queue.
- */
- protected interface DelayedOperation {
- public void operate();
-
- public Object getAddedInstance();
-
- public Object getOrphan();
- }
-
- /**
- * Given a collection of entity instances that used to
- * belong to the collection, and a collection of instances
- * that currently belong, return a collection of orphans
- */
- @SuppressWarnings({"JavaDoc", "unchecked"})
- protected static Collection getOrphans(
- Collection oldElements,
- Collection currentElements,
- String entityName,
- SessionImplementor session) throws HibernateException {
-
- // short-circuit(s)
- if ( currentElements.size() == 0 ) {
- return oldElements; // no new elements, the old list contains only Orphans
- }
- if ( oldElements.size() == 0 ) {
- return oldElements; // no old elements, so no Orphans neither
- }
-
- final EntityPersister entityPersister = session.getFactory().getEntityPersister( entityName );
- final Type idType = entityPersister.getIdentifierType();
-
- // create the collection holding the Orphans
- Collection res = new ArrayList();
-
- // collect EntityIdentifier(s) of the *current* elements - add them into a HashSet for fast access
- java.util.Set currentIds = new HashSet();
- java.util.Set currentSaving = new IdentitySet();
- for ( Object current : currentElements ) {
- if ( current != null && ForeignKeys.isNotTransient( entityName, current, null, session ) ) {
- EntityEntry ee = session.getPersistenceContext().getEntry( current );
- if ( ee != null && ee.getStatus() == Status.SAVING ) {
- currentSaving.add( current );
- }
- else {
- Serializable currentId = ForeignKeys.getEntityIdentifierIfNotUnsaved(
- entityName,
- current,
- session
- );
- currentIds.add( new TypedValue( idType, currentId, entityPersister.getEntityMode() ) );
- }
- }
- }
-
- // iterate over the *old* list
- for ( Object old : oldElements ) {
- if ( !currentSaving.contains( old ) ) {
- Serializable oldId = ForeignKeys.getEntityIdentifierIfNotUnsaved( entityName, old, session );
- if ( !currentIds.contains( new TypedValue( idType, oldId, entityPersister.getEntityMode() ) ) ) {
- res.add( old );
- }
- }
- }
-
- return res;
- }
-
- public static void identityRemove(
- Collection list,
- Object object,
- String entityName,
- SessionImplementor session) throws HibernateException {
-
- if ( object != null && ForeignKeys.isNotTransient( entityName, object, null, session ) ) {
- final EntityPersister entityPersister = session.getFactory().getEntityPersister( entityName );
- Type idType = entityPersister.getIdentifierType();
-
- Serializable idOfCurrent = ForeignKeys.getEntityIdentifierIfNotUnsaved( entityName, object, session );
- Iterator itr = list.iterator();
- while ( itr.hasNext() ) {
- Serializable idOfOld = ForeignKeys.getEntityIdentifierIfNotUnsaved( entityName, itr.next(), session );
- if ( idType.isEqual( idOfCurrent, idOfOld, session.getFactory() ) ) {
- itr.remove();
- break;
- }
- }
-
- }
- }
-
- @Override
- public Object getIdentifier(Object entry, int i) {
- throw new UnsupportedOperationException();
- }
-
- @Override
- public Object getOwner() {
- return owner;
- }
-
- @Override
- public void setOwner(Object owner) {
- this.owner = owner;
- }
-
- /** ------ Below is section of code which makes remote service calls ----- */
- // The affected methods are :
- // initialize(final boolean writing)
- // readSize()
- // readIndexExistence(final Object index)
- // readElementExistence(final Object element)
- // readElementByIndex(final Object index)
-
- private static CdmApplicationRemoteConfiguration configuration;
- private static boolean remoting = false;
-
- public static void setConfiguration(CdmApplicationRemoteConfiguration conf) {
- remoting = true;
- configuration = conf;
- }
-
-
- private void remoteInitialize() {
-
- if (getOwner() != null && !initialized) {
-
- try {
- String role = getRole();
- String fieldName = role.substring(role.lastIndexOf(".") + 1);
- log.info("--> Remote Lazy Initializing Collection " + getRole() + " , key : " + getKey() + " , field : " + fieldName);
- Object owner = getOwner();
-
- if(configuration == null) {
- throw new HibernateException("CdmApplicationRemoteConfiguration not initialized (null)");
- }
- ICachedCommonService cachedCommonService = configuration.getCachedCommonService();
- if(cachedCommonService == null) {
- throw new HibernateException("commonService not initialized (null)");
- }
-
- PersistentCollection col = cachedCommonService.initializeCollection(this);
- afterInitialize();
-
- Class<?> clazz = getClass();
- if (clazz != null) {
- CollectionField cf = cachedCommonService.getCollectionField(col);
- cachedCommonService.updatePersistentCollection(cf);
- Field field = clazz.getDeclaredField(cf.getType().toString());
- field.setAccessible(true);
- field.set(this, cf.getCollection());
- }
- } catch (Exception ex) {
- log.warn(ex.getMessage());
- }
- }
- }
-
-
-
-}
-
+++ /dev/null
-/*
- * Hibernate, Relational Persistence for Idiomatic Java
- *
- * Copyright (c) 2008-2011, Red Hat Inc. or third-party contributors as
- * indicated by the @author tags or express copyright attribution
- * statements applied by the authors. All third-party contributions are
- * distributed under license by Red Hat Inc.
- *
- * This copyrighted material is made available to anyone wishing to use, modify,
- * copy, or redistribute it subject to the terms and conditions of the GNU
- * Lesser General Public License, as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
- * for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this distribution; if not, write to:
- * Free Software Foundation, Inc.
- * 51 Franklin Street, Fifth Floor
- * Boston, MA 02110-1301 USA
- */
-package org.hibernate.proxy;
-
-import java.io.Serializable;
-
-import javax.naming.NamingException;
-
-import org.hibernate.HibernateException;
-import org.hibernate.LazyInitializationException;
-import org.hibernate.Session;
-import org.hibernate.SessionException;
-import org.hibernate.TransientObjectException;
-import org.hibernate.engine.spi.EntityKey;
-import org.hibernate.engine.spi.SessionFactoryImplementor;
-import org.hibernate.engine.spi.SessionImplementor;
-import org.hibernate.internal.SessionFactoryRegistry;
-import org.hibernate.persister.entity.EntityPersister;
-import org.jboss.logging.Logger;
-
-import eu.etaxonomy.cdm.api.application.CdmApplicationRemoteConfiguration;
-import eu.etaxonomy.cdm.api.cache.ICachedCommonService;
-import eu.etaxonomy.cdm.model.common.CdmBase;
-
-/**
- * Convenience base class for lazy initialization handlers. Centralizes the basic plumbing of doing lazy
- * initialization freeing subclasses to acts as essentially adapters to their intended entity mode and/or
- * proxy generation strategy.
- *
- * @author Gavin King
- */
-public abstract class AbstractLazyInitializer implements LazyInitializer {
- private static final Logger log = Logger.getLogger( AbstractLazyInitializer.class );
-
- private String entityName;
- private Serializable id;
- private Object target;
- private boolean initialized;
- private boolean readOnly;
- private boolean unwrap;
- private transient SessionImplementor session;
- private Boolean readOnlyBeforeAttachedToSession;
-
- private String sessionFactoryUuid;
- private boolean specjLazyLoad = false;
-
- /**
- * For serialization from the non-pojo initializers (HHH-3309)
- */
- protected AbstractLazyInitializer() {
- }
-
- /**
- * Main constructor.
- *
- * @param entityName The name of the entity being proxied.
- * @param id The identifier of the entity being proxied.
- * @param session The session owning the proxy.
- */
- protected AbstractLazyInitializer(String entityName, Serializable id, SessionImplementor session) {
- this.entityName = entityName;
- this.id = id;
- // initialize other fields depending on session state
- if ( session == null ) {
- unsetSession();
- }
- else {
- setSession( session );
- }
- }
-
- @Override
- public final String getEntityName() {
- return entityName;
- }
-
- @Override
- public final Serializable getIdentifier() {
- return id;
- }
-
- @Override
- public final void setIdentifier(Serializable id) {
- this.id = id;
- }
-
- @Override
- public final boolean isUninitialized() {
- return !initialized;
- }
-
- @Override
- public final SessionImplementor getSession() {
- return session;
- }
-
- @Override
- public final void setSession(SessionImplementor s) throws HibernateException {
- if ( s != session ) {
- // check for s == null first, since it is least expensive
- if ( s == null ) {
- unsetSession();
- }
- else if ( isConnectedToSession() ) {
- //TODO: perhaps this should be some other RuntimeException...
- throw new HibernateException( "illegally attempted to associate a proxy with two open Sessions" );
- }
- else {
- // s != null
- session = s;
- if ( readOnlyBeforeAttachedToSession == null ) {
- // use the default read-only/modifiable setting
- final EntityPersister persister = s.getFactory().getEntityPersister( entityName );
- setReadOnly( s.getPersistenceContext().isDefaultReadOnly() || !persister.isMutable() );
- }
- else {
- // use the read-only/modifiable setting indicated during deserialization
- setReadOnly( readOnlyBeforeAttachedToSession.booleanValue() );
- readOnlyBeforeAttachedToSession = null;
- }
- }
- }
- }
-
- private static EntityKey generateEntityKeyOrNull(Serializable id, SessionImplementor s, String entityName) {
- if ( id == null || s == null || entityName == null ) {
- return null;
- }
- return s.generateEntityKey( id, s.getFactory().getEntityPersister( entityName ) );
- }
-
- @Override
- public final void unsetSession() {
- prepareForPossibleSpecialSpecjInitialization();
- session = null;
- readOnly = false;
- readOnlyBeforeAttachedToSession = null;
- }
-
- @Override
- public final void initialize() throws HibernateException {
- // In remoting we are sure that session is null
- // both when using property paths and switching off conversations
- if(session == null && remoting) {
- remoteInitialize();
- }
- if ( !initialized ) {
- if ( specjLazyLoad ) {
- specialSpecjInitialization();
- }
- else if ( session == null ) {
- throw new LazyInitializationException( "could not initialize proxy - no Session" );
- }
- else if ( !session.isOpen() ) {
- throw new LazyInitializationException( "could not initialize proxy - the owning Session was closed" );
- }
- else if ( !session.isConnected() ) {
- throw new LazyInitializationException( "could not initialize proxy - the owning Session is disconnected" );
- }
- else {
- target = session.immediateLoad( entityName, id );
- initialized = true;
- checkTargetState();
- }
- }
- else {
- checkTargetState();
- }
- }
-
- protected void specialSpecjInitialization() {
- if ( session == null ) {
- //we have a detached collection thats set to null, reattach
- if ( sessionFactoryUuid == null ) {
- throw new LazyInitializationException( "could not initialize proxy - no Session" );
- }
- try {
- SessionFactoryImplementor sf = (SessionFactoryImplementor)
- SessionFactoryRegistry.INSTANCE.getSessionFactory( sessionFactoryUuid );
- SessionImplementor session = (SessionImplementor) sf.openSession();
-
- // TODO: On the next major release, add an
- // 'isJTA' or 'getTransactionFactory' method to Session.
- boolean isJTA = session.getTransactionCoordinator()
- .getTransactionContext().getTransactionEnvironment()
- .getTransactionFactory()
- .compatibleWithJtaSynchronization();
-
- if ( !isJTA ) {
- // Explicitly handle the transactions only if we're not in
- // a JTA environment. A lazy loading temporary session can
- // be created even if a current session and transaction are
- // open (ex: session.clear() was used). We must prevent
- // multiple transactions.
- ( ( Session) session ).beginTransaction();
- }
-
- try {
- target = session.immediateLoad( entityName, id );
- }
- finally {
- // make sure the just opened temp session gets closed!
- try {
- if ( !isJTA ) {
- ( ( Session) session ).getTransaction().commit();
- }
- ( (Session) session ).close();
- }
- catch (Exception e) {
- log.warn( "Unable to close temporary session used to load lazy proxy associated to no session" );
- }
- }
- initialized = true;
- checkTargetState();
- }
- catch (Exception e) {
- e.printStackTrace();
- throw new LazyInitializationException( e.getMessage() );
- }
- }
- else if ( session.isOpen() && session.isConnected() ) {
- target = session.immediateLoad( entityName, id );
- initialized = true;
- checkTargetState();
- }
- else {
- throw new LazyInitializationException( "could not initialize proxy - Session was closed or disced" );
- }
- }
-
- protected void prepareForPossibleSpecialSpecjInitialization() {
- if ( session != null ) {
- specjLazyLoad = session.getFactory().getSettings().isInitializeLazyStateOutsideTransactionsEnabled();
-
- if ( specjLazyLoad && sessionFactoryUuid == null ) {
- try {
- sessionFactoryUuid = (String) session.getFactory().getReference().get( "uuid" ).getContent();
- }
- catch (NamingException e) {
- //not much we can do if this fails...
- }
- }
- }
- }
-
- private void checkTargetState() {
- if ( !unwrap ) {
- if ( target == null ) {
- getSession().getFactory().getEntityNotFoundDelegate().handleEntityNotFound( entityName, id );
- }
- }
- }
-
- /**
- * Getter for property 'connectedToSession'.
- *
- * @return Value for property 'connectedToSession'.
- */
- protected final boolean isConnectedToSession() {
- return getProxyOrNull() != null;
- }
-
- private Object getProxyOrNull() {
- final EntityKey entityKey = generateEntityKeyOrNull( getIdentifier(), session, getEntityName() );
- if ( entityKey != null && session != null && session.isOpen() ) {
- return session.getPersistenceContext().getProxy( entityKey );
- }
- return null;
- }
-
- @Override
- public final Object getImplementation() {
- initialize();
- return target;
- }
-
- @Override
- public final void setImplementation(Object target) {
- this.target = target;
- initialized = true;
- }
-
- @Override
- public final Object getImplementation(SessionImplementor s) throws HibernateException {
- final EntityKey entityKey = generateEntityKeyOrNull( getIdentifier(), s, getEntityName() );
- return (entityKey == null ? null : s.getPersistenceContext().getEntity( entityKey ));
- }
-
- /**
- * Getter for property 'target'.
- * <p/>
- * Same as {@link #getImplementation()} except that this method will not force initialization.
- *
- * @return Value for property 'target'.
- */
- protected final Object getTarget() {
- return target;
- }
-
- @Override
- public final boolean isReadOnlySettingAvailable() {
- return (session != null && !session.isClosed());
- }
-
- private void errorIfReadOnlySettingNotAvailable() {
- if ( session == null ) {
- throw new TransientObjectException(
- "Proxy is detached (i.e, session is null). The read-only/modifiable setting is only accessible when the proxy is associated with an open session."
- );
- }
- if ( session.isClosed() ) {
- throw new SessionException(
- "Session is closed. The read-only/modifiable setting is only accessible when the proxy is associated with an open session."
- );
- }
- }
-
- @Override
- public final boolean isReadOnly() {
- errorIfReadOnlySettingNotAvailable();
- return readOnly;
- }
-
- @Override
- public final void setReadOnly(boolean readOnly) {
- errorIfReadOnlySettingNotAvailable();
- // only update if readOnly is different from current setting
- if ( this.readOnly != readOnly ) {
- final EntityPersister persister = session.getFactory().getEntityPersister( entityName );
- if ( !persister.isMutable() && !readOnly ) {
- throw new IllegalStateException( "cannot make proxies for immutable entities modifiable" );
- }
- this.readOnly = readOnly;
- if ( initialized ) {
- EntityKey key = generateEntityKeyOrNull( getIdentifier(), session, getEntityName() );
- if ( key != null && session.getPersistenceContext().containsEntity( key ) ) {
- session.getPersistenceContext().setReadOnly( target, readOnly );
- }
- }
- }
- }
-
- /**
- * Get the read-only/modifiable setting that should be put in affect when it is
- * attached to a session.
- * <p/>
- * This method should only be called during serialization when read-only/modifiable setting
- * is not available (i.e., isReadOnlySettingAvailable() == false)
- *
- * @return null, if the default setting should be used;
- * true, for read-only;
- * false, for modifiable
- *
- * @throws IllegalStateException if isReadOnlySettingAvailable() == true
- */
- protected final Boolean isReadOnlyBeforeAttachedToSession() {
- if ( isReadOnlySettingAvailable() ) {
- throw new IllegalStateException(
- "Cannot call isReadOnlyBeforeAttachedToSession when isReadOnlySettingAvailable == true"
- );
- }
- return readOnlyBeforeAttachedToSession;
- }
-
- /**
- * Set the read-only/modifiable setting that should be put in affect when it is
- * attached to a session.
- * <p/>
- * This method should only be called during deserialization, before associating
- * the proxy with a session.
- *
- * @param readOnlyBeforeAttachedToSession, the read-only/modifiable setting to use when
- * associated with a session; null indicates that the default should be used.
- *
- * @throws IllegalStateException if isReadOnlySettingAvailable() == true
- */
- /* package-private */
- final void setReadOnlyBeforeAttachedToSession(Boolean readOnlyBeforeAttachedToSession) {
- if ( isReadOnlySettingAvailable() ) {
- throw new IllegalStateException(
- "Cannot call setReadOnlyBeforeAttachedToSession when isReadOnlySettingAvailable == true"
- );
- }
- this.readOnlyBeforeAttachedToSession = readOnlyBeforeAttachedToSession;
- }
-
- @Override
- public boolean isUnwrap() {
- return unwrap;
- }
-
- @Override
- public void setUnwrap(boolean unwrap) {
- this.unwrap = unwrap;
- }
-
- /** Below is section of code which makes remote service calls */
-
- private static CdmApplicationRemoteConfiguration configuration;
- private static boolean remoting = false;
-
- public static void setConfiguration(CdmApplicationRemoteConfiguration conf) {
- remoting = true;
- configuration = conf;
- }
-
-
- private void remoteInitialize() {
-
- if(!initialized) {
- int classid = ((Integer)getIdentifier()).intValue();
- log.info("--> Remote Lazy Initializing Object " + getEntityName() + " with id " + classid);
- Class clazz;
- try {
- clazz = Class.forName(getEntityName());
- } catch (ClassNotFoundException e) {
- throw new HibernateException("Class for " + getEntityName() + " not found", e);
- }
- if(configuration == null) {
- throw new HibernateException("CdmApplicationRemoteConfiguration not initialized (null)");
- }
- ICachedCommonService cachedCommonService = configuration.getCachedCommonService();
- if(cachedCommonService == null) {
- throw new HibernateException("commonService not initialized (null)");
- }
-
- CdmBase cdmBase = CdmBase.deproxy(cachedCommonService.find(clazz,classid),clazz);
- setImplementation(cdmBase);
-
- }
- }
-
- public static boolean isInitialized(AbstractLazyInitializer obj) {
- return obj.initialized;
- }
-}
+++ /dev/null
-cdmlib-remote-webapp.war
+++ /dev/null
-serverName=localhost:8080
-contextPath=remoting
+++ /dev/null
-<?xml version="1.0" encoding="UTF-8"?>\r
-<beans xmlns="http://www.springframework.org/schema/beans"\r
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"\r
- xmlns:context="http://www.springframework.org/schema/context"\r
- xmlns:tx="http://www.springframework.org/schema/tx"\r
- xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd\r
- http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.5.xsd\r
- http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-2.5.xsd">\r
-\r
- \r
- <bean id="agentService"\r
- class="org.springframework.remoting.httpinvoker.HttpInvokerProxyFactoryBean">\r
- <property name="serviceUrl">\r
- <value>http://${remoteServer}:${remotePort}/${remoteContext}/remoting/agent.service</value>\r
- </property>\r
- <property name="serviceInterface">\r
- <value>eu.etaxonomy.cdm.api.service.IAgentService</value>\r
- </property>\r
- <property name="httpInvokerRequestExecutor">\r
- <bean class="org.springframework.security.remoting.httpinvoker.AuthenticationSimpleHttpInvokerRequestExecutor" />\r
- </property>\r
- </bean>\r
-\r
- <bean id="annotationService"\r
- class="org.springframework.remoting.httpinvoker.HttpInvokerProxyFactoryBean">\r
- <property name="serviceUrl">\r
- <value>http://${remoteServer}:${remotePort}/${remoteContext}/remoting/annotation.service</value>\r
- </property>\r
- <property name="serviceInterface">\r
- <value>eu.etaxonomy.cdm.api.service.IAnnotationService</value>\r
- </property>\r
- <property name="httpInvokerRequestExecutor">\r
- <bean class="org.springframework.security.remoting.httpinvoker.AuthenticationSimpleHttpInvokerRequestExecutor" />\r
- </property>\r
- </bean>\r
-\r
- <bean id="auditeventService"\r
- class="org.springframework.remoting.httpinvoker.HttpInvokerProxyFactoryBean">\r
- <property name="serviceUrl">\r
- <value>http://${remoteServer}:${remotePort}/${remoteContext}/remoting/auditevent.service</value>\r
- </property>\r
- <property name="serviceInterface">\r
- <value>eu.etaxonomy.cdm.api.service.IAuditEventService</value>\r
- </property>\r
- <property name="httpInvokerRequestExecutor">\r
- <bean class="org.springframework.security.remoting.httpinvoker.AuthenticationSimpleHttpInvokerRequestExecutor" />\r
- </property>\r
- </bean>\r
-\r
- <bean id="classificationService"\r
- class="org.springframework.remoting.httpinvoker.HttpInvokerProxyFactoryBean">\r
- <property name="serviceUrl">\r
- <value>http://${remoteServer}:${remotePort}/${remoteContext}/remoting/classification.service</value>\r
- </property>\r
- <property name="serviceInterface">\r
- <value>eu.etaxonomy.cdm.api.service.IClassificationService</value>\r
- </property>\r
- <property name="httpInvokerRequestExecutor">\r
- <bean class="org.springframework.security.remoting.httpinvoker.AuthenticationSimpleHttpInvokerRequestExecutor" />\r
- </property>\r
- </bean>\r
-\r
- <bean id="collectionService"\r
- class="org.springframework.remoting.httpinvoker.HttpInvokerProxyFactoryBean">\r
- <property name="serviceUrl">\r
- <value>http://${remoteServer}:${remotePort}/${remoteContext}/remoting/collection.service</value>\r
- </property>\r
- <property name="serviceInterface">\r
- <value>eu.etaxonomy.cdm.api.service.ICollectionService</value>\r
- </property>\r
- <property name="httpInvokerRequestExecutor">\r
- <bean class="org.springframework.security.remoting.httpinvoker.AuthenticationSimpleHttpInvokerRequestExecutor" />\r
- </property>\r
- </bean>\r
-\r
- <bean id="commonService"\r
- class="org.springframework.remoting.httpinvoker.HttpInvokerProxyFactoryBean">\r
- <property name="serviceUrl">\r
- <value>http://${remoteServer}:${remotePort}/${remoteContext}/remoting/common.service</value>\r
- </property>\r
- <property name="serviceInterface">\r
- <value>eu.etaxonomy.cdm.api.service.ICommonService</value>\r
- </property>\r
- <property name="httpInvokerRequestExecutor">\r
- <bean class="org.springframework.security.remoting.httpinvoker.AuthenticationSimpleHttpInvokerRequestExecutor" />\r
- </property>\r
- </bean>\r
-\r
- <bean id="descriptionService"\r
- class="org.springframework.remoting.httpinvoker.HttpInvokerProxyFactoryBean">\r
- <property name="serviceUrl">\r
- <value>http://${remoteServer}:${remotePort}/${remoteContext}/remoting/description.service</value>\r
- </property>\r
- <property name="serviceInterface">\r
- <value>eu.etaxonomy.cdm.api.service.IDescriptionService</value>\r
- </property>\r
- <property name="httpInvokerRequestExecutor">\r
- <bean class="org.springframework.security.remoting.httpinvoker.AuthenticationSimpleHttpInvokerRequestExecutor" />\r
- </property>\r
- </bean>\r
- \r
- <bean id="editGeoService"\r
- class="org.springframework.remoting.httpinvoker.HttpInvokerProxyFactoryBean">\r
- <property name="serviceUrl">\r
- <value>http://${remoteServer}:${remotePort}/${remoteContext}/remoting/editgeo.service</value>\r
- </property>\r
- <property name="serviceInterface">\r
- <value>eu.etaxonomy.cdm.ext.geo.IEditGeoService</value>\r
- </property>\r
- <property name="httpInvokerRequestExecutor">\r
- <bean class="org.springframework.security.remoting.httpinvoker.AuthenticationSimpleHttpInvokerRequestExecutor" />\r
- </property>\r
- </bean>\r
-\r
- <bean id="featureNodeService"\r
- class="org.springframework.remoting.httpinvoker.HttpInvokerProxyFactoryBean">\r
- <property name="serviceUrl">\r
- <value>http://${remoteServer}:${remotePort}/${remoteContext}/remoting/featurenode.service</value>\r
- </property>\r
- <property name="serviceInterface">\r
- <value>eu.etaxonomy.cdm.api.service.IFeatureNodeService</value>\r
- </property>\r
- <property name="httpInvokerRequestExecutor">\r
- <bean class="org.springframework.security.remoting.httpinvoker.AuthenticationSimpleHttpInvokerRequestExecutor" />\r
- </property>\r
- </bean>\r
-\r
- <bean id="featureTreeService"\r
- class="org.springframework.remoting.httpinvoker.HttpInvokerProxyFactoryBean">\r
- <property name="serviceUrl">\r
- <value>http://${remoteServer}:${remotePort}/${remoteContext}/remoting/featuretree.service</value>\r
- </property>\r
- <property name="serviceInterface">\r
- <value>eu.etaxonomy.cdm.api.service.IFeatureTreeService</value>\r
- </property>\r
- <property name="httpInvokerRequestExecutor">\r
- <bean class="org.springframework.security.remoting.httpinvoker.AuthenticationSimpleHttpInvokerRequestExecutor" />\r
- </property>\r
- </bean>\r
-\r
- <bean id="groupService"\r
- class="org.springframework.remoting.httpinvoker.HttpInvokerProxyFactoryBean">\r
- <property name="serviceUrl">\r
- <value>http://${remoteServer}:${remotePort}/${remoteContext}/remoting/group.service</value>\r
- </property>\r
- <property name="serviceInterface">\r
- <value>eu.etaxonomy.cdm.api.service.IGroupService</value>\r
- </property>\r
- <property name="httpInvokerRequestExecutor">\r
- <bean class="org.springframework.security.remoting.httpinvoker.AuthenticationSimpleHttpInvokerRequestExecutor" />\r
- </property>\r
- </bean>\r
-\r
- <bean id="identificationKeyService"\r
- class="org.springframework.remoting.httpinvoker.HttpInvokerProxyFactoryBean">\r
- <property name="serviceUrl">\r
- <value>http://${remoteServer}:${remotePort}/${remoteContext}/remoting/identificationkey.service</value>\r
- </property>\r
- <property name="serviceInterface">\r
- <value>eu.etaxonomy.cdm.api.service.IIdentificationKeyService</value>\r
- </property>\r
- <property name="httpInvokerRequestExecutor">\r
- <bean class="org.springframework.security.remoting.httpinvoker.AuthenticationSimpleHttpInvokerRequestExecutor" />\r
- </property>\r
- </bean>\r
-\r
- <bean id="locationService"\r
- class="org.springframework.remoting.httpinvoker.HttpInvokerProxyFactoryBean">\r
- <property name="serviceUrl">\r
- <value>http://${remoteServer}:${remotePort}/${remoteContext}/remoting/location.service</value>\r
- </property>\r
- <property name="serviceInterface">\r
- <value>eu.etaxonomy.cdm.api.service.ILocationService</value>\r
- </property>\r
- <property name="httpInvokerRequestExecutor">\r
- <bean class="org.springframework.security.remoting.httpinvoker.AuthenticationSimpleHttpInvokerRequestExecutor" />\r
- </property>\r
- </bean>\r
-\r
- <bean id="markerService"\r
- class="org.springframework.remoting.httpinvoker.HttpInvokerProxyFactoryBean">\r
- <property name="serviceUrl">\r
- <value>http://${remoteServer}:${remotePort}/${remoteContext}/remoting/marker.service</value>\r
- </property>\r
- <property name="serviceInterface">\r
- <value>eu.etaxonomy.cdm.api.service.IMarkerService</value>\r
- </property>\r
- <property name="httpInvokerRequestExecutor">\r
- <bean class="org.springframework.security.remoting.httpinvoker.AuthenticationSimpleHttpInvokerRequestExecutor" />\r
- </property>\r
- </bean>\r
-\r
- <bean id="mediaService"\r
- class="org.springframework.remoting.httpinvoker.HttpInvokerProxyFactoryBean">\r
- <property name="serviceUrl">\r
- <value>http://${remoteServer}:${remotePort}/${remoteContext}/remoting/media.service</value>\r
- </property>\r
- <property name="serviceInterface">\r
- <value>eu.etaxonomy.cdm.api.service.IMediaService</value>\r
- </property>\r
- <property name="httpInvokerRequestExecutor">\r
- <bean class="org.springframework.security.remoting.httpinvoker.AuthenticationSimpleHttpInvokerRequestExecutor" />\r
- </property>\r
- </bean>\r
-\r
- <bean id="nameService"\r
- class="org.springframework.remoting.httpinvoker.HttpInvokerProxyFactoryBean">\r
- <property name="serviceUrl">\r
- <value>http://${remoteServer}:${remotePort}/${remoteContext}/remoting/name.service</value>\r
- </property>\r
- <property name="serviceInterface">\r
- <value>eu.etaxonomy.cdm.api.service.INameService</value>\r
- </property>\r
- <property name="httpInvokerRequestExecutor">\r
- <bean class="org.springframework.security.remoting.httpinvoker.AuthenticationSimpleHttpInvokerRequestExecutor" />\r
- </property>\r
- </bean>\r
-\r
- <bean id="occurrenceService"\r
- class="org.springframework.remoting.httpinvoker.HttpInvokerProxyFactoryBean">\r
- <property name="serviceUrl">\r
- <value>http://${remoteServer}:${remotePort}/${remoteContext}/remoting/occurrence.service</value>\r
- </property>\r
- <property name="serviceInterface">\r
- <value>eu.etaxonomy.cdm.api.service.IOccurrenceService</value>\r
- </property>\r
- <property name="httpInvokerRequestExecutor">\r
- <bean class="org.springframework.security.remoting.httpinvoker.AuthenticationSimpleHttpInvokerRequestExecutor" />\r
- </property>\r
- </bean>\r
-\r
- <bean id="polytomousKeyNodeService"\r
- class="org.springframework.remoting.httpinvoker.HttpInvokerProxyFactoryBean">\r
- <property name="serviceUrl">\r
- <value>http://${remoteServer}:${remotePort}/${remoteContext}/remoting/polytomouskeynode.service</value>\r
- </property>\r
- <property name="serviceInterface">\r
- <value>eu.etaxonomy.cdm.api.service.IPolytomousKeyNodeService</value>\r
- </property>\r
- <property name="httpInvokerRequestExecutor">\r
- <bean class="org.springframework.security.remoting.httpinvoker.AuthenticationSimpleHttpInvokerRequestExecutor" />\r
- </property>\r
- </bean>\r
-\r
- <bean id="polytomousKeyService"\r
- class="org.springframework.remoting.httpinvoker.HttpInvokerProxyFactoryBean">\r
- <property name="serviceUrl">\r
- <value>http://${remoteServer}:${remotePort}/${remoteContext}/remoting/polytomouskey.service</value>\r
- </property>\r
- <property name="serviceInterface">\r
- <value>eu.etaxonomy.cdm.api.service.IPolytomousKeyService</value>\r
- </property>\r
- <property name="httpInvokerRequestExecutor">\r
- <bean class="org.springframework.security.remoting.httpinvoker.AuthenticationSimpleHttpInvokerRequestExecutor" />\r
- </property>\r
- </bean>\r
-\r
- <bean id="referenceService"\r
- class="org.springframework.remoting.httpinvoker.HttpInvokerProxyFactoryBean">\r
- <property name="serviceUrl">\r
- <value>http://${remoteServer}:${remotePort}/${remoteContext}/remoting/reference.service</value>\r
- </property>\r
- <property name="serviceInterface">\r
- <value>eu.etaxonomy.cdm.api.service.IReferenceService</value>\r
- </property>\r
- <property name="httpInvokerRequestExecutor">\r
- <bean class="org.springframework.security.remoting.httpinvoker.AuthenticationSimpleHttpInvokerRequestExecutor" />\r
- </property>\r
- </bean>\r
- \r
-<!-- \r
- <bean id="serviceService"\r
- class="org.springframework.remoting.httpinvoker.HttpInvokerProxyFactoryBean">\r
- <property name="serviceUrl">\r
- <value>http://${remoteServer}:${remotePort}/${remoteContext}/remoting/service.service</value>\r
- </property>\r
- <property name="serviceInterface">\r
- <value>eu.etaxonomy.cdm.api.service.IService</value>\r
- </property>\r
- </bean>\r
- -->\r
- \r
- <bean id="taxonNodeService"\r
- class="org.springframework.remoting.httpinvoker.HttpInvokerProxyFactoryBean">\r
- <property name="serviceUrl">\r
- <value>http://${remoteServer}:${remotePort}/${remoteContext}/remoting/taxonnode.service</value>\r
- </property>\r
- <property name="serviceInterface">\r
- <value>eu.etaxonomy.cdm.api.service.ITaxonNodeService</value>\r
- </property>\r
- <property name="httpInvokerRequestExecutor">\r
- <bean class="org.springframework.security.remoting.httpinvoker.AuthenticationSimpleHttpInvokerRequestExecutor" />\r
- </property>\r
- </bean>\r
-\r
- <bean id="taxonService"\r
- class="org.springframework.remoting.httpinvoker.HttpInvokerProxyFactoryBean">\r
- <property name="serviceUrl">\r
- <value>http://${remoteServer}:${remotePort}/${remoteContext}/remoting/taxon.service</value>\r
- </property>\r
- <property name="serviceInterface">\r
- <value>eu.etaxonomy.cdm.api.service.ITaxonService</value>\r
- </property>\r
- <property name="httpInvokerRequestExecutor">\r
- <bean class="org.springframework.security.remoting.httpinvoker.AuthenticationSimpleHttpInvokerRequestExecutor" />\r
- </property>\r
- </bean>\r
-\r
- <bean id="termService"\r
- class="org.springframework.remoting.httpinvoker.HttpInvokerProxyFactoryBean">\r
- <property name="serviceUrl">\r
- <value>http://${remoteServer}:${remotePort}/${remoteContext}/remoting/term.service</value>\r
- </property>\r
- <property name="serviceInterface">\r
- <value>eu.etaxonomy.cdm.api.service.ITermService</value>\r
- </property>\r
- <property name="httpInvokerRequestExecutor">\r
- <bean class="org.springframework.security.remoting.httpinvoker.AuthenticationSimpleHttpInvokerRequestExecutor" />\r
- </property>\r
- </bean>\r
-\r
- <bean id="userService"\r
- class="org.springframework.remoting.httpinvoker.HttpInvokerProxyFactoryBean">\r
- <property name="serviceUrl">\r
- <value>http://${remoteServer}:${remotePort}/${remoteContext}/remoting/user.service</value>\r
- </property>\r
- <property name="serviceInterface">\r
- <value>eu.etaxonomy.cdm.api.service.IUserService</value>\r
- </property>\r
- <property name="httpInvokerRequestExecutor">\r
- <bean class="org.springframework.security.remoting.httpinvoker.AuthenticationSimpleHttpInvokerRequestExecutor" />\r
- </property>\r
- </bean>\r
-\r
- <bean id="vocabularyService"\r
- class="org.springframework.remoting.httpinvoker.HttpInvokerProxyFactoryBean">\r
- <property name="serviceUrl">\r
- <value>http://${remoteServer}:${remotePort}/${remoteContext}/remoting/vocabulary.service</value>\r
- </property>\r
- <property name="serviceInterface">\r
- <value>eu.etaxonomy.cdm.api.service.IVocabularyService</value>\r
- </property>\r
- <property name="httpInvokerRequestExecutor">\r
- <bean class="org.springframework.security.remoting.httpinvoker.AuthenticationSimpleHttpInvokerRequestExecutor" />\r
- </property>\r
- </bean>\r
-\r
- <bean id="workingSetService"\r
- class="org.springframework.remoting.httpinvoker.HttpInvokerProxyFactoryBean">\r
- <property name="serviceUrl">\r
- <value>http://${remoteServer}:${remotePort}/${remoteContext}/remoting/workingset.service</value>\r
- </property>\r
- <property name="serviceInterface">\r
- <value>eu.etaxonomy.cdm.api.service.IWorkingSetService</value>\r
- </property>\r
- <property name="httpInvokerRequestExecutor">\r
- <bean class="org.springframework.security.remoting.httpinvoker.AuthenticationSimpleHttpInvokerRequestExecutor" />\r
- </property>\r
- </bean>\r
- \r
- <bean id="grantedAuthorityService"\r
- class="org.springframework.remoting.httpinvoker.HttpInvokerProxyFactoryBean">\r
- <property name="serviceUrl">\r
- <value>http://${remoteServer}:${remotePort}/${remoteContext}/remoting/grantedauthority.service</value>\r
- </property>\r
- <property name="serviceInterface">\r
- <value>eu.etaxonomy.cdm.api.service.IGrantedAuthorityService</value>\r
- </property>\r
- <property name="httpInvokerRequestExecutor">\r
- <bean class="org.springframework.security.remoting.httpinvoker.AuthenticationSimpleHttpInvokerRequestExecutor" />\r
- </property>\r
- </bean>\r
- \r
- <bean id="databaseService"\r
- class="org.springframework.remoting.httpinvoker.HttpInvokerProxyFactoryBean">\r
- <property name="serviceUrl">\r
- <value>http://${remoteServer}:${remotePort}/${remoteContext}/remoting/database.service</value>\r
- </property>\r
- <property name="serviceInterface">\r
- <value>eu.etaxonomy.cdm.api.service.IDatabaseService</value>\r
- </property>\r
- <property name="httpInvokerRequestExecutor">\r
- <bean class="org.springframework.security.remoting.httpinvoker.AuthenticationSimpleHttpInvokerRequestExecutor" />\r
- </property>\r
- </bean>\r
- \r
- <bean id="lsidAuthorityService"\r
- class="org.springframework.remoting.httpinvoker.HttpInvokerProxyFactoryBean">\r
- <property name="serviceUrl">\r
- <value>http://${remoteServer}:${remotePort}/${remoteContext}/remoting/lsidauthoruty.service</value>\r
- </property>\r
- <property name="serviceInterface">\r
- <value>eu.etaxonomy.cdm.api.service.lsid.LSIDAuthorityService</value>\r
- </property>\r
- <property name="httpInvokerRequestExecutor">\r
- <bean class="org.springframework.security.remoting.httpinvoker.AuthenticationSimpleHttpInvokerRequestExecutor" />\r
- </property>\r
- </bean>\r
- \r
- <bean id="lsidMetadataService"\r
- class="org.springframework.remoting.httpinvoker.HttpInvokerProxyFactoryBean">\r
- <property name="serviceUrl">\r
- <value>http://${remoteServer}:${remotePort}/${remoteContext}/remoting/lsidmetadata.service</value>\r
- </property>\r
- <property name="serviceInterface">\r
- <value>eu.etaxonomy.cdm.api.service.lsid.LSIDMetadataService</value>\r
- </property>\r
- <property name="httpInvokerRequestExecutor">\r
- <bean class="org.springframework.security.remoting.httpinvoker.AuthenticationSimpleHttpInvokerRequestExecutor" />\r
- </property>\r
- </bean>\r
- \r
- <bean id="lsiDataService"\r
- class="org.springframework.remoting.httpinvoker.HttpInvokerProxyFactoryBean">\r
- <property name="serviceUrl">\r
- <value>http://${remoteServer}:${remotePort}/${remoteContext}/remoting/lsiddata.service</value>\r
- </property>\r
- <property name="serviceInterface">\r
- <value>eu.etaxonomy.cdm.api.service.lsid.LSIDDataService</value>\r
- </property>\r
- <property name="httpInvokerRequestExecutor">\r
- <bean class="org.springframework.security.remoting.httpinvoker.AuthenticationSimpleHttpInvokerRequestExecutor" />\r
- </property>\r
- </bean>\r
-\r
- <bean id="providerManager"\r
- class="org.springframework.remoting.httpinvoker.HttpInvokerProxyFactoryBean">\r
- <property name="serviceUrl">\r
- <value>http://${remoteServer}:${remotePort}/${remoteContext}/remoting/authenticationManager.service</value>\r
- </property>\r
- <property name="serviceInterface">\r
- <value>org.springframework.security.authentication.AuthenticationManager</value>\r
- </property>\r
- <property name="httpInvokerRequestExecutor">\r
- <bean class="org.springframework.security.remoting.httpinvoker.AuthenticationSimpleHttpInvokerRequestExecutor" />\r
- </property>\r
- </bean>\r
- \r
- <bean id="primerService"\r
- class="org.springframework.remoting.httpinvoker.HttpInvokerProxyFactoryBean">\r
- <property name="serviceUrl">\r
- <value>http://${remoteServer}:${remotePort}/${remoteContext}/remoting/primer.service</value>\r
- </property>\r
- <property name="serviceInterface">\r
- <value>eu.etaxonomy.cdm.api.service.molecular.IPrimerService</value>\r
- </property>\r
- <property name="httpInvokerRequestExecutor">\r
- <bean class="org.springframework.security.remoting.httpinvoker.AuthenticationSimpleHttpInvokerRequestExecutor" />\r
- </property>\r
- </bean>\r
- \r
- <bean id="amplificationService"\r
- class="org.springframework.remoting.httpinvoker.HttpInvokerProxyFactoryBean">\r
- <property name="serviceUrl">\r
- <value>http://${remoteServer}:${remotePort}/${remoteContext}/remoting/amplification.service</value>\r
- </property>\r
- <property name="serviceInterface">\r
- <value>eu.etaxonomy.cdm.api.service.molecular.IAmplificationService</value>\r
- </property>\r
- <property name="httpInvokerRequestExecutor">\r
- <bean class="org.springframework.security.remoting.httpinvoker.AuthenticationSimpleHttpInvokerRequestExecutor" />\r
- </property>\r
- </bean>\r
- \r
- <bean id="sequenceService"\r
- class="org.springframework.remoting.httpinvoker.HttpInvokerProxyFactoryBean">\r
- <property name="serviceUrl">\r
- <value>http://${remoteServer}:${remotePort}/${remoteContext}/remoting/sequence.service</value>\r
- </property>\r
- <property name="serviceInterface">\r
- <value>eu.etaxonomy.cdm.api.service.molecular.ISequenceService</value>\r
- </property>\r
- <property name="httpInvokerRequestExecutor">\r
- <bean class="org.springframework.security.remoting.httpinvoker.AuthenticationSimpleHttpInvokerRequestExecutor" />\r
- </property>\r
- </bean>\r
-\r
-\r
-\r
-</beans>\r
+++ /dev/null
-<?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"
- xmlns:tx="http://www.springframework.org/schema/tx"
- xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
- http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.5.xsd
- http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-2.5.xsd">
-
-
- <!-- Default application context and term initializer -->
- <import resource="classpath:/eu/etaxonomy/cdm/defaultApplicationContext.xml"/>
- <bean id="persistentTermInitializer" class="eu.etaxonomy.cdm.database.PersistentTermInitializer">
- <property name="omit" value="false" />
- </bean>
-
- <import resource="classpath:/eu/etaxonomy/cdm/remote.xml"/>
- <import resource="classpath:eu/etaxonomy/cdm/remote/json/jsonConfigurations.xml"/>
-
- <context:component-scan base-package="eu/etaxonomy/cdm/ext"/>
-
- <context:component-scan base-package="eu/etaxonomy/cdm/remote">
- <context:exclude-filter type="regex" expression="eu\.etaxonomy\.cdm\.remote\.config\.DataSourceConfigurer" />
- <context:exclude-filter type="regex" expression="eu\.etaxonomy\.cdm\.remote\.config\.LoggingConfigurer" />
- <context:exclude-filter type="regex" expression="eu\.etaxonomy\.cdm\.remote\.view\.PatternViewResolver" />
- <context:exclude-filter type="regex" expression="eu\.etaxonomy\.cdm\.remote\.vaadin\..*" />
- <context:exclude-filter type="regex" expression="eu\.etaxonomy\.cdm\.remote\.controller\..*Portal.*" />
- </context:component-scan>
-
-
-</beans>
+++ /dev/null
-<?xml version="1.0" encoding="UTF-8"?>\r
-<beans xmlns="http://www.springframework.org/schema/beans"\r
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"\r
- xmlns:context="http://www.springframework.org/schema/context"\r
- xmlns:tx="http://www.springframework.org/schema/tx"\r
- xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
- http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.5.xsd
- http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-2.5.xsd">\r
- \r
- \r
- <!-- <bean id="remoteTermInitializer" class="eu.etaxonomy.cdm.remote.service.RemoteTermInitializer"/>-->\r
- \r
- <context:annotation-config/>\r
- \r
- <import resource="classpath:/eu/etaxonomy/cdm/httpInvokerServiceClients.xml"/>\r
- \r
- <bean id="cdmApplicationRemoteConfiguration" class="eu.etaxonomy.cdm.api.application.CdmApplicationRemoteConfiguration"/> \r
- \r
- <import resource="classpath:/eu/etaxonomy/cdm/remoting_services_security.xml"/> \r
- \r
- <context:component-scan base-package="eu/etaxonomy/cdm/api/cache">\r
- <!-- FIXME:Remoting Temp workaround to make remoting work-->\r
- <context:exclude-filter type="regex" expression="eu\.etaxonomy\.cdm\.api\.cache\.CdmDaoCacher" /> \r
- </context:component-scan>\r
- \r
- \r
- <!-- EditGeoService was moved to ext. Therefore it will not be found by the default component scan.
- We added it here because the Editor needs it. However, this is only a temporary solution.
- In the future we want to pass in an application context with the editor. -->\r
-\r
-\r
- <!-- <bean id="conversationHolder" class="eu.etaxonomy.cdm.api.conversation.ConversationHolder" scope="prototype"/> -->\r
-\r
- <!-- TODO move to io -->\r
-<!-- \r
- <context:component-scan base-package="eu/etaxonomy/cdm/io">\r
- <context:exclude-filter type="regex" expression="eu\.etaxonomy\.cdm\.io\.berlinModel.*" />\r
- </context:component-scan>\r
- -->\r
- <!-- enable the configuration of transactional behavior based on annotations -->\r
- <!-- <tx:annotation-driven transaction-manager="transactionManager"/> -->\r
-\r
-</beans>\r
+++ /dev/null
-<?xml version="1.0" encoding="UTF-8"?>\r
-<beans xmlns="http://www.springframework.org/schema/beans"\r
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:context="http://www.springframework.org/schema/context"\r
- xmlns:tx="http://www.springframework.org/schema/tx" xmlns:aop="http://www.springframework.org/schema/aop"\r
- xsi:schemaLocation="http://www.springframework.org/schema/beans\r
- http://www.springframework.org/schema/beans/spring-beans-3.0.xsd\r
- http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd\r
- http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.0.xsd\r
- http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-3.0.xsd\r
- ">\r
-\r
-\r
- <!--\r
- ============================== SECURITY ==============================\r
- -->\r
- <bean id="accessDecisionManager" class="eu.etaxonomy.cdm.persistence.hibernate.permission.UnanimousBasedUnrevokable">\r
- <property name="decisionVoters">\r
- <list>\r
- <bean class="eu.etaxonomy.cdm.persistence.hibernate.permission.voter.GrantAlwaysVoter" />\r
- <bean class="eu.etaxonomy.cdm.persistence.hibernate.permission.voter.TaxonNodeVoter" />\r
- <bean class="eu.etaxonomy.cdm.persistence.hibernate.permission.voter.TaxonBaseVoter" />\r
- <bean class="eu.etaxonomy.cdm.persistence.hibernate.permission.voter.DescriptionBaseVoter" />\r
- <bean class="eu.etaxonomy.cdm.persistence.hibernate.permission.voter.DescriptionElementVoter" />\r
- </list>\r
- </property>\r
- </bean>\r
-\r
- <!--\r
- CdmPermissionEvaluator.hasPermissions() evaluates the CdmPermissions like TAXONNODE.UPDATE{20c8f083-5870-4cbd-bf56-c5b2b98ab6a7}\r
- -->\r
- <bean id="cdmPermissionEvaluator" class="eu.etaxonomy.cdm.persistence.hibernate.permission.CdmPermissionEvaluator">\r
- <property name="accessDecisionManager" ref="accessDecisionManager" />\r
- </bean>\r
-\r
- <!-- The CdmSecurityHibernateInterceptor checks onSave() and on flushDirty() if the currently authenticated principal or token has\r
- sufficient permissions on the entity to be persisted -->\r
- <bean id="securityHibernateInterceptor" class="eu.etaxonomy.cdm.persistence.hibernate.CdmSecurityHibernateInterceptor">\r
- <property name="permissionEvaluator" ref="cdmPermissionEvaluator" />\r
- </bean>\r
-\r
-</beans>\r
+++ /dev/null
-<?xml version="1.0" encoding="UTF-8"?>\r
-<beans xmlns="http://www.springframework.org/schema/beans"\r
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"\r
- xmlns:context="http://www.springframework.org/schema/context"\r
- xmlns:security="http://www.springframework.org/schema/security"\r
- xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd\r
- http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.0.xsd\r
- http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd\r
- http://www.springframework.org/schema/security http://www.springframework.org/schema/security/spring-security-3.1.xsd"\r
- >\r
-\r
- <import resource="classpath:/eu/etaxonomy/cdm/remoting_persistence_security.xml"/>\r
- <!--\r
- ======================================================================\r
- security specific configuration\r
- ======================================================================\r
- -->\r
- <security:global-method-security pre-post-annotations="enabled" run-as-manager-ref="runAsManager" >\r
- <security:expression-handler ref="expressionHandler" />\r
- </security:global-method-security>\r
-\r
- <!--\r
- To use "hasPermission()" in the Spring EL method annotations like @PreAuthorize we explicitly configure the permissionEvaluator\r
- the cdmPermissionEvaluator is already defined in the persistence security context\r
- -->\r
- <bean id="expressionHandler" class="org.springframework.security.access.expression.method.DefaultMethodSecurityExpressionHandler">\r
- <property name="permissionEvaluator" ref="cdmPermissionEvaluator" />\r
- </bean>\r
-\r
- <bean id="authenticationManager" class="org.springframework.security.authentication.ProviderManager">\r
- <property name="providers">\r
- <list>\r
- <ref local="daoAuthenticationProvider"/>\r
- </list>\r
- </property>\r
- </bean>\r
-\r
- <bean id="daoAuthenticationProvider" class="org.springframework.security.authentication.dao.DaoAuthenticationProvider">\r
- <property name="userDetailsService" ref="userService"/>\r
- <property name="saltSource" ref="saltSource"/>\r
- <property name="passwordEncoder" ref="passwordEncoder"/>\r
- </bean>\r
-\r
- <bean id="passwordEncoder" class="org.springframework.security.authentication.encoding.Md5PasswordEncoder"/>\r
-\r
- <bean id="saltSource" class="org.springframework.security.authentication.dao.ReflectionSaltSource">\r
- <property name="userPropertyToUse" value="getUsername"/>\r
- </bean>\r
-\r
- <!--\r
- Run-As Authentication Replacement for system operations\r
- as e.g. performed by the eu.etaxonomy.cdm.api.application.FirstDataInserter\r
-\r
- the key must match FirstDataInserter.RUN_AS_KEY\r
- -->\r
- <bean id="runAsManager"\r
- class="org.springframework.security.access.intercept.RunAsManagerImpl">\r
- <property name="key" value="TtlCx3pgKC4l"/>\r
- </bean>\r
-\r
-\r
-</beans>\r
+++ /dev/null
-// $Id$
-/**
-* Copyright (C) 2014 EDIT
-* European Distributed Institute of Taxonomy
-* http://www.e-taxonomy.eu
-*
-* The contents of this file are subject to the Mozilla Public License Version 1.1
-* See LICENSE.TXT at the top of this package for the full license terms.
-*/
-package eu.etaxonomy.cdm.polytomouskey;
-
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import java.util.UUID;
-
-import org.apache.log4j.Level;
-import org.apache.log4j.Logger;
-import org.hibernate.collection.spi.PersistentCollection;
-import org.junit.Assert;
-import org.junit.BeforeClass;
-import org.junit.Test;
-import org.unitils.dbunit.annotation.DataSet;
-
-import eu.etaxonomy.cdm.api.cache.CachedCommonServiceImpl;
-import eu.etaxonomy.cdm.api.service.ICommonService;
-import eu.etaxonomy.cdm.api.service.IPolytomousKeyService;
-import eu.etaxonomy.cdm.api.service.ITaxonService;
-import eu.etaxonomy.cdm.model.agent.AgentBase;
-import eu.etaxonomy.cdm.model.common.CdmBase;
-import eu.etaxonomy.cdm.model.common.Credit;
-import eu.etaxonomy.cdm.model.common.Extension;
-import eu.etaxonomy.cdm.model.common.IdentifiableSource;
-import eu.etaxonomy.cdm.model.common.Language;
-import eu.etaxonomy.cdm.model.common.LanguageString;
-import eu.etaxonomy.cdm.model.description.KeyStatement;
-import eu.etaxonomy.cdm.model.description.PolytomousKey;
-import eu.etaxonomy.cdm.model.description.PolytomousKeyNode;
-import eu.etaxonomy.cdm.model.media.Rights;
-import eu.etaxonomy.cdm.model.name.NomenclaturalCode;
-import eu.etaxonomy.cdm.model.taxon.Taxon;
-import eu.etaxonomy.taxeditor.httpinvoker.BaseRemotingTest;
-import eu.etaxonomy.taxeditor.httpinvoker.CDMServer;
-
-/**
- * @author cmathew
- * @date 7 Oct 2014
- *
- */
-@DataSet
-public class PolytomousKeyTest extends BaseRemotingTest {
-
- private static final Logger logger = Logger.getLogger(PolytomousKeyTest.class);
-
- UUID polytomousKeyUuid = UUID.fromString("0d53ba20-7de4-4baa-bd8a-401048447d66");
- UUID taxon1Uuid = UUID.fromString("2b336df7-29e8-4f79-985f-66502739d22f");
-
-
- IPolytomousKeyService polytomousKeyService = getRemoteApplicationController().getPolytomousKeyService();
- ICommonService commonService = getRemoteApplicationController().getCommonService();
- ITaxonService taxonService = getRemoteApplicationController().getTaxonService();
-
- Language english = Language.getLanguageFromUuid(Language.uuidEnglish);
-
- @BeforeClass
- public static void initializePolytomousKeyTest() {
- logger.setLevel(Level.INFO);
- CDMServer.getInstance().setKeepServerRunning(true);
-
- initializeController("default", "127.0.0.1", 8080, "", NomenclaturalCode.ICNAFP);
- }
-
- @Test
- public void readAllPolytomousKeys() {
- List<PolytomousKey> pKeys = polytomousKeyService.list(PolytomousKey.class, null, null, null, null);
- for(PolytomousKey pKey : pKeys) {
- logger.info("Polytomous Key : " + pKey.getTitleCache());
- }
- }
-
-
- @Test
- //@DataSet("PolytomousKeyTest.readPolytmousKeyData.xml")
- public void readPolytmousKeyData() {
- PolytomousKey pKey = CdmBase.deproxy(polytomousKeyService.find(polytomousKeyUuid),PolytomousKey.class);
- Set<Taxon> taxonomicScope = pKey.getTaxonomicScope();
- Iterator<Taxon> tsItr = taxonomicScope.iterator();
- Taxon taxon = tsItr.next();
- logger.info("taxonomic scope : " + taxon.getTitleCache());
- Assert.assertEquals(taxon.getTitleCache(), "Achillea cretica L. sec. Cyprus");
- taxon = tsItr.next();
- logger.info("taxonomic scope : " + taxon.getTitleCache());
- Assert.assertEquals(taxon.getTitleCache(), "Achillea sec. Cyprus");
- Assert.assertEquals(tsItr.hasNext(), false);
-
- List<Credit> credits = pKey.getCredits();
- AgentBase agent = credits.get(0).getAgent();
- Assert.assertEquals(agent.getId(),4809);
- Assert.assertEquals(agent.getTitleCache(),"R. A. Graham");
- Assert.assertEquals(credits.get(0).getText(),"Credits Text Test");
-
- Set<Extension> exts = pKey.getExtensions();
- Iterator<Extension> extItr = exts.iterator();
- Extension ext = extItr.next();
- Assert.assertEquals(ext.getValue(), "http://test.com");
-
- Set<Rights> rights = pKey.getRights();
- Iterator<Rights> rightsItr = rights.iterator();
- Rights right = rightsItr.next();
- Assert.assertEquals(right.getText(),"Rights Text Test");
-
- Set<IdentifiableSource> sources = pKey.getSources();
- Iterator<IdentifiableSource> sourcesItr = sources.iterator();
- IdentifiableSource source = sourcesItr.next();
- Assert.assertEquals(source.getId(), 23710);
- source = sourcesItr.next();
- Assert.assertEquals(source.getId(), 23711);
-
- // TO DO : Added tests for Annotations , Markers
- }
-
- @Test
- public void readPolytomousKeyDataFromNodes() {
- PolytomousKey pKey = CdmBase.deproxy(polytomousKeyService.find(polytomousKeyUuid),PolytomousKey.class);
- PolytomousKeyNode rootNode = pKey.getRoot();
-
-
- Assert.assertEquals(rootNode.getId(), 2750);
-
- Assert.assertEquals(rootNode.getChildAt(0).getId(), 2751);
- Assert.assertEquals(rootNode.getChildAt(0).getParent().getId(), rootNode.getId());
- Assert.assertEquals(rootNode.getKey().getId(), pKey.getId());
- Integer sortIndex = (Integer)getFieldValueViaReflection(rootNode.getChildAt(0), "sortIndex");
- Assert.assertEquals(sortIndex, new Integer(0));
- String statement = "Capitula without ligulate ray-florets; leaves entire or subentire";
- Assert.assertEquals(rootNode.getChildAt(0).getStatement().getLabelText(english), statement);
-
- Assert.assertEquals(rootNode.getChildAt(1).getId(), 2753);
- Assert.assertEquals(rootNode.getChildAt(1).getParent().getId(), rootNode.getId());
- Assert.assertEquals(rootNode.getChildAt(1).getKey().getId(), pKey.getId());
- sortIndex = (Integer)getFieldValueViaReflection(rootNode.getChildAt(1), "sortIndex");
- Assert.assertEquals(sortIndex, new Integer(1));
- statement = "Capitula with ligulate ray-florets; leaves pinnatisect";
- Assert.assertEquals(rootNode.getChildAt(1).getStatement().getLabelText(english), statement);
-
- Assert.assertEquals(rootNode.getChildAt(1).getChildAt(0).getId(), 2754);
- Assert.assertEquals(rootNode.getChildAt(1).getChildAt(0).getParent().getId(), rootNode.getChildAt(1).getId());
- Assert.assertEquals(rootNode.getChildAt(1).getChildAt(0).getKey().getId(), pKey.getId());
- sortIndex = (Integer)getFieldValueViaReflection(rootNode.getChildAt(1).getChildAt(0), "sortIndex");
- Assert.assertEquals(sortIndex, new Integer(0));
- statement = "Ray-florets yellow";
- Assert.assertEquals(rootNode.getChildAt(1).getChildAt(0).getStatement().getLabelText(english), statement);
- Assert.assertEquals(rootNode.getChildAt(1).getChildAt(0).getChildAt(0).getTaxon().getTitleCache(), "Achillea arabica Kotschy sec. Cyprus");
- }
-
- @Test
- public void savePolytomousKeyNodeData() {
- PolytomousKey pkey = CdmBase.deproxy(polytomousKeyService.find(polytomousKeyUuid),PolytomousKey.class);
- PolytomousKeyNode pkeynode = pkey.getRoot();
- String newQuestion = "New Question";
- String newStatement = "New Statement";
-
- Assert.assertEquals("Question 1",pkeynode.getQuestion().getLabel().get(english).getText());
- for(PolytomousKeyNode node : pkeynode.getChildren()) {
-
- node.setQuestion(null);
- node.setStatement(null);
- }
- //FIXME: Add tests for feature after fixing problem
-
- //Feature feature = pkeynode.getFeature();
- //Assert.assertEquals(feature.getTitleCache(),"Systematics");
- //pkeynode.setFeature(null);
-
- Assert.assertEquals(pkeynode.getChildAt(0).getModifyingText().get(english).getText(),"Modifying Text 1a");
- String modifyingText = "Modifying Text 1a updated";
-
- //pkeynode.getChildAt(0).putModifyingText(english, modifyingText);
-
- Assert.assertEquals(pkeynode.getChildAt(0).getSubkey().getId(),751);
- Assert.assertEquals(pkeynode.getChildAt(0).getSubkey().getTitleCache(),"Asphodeline");
- Assert.assertNull(pkeynode.getChildAt(1).getTaxon());
- Taxon taxon = CdmBase.deproxy(taxonService.find(taxon1Uuid),Taxon.class);
- pkeynode.getChildAt(1).setTaxon(taxon);
-
- polytomousKeyService.merge(pkey);
-
- pkey = CdmBase.deproxy(polytomousKeyService.find(polytomousKeyUuid),PolytomousKey.class);
- pkeynode = pkey.getRoot();
- for(PolytomousKeyNode node : pkeynode.getChildren()) {
- Assert.assertNull(node.getQuestion());
- node.setQuestion(KeyStatement.NewInstance(english,newQuestion));
- Assert.assertNull(node.getStatement());
- node.setStatement(KeyStatement.NewInstance(english,newStatement));
- }
- //Assert.assertNull(pkeynode.getFeature());
- //pkeynode.setFeature(feature);
-
- //Assert.assertEquals(pkeynode.getChildAt(0).getModifyingText().get(english).getText(),modifyingText);
- Assert.assertEquals(pkeynode.getChildAt(1).getTaxon(), taxon);
-
- polytomousKeyService.merge(pkey);
-
- pkey = CdmBase.deproxy(polytomousKeyService.find(polytomousKeyUuid),PolytomousKey.class);
- pkeynode = pkey.getRoot();
- for(PolytomousKeyNode node : pkeynode.getChildren()) {
- Assert.assertNotNull(node.getQuestion());
- Map<Language, LanguageString> label = node.getQuestion().getLabel();
- Assert.assertEquals(newQuestion, label.get(english).getText());
- Assert.assertNotNull(node.getStatement());
- Assert.assertEquals(newStatement, node.getStatement().getLabel(english).getText());
- }
- //Assert.assertEquals(pkeynode.getFeature().getId(), feature.getId());
-
- }
-
- @Test
- public void savePolytomousKeyNodeDataWithSameSubKey() {
- //CachedCommonServiceImpl.setCacheEnabled(false);
- PolytomousKey pkey = CdmBase.deproxy(polytomousKeyService.find(polytomousKeyUuid),PolytomousKey.class);
- PolytomousKeyNode pkeynode = pkey.getRoot();
-
- PolytomousKey subkey1 = pkeynode.getChildAt(0).getSubkey();
- String subkey1title = subkey1.getTitleCache();
- subkey1.setTitleCache(subkey1title + "test", true);
-
-
- PolytomousKey subkey2 = pkeynode.getChildAt(1).getChildAt(0).getSubkey();
- String subkey2title = subkey2.getTitleCache();
- subkey2.setTitleCache(subkey2title + "test", true);
-
- Assert.assertNotSame(subkey1, subkey2);
-
-
- polytomousKeyService.merge(pkey);
- }
-
- @Test
- public void savePolytomousKeyNodeDataWithSameSubKeyUsingService() {
- CachedCommonServiceImpl.setCacheEnabled(false);
- PolytomousKey pkey = CdmBase.deproxy(polytomousKeyService.find(polytomousKeyUuid),PolytomousKey.class);
- PolytomousKeyNode pkeynode = pkey.getRoot();
-
- PersistentCollection children = (PersistentCollection) pkeynode.getChildren();
- PolytomousKeyNode childNode0 = (PolytomousKeyNode)commonService.get(children, 0);
- PolytomousKey subkey1 = CdmBase.deproxy(childNode0.getSubkey(),PolytomousKey.class);
- String subkey1title = subkey1.getTitleCache();
- subkey1.setTitleCache(subkey1title + "test", true);
-
- PolytomousKeyNode childNode1 = (PolytomousKeyNode)commonService.get(children, 1);
- PolytomousKey subkey2 = CdmBase.deproxy(childNode1.getSubkey(),PolytomousKey.class);
- String subkey2title = subkey2.getTitleCache();
- subkey2.setTitleCache(subkey2title + "test", true);
-
- Assert.assertNotSame(subkey1, subkey2);
-
- polytomousKeyService.merge(pkey);
- }
-
-
- @Test
- public void savePolytomousKeyNodeDataWithSameLanguageInLabel() {
- PolytomousKey pkey = CdmBase.deproxy(polytomousKeyService.find(polytomousKeyUuid),PolytomousKey.class);
- PolytomousKeyNode pkeynode = pkey.getRoot();
-
- Map<Language, LanguageString> label1 = pkeynode.getQuestion().getLabel();
- label1.size();
- //Language lang1 = label1.get(english).getLanguage();
- //String title1 = lang1.getTitleCache();
-
- Map<Language, LanguageString> label2 = pkeynode.getChildAt(0).getStatement().getLabel();
- label2.size();
- //Language lang2 = label2.get(english).getLanguage();
- //String title2 = lang2.getTitleCache();
-
- polytomousKeyService.merge(pkey);
- }
-
-
-}
+++ /dev/null
-// $Id$
-/**
-* Copyright (C) 2014 EDIT
-* European Distributed Institute of Taxonomy
-* http://www.e-taxonomy.eu
-*
-* The contents of this file are subject to the Mozilla Public License Version 1.1
-* See LICENSE.TXT at the top of this package for the full license terms.
-*/
-package eu.etaxonomy.taxeditor.exception;
-
-/**
- * @author cmathew
- * @date 23 Sep 2014
- *
- */
-public class CDMServerException extends Exception {
-
- public CDMServerException(String message) {
- super(message);
- }
-
- public CDMServerException(Exception e) {
- super(e);
- }
-
- public CDMServerException(String message,Exception e) {
- super(message,e);
- }
-
-}
+++ /dev/null
-/**
- * Copyright (C) 2014 EDIT
- * European Distributed Institute of Taxonomy
- * http://www.e-taxonomy.eu
- *
- * The contents of this file are subject to the Mozilla Public License Version 1.1
- * See LICENSE.TXT at the top of this package for the full license terms.
- */
-package eu.etaxonomy.taxeditor.httpinvoker;
-
-import java.lang.reflect.Field;
-
-import org.apache.log4j.Level;
-import org.apache.log4j.Logger;
-import org.junit.AfterClass;
-import org.junit.Assert;
-import org.junit.BeforeClass;
-import org.junit.Ignore;
-import org.junit.Test;
-import org.springframework.core.io.ClassPathResource;
-import org.springframework.core.io.Resource;
-import org.unitils.UnitilsJUnit4;
-import org.unitils.database.DatabaseUnitils;
-import org.unitils.database.annotations.Transactional;
-import org.unitils.database.util.TransactionMode;
-import org.unitils.spring.annotation.SpringApplicationContext;
-
-import eu.etaxonomy.cdm.api.application.CdmApplicationRemoteController;
-import eu.etaxonomy.cdm.api.application.ICdmApplicationConfiguration;
-import eu.etaxonomy.cdm.model.name.NomenclaturalCode;
-import eu.etaxonomy.cdm.remote.CdmPersistentRemoteSource;
-import eu.etaxonomy.cdm.remote.CdmRemoteSource;
-import eu.etaxonomy.cdm.remote.CdmRemoteSourceException;
-import eu.etaxonomy.cdm.remote.ICdmRemoteSource;
-
-
-/**
- * Base class for remoting tests, responsible for
- * - starting / stop the cdm server
- * - running some basic connection tests
- * - setting up the remote configuration.
- *
- */
-@Transactional(TransactionMode.DISABLED)
-@SpringApplicationContext("file:./target/test-classes/eu/etaxonomy/cdm/testRemotingApplicationContext.xml")
-public class BaseRemotingTest extends UnitilsJUnit4 {
- //private static final Logger logger = Logger.getLogger(BaseRemotingTest.class);
-
- private static final Resource TEST_REMOTE_APPLICATION_CONTEXT_RESOURCE =
- new ClassPathResource("/eu/etaxonomy/cdm/testRemotingApplicationContext.xml");
-
- private static ICdmApplicationConfiguration remoteApplicationController;
- private static ICdmRemoteSource cdmRemoteSource;
- private static CdmPersistentRemoteSource remotePersistentSource;
-
- public static boolean useManagedServer = false;
-
- @BeforeClass
- public static void initializeBaseRemotingTest() {
- //Logger.getRootLogger().setLevel(Level.INFO);
- useManagedServer = (System.getProperty("use.managed.server") == null) ? useManagedServer : Boolean.valueOf(System.getProperty("use.managed.server"));
- if(useManagedServer) {
- try {
- CDMServer.getInstance().start();
- } catch (Exception e) {
- e.printStackTrace();
- Assert.fail("Server failed to start. Reason : " + e.getMessage());
- }
-
- initializeController(CDMServer.getInstance().getName(),
- CDMServer.getInstance().getHost(),
- CDMServer.getInstance().getPort(),
- CDMServer.getInstance().getContextPath(),
- NomenclaturalCode.ICNAFP);
- }
- }
-
-
- public static void initializeController(String sourceName, String host, int port, String contextPath, NomenclaturalCode ncode) {
-
- cdmRemoteSource = CdmRemoteSource.NewInstance(sourceName, host, port, contextPath, ncode);
- remoteApplicationController =
- CdmApplicationRemoteController.NewInstance(cdmRemoteSource,
- false,
- null,
- null);
-
- try {
- remotePersistentSource = CdmPersistentRemoteSource.NewInstance(sourceName);
- } catch (CdmRemoteSourceException e) {
- Assert.fail("Default Remote Persistent Source failed to load. Reason : " + e.getMessage());
- }
-
- }
-
-
-
- protected static ICdmApplicationConfiguration getRemoteApplicationController() {
- return remoteApplicationController;
- }
-
- protected static ICdmRemoteSource getCdmRemoteSource() {
- return cdmRemoteSource;
- }
-
- protected static CdmPersistentRemoteSource getCdmPersistentRemoteSource() {
- return remotePersistentSource;
- }
-
- @AfterClass
- public static void cleanup() {
- try {
- CDMServer.getInstance().stop();
- } catch (Exception e) {
- Assert.fail("Server could not be stopped. Reason : " + e.getMessage());
- }
- }
-
-
- protected static Object getFieldValueViaReflection(Object object, String fieldName) {
- Class<?> clazz = object.getClass();
- try {
- Field field = clazz.getDeclaredField(fieldName);
- field.setAccessible(true);
- return field.get(object);
- } catch (NoSuchFieldException e) {
- e.printStackTrace();
- } catch (SecurityException e) {
- e.printStackTrace();
- } catch (IllegalArgumentException e) {
- e.printStackTrace();
- } catch (IllegalAccessException e) {
- e.printStackTrace();
- }
- return null;
- }
-
-
-
-
-}
+++ /dev/null
-// $Id$
-/**
- * Copyright (C) 2014 EDIT
- * European Distributed Institute of Taxonomy
- * http://www.e-taxonomy.eu
- *
- * The contents of this file are subject to the Mozilla Public License Version 1.1
- * See LICENSE.TXT at the top of this package for the full license terms.
- */
-package eu.etaxonomy.taxeditor.httpinvoker;
-
-import java.io.BufferedReader;
-import java.io.IOException;
-import java.io.InputStreamReader;
-import java.net.Socket;
-
-
-import javax.sql.DataSource;
-
-import org.apache.log4j.Level;
-import org.apache.log4j.Logger;
-import org.springframework.core.io.ClassPathResource;
-import org.springframework.core.io.Resource;
-import org.unitils.database.annotations.TestDataSource;
-import org.unitils.spring.annotation.SpringApplicationContext;
-
-import eu.etaxonomy.cdm.remote.CdmRemoteSourceBase;
-import eu.etaxonomy.taxeditor.exception.CDMServerException;
-
-/**
- *
- * (Singleton) Server instance which manages a compatible cdmlib-webapp-war.
- * This is done by launching a jetty instance (using jetty-runner) as an
- * executed process. The choice of the external process over a more
- * preferable 'embedded jetty' instance is due to problems arising from the
- * class loading of classes (e.g. from hibernate core) which are needed
- * for both the webapp as well as the remoting client.
- *
- * @author cmathew
- * @date 23 Sep 2014
- *
- */
-
-public class CDMServer {
-
- public static final Logger logger = Logger.getLogger(CDMServer.class);
-
- @TestDataSource
- protected DataSource dataSource;
-
- private final String name = "default";
- private final String host = "127.0.0.1";
- private final int port = 9090;
- private final int stopPort = 9191;
- private final String stopKey = "jetty-cdm-server";
- private final String contextPath = "";
-
- private boolean keepServerRunning = false;
-
- public static final Resource DEFAULT_CDM_WEBAPP_RESOURCE =
- new ClassPathResource("/etc/jetty/cdmlib-remote-webapp.war");
-
- public static final Resource DEFAULT_JETTY_CONFIG_RESOURCE =
- new ClassPathResource("/etc/jetty/jetty.xml");
-
- public static final Resource DEFAULT_JETTY_TEMP_RESOURCE =
- new ClassPathResource("/etc/jetty/temp");
-
- public static final Resource DEFAULT_JETTY_TEMP_WAR_LIB_RESOURCE =
- new ClassPathResource("/etc/jetty/temp/webapp/WEB-INF/lib");
-
- public static final Resource DEFAULT_DATASOURCE_FILE =
- new ClassPathResource("datasources.xml");
-
- public static final Resource DEFAULT_JETTY_RUNNER_RESOURCE =
- new ClassPathResource("/etc/jetty/jetty-runner-9.2.3.v20140905.jar");
-
- public static final Resource DEFAULT_JETTY_RESOURCE =
- new ClassPathResource("/etc/jetty/start-9.2.3.v20140905.jar");
-
-
-
- private static CDMServer cdmServer = null;
- private static CDMServerException cdmse = null;
-
- private void CDMServer() {
- logger.setLevel(Level.INFO);
- }
-
- public static CDMServer getInstance() {
- if(cdmServer == null) {
- cdmServer = new CDMServer();
- }
- return cdmServer;
- }
-
- public String getName() {
- return name;
- }
-
- public String getHost() {
- return host;
- }
-
- public int getPort() {
- return port;
- }
-
- public String getContextPath() {
- return contextPath;
- }
-
- public boolean getKeepServerRunning() {
- return keepServerRunning;
- }
-
- public void setKeepServerRunning(boolean keepServerRunning) {
- this.keepServerRunning = keepServerRunning;
- }
-
- public static boolean isRunningInEclipse() {
- return (System.getProperty("sun.java.command") != null &&
- System.getProperty("sun.java.command").startsWith("org.eclipse.jdt.internal.junit.runner.RemoteTestRunner"));
- }
-
- private String getVMArgs() throws IOException {
- StringBuilder sb = new StringBuilder();
- sb.append(" -Dspring.profiles.active=remoting");
- sb.append(" -Dcdm.beanDefinitionFile=" + DEFAULT_DATASOURCE_FILE.getFile().getAbsolutePath());
- sb.append(" -Dcdm.datasource=cdmTest");
- return sb.toString();
- }
-
- private String getStartServerArgs() {
- StringBuilder sb = new StringBuilder();
- sb.append(" --port ");
- sb.append(port);
- return sb.toString();
- }
-
- private String getStopServerSettings() {
- StringBuilder sb = new StringBuilder();
- sb.append(" --stop-port ");
- sb.append(stopPort);
- sb.append(" --stop-key ");
- sb.append(stopKey);
- return sb.toString();
- }
-
- private String getStopServerArgs() {
- StringBuilder sb = new StringBuilder();
- sb.append(" STOP.PORT=");
- sb.append(stopPort);
- sb.append(" STOP.KEY=");
- sb.append(stopKey);
- return sb.toString();
- }
-
- public void start() throws CDMServerException {
-
- /**
- * First check if the CDM server responds to a service request, which implies that
- * the server has started properly. If no response is received then check if the
- * server is listening on specific host / port, which implies that the server
- * has started but incorrectly, in which case we try to force stop it (if we can)
- * and start a new server.
- */
- if(isRunning(1)) {
- logger.info("[CDM-Server] Server already running @ " + host + ":" + port );
- return;
- } else if (isAvailable(1)){
- logger.info("[CDM-Server] Server available, but not started correctly @ " + host + ":" + port );
- logger.info("[CDM-Server] .... trying to force stop server @ " + host + ":" + port );
- try {
- stop(true);
- } catch (Exception e) {
- throw new CDMServerException("CDM Server could not be stopped : " + e.getMessage());
- }
- }
-
- Thread t = new Thread() {
- @Override
- public void run() {
- StringBuffer output = new StringBuffer();
- try{
- Process p;
- String command = "java "
- + getVMArgs()
- + " -jar "
- + DEFAULT_JETTY_RUNNER_RESOURCE.getFile().getAbsolutePath()
- + getStartServerArgs()
- + getStopServerSettings()
- + " "
- + DEFAULT_CDM_WEBAPP_RESOURCE.getFile().getAbsolutePath();
- logger.info("[CDM-Server] Starting server with Command : " + command);
- p = Runtime.getRuntime().exec(command);
-
- BufferedReader reader =
- new BufferedReader(new InputStreamReader(p.getInputStream()));
-
- String line = "";
- while ((line = reader.readLine())!= null) {
- logger.info("[CDM-Server] Start : " + line);
- }
-
- } catch (Exception e) {
- e.printStackTrace();
- cdmse = new CDMServerException(e);
- }
-
- }
- };
-
- t.setDaemon(true);
- cdmse = null;
- t.start();
-
- if(isRunning(50)) {
- logger.info("[CDM-Server] Started Server @ " + host + ":" + port );
- } else {
- logger.info("[CDM-Server] Server not started within given interval");
- // making sure to kill server if it is not started correctly
- try {
- stop(true);
- } catch (Exception e) {
- throw new CDMServerException("CDM Server could not be stopped : " + e.getMessage());
- }
- throw new CDMServerException("CDM Server not started : ");
- }
-
- }
-
- public boolean isAvailable(int checkingIntervals) throws CDMServerException {
- int intervalsCount = 0;
- do {
- try {
- Socket s = new Socket(host, port);
- logger.info("[CDM-Server] Available @ " + host + ":" + port );
- return true;
- } catch (IOException ioe) {
-
- }
- try {
- Thread.sleep(1000);
- } catch (InterruptedException ie) {
- throw new CDMServerException("Error checking CDM Server status", ie);
- }
- intervalsCount++;
- } while (intervalsCount < checkingIntervals);
-
- return false;
- }
-
- public boolean isStopped(int checkingIntervals) throws CDMServerException {
- int intervalsCount = 0;
- do {
- try {
- Socket s = new Socket(host, port);
- } catch (IOException ioe) {
- logger.info("[CDM-Server] Stopped @ " + host + ":" + port );
- return true;
- }
- try {
- Thread.sleep(1000);
- } catch (InterruptedException ie) {
- throw new CDMServerException("Error checking CDM Server status", ie);
- }
- intervalsCount++;
- } while (intervalsCount < checkingIntervals);
-
- return false;
- }
-
- public boolean isRunning(int checkingIntervals) throws CDMServerException {
- CdmRemoteSourceBase crsb = new CdmRemoteSourceBase("local-cdm-server",
- host,
- port,
- contextPath,
- null);
- int intervalsCount = 0;
- do {
- try {
- if(cdmse != null) {
- return false;
- }
- if(crsb.checkConnection()) {
- logger.info("[CDM-Server] Running @ " + host + ":" + port );
- return true;
- }
- } catch (Exception e) {
- }
- try {
- Thread.sleep(1000);
- } catch (InterruptedException ie) {
- throw new CDMServerException("Error checking CDM Server status", ie);
- }
- intervalsCount++;
- } while (intervalsCount < checkingIntervals);
- return false;
- }
-
- public void stop() throws Exception {
- stop(false);
- }
- public void stop(boolean force) throws Exception {
-
- if(!force) {
- if(!getInstance().isAvailable(1)) {
- logger.info("[CDM-Server] Server already stopped @ " + host + ":" + port );
- return;
- }
-
- if(getInstance().getKeepServerRunning()) {
- logger.info("[CDM-Server] Server @ " + host + ":" + port + " is set to keep running");
- return;
- }
- }
- Thread t = new Thread() {
- @Override
- public void run() {
- StringBuffer output = new StringBuffer();
- try{
- Process p;
- String command = "java -jar " + DEFAULT_JETTY_RESOURCE.getFile().getAbsolutePath()
- + getStopServerArgs() + " --stop ";
- logger.info("[CDM-Server] Stop Command : " + command);
- p = Runtime.getRuntime().exec(command);
- p.waitFor();
- BufferedReader reader =
- new BufferedReader(new InputStreamReader(p.getInputStream()));
- String line = "";
- while ((line = reader.readLine())!= null) {
- logger.info("CDM-Server Stop : " + line + "\n");
- }
- } catch (Exception e) {
- e.printStackTrace();
- }
-
- }
- };
-
- t.setDaemon(true);
- t.start();
-
- if(isStopped(5)) {
- logger.info("[CDM-Server] Stopped Server @ " + host + ":" + port );
- } else {
- logger.info("[CDM-Server] Could not stop @ " + host + ":" + port + ". Please kill it manually");
- }
- }
-}
+++ /dev/null
-/**
- * Copyright (C) 2014 EDIT
- * European Distributed Institute of Taxonomy
- * http://www.e-taxonomy.eu
- *
- * The contents of this file are subject to the Mozilla Public License Version 1.1
- * See LICENSE.TXT at the top of this package for the full license terms.
- */
-package eu.etaxonomy.taxeditor.httpinvoker;
-
-
-import static org.hamcrest.CoreMatchers.containsString;
-
-import java.util.Map;
-
-import org.apache.log4j.Level;
-import org.apache.log4j.Logger;
-import org.junit.Assert;
-import org.junit.BeforeClass;
-import org.junit.Test;
-
-import eu.etaxonomy.cdm.config.CdmPersistentSourceUtils;
-import eu.etaxonomy.cdm.config.CdmPersistentXMLSource.CdmSourceProperties;
-import eu.etaxonomy.cdm.config.CdmSourceException;
-import eu.etaxonomy.cdm.model.metadata.CdmMetaData.MetaDataPropertyName;
-import eu.etaxonomy.cdm.model.name.NomenclaturalCode;
-import eu.etaxonomy.cdm.remote.CdmPersistentRemoteSource;
-import eu.etaxonomy.cdm.remote.CdmRemoteSource;
-import eu.etaxonomy.cdm.remote.CdmRemoteSourceException;
-import eu.etaxonomy.cdm.remote.ICdmRemoteSource;
-
-/**
- * Class to test the cdm persistent source functionality, including
- * initialising / saving / updating and deleting
- *
- * Corresponding test sources settings can be found at
- * /src/text/resources/eu.etaxonomy.cdm/cdm.datasources.xml
- *
- */
-public class CdmPersistentRemoteSourceTest extends BaseRemotingTest {
- private static final Logger logger = Logger.getLogger(CdmPersistentRemoteSourceTest.class);
-
- private CdmPersistentRemoteSource remotePersistentSource;
-
- @BeforeClass
- public static void initialize() {
- Logger.getRootLogger().setLevel(Level.INFO);
- }
-
- @Test
- public void whenLoadingExistingCompleteRemoteSourceThenLoadIsSuccessful() {
-
- remotePersistentSource = getCdmPersistentRemoteSource();
-
- String expectedServer = "127.0.0.1";
- String expectedPort = "9090";
- String expectedContextPath = "";
- logger.info("Default remote source server : " + remotePersistentSource.getServer());
- Assert.assertTrue("Default server should be " + expectedServer,
- expectedServer.equals(remotePersistentSource.getServer()));
-
- logger.info("Default remote source port : " + remotePersistentSource.getPort());
- Assert.assertTrue("Default port should be 9090",
- expectedPort.equals(String.valueOf(remotePersistentSource.getPort())));
-
- logger.info("Default remote source context path : " + remotePersistentSource.getContextPath());
- Assert.assertTrue("Default remote source context path should be " + expectedContextPath,
- expectedContextPath.equals(remotePersistentSource.getContextPath()));
-
- logger.info("Default remote source nomenclatural code : " + remotePersistentSource.getNomenclaturalCode().toString());
- Assert.assertTrue("Default NomenclaturalCode should be ICNAFP",
- NomenclaturalCode.ICNAFP.equals(remotePersistentSource.getNomenclaturalCode()));
- }
-
-
-
-
- @Test
- public void whenConnectingToAnActiveServerThenConnectSuccessfully() {
- // check if active server throws the right exception
-
- remotePersistentSource = getCdmPersistentRemoteSource();
-
- String dbSchemaVersion = "";
- try {
- dbSchemaVersion = remotePersistentSource.getDbSchemaVersion();
- } catch (CdmSourceException e) {
- Assert.fail("getDbSchemaVersion() on active cdm server should not have thrown CdmSourceException");
- }
- logger.info("dbSchemaVersion is " + dbSchemaVersion);
-
-
- boolean isDbEmpty = false;
- try {
- isDbEmpty = remotePersistentSource.isDbEmpty();
- } catch (CdmSourceException e) {
- Assert.fail("isDbEmpty() on active cdm server should not have thrown CdmSourceException");
- }
- Assert.assertFalse(isDbEmpty);
-
-
- boolean check = false;
- try {
- check = remotePersistentSource.checkConnection();
- } catch (CdmSourceException e) {
- Assert.fail("checkConnection() on active cdm server should not have thrown CdmSourceException");
- }
- Assert.assertTrue(check);
-
-
- }
-
- @Test
- public void whenRequestingMetadatFromRemoteSourceThenMetaDataIsRetrieved() {
- try {
- remotePersistentSource = getCdmPersistentRemoteSource();
- Map<MetaDataPropertyName, String> cdmMetaDataMap = remotePersistentSource.getMetaDataMap();
- for(MetaDataPropertyName mdpn : cdmMetaDataMap.keySet()) {
- String value = cdmMetaDataMap.get(mdpn);
- logger.info("MetaData Property " + mdpn.name() + " has value " + value);
- Assert.assertNotNull("Meta Data Value for property for " + mdpn.name() + " should not be null", value);
- }
- } catch (CdmSourceException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
- }
-
- @Test
- public void whenLoadingNonExistingRemoteSourceThenThrowException() {
- try {
- remotePersistentSource = CdmPersistentRemoteSource.NewInstance("nonExistingSource");
- Assert.fail("Initialising a non-existing remote source should throw an exception");
- } catch (CdmRemoteSourceException e) {
- logger.info(e.getMessage());
- }
- }
-
- @Test
- public void whenLoadingExistingIncompleteRemoteSourceThenThrowException() {
- try {
- remotePersistentSource = CdmPersistentRemoteSource.NewInstance("incomplete");
- Assert.fail("Initialising an incomplete remote source should throw an exception");
- } catch (CdmRemoteSourceException e) {
- Assert.assertThat(e.getMessage(), containsString("Required property '" + CdmSourceProperties.SERVER.toString() + "' is missing"));
- }
- }
-
- @Test
- public void whenSavingUpdatingDeletingNewCompleteRemoteSourceThenSaveUpdateDeleteIsSuccessful() {
- String strRemoteSource = "local";
- Assert.assertFalse("New remote source '" + strRemoteSource + "' should not yet exist in source settings file",
- CdmPersistentRemoteSource.exists(strRemoteSource));
- try {
- ICdmRemoteSource remoteSource =
- CdmRemoteSource.NewInstance(strRemoteSource,
- "127.0.0.1",
- 8080,
- "col",
- NomenclaturalCode.ICNAFP);
- remotePersistentSource = CdmPersistentRemoteSource.save(strRemoteSource,remoteSource);
-
- logger.info("Server : " + remotePersistentSource.getServer());
- Assert.assertTrue("Server value should be equal",
- remoteSource.getServer().equals(remotePersistentSource.getServer()));
-
- logger.info("Port : " + remotePersistentSource.getPort());
- Assert.assertTrue("Port value should be equal",
- remoteSource.getPort() == remotePersistentSource.getPort());
-
- logger.info("Context Path : " + remotePersistentSource.getContextPath());
- Assert.assertTrue("Context Path value should be equal",
- remoteSource.getContextPath().equals(remotePersistentSource.getContextPath()));
-
- logger.info("Nomenclatural Code : " + remotePersistentSource.getNomenclaturalCode().name());
- Assert.assertTrue("Nomenclatural Code value should be equal",
- remoteSource.getNomenclaturalCode().name().equals(remotePersistentSource.getNomenclaturalCode().name()));
-
- Assert.assertTrue("New remote source '" + strRemoteSource + "' should be saved in source settings file",
- CdmPersistentRemoteSource.exists(strRemoteSource));
-
- remoteSource = CdmRemoteSource.NewInstance(strRemoteSource,
- "127.0.0.55",
- 9090,
- "cyprus",
- NomenclaturalCode.ICNB);
- remotePersistentSource = CdmPersistentRemoteSource.update(strRemoteSource,remoteSource);
-
- logger.info("Server : " + remotePersistentSource.getServer());
- Assert.assertTrue("Server value should be equal",
- remoteSource.getServer().equals(remotePersistentSource.getServer()));
-
- logger.info("Port : " + remotePersistentSource.getPort());
- Assert.assertTrue("Port value should be equal",
- remoteSource.getPort() == remotePersistentSource.getPort());
-
- logger.info("Context Path : " + remotePersistentSource.getContextPath());
- Assert.assertTrue("Context Path value should be equal",
- remoteSource.getContextPath().equals(remotePersistentSource.getContextPath()));
-
- logger.info("Nomenclatural Code : " + remotePersistentSource.getNomenclaturalCode().name());
- Assert.assertTrue("Nomenclatural Code value should be equal",
- remoteSource.getNomenclaturalCode().name().equals(remotePersistentSource.getNomenclaturalCode().name()));
-
- Assert.assertTrue("New remote source '" + strRemoteSource + "' should be saved in source settings file",
- CdmPersistentRemoteSource.exists(strRemoteSource));
-
- CdmPersistentSourceUtils.delete(remotePersistentSource);
-
- Assert.assertFalse("New remote source '" + strRemoteSource + "' should no longer exist in source settings file",
- CdmPersistentRemoteSource.exists(strRemoteSource));
-
- } catch (CdmRemoteSourceException e) {
- Assert.fail("Saving a new complete remote source should not throw an exception");
- logger.info(e.getMessage());
- }
- }
-
-
-
-}
+++ /dev/null
-/**
-* Copyright (C) 2014 EDIT
-* European Distributed Institute of Taxonomy
-* http://www.e-taxonomy.eu
-*
-* The contents of this file are subject to the Mozilla Public License Version 1.1
-* See LICENSE.TXT at the top of this package for the full license terms.
-*/
-package eu.etaxonomy.taxeditor.httpinvoker;
-
-import org.apache.log4j.Level;
-import org.apache.log4j.Logger;
-import org.junit.Assert;
-import org.junit.BeforeClass;
-import org.junit.Test;
-import org.springframework.remoting.RemoteAccessException;
-
-import eu.etaxonomy.cdm.config.CdmSourceException;
-import eu.etaxonomy.cdm.model.name.NomenclaturalCode;
-import eu.etaxonomy.cdm.remote.CdmRemoteSource;
-import eu.etaxonomy.taxeditor.lazyloading.RemotePersistentCollectionTest;
-
-public class CdmRemoteSourceTest extends BaseRemotingTest {
- private static final Logger logger = Logger.getLogger(RemotePersistentCollectionTest.class);
-
-
- @BeforeClass
- public static void initialize() {
-
- Logger.getRootLogger().setLevel(Level.INFO);
-
- }
-
- @Test
- public void whenConnectingToInactiveServerThenFailToConnect() {
- // check if non-active server throws the right exception
- CdmRemoteSource inactiveCrs = CdmRemoteSource.NewInstance(CDMServer.getInstance().getName(),
- CDMServer.getInstance().getHost(),
- 808080,
- CDMServer.getInstance().getContextPath(),
- NomenclaturalCode.ICNAFP);
- try {
- inactiveCrs.getDbSchemaVersion();
- Assert.fail("getDbSchemaVersion() on inactive cdm server should have thrown RemoteAccessException");
- } catch(CdmSourceException cse) {
- Assert.fail("getDbSchemaVersion() on inactive cdm server should have thrown RemoteAccessException and not CdmSourceException");
- } catch(RemoteAccessException rae){
-
- }
-
- try {
- inactiveCrs.isDbEmpty();
- Assert.fail("isDbEmpty() on inactive cdm server should have thrown RemoteAccessException");
- } catch(CdmSourceException cse) {
- Assert.fail("isDbEmpty() on inactive cdm server should have thrown RemoteAccessException and not CdmSourceException");
- } catch(RemoteAccessException rae){
-
- }
-
- try {
- inactiveCrs.checkConnection();
- Assert.fail("checkConnection() on inactive cdm server should have thrown RemoteAccessException");
- } catch(CdmSourceException cse) {
- Assert.fail("checkConnection() on inactive cdm server should have thrown RemoteAccessException and not CdmSourceException");
- } catch(RemoteAccessException rae){
-
- }
-
- }
-
- @Test
- public void whenConnectingToAnActiveServerWithServicesBlockedThenFailToAccessServices() {
-
- }
-
- @Test
- public void whenConnectingToAnActiveServerThenConnectSuccessfully() {
- // check if active server throws the right exception
- CdmRemoteSource activeCrs = CdmRemoteSource.NewInstance(CDMServer.getInstance().getName(),
- CDMServer.getInstance().getHost(),
- CDMServer.getInstance().getPort(),
- CDMServer.getInstance().getContextPath(),
- NomenclaturalCode.ICNAFP);
- String dbSchemaVersion = "";
- try {
- dbSchemaVersion = activeCrs.getDbSchemaVersion();
- } catch (CdmSourceException e) {
- Assert.fail("getDbSchemaVersion() on active cdm server should not have thrown CdmSourceException");
- }
- logger.info("dbSchemaVersion is " + dbSchemaVersion);
-
-
- boolean isDbEmpty = false;
- try {
- isDbEmpty = activeCrs.isDbEmpty();
- } catch (CdmSourceException e) {
- Assert.fail("isDbEmpty() on active cdm server should not have thrown CdmSourceException");
- }
- Assert.assertFalse(isDbEmpty);
-
-
- boolean check = true;
- try {
- isDbEmpty = activeCrs.checkConnection();
- } catch (CdmSourceException e) {
- Assert.fail("checkConnection() on active cdm server should not have thrown CdmSourceException");
- }
- Assert.assertTrue(check);
-
- }
-
-}
+++ /dev/null
-// $Id$
-/**
-* Copyright (C) 2014 EDIT
-* European Distributed Institute of Taxonomy
-* http://www.e-taxonomy.eu
-*
-* The contents of this file are subject to the Mozilla Public License Version 1.1
-* See LICENSE.TXT at the top of this package for the full license terms.
-*/
-package eu.etaxonomy.taxeditor.httpinvoker;
-
-import org.apache.log4j.Level;
-import org.apache.log4j.Logger;
-import org.junit.Assert;
-import org.junit.Ignore;
-import org.junit.Test;
-import org.unitils.UnitilsJUnit4;
-
-import eu.etaxonomy.taxeditor.lazyloading.AbstractLazyInitializerTest;
-
-/**
- * @author cmathew
- * @date 6 Oct 2014
- *
- */
-public class CdmServerTest extends UnitilsJUnit4 {
- private static final Logger logger = Logger.getLogger(CdmServerTest.class);
-
-
- @Test
- public void stopCdmServer() {
- Logger.getRootLogger().setLevel(Level.INFO);
- CDMServer.getInstance().setKeepServerRunning(false);
- try {
- CDMServer.getInstance().stop();
- } catch (Exception e) {
- Assert.fail("Server could not be stopped. Reason : " + e.getMessage());
- }
- }
-
-}
+++ /dev/null
-// $Id$
-/**
-* Copyright (C) 2014 EDIT
-* European Distributed Institute of Taxonomy
-* http://www.e-taxonomy.eu
-*
-* The contents of this file are subject to the Mozilla Public License Version 1.1
-* See LICENSE.TXT at the top of this package for the full license terms.
-*/
-package eu.etaxonomy.taxeditor.httpinvoker;
-
-import org.apache.log4j.Level;
-import org.apache.log4j.Logger;
-import org.junit.Assert;
-import org.junit.Ignore;
-import org.junit.Test;
-import org.unitils.UnitilsJUnit4;
-
-import eu.etaxonomy.taxeditor.lazyloading.AbstractLazyInitializerTest;
-
-/**
- * @author cmathew
- * @date 6 Oct 2014
- *
- */
-public class CdmServerTestManager extends UnitilsJUnit4 {
- private static final Logger logger = Logger.getLogger(CdmServerTestManager.class);
-
-
- @Test
- public void stopCdmServer() {
- Logger.getRootLogger().setLevel(Level.INFO);
- CDMServer.getInstance().setKeepServerRunning(true);
- try {
- CDMServer.getInstance().stop();
- } catch (Exception e) {
- Assert.fail("Server could not be stopped. Reason : " + e.getMessage());
- }
- }
-
-}
+++ /dev/null
-/**
-* Copyright (C) 2014 EDIT
-* European Distributed Institute of Taxonomy
-* http://www.e-taxonomy.eu
-*
-* The contents of this file are subject to the Mozilla Public License Version 1.1
-* See LICENSE.TXT at the top of this package for the full license terms.
-*/
-package eu.etaxonomy.taxeditor.httpinvoker;
-
-import org.apache.log4j.Logger;
-import org.junit.Assert;
-import org.junit.Test;
-
-import eu.etaxonomy.cdm.config.CdmSourceException;
-
-/**
- * Class to test the HttpInvoker services exposed by the CDM Sever
- *
- */
-public class HttpInvokerServicesTest extends BaseRemotingTest {
- private static final Logger logger = Logger.getLogger(HttpInvokerServicesTest.class);
-
- @Test
- public void whenCallingMethodsOnRemoteServicesThenSuceed() {
- try {
- String dbSchemaVersion = getRemoteApplicationController().getDatabaseService().getDbSchemaVersion();
- logger.info("dbSchemaVersion is " + dbSchemaVersion);
- } catch (CdmSourceException e) {
- Assert.fail("pinging database service on active cdm server should not have thrown CdmSourceException");
- }
- }
-
-}
+++ /dev/null
-/**
- * Copyright (C) 2014 EDIT
- * European Distributed Institute of Taxonomy
- * http://www.e-taxonomy.eu
- *
- * The contents of this file are subject to the Mozilla Public License Version 1.1
- * See LICENSE.TXT at the top of this package for the full license terms.
- */
-package eu.etaxonomy.taxeditor.lazyloading;
-
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Set;
-import java.util.UUID;
-
-import org.apache.log4j.Level;
-import org.apache.log4j.Logger;
-import org.junit.Assert;
-import org.junit.BeforeClass;
-import org.junit.Ignore;
-import org.junit.Test;
-import org.unitils.dbunit.annotation.DataSet;
-
-import eu.etaxonomy.cdm.api.application.CdmApplicationRemoteController;
-import eu.etaxonomy.cdm.api.service.IClassificationService;
-import eu.etaxonomy.cdm.api.service.ITaxonService;
-import eu.etaxonomy.cdm.model.agent.Person;
-import eu.etaxonomy.cdm.model.agent.Team;
-import eu.etaxonomy.cdm.model.common.CdmBase;
-import eu.etaxonomy.cdm.model.name.BotanicalName;
-import eu.etaxonomy.cdm.model.name.NonViralName;
-import eu.etaxonomy.cdm.model.name.TaxonNameBase;
-import eu.etaxonomy.cdm.model.taxon.Classification;
-import eu.etaxonomy.cdm.model.taxon.SynonymRelationship;
-import eu.etaxonomy.cdm.model.taxon.Taxon;
-import eu.etaxonomy.cdm.model.taxon.TaxonNode;
-import eu.etaxonomy.taxeditor.httpinvoker.BaseRemotingTest;
-
-
-
-
-/**
- * Class to test the {@link CdmApplicationRemoteController}
- *
- */
-@DataSet
-public class AbstractLazyInitializerTest extends BaseRemotingTest {
- private static final Logger logger = Logger.getLogger(AbstractLazyInitializerTest.class);
-
- private static IClassificationService classificationService;
- private static ITaxonService taxonService;
-
- private static List<TaxonNode> taxonNodes;
-
- private final UUID taxonUuid1 = UUID.fromString("8217ef77-2ab1-4318-bd67-ccd0cdef07c4");
- private final UUID taxonUuid2 = UUID.fromString("ef96fafa-7750-4141-b31b-1ad1daab3e76");
-
-
- @BeforeClass
- public void initializeRemoteLazyLoading() {
-
- Logger.getRootLogger().setLevel(Level.DEBUG);
-
- taxonService = getRemoteApplicationController().getTaxonService();
- classificationService= getRemoteApplicationController().getClassificationService();
- List<Classification> classifications = classificationService.listClassifications(1,0,null,null);
- Assert.assertFalse(classifications.isEmpty());
-
- Classification classification = classifications.get(0);
- Assert.assertNotNull(classification);
- taxonNodes = classificationService.getAllNodes();
- Assert.assertFalse(taxonNodes.isEmpty());
-
- }
-
-
-
- @Test
- public void testCDMEntityGet() {
- //ITaxonService taxonService = getRemoteApplicationController().getTaxonService();
- Iterator<TaxonNode> taxonNodeItr = taxonNodes.iterator();
- int maxcount = 30;
- int count = 0;
- while(taxonNodeItr.hasNext() && count <= maxcount) {
- TaxonNode taxonNode = taxonNodeItr.next();
- Assert.assertNotNull(taxonNode);
-
- Taxon taxon = taxonNode.getTaxon();
- Assert.assertNotNull(taxon);
-
- String taxonTitle = taxon.getTitleCache();
- logger.info("Taxon : " + taxonTitle);
-
- TaxonNameBase name = taxon.getName();
- Assert.assertNotNull(name);
-
- String nameTitle = name.getTitleCache();
- logger.info("Taxon Name : " + nameTitle);
-
- count++;
- }
- }
-
- @Test
- public void taxonReadTest() {
- Taxon taxon = (Taxon)taxonService.find(taxonUuid1);
-
- }
-
-
- @Test
- public void testCDMEntitySave() {
- Taxon taxon = (Taxon)taxonService.find(taxonUuid1);
- String oldTitleCache = taxon.getTitleCache();
-
- System.out.println("Taxon title : " + oldTitleCache);
-
- taxon.setTitleCache(oldTitleCache + ":updated", true);
- taxonService.merge(taxon);
-
- Taxon taxonNew = (Taxon)taxonService.find(taxonUuid1);
- System.out.println("New Taxon Title : " + taxonNew.getTitleCache());
-
- Assert.assertNotEquals("Title caches should not be equal",oldTitleCache,taxonNew.getTitleCache());
-
- taxonNew.setTitleCache(oldTitleCache, true);
- taxonService.merge(taxonNew);
-
- Taxon taxonOld = (Taxon)taxonService.find(taxonUuid1);
- System.out.println("Old Taxon Title : " + taxonOld.getTitleCache());
-
- Assert.assertEquals("Title caches should be equal",oldTitleCache,taxonOld.getTitleCache());
-
- }
-
-
- @Test
- public void testCDMEntitySaveLazyNew() {
- Team combAuthor = Team.NewInstance();
- combAuthor.addTeamMember(Person.NewTitledInstance("test member"));
- BotanicalName name = BotanicalName.NewInstance(null, "Test1", null, null, null, null, null, null, null);
- name.setCombinationAuthorTeam(combAuthor);
- Taxon tax1 = Taxon.NewInstance(name, null);
- UUID taxonUuid1 = taxonService.save(tax1);
-
- Taxon taxon = (Taxon)taxonService.find(taxonUuid1);
-
- NonViralName nvn = CdmBase.deproxy(taxon.getName(),NonViralName.class);
- String oldTitleCache = nvn.getTitleCache();
- logger.info("Taxon Name Title : " + oldTitleCache);
- nvn.setTitleCache(oldTitleCache + ":updated",false);
- taxonService.update(taxon);
-
- Taxon taxonNew = (Taxon)taxonService.find(taxonUuid1);
- NonViralName nvnNew = CdmBase.deproxy(taxon.getName(),NonViralName.class);
- logger.info("New Taxon Name Title : " + nvnNew.getTitleCache());
-
- Assert.assertNotEquals("Title caches should not be equal",oldTitleCache,nvnNew.getTitleCache());
-
- nvnNew.setTitleCache(oldTitleCache, true);
- taxonService.update(taxon);
-
- Taxon taxonOld = (Taxon)taxonService.find(taxonUuid1);
- NonViralName nvnOld = CdmBase.deproxy(taxon.getName(),NonViralName.class);
- logger.info("Old Taxon Name Title : " + nvnNew.getTitleCache());
-
- Assert.assertEquals("Title caches should be equal",oldTitleCache,nvnOld.getTitleCache());
- }
-
- @Ignore
- @Test
- public void testCDMEntitySaveCollection() {
- Taxon taxon = (Taxon)taxonService.find(taxonUuid1);
-
- Set<SynonymRelationship> synRelations = taxon.getSynonymRelations();
- Set<String> relToTitles = new HashSet<String>();
- Iterator<SynonymRelationship> srItr = synRelations.iterator();
- while(srItr.hasNext()) {
- SynonymRelationship sr = srItr.next();
- System.out.println("Synonym Title Cache : " + sr.getSynonym().getTitleCache());
- relToTitles.add(sr.getSynonym().getTitleCache());
- sr.getSynonym().setTitleCache(sr.getSynonym().getTitleCache() + ":updated");
-
- }
- taxonService.merge(taxon);
-
- Taxon taxonNew = (Taxon)taxonService.find(taxonUuid1);
- Set<SynonymRelationship> synRelationsNew = taxonNew.getSynonymRelations();
-
- Iterator<SynonymRelationship> srItrNew = synRelationsNew.iterator();
- Iterator<String> relToTitlesItr = relToTitles.iterator();
- while(srItrNew.hasNext() && relToTitlesItr.hasNext()) {
- SynonymRelationship srNew = srItrNew.next();
- String relToTitle = relToTitlesItr.next();
- System.out.println("New Synonym Title Cache: " + srNew.getSynonym().getTitleCache());
- Assert.assertNotEquals("Synonym Title caches should not be equal", srNew.getSynonym().getTitleCache(), relToTitle);
- srNew.getSynonym().setTitleCache(relToTitle);
- }
-
- Taxon taxonOld = (Taxon)taxonService.find(taxonUuid1);
-
- Set<SynonymRelationship> synRelationsOld = taxonNew.getSynonymRelations();
- Iterator<SynonymRelationship> srItrOld = synRelationsOld.iterator();
- relToTitlesItr = relToTitles.iterator();
- while(srItrOld.hasNext() && relToTitlesItr.hasNext()) {
- SynonymRelationship srOld = srItrOld.next();
- String relToTitle = relToTitlesItr.next();
- System.out.println("New Synonym Title Cache: " + srOld.getSynonym().getTitleCache());
- Assert.assertEquals("Synonym Title caches should be equal", srOld.getSynonym().getTitleCache(), relToTitle);
-
- }
- }
-}
+++ /dev/null
-// $Id$
-/**
-* Copyright (C) 2014 EDIT
-* European Distributed Institute of Taxonomy
-* http://www.e-taxonomy.eu
-*
-* The contents of this file are subject to the Mozilla Public License Version 1.1
-* See LICENSE.TXT at the top of this package for the full license terms.
-*/
-package eu.etaxonomy.taxeditor.lazyloading;
-
-import java.util.UUID;
-
-import org.apache.log4j.Level;
-import org.apache.log4j.Logger;
-import org.hibernate.collection.spi.PersistentCollection;
-import org.junit.Assert;
-import org.junit.BeforeClass;
-import org.junit.Test;
-
-import eu.etaxonomy.cdm.api.service.ICommonService;
-import eu.etaxonomy.cdm.api.service.IPolytomousKeyService;
-import eu.etaxonomy.cdm.api.service.ITaxonService;
-import eu.etaxonomy.cdm.model.common.CdmBase;
-import eu.etaxonomy.cdm.model.common.Language;
-import eu.etaxonomy.cdm.model.description.PolytomousKey;
-import eu.etaxonomy.cdm.model.description.PolytomousKeyNode;
-import eu.etaxonomy.cdm.model.name.NomenclaturalCode;
-import eu.etaxonomy.taxeditor.httpinvoker.BaseRemotingTest;
-import eu.etaxonomy.taxeditor.httpinvoker.CDMServer;
-
-/**
- * @author cmathew
- * @date 16 Oct 2014
- *
- */
-public class CdmEntityCacherTest extends BaseRemotingTest {
-
- private static final Logger logger = Logger.getLogger(CdmEntityCacherTest.class);
-
- UUID polytomousKeyUuid = UUID.fromString("0d53ba20-7de4-4baa-bd8a-401048447d66");
- UUID taxon1Uuid = UUID.fromString("2b336df7-29e8-4f79-985f-66502739d22f");
-
-
- IPolytomousKeyService polytomousKeyService = getRemoteApplicationController().getPolytomousKeyService();
- ICommonService commonService = getRemoteApplicationController().getCommonService();
- ITaxonService taxonService = getRemoteApplicationController().getTaxonService();
-
- Language english = Language.getLanguageFromUuid(Language.uuidEnglish);
-
- @BeforeClass
- public static void initializePolytomousKeyTest() {
- logger.setLevel(Level.INFO);
- CDMServer.getInstance().setKeepServerRunning(true);
-
- initializeController("default", "127.0.0.1", 8080, "", NomenclaturalCode.ICNAFP);
- }
-
- @Test
- public void testSimpleCache() {
-
-
- }
-
- @Test
- public void testCachingCdmEntities() {
- PolytomousKey pkey = CdmBase.deproxy(polytomousKeyService.find(polytomousKeyUuid),PolytomousKey.class);
- PolytomousKeyNode pkeynode = pkey.getRoot();
-
- PersistentCollection children = (PersistentCollection) pkeynode.getChildren();
- PolytomousKeyNode childNode0 = (PolytomousKeyNode)commonService.get(children, 0);
- PolytomousKey subkey1 = CdmBase.deproxy(childNode0.getSubkey(),PolytomousKey.class);
- String subkey1title = subkey1.getTitleCache();
- subkey1.setTitleCache(subkey1title + "test", true);
-
- PolytomousKeyNode childNode1 = (PolytomousKeyNode)commonService.get(children, 1);
- PolytomousKey subkey2 = CdmBase.deproxy(childNode1.getSubkey(),PolytomousKey.class);
- String subkey2title = subkey2.getTitleCache();
- subkey2.setTitleCache(subkey2title + "test", true);
-
- Assert.assertNotSame(subkey1, subkey2);
-
- polytomousKeyService.merge(pkey);
-
-
- }
-
-
-}
+++ /dev/null
-package eu.etaxonomy.taxeditor.lazyloading;
-
-import org.apache.log4j.Level;
-import org.apache.log4j.Logger;
-import org.junit.Assert;
-import org.junit.BeforeClass;
-import org.junit.Test;
-
-import eu.etaxonomy.cdm.api.cache.CdmServiceCacher;
-import eu.etaxonomy.cdm.model.common.Language;
-import eu.etaxonomy.taxeditor.httpinvoker.BaseRemotingTest;
-
-public class CdmServiceCacherTest extends BaseRemotingTest {
- private static final Logger logger = Logger.getLogger(CdmServiceCacherTest.class);
-
-
- private static CdmServiceCacher cdmServiceCacher;
-
- @BeforeClass
- public void initialize() {
- Logger.getRootLogger().setLevel(Level.INFO);
- cdmServiceCacher = (CdmServiceCacher)getRemoteApplicationController().getBean("cdmServiceCacher");
- }
-
- @Test
- public void testLanguageCache() {
- Language defaultLanguage = Language.getDefaultLanguage();
-
- Language defaultLanguageInCache = (Language)cdmServiceCacher.getFromCache(defaultLanguage.getUuid());
- Assert.assertEquals("Loaded Language Term should match Language Term in Cache",defaultLanguage,defaultLanguageInCache);
-
- Language language = Language.getLanguageFromUuid(Language.uuidFrench);
- Language languageInCache = (Language)cdmServiceCacher.getFromCache(language.getUuid());
- Assert.assertEquals("Loaded Language Term should match Language Term in Cache",language,languageInCache);
-
- }
-
-}
+++ /dev/null
-/**
- * Copyright (C) 2014 EDIT
- * European Distributed Institute of Taxonomy
- * http://www.e-taxonomy.eu
- *
- * The contents of this file are subject to the Mozilla Public License Version 1.1
- * See LICENSE.TXT at the top of this package for the full license terms.
- */
-
-package eu.etaxonomy.taxeditor.lazyloading;
-
-import java.util.Arrays;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Set;
-import java.util.UUID;
-
-import org.apache.log4j.Level;
-import org.apache.log4j.Logger;
-import org.junit.Assert;
-import org.junit.BeforeClass;
-import org.junit.Ignore;
-import org.junit.Test;
-
-import eu.etaxonomy.cdm.api.service.IClassificationService;
-import eu.etaxonomy.cdm.api.service.ITaxonService;
-import eu.etaxonomy.cdm.model.agent.Person;
-import eu.etaxonomy.cdm.model.agent.Team;
-import eu.etaxonomy.cdm.model.common.CdmBase;
-import eu.etaxonomy.cdm.model.name.BotanicalName;
-import eu.etaxonomy.cdm.model.name.NonViralName;
-import eu.etaxonomy.cdm.model.name.TaxonNameBase;
-import eu.etaxonomy.cdm.model.taxon.Classification;
-import eu.etaxonomy.cdm.model.taxon.SynonymRelationship;
-import eu.etaxonomy.cdm.model.taxon.Taxon;
-import eu.etaxonomy.cdm.model.taxon.TaxonNode;
-import eu.etaxonomy.taxeditor.httpinvoker.BaseRemotingTest;
-
-
-
-/**
- * Test class which tests remoting for persistent cdm entities.
- *
- * FIXME:Remoting saving tests are ignored until the merge development is underway
- * @author c.mathew
- *
- */
-//@DataSet
-public class RemoteLazyLoadingTest extends BaseRemotingTest {
-
- private static final Logger logger = Logger.getLogger(RemoteLazyLoadingTest.class);
-
- private static IClassificationService classificationService;
- private static ITaxonService taxonService;
-
- private static List<TaxonNode> taxonNodes;
-
- private final UUID taxonUuid1 = UUID.fromString("8217ef77-2ab1-4318-bd67-ccd0cdef07c4");
- private final UUID taxonUuid2 = UUID.fromString("ef96fafa-7750-4141-b31b-1ad1daab3e76");
-
-
- @BeforeClass
- public static void initializeRemoteLazyLoading() {
-
- Logger.getRootLogger().setLevel(Level.DEBUG);
- taxonService = getRemoteApplicationController().getTaxonService();
-
- classificationService= getRemoteApplicationController().getClassificationService();
- //List<Classification> classifications = classificationService.listClassifications(1,0,null,null);
-// Assert.assertFalse(classifications.isEmpty());
-//
-// Classification classification = classifications.get(0);
-// Assert.assertNotNull(classification);
- taxonNodes = classificationService.getAllNodes();
- Assert.assertFalse(taxonNodes.isEmpty());
-
- }
-
-
-
- @Test
- public void testCDMEntityGet() {
- Iterator<TaxonNode> taxonNodeItr = taxonNodes.iterator();
- int maxcount = 30;
- int count = 0;
- while(taxonNodeItr.hasNext() && count <= maxcount) {
- TaxonNode taxonNode = taxonNodeItr.next();
- Assert.assertNotNull(taxonNode);
-
- Taxon taxon = taxonNode.getTaxon();
- Assert.assertNotNull(taxon);
-
- String taxonTitle = taxon.getTitleCache();
- logger.info("Taxon : " + taxonTitle);
-
- TaxonNameBase name = taxon.getName();
- Assert.assertNotNull(name);
-
- String nameTitle = name.getTitleCache();
- logger.info("Taxon Name : " + nameTitle);
-
- count++;
- }
-
-
- }
-
- @Test
- public void test() {
-
- }
-
- @Test
- public void testCDMEntitySaveEager() {
- Taxon taxon = (Taxon)taxonService.find(taxonUuid1);
- String oldTitleCache = taxon.getTitleCache();
-
- System.out.println("Taxon title : " + oldTitleCache);
-
- taxon.setTitleCache(oldTitleCache + ":updated");
- taxonService.merge(taxon);
-
- Taxon taxonNew = (Taxon)taxonService.find(taxonUuid1);
- System.out.println("New Taxon Title : " + taxonNew.getTitleCache());
-
- Assert.assertNotEquals("Title caches should not be equal",oldTitleCache,taxonNew.getTitleCache());
-
- taxonNew.setTitleCache(oldTitleCache);
- taxonService.merge(taxonNew);
-
- Taxon taxonOld = (Taxon)taxonService.find(taxonUuid1);
- System.out.println("Old Taxon Title : " + taxonOld.getTitleCache());
-
- Assert.assertEquals("Title caches should be equal",oldTitleCache,taxonOld.getTitleCache());
-
- }
-
-
- @Test
- public void testCDMEntityUpdate() {
-
- Team combAuthor = Team.NewInstance();
- combAuthor.addTeamMember(Person.NewTitledInstance("test member"));
- BotanicalName name = BotanicalName.NewInstance(null, "Test1", null, null, null, null, null, null, null);
- name.setCombinationAuthorTeam(combAuthor);
- Taxon taxon = Taxon.NewInstance(name, null);
- UUID taxonUuid = taxonService.save(taxon);
-
- // Taxon taxon = (Taxon)taxonService.find(taxonUuid1);
- // NonViralName nvn = CdmBase.deproxy(taxon.getName(),NonViralName.class);
- // String oldTitleCache = nvn.getTitleCache();
- // System.out.println("Taxon Name Title : " + oldTitleCache);
- // nvn.setTitleCache(oldTitleCache + ":updated", true);
- //
- // taxon.setTitleCache(oldTitleCache + ":updated",true);
- // try {
- // taxonService.update(taxon);
- // } catch (LazyInitializationException lie) {
- // lie.printStackTrace();
- // }
-
- List<String> TAXON_INIT_STRATEGY = Arrays.asList(new String[] {
- "name"
- });
- Taxon taxonNew = (Taxon)taxonService.findTaxonByUuid(taxonUuid,TAXON_INIT_STRATEGY);
- NonViralName nvn = CdmBase.deproxy(taxonNew.getName(),NonViralName.class);
- Team team = CdmBase.deproxy(nvn.getCombinationAuthorTeam(),Team.class);
- String oldTitleCache = nvn.getTitleCache();
- System.out.println("Taxon Name Title : " + oldTitleCache);
- nvn.setTitleCache(oldTitleCache + ":updated", true);
- taxonService.update(taxonNew);
-
- }
-
-
- @Test
- public void testCDMEntitySaveLazy() {
- Taxon taxon = (Taxon)taxonService.find(taxonUuid1);
-
- NonViralName nvn = CdmBase.deproxy(taxon.getName(),NonViralName.class);
- String oldTitleCache = nvn.getTitleCache();
- System.out.println("Taxon Name Title : " + oldTitleCache);
- nvn.setTitleCache(oldTitleCache + ":updated", true);
- taxonService.update(taxon);
-
- // Taxon taxonNew = (Taxon)taxonService.find(taxonUuid1);
- // NonViralName nvnNew = CdmBase.deproxy(taxon.getName(),NonViralName.class);
- // System.out.println("New Taxon Name Title : " + nvnNew.getTitleCache());
- //
- // Assert.assertNotEquals("Title caches should not be equal",oldTitleCache,nvnNew.getTitleCache());
- //
- // nvnNew.setTitleCache(oldTitleCache, true);
- // taxonService.update(taxon);
- //
- // Taxon taxonOld = (Taxon)taxonService.find(taxonUuid1);
- // NonViralName nvnOld = CdmBase.deproxy(taxon.getName(),NonViralName.class);
- // System.out.println("Old Taxon Name Title : " + nvnNew.getTitleCache());
- //
- // Assert.assertEquals("Title caches should be equal",oldTitleCache,nvnOld.getTitleCache());
- }
-
- @Test
- public void testCDMEntitySaveLazyNew() {
- Team combAuthor = Team.NewInstance();
- combAuthor.addTeamMember(Person.NewTitledInstance("test member"));
- BotanicalName name = BotanicalName.NewInstance(null, "Test1", null, null, null, null, null, null, null);
- name.setCombinationAuthorTeam(combAuthor);
- Taxon tax1 = Taxon.NewInstance(name, null);
- UUID taxonUuid1 = taxonService.save(tax1);
-
- Taxon taxon = (Taxon)taxonService.find(taxonUuid1);
-
- NonViralName nvn = CdmBase.deproxy(taxon.getName(),NonViralName.class);
- String oldTitleCache = nvn.getTitleCache();
- logger.info("Taxon Name Title : " + oldTitleCache);
- nvn.setTitleCache(oldTitleCache + ":updated",false);
- taxonService.update(taxon);
-
- Taxon taxonNew = (Taxon)taxonService.find(taxonUuid1);
- NonViralName nvnNew = CdmBase.deproxy(taxon.getName(),NonViralName.class);
- logger.info("New Taxon Name Title : " + nvnNew.getTitleCache());
-
- Assert.assertNotEquals("Title caches should not be equal",oldTitleCache,nvnNew.getTitleCache());
-
- nvnNew.setTitleCache(oldTitleCache, true);
- taxonService.update(taxon);
-
- Taxon taxonOld = (Taxon)taxonService.find(taxonUuid1);
- NonViralName nvnOld = CdmBase.deproxy(taxon.getName(),NonViralName.class);
- logger.info("Old Taxon Name Title : " + nvnNew.getTitleCache());
-
- Assert.assertEquals("Title caches should be equal",oldTitleCache,nvnOld.getTitleCache());
- }
- @Ignore
- @Test
- public void testCDMEntitySaveCollection() {
- Taxon taxon = (Taxon)taxonService.find(taxonUuid1);
-
- Set<SynonymRelationship> synRelations = taxon.getSynonymRelations();
- Set<String> relToTitles = new HashSet<String>();
- Iterator<SynonymRelationship> srItr = synRelations.iterator();
- while(srItr.hasNext()) {
- SynonymRelationship sr = srItr.next();
- System.out.println("Synonym Title Cache : " + sr.getSynonym().getTitleCache());
- relToTitles.add(sr.getSynonym().getTitleCache());
- sr.getSynonym().setTitleCache(sr.getSynonym().getTitleCache() + ":updated");
-
- }
- taxonService.merge(taxon);
-
- Taxon taxonNew = (Taxon)taxonService.find(taxonUuid1);
- Set<SynonymRelationship> synRelationsNew = taxonNew.getSynonymRelations();
-
- Iterator<SynonymRelationship> srItrNew = synRelationsNew.iterator();
- Iterator<String> relToTitlesItr = relToTitles.iterator();
- while(srItrNew.hasNext() && relToTitlesItr.hasNext()) {
- SynonymRelationship srNew = srItrNew.next();
- String relToTitle = relToTitlesItr.next();
- System.out.println("New Synonym Title Cache: " + srNew.getSynonym().getTitleCache());
- Assert.assertNotEquals("Synonym Title caches should not be equal", srNew.getSynonym().getTitleCache(), relToTitle);
- srNew.getSynonym().setTitleCache(relToTitle);
- }
-
- Taxon taxonOld = (Taxon)taxonService.find(taxonUuid1);
-
- Set<SynonymRelationship> synRelationsOld = taxonNew.getSynonymRelations();
- Iterator<SynonymRelationship> srItrOld = synRelationsOld.iterator();
- relToTitlesItr = relToTitles.iterator();
- while(srItrOld.hasNext() && relToTitlesItr.hasNext()) {
- SynonymRelationship srOld = srItrOld.next();
- String relToTitle = relToTitlesItr.next();
- System.out.println("New Synonym Title Cache: " + srOld.getSynonym().getTitleCache());
- Assert.assertEquals("Synonym Title caches should be equal", srOld.getSynonym().getTitleCache(), relToTitle);
-
- }
- }
-}
+++ /dev/null
-/**
-* Copyright (C) 2014 EDIT
-* European Distributed Institute of Taxonomy
-* http://www.e-taxonomy.eu
-*
-* The contents of this file are subject to the Mozilla Public License Version 1.1
-* See LICENSE.TXT at the top of this package for the full license terms.
-*/
-package eu.etaxonomy.taxeditor.lazyloading;
-
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
-import org.apache.log4j.Level;
-import org.apache.log4j.Logger;
-import org.hibernate.collection.internal.AbstractPersistentCollection;
-import org.hibernate.collection.spi.PersistentCollection;
-import org.junit.Assert;
-import org.junit.BeforeClass;
-import org.junit.Test;
-
-import eu.etaxonomy.cdm.api.service.IClassificationService;
-import eu.etaxonomy.cdm.api.service.ICommonService;
-import eu.etaxonomy.cdm.model.common.Language;
-import eu.etaxonomy.cdm.model.common.LanguageString;
-import eu.etaxonomy.cdm.model.description.DescriptionElementBase;
-import eu.etaxonomy.cdm.model.description.TaxonDescription;
-import eu.etaxonomy.cdm.model.description.TextData;
-import eu.etaxonomy.cdm.model.name.TaxonNameBase;
-import eu.etaxonomy.cdm.model.taxon.Classification;
-import eu.etaxonomy.cdm.model.taxon.Taxon;
-import eu.etaxonomy.cdm.model.taxon.TaxonNode;
-import eu.etaxonomy.taxeditor.httpinvoker.BaseRemotingTest;
-
-/**
- * Test class which tests remoting for persistent collections.
- *
- * @author c.mathew
- * @created 13.03.2014
- */
-public class RemotePersistentCollectionTest extends BaseRemotingTest {
- private static final Logger logger = Logger.getLogger(RemotePersistentCollectionTest.class);
-
- private static IClassificationService classificationService;
- private static ICommonService commonService;
-
- @BeforeClass
- public void initializeServices() {
- Logger.getRootLogger().setLevel(Level.INFO);
- classificationService = getRemoteApplicationController().getClassificationService();
- commonService = getRemoteApplicationController().getCommonService();
- }
-
- /**
- * Test method which checks remoting for persistent lists.
- *
- */
- @Test
- public void persistentListTest() {
-
- List<TaxonNode> taxonNodes = classificationService.getAllNodes();
- int size = taxonNodes.size();
- logger.debug("classificationService.getAllNodes() size : " + size);
- TaxonNode taxonNode = null;
- if(size > 0) {
- Assert.assertFalse(taxonNodes.isEmpty());
-
- taxonNode = taxonNodes.get(0);
- Assert.assertNotNull(taxonNode);
- Assert.assertTrue(taxonNodes.contains(taxonNode));
-
- // get the list of child nodes, which will give a
- // proxy list which is not yet initialised
- List<TaxonNode> childNodes = taxonNode.getChildNodes();
- // this size call will first initialise the list locally by internally
- // calling the ICommonService.initializeCollection method and then
- // call size on the initialised list
- int childCount = childNodes.size();
-
- // this size call will initialise the list remotely and only return the
- // size of the list
- int remoteChildCount = commonService.size((PersistentCollection)childNodes);
- Assert.assertEquals(childCount, remoteChildCount);
-
- String firstNodeTaxonTitle = taxonNode.getTaxon().getTitleCache();
- Assert.assertNotNull(firstNodeTaxonTitle);
-
- if(childCount > 0) {
- Assert.assertFalse(childNodes.isEmpty());
- // this get call will use the already initialised list to get the
- // 0th element
- TaxonNode localTaxonNode = childNodes.get(0);
-
- // this get call will initialise the list remotely and only return the
- // 0th element from the list
- TaxonNode remoteTaxonNode = (TaxonNode)commonService.get((PersistentCollection)childNodes,0);
-
- // the locally and remotely retrieved taxon node should exist in the
- // (local and remote) child nodes list, should be not-null and should be equal to each other
- Assert.assertTrue(taxonNode.getChildNodes().contains(localTaxonNode));
- Assert.assertTrue(taxonNode.getChildNodes().contains(remoteTaxonNode));
- Assert.assertTrue(commonService.contains((PersistentCollection)childNodes, localTaxonNode));
- Assert.assertTrue(commonService.contains((PersistentCollection)childNodes, remoteTaxonNode));
- Assert.assertNotNull(remoteTaxonNode);
- Assert.assertNotNull(localTaxonNode);
- Assert.assertEquals(remoteTaxonNode,localTaxonNode);
- }
- }
- }
-
-// @Test
-// public void persistentSetTest() {
-// List<Classification> classifications = classificationService.listClassifications(1,0,null,null);
-// int size = classifications.size();
-// if(size > 0) {
-// Assert.assertFalse(classifications.isEmpty());
-//
-// Classification classification = classifications.get(0);
-// Assert.assertNotNull(classification);
-// Assert.assertTrue(classifications.contains(classification));
-//
-// TaxonNode rootTaxonNode = classification.getRootNode();
-// // get the list of child nodes, which will give a
-// // proxy list which is not yet initialised
-// List<TaxonNode> childNodes = rootTaxonNode.getChildNodes();
-//
-// // this size call will initialise the list locally by internally
-// // calling the ICommonService.initializeCollection method
-// int childCount = childNodes.size();
-//
-// if(childCount > 0) {
-// Assert.assertFalse(childNodes.isEmpty());
-//
-// // this get call will use the already initialised list to get the
-// // 0th element
-// Taxon localTaxon = childNodes.get(0).getTaxon();
-// Assert.assertNotNull(localTaxon);
-//
-// TaxonNameBase taxonName = localTaxon.getName();
-// Assert.assertNotNull(taxonName);
-//
-// // get the list of taxa, which will give a
-// // proxy set which is not yet initialised
-// Set<Taxon> taxa = taxonName.getTaxonBases();
-//
-// // this size call will initialise the list locally by internally
-// // calling the ICommonService.initializeCollection method
-// int taxaCount = taxa.size();
-// Assert.assertNotEquals(taxaCount,-1);
-//
-// if(taxaCount > 0) {
-// Assert.assertFalse(taxa.isEmpty());
-// // the locally retrieved taxon should exist in the
-// // (local and remote) taxon list and should be not-null
-// Assert.assertTrue(taxa.contains(localTaxon));
-// Assert.assertNotNull(localTaxon);
-// Assert.assertTrue(commonService.contains((PersistentCollection)taxa, localTaxon));
-// }
-// }
-// }
-// }
-
- @Test
- public void persistentMapTest() {
- List<TaxonNode> taxonNodes = classificationService.getAllNodes();
- // calling iterator will initialise the collection
- Iterator<TaxonNode> taxonNodesItr = taxonNodes.iterator();
- while(taxonNodesItr.hasNext()) {
- TaxonNode taxonNode = taxonNodesItr.next();
- Taxon taxon = taxonNode.getTaxon();
-
- if(taxon != null) {
- Set<TaxonDescription> descriptions = taxon.getDescriptions();
- Iterator<TaxonDescription> descriptionsItr = descriptions.iterator();
- while(descriptionsItr.hasNext()) {
- TaxonDescription desc = descriptionsItr.next();
- if(desc != null) {
- for (DescriptionElementBase element : desc.getElements()){
- if (element.isInstanceOf(TextData.class)){
- // usually a call to 'get' collections should not initialise the collection,
- // but the 'getMultilanguageText' call internally calls readSize on the collection
- // which triggers the initialisation
- Map<Language, LanguageString> multilanguagetextMap = ((TextData)element).getMultilanguageText();
- //boolean init = AbstractPersistentCollection.isInitialized(multilanguagetextMap);
- //Assert.assertTrue(init);
-
- if(!multilanguagetextMap.isEmpty()) {
- // found a map whcih we can test!
- logger.info("Found Non-empty multilanguagetextMap");
- boolean empty = commonService.isEmpty((PersistentCollection)multilanguagetextMap);
- Assert.assertFalse(empty);
- // test retrieval of key set, which should already by initialised
- Set<Language> langKeySet = multilanguagetextMap.keySet();
- Iterator<Language> langKeySetItr = langKeySet.iterator();
- while(langKeySetItr.hasNext()) {
- Language key = langKeySetItr.next();
- // testing 'containsKey' on locally initialised collection
- boolean localContainsKey = multilanguagetextMap.containsKey(key);
- Assert.assertTrue(localContainsKey);
- // testing 'containsKey' on remotely initialised collection
- boolean remoteContainsKey =
- commonService.containsKey((PersistentCollection)multilanguagetextMap, key);
- Assert.assertTrue(remoteContainsKey);
-
- LanguageString value = multilanguagetextMap.get(key);
- // testing 'containsValue' on locally initialised collection
- boolean localContainsValue = multilanguagetextMap.containsValue(value);
- Assert.assertTrue(localContainsValue);
- // testing 'containsValue' on remotely initialised collection
- boolean remoteContainsValue =
- commonService.containsValue((PersistentCollection)multilanguagetextMap, value);
- Assert.assertTrue(remoteContainsValue);
-
- }
- return;
- }
- }
- }
- }
- }
- }
- }
- }
-}
+++ /dev/null
-<?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:tx="http://www.springframework.org/schema/tx"
- xmlns:context="http://www.springframework.org/schema/context"
- xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.1.xsd
- http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-2.5.xsd
- http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.5.xsd
- ">
-
- <!--
- DataSourceProperties allow configuring specific properties of the datasources
-
- * cdmlib-remote.xslBasePath:
- alternative base path for REST services to retrieve XSL style sheets from.
- the base path must be on the same domain since cross domain xsl loading is
- not permitted
- -->
- <bean id="dataSourceProperties" class="eu.etaxonomy.cdm.remote.config.DataSourceProperties">
- <property name="propsMap">
- <map>
- <!--
- <entry key="dataSourceBeanID">
- <props>
- <prop key="cdmlib-remote.xslBasePath">/xsl</prop>
- </props>
- </entry>
- -->
- </map>
- </property>
- </bean>
-
- <bean id="cdmTest" lazy-init="true" class="com.mchange.v2.c3p0.ComboPooledDataSource">
- <property name="driverClass" value="eu.etaxonomy.cdm.database.LocalH2"/>
- <property name="user" value="sa" />
- <property name="password" value="" />
- <property name="jdbcUrl" value="jdbc:h2:file:./target/test-classes/h2/cdmTest;AUTO_SERVER=TRUE"/>
- </bean>
-</beans>
\ No newline at end of file
+++ /dev/null
-<?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.springf