X-Git-Url: https://dev.e-taxonomy.eu/gitweb/taxeditor.git/blobdiff_plain/9a84bed87398862850cf0554b50b20cea28a0951..955e5a526df40fd382ba278c694f72339b037b4d:/eu.etaxonomy.taxeditor.cdmlib/src/main/java/eu/etaxonomy/cdm/api/application/CdmApplicationState.java?ds=sidebyside
diff --git a/eu.etaxonomy.taxeditor.cdmlib/src/main/java/eu/etaxonomy/cdm/api/application/CdmApplicationState.java b/eu.etaxonomy.taxeditor.cdmlib/src/main/java/eu/etaxonomy/cdm/api/application/CdmApplicationState.java
index e9e489a53..796727a2c 100644
--- a/eu.etaxonomy.taxeditor.cdmlib/src/main/java/eu/etaxonomy/cdm/api/application/CdmApplicationState.java
+++ b/eu.etaxonomy.taxeditor.cdmlib/src/main/java/eu/etaxonomy/cdm/api/application/CdmApplicationState.java
@@ -1,4 +1,3 @@
-// $Id$
/**
* Copyright (C) 2015 EDIT
* European Distributed Institute of Taxonomy
@@ -14,6 +13,7 @@ import java.io.IOException;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.lang.reflect.Type;
+import java.net.URI;
import java.net.URISyntaxException;
import java.net.URL;
import java.util.Dictionary;
@@ -47,7 +47,7 @@ public class CdmApplicationState {
private static CdmApplicationState cdmApplicationState;
- private ICdmApplicationConfiguration appConfig;
+ private ICdmRepository appConfig;
private ICdmDataChangeService dataChangeService;
@@ -66,7 +66,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());
@@ -75,15 +75,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();
}
@@ -151,7 +151,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 null
.
*
@@ -161,9 +161,9 @@ public class CdmApplicationState {
* @throws CdmApplicationException
*/
public static T getService(Class serviceClass) throws CdmApplicationException {
- ICdmApplicationConfiguration configuration = getCurrentAppConfig();
+ ICdmRepository configuration = getCurrentAppConfig();
- Method[] methods = ICdmApplicationConfiguration.class.getDeclaredMethods();
+ Method[] methods = ICdmRepository.class.getDeclaredMethods();
T service = null;
@@ -193,14 +193,14 @@ 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();
@@ -208,14 +208,14 @@ public class CdmApplicationState {
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();
@@ -245,7 +245,8 @@ public class CdmApplicationState {
URL fileURL = bundle.getEntry(jar);
File file = null;
try {
- file = new File(FileLocator.resolve(fileURL).toURI());
+ String urlString = FileLocator.resolve(fileURL).toExternalForm().replace(" ", "%20");
+ file = new File(new URI(urlString));
JarFile jarFile = new JarFile(file);
Manifest manifest = jarFile.getManifest();
Attributes attributes = manifest.getMainAttributes();
@@ -256,6 +257,7 @@ public class CdmApplicationState {
cdmlibVersion = attributes.getValue("Bundle-Version");
cdmlibLastModified = attributes.getValue("Bnd-LastModified");
+ jarFile.close();
if(cdmlibVersion == null || cdmlibLastModified == null) {
throw new IllegalStateException("Invalid cdmlib manifest info");
}