eu.etaxonomy.taxeditor.cdmlib/lib/activation-1.1.1.jar -text
eu.etaxonomy.taxeditor.cdmlib/lib/antlr-2.7.7.jar -text
eu.etaxonomy.taxeditor.cdmlib/lib/aopalliance-1.0.jar -text
-eu.etaxonomy.taxeditor.cdmlib/lib/aspectjrt-1.7.1-sources.jar -text
eu.etaxonomy.taxeditor.cdmlib/lib/aspectjrt-1.7.1.jar -text
-eu.etaxonomy.taxeditor.cdmlib/lib/aspectjweaver-1.7.1-sources.jar -text
eu.etaxonomy.taxeditor.cdmlib/lib/aspectjweaver-1.7.1.jar -text
eu.etaxonomy.taxeditor.cdmlib/lib/avro-1.6.3.jar -text
eu.etaxonomy.taxeditor.cdmlib/lib/batik-anim-1.7.jar -text
eu.etaxonomy.taxeditor.cdmlib/lib/stax-1.2.0.jar -text
eu.etaxonomy.taxeditor.cdmlib/lib/stax-api-1.0.1.jar -text
eu.etaxonomy.taxeditor.cdmlib/lib/swagger-annotations-1.3.5.jar -text
-eu.etaxonomy.taxeditor.cdmlib/lib/unitils-core-3.3.jar -text
-eu.etaxonomy.taxeditor.cdmlib/lib/unitils-database-3.3.jar -text
-eu.etaxonomy.taxeditor.cdmlib/lib/unitils-dbmaintainer-3.3.jar -text
-eu.etaxonomy.taxeditor.cdmlib/lib/unitils-dbunit-3.3.jar -text
-eu.etaxonomy.taxeditor.cdmlib/lib/unitils-easymock-3.3.jar -text
-eu.etaxonomy.taxeditor.cdmlib/lib/unitils-inject-3.3.jar -text
-eu.etaxonomy.taxeditor.cdmlib/lib/unitils-mock-3.3.jar -text
-eu.etaxonomy.taxeditor.cdmlib/lib/unitils-orm-3.3.jar -text
-eu.etaxonomy.taxeditor.cdmlib/lib/unitils-spring-3.3.jar -text
+eu.etaxonomy.taxeditor.cdmlib/lib/unitils-core-3.4.2.jar -text
+eu.etaxonomy.taxeditor.cdmlib/lib/unitils-database-3.4.2.jar -text
+eu.etaxonomy.taxeditor.cdmlib/lib/unitils-dbmaintainer-3.4.2.jar -text
+eu.etaxonomy.taxeditor.cdmlib/lib/unitils-dbunit-3.4.2.jar -text
+eu.etaxonomy.taxeditor.cdmlib/lib/unitils-spring-3.4.2.jar -text
eu.etaxonomy.taxeditor.cdmlib/lib/usertype.jodatime-2.0.1.jar -text
eu.etaxonomy.taxeditor.cdmlib/lib/usertype.spi-2.0.1.jar -text
eu.etaxonomy.taxeditor.cdmlib/lib/validation-api-1.0.0.GA.jar -text
eu.etaxonomy.taxeditor.cdmlib/pom.xml -text
eu.etaxonomy.taxeditor.cdmlib/src/main/java/eu/etaxonomy/cdm/api/application/CdmApplicationRemoteConfiguration.java -text
eu.etaxonomy.taxeditor.cdmlib/src/main/java/eu/etaxonomy/cdm/api/application/CdmApplicationRemoteController.java -text
+eu.etaxonomy.taxeditor.cdmlib/src/main/java/eu/etaxonomy/cdm/api/application/RemotingMonitoredGenericApplicationContext.java -text
+eu.etaxonomy.taxeditor.cdmlib/src/main/java/eu/etaxonomy/cdm/api/application/RemotingMonitoredListableBeanFactory.java -text
eu.etaxonomy.taxeditor.cdmlib/src/main/java/eu/etaxonomy/cdm/api/cache/CdmServiceCacher.java -text
-eu.etaxonomy.taxeditor.cdmlib/src/main/java/eu/etaxonomy/cdm/api/lazyloading/CdmLazyLoader.java -text
-eu.etaxonomy.taxeditor.cdmlib/src/main/java/eu/etaxonomy/cdm/remote/CdmPersistentRemoteSource.java -text
-eu.etaxonomy.taxeditor.cdmlib/src/main/java/eu/etaxonomy/cdm/remote/CdmRemoteSource.java -text
-eu.etaxonomy.taxeditor.cdmlib/src/main/java/eu/etaxonomy/cdm/remote/CdmRemoteSourceBase.java -text
-eu.etaxonomy.taxeditor.cdmlib/src/main/java/eu/etaxonomy/cdm/remote/CdmRemoteSourceException.java -text
-eu.etaxonomy.taxeditor.cdmlib/src/main/java/eu/etaxonomy/cdm/remote/ICdmRemoteSource.java -text
+eu.etaxonomy.taxeditor.cdmlib/src/main/java/eu/etaxonomy/taxeditor/remoting/CdmEagerLoadingException.java -text
+eu.etaxonomy.taxeditor.cdmlib/src/main/java/eu/etaxonomy/taxeditor/remoting/CdmRemotingException.java -text
+eu.etaxonomy.taxeditor.cdmlib/src/main/java/eu/etaxonomy/taxeditor/remoting/cache/CacheLoader.java -text
+eu.etaxonomy.taxeditor.cdmlib/src/main/java/eu/etaxonomy/taxeditor/remoting/cache/CdmClientCacheException.java -text
+eu.etaxonomy.taxeditor.cdmlib/src/main/java/eu/etaxonomy/taxeditor/remoting/cache/CdmEntityCacheKey.java -text
+eu.etaxonomy.taxeditor.cdmlib/src/main/java/eu/etaxonomy/taxeditor/remoting/cache/CdmModelCacher.java -text
+eu.etaxonomy.taxeditor.cdmlib/src/main/java/eu/etaxonomy/taxeditor/remoting/cache/CdmModelFieldPropertyFromClass.java -text
+eu.etaxonomy.taxeditor.cdmlib/src/main/java/eu/etaxonomy/taxeditor/remoting/cache/CdmRemoteCacheManager.java -text
+eu.etaxonomy.taxeditor.cdmlib/src/main/java/eu/etaxonomy/taxeditor/remoting/cache/CdmTransientEntityCacher.java -text
+eu.etaxonomy.taxeditor.cdmlib/src/main/java/eu/etaxonomy/taxeditor/remoting/cache/EntityCacherDebugResult.java -text
+eu.etaxonomy.taxeditor.cdmlib/src/main/java/eu/etaxonomy/taxeditor/remoting/cache/ProxyUtils.java -text
+eu.etaxonomy.taxeditor.cdmlib/src/main/java/eu/etaxonomy/taxeditor/remoting/server/CDMServerException.java -text
+eu.etaxonomy.taxeditor.cdmlib/src/main/java/eu/etaxonomy/taxeditor/remoting/source/CdmPersistentRemoteSource.java -text
+eu.etaxonomy.taxeditor.cdmlib/src/main/java/eu/etaxonomy/taxeditor/remoting/source/CdmRemoteSource.java -text
+eu.etaxonomy.taxeditor.cdmlib/src/main/java/eu/etaxonomy/taxeditor/remoting/source/CdmRemoteSourceBase.java -text
+eu.etaxonomy.taxeditor.cdmlib/src/main/java/eu/etaxonomy/taxeditor/remoting/source/CdmRemoteSourceException.java -text
+eu.etaxonomy.taxeditor.cdmlib/src/main/java/eu/etaxonomy/taxeditor/remoting/source/CdmServerInfo.java -text
+eu.etaxonomy.taxeditor.cdmlib/src/main/java/eu/etaxonomy/taxeditor/remoting/source/ICdmRemoteSource.java -text
+eu.etaxonomy.taxeditor.cdmlib/src/main/java/eu/etaxonomy/taxeditor/service/CachedCommonServiceImpl.java -text
+eu.etaxonomy.taxeditor.cdmlib/src/main/java/eu/etaxonomy/taxeditor/service/CdmAuthenticatedHttpInvokerRequestExecutor.java -text
+eu.etaxonomy.taxeditor.cdmlib/src/main/java/eu/etaxonomy/taxeditor/service/CdmServiceInterceptorException.java -text
+eu.etaxonomy.taxeditor.cdmlib/src/main/java/eu/etaxonomy/taxeditor/service/CdmServiceRequestExecutor.java -text
+eu.etaxonomy.taxeditor.cdmlib/src/main/java/eu/etaxonomy/taxeditor/service/ICachedCommonService.java -text
+eu.etaxonomy.taxeditor.cdmlib/src/main/java/eu/etaxonomy/taxeditor/service/TermServiceRequestExecutor.java -text
+eu.etaxonomy.taxeditor.cdmlib/src/main/java/eu/etaxonomy/taxeditor/session/CdmClientSessionException.java -text
+eu.etaxonomy.taxeditor.cdmlib/src/main/java/eu/etaxonomy/taxeditor/session/CdmEntitySession.java -text
+eu.etaxonomy.taxeditor.cdmlib/src/main/java/eu/etaxonomy/taxeditor/session/CdmEntitySessionManager.java -text
+eu.etaxonomy.taxeditor.cdmlib/src/main/java/eu/etaxonomy/taxeditor/session/ICdmEntitySession.java -text
+eu.etaxonomy.taxeditor.cdmlib/src/main/java/eu/etaxonomy/taxeditor/session/ICdmEntitySessionEnabled.java -text
+eu.etaxonomy.taxeditor.cdmlib/src/main/java/eu/etaxonomy/taxeditor/session/ICdmEntitySessionManager.java -text
+eu.etaxonomy.taxeditor.cdmlib/src/main/java/eu/etaxonomy/taxeditor/session/ICdmEntitySessionManagerObserver.java -text
+eu.etaxonomy.taxeditor.cdmlib/src/main/java/eu/etaxonomy/taxeditor/session/mock/MockCdmEntitySession.java -text
+eu.etaxonomy.taxeditor.cdmlib/src/main/java/eu/etaxonomy/taxeditor/session/mock/MockCdmEntitySessionManager.java -text
eu.etaxonomy.taxeditor.cdmlib/src/main/java/org/hibernate/collection/internal/AbstractPersistentCollection.java -text
eu.etaxonomy.taxeditor.cdmlib/src/main/java/org/hibernate/proxy/AbstractLazyInitializer.java -text
+eu.etaxonomy.taxeditor.cdmlib/src/main/resources/cdmlib-ehcache.xml -text
+eu.etaxonomy.taxeditor.cdmlib/src/main/resources/etc/jetty/.svnignore -text
+eu.etaxonomy.taxeditor.cdmlib/src/main/resources/etc/jetty/cdmlib-remote-webapp.war -text
+eu.etaxonomy.taxeditor.cdmlib/src/main/resources/etc/jetty/jetty-runner-9.2.3.v20140905.jar -text
+eu.etaxonomy.taxeditor.cdmlib/src/main/resources/etc/jetty/start-9.2.3.v20140905.jar -text
eu.etaxonomy.taxeditor.cdmlib/src/main/resources/eu/etaxonomy/cdm/config.properties -text
eu.etaxonomy.taxeditor.cdmlib/src/main/resources/eu/etaxonomy/cdm/httpInvokerServiceClients.xml -text
eu.etaxonomy.taxeditor.cdmlib/src/main/resources/eu/etaxonomy/cdm/localApplicationContext.xml -text
+eu.etaxonomy.taxeditor.cdmlib/src/main/resources/eu/etaxonomy/cdm/mappings/hibernate.cfg.xml -text
eu.etaxonomy.taxeditor.cdmlib/src/main/resources/eu/etaxonomy/cdm/remotingApplicationContext.xml -text
eu.etaxonomy.taxeditor.cdmlib/src/main/resources/eu/etaxonomy/cdm/remoting_persistence_security.xml -text
eu.etaxonomy.taxeditor.cdmlib/src/main/resources/eu/etaxonomy/cdm/remoting_services_security.xml -text
-eu.etaxonomy.taxeditor.cdmlib/src/test/resources/eu/etaxonomy/cdm/datasources/cdm.datasources.xml -text
+eu.etaxonomy.taxeditor.cdmlib/src/main/resources/log4j.properties -text
eu.etaxonomy.taxeditor.editor/.classpath -text
eu.etaxonomy.taxeditor.editor/.project -text
eu.etaxonomy.taxeditor.editor/META-INF/MANIFEST.MF -text
eu.etaxonomy.taxeditor.editor/plugin.xml -text
eu.etaxonomy.taxeditor.editor/pom.xml -text
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/CdmDataTransfer.java -text
+eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/CdmEntitySessionInput.java -text
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/ChooseFromMultipleTaxonNodesDialog.java -text
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/EditorCdmViewer.java -text
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/EditorStateManager.java -text
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/featuretree/SelectFeatureTreeWizard.java -text
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/featuretree/SelectFeatureTreeWizardPage.java -text
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/handler/OpenDistributionEditorWizardHandler.java -text
+<<<<<<< HEAD
+eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/handler/OpenInspectSessionsHandler.java -text
+=======
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/handler/OpenHandler.java -text
+>>>>>>> 02176688eaa23a31ff5b71c317cb5ee685483aa4
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/handler/OpenPasswordWizzardHandler.java -text
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/handler/ShowLoginWindowHandler.java -text
+eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/handler/ShowRemotingLoginWindowHandler.java -text
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/identificationkey/AbstractIdentificaitonKeyWizard.java -text
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/io/AbstractIOManager.java -text
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/io/ExportManager.java -text
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/operation/AbstractPostOperation.java -text
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/operation/AbstractPostTaxonOperation.java -text
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/operation/IPostOperationEnabled.java -text
-eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/parser/MatchStrategyConfigurator.java -text
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/parser/ParseHandler.java -text
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/preference/CdmPreferences.java -text
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/preference/CdmStorePropertyTester.java -text
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/combo/VocabularyComboElement.java -text
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/dialog/DefaultLanguageDialog.java -text
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/dialog/LoginDialog.java -text
+eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/dialog/RemotingLoginDialog.java -text
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/dialog/UriDialog.java -text
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/dialog/deleteConfigurator/DeleteConfiguratorComposite.java -text
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/dialog/deleteConfigurator/DeleteConfiguratorDialog.java -text
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/view/detail/DetailsViewPart.java -text
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/view/detail/DetailsViewer.java -text
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/view/reporting/ReportingViewPart.java -text
+eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/view/sessions/InspectSessionsDialog.java -text
+eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/view/sessions/SessionsViewPart.java -text
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/view/specimenSearch/SpecimenProviderSelectionComposite.java -text
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/view/specimenSearch/SpecimenProviderSelectionController.java -text
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/view/specimenSearch/SpecimenSearchComposite.java -text
eu.etaxonomy.taxeditor.test/META-INF/MANIFEST.MF -text
eu.etaxonomy.taxeditor.test/build.properties -text
eu.etaxonomy.taxeditor.test/ide/eclipse/EDITor[!!-~]Tests.launch -text
+eu.etaxonomy.taxeditor.test/lib/byte-buddy-0.5.1.jar -text
eu.etaxonomy.taxeditor.test/pom.xml -text
+eu.etaxonomy.taxeditor.test/src/main/resources/cdmlib-ehcache.xml -text
+eu.etaxonomy.taxeditor.test/src/main/resources/datasources.xml -text
+eu.etaxonomy.taxeditor.test/src/main/resources/eu/etaxonomy/cdm/api/cache/CdmClientCachingTest.xml -text
+eu.etaxonomy.taxeditor.test/src/main/resources/eu/etaxonomy/cdm/cdm.datasources.xml -text
+eu.etaxonomy.taxeditor.test/src/main/resources/eu/etaxonomy/cdm/model/PolytomousKeyTest.xml -text
+eu.etaxonomy.taxeditor.test/src/main/resources/eu/etaxonomy/cdm/model/TaxonNameEditorTest.xml -text
+eu.etaxonomy.taxeditor.test/src/main/resources/eu/etaxonomy/cdm/model/TaxonNavigatorTest.xml -text
+eu.etaxonomy.taxeditor.test/src/main/resources/eu/etaxonomy/cdm/testRemotingApplicationContext.xml -text
+eu.etaxonomy.taxeditor.test/src/main/resources/eu/etaxonomy/taxeditor/lazyloading/AbstractLazyInitializerTest.xml -text
+eu.etaxonomy.taxeditor.test/src/main/resources/eu/etaxonomy/taxeditor/lazyloading/CdmEntityCacherTest.xml -text
+eu.etaxonomy.taxeditor.test/src/main/resources/eu/etaxonomy/taxeditor/remoting/session/CdmEntitySessionManagerTest.xml -text
+eu.etaxonomy.taxeditor.test/src/main/resources/h2/cdmTest.h2.db -text
+eu.etaxonomy.taxeditor.test/src/main/resources/h2/cdmTest.trace.db -text
+eu.etaxonomy.taxeditor.test/src/main/resources/log4j.properties -text
eu.etaxonomy.taxeditor.test/src/main/resources/log4j.xml -text
+eu.etaxonomy.taxeditor.test/src/main/resources/unitils.properties -text
+eu.etaxonomy.taxeditor.test/src/test/java/eu/etaxonomy/cdm/api/cache/CdmClientCachingTest.java -text
+eu.etaxonomy.taxeditor.test/src/test/java/eu/etaxonomy/cdm/api/cache/CdmModelGetMethodCacherTest.java -text
+eu.etaxonomy.taxeditor.test/src/test/java/eu/etaxonomy/cdm/model/PolytomousKeyTest.java -text
+eu.etaxonomy.taxeditor.test/src/test/java/eu/etaxonomy/cdm/model/TaxonNameEditorTest.java -text
+eu.etaxonomy.taxeditor.test/src/test/java/eu/etaxonomy/cdm/model/TaxonNavigatorTest.java -text
eu.etaxonomy.taxeditor.test/src/test/java/eu/etaxonomy/taxeditor/application/menu/general/NewMenuTest.java -text
+eu.etaxonomy.taxeditor.test/src/test/java/eu/etaxonomy/taxeditor/httpinvoker/BaseRemotingTest.java -text
+eu.etaxonomy.taxeditor.test/src/test/java/eu/etaxonomy/taxeditor/httpinvoker/CDMServer.java -text
+eu.etaxonomy.taxeditor.test/src/test/java/eu/etaxonomy/taxeditor/httpinvoker/CdmPersistentRemoteSourceTest.java -text
+eu.etaxonomy.taxeditor.test/src/test/java/eu/etaxonomy/taxeditor/httpinvoker/CdmRemoteSourceTest.java -text
+eu.etaxonomy.taxeditor.test/src/test/java/eu/etaxonomy/taxeditor/httpinvoker/CdmServerTest.java -text
+eu.etaxonomy.taxeditor.test/src/test/java/eu/etaxonomy/taxeditor/httpinvoker/CdmServerTestManager.java -text
+eu.etaxonomy.taxeditor.test/src/test/java/eu/etaxonomy/taxeditor/httpinvoker/HttpInvokerServicesTest.java -text
+eu.etaxonomy.taxeditor.test/src/test/java/eu/etaxonomy/taxeditor/lazyloading/AbstractLazyInitializerTest.java -text
+eu.etaxonomy.taxeditor.test/src/test/java/eu/etaxonomy/taxeditor/lazyloading/CdmEntityCacherTest.java -text
+eu.etaxonomy.taxeditor.test/src/test/java/eu/etaxonomy/taxeditor/lazyloading/CdmServiceCacherTest.java -text
+eu.etaxonomy.taxeditor.test/src/test/java/eu/etaxonomy/taxeditor/lazyloading/RemoteLazyLoadingTest.java -text
+eu.etaxonomy.taxeditor.test/src/test/java/eu/etaxonomy/taxeditor/lazyloading/RemotePersistentCollectionTest.java -text
eu.etaxonomy.taxeditor.test/src/test/java/eu/etaxonomy/taxeditor/navigation/navigator/contextmenu/ClassificationTest.java -text
eu.etaxonomy.taxeditor.test/src/test/java/eu/etaxonomy/taxeditor/newWizard/NewTaxonWizardTest.java -text
+eu.etaxonomy.taxeditor.test/src/test/java/eu/etaxonomy/taxeditor/operations/OperationTestBase.java -text
+eu.etaxonomy.taxeditor.test/src/test/java/eu/etaxonomy/taxeditor/service/ITestService.java -text
+eu.etaxonomy.taxeditor.test/src/test/java/eu/etaxonomy/taxeditor/service/ServiceInterceptorTest.java -text
+eu.etaxonomy.taxeditor.test/src/test/java/eu/etaxonomy/taxeditor/service/ServiceRebasingTest.java -text
+eu.etaxonomy.taxeditor.test/src/test/java/eu/etaxonomy/taxeditor/service/TargetTestService.java -text
+eu.etaxonomy.taxeditor.test/src/test/java/eu/etaxonomy/taxeditor/service/TestService.java -text
+eu.etaxonomy.taxeditor.test/src/test/java/eu/etaxonomy/taxeditor/session/CdmEntitySessionManagerTest.java -text
+eu.etaxonomy.taxeditor.test/src/test/java/eu/etaxonomy/taxeditor/session/MockSessionOwner.java -text
eu.etaxonomy.taxeditor.test/src/test/java/eu/etaxonomy/taxeditor/test/AbstractEditorTest.java -text
eu.etaxonomy.taxeditor.test/src/test/java/eu/etaxonomy/taxeditor/test/ContextMenuHelper.java -text
eu.etaxonomy.taxeditor.test/src/test/java/eu/etaxonomy/taxeditor/test/SwtBotUtils.java -text
+eu.etaxonomy.taxeditor.test/src/test/java/eu/etaxonomy/taxeditor/ui/dialogs/CdmServerInfoTest.java -text
eu.etaxonomy.taxeditor.test/src/test/java/eu/etaxonomy/taxeditor/ui/dialogs/LoginDialogTest.java -text
eu.etaxonomy.taxeditor.test/src/test/java/eu/etaxonomy/taxeditor/ui/selection/AbstractSelectionElementTest.java -text
eu.etaxonomy.taxeditor.test/src/test/java/eu/etaxonomy/taxeditor/ui/selection/ClassificationSelectionElementTest.java -text
/.project
+eu.etaxonomy.taxeditor.cdmlib/src/main/resources/etc/jetty/*
eu.etaxonomy.taxeditor.application/.settings
eu.etaxonomy.taxeditor.application/target
eu.etaxonomy.taxeditor.bulkeditor/.settings
eu.etaxonomy.taxeditor.cdmlib/cdmlib-*.jar
eu.etaxonomy.taxeditor.cdmlib/cdmlib-*.zip
eu.etaxonomy.taxeditor.cdmlib/dist
+eu.etaxonomy.taxeditor.cdmlib/lib/cdm-server*
eu.etaxonomy.taxeditor.cdmlib/lib/cdmlib*
eu.etaxonomy.taxeditor.cdmlib/lib/org.eclipse.equinox.servletbridge.extensionbundle-1.2.0.v20100503.jar
eu.etaxonomy.taxeditor.cdmlib/lib/org.eclipse.equinox.transforms.hook-1.0.300.v20100719.jar
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
<classpathentry including="**/*.java" kind="src" path="src/main/java"/>
<classpathentry kind="src" path="src/main/resources"/>
+ <classpathentry kind="src" path="src/test/java/"/>
<classpathentry kind="output" path="target/classes"/>
</classpath>
name="eu.etaxonomy.taxeditor.application.filemenu.io"\r
visible="true">\r
</separator>\r
+ <command\r
+ commandId="eu.etaxonomy.taxeditor.store.operations.showRemotingLoginWindow"\r
+ id="eu.etaxonomy.taxeditor.application.menu.login"\r
+ label="Connect"\r
+ style="push">\r
+ </command>\r
<command\r
commandId="org.eclipse.ui.file.exit"\r
id="eu.etaxonomy.taxeditor.application.menu.exit"\r
id="eu.etaxonomy.taxeditor.install"\r
name="%command.label.18">\r
</command>\r
+ <command\r
+ defaultHandler="eu.etaxonomy.taxeditor.handler.ShowRemotingLoginWindowHandler"\r
+ id="eu.etaxonomy.taxeditor.store.operations.showRemotingLoginWindow"\r
+ name="Connect">\r
+ </command>\r
</extension>\r
\r
\r
/**
* Prefix to declare the version as beta
*/
- private static final String BETA_PREFIX = "[Beta]";
+ private static final String BETA_PREFIX = "[REMOTING]";
/**
* @return
<classpath>
<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 kind="src" path="src/main/java"/>
- <classpathentry kind="src" path="src/main/resources"/>
- <classpathentry kind="src" path="src/test/java/"/>
+ <classpathentry including="**/*.java" kind="src" path="src/main/java"/>
+ <classpathentry excluding="**/*.java" kind="src" path="src/main/resources"/>
+ <classpathentry kind="src" path="src/test/java"/>
<classpathentry exported="true" kind="lib" path="lib/activation-1.1.1.jar"/>
<classpathentry exported="true" kind="lib" path="lib/antlr-2.7.7.jar"/>
<classpathentry exported="true" kind="lib" path="lib/aopalliance-1.0.jar"/>
<classpathentry exported="true" kind="lib" path="lib/spring-security-core-3.1.3.RELEASE.jar"/>
<classpathentry exported="true" kind="lib" path="lib/stax-1.2.0.jar"/>
<classpathentry exported="true" kind="lib" path="lib/stax-api-1.0.1.jar"/>
- <classpathentry exported="true" kind="lib" path="lib/unitils-core-3.3.jar"/>
- <classpathentry exported="true" kind="lib" path="lib/unitils-database-3.3.jar"/>
- <classpathentry exported="true" kind="lib" path="lib/unitils-dbmaintainer-3.3.jar"/>
- <classpathentry exported="true" kind="lib" path="lib/unitils-dbunit-3.3.jar"/>
- <classpathentry exported="true" kind="lib" path="lib/unitils-easymock-3.3.jar"/>
- <classpathentry exported="true" kind="lib" path="lib/unitils-inject-3.3.jar"/>
- <classpathentry exported="true" kind="lib" path="lib/unitils-mock-3.3.jar"/>
- <classpathentry exported="true" kind="lib" path="lib/unitils-orm-3.3.jar"/>
- <classpathentry exported="true" kind="lib" path="lib/unitils-spring-3.3.jar"/>
<classpathentry exported="true" kind="lib" path="lib/usertype.jodatime-2.0.1.jar"/>
<classpathentry exported="true" kind="lib" path="lib/usertype.spi-2.0.1.jar"/>
<classpathentry exported="true" kind="lib" path="lib/validation-api-1.0.0.GA.jar"/>
<classpathentry exported="true" kind="lib" path="lib/spring-security-remoting-3.1.3.RELEASE.jar"/>
<classpathentry exported="true" kind="lib" path="lib/jena-core-2.11.2.jar"/>
<classpathentry exported="true" kind="lib" path="lib/jena-iri-1.0.2.jar"/>
- <classpathentry exported="true" kind="lib" path="lib/cdmlib-commons-3.6.1-SNAPSHOT-sources.jar"/>
<classpathentry exported="true" kind="lib" path="lib/cdmlib-commons-3.6.1-SNAPSHOT.jar"/>
- <classpathentry exported="true" kind="lib" path="lib/cdmlib-ext-3.6.1-SNAPSHOT-sources.jar"/>
<classpathentry exported="true" kind="lib" path="lib/cdmlib-ext-3.6.1-SNAPSHOT.jar"/>
- <classpathentry exported="true" kind="lib" path="lib/cdmlib-io-3.6.1-SNAPSHOT-sources.jar"/>
<classpathentry exported="true" kind="lib" path="lib/cdmlib-io-3.6.1-SNAPSHOT.jar"/>
- <classpathentry exported="true" kind="lib" path="lib/cdmlib-model-3.6.1-SNAPSHOT-sources.jar"/>
<classpathentry exported="true" kind="lib" path="lib/cdmlib-model-3.6.1-SNAPSHOT.jar"/>
- <classpathentry exported="true" kind="lib" path="lib/cdmlib-persistence-3.6.1-SNAPSHOT-sources.jar"/>
<classpathentry exported="true" kind="lib" path="lib/cdmlib-persistence-3.6.1-SNAPSHOT.jar"/>
- <classpathentry exported="true" kind="lib" path="lib/cdmlib-print-3.6.1-SNAPSHOT-sources.jar"/>
<classpathentry exported="true" kind="lib" path="lib/cdmlib-print-3.6.1-SNAPSHOT.jar"/>
- <classpathentry exported="true" kind="lib" path="lib/cdmlib-remote-3.6.1-SNAPSHOT-sources.jar"/>
<classpathentry exported="true" kind="lib" path="lib/cdmlib-remote-3.6.1-SNAPSHOT.jar"/>
- <classpathentry exported="true" kind="lib" path="lib/cdmlib-services-3.6.1-SNAPSHOT-sources.jar"/>
<classpathentry exported="true" kind="lib" path="lib/cdmlib-services-3.6.1-SNAPSHOT.jar"/>
<classpathentry exported="true" kind="lib" path="lib/poi-3.10-FINAL.jar"/>
<classpathentry exported="true" kind="lib" path="lib/poi-ooxml-3.10-FINAL.jar"/>
<classpathentry exported="true" kind="lib" path="lib/xmlbeans-2.3.0.jar"/>
<classpathentry exported="true" kind="lib" path="lib/poi-ooxml-schemas-3.10-FINAL.jar"/>
<classpathentry exported="true" kind="lib" path="lib/swagger-annotations-1.3.5.jar"/>
- <classpathentry kind="output" path="bin"/>
+ <classpathentry kind="output" path="target/classes"/>
</classpath>
-bin
\ No newline at end of file
+<<<<<<< HEAD
+bin
+=======
+bin
+>>>>>>> d24b444b7bf4e1bd048f864bcfede121794caddf
Export-Package: com.google.api,
com.google.api.detect,
com.google.api.translate,
+ eu.etaxonomy.cdm,
eu.etaxonomy.cdm.api.application,
+ eu.etaxonomy.cdm.api.cache,
eu.etaxonomy.cdm.api.conversation,
eu.etaxonomy.cdm.api.facade,
- eu.etaxonomy.cdm.api.lazyloading,
eu.etaxonomy.cdm.api.service,
eu.etaxonomy.cdm.api.service.config,
eu.etaxonomy.cdm.api.service.description,
eu.etaxonomy.cdm.persistence.dao.hibernate.occurrence,
eu.etaxonomy.cdm.persistence.dao.hibernate.reference,
eu.etaxonomy.cdm.persistence.dao.hibernate.taxon,
- eu.etaxonomy.cdm.persistence.dao.hibernate.validation,
eu.etaxonomy.cdm.persistence.dao.hibernate.view,
eu.etaxonomy.cdm.persistence.dao.media,
eu.etaxonomy.cdm.persistence.dao.name,
eu.etaxonomy.cdm.print.out.pdf,
eu.etaxonomy.cdm.print.out.taxpub,
eu.etaxonomy.cdm.print.out.xml,
- eu.etaxonomy.cdm.remote,
eu.etaxonomy.cdm.remote.config,
eu.etaxonomy.cdm.remote.controller,
eu.etaxonomy.cdm.remote.controller.dto,
eu.etaxonomy.cdm.validation.annotation,
eu.etaxonomy.cdm.validation.constraint,
eu.etaxonomy.remote.dto.rdf,
+ eu.etaxonomy.taxeditor.remoting,
+ eu.etaxonomy.taxeditor.remoting.cache,
+ eu.etaxonomy.taxeditor.remoting.server,
+ eu.etaxonomy.taxeditor.remoting.source,
+ eu.etaxonomy.taxeditor.service,
+ eu.etaxonomy.taxeditor.session,
+ eu.etaxonomy.taxeditor.session.mock,
+ javassist.util.proxy,
javax.persistence,
junit.framework;uses:="org.junit.runner.manipulation,org.junit.runner,org.junit.runner.notification",
+ net.sf.ehcache,
+ net.sf.ehcache.config,
+ net.sf.ehcache.statistics,
+ net.sf.ehcache.store,
net.sf.json;uses:="net.sf.json.processors,net.sf.json.util,org.apache.commons.lang.exception",
+ org.aopalliance.aop,
org.apache.commons.collections;uses:="org.apache.commons.collections.keyvalue,new org.apache.commons.collections",
+ org.apache.commons.collections.buffer,
+ org.apache.commons.dbcp,
org.apache.commons.io;uses:="org.apache.commons.io.filefilter",
org.apache.commons.lang;uses:="org.apache.commons.lang.exception",
org.apache.commons.lang.exception,
+ org.apache.commons.lang.text,
+ org.apache.commons.logging,
org.apache.fop.apps,
org.apache.http,
org.apache.http.client,
+ org.apache.http.util,
org.apache.log4j;uses:="org.apache.log4j.helpers,org.apache.log4j.or,org.apache.log4j.spi",
org.apache.log4j.chainsaw;
uses:="org.apache.log4j,
org.hibernate,
org.hibernate.annotations.common.reflection,
org.hibernate.cache.internal,
+ org.hibernate.cfg,
org.hibernate.classic,
org.hibernate.collection.internal,
+ org.hibernate.collection.spi,
org.hibernate.criterion,
+ org.hibernate.engine.internal,
+ org.hibernate.engine.spi,
+ org.hibernate.engine.transaction.spi,
org.hibernate.envers.query.criteria,
+ org.hibernate.internal,
+ org.hibernate.internal.util,
+ org.hibernate.internal.util.collections,
+ org.hibernate.mapping,
+ org.hibernate.persister.collection,
+ org.hibernate.persister.entity,
+ org.hibernate.pretty,
+ org.hibernate.property,
org.hibernate.proxy,
+ org.hibernate.proxy.pojo.javassist,
org.hibernate.search,
org.hibernate.search.spatial.impl,
+ org.hibernate.type,
org.jadira.usertype.dateandtime.joda,
org.jadira.usertype.dateandtime.shared.spi,
org.jboss.logging,
org.odftoolkit.odfdom.dom.element,
org.odftoolkit.odfdom.dom.element.style,
org.odftoolkit.odfdom.dom.style,
+ org.slf4j,
+ org.springframework.aop,
+ org.springframework.aop.framework,
+ org.springframework.beans,
org.springframework.beans.factory,
org.springframework.beans.factory.annotation;
uses:="org.apache.commons.logging,
org.springframework.beans.factory.wiring,
org.springframework.core.type,
org.springframework.beans.factory",
+ org.springframework.beans.factory.config,
+ org.springframework.beans.factory.support,
+ org.springframework.beans.factory.xml,
org.springframework.cache.ehcache,
org.springframework.context;
uses:="org.springframework.core.io,
org.springframework.core.io.support,
org.springframework.beans.factory.config,
org.springframework.beans.factory",
+ org.springframework.context.config,
org.springframework.context.event;
uses:="org.springframework.core,
org.aopalliance.intercept,
org.springframework.context,
org.springframework.beans.factory",
+ org.springframework.context.support,
org.springframework.core;uses:="org.springframework.util",
+ org.springframework.core.env,
org.springframework.core.io;uses:="org.jboss.virtual",
+ org.springframework.core.io.support,
org.springframework.core.type.classreading,
+ org.springframework.jdbc.datasource,
org.springframework.orm.hibernate3;
uses:="org.apache.commons.logging,
org.aopalliance.intercept,
org.springframework.dao,
org.springframework.transaction.support",
org.springframework.orm.hibernate4,
+ org.springframework.remoting,
+ org.springframework.remoting.httpinvoker,
+ org.springframework.remoting.support,
org.springframework.security.access,
org.springframework.security.authentication,
+ org.springframework.security.authentication.dao,
+ org.springframework.security.authentication.encoding,
org.springframework.security.authentication.event,
+ org.springframework.security.config,
org.springframework.security.core,
org.springframework.security.core.context,
org.springframework.security.core.userdetails,
org.springframework.transaction,
org.apache.commons.logging,
org.springframework.beans.factory",
+ org.springframework.util,
org.springframework.web.servlet;
uses:="org.springframework.web.multipart,
org.apache.commons.logging,
Bundle-Vendor: EDIT
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
Require-Bundle: org.eclipse.osgi,
- org.eclipse.equinox.common
+ org.eclipse.equinox.common,
+ org.apache.commons.httpclient;bundle-version="3.1.0"
Bundle-ClassPath: .,
lib/activation-1.1.1.jar,
lib/antlr-2.7.7.jar,
lib/spring-security-core-3.1.3.RELEASE.jar,
lib/stax-1.2.0.jar,
lib/stax-api-1.0.1.jar,
- lib/unitils-core-3.3.jar,
- lib/unitils-database-3.3.jar,
- lib/unitils-dbmaintainer-3.3.jar,
- lib/unitils-dbunit-3.3.jar,
- lib/unitils-easymock-3.3.jar,
- lib/unitils-inject-3.3.jar,
- lib/unitils-mock-3.3.jar,
- lib/unitils-orm-3.3.jar,
- lib/unitils-spring-3.3.jar,
lib/usertype.jodatime-2.0.1.jar,
lib/usertype.spi-2.0.1.jar,
lib/validation-api-1.0.0.GA.jar,
lib/xmlbeans-2.3.0.jar,
lib/poi-ooxml-schemas-3.10-FINAL.jar,
lib/swagger-annotations-1.3.5.jar
-Import-Package: eu.etaxonomy.cdm.api.application
+Import-Package: org.apache.commons.httpclient.methods
lib/spring-security-core-3.1.3.RELEASE.jar,\\r
lib/stax-1.2.0.jar,\\r
lib/stax-api-1.0.1.jar,\\r
- lib/unitils-core-3.3.jar,\\r
- lib/unitils-database-3.3.jar,\\r
- lib/unitils-dbmaintainer-3.3.jar,\\r
- lib/unitils-dbunit-3.3.jar,\\r
- lib/unitils-easymock-3.3.jar,\\r
- lib/unitils-inject-3.3.jar,\\r
- lib/unitils-mock-3.3.jar,\\r
- lib/unitils-orm-3.3.jar,\\r
- lib/unitils-spring-3.3.jar,\\r
lib/usertype.jodatime-2.0.1.jar,\\r
lib/usertype.spi-2.0.1.jar,\\r
lib/validation-api-1.0.0.GA.jar,\\r
lib/poi-ooxml-3.10-FINAL.jar,\\r
lib/poi-ooxml-schemas-3.10-FINAL.jar,\\r
lib/xmlbeans-2.3.0.jar,\\r
- lib/cdmlib-commons-3.6.1-SNAPSHOT-sources.jar,\\r
lib/cdmlib-commons-3.6.1-SNAPSHOT.jar,\\r
- lib/cdmlib-ext-3.6.1-SNAPSHOT-sources.jar,\\r
lib/cdmlib-ext-3.6.1-SNAPSHOT.jar,\\r
- lib/cdmlib-io-3.6.1-SNAPSHOT-sources.jar,\\r
lib/cdmlib-io-3.6.1-SNAPSHOT.jar,\\r
- lib/cdmlib-model-3.6.1-SNAPSHOT-sources.jar,\\r
lib/cdmlib-model-3.6.1-SNAPSHOT.jar,\\r
- lib/cdmlib-persistence-3.6.1-SNAPSHOT-sources.jar,\\r
lib/cdmlib-persistence-3.6.1-SNAPSHOT.jar,\\r
- lib/cdmlib-print-3.6.1-SNAPSHOT-sources.jar,\\r
lib/cdmlib-print-3.6.1-SNAPSHOT.jar,\\r
- lib/cdmlib-remote-3.6.1-SNAPSHOT-sources.jar,\\r
lib/cdmlib-remote-3.6.1-SNAPSHOT.jar,\\r
- lib/cdmlib-services-3.6.1-SNAPSHOT-sources.jar,\\r
lib/cdmlib-services-3.6.1-SNAPSHOT.jar,\\r
lib/swagger-annotations-1.3.5.jar\r
\r
jars.compile.order = .\r
output.. = bin/\r
source.. = src/main/java/,\\r
- src/main/resources/,\\r
- src/test/java/\r
+ src/main/resources/\r
src.includes = src/\r
\r
+<<<<<<< HEAD
+<?xml version="1.0" encoding="UTF-8"?>\r
+<project>\r
+\r
+ <parent>\r
+ <groupId>eu.etaxonomy</groupId>\r
+ <artifactId>taxeditor-parent</artifactId>\r
+ <version>3.6.1-SNAPSHOT</version>\r
+ </parent>\r
+ <modelVersion>4.0.0</modelVersion>\r
+ <artifactId>eu.etaxonomy.taxeditor.cdmlib</artifactId>\r
+ <packaging>eclipse-plugin</packaging>\r
+ <name>CDM Library Bundle</name>\r
+ <description>Cdm Library Plugin Taxonomic Editor</description>\r
+\r
+ <build>\r
+ <pluginManagement>\r
+ <plugins>\r
+ <plugin>\r
+ <groupId>org.apache.maven.plugins</groupId>\r
+ <artifactId>maven-surefire-plugin</artifactId>\r
+ <version>2.7</version>\r
+ </plugin>\r
+ </plugins>\r
+ </pluginManagement>\r
+ <plugins>\r
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>\r
+ <artifactId>maven-dependency-plugin</artifactId>\r
+ <version>2.4</version>\r
+ <executions>\r
+ <execution>\r
+ <id>copy-dependencies</id>\r
+ <phase>validate</phase>\r
+ <goals>\r
+ <goal>copy-dependencies</goal>\r
+ </goals>\r
+ <configuration>\r
+ <excludeArtifactIds>\r
+ cdmlib-remote-webapp\r
+ </excludeArtifactIds>\r
+ <includeArtifactIds>\r
+ cdmlib-services,cdmlib-commons,cdmlib-persistence,cdmlib-ext,cdmlib-model,cdmlib-io,cdmlib-print,cdmlib-remote\r
+ </includeArtifactIds>\r
+ <outputDirectory>${basedir}/lib</outputDirectory>\r
+ <overWriteReleases>true</overWriteReleases>\r
+ <overWriteSnapshots>true</overWriteSnapshots>\r
+ <excludeTransitive>true</excludeTransitive>\r
+ </configuration>\r
+ </execution>\r
+ <execution>\r
+ <id>copy-dependency-war</id>\r
+ <phase>validate</phase>\r
+ <goals>\r
+ <goal>copy-dependencies</goal>\r
+ </goals>\r
+ <configuration>\r
+ <includeArtifactIds>\r
+ cdmlib-remote-webapp\r
+ </includeArtifactIds>\r
+ <outputDirectory>\r
+ ${basedir}/src/main/resources/etc/jetty\r
+ </outputDirectory>\r
+ <overWriteReleases>true</overWriteReleases>\r
+ <overWriteSnapshots>true</overWriteSnapshots>\r
+ <excludeTransitive>true</excludeTransitive>\r
+ </configuration>\r
+ </execution>\r
+ </executions>
+ </plugin>\r
+ <plugin>\r
+ <groupId>org.apache.maven.plugins</groupId>\r
+ <artifactId>maven-antrun-plugin</artifactId>\r
+ <version>1.7</version>\r
+ <executions>\r
+ <execution>\r
+ <id>update-snapshot-jar-names</id>\r
+ <phase>validate</phase>\r
+ <goals>\r
+ <goal>run</goal>\r
+ </goals>\r
+ <configuration>\r
+ <target>\r
+ <echo>Anonymizing war</echo>\r
+ <move todir="./src/main/resources/etc/jetty">\r
+ <fileset dir="./src/main/resources/etc/jetty" />\r
+ <mapper type="regexp"\r
+ from="(^cdmlib\-.*)\-[0-9]\.[0-9]\.[0-9]\-SNAPSHOT(\.war)"\r
+ to="\1\2" />\r
+ </move>\r
+ <move todir="./src/main/resources/etc/jetty">\r
+ <fileset dir="./src/main/resources/etc/jetty" />\r
+ <mapper type="regexp"\r
+ from="(^cdmlib\-.*)\-[0-9]\.[0-9]\.[0-9]\-[0-9.-]+(\.war)"\r
+ to="\1\2" />\r
+ </move>\r
+ <echo>Update cdmlib jars to SNAPSHOT when build with\r
+ timestamp\r
+ </echo>\r
+ <move todir="./lib">\r
+ <fileset dir="./lib" />\r
+ <mapper type="regexp"\r
+ from="(^cdmlib\-.*\-[0-9]\.[0-9]\.[0-9]\-)[0-9.-]+(\.jar)"\r
+ to="\1SNAPSHOT\2" />\r
+ </move>\r
+ <move todir="./lib">\r
+ <fileset dir="./lib" />\r
+ <mapper type="regexp"\r
+ from="(^cdmlib\-.*\-[0-9]\.[0-9]\.[0-9]\-)[0-9.-]+(\-sources\.jar)"\r
+ to="\1SNAPSHOT\2" /> \r
+ </move>\r
+ </target>\r
+ </configuration>\r
+ </execution>\r
+ </executions>\r
+ </plugin>\r
+ </plugins>\r
+ </build>\r
+ <profiles>\r
+ <profile>\r
+ <id>cleanCdmlibJars</id>\r
+ <build>\r
+ <plugins>\r
+ <plugin>\r
+ <artifactId>maven-clean-plugin</artifactId>\r
+ <version>2.3</version>\r
+ <configuration>\r
+ <filesets>\r
+ <fileset>\r
+ <directory>${basedir}/lib</directory>\r
+ <includes>\r
+ <include>cdmlib-*</include>\r
+ </includes>\r
+ <followSymlinks>false</followSymlinks>\r
+ </fileset>\r
+ </filesets>\r
+ </configuration>\r
+ </plugin>\r
+ </plugins>\r
+ </build>\r
+ </profile>\r
+ <profile>\r
+ <id>cleanAllJars</id>\r
+ <build>\r
+ <plugins>\r
+ <plugin>\r
+ <artifactId>maven-clean-plugin</artifactId>\r
+ <version>2.3</version>\r
+ <configuration>\r
+ <filesets>\r
+ <fileset>\r
+ <directory>${basedir}/lib</directory>\r
+ <includes>\r
+ <include>*</include>\r
+ </includes>\r
+ <followSymlinks>false</followSymlinks>\r
+ </fileset>\r
+ </filesets>\r
+ </configuration>\r
+ </plugin>\r
+ </plugins>\r
+ </build>\r
+ </profile>\r
+ <profile>\r
+ <id>copyAllJars</id>\r
+ <build>\r
+ <plugins>\r
+ <plugin>\r
+ <groupId>org.apache.maven.plugins</groupId>\r
+ <artifactId>maven-dependency-plugin</artifactId>\r
+ <version>2.4</version>\r
+ <executions>\r
+ <execution>\r
+ <id>copy-all-dependencies</id>\r
+ <phase>validate</phase>\r
+ <goals>\r
+ <goal>copy-dependencies</goal>\r
+ </goals>\r
+ <configuration>\r
+ <excludeArtifactIds>\r
+ cdmlib-remote-webapp\r
+ </excludeArtifactIds>\r
+ <outputDirectory>${basedir}/lib</outputDirectory>\r
+ <overWriteReleases>true</overWriteReleases>\r
+ <overWriteSnapshots>true</overWriteSnapshots>\r
+ <excludeTransitive>true</excludeTransitive>\r
+ </configuration>\r
+ </execution>\r
+ </executions>\r
+ </plugin>\r
+ </plugins>\r
+ </build>\r
+ </profile>\r
+ </profiles>\r
+ <repositories>\r
+ <repository>\r
+ <id>SpringSource Enterprise Bundle Repository - External Bundle\r
+ Milestones\r
+ </id>\r
+ <url>http://repository.springsource.com/maven/bundles/milestone\r
+ </url>\r
+ </repository>\r
+ <repository>\r
+ <id>SpringSource Enterprise Bundle Repository - SpringSource\r
+ Bundle\r
+ Releases\r
+ </id>\r
+ <url>http://repository.springsource.com/maven/bundles/release\r
+ </url>\r
+ </repository>\r
+ <repository>\r
+ <id>SpringSource Enterprise Bundle Repository - External Bundle\r
+ Releases\r
+ </id>\r
+ <url>http://repository.springsource.com/maven/bundles/external\r
+ </url>\r
+ </repository>\r
+ </repositories>\r
+ <dependencies>\r
+ <dependency>\r
+ <groupId>eu.etaxonomy</groupId>\r
+ <artifactId>cdmlib-remote-webapp</artifactId>\r
+ <version>${cdmlib.version}</version>\r
+ <type>war</type>\r
+ </dependency>\r
+ <dependency>\r
+ <groupId>eu.etaxonomy</groupId>\r
+ <artifactId>cdmlib-commons</artifactId>\r
+ <version>${cdmlib.version}</version>\r
+ </dependency>\r
+ <dependency>\r
+ <groupId>eu.etaxonomy</groupId>\r
+ <artifactId>cdmlib-model</artifactId>\r
+ <version>${cdmlib.version}</version>\r
+ </dependency>\r
+ <dependency>\r
+ <groupId>eu.etaxonomy</groupId>\r
+ <artifactId>cdmlib-persistence</artifactId>\r
+ <version>${cdmlib.version}</version>\r
+ </dependency>\r
+ <dependency>\r
+ <groupId>eu.etaxonomy</groupId>\r
+ <artifactId>cdmlib-remote</artifactId>\r
+ <version>${cdmlib.version}</version>\r
+ </dependency>\r
+ <dependency>\r
+ <groupId>eu.etaxonomy</groupId>\r
+ <artifactId>cdmlib-print</artifactId>\r
+ <version>${cdmlib.version}</version>\r
+ </dependency>\r
+ <dependency>\r
+ <groupId>eu.etaxonomy</groupId>\r
+ <artifactId>cdmlib-services</artifactId>\r
+ <version>${cdmlib.version}</version>\r
+ </dependency>\r
+ <dependency>\r
+ <groupId>eu.etaxonomy</groupId>\r
+ <artifactId>cdmlib-io</artifactId>\r
+ <version>${cdmlib.version}</version>\r
+ </dependency>\r
+ <dependency>\r
+ <groupId>eu.etaxonomy</groupId>\r
+ <artifactId>cdmlib-ext</artifactId>\r
+ <version>${cdmlib.version}</version>\r
+ </dependency>\r
+\r
+ <!-- <dependency> -->\r
+ <!-- <groupId>org.eclipse.jetty</groupId> -->\r
+ <!-- <artifactId>jetty-server</artifactId> -->\r
+ <!-- <version>9.1.3.v20140225</version> -->\r
+ <!-- </dependency> -->\r
+ <!-- <dependency> -->\r
+ <!-- <groupId>org.eclipse.jetty</groupId> -->\r
+ <!-- <artifactId>jetty-util</artifactId> -->\r
+ <!-- <version>9.1.3.v20140225</version> -->\r
+ <!-- </dependency> -->\r
+ <!-- <dependency> -->\r
+ <!-- <groupId>org.eclipse.jetty</groupId> -->\r
+ <!-- <artifactId>jetty-xml</artifactId> -->\r
+ <!-- <version>9.1.3.v20140225</version> -->\r
+ <!-- </dependency> -->\r
+ <!-- <dependency> -->\r
+ <!-- <groupId>org.eclipse.jetty</groupId> -->\r
+ <!-- <artifactId>jetty-servlet</artifactId> -->\r
+ <!-- <version>9.1.3.v20140225</version> -->\r
+ <!-- </dependency> -->\r
+ <!-- <dependency> -->\r
+ <!-- <groupId>org.eclipse.jetty</groupId> -->\r
+ <!-- <artifactId>jetty-webapp</artifactId> -->\r
+ <!-- <version>9.1.3.v20140225</version> -->\r
+ <!-- </dependency> -->\r
+ <!-- <dependency> -->\r
+ <!-- <groupId>org.eclipse.jetty</groupId> -->\r
+ <!-- <artifactId>jetty-security</artifactId> -->\r
+ <!-- <version>9.1.3.v20140225</version> -->\r
+ <!-- </dependency> -->\r
+ <!-- <dependency> -->\r
+ <!-- <groupId>org.eclipse.jetty</groupId> -->\r
+ <!-- <artifactId>jetty-http</artifactId> -->\r
+ <!-- <version>${jetty.version}</version> -->\r
+ <!-- </dependency> -->\r
+ <!-- <dependency> -->\r
+ <!-- <groupId>org.eclipse.jetty</groupId> -->\r
+ <!-- <artifactId>jetty-io</artifactId> -->\r
+ <!-- <version>${jetty.version}</version> -->\r
+ <!-- </dependency> -->\r
+ <!-- <dependency> -->\r
+ <!-- <groupId>javax.servlet</groupId> -->\r
+ <!-- <artifactId>javax.servlet-api</artifactId> -->\r
+ <!-- <version>3.1.0</version> -->\r
+ <!-- </dependency> -->\r
+\r
+ <!-- <dependency> -->\r
+ <!-- <groupId>javax.servlet</groupId> -->\r
+ <!-- <artifactId>jsp-api</artifactId> -->\r
+ <!-- <version>2.0</version> -->\r
+ <!-- </dependency> -->\r
+\r
+ <dependency>\r
+ <groupId>net.sf.ehcache</groupId>\r
+ <artifactId>ehcache-core</artifactId>\r
+ <version>2.4.3</version>\r
+ </dependency>\r
+ <dependency>\r
+ <groupId>org.hibernate</groupId>\r
+ <artifactId>hibernate-core</artifactId>\r
+ <version>4.1.10.Final</version>\r
+ </dependency>\r
+ <dependency>\r
+ <groupId>org.hibernate.common</groupId>\r
+ <artifactId>hibernate-commons-annotations</artifactId>\r
+ <version>4.0.1.Final</version>\r
+ </dependency>\r
+ <dependency>\r
+ <groupId>org.hibernate</groupId>\r
+ <artifactId>hibernate-search-engine</artifactId>\r
+ <version>4.2.0.Final</version>\r
+ </dependency>\r
+ <dependency>\r
+ <groupId>org.hibernate.javax.persistence</groupId>\r
+ <artifactId>hibernate-jpa-2.0-api</artifactId>\r
+ <version>1.0.1.Final</version>\r
+ </dependency>\r
+ <dependency>\r
+ <groupId>org.hibernate</groupId>\r
+ <artifactId>hibernate-envers</artifactId>\r
+ <version>4.1.10.Final</version>\r
+ </dependency>\r
+ <dependency>\r
+ <groupId>org.hibernate</groupId>\r
+ <artifactId>hibernate-entitymanager</artifactId>\r
+ <version>4.1.10.Final</version>\r
+ </dependency>\r
+ <dependency>\r
+ <groupId>dom4j</groupId>\r
+ <artifactId>dom4j</artifactId>\r
+ <version>1.6</version>\r
+ </dependency>\r
+ <dependency>\r
+ <groupId>org.jadira.usertype</groupId>\r
+ <artifactId>usertype.jodatime</artifactId>\r
+ <version>2.0.1</version>\r
+ </dependency>\r
+ <dependency>\r
+ <groupId>org.jadira.usertype</groupId>\r
+ <artifactId>usertype.spi</artifactId>\r
+ <version>2.0.1</version>\r
+ </dependency>\r
+\r
+ <dependency>\r
+ <groupId>junit</groupId>\r
+ <artifactId>junit</artifactId>\r
+ <version>4.11</version>\r
+ <scope>test</scope>\r
+ </dependency>\r
+ <dependency>\r
+ <groupId>log4j</groupId>\r
+ <artifactId>log4j</artifactId>\r
+ <version>1.2.17</version>\r
+ </dependency>\r
+ <dependency>\r
+ <groupId>org.jdom</groupId>\r
+ <artifactId>jdom</artifactId>\r
+ <version>1.1.3</version>\r
+ </dependency>\r
+ <dependency>\r
+ <groupId>org.springframework</groupId>\r
+ <artifactId>org.springframework.context</artifactId>\r
+ <version>3.2.2.RELEASE</version>\r
+ </dependency>\r
+ <dependency>\r
+ <groupId>org.springframework</groupId>\r
+ <artifactId>org.springframework.context.support</artifactId>\r
+ <version>3.2.2.RELEASE</version>\r
+ </dependency>\r
+ <dependency>\r
+ <groupId>org.springframework</groupId>\r
+ <artifactId>org.springframework.aspects</artifactId>\r
+ <version>3.2.2.RELEASE</version>\r
+ </dependency>\r
+ <dependency>\r
+ <groupId>org.springframework</groupId>\r
+ <artifactId>org.springframework.test</artifactId>\r
+ <version>3.2.2.RELEASE</version>\r
+ </dependency>\r
+ <dependency>\r
+ <groupId>org.springframework</groupId>\r
+ <artifactId>org.springframework.beans</artifactId>\r
+ <version>3.2.2.RELEASE</version>\r
+ </dependency>\r
+ <dependency>\r
+ <groupId>org.springframework</groupId>\r
+ <artifactId>org.springframework.transaction</artifactId>\r
+ <version>3.2.2.RELEASE</version>\r
+ </dependency>\r
+ <dependency>\r
+ <groupId>org.springframework</groupId>\r
+ <artifactId>org.springframework.web</artifactId>\r
+ <version>3.2.2.RELEASE</version>\r
+ </dependency>\r
+ <dependency>\r
+ <groupId>org.springframework</groupId>\r
+ <artifactId>org.springframework.core</artifactId>\r
+ <version>3.2.2.RELEASE</version>\r
+ </dependency>\r
+ <dependency>\r
+ <groupId>org.springframework</groupId>\r
+ <artifactId>org.springframework.aop</artifactId>\r
+ <version>3.2.2.RELEASE</version>\r
+ </dependency>\r
+ <dependency>\r
+ <groupId>org.springframework</groupId>\r
+ <artifactId>org.springframework.expression</artifactId>\r
+ <version>3.2.2.RELEASE</version>\r
+ </dependency>\r
+ <dependency>\r
+ <groupId>org.springframework</groupId>\r
+ <artifactId>org.springframework.orm</artifactId>\r
+ <version>3.2.2.RELEASE</version>\r
+ </dependency>\r
+ <dependency>\r
+ <groupId>org.springframework</groupId>\r
+ <artifactId>org.springframework.jdbc</artifactId>\r
+ <version>3.2.2.RELEASE</version>\r
+ </dependency>\r
+ <dependency>\r
+ <groupId>org.springframework.security</groupId>\r
+ <artifactId>spring-security-core</artifactId>\r
+ <version>3.1.3.RELEASE</version>\r
+ </dependency>\r
+ <dependency>\r
+ <groupId>org.springframework.security</groupId>\r
+ <artifactId>spring-security-config</artifactId>\r
+ <version>3.1.3.RELEASE</version>\r
+ </dependency>\r
+ <dependency>\r
+ <groupId>org.springframework.security</groupId>\r
+ <artifactId>spring-security-remoting</artifactId>\r
+ <version>3.1.3.RELEASE</version>\r
+ </dependency>\r
+ <dependency>\r
+ <groupId>org.jboss.logging</groupId>\r
+ <artifactId>jboss-logging</artifactId>\r
+ <version>3.1.3.GA</version>\r
+ </dependency>\r
+ <dependency>\r
+ <groupId>org.hamcrest</groupId>\r
+ <artifactId>hamcrest-core</artifactId>\r
+ <version>1.3</version>\r
+ </dependency>\r
+ <dependency>\r
+ <groupId>com.mchange</groupId>\r
+ <artifactId>c3p0</artifactId>\r
+ <version>0.9.2</version>\r
+ </dependency>\r
+ <dependency>\r
+ <groupId>org.jboss.spec.javax.transaction</groupId>\r
+ <artifactId>jboss-transaction-api_1.1_spec</artifactId>\r
+ <version>1.0.0.Final</version>\r
+ </dependency>\r
+ <dependency>\r
+ <groupId>org.aspectj</groupId>\r
+ <artifactId>aspectjrt</artifactId>\r
+ <version>1.7.1</version>\r
+ </dependency>\r
+ <dependency>\r
+ <groupId>commons-logging</groupId>\r
+ <artifactId>commons-logging</artifactId>\r
+ <version>1.1.1</version>\r
+ </dependency>\r
+ <dependency>\r
+ <groupId>commons-lang</groupId>\r
+ <artifactId>commons-lang</artifactId>\r
+ <version>2.6</version>\r
+ </dependency>\r
+ <dependency>\r
+ <groupId>aopalliance</groupId>\r
+ <artifactId>aopalliance</artifactId>\r
+ <version>1.0</version>\r
+ </dependency>\r
+ <dependency>\r
+ <groupId>joda-time</groupId>\r
+ <artifactId>joda-time</artifactId>\r
+ <version>2.1</version>\r
+ </dependency>\r
+ <dependency>\r
+ <groupId>com.ibm.lsid</groupId>\r
+ <artifactId>lsid-client</artifactId>\r
+ <version>1.1.2</version>\r
+ </dependency>\r
+ <dependency>\r
+ <groupId>com.ibm.lsid</groupId>\r
+ <artifactId>lsid-server</artifactId>\r
+ <version>1.1.2</version>\r
+ </dependency>\r
+ <dependency>\r
+ <groupId>org.apache.lucene</groupId>\r
+ <artifactId>lucene-core</artifactId>\r
+ <version>3.6.2</version>\r
+ </dependency>\r
+ <dependency>\r
+ <groupId>org.slf4j</groupId>\r
+ <artifactId>slf4j-api</artifactId>\r
+ <version>1.7.2</version>\r
+ </dependency>\r
+ <dependency>\r
+ <groupId>org.javassist</groupId>\r
+ <artifactId>javassist</artifactId>\r
+ <version>3.17.1-GA</version>\r
+ </dependency>\r
+ <dependency>\r
+ <groupId>au.com.bytecode</groupId>\r
+ <artifactId>opencsv</artifactId>\r
+ <version>2.4</version>\r
+ </dependency>\r
+\r
+ <!-- For Unit Tests Start -->\r
+\r
+ <dependency>\r
+ <groupId>org.unitils</groupId>\r
+ <artifactId>unitils-core</artifactId>\r
+ <version>3.4.2</version>\r
+ </dependency>\r
+ <dependency>\r
+ <groupId>org.unitils</groupId>\r
+ <artifactId>unitils-spring</artifactId>\r
+ <version>3.4.2</version>\r
+ </dependency>\r
+ <dependency>\r
+ <groupId>org.unitils</groupId>\r
+ <artifactId>unitils-database</artifactId>\r
+ <version>3.4.2</version>\r
+ </dependency>\r
+ <dependency>\r
+ <groupId>commons-dbcp</groupId>\r
+ <artifactId>commons-dbcp</artifactId>\r
+ <version>1.4</version>\r
+ </dependency>\r
+ <dependency>\r
+ <groupId>commons-pool</groupId>\r
+ <artifactId>commons-pool</artifactId>\r
+ <version>1.5.4</version>\r
+ </dependency>\r
+ <dependency>\r
+ <groupId>org.unitils</groupId>\r
+ <artifactId>unitils-dbmaintainer</artifactId>\r
+ <version>3.4.2</version>\r
+ </dependency>\r
+ <dependency>\r
+ <groupId>com.h2database</groupId>\r
+ <artifactId>h2</artifactId>\r
+ <version>1.4.181</version>\r
+ </dependency>\r
+ <dependency>\r
+ <groupId>org.unitils</groupId>\r
+ <artifactId>unitils-dbunit</artifactId>\r
+ <version>3.4.2</version>\r
+ </dependency>\r
+ <dependency>\r
+ <groupId>org.dbunit</groupId>\r
+ <artifactId>dbunit</artifactId>\r
+ <version>2.4.9</version>\r
+ </dependency>\r
+ <!-- For Unit Tests End -->\r
+\r
+ <!-- For Hibernate Mapping Start -->\r
+ <dependency>\r
+ <groupId>wsdl4j</groupId>\r
+ <artifactId>wsdl4j</artifactId>\r
+ <version>1.6.3</version>\r
+ </dependency>\r
+ <dependency>\r
+ <groupId>javax.validation</groupId>\r
+ <artifactId>validation-api</artifactId>\r
+ <version>1.1.0.Final</version>\r
+ </dependency>\r
+ <!-- For Hibernate Mapping End -->\r
+ </dependencies>\r
+=======
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<parent>
seems to be loaded as bean by spring
-->
</dependencies>
+>>>>>>> d24b444b7bf4e1bd048f864bcfede121794caddf
</project>
/**\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
+ * 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.hibernate.SessionFactory;\r
-\r
import org.apache.log4j.Logger;\r
-import org.springframework.beans.factory.annotation.Autowired;\r
+import org.springframework.beans.BeansException;\r
+import org.springframework.context.ApplicationContext;\r
+import org.springframework.context.ApplicationContextAware;\r
+import org.springframework.security.authentication.ProviderManager;\r
+import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;\r
+import org.springframework.security.core.Authentication;\r
+import org.springframework.security.core.context.SecurityContext;\r
+import org.springframework.security.core.context.SecurityContextHolder;\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.conversation.ConversationHolder;\r
import eu.etaxonomy.cdm.api.conversation.ConversationHolderMock;\r
+import eu.etaxonomy.cdm.api.service.IAgentService;\r
+import eu.etaxonomy.cdm.api.service.IClassificationService;\r
+import eu.etaxonomy.cdm.api.service.ICollectionService;\r
+import eu.etaxonomy.cdm.api.service.ICommonService;\r
import eu.etaxonomy.cdm.api.service.IDatabaseService;\r
+import eu.etaxonomy.cdm.api.service.IDescriptionService;\r
+import eu.etaxonomy.cdm.api.service.IEntityConstraintViolationService;\r
+import eu.etaxonomy.cdm.api.service.IEntityValidationService;\r
+import eu.etaxonomy.cdm.api.service.IFeatureNodeService;\r
+import eu.etaxonomy.cdm.api.service.IFeatureTreeService;\r
+import eu.etaxonomy.cdm.api.service.IGrantedAuthorityService;\r
+import eu.etaxonomy.cdm.api.service.IGroupService;\r
+import eu.etaxonomy.cdm.api.service.IIdentificationKeyService;\r
+import eu.etaxonomy.cdm.api.service.ILocationService;\r
+import eu.etaxonomy.cdm.api.service.IMediaService;\r
+import eu.etaxonomy.cdm.api.service.INameService;\r
+import eu.etaxonomy.cdm.api.service.IOccurrenceService;\r
+import eu.etaxonomy.cdm.api.service.IPolytomousKeyNodeService;\r
+import eu.etaxonomy.cdm.api.service.IPolytomousKeyService;\r
+import eu.etaxonomy.cdm.api.service.IReferenceService;\r
+import eu.etaxonomy.cdm.api.service.IService;\r
+import eu.etaxonomy.cdm.api.service.ITaxonNodeService;\r
+import eu.etaxonomy.cdm.api.service.ITaxonService;\r
+import eu.etaxonomy.cdm.api.service.ITermService;\r
+import eu.etaxonomy.cdm.api.service.IUserService;\r
+import eu.etaxonomy.cdm.api.service.IVocabularyService;\r
+import eu.etaxonomy.cdm.api.service.IWorkingSetService;\r
+import eu.etaxonomy.cdm.api.service.molecular.IAmplificationService;\r
+import eu.etaxonomy.cdm.api.service.molecular.IPrimerService;\r
+import eu.etaxonomy.cdm.api.service.molecular.ISequenceService;\r
import eu.etaxonomy.cdm.ext.geo.IEditGeoService;\r
+import eu.etaxonomy.cdm.model.common.CdmBase;\r
+import eu.etaxonomy.cdm.persistence.hibernate.permission.ICdmPermissionEvaluator;\r
+import eu.etaxonomy.taxeditor.service.ICachedCommonService;\r
+import eu.etaxonomy.taxeditor.session.ICdmEntitySessionManager;\r
\r
\r
/**\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
- public CdmApplicationRemoteConfiguration() {\r
- }\r
- \r
+public class CdmApplicationRemoteConfiguration implements ICdmApplicationConfiguration, ApplicationContextAware {\r
+\r
+ @SuppressWarnings("unused")\r
+ private static final Logger logger = Logger.getLogger(CdmApplicationRemoteConfiguration.class);\r
+\r
+ protected ApplicationContext applicationContext;\r
+\r
+\r
+ public CdmApplicationRemoteConfiguration() {}\r
+\r
+ // ****************************** APPLICATION CONTEXT *************************************************/\r
+\r
+ @Override\r
+ public void setApplicationContext(ApplicationContext applicationContext) throws BeansException{\r
+ this.applicationContext = applicationContext;\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
+ 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
+ /**\r
+ * @return\r
+ */\r
+ public IEditGeoService getEditGeoService() {\r
+ return (IEditGeoService)getBean("editGeoService");\r
+ }\r
+\r
+ /**\r
+ * @return\r
*/\r
+ public ICachedCommonService getCachedCommonService(){\r
+ return (ICachedCommonService) getBean("cachedCommonService");\r
+ }\r
+\r
+\r
+ public ICdmEntitySessionManager getCdmEntitySessionManager() {\r
+ return (ICdmEntitySessionManager) getBean("cdmEntitySessionManager");\r
+ }\r
+\r
+\r
+\r
+\r
+\r
+\r
+ // ****************************** GETTER *************************************************/\r
+\r
@Override\r
- public TransactionStatus startTransaction() throws UnsupportedOperationException {\r
- throw new UnsupportedOperationException("startTransaction is not implemented for CdmApplicationRemoteConfiguration");\r
- }\r
+ public final Object getBean(String name){\r
+ return this.applicationContext.getBean(name);\r
+ }\r
+\r
+ @Override\r
+ public IAgentService getAgentService(){\r
+ return (IAgentService) getBean("agentService");\r
+ }\r
+\r
+ @Override\r
+ public IDatabaseService getDatabaseService(){\r
+ return (IDatabaseService) getBean("databaseService");\r
+ }\r
+\r
+ @Override\r
+ public INameService getNameService(){\r
+ return (INameService) getBean("nameService");\r
+ }\r
+\r
+ @Override\r
+ public IReferenceService getReferenceService(){\r
+ return (IReferenceService) getBean("referenceService");\r
+ }\r
+\r
+ @Override\r
+ public ITaxonService getTaxonService(){\r
+ return (ITaxonService) getBean("taxonService");\r
+ }\r
+\r
+ @Override\r
+ public IClassificationService getClassificationService(){\r
+ return (IClassificationService) getBean("classificationService");\r
+ }\r
+\r
+ @Override\r
+ public ITaxonNodeService getTaxonNodeService(){\r
+ return (ITaxonNodeService) getBean("taxonNodeService");\r
+ }\r
+\r
+ @Override\r
+ public IDescriptionService getDescriptionService(){\r
+ return (IDescriptionService) getBean("descriptionService");\r
+ }\r
+\r
+ @Override\r
+ public IOccurrenceService getOccurrenceService(){\r
+ return (IOccurrenceService) getBean("occurrenceService");\r
+ }\r
+\r
+ @Override\r
+ public IPrimerService getPrimerService(){\r
+ return (IPrimerService) getBean("primerService");\r
+ }\r
+\r
+ @Override\r
+ public IAmplificationService getAmplificationService(){\r
+ return (IAmplificationService) getBean("amplificationService");\r
+ }\r
+\r
+ @Override\r
+ public ISequenceService getSequenceService(){\r
+ return (ISequenceService) getBean("sequenceService");\r
+ }\r
+\r
+ @Override\r
+ public IMediaService getMediaService(){\r
+ return (IMediaService) getBean("mediaService");\r
+ }\r
+\r
+ @Override\r
+ public ITermService getTermService(){\r
+ return (ITermService) getBean("termService");\r
+ }\r
+\r
+ @Override\r
+ public ICommonService getCommonService(){\r
+ return (ICommonService) getBean("commonService");\r
+ }\r
+\r
+ @Override\r
+ public ILocationService getLocationService(){\r
+ return (ILocationService) getBean("locationService");\r
+ }\r
+\r
+ @Override\r
+ public IUserService getUserService(){\r
+ return (IUserService) getBean("userService");\r
+ }\r
+\r
+ @Override\r
+ public IGrantedAuthorityService getGrantedAuthorityService(){\r
+ return (IGrantedAuthorityService) getBean("grantedAuthorityService");\r
+ }\r
+\r
+ @Override\r
+ public IService<CdmBase> getMainService(){\r
+ return (IService<CdmBase>) getBean("mainService");\r
+ }\r
+\r
+\r
+ @Override\r
+ public ProviderManager getAuthenticationManager(){\r
+ return (ProviderManager) getBean("authenticationManager");\r
+ }\r
+\r
+\r
+ @Override\r
+ public ConversationHolder NewConversation() {\r
+ return new ConversationHolderMock();\r
+ }\r
+\r
+ @Override\r
+ public ICollectionService getCollectionService(){\r
+ return (ICollectionService) getBean("collectionService");\r
+ }\r
+\r
+ @Override\r
+ public IFeatureTreeService getFeatureTreeService(){\r
+ return (IFeatureTreeService) getBean("featureTreeService");\r
+ }\r
+\r
+ @Override\r
+ public IFeatureNodeService getFeatureNodeService(){\r
+ return (IFeatureNodeService) getBean("featureNodeService");\r
+ }\r
+\r
+ @Override\r
+ public IVocabularyService getVocabularyService(){\r
+ return (IVocabularyService) getBean("vocabularyService");\r
+ }\r
+\r
+ @Override\r
+ public IIdentificationKeyService getIdentificationKeyService(){\r
+ return (IIdentificationKeyService) getBean("identificationKeyService");\r
+ }\r
+\r
+ @Override\r
+ public IPolytomousKeyService getPolytomousKeyService(){\r
+ return (IPolytomousKeyService) getBean("polytomousKeyService");\r
+ }\r
\r
\r
- /* (non-Javadoc)\r
- * @see eu.etaxonomy.cdm.api.application.ICdmApplicationConfiguration#startTransaction()\r
- */\r
+ @Override\r
+ public IPolytomousKeyNodeService getPolytomousKeyNodeService(){\r
+ return (IPolytomousKeyNodeService) getBean("polytomousKeyNodeService");\r
+ }\r
+\r
+ @Override\r
+ public IWorkingSetService getWorkingSetService(){\r
+ return (IWorkingSetService) getBean("workingSetService");\r
+ }\r
+\r
+ @Override\r
+ public IGroupService getGroupService(){\r
+ return (IGroupService) getBean("groupService");\r
+ }\r
+\r
+\r
+ @Override\r
+ public IEntityValidationService getEntityValidationService(){\r
+ return (IEntityValidationService) getBean("entityValidationService");\r
+ }\r
+\r
+\r
+ @Override\r
+ public IEntityConstraintViolationService getEntityConstraintViolationService(){\r
+ return (IEntityConstraintViolationService) getBean("entityConstraintViolationService");\r
+ }\r
+\r
+ @Override\r
+ public ICdmPermissionEvaluator getPermissionEvaluator(){\r
+ return (ICdmPermissionEvaluator) getBean("cdmPermissionEvaluator");\r
+ }\r
+\r
+\r
+ @Override\r
+ public TransactionStatus startTransaction() throws UnsupportedOperationException {\r
+ throw new UnsupportedOperationException("startTransaction is not implemented for CdmApplicationRemoteConfiguration");\r
+ }\r
+\r
@Override\r
public TransactionStatus startTransaction(Boolean readOnly) throws UnsupportedOperationException {\r
- throw new UnsupportedOperationException("startTransaction is not implemented for CdmApplicationRemoteConfiguration");\r
- }\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
- /* (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
+ throw new UnsupportedOperationException("commitTransaction is not implemented for CdmApplicationRemoteConfiguration");\r
+ }\r
+\r
+ @Override\r
+ public void authenticate(String username, String password){\r
+ UsernamePasswordAuthenticationToken tokenForUser = new UsernamePasswordAuthenticationToken(username, password);\r
+ Authentication authentication = this.getAuthenticationManager().authenticate(tokenForUser);\r
+ SecurityContext context = SecurityContextHolder.getContext();\r
+ context.setAuthentication(authentication);\r
}\r
}\r
/**
-* 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.
-*/
+ * 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 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.GenericApplicationContext;
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;
+import eu.etaxonomy.taxeditor.remoting.cache.CdmRemoteCacheManager;
+import eu.etaxonomy.taxeditor.remoting.source.ICdmRemoteSource;
+import eu.etaxonomy.taxeditor.session.ICdmEntitySessionManager;
/**
* 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");
+
+ 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 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);
-
- }
+// public static CdmApplicationRemoteController NewInstance(Resource applicationContextResource,
+// ICdmRemoteSource remoteSource,
+// IProgressMonitor progressMonitor,
+// List<ApplicationListener> listeners) {
+// return new CdmApplicationRemoteController(applicationContextResource,
+// remoteSource,
+// false,
+// progressMonitor,
+// listeners);
+//
+// }
/**
* Creates new instance of CdmApplicationRemoteController
- *
+ *
* @param applicationContextResource
* @param remoteSource
* @param omitTermLoading
* @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);
-
+ public static CdmApplicationRemoteController NewInstance(ICdmRemoteSource remoteSource,
+ IProgressMonitor progressMonitor,
+ List<ApplicationListener> listeners) {
+
+ return new CdmApplicationRemoteController(DEFAULT_REMOTE_APPLICATION_CONTEXT_RESOURCE,
+ remoteSource,
+ false,
+ 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;
+
+ public static CdmApplicationRemoteController NewInstance(ICdmRemoteSource remoteSource,
+ boolean validateXml,
+ IProgressMonitor progressMonitor,
+ List<ApplicationListener> listeners) {
+
+ return new CdmApplicationRemoteController(DEFAULT_REMOTE_APPLICATION_CONTEXT_RESOURCE,
+ remoteSource,
+ validateXml,
+ progressMonitor,
+ listeners);
+
+ }
+
+ /**
+ * Constructs CdmApplicationRemoteController
+ *
+ * @param applicationContextResource
+ * @param remoteSource
+ * @param omitTermLoading
+ * @param progressMonitor
+ * @param listeners
+ */
+ private CdmApplicationRemoteController(Resource applicationContextResource,
+ ICdmRemoteSource remoteSource,
+ boolean validateXml,
+ 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, validateXml, listeners);
+
+ }
+
+
- 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){
+ public boolean setNewRemoteSource(ICdmRemoteSource remoteSource,
+ boolean validateXml,
+ List<ApplicationListener> listeners){
logger.info("Connecting to '" + remoteSource.getName() + "'");
- MonitoredGenericApplicationContext applicationContext = new MonitoredGenericApplicationContext();
- int refreshTasks = 45;
- int nTasks = 5 + refreshTasks;
+ GenericApplicationContext applicationContext = new GenericApplicationContext();
+
+ int nTasks = 2;
progressMonitor.beginTask("Connecting to '" + remoteSource.getName() + "'", nTasks);
- progressMonitor.subTask("Registering remote source.");
+ progressMonitor.subTask("Loading context beans ...");
+ // initialising the cdm model cache
+ CdmRemoteCacheManager.getInstance();
+
PropertySourcesPlaceholderConfigurer pspc = new PropertySourcesPlaceholderConfigurer();
Properties properties = new Properties();
properties.setProperty("remoteServer", remoteSource.getServer());
properties.setProperty("remoteContext", remoteSource.getContextPath());
pspc.setProperties(properties);
applicationContext.addBeanFactoryPostProcessor(pspc);
- progressMonitor.worked(1);
-
+ applicationContext.getEnvironment().setActiveProfiles("remoting");
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(!validateXml) {
+ xmlReader.setValidating(false);
}
-
+ xmlReader.loadBeanDefinitions(applicationContextResource);
if (listeners != null){
for(ApplicationListener listener : listeners){
applicationContext.addApplicationListener(listener);
}
}
+ progressMonitor.worked(1);
-
- applicationContext.refresh(new SubProgressMonitor(progressMonitor, refreshTasks));
+ progressMonitor.subTask("Starting context ...");
+ applicationContext.refresh();
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(){
+ protected void init(){
+
+ // retrieving the application configuration
configuration = (ICdmApplicationConfiguration)applicationContext.getBean("cdmApplicationRemoteConfiguration");
- AbstractLazyInitializer.setConfiguration(this);
- AbstractPersistentCollection.setConfiguration(this);
+ AbstractLazyInitializer.setConfiguration((CdmApplicationRemoteConfiguration)configuration);
+ AbstractPersistentCollection.setConfiguration((CdmApplicationRemoteConfiguration)configuration);
+
+
}
+ public ICdmEntitySessionManager getCdmEntitySessionManager() {
+ return ((CdmApplicationRemoteConfiguration)configuration).getCdmEntitySessionManager();
+ }
}
--- /dev/null
+// $Id$
+/**
+* Copyright (C) 2015 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;
+
+/**
+ * @author cmathew
+ * @date 17 Jun 2015
+ *
+ */
+public class CdmApplicationState {
+
+ private static CdmApplicationState cdmApplicationState;
+
+ private ICdmApplicationConfiguration appConfig;
+
+ public static CdmApplicationState getInstance() {
+ if(cdmApplicationState == null) {
+ cdmApplicationState = new CdmApplicationState();
+ }
+ return cdmApplicationState;
+ }
+
+ public void setAppConfig(ICdmApplicationConfiguration appConfig) {
+ this.appConfig = appConfig;
+ }
+
+ public ICdmApplicationConfiguration getAppConfig() {
+ return appConfig;
+ }
+
+ public static void setCurrentAppConfig(ICdmApplicationConfiguration appConfig) {
+ getInstance().setAppConfig(appConfig);
+ }
+
+ public static ICdmApplicationConfiguration getCurrentAppConfig() {
+ return getInstance().getAppConfig();
+ }
+
+}
import java.util.UUID;
+import net.sf.ehcache.config.CacheConfiguration;
+import net.sf.ehcache.config.SizeOfPolicyConfiguration;
+
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import eu.etaxonomy.cdm.api.service.ITermService;
import eu.etaxonomy.cdm.model.common.CdmBase;
+import eu.etaxonomy.cdm.model.common.DefinedTermBase;
+import eu.etaxonomy.taxeditor.remoting.cache.CacheLoader;
+import eu.etaxonomy.taxeditor.remoting.cache.CdmEntityCacheKey;
+import eu.etaxonomy.taxeditor.remoting.cache.CdmTransientEntityCacher;
+import eu.etaxonomy.taxeditor.service.TermServiceRequestExecutor;
+import eu.etaxonomy.taxeditor.session.CdmEntitySession;
+import eu.etaxonomy.taxeditor.session.ICdmEntitySession;
+import eu.etaxonomy.taxeditor.session.ICdmEntitySessionManager;
+import eu.etaxonomy.taxeditor.session.ICdmEntitySessionManagerObserver;
/**
* Class which uses CDM services to cache cdm entities
* @param <T>
*/
@Component
-public class CdmServiceCacher<T extends CdmBase> extends CdmCacher {
+public class CdmServiceCacher extends CdmCacher implements ICdmEntitySessionManagerObserver {
- @Autowired
- ITermService termService;
+ @Autowired
+ ITermService termService;
- @Override
- protected T findByUuid(UUID uuid) {
- return (T)termService.findWithoutFlush(uuid);
- }
- /* (non-Javadoc)
- * @see eu.etaxonomy.cdm.api.cache.CdmCacher#setup()
- */
+ private ICdmEntitySessionManager cdmEntitySessionManager;
+
+ private CdmTransientEntityCacher cdmTransientEntityCacher;
+
+ private CacheLoader cacheLoader;
+
@Override
protected void setup() {
- // TODO Auto-generated method stub
+ DefinedTermBase.setCacher(this);
+ CdmTransientEntityCacher.setDefaultCacher(this);
+ TermServiceRequestExecutor.setDefaultCacher(this);
+ cacheLoader = new CacheLoader(this);
+ }
+
+ @Override
+ protected CacheConfiguration getDefaultCacheConfiguration() {
+ // For a better understanding on how to size caches, refer to
+ // http://ehcache.org/documentation/configuration/cache-size
+
+ SizeOfPolicyConfiguration sizeOfConfig = new SizeOfPolicyConfiguration();
+ sizeOfConfig.setMaxDepth(100);
+ sizeOfConfig.setMaxDepthExceededBehavior("abort");
+
+ return new CacheConfiguration(DEFAULT_CACHE_NAME, 0)
+ .eternal(true)
+ .statistics(true)
+ .sizeOfPolicy(sizeOfConfig)
+ .overflowToOffHeap(false);
+
+ }
+
+ @Override
+ protected CdmBase findByUuid(UUID uuid) {
+ CdmBase term = termService.findWithoutFlush(uuid);
+ return load(term);
}
/* (non-Javadoc)
* @see eu.etaxonomy.cdm.model.ICdmCacher#isCachable(eu.etaxonomy.cdm.model.common.CdmBase)
*/
@Override
- public boolean isCachable(CdmBase arg0) {
- // TODO Auto-generated method stub
+ public boolean isCachable(CdmBase cdmEntity) {
+ if(cdmEntity != null && cdmEntity instanceof DefinedTermBase) {
+ return true;
+ }
return false;
}
+
+ public void setCdmEntitySessionManager(ICdmEntitySessionManager cdmEntitySessionManager) {
+ this.cdmEntitySessionManager = cdmEntitySessionManager;
+ if(cdmEntitySessionManager != null) {
+ cdmEntitySessionManager.addSessionObserver(this);
+ }
+ }
+
+
+ public CdmTransientEntityCacher getCurrentCacher() {
+ ICdmEntitySession cdmEntitySession = cdmEntitySessionManager.getActiveSession();
+ if(cdmEntitySession != null && cdmEntitySession instanceof CdmEntitySession) {
+ return ((CdmEntitySession) cdmEntitySession).getCacher();
+ }
+ return null;
+ }
+
+ @Override
+ public CdmBase getFromCache(CdmBase cdmBase) {
+ CdmBase cachedCdmEntity = null;
+ // first we check in the active session cache if the
+ if(!isCachable(cdmBase) && cdmTransientEntityCacher != null) {
+ CdmEntityCacheKey key = CdmTransientEntityCacher.generateKey(cdmBase);
+ cachedCdmEntity = cdmTransientEntityCacher.getFromCache(key);
+
+ }
+ if(cachedCdmEntity == null) {
+ cachedCdmEntity = super.getFromCache(cdmBase);
+ }
+ return cachedCdmEntity;
+ }
+
+
/* (non-Javadoc)
* @see eu.etaxonomy.cdm.api.cache.CdmCacher#load(eu.etaxonomy.cdm.model.common.CdmBase)
*/
@Override
- public CdmBase load(CdmBase arg0) {
- // TODO Auto-generated method stub
- return null;
+ public CdmBase load(CdmBase cdmEntity) {
+ CdmBase cachedCdmEntity = getFromCache(cdmEntity.getUuid());
+
+ if(isCachable(cdmEntity)) {
+ cachedCdmEntity = cacheLoader.load(cdmEntity, true, false);
+ }
+ return cachedCdmEntity;
}
+ /* (non-Javadoc)
+ * @see eu.etaxonomy.taxeditor.session.ICdmEntitySessionManagerObserver#changed()
+ */
+ @Override
+ public void changed() {
+ ICdmEntitySession cdmEntitySession = cdmEntitySessionManager.getActiveSession();
+ if(cdmEntitySession != null && cdmEntitySession instanceof CdmEntitySession) {
+ this.cdmTransientEntityCacher = ((CdmEntitySession) cdmEntitySession).getCacher();
+ } else {
+ this.cdmTransientEntityCacher = null;
+ }
+ }
}
+++ /dev/null
-package eu.etaxonomy.cdm.api.lazyloading;
-
-import java.lang.reflect.Field;
-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.aspectj.lang.ProceedingJoinPoint;
-import org.aspectj.lang.annotation.Around;
-import org.aspectj.lang.annotation.Aspect;
-import org.aspectj.lang.annotation.Pointcut;
-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.hibernate.proxy.LazyInitializer;
-import org.springframework.beans.factory.annotation.Autowire;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.beans.factory.annotation.Configurable;
-import org.springframework.stereotype.Component;
-
-import eu.etaxonomy.cdm.api.service.ICommonService;
-import eu.etaxonomy.cdm.model.common.CdmBase;
-import eu.etaxonomy.cdm.model.common.PersistentMultiLanguageText;
-
-
-@Aspect
-@Component
-@Configurable(autowire = Autowire.BY_TYPE)
-public class CdmLazyLoader {
-
-
- private Set classes = new HashSet();
-
- public static boolean enableWeaving = true;
- private static Set<String> classesToIgnore = new HashSet<String>();
-
-
- @Autowired
- private ICommonService commonService;
-
- public CdmLazyLoader() {
- //classesToIgnore.add("eu.etaxonomy.cdm.model.common.TermVocabulary");
- //classesToIgnore.add("eu.etaxonomy.cdm.model.common.OrderedTermVocabulary");
-
- }
-
- /**
- * Point cut for the 'initialize' method of the AbstractLazyInitializer.
- *
- */
- @Pointcut("execution(* org.hibernate.proxy.AbstractLazyInitializer.initialize())")
- public void possibleEntityLazyInitializationException() {
- }
-
-
- /**
- * 'Around' advice for the initialization of CDM Entity Objects
- *
- */
- @Around(value = "possibleEntityLazyInitializationException()")
- public Object preloadEntityOnDemand(ProceedingJoinPoint pjp) throws Throwable {
- if(enableWeaving) {
- LazyInitializer ll = (LazyInitializer)pjp.getTarget();
- if(ll.isUninitialized()) {
- int classid = ((Integer)ll.getIdentifier()).intValue();
- System.out.print("--> AspectJ Compile-Time Weaving " + ll.getEntityName() + " with id " + classid);
- Class clazz = (Class<? extends CdmBase>) Class.forName(ll.getEntityName());
- CdmBase cdmBase = CdmBase.deproxy(commonService.find(clazz,classid),clazz);
- ll.setImplementation(cdmBase);
- System.out.println("....Done");
- }
- }
- return pjp.proceed();
- }
-
-
- /**
- * Point cut for the 'initialize' method of the AbstractPersistentCollection.
- *
- */
- @Pointcut("execution(protected final void org.hibernate.collection.internal.AbstractPersistentCollection.initialize(..))")
- public void possibleCollectionLazyInitializationException() {
- }
-
- /**
- * 'Around' advice for the initialization of Collection objects
- *
- */
- @Around(value = "possibleCollectionLazyInitializationException()")
- public Object preloadCollectionOnDemand(ProceedingJoinPoint pjp) throws Throwable {
- if(enableWeaving) {
- PersistentCollection ps = (PersistentCollection) pjp.getTarget();
- if (ps.getOwner() != null && !classesToIgnore.contains(ps.getOwner().getClass().getName()) && !ps.wasInitialized() && !classes.contains(ps.getKey())) {
- System.out.print("--> AspectJCompile-Time Weaving " + ps.getRole());
- classes.add(ps.getKey());
- try {
- String role = ps.getRole();
- String fieldName = role.substring(role.lastIndexOf(".") + 1);
- System.out.print(", field : " + fieldName);
- Object owner = ps.getOwner();
-
- PersistentCollection col = commonService.initializeCollection(ps);
- ps.afterInitialize();
-
- Class<?> clazz = ps.getClass();
- if (clazz != null) {
- CollectionField cf = getCollectionField(col);
- Field field = clazz.getDeclaredField(cf.getFieldName());
- field.setAccessible(true);
- field.set(ps, cf.getCollection());
- }
- } catch (Exception ex) {
- ex.printStackTrace();
- System.out.println("Error in ReattachSessionAspect : " + ex.getMessage());
- } finally {
- classes.remove(ps.getKey());
- System.out.println("....Done");
- }
- }
- }
- return pjp.proceed();
-
- }
-
- private CollectionField getCollectionField(PersistentCollection pc) {
- if(pc != null) {
- if(pc instanceof PersistentSet) {
- return new CollectionField(new HashSet((Set)pc), "set");
- }
- if(pc instanceof PersistentSortedSet) {
- return new CollectionField(new TreeSet((Set)pc), "set");
- }
- if(pc instanceof PersistentList) {
- return new CollectionField(new ArrayList((List)pc), "list");
- }
- if(pc instanceof PersistentMap || pc instanceof PersistentMultiLanguageText) {
- return new CollectionField(new HashMap((Map)pc), "map");
- }
- if(pc instanceof PersistentSortedMap) {
- return new CollectionField(new TreeMap((Map)pc), "map");
- }
- }
- return null;
- }
-
- private String getCollectionFieldName(PersistentCollection pc) {
- if(pc != null) {
- if(pc instanceof PersistentSet || pc instanceof PersistentSortedSet) {
- return "set";
- }
- if(pc instanceof PersistentList) {
- return "list";
- }
- if(pc instanceof PersistentMap || pc instanceof PersistentMultiLanguageText) {
- return "map";
- }
- }
- return null;
- }
-
- private class CollectionField {
- private Object col;
- private String fieldName;
- public CollectionField(Object col, String fieldName) {
- this.col = col;
- this.fieldName = fieldName;
- }
-
- public Object getCollection() {
- return this.col;
- }
-
- public String getFieldName() {
- return this.fieldName;
- }
- }
-
-}
--- /dev/null
+package eu.etaxonomy.taxeditor.remoting;
+
+public class CdmEagerLoadingException extends RuntimeException {
+
+ public CdmEagerLoadingException(Throwable t) {
+ super(t);
+ }
+
+ public CdmEagerLoadingException(String message) {
+ super(message);
+ }
+
+}
--- /dev/null
+package eu.etaxonomy.taxeditor.remoting;
+
+public class CdmRemotingException extends RuntimeException {
+
+ /**
+ *
+ */
+ private static final long serialVersionUID = -560332689478356360L;
+
+ public CdmRemotingException(String message) {
+ super(message);
+ }
+
+ public CdmRemotingException(Exception exception) {
+ super(exception);
+ }
+
+}
--- /dev/null
+// $Id$
+/**
+ * Copyright (C) 2015 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.remoting.cache;
+
+import java.lang.reflect.Field;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+
+import net.sf.ehcache.Cache;
+import net.sf.ehcache.Element;
+
+import org.apache.log4j.Logger;
+import org.springframework.util.ReflectionUtils;
+
+import eu.etaxonomy.cdm.model.ICdmCacher;
+import eu.etaxonomy.cdm.model.common.CdmBase;
+
+/**
+ * @author cmathew
+ * @date 19 Feb 2015
+ *
+ */
+public class CacheLoader {
+ private static final Logger logger = Logger.getLogger(CacheLoader.class);
+
+ private static boolean isRecursiveEnabled = true;
+
+ protected final ICdmCacher cdmCacher;
+
+ private final Cache cdmlibModelCache;
+
+
+
+ public CacheLoader(ICdmCacher cdmCacher) {
+ this.cdmCacher = cdmCacher;
+ this.cdmlibModelCache = CdmRemoteCacheManager.getInstance().getCdmModelGetMethodsCache();
+
+ }
+
+
+ public CdmModelFieldPropertyFromClass getFromCdmlibModelCache(String className) {
+ Element e = cdmlibModelCache.get(className);
+ if (e == null) {
+ return null;
+ } else {
+ return (CdmModelFieldPropertyFromClass) e.getObjectValue();
+ }
+ }
+
+ @SuppressWarnings("unchecked")
+ public <T extends Object> T load(T obj, boolean recursive, boolean update) {
+ if(obj == null) {
+ return null;
+ }
+ if(obj instanceof CdmBase) {
+ return (T) load((CdmBase)obj, recursive, update);
+ } else if (obj instanceof Map) {
+ return (T) load((Map<T,T>)obj, recursive, update);
+ } else if (obj instanceof Collection) {
+ return (T) load((Collection<T>)obj, recursive, update);
+ }
+
+ return obj;
+ }
+
+ @SuppressWarnings("unchecked")
+ private <T extends Object> T loadRecursive(T obj, List<Object> alreadyVisitedEntities, boolean update) {
+ if(obj == null) {
+ return null;
+ }
+ if(obj instanceof CdmBase) {
+ return (T) loadRecursive((CdmBase)obj, alreadyVisitedEntities, update);
+ } else if (obj instanceof Map) {
+ return (T) load((Map<T,T>)obj, alreadyVisitedEntities, update);
+ } else if (obj instanceof Collection) {
+ return (T) load((Collection<T>)obj, alreadyVisitedEntities, update);
+ }
+
+
+ logger.info("No caching yet for type " + obj.getClass().getName());
+
+ return obj;
+ }
+
+ public <T extends Object> Map<T,T> load(Map<T,T> map, boolean recursive, boolean update){
+
+
+ if(isRecursiveEnabled && recursive) {
+ logger.info("---- starting recursive load for cdm entity map");
+ List<Object> alreadyVisitedEntities = new ArrayList<Object>();
+ Map<T,T> cachedMap = load(map, alreadyVisitedEntities, update);
+ alreadyVisitedEntities.clear();
+ logger.info("---- ending recursive load for cdm entity map \n");
+ return cachedMap;
+ } else {
+ return load(map, null, update);
+ }
+ }
+
+
+ private <T extends Object> Map<T,T> load(Map<T,T> map, List<Object> alreadyVisitedEntities, boolean update){
+ //map = (Map<T,T>)deproxy(map);
+
+ if(map == null || map.isEmpty()) {
+ return map;
+ }
+
+ int originalMapSize = map.size();
+ Object[] result = new Object[ map.size() * 2 ];
+ Iterator<Map.Entry<T,T>> iter = map.entrySet().iterator();
+ int i=0;
+ // to avoid ConcurrentModificationException
+ alreadyVisitedEntities.add(map);
+ while ( iter.hasNext() ) {
+ Map.Entry<T,T> e = iter.next();
+ result[i++] = e.getKey();
+ result[i++] = e.getValue();
+ }
+
+ for(i=0; i<result.length;i++) {
+ if(alreadyVisitedEntities == null) {
+ result[i] = load(result[i], false, update);
+ } else {
+ result[i] = loadRecursive(result[i], alreadyVisitedEntities, update);
+ }
+ }
+ map.clear();
+ for(i = 0; i < originalMapSize; i+=2 ) {
+ map.put(
+ (T)result[i],
+ (T)result[i+1]
+ );
+ }
+ return map;
+ }
+
+ public <T extends Object> Collection<T> load(Collection<T> collection, boolean recursive, boolean update){
+
+ Collection<T> loadedCollection;
+ if(isRecursiveEnabled && recursive) {
+ logger.info("---- starting recursive load for cdm entity collection");
+ List<Object> alreadyVisitedEntities = new ArrayList<Object>();
+ Collection<T> cachedCollection = load(collection, alreadyVisitedEntities, update);
+ alreadyVisitedEntities.clear();
+ logger.info("---- ending recursive load for cdm entity collection \n");
+ loadedCollection = cachedCollection;
+ } else {
+ loadedCollection = load(collection, null, update);
+ }
+ return loadedCollection;
+ }
+
+ @SuppressWarnings("unchecked")
+ private <T extends Object> Collection<T> load(Collection<T> collection, List<Object> alreadyVisitedEntities, boolean update) {
+
+
+
+ if(collection == null || collection.isEmpty()) {
+ return collection;
+ }
+ int length = collection.size();
+ Object[] result = new Object[length];
+ Iterator<T> collectionItr = collection.iterator();
+ int count = 0;
+ // to avoid ConcurrentModificationException
+ alreadyVisitedEntities.add(collection);
+ while(collectionItr.hasNext()) {
+ Object obj = collectionItr.next();
+ if(alreadyVisitedEntities == null) {
+ result[count] = load(obj, false, update);
+ } else {
+ result[count] = loadRecursive(obj, alreadyVisitedEntities, update);
+ }
+
+ count++;
+ }
+
+ collection.clear();
+
+ for ( int i = 0; i < length; i++ ) {
+ collection.add((T)result[i]);
+ }
+
+ return collection;
+ }
+
+
+ /**
+ * 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 CdmBase load(CdmBase cdmEntity, boolean recursive, boolean update) {
+ if(cdmEntity == null) {
+ return null;
+ }
+
+ // start by looking up the cdm entity in the cache
+ CdmBase cachedCdmEntity = cdmCacher.getFromCache(cdmEntity);
+
+ if(cachedCdmEntity != null) {
+ // if cdm entity was found in cache then
+ logger.info(" - object of type " + cdmEntity.getClass().getName() + " with id " + cdmEntity.getId() + " already exists");
+ // .. return if the cached and input objects are identical, else (this is a newly loaded object so) continue
+ if(cachedCdmEntity == cdmEntity) {
+ return cachedCdmEntity;
+ }
+ }
+
+ CdmBase loadedCdmBase;
+ if(isRecursiveEnabled && recursive) {
+ logger.info("---- starting recursive load for cdm entity " + cdmEntity.getClass().getName() + " with id " + cdmEntity.getId());
+ List<Object> alreadyVisitedEntities = new ArrayList<Object>();
+ CdmBase cb = loadRecursive(cdmEntity, alreadyVisitedEntities, update);
+ alreadyVisitedEntities.clear();
+ logger.info("---- ending recursive load for cdm entity " + cdmEntity.getClass().getName() + " with id " + cdmEntity.getId() + "\n");
+ loadedCdmBase = cb;
+ } else {
+ loadedCdmBase = load(cdmEntity);
+ }
+ return loadedCdmBase;
+
+ }
+
+
+ protected CdmBase load(CdmBase cdmEntity) {
+ logger.info("loading object of type " + cdmEntity.getClass().getName() + " with id " + cdmEntity.getId());
+ cdmCacher.put((CdmBase)ProxyUtils.deproxy(cdmEntity));
+ return cdmCacher.getFromCache(cdmEntity);
+ }
+
+
+ private CdmBase loadRecursive(CdmBase cdmEntity, List<Object> alreadyVisitedEntities, boolean update) {
+
+ CdmBase cachedCdmEntity = load(cdmEntity);
+
+
+ // we want to recursive through the cdmEntity (and not the cachedCdmEntity)
+ // since there could be new or deleted objects in the cdmEntity sub-graph
+
+ // start by getting the fields from the cdm entity
+ String className = cdmEntity.getClass().getName();
+ CdmModelFieldPropertyFromClass cmgmfc = getFromCdmlibModelCache(className);
+ if(cmgmfc != null) {
+ alreadyVisitedEntities.add(cdmEntity);
+ List<String> fields = cmgmfc.getFields();
+ for(String field : fields) {
+ // retrieve the actual object corresponding to the field.
+ // this object will be either a CdmBase or a Collection / Map
+ // with CdmBase as the generic type
+
+ CdmBase cdmEntityInSubGraph = getCdmBaseTypeFieldValue(cdmEntity, cachedCdmEntity, field, alreadyVisitedEntities, update);
+ if(cdmEntityInSubGraph != null) {
+ //checkForIdenticalCdmEntity(alreadyVisitedEntities, cdmEntityInSubGraph);
+ if(!checkForIdenticalCdmEntity(alreadyVisitedEntities, cdmEntityInSubGraph)) {
+ logger.info("recursive loading object of type " + cdmEntityInSubGraph.getClass().getName() + " with id " + cdmEntityInSubGraph.getId());
+ loadRecursive(cdmEntityInSubGraph, alreadyVisitedEntities, update);
+ } else {
+ logger.info("object of type " + cdmEntityInSubGraph.getClass().getName() + " with id " + cdmEntityInSubGraph.getId() + " already visited");
+ }
+ }
+ }
+ } else {
+ throw new CdmClientCacheException("CdmEntity with class " + cdmEntity.getClass().getName() + " is not found in the cdmlib model cache. " +
+ "The cache may be corrupted or not in sync with the latest model version" );
+ }
+
+ return cachedCdmEntity;
+ }
+
+
+ private CdmBase getCdmBaseTypeFieldValue(CdmBase cdmEntity,
+ CdmBase cachedCdmEntity,
+ String fieldName,
+ List<Object> alreadyVisitedEntities,
+ boolean update) {
+
+ // this method attempts to make sure that for any two objects found in
+ // the object graph, if they are equal then they should also be the same,
+ // which is crucial for the merge to work
+ if(cachedCdmEntity == null) {
+ throw new CdmClientCacheException("When trying to set field value, the cached cdm entity cannot be null");
+ }
+
+ Class<?> clazz = cdmEntity.getClass();
+ try {
+ // this call will search in the provided class as well as
+ // the super classes until it finds the field
+ Field field = ReflectionUtils.findField(clazz, fieldName);
+
+ if(field == null) {
+ throw new CdmClientCacheException("Field '" + fieldName
+ + "' not found when searching in class '" + clazz.getName() + "' and its supercalsses");
+ }
+ field.setAccessible(true);
+ Object o = field.get(cdmEntity);
+ // resetting the value in cdm entity to the deproxied object
+ o = ProxyUtils.deproxy(o);
+ field.set(cdmEntity, o);
+
+ CdmBase cdmEntityInSubGraph = null;
+
+ if(update) {
+ // if we are in update mode we have to make the field of the cached entity
+ // up-to-date by setting it to the value of the cdm entity being loaded
+ // NOTE : the filed is overridden in the case of two exceptions
+ // found below
+ field.set(cachedCdmEntity, o);
+
+ }
+
+ if(o != null && !ProxyUtils.isProxy(o)) {
+ if(CdmBase.class.isAssignableFrom(o.getClass())) {
+ logger.info("found initialised cdm entity '" + fieldName + "' in object of type " + clazz.getName() + " with id " + cdmEntity.getId());
+
+ cdmEntityInSubGraph = (CdmBase)o;
+ CdmBase cachedCdmEntityInSubGraph = cdmCacher.getFromCache(cdmEntityInSubGraph);
+
+// Object oldCachedCdmEntityInSubGraph = field.get(cachedCdmEntity);
+// if(ProxyUtils.isProxy(oldCachedCdmEntityInSubGraph)) {
+// LazyInitializer hli =
+// ((HibernateProxy)oldCachedCdmEntityInSubGraph).getHibernateLazyInitializer();
+//
+// if(cdmEntityInSubGraph.getId() == ((Integer)hli.getIdentifier()).intValue()) {
+// // exception 1 : is the case where
+// // the earlier value of the field in the cached entity
+// // was a proxy with the same id then we don't need to
+// // update it here as it will be updated on demand,
+// // so we reset it to the earlier proxy
+// field.set(cachedCdmEntity, oldCachedCdmEntityInSubGraph);
+// return null;
+// }
+// }
+
+ if(cachedCdmEntityInSubGraph != null) {
+ if(cachedCdmEntityInSubGraph != cdmEntityInSubGraph) {
+ // exception 2 : is the case where
+ // the field has been already initialised, cached and
+ // is not the same as the one in the cache, in which case we set the value
+ // of the field to the one found in the cache
+ logger.info("setting cached + real value to '" + fieldName + "' in object of type " + clazz.getName() + " with id " + cdmEntity.getId());
+ field.set(cachedCdmEntity, cachedCdmEntityInSubGraph);
+ field.set(cdmEntity, cachedCdmEntityInSubGraph);
+ } else {
+ // since the field value object in cdmEntity
+ // is the same as the field value object in cachedCdmEntity
+ // we are sure that the its subgraph is also correctly loaded,
+ // so we can exit the recursion
+ return null;
+ }
+ }
+ } else if(o instanceof Map && !checkForIdenticalCdmEntity(alreadyVisitedEntities, o)) {
+ loadRecursive((Map)o, alreadyVisitedEntities, update);
+ } else if(o instanceof Collection && !checkForIdenticalCdmEntity(alreadyVisitedEntities, o)) {
+ loadRecursive((Collection)o, alreadyVisitedEntities, update);
+ }
+ }
+ // we return the original cdm entity in the sub graph because we
+ // want to continue to recurse on the input cdm entity graph
+ // and not the one in the cache
+ return cdmEntityInSubGraph;
+ } catch (SecurityException e) {
+ throw new CdmClientCacheException(e);
+ } catch (IllegalArgumentException e) {
+ throw new CdmClientCacheException(e);
+ } catch (IllegalAccessException e) {
+ throw new CdmClientCacheException(e);
+ }
+ }
+
+ private boolean checkForIdenticalCdmEntity(List<Object> objList, Object objToCompare) {
+ if(objToCompare != null) {
+ for(Object obj : objList) {
+ if(obj == objToCompare) {
+ return true;
+ }
+ }
+ }
+ return false;
+ }
+
+
+ public static boolean isRecursiveEnabled() {
+ return isRecursiveEnabled;
+ }
+
+ public static void setRecursiveEnabled(boolean ire) {
+ isRecursiveEnabled = ire;
+ }
+}
--- /dev/null
+package eu.etaxonomy.taxeditor.remoting.cache;
+
+public class CdmClientCacheException extends RuntimeException {
+
+ public CdmClientCacheException(String message) {
+ super(message);
+ }
+
+ public CdmClientCacheException(Exception e) {
+ super(e);
+ }
+}
--- /dev/null
+package eu.etaxonomy.taxeditor.remoting.cache;
+
+import eu.etaxonomy.cdm.model.common.CdmBase;
+
+public class CdmEntityCacheKey {
+
+ private Class<? extends CdmBase> persistenceClass;
+ private int persistenceId;
+
+ public CdmEntityCacheKey(CdmBase cdmBase) {
+ this.persistenceClass = cdmBase.getClass();
+ this.persistenceId = cdmBase.getId();
+ }
+
+ public CdmEntityCacheKey(Class<? extends CdmBase> clazz, int id) {
+ this.persistenceClass = clazz;
+ this.persistenceId = id;
+ }
+
+
+
+ public Class<? extends CdmBase> getPersistenceClass() {
+ return persistenceClass;
+ }
+
+ public int getPersistenceId() {
+ return persistenceId;
+ }
+ @Override
+ public boolean equals(Object obj) {
+ if(obj == null || !(obj instanceof CdmEntityCacheKey)) {
+ return false;
+ }
+
+ if(this == obj) {
+ return true;
+ }
+ CdmEntityCacheKey that = (CdmEntityCacheKey) obj;
+ if(this.persistenceClass.equals(that.persistenceClass) && this.persistenceId == that.persistenceId) {
+ return true;
+ }
+
+ return false;
+ }
+
+ @Override
+ public int hashCode() {
+ return (this.persistenceClass.getName() + String.valueOf(this.persistenceId)).hashCode();
+ }
+
+ @Override
+ public String toString() {
+ return this.persistenceClass.getName() + String.valueOf(this.persistenceId);
+ }
+
+}
--- /dev/null
+package eu.etaxonomy.taxeditor.remoting.cache;
+
+import java.lang.reflect.Field;
+import java.lang.reflect.Method;
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+import net.sf.ehcache.Cache;
+import net.sf.ehcache.Element;
+
+import org.apache.log4j.Logger;
+import org.hibernate.cfg.Configuration;
+import org.hibernate.mapping.PersistentClass;
+import org.hibernate.mapping.Property;
+import org.hibernate.property.Getter;
+
+
+public class CdmModelCacher {
+
+
+ private static final Logger logger = Logger.getLogger(CdmModelCacher.class);
+
+ public static String HB_CONFIG_FILE_PATH= "/eu/etaxonomy/cdm/mappings/hibernate.cfg.xml";
+
+ private final List<CdmModelFieldPropertyFromClass> cmgmfcList = new ArrayList<CdmModelFieldPropertyFromClass>();
+
+
+ public static Configuration buildConfiguration() {
+ Configuration configuration = new Configuration().configure(HB_CONFIG_FILE_PATH);
+ configuration.buildMappings();
+ return configuration;
+ }
+
+ public void cacheGetterFields(Cache cache) {
+
+ Configuration configuration = buildConfiguration();
+ Iterator<PersistentClass> classMappingIterator = configuration.getClassMappings();
+
+ cache.removeAll();
+
+ while(classMappingIterator.hasNext()) {
+ PersistentClass persistentClass = classMappingIterator.next();
+ Class mappedClass = persistentClass.getMappedClass();
+ String mappedClassName = mappedClass.getName();
+
+ CdmModelFieldPropertyFromClass cmgmfc = new CdmModelFieldPropertyFromClass(mappedClassName);
+ //logger.info("Adding class : " + mappedClassName + " to cache");
+ addGetters(persistentClass, cmgmfc);
+ cache.put(new Element(mappedClassName, cmgmfc));
+ }
+
+ }
+
+ private void addGetters(PersistentClass persistentClass, CdmModelFieldPropertyFromClass cmgmfc) {
+ if (persistentClass != null) {
+ Iterator propertyIt = persistentClass.getPropertyIterator();
+
+ while(propertyIt.hasNext())
+ {
+ Property property = (Property)propertyIt.next();
+ Getter getter = property.getGetter(persistentClass.getMappedClass());
+ if(getter != null && getter.getMember() != null) {
+ Field field = (Field)getter.getMember();
+
+ //logger.info(" - contains field '" + field.getName() + "' of type '" + field.getType().getName() + "'");
+ cmgmfc.addGetMethods(field.getName());
+ }
+ }
+ addGetters(persistentClass.getSuperclass(), cmgmfc);
+ }
+ }
+
+ public void checkGetterMethods() {
+
+ Configuration configuration = new Configuration().configure(HB_CONFIG_FILE_PATH);
+ configuration.buildMappings();
+ Iterator<PersistentClass> classMappingIterator = configuration.getClassMappings();
+
+ Cache cache = CdmRemoteCacheManager.getInstance().getCdmModelGetMethodsCache();
+ cache.removeAll();
+
+ while(classMappingIterator.hasNext()) {
+ PersistentClass persistentClass = classMappingIterator.next();
+ Class mappedClass = persistentClass.getMappedClass();
+ String mappedClassName = mappedClass.getName();
+
+ Iterator propertyIt = persistentClass.getPropertyIterator();
+
+ Method[] methods = mappedClass.getMethods();
+
+ while(propertyIt.hasNext())
+ {
+ Property property = (Property)propertyIt.next();
+ Getter getter = property.getGetter(mappedClass);
+ if(getter != null && getter.getMember() != null) {
+ Field field = (Field)getter.getMember();
+ String getMethod = getMethodNameFromFieldName(field.getName(), field.getType().getName());
+
+ boolean foundMethod = false;
+ for(Method method : methods) {
+ if(method.getName().equals(getMethod)) {
+ foundMethod = true;
+ break;
+ }
+ }
+ if(!foundMethod) {
+ logger.info("Inferred method " + getMethod + " does not exist in class " + mappedClassName);
+ //throw new CdmClientCacheException("Inferred method " + getMethod + " does not exist in class " + mappedClassName);
+ }
+ }
+ }
+
+
+ }
+
+ }
+
+ public List<CdmModelFieldPropertyFromClass> getCdmModelGetMethodFromClassList() {
+ cmgmfcList.clear();
+ Configuration configuration = new Configuration().configure(HB_CONFIG_FILE_PATH);
+ configuration.buildMappings();
+ Iterator<PersistentClass> classMappingIterator = configuration.getClassMappings();
+
+ while(classMappingIterator.hasNext()) {
+ PersistentClass persistentClass = classMappingIterator.next();
+ Class mappedClass = persistentClass.getMappedClass();
+ String mappedClassName = mappedClass.getName();
+
+ CdmModelFieldPropertyFromClass cmgmfc = new CdmModelFieldPropertyFromClass(mappedClassName);
+ Iterator propertyIt = persistentClass.getPropertyIterator();
+
+ while(propertyIt.hasNext())
+ {
+ Property property = (Property)propertyIt.next();
+ Getter getter = property.getGetter(mappedClass);
+ if(getter != null && getter.getMember() != null) {
+ Field field = (Field)getter.getMember();
+ String getMethod = getMethodNameFromFieldName(getter.getMember().getName(),field.getType().getName());
+ cmgmfc.addGetMethods(getMethod);
+ }
+ }
+ cmgmfcList.add(cmgmfc);
+ }
+ return cmgmfcList;
+
+ }
+
+ public static String getMethodNameFromFieldName(String fieldName, String type) {
+ String prefix = type != null && type.toLowerCase().endsWith("boolean") ? "is" : "get";
+ String getMethod = prefix + fieldName.substring(0, 1).toUpperCase() + fieldName.substring(1);
+ return getMethod;
+ }
+
+
+
+
+
+}
--- /dev/null
+package eu.etaxonomy.taxeditor.remoting.cache;
+
+import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.List;
+
+public class CdmModelFieldPropertyFromClass implements Serializable {
+
+ private static final long serialVersionUID = 5726395976531887526L;
+ private String className;
+ private String parentClassName;
+
+ private List<String> fields = new ArrayList<String>();
+
+
+ public CdmModelFieldPropertyFromClass(String className) {
+ this.setClassName(className);
+ }
+
+ public String getParentClassName() {
+ return parentClassName;
+ }
+
+ public void setParentClassName(String parentClassName) {
+ this.parentClassName = parentClassName;
+ }
+
+ public List<String> getFields() {
+ return fields;
+ }
+
+ public void setFields(List<String> fields) {
+ this.fields = fields;
+ }
+
+ public void addGetMethods(String getMethod) {
+ this.fields.add(getMethod);
+ }
+
+ public String getClassName() {
+ return className;
+ }
+
+ public void setClassName(String className) {
+ this.className = className;
+ }
+
+
+
+
+}
--- /dev/null
+package eu.etaxonomy.taxeditor.remoting.cache;
+
+import net.sf.ehcache.Cache;
+import net.sf.ehcache.CacheException;
+import net.sf.ehcache.CacheManager;
+import net.sf.ehcache.config.CacheConfiguration;
+import net.sf.ehcache.config.SizeOfPolicyConfiguration;
+
+import org.apache.log4j.Logger;
+
+
+public class CdmRemoteCacheManager {
+
+ private static final Logger logger = Logger.getLogger(CdmRemoteCacheManager.class);
+
+
+ private Cache cdmlibModelCache;
+
+ private static CdmRemoteCacheManager cdmRemoteCacheManager = null;
+
+ public static final String CDM_MODEL_CACHE_NAME = "cdmModelGetMethodsCache";
+
+ private static Thread initThread;
+
+ private static boolean cacheInitialised = false;
+
+ public enum CdmCacheManagerType {
+ CDMLIB_MODEL,
+ DEFAULT
+ }
+
+ public static CdmRemoteCacheManager getInstance(){
+
+ if(cdmRemoteCacheManager == null) {
+ cdmRemoteCacheManager = new CdmRemoteCacheManager();
+ }
+ return cdmRemoteCacheManager;
+ }
+ private CdmRemoteCacheManager() {
+
+
+ try {
+ // NOTE:Programmatically creating the cache manager may solve the problem of
+ // recreating data written to disk on startup
+ // see https://stackoverflow.com/questions/1729605/ehcache-persist-to-disk-issues
+ //String cacheFilePath = CDMLIB_CACHE_MANAGER_CONFIG_RESOURCE.getFile().getAbsolutePath();
+ //InputStream in = this.getClass().getClassLoader().getResourceAsStream("cdmlib-ehcache.xml");
+
+ SizeOfPolicyConfiguration sizeOfConfig = new SizeOfPolicyConfiguration();
+ sizeOfConfig.setMaxDepth(1000);
+ sizeOfConfig.setMaxDepthExceededBehavior("abort");
+
+ CacheConfiguration modelcc = new CacheConfiguration(CDM_MODEL_CACHE_NAME, 0)
+ .eternal(true)
+ .statistics(true)
+ .sizeOfPolicy(sizeOfConfig)
+ .overflowToOffHeap(false);
+
+ cdmlibModelCache = new Cache(modelcc);
+
+ CacheManager.create().addCache(cdmlibModelCache);
+ initCdmModelCache(cdmlibModelCache);
+
+ } catch (CacheException e) {
+ throw new CdmClientCacheException(e);
+ }
+
+ }
+
+ private void initCdmModelCache(final Cache cache) {
+
+ initThread = new Thread() {
+ @Override
+ public void run(){
+ synchronized (cdmlibModelCache) {
+ CdmModelCacher cmdmc = new CdmModelCacher();
+ cmdmc.cacheGetterFields(cache);
+ cacheInitialised = true;
+ logger.info("Initialisation of CDM getter fields complete");
+ cdmlibModelCache.notify();
+ }
+ }
+
+ };
+ initThread.start();
+ }
+
+ public Cache getCdmModelGetMethodsCache(){
+ //Note : Even though we synchronize this method, the cache can be simply
+ // retrieved using CacheManager.create().getCache(CDM_MODEL_CACHE_NAME)
+ // in which case the cache may not be fully initialised
+ synchronized (cdmlibModelCache) {
+ while(!cacheInitialised) {
+ try {
+ logger.info("Waiting for initialisation of CDM getter fields to complete ...");
+ cdmlibModelCache.wait();
+ } catch (InterruptedException e) {}
+ }
+ }
+ logger.info("CDM getter fields cache initialised");
+ return cdmlibModelCache;
+ }
+
+ public static void removeEntityCaches() {
+ CacheManager cm = CacheManager.create();
+ String[] cacheNames = CacheManager.create().getCacheNames();
+ for(String cacheName : cacheNames) {
+ if(!cacheName.equals(CDM_MODEL_CACHE_NAME)) {
+ cm.removeCache(cacheName);
+ }
+ }
+ }
+
+
+
+}
--- /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.remoting.cache;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
+import java.util.Map;
+
+import net.sf.ehcache.Cache;
+import net.sf.ehcache.CacheManager;
+import net.sf.ehcache.Element;
+import net.sf.ehcache.config.CacheConfiguration;
+import net.sf.ehcache.config.SizeOfPolicyConfiguration;
+import net.sf.ehcache.statistics.LiveCacheStatistics;
+
+import org.apache.log4j.Logger;
+
+import eu.etaxonomy.cdm.api.cache.CdmServiceCacher;
+import eu.etaxonomy.cdm.model.ICdmCacher;
+import eu.etaxonomy.cdm.model.common.CdmBase;
+import eu.etaxonomy.taxeditor.session.ICdmEntitySessionManager;
+
+/**
+ *
+ * This cache guarantees that
+ * - all objects put will be ancestors of CdmBase
+ * - all CdmBase objects in the cache will be already de-proxied
+ * - after any CdmBase object is put in the cache,
+ * all non-null / non-proxy CdmBase objects in the sub-graph
+ * will also be present in the cache.
+ *
+ * @author cmathew
+ * @date 14 Oct 2014
+ *
+ */
+
+public class CdmTransientEntityCacher implements ICdmCacher {
+
+ private static final Logger logger = Logger.getLogger(CdmTransientEntityCacher.class);
+
+
+ private final ICdmEntitySessionManager cdmEntitySessionManager;
+
+ private static CdmServiceCacher cdmServiceCacher;
+
+ private final String cacheId;
+
+ private final Cache cache;
+
+ private final CacheLoader cacheLoader;
+
+
+
+ public CdmTransientEntityCacher(String cacheId, ICdmEntitySessionManager cdmEntitySessionManager) {
+ this.cacheId = cacheId;
+
+ cache = new Cache(getEntityCacheConfiguration(cacheId));
+
+ CacheManager.create().addCache(cache);
+
+ this.cdmEntitySessionManager = cdmEntitySessionManager;
+
+ cacheLoader = new CacheLoader(this);
+ }
+
+ public CdmTransientEntityCacher(Object sessionOwner, ICdmEntitySessionManager cdmEntitySessionManager) {
+ this(generateCacheId(sessionOwner), cdmEntitySessionManager);
+ }
+
+ public static String generateCacheId(Object sessionOwner) {
+ return sessionOwner.getClass().getName() + String.valueOf(sessionOwner.hashCode());
+ }
+
+ /**
+ * Returns the default cache configuration.
+ *
+ * @return
+ */
+ private CacheConfiguration getEntityCacheConfiguration(String cacheId) {
+ SizeOfPolicyConfiguration sizeOfConfig = new SizeOfPolicyConfiguration();
+ sizeOfConfig.setMaxDepth(10000);
+ sizeOfConfig.setMaxDepthExceededBehavior("abort");
+
+ return new CacheConfiguration(cacheId, 0)
+ .eternal(true)
+ .statistics(true)
+ .sizeOfPolicy(sizeOfConfig)
+ .overflowToOffHeap(false);
+
+ }
+
+ public static void setDefaultCacher(CdmServiceCacher css) {
+ cdmServiceCacher = css;
+ }
+
+ public LiveCacheStatistics getCacheStatistics() {
+ return cache.getLiveCacheStatistics();
+ }
+
+ /**
+ * Returns the cache corresponding to the cache id
+ *
+ * @param cacheId
+ * @return
+ */
+ private Cache getCache() {
+ return CacheManager.create().getCache(cacheId);
+ }
+
+ public <T extends Object> T load(T obj, boolean update) {
+ return cacheLoader.load(obj, true, update);
+ }
+
+ public <T extends Object> Map<T,T> load(Map<T,T> map, boolean update){
+ return cacheLoader.load(map, true, update);
+ }
+
+ public <T extends Object> Collection<T> load(Collection<T> collection, boolean update){
+ return cacheLoader.load(collection, true, update);
+ }
+
+ public CdmBase load(CdmBase cdmEntity, boolean update) {
+ return cacheLoader.load(cdmEntity, true, update);
+ }
+
+ public CdmModelFieldPropertyFromClass getFromCdmlibModelCache(String className) {
+ return cacheLoader.getFromCdmlibModelCache(className);
+ }
+
+
+
+
+ @Override
+ public void put(CdmBase cdmEntity) {
+
+ CdmBase cachedCdmEntity = cdmServiceCacher.load(cdmEntity);
+ if(cachedCdmEntity != null) {
+ logger.info("Cdm Entity with id : " + cdmEntity.getId() + " already exists in permanent cache. Ignoring put.");
+ return;
+ }
+ CdmEntityCacheKey id = new CdmEntityCacheKey(cdmEntity);
+
+ cachedCdmEntity = getFromCache(id);
+ if(cachedCdmEntity == null) {
+ getCache().put(new Element(id, cdmEntity));
+ logger.info(" - object of type " + cdmEntity.getClass().getName() + " with id " + cdmEntity.getId() + " put in cache");
+ return;
+ }
+ logger.info(" - object of type " + cdmEntity.getClass().getName() + " with id " + cdmEntity.getId() + " already exists");
+ }
+
+
+ private Element getCacheElement(CdmEntityCacheKey key) {
+ return getCache().get(key);
+ }
+
+
+ public CdmBase getFromCache(CdmEntityCacheKey id) {
+ Element e = getCacheElement(id);
+
+ if (e == null) {
+ return null;
+ } else {
+ return (CdmBase) e.getObjectValue();
+ }
+ }
+
+ public CdmBase getFromCache(Class<? extends CdmBase> clazz, int id) {
+ CdmEntityCacheKey cacheId = generateKey(clazz,id);
+ return getFromCache(cacheId);
+ }
+
+ @Override
+ public CdmBase getFromCache(CdmBase cdmBase) {
+
+ CdmEntityCacheKey cacheId = generateKey((CdmBase)ProxyUtils.deproxy(cdmBase));
+ // first try this cache
+ CdmBase cachedCdmEntity = getFromCache(cacheId);
+
+ if(cachedCdmEntity == null) {
+ // ... then try the permanent cache
+ cachedCdmEntity = cdmServiceCacher.getFromCache(cdmBase.getUuid());
+ }
+
+ return cachedCdmEntity;
+ }
+
+ public CdmBase getFromCache(CdmBase cdmBase, Class<? extends CdmBase> clazz) {
+
+ cdmBase = CdmBase.deproxy(cdmBase, clazz);
+ return getFromCache(cdmBase);
+ }
+
+ public List<CdmBase> getAllEntities() {
+ List<CdmBase> entities = new ArrayList<CdmBase>();
+ Map<String, CdmBase> elementsMap = getCache().getAllWithLoader(getCache().getKeys(), null);
+ for (Map.Entry<String, CdmBase> entry : elementsMap.entrySet()) {
+ entities.add(entry.getValue());
+ }
+ return entities;
+ }
+
+ public boolean exists(CdmEntityCacheKey key) {
+ return (getCacheElement(key) != null);
+ }
+
+ public boolean existsAndIsNotNull(CdmEntityCacheKey id) {
+ return getFromCache(id) != null;
+ }
+
+ public void clear() {
+ cache.removeAll();
+ }
+
+ public void dispose() {
+ cache.dispose();
+
+ }
+
+
+ public static CdmEntityCacheKey generateKey(Class<? extends CdmBase> clazz, int id) {
+ return new CdmEntityCacheKey(clazz, id);
+ }
+
+
+ public static CdmEntityCacheKey generateKey(CdmBase cdmBase) {
+ Class<? extends CdmBase> entityClass = cdmBase.getClass();
+ int id = cdmBase.getId();
+ return new CdmEntityCacheKey(entityClass, id);
+ }
+
+ /* (non-Javadoc)
+ * @see eu.etaxonomy.cdm.model.ICdmCacher#load(eu.etaxonomy.cdm.model.common.CdmBase)
+ */
+ @Override
+ public CdmBase load(CdmBase cdmEntity) {
+ return load(cdmEntity, true);
+ }
+
+ /* (non-Javadoc)
+ * @see eu.etaxonomy.cdm.model.ICdmCacher#isCachable(eu.etaxonomy.cdm.model.common.CdmBase)
+ */
+ @Override
+ public boolean isCachable(CdmBase cdmEntity) {
+ return true;
+ }
+
+ /* (non-Javadoc)
+ * @see eu.etaxonomy.cdm.model.ICdmCacher#exists(eu.etaxonomy.cdm.model.common.CdmBase)
+ */
+ @Override
+ public boolean exists(CdmBase cdmBase) {
+ return exists(generateKey(cdmBase));
+ }
+
+
+
+}
--- /dev/null
+// $Id$
+/**
+ * Copyright (C) 2015 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.remoting.cache;
+
+import java.lang.reflect.Field;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+
+import net.sf.ehcache.Cache;
+import net.sf.ehcache.CacheManager;
+import net.sf.ehcache.Element;
+
+import org.apache.log4j.Logger;
+import org.hibernate.collection.spi.PersistentCollection;
+import org.hibernate.proxy.HibernateProxy;
+import org.hibernate.proxy.LazyInitializer;
+import org.springframework.util.ReflectionUtils;
+
+import eu.etaxonomy.cdm.api.cache.CdmCacher;
+import eu.etaxonomy.cdm.model.common.CdmBase;
+
+/**
+ * @author cmathew
+ * @date 9 Feb 2015
+ *
+ */
+public class EntityCacherDebugResult {
+
+ private static final Logger logger = Logger.getLogger(EntityCacherDebugResult.class);
+
+ private Map<CdmEntityInfo, CdmEntityInfo> duplicateCdmEntityMap;
+
+ private List<CdmEntityInfo> notInCacheList;
+
+ private CdmTransientEntityCacher cacher;
+
+ private List<CdmEntityInfo> rootElements;
+
+ StringBuilder debugOutput = new StringBuilder();
+
+ public EntityCacherDebugResult() {
+ }
+
+
+ public <T extends CdmBase> EntityCacherDebugResult(CdmTransientEntityCacher cacher, List<T> rootEntities) {
+ this.cacher = cacher;
+ init();
+
+ if(rootEntities != null && !rootEntities.isEmpty()) {
+ for(CdmBase rootEntity : rootEntities) {
+ debug(rootEntity, true);
+ String out = toString(duplicateCdmEntityMap, notInCacheList, rootEntity);
+ System.out.println(out);
+ debugOutput.append(out);
+ clear();
+ }
+
+ }
+ }
+
+ private void init() {
+ duplicateCdmEntityMap = new HashMap<CdmEntityInfo, CdmEntityInfo>();
+ notInCacheList = new ArrayList<CdmEntityInfo>();
+ rootElements = new ArrayList<CdmEntityInfo>();
+ }
+
+ private void clear() {
+ duplicateCdmEntityMap.clear();
+ notInCacheList.clear();
+ }
+
+ public void addDuplicateEntity(CdmEntityInfo cei, CdmEntityInfo cachedCei) {
+ duplicateCdmEntityMap.put(cei, cachedCei);
+ }
+
+ public void addEntityNotInCache(CdmEntityInfo cei) {
+ notInCacheList.add(cei);
+ }
+
+ public List<CdmEntityInfo> getRootElements() {
+ return rootElements;
+ }
+
+ private void print(Map<CdmEntityInfo, CdmEntityInfo> duplicateCdmEntityMap,
+ List<CdmEntityInfo> notInCacheList,
+ CdmBase rootEntity) {
+ System.out.println(toString(duplicateCdmEntityMap, notInCacheList, rootEntity));
+ }
+
+
+ @Override
+ public String toString() {
+ return debugOutput.toString();
+ }
+
+ private String toString(Map<CdmEntityInfo, CdmEntityInfo> duplicateCdmEntityMap,
+ List<CdmEntityInfo> notInCacheList,
+ CdmBase rootEntity) {
+
+
+ StringBuilder sb = new StringBuilder();
+ sb.append(System.getProperty("line.separator"));
+ sb.append("<<< Root Entity " + rootEntity.getUserFriendlyTypeName() + " with id " + rootEntity.getId() + " >>>");
+ sb.append(System.getProperty("line.separator"));
+ if(duplicateCdmEntityMap.isEmpty()) {
+ sb.append("No Duplicate CDM Entities.");
+ } else {
+ sb.append("Duplicate CDM Entities,");
+
+ for (Map.Entry<CdmEntityInfo, CdmEntityInfo> entry : duplicateCdmEntityMap.entrySet())
+ {
+ sb.append(System.getProperty("line.separator"));
+ CdmEntityInfo cei = entry.getKey();
+ CdmBase cb = (CdmBase) cei.getObject();
+ Object cbParent = cei.getParent().getObject();
+
+
+ sb.append(" - " + cei.getField().getName() + ":" + cb.getUserFriendlyTypeName() + "/" + cb.getId() +
+ " in entity " + cbParent.getClass().getCanonicalName());
+ if(cbParent instanceof CdmBase) {
+ sb.append(" with id : " + ((CdmBase)cbParent).getId());
+ }
+ sb.append(System.getProperty("line.separator"));
+ sb.append(" -- entity belongs to cache(s) : " + getCachesContainingEntity(cb));
+ sb.append(System.getProperty("line.separator"));
+
+
+ CdmEntityInfo dupCei = entry.getValue();
+ CdmBase dupCb = (CdmBase) dupCei.getObject();
+ Object dupCbParent = dupCei.getParent().getObject();
+
+ sb.append(" - " + dupCei.getField().getName() + ":" + dupCb.getUserFriendlyTypeName() + "/" + dupCb.getId() +
+ " in entity " + dupCbParent.getClass().getCanonicalName());
+ if(dupCbParent instanceof CdmBase) {
+ sb.append(" with id : " + ((CdmBase)dupCbParent).getId());
+ }
+ sb.append(System.getProperty("line.separator"));
+ sb.append(" -- entity belongs to cache(s) : " + getCachesContainingEntity(dupCb));
+ sb.append(System.getProperty("line.separator"));
+ sb.append("-----------");
+ }
+ }
+
+ sb.append(System.getProperty("line.separator"));
+ sb.append(System.getProperty("line.separator"));
+
+ if(notInCacheList.isEmpty()) {
+ sb.append("No Entities found which are not in Cache.");
+ } else {
+ sb.append("Not In Cache Entities,");
+
+ for(CdmEntityInfo cei : notInCacheList) {
+ CdmBase cb = (CdmBase) cei.getObject();
+ Object cbParent = cei.getParent().getObject();
+
+ sb.append(System.getProperty("line.separator"));
+
+ String fieldName = "";
+ if(cei.getField() != null) {
+ fieldName = cei.getField().getName();
+ }
+ sb.append(" - " + fieldName + ":" + cb.getUserFriendlyTypeName() + "/" + cb.getId());
+
+ if(cbParent instanceof CdmBase) {
+ sb.append(" of entity " + ((CdmBase)cbParent).getUserFriendlyTypeName());
+ } else {
+ sb.append(" of entity " + cbParent.getClass().getName());
+ }
+ }
+ }
+ sb.append(System.getProperty("line.separator"));
+ return sb.toString();
+ }
+
+ private String getCachesContainingEntity(CdmBase cdmEntity) {
+ Cache defaultCache = CacheManager.create().getCache(CdmCacher.DEFAULT_CACHE_NAME);
+ String caches = "";
+ Element dce = defaultCache.get(cdmEntity.getUuid());
+ if(dce != null && dce.getObjectValue() == cdmEntity) {
+ caches = "{DC}";
+ }
+
+ Object cte = cacher.getFromCache(CdmTransientEntityCacher.generateKey(cdmEntity));
+ if(cte != null && cte == cdmEntity) {
+ caches += "{TC}";
+ }
+ return caches;
+ }
+
+
+ private void debug(CdmBase cdmEntity, boolean recursive) {
+ if(cdmEntity == null) {
+ return;
+ }
+ logger.info("---- starting recursive debug for cdm entity " + cdmEntity.getClass().getName() + " with id " + cdmEntity.getId());
+ List<CdmEntityInfo> alreadyVisitedEntities = new ArrayList<CdmEntityInfo>();
+ CdmEntityInfo cei = new CdmEntityInfo(cdmEntity);
+ debugRecursive(cdmEntity, alreadyVisitedEntities, cei);
+ rootElements.add(cei);
+ alreadyVisitedEntities.clear();
+ logger.info("---- ending recursive debug for cdm entity " + cdmEntity.getClass().getName() + " with id " + cdmEntity.getId() + "\n");
+ }
+
+ private <T extends Object> void debugRecursive(T obj,
+ List<CdmEntityInfo> alreadyVisitedEntities,
+ CdmEntityInfo cei) {
+ if(obj == null) {
+ return;
+ }
+ if(obj instanceof CdmBase) {
+ debugRecursive((CdmBase)obj, alreadyVisitedEntities, cei);
+ } else if (obj instanceof Map) {
+ debug((Map<T,T>)obj, alreadyVisitedEntities, cei);
+ } else if (obj instanceof Collection) {
+ debug((Collection<T>)obj, alreadyVisitedEntities, cei);
+ }
+
+ logger.info("No caching yet for type " + obj.getClass().getName());
+
+
+ }
+
+ private <T extends Object> void debug(Map<T,T> map,
+ List<CdmEntityInfo> alreadyVisitedEntities,
+ CdmEntityInfo cei) {
+ if(map == null || map.isEmpty()) {
+ return;
+ }
+
+ int originalMapSize = map.size();
+
+ Iterator<Map.Entry<T,T>> iter = map.entrySet().iterator();
+ int i=0;
+ while ( iter.hasNext() ) {
+ Map.Entry<T,T> e = iter.next();
+ CdmEntityInfo childCei = new CdmEntityInfo(e);
+ cei.addChild(childCei);
+ debugRecursive(e.getKey(), alreadyVisitedEntities, childCei);
+ debugRecursive(e.getValue(), alreadyVisitedEntities, childCei);
+ }
+ }
+
+ private <T extends Object> void debug(Collection<T> collection,
+ List<CdmEntityInfo> alreadyVisitedEntities,
+ CdmEntityInfo cei) {
+ int length = collection.size();
+ Object[] result = new Object[length];
+ Iterator<T> collectionItr = collection.iterator();
+
+ while(collectionItr.hasNext()) {
+ Object obj = collectionItr.next();
+ CdmEntityInfo childCei = new CdmEntityInfo(obj);
+ cei.addChild(childCei);
+ debugRecursive(obj, alreadyVisitedEntities, childCei);
+
+ }
+
+ }
+
+ private void debugRecursive(CdmBase cdmEntity,
+ List<CdmEntityInfo> alreadyVisitedEntities,
+ CdmEntityInfo cei) {
+
+ CdmBase cachedCdmEntityInSubGraph = null;
+
+ if(cei.getObject() instanceof CdmBase) {
+ CdmBase cb = (CdmBase)cei.getObject();
+ cachedCdmEntityInSubGraph = cacher.getFromCache(cb);
+ if(cachedCdmEntityInSubGraph != cb) {
+ // found a cdm entity which is not in cache - need to record this
+ //logger.info(" - found entity not in cache " + fieldName + "' in object of type " + clazz.getName() + " with id " + cdmEntity.getId());
+ addEntityNotInCache(cei);
+ }
+ }
+
+
+ // we want to recursive through the cdmEntity (and not the cachedCdmEntity)
+ // since there could be new or deleted objects in the cdmEntity sub-graph
+
+ // start by getting the fields from the cdm entity
+ String className = cdmEntity.getClass().getName();
+ CdmModelFieldPropertyFromClass cmgmfc = cacher.getFromCdmlibModelCache(className);
+ if(cmgmfc != null) {
+ alreadyVisitedEntities.add(cei);
+ List<String> fields = cmgmfc.getFields();
+ for(String field : fields) {
+ // retrieve the actual object corresponding to the field.
+ // this object will be either a CdmBase or a Collection / Map
+ // with CdmBase as the generic type
+ String f = field;
+ CdmEntityInfo childCei = getDebugCdmBaseTypeFieldValue(cdmEntity, field, alreadyVisitedEntities, cei);
+ if(!childCei.isProxy()) {
+ Object object = childCei.getObject();
+ if(object != null && object instanceof CdmBase) {
+ CdmBase cdmEntityInSubGraph = (CdmBase)object;
+ if(!containsIdenticalCdmEntity(alreadyVisitedEntities, cdmEntityInSubGraph)) {
+ logger.info("recursive debugging object of type " + cdmEntityInSubGraph.getClass().getName() + " with id " + cdmEntityInSubGraph.getId());
+ debugRecursive(cdmEntityInSubGraph, alreadyVisitedEntities, childCei);
+ } else {
+ logger.info("object of type " + cdmEntityInSubGraph.getClass().getName() + " with id " + cdmEntityInSubGraph.getId() + " already visited");
+ }
+ }
+ }
+ }
+ } else {
+ throw new CdmClientCacheException("CdmEntity with class " + cdmEntity.getClass().getName() + " is not found in the cdmlib model cache. " +
+ "The cache may be corrupted or not in sync with the latest model version" );
+ }
+
+ }
+
+
+ private CdmEntityInfo getDebugCdmBaseTypeFieldValue(CdmBase cdmEntity,
+ String fieldName,
+ List<CdmEntityInfo> alreadyVisitedEntities,
+ CdmEntityInfo cei) {
+
+ CdmEntityInfo childCei = null;
+ Class<?> clazz = cdmEntity.getClass();
+ try {
+ // this call will search in the provided class as well as
+ // the super classes until it finds the field
+ Field field = ReflectionUtils.findField(clazz, fieldName);
+
+ if(field == null) {
+ throw new CdmClientCacheException("Field '" + fieldName
+ + "' not found when searching in class '" + clazz.getName() + "' and its supercalsses");
+ }
+ field.setAccessible(true);
+ Object o = field.get(cdmEntity);
+
+ CdmBase cdmEntityInSubGraph = null;
+
+ boolean isHibernateProxy = false;
+ boolean isPersistentCollection = false;
+
+ childCei = new CdmEntityInfo(o);
+ cei.addChild(childCei);
+ childCei.setField(field);
+
+ if(o != null) {
+
+ if(o instanceof HibernateProxy) {
+ isHibernateProxy = true;
+ }
+
+ if(o instanceof PersistentCollection) {
+ isPersistentCollection = true;
+ }
+ childCei.setObject(o);
+ childCei.setProxy(isHibernateProxy || isPersistentCollection);
+ if(!isHibernateProxy && !isPersistentCollection) {
+
+ if(CdmBase.class.isAssignableFrom(o.getClass())) {
+ logger.info("found initialised cdm entity '" + fieldName + "' in object of type " + clazz.getName() + " with id " + cdmEntity.getId());
+ cdmEntityInSubGraph = (CdmBase)o;
+
+ //logger.info(" - found duplicate entity at " + fieldName + "' in object of type " + clazz.getName() + " with id " + cdmEntity.getId());
+ CdmEntityInfo dupCei = getDuplicate(alreadyVisitedEntities, cdmEntityInSubGraph);
+ if(dupCei != null) {
+ addDuplicateEntity(childCei, dupCei);
+ }
+
+ } else if(o instanceof Map) {
+ debugRecursive((Map)o, alreadyVisitedEntities, childCei);
+ } else if(o instanceof Collection) {
+ debugRecursive((Collection)o, alreadyVisitedEntities, childCei);
+ }
+
+ }
+ }
+ // we return the original cdm entity in the sub graph because we
+ // want to continue to recurse on the input cdm entity graph
+ // and not the one in the cache
+
+ return childCei;
+ } catch (SecurityException e) {
+ throw new CdmClientCacheException(e);
+ } catch (IllegalArgumentException e) {
+ throw new CdmClientCacheException(e);
+ } catch (IllegalAccessException e) {
+ throw new CdmClientCacheException(e);
+ }
+ }
+
+
+ private CdmEntityInfo getDuplicate(List<CdmEntityInfo> alreadyVisitedEntities, Object objectToCompare) {
+ if(objectToCompare != null ) {
+ for(CdmEntityInfo cei: alreadyVisitedEntities) {
+ if(objectToCompare.equals(cei.getObject()) && objectToCompare != cei.getObject()) {
+ return cei;
+ }
+ }
+ }
+ return null;
+ }
+
+ private boolean containsIdenticalCdmEntity(List<CdmEntityInfo> ceiSet, Object objectToCompare) {
+ boolean foundIdentical = false;
+ if(objectToCompare != null) {
+ for(CdmEntityInfo cei : ceiSet) {
+ if(cei.getObject() == objectToCompare) {
+ foundIdentical = true;
+ } else if(objectToCompare.equals(cei.getObject())) {
+ return false;
+ }
+ }
+ }
+ return foundIdentical;
+ }
+
+ public class CdmEntityInfo {
+
+ private Object object;
+ private CdmEntityInfo parent;
+ private List<CdmEntityInfo> children;
+ private Field field;
+ private String label;
+ private boolean isProxy;
+
+ public CdmEntityInfo(Object object) {
+ this.object = object;
+ isProxy = false;
+ children = new ArrayList<CdmEntityInfo>();
+ }
+
+ public CdmEntityInfo getParent() {
+ return parent;
+ }
+
+ public void setParent(CdmEntityInfo parent) {
+ this.parent = parent;
+ }
+
+ public List<CdmEntityInfo> getChildren() {
+ return children;
+ }
+
+ public void setChildren(List<CdmEntityInfo> children) {
+ this.children = children;
+ }
+
+ public void addChild(CdmEntityInfo cei) {
+ this.children.add(cei);
+ cei.setParent(this);
+ }
+
+ public Field getField() {
+ return field;
+ }
+
+ public void setField(Field field) {
+ this.field = field;
+ }
+
+
+ public String getLabel() {
+ String label;
+ String fieldName = "";
+ if(field != null) {
+ fieldName = field.getName();
+ }
+
+ if(object != null) {
+ String className = object.getClass().getName();
+ if(object instanceof HibernateProxy) {
+ LazyInitializer hli = ((HibernateProxy)object).getHibernateLazyInitializer();
+ if(hli.isUninitialized()) {
+ className = "HibernateProxy";
+ } else {
+ className = "InitialisedHibernateProxy";
+ }
+ label = "[" + className + "] " + fieldName;
+ } else if(object instanceof PersistentCollection) {
+ PersistentCollection pc = ((PersistentCollection)object);
+ if(!pc.wasInitialized()) {
+ className = "PersistentCollection";
+ } else {
+ className = "InitialisedPersistentCollection";
+ }
+ label = "[" + className + "] " + fieldName;
+ } else if(object instanceof Collection) {
+ label = "[" + className + "] " + fieldName + " : " + String.valueOf(((Collection)object).size());
+ } else if(object instanceof Map) {
+
+ label = "[" + className + "] " + fieldName + " : " + String.valueOf(((Map)object).size());
+ } else if(object instanceof CdmBase) {
+ label = getCachesContainingEntity((CdmBase)object) + "[" + className + ",id" + ((CdmBase)object).getId() + "] " + fieldName + " : " + object.toString();
+ } else {
+ label = "[" + className + "] " + fieldName + " : " + object.toString();
+ }
+ } else {
+ label = "[NULL] " + fieldName;
+ }
+ return label;
+ }
+
+ public void setLabel(String label) {
+ this.label = label;
+ }
+
+ public Object getObject() {
+ return object;
+ }
+
+ public void setObject(Object object) {
+ this.object = object;
+ }
+
+ public boolean isProxy() {
+ return isProxy;
+ }
+
+ public void setProxy(boolean isProxy) {
+ this.isProxy = isProxy;
+ }
+
+
+
+ }
+
+}
--- /dev/null
+// $Id$
+/**
+* Copyright (C) 2015 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.remoting.cache;
+
+import java.lang.reflect.Field;
+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.hibernate.proxy.HibernateProxy;
+import org.hibernate.proxy.LazyInitializer;
+import org.springframework.util.ReflectionUtils;
+
+import eu.etaxonomy.cdm.model.common.PersistentMultiLanguageText;
+import eu.etaxonomy.taxeditor.remoting.CdmRemotingException;
+
+/**
+ * @author cmathew
+ * @date 17 Feb 2015
+ *
+ */
+public class ProxyUtils {
+
+
+
+ public static enum CollectionType {
+ SET,
+ LIST,
+ MAP;
+
+ @Override
+ public String toString() {
+ return this.name().toLowerCase();
+ }
+ }
+
+ public static Object getCollectionType(Object obj) {
+ if(obj != null) {
+ if(obj instanceof List) {
+ return CollectionType.LIST;
+ }
+ if(obj instanceof Set) {
+ return CollectionType.SET;
+ }
+ if(obj instanceof Map) {
+ return CollectionType.MAP;
+ }
+ throw new CdmRemotingException("Cannot get Collection Type for " + obj.getClass().getName());
+ }
+ return null;
+ }
+
+ public static Object getObject(PersistentCollection pc) {
+ if(pc != null) {
+ if(pc instanceof PersistentSet) {
+ return new HashSet((Set)pc);
+ }
+ if(pc instanceof PersistentSortedSet) {
+ return new TreeSet((Set)pc);
+ }
+ if(pc instanceof PersistentList) {
+ return new ArrayList((List)pc);
+ }
+ if(pc instanceof PersistentMap || pc instanceof PersistentMultiLanguageText) {
+ return new HashMap((Map)pc);
+ }
+ if(pc instanceof PersistentSortedMap) {
+ return new TreeMap((Map)pc);
+ }
+ throw new CdmRemotingException("Cannot get Collection field for type " + pc.getClass().getName());
+ }
+ return null;
+ }
+
+ public static 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);
+ }
+ throw new CdmRemotingException("Cannot get Collection field for type " + pc.getClass().getName());
+ }
+ return null;
+ }
+
+ public static 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;
+ }
+ }
+
+
+ public static Object deproxy(Object o) {
+ if(o != null && o instanceof HibernateProxy) {
+ LazyInitializer hli = ((HibernateProxy)o).getHibernateLazyInitializer();
+ if(!hli.isUninitialized()) {
+ return hli.getImplementation();
+
+ }
+ }
+
+ if(o != null && o instanceof PersistentCollection) {
+ PersistentCollection pc = ((PersistentCollection)o);
+ if(pc.wasInitialized()) {
+ return ProxyUtils.getObject(pc);
+
+ }
+ }
+ return o;
+ }
+
+ public static boolean isProxy(Object o) {
+ if(o != null && o instanceof HibernateProxy) {
+ LazyInitializer hli = ((HibernateProxy)o).getHibernateLazyInitializer();
+ if(hli.isUninitialized()) {
+ return true;
+ }
+ }
+
+ if(o != null && o instanceof PersistentCollection) {
+ PersistentCollection pc = ((PersistentCollection)o);
+ if(!pc.wasInitialized()) {
+ return true;
+ }
+ }
+
+ return false;
+ }
+
+ public static void setRoleValueInOwner(Object owner, String role, Object value) {
+ if(role == null || role.isEmpty()) {
+ throw new CdmRemotingException("Role cannot be null or an empty string");
+ }
+
+ String fieldName = role.substring(role.lastIndexOf(".") + 1);
+
+ Field field = ReflectionUtils.findField(owner.getClass(), fieldName);
+
+ if(field == null) {
+ throw new CdmRemotingException("Field '" + fieldName
+ + "' not found when searching in class '" + owner.getClass() + "' and its supercalsses");
+ }
+
+ field.setAccessible(true);
+
+ try {
+ field.set(owner, value);
+ } catch (IllegalArgumentException e) {
+ throw new CdmRemotingException(e);
+ } catch (IllegalAccessException e) {
+ throw new CdmRemotingException(e);
+ }
+ }
+
+}
--- /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.remoting.server;
+
+/**
+ * @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);
+ }
+
+}
/**
* Copyright (C) 2014 EDIT
-* European Distributed Institute of Taxonomy
+* 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;
+package eu.etaxonomy.taxeditor.remoting.source;
import static eu.etaxonomy.cdm.common.XmlHelp.getBeansRoot;
import static eu.etaxonomy.cdm.common.XmlHelp.insertXmlBean;
import eu.etaxonomy.cdm.common.XmlHelp;
import eu.etaxonomy.cdm.config.CdmPersistentSourceUtils;
import eu.etaxonomy.cdm.config.CdmPersistentXMLSource;
-import eu.etaxonomy.cdm.config.CdmSourceException;
-import eu.etaxonomy.cdm.config.ICdmPersistentSource;
import eu.etaxonomy.cdm.config.CdmPersistentXMLSource.CdmSourceProperties;
-import eu.etaxonomy.cdm.database.CdmDataSource;
-import eu.etaxonomy.cdm.database.CdmPersistentDataSource;
-import eu.etaxonomy.cdm.database.DataSourceNotFoundException;
-import eu.etaxonomy.cdm.database.DatabaseTypeEnum;
-import eu.etaxonomy.cdm.database.ICdmDataSource;
-import eu.etaxonomy.cdm.database.types.IDatabaseType;
+import eu.etaxonomy.cdm.config.ICdmPersistentSource;
import eu.etaxonomy.cdm.model.name.NomenclaturalCode;
/**
*/
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
+ * @throws CdmRemoteSourceException
*/
public static CdmPersistentRemoteSource NewInstance(String remoteSource) throws CdmRemoteSourceException {
if(exists(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
+ * @throws CdmRemoteSourceException
*/
- private CdmPersistentRemoteSource(String remoteSource) 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
+ // 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");
+ 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");
- }
+ 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");
- }
+ 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())) {
+ if(!cdmSourceProperties.containsKey(CdmSourceProperties.NOMENCLATURAL_CODE.toString())) {
cdmSourceProperties.put(CdmSourceProperties.NOMENCLATURAL_CODE.toString(), NomenclaturalCode.ICNAFP.name());
- }
+ }
}
/* (non-Javadoc)
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()));
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());
checkProperties(cdmSourceProperties);
return save(strRemoteSourceName, cdmSourceProperties);
}
-
+
private static CdmPersistentRemoteSource save(String strRemoteSourceName,Properties cdmSourceProperties) throws CdmRemoteSourceException {
//root
}
//save
- saveToXml(root.getDocument(),
- CdmPersistentSourceUtils.getResourceDirectory(),
- CdmPersistentXMLSource.CDMSOURCE_FILE_NAME,
+ saveToXml(root.getDocument(),
+ CdmPersistentSourceUtils.getResourceDirectory(),
+ CdmPersistentXMLSource.CDMSOURCE_FILE_NAME,
XmlHelp.prettyFormat );
return NewInstance(strRemoteSourceName) ;
}
-
+
/**
* @param strDataSourceName
* @param dataSource
- * @param code
+ * @param code
* @return
* the updated dataSource, null if not succesful
*/
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.
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
+ * @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)){
}
return remoteSources;
}
-
+
@Override
public String toString(){
if (getName() != null){
* 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;
+package eu.etaxonomy.taxeditor.remoting.source;
import eu.etaxonomy.cdm.model.name.NomenclaturalCode;
/**
* Copyright (C) 2014 EDIT
-* European Distributed Institute of Taxonomy
+* 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;
+package eu.etaxonomy.taxeditor.remoting.source;
import java.util.Map;
import org.springframework.remoting.httpinvoker.HttpInvokerProxyFactoryBean;
-import eu.etaxonomy.cdm.api.service.IDatabaseService;
+import eu.etaxonomy.cdm.api.service.IUserService;
import eu.etaxonomy.cdm.config.CdmSource;
import eu.etaxonomy.cdm.config.CdmSourceException;
-import eu.etaxonomy.cdm.database.DatabaseTypeEnum;
import eu.etaxonomy.cdm.model.metadata.CdmMetaData.MetaDataPropertyName;
import eu.etaxonomy.cdm.model.name.NomenclaturalCode;
/**
- * Base class representing a CDM remote source.
+ * Base class representing a CDM remote source.
* This class handles all the configuration relating to the remoting aspect of
* a CDM source.
*
protected static final NomenclaturalCode DEFAULT_NOMENCLATURAL_CODE = NomenclaturalCode.ICNAFP;
private String contextPath;
private String baseUrl;
-
- private IDatabaseService databaseService;
-
+
+ private IUserService userService;
+
/**
* Constructs a CdmRemoteSourceBase object with default values.
- *
+ *
*/
protected CdmRemoteSourceBase() {
setName(DEFAULT_NAME);
setContextPath(DEFAULT_CONTEXT_PATH);
setNomenclaturalCode(DEFAULT_NOMENCLATURAL_CODE);
}
-
+
/**
* Constructs a CdmRemoteSourceBase
- *
+ *
* @param name
* @param server
* @param port
* @param contextPath
* @param nomenclaturalCode
*/
- protected CdmRemoteSourceBase(String name, String server, int port, String contextPath, NomenclaturalCode nomenclaturalCode) {
+ public CdmRemoteSourceBase(String name, String server, int port, String contextPath, NomenclaturalCode nomenclaturalCode) {
setName(name);
setServer(server);
setPort(port);
setContextPath(contextPath);
- setNomenclaturalCode(nomenclaturalCode);
+ 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
+ // 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.setServiceInterface(IUserService.class);
+ // FIXME:Remoting need to fix this hardcoded url and make it configurable somehow
+ proxy.setServiceUrl(baseUrl + "/remoting-public/user.service");
proxy.afterPropertiesSet();
- databaseService = (IDatabaseService) proxy.getObject();
+ userService = (IUserService) proxy.getObject();
}
-
+
/* (non-Javadoc)
* @see eu.etaxonomy.cdm.remote.ICdmRemoteSource#getBaseUrl()
*/
}
/**
- * Sets the base url for the http-invoker services as listed in
+ * 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
+ * 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) {
/**
* Sets the context path.
- * e.g. for 'http://127.0.0.1:8080/col/remoting/common.service', the
+ * 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) {
*/
@Override
public String getDbSchemaVersion() throws CdmSourceException {
- return databaseService.getDbSchemaVersion();
+ return userService.getDbSchemaVersion();
}
*/
@Override
public boolean isDbEmpty() throws CdmSourceException {
- return databaseService.isDbEmpty();
+ return userService.isDbEmpty();
}
*/
@Override
public boolean checkConnection() throws CdmSourceException {
- // assuming that database service works implies
+ // assuming that database service works implies
// the connection is up
- // if no exception is thrown then we assume that the
+ // if no exception is thrown then we assume that the
// connection is up
// FIXME:Remoting is this really correct?
- databaseService.getDbSchemaVersion();
+ userService.getDbSchemaVersion();
return true;
}
return "Conncting to Remote CDM Server " + getName();
}
-
+
@Override
public Map<MetaDataPropertyName, String> getMetaDataMap() throws CdmSourceException {
- return databaseService.getCdmMetadataMap();
+ return userService.getCdmMetadataMap();
}
/**
*
*/
-package eu.etaxonomy.cdm.remote;
+package eu.etaxonomy.taxeditor.remoting.source;
/**
*
--- /dev/null
+// $Id$
+/**
+ * Copyright (C) 2015 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.remoting.source;
+
+import java.io.IOException;
+import java.net.Socket;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.http.HttpEntity;
+import org.apache.http.HttpResponse;
+import org.apache.http.client.ClientProtocolException;
+import org.apache.http.client.HttpClient;
+import org.apache.http.client.ResponseHandler;
+import org.apache.http.client.methods.HttpGet;
+import org.apache.http.impl.client.DefaultHttpClient;
+import org.apache.http.util.EntityUtils;
+import org.apache.log4j.Logger;
+import org.json.JSONArray;
+import org.json.JSONException;
+import org.json.JSONObject;
+
+import eu.etaxonomy.cdm.config.CdmSourceException;
+import eu.etaxonomy.taxeditor.remoting.server.CDMServerException;
+
+/**
+ * @author cmathew
+ * @date 20 Jan 2015
+ *
+ */
+public class CdmServerInfo {
+ public static final Logger logger = Logger.getLogger(CdmServerInfo.class);
+
+ private final static String NAME_PRODUCTION = "edit-production";
+ private final static String SERVER_PRODUCTION = "dev.e-taxonomy.eu";
+
+ private final static String NAME_INTEGRATION = "edit-integration";
+ private final static String SERVER_INTEGRATION = "int.e-taxonomy.eu";
+
+ private final static String NAME_TEST = "edit-test";
+ private final static String SERVER_TEST = "test.e-taxonomy.eu";
+
+ private final static String SERVER_LOCALHOST = "localhost";
+ private final static String NAME_LOCALHOST = "localhost";
+ private final static String NAME_LOCALHOST_MGD = "localhost mgd.";
+
+ private final static String NAME_LOCALHOST_DEV = "localhost-dev";
+ private final static String NAME_INSTANCE_LOCALHOST_DEV = "local-dev";
+ private final static String SERVER_LOCALHOST_DEV = "localhost";
+ private final static int PORT_LOCALHOST_DEV = 8080;
+ private final static String BASEPATH_LOCALHOST_DEV = "";
+
+ private final String name;
+ private final String server;
+ private final int port;
+ private final List<CdmInstanceInfo> instances;
+
+
+ public CdmServerInfo(String name, String server, int port) {
+ this.name = name;
+ this.server = server;
+ this.port = port;
+ instances = new ArrayList<CdmInstanceInfo>();
+ }
+
+
+ public CdmInstanceInfo addInstance(String name, String basePath) {
+ CdmInstanceInfo cii = new CdmInstanceInfo(name, basePath);
+ instances.add(cii);
+ return cii;
+
+ }
+
+ public void refreshInstances() throws CDMServerException {
+ String url = "http://" + server + ":" + String.valueOf(port) + "/cdmserver/instances.jsp";
+
+ HttpClient client = new DefaultHttpClient();
+ HttpGet httpGet = new HttpGet(url);
+
+ logger.info("Executing request " + httpGet.getRequestLine());
+
+ // Create a custom response handler
+ ResponseHandler<String> responseHandler = new ResponseHandler<String>() {
+
+ @Override
+ public String handleResponse(
+ final HttpResponse response) throws ClientProtocolException, IOException {
+ int status = response.getStatusLine().getStatusCode();
+ if (status >= 200 && status < 300) {
+ HttpEntity entity = response.getEntity();
+ return entity != null ? EntityUtils.toString(entity) : null;
+ } else {
+ throw new ClientProtocolException("Unexpected response status: " + status);
+ }
+ }
+
+ };
+ String responseBody = null;
+ try {
+ responseBody = client.execute(httpGet, responseHandler);
+ } catch (ClientProtocolException e) {
+ throw new CDMServerException(e);
+ } catch (IOException e) {
+ throw new CDMServerException(e);
+ }
+
+
+ if(responseBody != null) {
+ try {
+ JSONArray array = new JSONArray(responseBody);
+ for(int i=0;i<array.length();i++) {
+ JSONObject instance = (JSONObject)array.get(i);
+ if(instance != null) {
+ JSONObject conf = (JSONObject)instance.get("configuration");
+ if(conf != null) {
+ String instanceName = conf.getString("instanceName");
+ // we need to remove the first (char) forward slash from
+ // the base path
+ String basePath = conf.getString("basePath").substring(1);
+ addInstance(instanceName, basePath);
+ logger.info("Added instance with name : " + instanceName + ", basePath : " + basePath);
+ }
+ }
+ }
+ } catch (JSONException e) {
+ throw new CDMServerException(e);
+ }
+ }
+
+ }
+
+ public CdmInstanceInfo getInstanceFromName(String instanceName) {
+ if(instanceName == null) {
+ return null;
+ }
+
+ for(CdmInstanceInfo instance : instances) {
+ if(instance.getName() != null && instance.getName().equals(instanceName)) {
+ return instance;
+ }
+ }
+ return null;
+ }
+
+ public ICdmRemoteSource getCdmRemoteSource(CdmInstanceInfo instance) {
+ if(instance != null) {
+ return CdmRemoteSource.NewInstance(name,
+ server,
+ port,
+ instance.getBasePath(),
+ null);
+ }
+ return null;
+ }
+
+ public boolean pingServer(){
+ try {
+ Socket s = new Socket(server, port);
+ logger.info("[CDM-Server] Available @ " + server + ":" + port );
+ return true;
+ } catch (IOException ioe) {
+
+ }
+ return false;
+ }
+
+ public boolean pingInstance(CdmInstanceInfo instance) throws CDMServerException {
+
+ ICdmRemoteSource crs = getCdmRemoteSource(instance);
+ try {
+ if(crs != null && crs.checkConnection()) {
+ logger.info("[CDM-Server] Running @ " + server + ":" + port + " for instance " + instance);
+ return true;
+ }
+ } catch (CdmSourceException e) {
+ throw new CDMServerException(e);
+ }
+
+ return false;
+ }
+
+ public static List<CdmServerInfo> getCdmServers() {
+ List<CdmServerInfo> cdmServerInfoList = new ArrayList<CdmServerInfo>();
+ cdmServerInfoList.add(new CdmServerInfo(NAME_PRODUCTION, SERVER_PRODUCTION, 80));
+ cdmServerInfoList.add(new CdmServerInfo(NAME_INTEGRATION, SERVER_INTEGRATION, 80));
+ cdmServerInfoList.add(new CdmServerInfo(NAME_TEST, SERVER_TEST, 80));
+ cdmServerInfoList.add(new CdmServerInfo(NAME_LOCALHOST, SERVER_LOCALHOST, 8080));
+ cdmServerInfoList.add(new CdmServerInfo(NAME_LOCALHOST_MGD, SERVER_LOCALHOST,8080));
+ return cdmServerInfoList;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public String getServer() {
+ return server;
+ }
+
+
+ public int getPort() {
+ return port;
+ }
+
+
+ public List<CdmInstanceInfo> getInstances() throws CDMServerException {
+ if(instances.isEmpty()) {
+ refreshInstances();
+ }
+ return instances;
+ }
+
+ public static ICdmRemoteSource getDevServerRemoteSource() {
+ String value=System.getProperty("cdm.server.dev.activate");
+ boolean available = false;
+ CdmInstanceInfo devInstance = null;
+ if(value != null && value.equals("true")) {
+ CdmServerInfo devCii = new CdmServerInfo(NAME_LOCALHOST_DEV, SERVER_LOCALHOST_DEV, PORT_LOCALHOST_DEV);
+ try {
+ devInstance = devCii.addInstance(NAME_INSTANCE_LOCALHOST_DEV, BASEPATH_LOCALHOST_DEV);
+ available = devCii.pingInstance(devInstance);
+ if(available) {
+ return devCii.getCdmRemoteSource(devInstance);
+ }
+ } catch (Exception e) {
+
+ }
+ }
+ return null;
+ }
+
+ public class CdmInstanceInfo {
+ private final String name;
+ private final String basePath;
+
+
+ public CdmInstanceInfo(String name, String basePath) {
+ this.name = name;
+ this.basePath = basePath;
+ }
+
+
+ public String getName() {
+ return name;
+ }
+
+ public String getBasePath() {
+ return basePath;
+ }
+ }
+}
* 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;
+package eu.etaxonomy.taxeditor.remoting.source;
import eu.etaxonomy.cdm.config.ICdmSource;
--- /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.service;
+
+import org.hibernate.collection.spi.PersistentCollection;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
+import eu.etaxonomy.cdm.api.service.ICommonService;
+import eu.etaxonomy.cdm.model.common.CdmBase;
+import eu.etaxonomy.taxeditor.remoting.cache.ProxyUtils.CollectionField;
+import eu.etaxonomy.taxeditor.session.ICdmEntitySessionManager;
+
+/**
+ * @author cmathew
+ * @date 14 Oct 2014
+ *
+ */
+@Component
+public class CachedCommonServiceImpl implements ICachedCommonService {
+
+
+ @Autowired
+ private ICommonService commonService;
+
+ private static boolean cacheEnabled = true;
+
+ @Autowired
+ private ICdmEntitySessionManager cdmEntitySessionManager;
+
+
+ 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 = CdmBase.deproxy(commonService.find(clazz, id),clazz);
+ if(cdmEntity == null) {
+ throw new NullPointerException("CDM Entity of type " + clazz.getName() + " with id " + id + " is null.");
+ }
+ return cdmEntitySessionManager.load(cdmEntity, false);
+ } else {
+ return CdmBase.deproxy(commonService.find(clazz, id),clazz);
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see eu.etaxonomy.taxeditor.remoting.service.ICachedCommonService#initializeCollection(org.hibernate.collection.spi.PersistentCollection)
+ */
+ @Override
+ public PersistentCollection initializeCollection(PersistentCollection col) {
+ return commonService.initializeCollection(col);
+ }
+
+ @Override
+ public void updatePersistentCollection(CollectionField colf) {
+ if(cacheEnabled) {
+ cdmEntitySessionManager.load(colf.getCollection(), false);
+ }
+ }
+
+ /* (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);
+ }
+
+
+
+
+
+}
--- /dev/null
+// $Id$
+/**
+ * Copyright (C) 2015 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.service;
+
+import java.io.IOException;
+
+import org.apache.commons.codec.binary.Base64;
+import org.apache.commons.httpclient.methods.PostMethod;
+import org.springframework.remoting.httpinvoker.CommonsHttpInvokerRequestExecutor;
+import org.springframework.remoting.httpinvoker.HttpInvokerClientConfiguration;
+import org.springframework.security.core.Authentication;
+import org.springframework.security.core.context.SecurityContextHolder;
+
+/**
+ * @author cmathew
+ * @date 27 Jan 2015
+ *
+ */
+public class CdmAuthenticatedHttpInvokerRequestExecutor extends CommonsHttpInvokerRequestExecutor {
+
+ @Override
+ protected PostMethod createPostMethod(HttpInvokerClientConfiguration config) throws IOException {
+ PostMethod postMethod = super.createPostMethod(config);
+
+ Authentication auth =
+ SecurityContextHolder.getContext().getAuthentication();
+
+ if ((auth != null) && (auth.getName() != null) &&
+ (auth.getCredentials() != null)) {
+ String base64 = auth.getName() + ":" + auth.getCredentials().toString();
+ postMethod.setRequestHeader("Authorization", "Basic " +
+ new String(Base64.encodeBase64(base64.getBytes())));
+ }
+
+ return postMethod;
+ }
+}
\ No newline at end of file
--- /dev/null
+package eu.etaxonomy.taxeditor.service;
+
+public class CdmServiceInterceptorException extends RuntimeException {
+
+ public CdmServiceInterceptorException(String message) {
+ super(message);
+ }
+
+ public CdmServiceInterceptorException(Exception ex) {
+ super(ex);
+ }
+
+}
--- /dev/null
+package eu.etaxonomy.taxeditor.service;
+
+import java.io.IOException;
+import java.io.OutputStream;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.remoting.httpinvoker.HttpInvokerClientConfiguration;
+import org.springframework.remoting.support.RemoteInvocation;
+import org.springframework.remoting.support.RemoteInvocationResult;
+import org.springframework.stereotype.Component;
+
+import eu.etaxonomy.cdm.api.service.UpdateResult;
+import eu.etaxonomy.taxeditor.session.ICdmEntitySessionManager;
+
+@Component
+public class CdmServiceRequestExecutor extends CdmAuthenticatedHttpInvokerRequestExecutor {
+
+ @Autowired
+ private ICdmEntitySessionManager cdmEntitySessionManager;
+
+ private RemoteInvocation currentRemoteInvocation;
+
+ @Override
+ protected void writeRemoteInvocation(RemoteInvocation invocation, OutputStream os) throws IOException {
+ currentRemoteInvocation = invocation;
+ super.writeRemoteInvocation(invocation, os);
+ }
+
+ @Override
+ protected RemoteInvocationResult doExecuteRequest(HttpInvokerClientConfiguration config,
+ java.io.ByteArrayOutputStream baos)
+ throws java.io.IOException,
+ java.lang.ClassNotFoundException {
+ RemoteInvocationResult rir = fromCache(currentRemoteInvocation);
+
+ // if rir is not null at this point we assume that the
+ // the object has already been loaded in the cache and
+ // does not need to be reloaded
+
+ if(rir == null) {
+ rir = super.doExecuteRequest(config, baos);
+ if(rir.getValue() != null && !rir.hasException()) {
+ if(currentRemoteInvocation.getMethodName().equals("merge")) {
+ rir = new RemoteInvocationResult(cdmEntitySessionManager.load(rir.getValue(), true));
+ } else if(rir.getValue() instanceof UpdateResult){
+ UpdateResult result = (UpdateResult)rir.getValue();
+ if(result.isOk()){
+ cdmEntitySessionManager.update(result.getCdmEntity(), result.getUpdatedObjects());
+ }
+ } else {
+ rir = new RemoteInvocationResult(cdmEntitySessionManager.load(rir.getValue(), false));
+ }
+ }
+ cache(currentRemoteInvocation, rir);
+ }
+ currentRemoteInvocation = null;
+
+ return rir;
+ }
+
+ public void cache(RemoteInvocation ri, RemoteInvocationResult rir) {
+
+ }
+
+ public RemoteInvocationResult fromCache(RemoteInvocation ri) {
+ 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.service;
+
+import org.hibernate.collection.spi.PersistentCollection;
+
+import eu.etaxonomy.cdm.model.common.CdmBase;
+import eu.etaxonomy.taxeditor.remoting.cache.ProxyUtils.CollectionField;
+
+/**
+ * @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);
+
+
+
+
+}
\ No newline at end of file
--- /dev/null
+package eu.etaxonomy.taxeditor.service;
+
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import org.apache.log4j.Logger;
+import org.springframework.remoting.support.RemoteInvocation;
+import org.springframework.remoting.support.RemoteInvocationResult;
+
+import eu.etaxonomy.cdm.api.cache.CdmServiceCacher;
+import eu.etaxonomy.cdm.model.common.DefinedTermBase;
+import eu.etaxonomy.cdm.model.common.TermType;
+
+
+public class TermServiceRequestExecutor extends CdmServiceRequestExecutor {
+ private static final Logger logger = Logger.getLogger(TermServiceRequestExecutor.class);
+
+ private static Map<TermType, RemoteInvocationResult> termTypeMap = new
+ HashMap<TermType, RemoteInvocationResult>();
+
+ private static CdmServiceCacher cdmServiceCacher;
+
+ public static void setDefaultCacher(CdmServiceCacher css) {
+ cdmServiceCacher = css;
+ }
+
+ @Override
+ public void cache(RemoteInvocation ri, RemoteInvocationResult rir) {
+ if(cdmServiceCacher != null) {
+ if(ri.getMethodName().equals("listByTermType")) {
+ if(ri.getArguments()[1] == null) {
+ Set<DefinedTermBase> terms = new HashSet<DefinedTermBase>();
+ if(rir.getValue() != null) {
+ terms.addAll((List<DefinedTermBase>)rir.getValue());
+
+ for(DefinedTermBase<?> term : terms) {
+ cdmServiceCacher.put(term.getUuid(), term);
+ }
+ termTypeMap.put((TermType)ri.getArguments()[0], rir);
+ }
+
+ }
+ }
+ } else {
+ logger.info("Default CdmServiceCacher is null. Cannot cache terms");
+ }
+ }
+
+
+ @Override
+ public RemoteInvocationResult fromCache(RemoteInvocation ri) {
+ return termTypeMap.get(ri.getArguments()[0]);
+ }
+
+
+
+}
--- /dev/null
+package eu.etaxonomy.taxeditor.session;
+
+public class CdmClientSessionException extends RuntimeException {
+
+ public CdmClientSessionException(String message) {
+ super(message);
+ }
+}
--- /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.session;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+import java.util.UUID;
+
+import net.sf.ehcache.statistics.LiveCacheStatistics;
+
+import org.apache.log4j.Logger;
+
+import eu.etaxonomy.cdm.api.service.IService;
+import eu.etaxonomy.cdm.model.common.CdmBase;
+import eu.etaxonomy.cdm.model.common.ICdmBase;
+import eu.etaxonomy.cdm.persistence.hibernate.CdmDataChangeEvent;
+import eu.etaxonomy.cdm.persistence.hibernate.CdmDataChangeEvent.EventType;
+import eu.etaxonomy.cdm.persistence.hibernate.CdmPostDataChangeObservableListener;
+import eu.etaxonomy.taxeditor.remoting.cache.CdmTransientEntityCacher;
+import eu.etaxonomy.taxeditor.remoting.cache.EntityCacherDebugResult;
+
+
+/**
+ *
+ * NOTE : It would be nice to have this class performing merge / delete operations
+ * using services, but this is only possible if we can 'intelligently'
+ * get from a model class to the correspoding service class
+ * @author cmathew
+ * @date 20 Oct 2014
+ *
+ */
+
+public class CdmEntitySession implements ICdmEntitySession {
+
+ private static final Logger logger = Logger.getLogger(CdmEntitySession.class);
+
+ private final CdmEntitySessionManager cdmEntitySessionManager;
+
+ private final ICdmEntitySessionEnabled sessionOwner;
+
+ private final CdmTransientEntityCacher cdmTransientEntityCacher;
+
+ private final List<ICdmEntitySessionEnabled> changeObservers;
+
+ private final Set<CdmBase> newCdmEntities;
+
+
+
+ public CdmEntitySession(ICdmEntitySessionEnabled sessionOwner, CdmEntitySessionManager cdmEntitySessionManager) {
+ this.sessionOwner = sessionOwner;
+ this.cdmTransientEntityCacher = new CdmTransientEntityCacher(sessionOwner, cdmEntitySessionManager);
+ this.cdmEntitySessionManager = cdmEntitySessionManager;
+ this.changeObservers = new ArrayList<ICdmEntitySessionEnabled>();
+ this.newCdmEntities = new HashSet<CdmBase>();
+ cdmEntitySessionManager.addToOwnerSessionMap(sessionOwner, this);
+ }
+
+
+
+ /* (non-Javadoc)
+ * @see eu.etaxonomy.taxeditor.session.ICdmEntitySession#load(java.lang.Object, boolean)
+ */
+ @Override
+ public <O extends Object> O load(O obj, boolean update) {
+ return cdmTransientEntityCacher.load(obj, update);
+ }
+
+
+ /* (non-Javadoc)
+ * @see eu.etaxonomy.taxeditor.session.ICdmEntitySession#load(eu.etaxonomy.cdm.model.common.CdmBase, boolean)
+ */
+ @Override
+ public <T extends CdmBase> T load(T cdmBase, boolean update) {
+ return (T)cdmTransientEntityCacher.load(cdmBase, update);
+ }
+
+ @Override
+ public <T extends CdmBase> void update() {
+ List<T> rootEntities = getRootEntities();
+ if(rootEntities != null) {
+ for(T rootEntity : rootEntities) {
+ load(rootEntity, true);
+ }
+ }
+ }
+
+ @Override
+ public <T extends ICdmBase> void update(T cdmBase, Set<CdmBase> affectedObjects) {
+ addEvent(cdmBase, affectedObjects, EventType.UPDATE);
+ }
+
+ @Override
+ public <T extends ICdmBase> void update(T cdmBase, CdmBase affectedObject) {
+ Set<CdmBase> set = new HashSet<CdmBase>();
+ set.add(affectedObject);
+ addEvent(cdmBase, set, EventType.UPDATE);
+ }
+
+
+ @Override
+ public <T extends ICdmBase> void delete(T cdmBase, Set<CdmBase> affectedObjects) {
+ addEvent(cdmBase, affectedObjects, EventType.DELETE);
+ }
+
+ @Override
+ public <T extends ICdmBase> void delete(Set<T> cdmBases, Set<CdmBase> affectedObjects) {
+ addEvent(cdmBases, affectedObjects, EventType.DELETE);
+ }
+
+
+
+ /* (non-Javadoc)
+ * @see eu.etaxonomy.taxeditor.session.ICdmEntitySession#debug(eu.etaxonomy.cdm.model.common.CdmBase)
+ */
+ @Override
+ public <T extends CdmBase> EntityCacherDebugResult debug(T cdmBase) {
+ return debug(Arrays.asList(cdmBase));
+ }
+
+
+
+ /* (non-Javadoc)
+ * @see eu.etaxonomy.taxeditor.session.ICdmEntitySession#debug(java.util.List)
+ */
+ @Override
+ public <T extends CdmBase> EntityCacherDebugResult debug(List<T> cdmBases) {
+ EntityCacherDebugResult entityCacherDebugResult =
+ new EntityCacherDebugResult(cdmTransientEntityCacher, cdmBases);
+ return entityCacherDebugResult;
+ }
+
+
+ /* (non-Javadoc)
+ * @see eu.etaxonomy.taxeditor.session.ICdmEntitySession#debug()
+ */
+ @Override
+ public <T extends CdmBase> EntityCacherDebugResult debug() {
+ return debug(getRootEntities());
+ }
+
+ /* (non-Javadoc)
+ * @see eu.etaxonomy.taxeditor.session.ICdmEntitySession#load(java.util.Collection)
+ */
+ @Override
+ public <T extends CdmBase> Collection<T> load(Collection<T> cdmBaseList, boolean update) {
+ return cdmTransientEntityCacher.load(cdmBaseList, update);
+ }
+
+ /* (non-Javadoc)
+ * @see eu.etaxonomy.taxeditor.session.ICdmEntitySession#setEntitiesAsLatest()
+ */
+ @Override
+ public void setEntitiesAsLatest() {
+ //FIXME:Remoting need to think more about whether we really need this
+ // List<CdmBase> entities = cdmTransientEntityCacher.getAllEntities();
+ // for(CdmBase entity : entities) {
+ // cdmEntitySessionManager.setEntityAsLatest(entity);
+ // }
+ }
+
+ /**
+ * Register to get updated after any interaction with the datastore
+ */
+ @Override
+ public void registerForDataStoreChanges(ICdmEntitySessionEnabled observer) {
+ CdmPostDataChangeObservableListener.getDefault().register(observer);
+ }
+
+ /**
+ * Register to get updated after any interaction with the datastore
+ */
+ @Override
+ public void unregisterForDataStoreChanges(ICdmEntitySessionEnabled observer) {
+ CdmPostDataChangeObservableListener.getDefault().unregister(observer);
+ }
+
+
+
+ @Override
+ public void bind() {
+ logger.info("Binding session with owner " + sessionOwner.toString());
+ cdmEntitySessionManager.bind(sessionOwner);
+
+ }
+
+ /* (non-Javadoc)
+ * @see eu.etaxonomy.taxeditor.session.ICdmEntitySession#dispose()
+ */
+ @Override
+ public void dispose() {
+
+ cdmTransientEntityCacher.dispose();
+ for(ICdmEntitySessionEnabled observer : changeObservers) {
+ CdmPostDataChangeObservableListener.getDefault().unregister(observer);
+ }
+ changeObservers.clear();
+ cdmEntitySessionManager.remove(sessionOwner);
+ }
+
+
+ /* (non-Javadoc)
+ * @see eu.etaxonomy.taxeditor.session.ICdmEntitySession#commit()
+ */
+ @Override
+ public void addEvent(ICdmBase cdmBase, Set<CdmBase> affectedObjects, EventType eventType) {
+ affectedObjects = (Set<CdmBase>) load(affectedObjects, true);
+ CdmDataChangeEvent cdce = CdmDataChangeEvent.NewInstance((CdmBase)cdmBase, affectedObjects, eventType);
+ CdmPostDataChangeObservableListener.getDefault().notifyObservers(cdce);
+ }
+
+
+ /* (non-Javadoc)
+ * @see eu.etaxonomy.taxeditor.session.ICdmEntitySession#notify(java.util.Collection, eu.etaxonomy.cdm.persistence.hibernate.CdmDataChangeEvent.EventType)
+ */
+ @Override
+ public <T extends ICdmBase> void addEvent(Collection <T> cdmBases, Set<CdmBase> affectedObjects, EventType eventType) {
+ affectedObjects = (Set<CdmBase>) load(affectedObjects, true);
+ for(ICdmBase cdmBase : cdmBases) {
+ CdmDataChangeEvent cdce = CdmDataChangeEvent.NewInstance((CdmBase)cdmBase, affectedObjects, eventType);
+ CdmPostDataChangeObservableListener.getDefault().notifyObservers(cdce);
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see eu.etaxonomy.taxeditor.session.ICdmEntitySession#commit()
+ */
+ @Override
+ public void fireNotifications() {
+ CdmPostDataChangeObservableListener.getDefault().delayedNotify();
+ }
+
+
+ /* (non-Javadoc)
+ * @see eu.etaxonomy.taxeditor.session.ICdmEntitySession#load(java.util.UUID, java.lang.Class)
+ */
+ @Override
+ public <T extends CdmBase> T remoteLoad(IService<T> service, UUID uuid) {
+ T cdmBase = service.load(uuid);
+ return load(cdmBase, false);
+ }
+
+
+ /* (non-Javadoc)
+ * @see eu.etaxonomy.taxeditor.session.ICdmEntitySession#load(eu.etaxonomy.cdm.api.service.IService, java.util.UUID, java.util.List)
+ */
+ @Override
+ public <T extends CdmBase> T remoteLoad(IService<T> service, UUID uuid, List<String> propertyPaths) {
+ T cdmBase = service.load(uuid, propertyPaths);
+ return load(cdmBase, false);
+ }
+
+
+ /* (non-Javadoc)
+ * @see eu.etaxonomy.taxeditor.session.ICdmEntitySession#save(eu.etaxonomy.cdm.api.service.IService, eu.etaxonomy.cdm.model.common.CdmBase)
+ */
+ @Override
+ public <T extends CdmBase> UUID remoteSave(IService<T> service, T cdmBase) {
+ UUID uuid = service.save(cdmBase);
+ load(cdmBase,false);
+ return uuid;
+ }
+
+
+ /* (non-Javadoc)
+ * @see eu.etaxonomy.taxeditor.session.ICdmEntitySession#update(eu.etaxonomy.cdm.api.service.IService, eu.etaxonomy.cdm.model.common.CdmBase)
+ */
+ @Override
+ public <T extends CdmBase> T remoteUpdate(IService<T> service, T cdmBase) {
+ T mergedCdmBase = service.merge(cdmBase);
+ return mergedCdmBase;
+ }
+
+
+ /* (non-Javadoc)
+ * @see eu.etaxonomy.taxeditor.session.ICdmEntitySession#isActive()
+ */
+ @Override
+ public boolean isActive() {
+ return cdmEntitySessionManager.getActiveSession() == this;
+ }
+
+
+ /* (non-Javadoc)
+ * @see eu.etaxonomy.taxeditor.session.ICdmEntitySession#getOwner()
+ */
+ @Override
+ public ICdmEntitySessionEnabled getOwner() {
+ return sessionOwner;
+ }
+
+
+ /* (non-Javadoc)
+ * @see eu.etaxonomy.taxeditor.session.ICdmEntitySession#getNoOfObjectsInCache()
+ */
+ @Override
+ public LiveCacheStatistics getCacheStatistics() {
+ return cdmTransientEntityCacher.getCacheStatistics();
+ }
+
+
+ /* (non-Javadoc)
+ * @see eu.etaxonomy.taxeditor.session.ICdmEntitySession#getRootEntities()
+ */
+ @Override
+ public <T extends CdmBase> List<T> getRootEntities() {
+ return sessionOwner.getRootEntities();
+ }
+
+ public CdmTransientEntityCacher getCacher() {
+ return cdmTransientEntityCacher;
+ }
+
+
+
+
+
+
+
+
+
+
+
+}
--- /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.session;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import org.apache.log4j.Logger;
+import org.springframework.stereotype.Component;
+
+import eu.etaxonomy.cdm.model.common.CdmBase;
+import eu.etaxonomy.cdm.persistence.hibernate.CdmDataChangeEvent.EventType;
+
+/**
+ * @author cmathew
+ * @date 16 Oct 2014
+ *
+ */
+@Component
+public class CdmEntitySessionManager implements ICdmEntitySessionManager {
+ private static final Logger logger = Logger.getLogger(CdmEntitySessionManager.class);
+
+ private final Map<ICdmEntitySessionEnabled, ICdmEntitySession> ownerSessionMap =
+ new HashMap<ICdmEntitySessionEnabled, ICdmEntitySession>();
+
+ private final List<ICdmEntitySessionManagerObserver> sessionObservers = new ArrayList<ICdmEntitySessionManagerObserver>();
+
+ private ICdmEntitySession activeSession;
+
+
+
+ @Override
+ public ICdmEntitySession newSession(ICdmEntitySessionEnabled sessionOwner, boolean setAsActive) {
+ ICdmEntitySession session = ownerSessionMap.get(sessionOwner);
+ if(session == null) {
+ session = new CdmEntitySession(sessionOwner, this);
+ addToOwnerSessionMap(sessionOwner, session);
+
+ }
+
+ if(setAsActive) {
+ setActiveSession(session);
+
+ }
+
+ return session;
+ }
+
+ @Override
+ public ICdmEntitySession getActiveSession() {
+ return activeSession;
+ }
+
+ private void setActiveSession(ICdmEntitySession activeSession) {
+ this.activeSession = activeSession;
+ notifyObservers();
+ }
+
+
+ /* (non-Javadoc)
+ * @see eu.etaxonomy.taxeditor.session.ICdmEntitySessionManager#getSessions()
+ */
+ @Override
+ public Collection<ICdmEntitySession> getSessions() {
+ return ownerSessionMap.values();
+ }
+
+
+ /* (non-Javadoc)
+ * @see eu.etaxonomy.taxeditor.session.ICdmEntitySessionManager#bind(eu.etaxonomy.taxeditor.session.ISessionEventListener)
+ */
+ @Override
+ public void bind(ICdmEntitySessionEnabled sessionOwner) {
+ if(sessionOwner == null) {
+ setActiveSession(null);
+ return;
+ }
+ ICdmEntitySession session = ownerSessionMap.get(sessionOwner);
+ if(session == null) {
+ session = newSession(sessionOwner,true);
+ }
+
+ setActiveSession(session);
+
+ }
+
+
+ /* (non-Javadoc)
+ * @see eu.etaxonomy.taxeditor.session.ICdmEntitySessionManager#load(T)
+ */
+ @Override
+ public <T extends Object> T load(T obj, boolean update) {
+ if(activeSession == null) {
+ return obj;
+ } else {
+ return activeSession.load(obj, update);
+ }
+ }
+
+ @Override
+ public <T extends CdmBase> void update(T cdmBase, Set<CdmBase> affectedObjects) {
+ if(activeSession != null) {
+ activeSession.addEvent(cdmBase, affectedObjects, EventType.UPDATE);
+ }
+ }
+
+ @Override
+ public <T extends CdmBase> void update() {
+ if(activeSession != null) {
+ activeSession.update();
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see eu.etaxonomy.taxeditor.session.ICdmEntitySessionManager#load(T)
+ */
+ @Override
+ public <T extends CdmBase> T load(T cdmBase, boolean update) {
+ if(activeSession == null) {
+ return cdmBase;
+ }
+ return activeSession.load(cdmBase, update);
+ }
+
+
+
+ /* (non-Javadoc)
+ * @see eu.etaxonomy.taxeditor.session.ICdmEntitySessionManager#load(java.util.Collection)
+ */
+ @Override
+ public <T extends CdmBase> Collection<T> load(Collection<T> cdmBaseList, boolean update) {
+ if(activeSession == null) {
+ return cdmBaseList;
+ }
+ return activeSession.load(cdmBaseList, update);
+ }
+
+
+ /* (non-Javadoc)
+ * @see eu.etaxonomy.taxeditor.session.ICdmEntitySessionManager#dispose(eu.etaxonomy.taxeditor.session.ISessionEventListener)
+ */
+ void remove(ICdmEntitySessionEnabled owner) {
+ ICdmEntitySession session = ownerSessionMap.get(owner);
+ if(session == null) {
+ logger.info("No Session connected to owner, nothing to do");
+ return;
+ }
+ if(session == activeSession) {
+ setActiveSession(null);
+ }
+ ownerSessionMap.remove(owner);
+
+ }
+
+ @Override
+ public void dispose(ICdmEntitySessionEnabled owner) {
+ ICdmEntitySession session = ownerSessionMap.get(owner);
+ if(session != null) {
+ session.dispose();
+ }
+ notifyObservers();
+ }
+
+ @Override
+ public void disposeAll() {
+ Set<ICdmEntitySessionEnabled> owners =
+ new HashSet<ICdmEntitySessionEnabled>(ownerSessionMap.keySet());
+ for(ICdmEntitySessionEnabled owner : owners) {
+ ICdmEntitySession session = ownerSessionMap.get(owner);
+ if(session != null) {
+ session.dispose();
+ }
+ }
+ notifyObservers();
+ }
+
+ void addToOwnerSessionMap(ICdmEntitySessionEnabled owner, ICdmEntitySession session) {
+ ownerSessionMap.put(owner, session);
+ }
+
+ /* (non-Javadoc)
+ * @see eu.etaxonomy.taxeditor.session.ICdmEntitySessionManager#addSessionListener()
+ */
+ @Override
+ public void addSessionObserver(ICdmEntitySessionManagerObserver sessionObserver) {
+ sessionObservers.add(sessionObserver);
+ }
+
+ public void notifyObservers() {
+ for(ICdmEntitySessionManagerObserver sessionObserver : sessionObservers) {
+ sessionObserver.changed();
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see eu.etaxonomy.taxeditor.session.ICdmEntitySessionManager#isRemoting()
+ */
+ @Override
+ public boolean isRemoting() {
+ // FIXME:Remoting stupid method to check whether we are in remoting
+ return true;
+ }
+
+
+}
+
--- /dev/null
+package eu.etaxonomy.taxeditor.session;
+
+import java.util.Collection;
+import java.util.List;
+import java.util.Set;
+import java.util.UUID;
+
+import net.sf.ehcache.statistics.LiveCacheStatistics;
+import eu.etaxonomy.cdm.api.service.IService;
+import eu.etaxonomy.cdm.model.common.CdmBase;
+import eu.etaxonomy.cdm.model.common.ICdmBase;
+import eu.etaxonomy.cdm.persistence.hibernate.CdmDataChangeEvent.EventType;
+import eu.etaxonomy.taxeditor.remoting.cache.EntityCacherDebugResult;
+
+public interface ICdmEntitySession {
+
+ public ICdmEntitySessionEnabled getOwner();
+
+ public LiveCacheStatistics getCacheStatistics();
+
+ public <O extends Object> O load(O obj, boolean update);
+
+ public <T extends CdmBase> T load(T cdmBase, boolean update);
+
+ public <T extends CdmBase> EntityCacherDebugResult debug(T cdmBase);
+
+ public <T extends CdmBase> EntityCacherDebugResult debug(List<T> cdmBase);
+
+ public <T extends CdmBase> EntityCacherDebugResult debug();
+
+ public <T extends CdmBase> Collection<T> load(Collection<T> cdmBaseList, boolean update);
+
+ public void setEntitiesAsLatest();
+
+ public <T extends CdmBase> List<T> getRootEntities();
+
+ public void dispose();
+
+ public void bind();
+
+ public void registerForDataStoreChanges(ICdmEntitySessionEnabled observer);
+
+ public void unregisterForDataStoreChanges(ICdmEntitySessionEnabled observer);
+
+ public void addEvent(ICdmBase cdmBase, Set<CdmBase> affectedObjects, EventType eventType);
+
+ public <T extends ICdmBase> void addEvent(Collection <T> cdmBases, Set<CdmBase> affectedObjects, EventType eventType);
+
+ public <T extends CdmBase> T remoteLoad(IService<T> service, UUID uuid);
+
+ public <T extends CdmBase> T remoteLoad(IService<T> service, UUID uuid, List<String> propertyPaths);
+
+ public <T extends CdmBase> UUID remoteSave(IService<T> service, T cdmBase);
+
+ public <T extends CdmBase> T remoteUpdate(IService<T> service, T cdmBase);
+
+
+ /**
+ * @param cdmBase
+ * @param affectedObjects
+ */
+ public <T extends ICdmBase> void update(T cdmBase, Set<CdmBase> affectedObjects);
+
+ /**
+ * @param cdmBase
+ * @param affectedObjects
+ */
+ public <T extends ICdmBase> void delete(T cdmBase, Set<CdmBase> affectedObjects);
+
+ /**
+ * @param cdmBase
+ * @param affectedObjects
+ */
+ public <T extends ICdmBase> void delete(Set<T> cdmBases, Set<CdmBase> affectedObjects);
+
+ /**
+ *
+ */
+ public void fireNotifications();
+
+ public boolean isActive();
+
+ /**
+ * @param cdmBase
+ * @param affectedObject
+ */
+ public <T extends ICdmBase> void update(T cdmBase, CdmBase affectedObject);
+
+ /**
+ *
+ */
+ public <T extends CdmBase> void update();
+
+
+
+
+}
\ No newline at end of file
--- /dev/null
+package eu.etaxonomy.taxeditor.session;
+
+import java.util.List;
+
+import eu.etaxonomy.cdm.model.common.CdmBase;
+import eu.etaxonomy.cdm.persistence.hibernate.ICdmPostDataChangeObserver;
+
+public interface ICdmEntitySessionEnabled extends ICdmPostDataChangeObserver {
+
+ public ICdmEntitySession getCdmEntitySession();
+
+ public <T extends CdmBase> List<T> getRootEntities();
+
+}
--- /dev/null
+package eu.etaxonomy.taxeditor.session;
+
+import java.util.Collection;
+import java.util.Set;
+
+import eu.etaxonomy.cdm.model.common.CdmBase;
+
+public interface ICdmEntitySessionManager {
+
+ public abstract ICdmEntitySession newSession(ICdmEntitySessionEnabled sessionOwner, boolean setAsActive);
+
+ public abstract void bind(ICdmEntitySessionEnabled sessionOwner);
+
+
+ public abstract <T extends Object> T load(T obj, boolean update);
+
+
+ public abstract <T extends CdmBase> T load(T cdmBase, boolean update);
+
+
+ public abstract <T extends CdmBase> Collection<T> load(Collection<T> cdmBaseList, boolean update);
+
+
+ /**
+ * @return
+ */
+ public ICdmEntitySession getActiveSession();
+
+ public Collection<ICdmEntitySession> getSessions();
+
+ public void addSessionObserver(ICdmEntitySessionManagerObserver sessionObserver);
+
+
+
+
+ public boolean isRemoting();
+
+ /**
+ * @param owner
+ */
+ public void dispose(ICdmEntitySessionEnabled owner);
+
+ /**
+ *
+ */
+ public void disposeAll();
+
+ /**
+ * @param cdmBase
+ * @param affectedObjects
+ */
+ public <T extends CdmBase> void update(T cdmBase, Set<CdmBase> affectedObjects);
+
+ /**
+ *
+ */
+ public <T extends CdmBase> void update();
+
+
+}
\ No newline at end of file
--- /dev/null
+// $Id$
+/**
+* Copyright (C) 2015 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.session;
+
+/**
+ * @author cmathew
+ * @date 16 Feb 2015
+ *
+ */
+public interface ICdmEntitySessionManagerObserver {
+
+ public void changed();
+
+}
--- /dev/null
+// $Id$
+/**
+* Copyright (C) 2015 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.session.mock;
+
+import java.util.Collection;
+import java.util.List;
+import java.util.Set;
+import java.util.UUID;
+
+import net.sf.ehcache.statistics.LiveCacheStatistics;
+import eu.etaxonomy.cdm.api.service.IService;
+import eu.etaxonomy.cdm.model.common.CdmBase;
+import eu.etaxonomy.cdm.model.common.ICdmBase;
+import eu.etaxonomy.cdm.persistence.hibernate.CdmDataChangeEvent.EventType;
+import eu.etaxonomy.taxeditor.remoting.cache.EntityCacherDebugResult;
+import eu.etaxonomy.taxeditor.session.ICdmEntitySession;
+import eu.etaxonomy.taxeditor.session.ICdmEntitySessionEnabled;
+
+/**
+ * @author cmathew
+ * @date 29 Jan 2015
+ *
+ */
+public class MockCdmEntitySession implements ICdmEntitySession {
+
+ /* (non-Javadoc)
+ * @see eu.etaxonomy.taxeditor.session.ICdmEntitySession#load(java.lang.Object)
+ */
+ @Override
+ public <O extends Object> O load(O obj, boolean update) {
+ return obj;
+ }
+
+ /* (non-Javadoc)
+ * @see eu.etaxonomy.taxeditor.session.ICdmEntitySession#load(eu.etaxonomy.cdm.model.common.CdmBase)
+ */
+ @Override
+ public <T extends CdmBase> T load(T cdmBase, boolean update) {
+ return cdmBase;
+ }
+
+ /* (non-Javadoc)
+ * @see eu.etaxonomy.taxeditor.session.ICdmEntitySession#load(java.util.Collection)
+ */
+ @Override
+ public <T extends CdmBase> Collection<T> load(Collection<T> cdmBaseList, boolean update) {
+ return cdmBaseList;
+ }
+
+ /* (non-Javadoc)
+ * @see eu.etaxonomy.taxeditor.session.ICdmEntitySession#setEntitiesAsLatest()
+ */
+ @Override
+ public void setEntitiesAsLatest() {
+
+ }
+
+ /* (non-Javadoc)
+ * @see eu.etaxonomy.taxeditor.session.ICdmEntitySession#dispose()
+ */
+ @Override
+ public void dispose() {
+
+ }
+
+ /* (non-Javadoc)
+ * @see eu.etaxonomy.taxeditor.session.ICdmEntitySession#bind()
+ */
+ @Override
+ public void bind() {
+ // TODO Auto-generated method stub
+
+ }
+
+ /* (non-Javadoc)
+ * @see eu.etaxonomy.taxeditor.session.ICdmEntitySession#registerForDataStoreChanges(eu.etaxonomy.taxeditor.session.ICdmEntitySessionEnabled)
+ */
+ @Override
+ public void registerForDataStoreChanges(ICdmEntitySessionEnabled observer) {
+
+
+ }
+
+ /* (non-Javadoc)
+ * @see eu.etaxonomy.taxeditor.session.ICdmEntitySession#unregisterForDataStoreChanges(eu.etaxonomy.taxeditor.session.ICdmEntitySessionEnabled)
+ */
+ @Override
+ public void unregisterForDataStoreChanges(ICdmEntitySessionEnabled observer) {
+
+ }
+
+
+
+ /* (non-Javadoc)
+ * @see eu.etaxonomy.taxeditor.session.ICdmEntitySession#commit()
+ */
+ @Override
+ public void fireNotifications() {
+
+
+ }
+
+ /* (non-Javadoc)
+ * @see eu.etaxonomy.taxeditor.session.ICdmEntitySession#debug(eu.etaxonomy.cdm.model.common.CdmBase)
+ */
+ @Override
+ public <T extends CdmBase> EntityCacherDebugResult debug(T cdmBase) {
+
+ return new EntityCacherDebugResult();
+ }
+
+ /* (non-Javadoc)
+ * @see eu.etaxonomy.taxeditor.session.ICdmEntitySession#addEvent(eu.etaxonomy.cdm.model.common.ICdmBase, eu.etaxonomy.cdm.model.common.CdmBase[], eu.etaxonomy.cdm.persistence.hibernate.CdmDataChangeEvent.EventType)
+ */
+ @Override
+ public void addEvent(ICdmBase cdmBase, Set<CdmBase> affectedObjects, EventType eventType) {
+ // TODO Auto-generated method stub
+
+ }
+
+ /* (non-Javadoc)
+ * @see eu.etaxonomy.taxeditor.session.ICdmEntitySession#addEvent(java.util.Collection, eu.etaxonomy.cdm.model.common.CdmBase[], eu.etaxonomy.cdm.persistence.hibernate.CdmDataChangeEvent.EventType)
+ */
+ @Override
+ public <T extends ICdmBase> void addEvent(Collection<T> cdmBases, Set<CdmBase> affectedObjects, EventType eventType) {
+ // TODO Auto-generated method stub
+
+ }
+
+ /* (non-Javadoc)
+ * @see eu.etaxonomy.taxeditor.session.ICdmEntitySession#load(java.util.UUID, eu.etaxonomy.cdm.api.service.IService)
+ */
+ @Override
+ public <T extends CdmBase> T remoteLoad(IService<T> service, UUID uuid) {
+ return service.load(uuid);
+ }
+
+
+ /* (non-Javadoc)
+ * @see eu.etaxonomy.taxeditor.session.ICdmEntitySession#load(eu.etaxonomy.cdm.api.service.IService, java.util.UUID, java.util.List)
+ */
+ @Override
+ public <T extends CdmBase> T remoteLoad(IService<T> service, UUID uuid, List<String> propertyPaths) {
+ return service.load(uuid, propertyPaths);
+ }
+
+ /* (non-Javadoc)
+ * @see eu.etaxonomy.taxeditor.session.ICdmEntitySession#save(eu.etaxonomy.cdm.api.service.IService, eu.etaxonomy.cdm.model.common.CdmBase)
+ */
+ @Override
+ public <T extends CdmBase> UUID remoteSave(IService<T> service, T cdmBase) {
+ return service.save(cdmBase);
+ }
+
+ /* (non-Javadoc)
+ * @see eu.etaxonomy.taxeditor.session.ICdmEntitySession#update(eu.etaxonomy.cdm.api.service.IService, eu.etaxonomy.cdm.model.common.CdmBase)
+ */
+ @Override
+ public <T extends CdmBase> T remoteUpdate(IService<T> service, T cdmBase) {
+ return cdmBase;
+ }
+
+
+ /* (non-Javadoc)
+ * @see eu.etaxonomy.taxeditor.session.ICdmEntitySession#update(eu.etaxonomy.cdm.model.common.ICdmBase, java.util.Set)
+ */
+ @Override
+ public <T extends ICdmBase> void update(T cdmBase, Set<CdmBase> affectedObjects) {
+ // TODO Auto-generated method stub
+
+ }
+
+ /* (non-Javadoc)
+ * @see eu.etaxonomy.taxeditor.session.ICdmEntitySession#delete(eu.etaxonomy.cdm.model.common.ICdmBase, java.util.Set)
+ */
+ @Override
+ public <T extends ICdmBase> void delete(T cdmBase, Set<CdmBase> affectedObjects) {
+ // TODO Auto-generated method stub
+
+ }
+
+ /* (non-Javadoc)
+ * @see eu.etaxonomy.taxeditor.session.ICdmEntitySession#delete(java.util.Set, java.util.Set)
+ */
+ @Override
+ public <T extends ICdmBase> void delete(Set<T> cdmBases, Set<CdmBase> affectedObjects) {
+ // TODO Auto-generated method stub
+
+ }
+
+ /* (non-Javadoc)
+ * @see eu.etaxonomy.taxeditor.session.ICdmEntitySession#getOwner()
+ */
+ @Override
+ public ICdmEntitySessionEnabled getOwner() {
+ return null;
+ }
+
+ /* (non-Javadoc)
+ * @see eu.etaxonomy.taxeditor.session.ICdmEntitySession#getCacheStatistics()
+ */
+ @Override
+ public LiveCacheStatistics getCacheStatistics() {
+ return null;
+ }
+
+ /* (non-Javadoc)
+ * @see eu.etaxonomy.taxeditor.session.ICdmEntitySession#isActive()
+ */
+ @Override
+ public boolean isActive() {
+ return false;
+ }
+
+ /* (non-Javadoc)
+ * @see eu.etaxonomy.taxeditor.session.ICdmEntitySession#getRootEntities()
+ */
+ @Override
+ public <T extends CdmBase> List<T> getRootEntities() {
+ return null;
+ }
+
+ /* (non-Javadoc)
+ * @see eu.etaxonomy.taxeditor.session.ICdmEntitySession#debug(java.util.List)
+ */
+ @Override
+ public <T extends CdmBase> EntityCacherDebugResult debug(List<T> cdmBase) {
+
+ return null;
+ }
+
+ /* (non-Javadoc)
+ * @see eu.etaxonomy.taxeditor.session.ICdmEntitySession#debug()
+ */
+ @Override
+ public <T extends CdmBase> EntityCacherDebugResult debug() {
+
+ return null;
+ }
+
+ /* (non-Javadoc)
+ * @see eu.etaxonomy.taxeditor.session.ICdmEntitySession#update(eu.etaxonomy.cdm.model.common.ICdmBase, eu.etaxonomy.cdm.model.common.CdmBase)
+ */
+ @Override
+ public <T extends ICdmBase> void update(T cdmBase, CdmBase affectedObject) {
+
+ }
+
+ /* (non-Javadoc)
+ * @see eu.etaxonomy.taxeditor.session.ICdmEntitySession#update()
+ */
+ @Override
+ public <T extends CdmBase> void update() {
+ // TODO Auto-generated method stub
+
+ }
+
+
+}
--- /dev/null
+package eu.etaxonomy.taxeditor.session.mock;
+
+import java.util.Collection;
+import java.util.Set;
+
+import eu.etaxonomy.cdm.model.common.CdmBase;
+import eu.etaxonomy.taxeditor.session.ICdmEntitySession;
+import eu.etaxonomy.taxeditor.session.ICdmEntitySessionEnabled;
+import eu.etaxonomy.taxeditor.session.ICdmEntitySessionManager;
+import eu.etaxonomy.taxeditor.session.ICdmEntitySessionManagerObserver;
+
+
+public class MockCdmEntitySessionManager implements ICdmEntitySessionManager {
+
+
+ @Override
+ public void bind(ICdmEntitySessionEnabled sessionOwner) {
+ }
+
+ @Override
+ public <T> T load(T obj, boolean update) {
+ return obj;
+ }
+
+ @Override
+ public <T extends CdmBase> T load(T obj, boolean update) {
+ return obj;
+ }
+
+
+ @Override
+ public <T extends CdmBase> Collection<T> load(Collection<T> cdmBaseList, boolean update) {
+ return cdmBaseList;
+ }
+
+
+ /* (non-Javadoc)
+ * @see eu.etaxonomy.taxeditor.session.ICdmEntitySessionManager#newSession(eu.etaxonomy.taxeditor.session.ISessionEventListener, boolean)
+ */
+ @Override
+ public ICdmEntitySession newSession(ICdmEntitySessionEnabled sessionOwner, boolean setAsActive) {
+ return new MockCdmEntitySession();
+ }
+
+ /* (non-Javadoc)
+ * @see eu.etaxonomy.taxeditor.session.ICdmEntitySessionManager#getActiveSession()
+ */
+ @Override
+ public ICdmEntitySession getActiveSession() {
+ return new MockCdmEntitySession();
+ }
+
+ /* (non-Javadoc)
+ * @see eu.etaxonomy.taxeditor.session.ICdmEntitySessionManager#getSessions()
+ */
+ @Override
+ public Collection<ICdmEntitySession> getSessions() {
+ return null;
+ }
+
+ /* (non-Javadoc)
+ * @see eu.etaxonomy.taxeditor.session.ICdmEntitySessionManager#addSessionObserver(eu.etaxonomy.taxeditor.session.ICdmEntitySessionManagerObserver)
+ */
+ @Override
+ public void addSessionObserver(ICdmEntitySessionManagerObserver sessionObserver) {
+
+ }
+
+ /* (non-Javadoc)
+ * @see eu.etaxonomy.taxeditor.session.ICdmEntitySessionManager#isRemoting()
+ */
+ @Override
+ public boolean isRemoting() {
+ return false;
+ }
+
+ /* (non-Javadoc)
+ * @see eu.etaxonomy.taxeditor.session.ICdmEntitySessionManager#dispose(eu.etaxonomy.taxeditor.session.ICdmEntitySessionEnabled)
+ */
+ @Override
+ public void dispose(ICdmEntitySessionEnabled owner) {
+
+
+ }
+
+ /* (non-Javadoc)
+ * @see eu.etaxonomy.taxeditor.session.ICdmEntitySessionManager#disposeAll()
+ */
+ @Override
+ public void disposeAll() {
+
+
+ }
+
+ /* (non-Javadoc)
+ * @see eu.etaxonomy.taxeditor.session.ICdmEntitySessionManager#update(eu.etaxonomy.cdm.model.common.CdmBase, java.util.Set)
+ */
+ @Override
+ public <T extends CdmBase> void update(T cdmBase, Set<CdmBase> affectedObjects) {
+
+ }
+
+ /* (non-Javadoc)
+ * @see eu.etaxonomy.taxeditor.session.ICdmEntitySessionManager#update()
+ */
+ @Override
+ public <T extends CdmBase> void update() {
+ // TODO Auto-generated method stub
+
+ }
+
+
+}
--- /dev/null
+// $Id$
+/**
+* Copyright (C) 2015 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.util;
+
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.ObjectOutputStream;
+
+import org.apache.log4j.Logger;
+import org.hibernate.cfg.Configuration;
+
+import eu.etaxonomy.taxeditor.remoting.cache.CdmModelCacher;
+
+/**
+ * @author cmathew
+ * @date 27 May 2015
+ *
+ */
+public class Serializer {
+ private static final Logger logger = Logger.getLogger(Serializer.class);
+
+
+ public static String HB_CONFIG_SER_FILE_NAME = "hibernate.cfg.ser";
+
+ public static boolean checkDir(String dirString) {
+ if(dirString == null || dirString.isEmpty()) {
+ logger.warn("Directory not set or set to empty string");
+ return false;
+ }
+
+ File dir = new File(dirString);
+
+ if(!dir.exists()) {
+ logger.warn("Directory does not exist");
+ return false;
+ }
+
+ return true;
+
+ }
+ public static void serializeHbConfig() {
+
+ Configuration configuration = CdmModelCacher.buildConfiguration();
+ String hbConfigDir = System.getProperty("hb.config.dir");
+ if(checkDir(hbConfigDir)) {
+ try {
+ FileOutputStream fileOut = new FileOutputStream(hbConfigDir + File.separator + HB_CONFIG_SER_FILE_NAME);
+ ObjectOutputStream out = new ObjectOutputStream(fileOut);
+ out.writeObject(configuration);
+ out.close();
+ fileOut.close();
+ logger.info("Serialized configuration object");
+ } catch(IOException i) {
+ i.printStackTrace();
+ }
+ }
+ }
+
+ public static void main(String[] args) {
+ serializeHbConfig();
+
+ }
+
+}
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.type.Type;
import org.jboss.logging.Logger;
-import eu.etaxonomy.cdm.api.application.CdmApplicationRemoteController;
-import eu.etaxonomy.cdm.api.application.ICdmApplicationConfiguration;
-import eu.etaxonomy.cdm.api.service.ICommonService;
-import eu.etaxonomy.cdm.model.common.PersistentMultiLanguageText;
+import eu.etaxonomy.cdm.api.application.CdmApplicationRemoteConfiguration;
+import eu.etaxonomy.taxeditor.remoting.CdmEagerLoadingException;
+import eu.etaxonomy.taxeditor.remoting.cache.ProxyUtils;
+import eu.etaxonomy.taxeditor.service.ICachedCommonService;
/**
* Base class implementing {@link org.hibernate.collection.spi.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 String sessionFactoryUuid;
private boolean specjLazyLoad = false;
- public final String getRole() {
+ @Override
+ public final String getRole() {
return role;
}
- public final Serializable getKey() {
+ @Override
+ public final Serializable getKey() {
return key;
}
- public final boolean isUnreferenced() {
+ @Override
+ public final boolean isUnreferenced() {
return role == null;
}
- public final boolean isDirty() {
+ @Override
+ public final boolean isDirty() {
return dirty;
}
- public final void clearDirty() {
+ @Override
+ public final void clearDirty() {
dirty = false;
}
- public final void dirty() {
+ @Override
+ public final void dirty() {
dirty = true;
}
- public final Serializable getStoredSnapshot() {
+ @Override
+ public final Serializable getStoredSnapshot() {
return storedSnapshot;
}
/**
* Is the initialized collection empty?
*/
- public abstract boolean empty();
+ @Override
+ public abstract boolean empty();
/**
* Called by any read-only method of the collection interface
else {
// In remoting we are sure that session is null
// both when using property paths and switching off conversations
- if(session == null && remoting) {
+ if(session == null && remoting) {
log.info("--> readSize, of " + getRole() + " with key " + getKey());
-