ref #8842 claning up - removing obsolete classes and renaming
[taxeditor.git] / eu.etaxonomy.taxeditor.cdmlib / src / main / java / eu / etaxonomy / cdm / api / application / CdmApplicationState.java
index 8bee46bf9946ebd9e7472e970d04d4646aeb4827..5d73b7ad27c83c8da39d3681222f1f4254ae15f5 100644 (file)
@@ -1,4 +1,3 @@
-// $Id$
 /**
 * Copyright (C) 2015 EDIT
 * European Distributed Institute of Taxonomy
@@ -34,6 +33,7 @@ import eu.etaxonomy.cdm.api.cache.CdmServiceCacher;
 import eu.etaxonomy.cdm.api.service.ICommonService;
 import eu.etaxonomy.cdm.api.service.IService;
 import eu.etaxonomy.cdm.api.service.ITestService;
+import eu.etaxonomy.cdm.api.service.longrunningService.ILongRunningTasksService;
 import eu.etaxonomy.cdm.io.service.IIOService;
 import eu.etaxonomy.cdm.model.common.CdmBase;
 import eu.etaxonomy.taxeditor.service.ICachedCommonService;
@@ -48,10 +48,11 @@ public class CdmApplicationState {
 
     private static CdmApplicationState cdmApplicationState;
 
-    private ICdmApplicationConfiguration appConfig;
+    private ICdmRepository appConfig;
 
     private ICdmDataChangeService dataChangeService;
 
+    //FIXME SecurityContextHolder.getContext()
     private SecurityContext securityContext;
 
     private static CdmServiceCacher cdmServiceCacher;
@@ -67,7 +68,7 @@ public class CdmApplicationState {
         return cdmApplicationState;
     }
 
-    public void setAppConfig(ICdmApplicationConfiguration appConfig) {
+    public void setAppConfig(ICdmRepository appConfig) {
         this.appConfig = appConfig;
         if(appConfig instanceof CdmApplicationRemoteController) {
             CdmBase.setNewEntityListener(new DefaultNewEntityListener());
@@ -76,15 +77,15 @@ public class CdmApplicationState {
         }
     }
 
-    public ICdmApplicationConfiguration getAppConfig() {
+    public ICdmRepository getAppConfig() {
         return appConfig;
     }
 
-    public static void setCurrentAppConfig(ICdmApplicationConfiguration appConfig) {
+    public static void setCurrentAppConfig(ICdmRepository appConfig) {
         getInstance().setAppConfig(appConfig);
     }
 
-    public static ICdmApplicationConfiguration getCurrentAppConfig() {
+    public static ICdmRepository getCurrentAppConfig() {
         return getInstance().getAppConfig();
     }
 
@@ -152,7 +153,7 @@ public class CdmApplicationState {
 
 
     /**
-     * Generic method that will scan the getters of {@link ICdmApplicationConfiguration} for the given service
+     * Generic method that will scan the getters of {@link ICdmRepository} for the given service
      * interface. If a matching getter is found the according service implementation is returned by
      * invoking the getter otherwise the method returns <code>null</code>.
      *
@@ -162,9 +163,9 @@ public class CdmApplicationState {
      * @throws CdmApplicationException
      */
     public static <T extends IService> T getService(Class<T> serviceClass) throws CdmApplicationException {
-        ICdmApplicationConfiguration configuration = getCurrentAppConfig();
+        ICdmRepository configuration = getCurrentAppConfig();
 
-        Method[] methods = ICdmApplicationConfiguration.class.getDeclaredMethods();
+        Method[] methods = ICdmRepository.class.getDeclaredMethods();
 
         T service = null;
 
@@ -194,29 +195,37 @@ public class CdmApplicationState {
      * As ICommonService is not extending IService we need a specific request here
      */
     public static ICommonService getCommonService() {
-        ICdmApplicationConfiguration configuration = getCurrentAppConfig();
+        ICdmRepository configuration = getCurrentAppConfig();
 
         return configuration.getCommonService();
 
     }
 
     public static IIOService getIOService() {
-        ICdmApplicationConfiguration configuration = getCurrentAppConfig();
+        ICdmRepository configuration = getCurrentAppConfig();
 
         return ((CdmApplicationRemoteController)configuration).getIOService();
 
     }
 
+    public static ILongRunningTasksService getLongRunningTasksService() {
+        ICdmRepository configuration = getCurrentAppConfig();
+
+        return ((CdmApplicationRemoteController)configuration).getLongRunningTasksService();
+
+    }
+
+
 
     public static ITestService getTestService() {
-        ICdmApplicationConfiguration configuration = getCurrentAppConfig();
+        ICdmRepository configuration = getCurrentAppConfig();
 
         return ((CdmApplicationRemoteController)configuration).getTestService();
 
     }
 
     public static ICachedCommonService getCachedCommonService() {
-        ICdmApplicationConfiguration configuration = getCurrentAppConfig();
+        ICdmRepository configuration = getCurrentAppConfig();
 
         return ((CdmApplicationRemoteController)configuration).getCachedCommonService();
 
@@ -246,7 +255,7 @@ public class CdmApplicationState {
                     URL fileURL = bundle.getEntry(jar);
                     File file = null;
                     try {
-                        String urlString = FileLocator.resolve(fileURL).toExternalForm().replace(" ", "%20");;
+                        String urlString = FileLocator.resolve(fileURL).toExternalForm().replace(" ", "%20");
                         file = new File(new URI(urlString));
                         JarFile jarFile = new JarFile(file);
                         Manifest manifest = jarFile.getManifest();