import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.lang.reflect.Type;
-import java.net.URI;
+import eu.etaxonomy.cdm.common.URI;
import java.net.URISyntaxException;
import java.net.URL;
import java.util.Dictionary;
if(cdmApplicationState == null) {
cdmApplicationState = new CdmApplicationState();
}
-
return cdmApplicationState;
}
return getInstance().getAppConfig();
}
- /**
- * @return the dataChangeService
- */
public ICdmDataChangeService getDataChangeService() {
return dataChangeService;
}
-
- /**
- * @param dataChangeService the dataChangeService to set
- */
public void setDataChangeService(ICdmDataChangeService dataChangeService) {
this.dataChangeService = dataChangeService;
}
getInstance().setDataChangeService(dataChangeService);
}
- /**
- * @return the securityContext
- */
public SecurityContext getSecurityContext() {
return securityContext;
}
-
- /**
- * @param securityContext the securityContext to set
- */
public void setSecurityContext(SecurityContext securityContext) {
this.securityContext = securityContext;
}
- /**
- * @return the securityContext
- */
public static SecurityContext getCurrentSecurityContext() {
return getInstance().getSecurityContext();
}
-
- /**
- * @param securityContext the securityContext to set
- */
public static void setCurrentSecurityContext(SecurityContext securityContext) {
getInstance().setSecurityContext(securityContext);
}
public static void dispose() {
- getInstance().setCurrentDataChangeService(null);
+ setCurrentDataChangeService(null);
getInstance().setAppConfig(null);
getInstance().setSecurityContext(null);
cdmApplicationState = null;
Method[] methods = ICdmRepository.class.getDeclaredMethods();
- T service = null;
-
for (Method method : methods) {
Type type = method.getGenericReturnType();
if (type.equals(serviceClass)) {
try {
- service = (T) method.invoke(configuration, null);
- break;
- } catch (IllegalArgumentException iae) {
+ @SuppressWarnings("unchecked")
+ T service = (T) method.invoke(configuration);
+ return service;
+ } catch (IllegalArgumentException | IllegalAccessException | InvocationTargetException iae) {
throw new CdmApplicationException(iae);
- } catch (IllegalAccessException iae) {
- throw new CdmApplicationException(iae);
- } catch (InvocationTargetException ite) {
- throw new CdmApplicationException(ite);
}
}
}
- return service;
+ return null;
}
/**
return ((CdmApplicationRemoteController)configuration).getLongRunningTasksService();
}
-
-
public static ITestService getTestService() {
ICdmRepository configuration = getCurrentAppConfig();
-
return ((CdmApplicationRemoteController)configuration).getTestService();
}
public static ICachedCommonService getCachedCommonService() {
ICdmRepository configuration = getCurrentAppConfig();
-
return ((CdmApplicationRemoteController)configuration).getCachedCommonService();
}
File file = null;
try {
String urlString = FileLocator.resolve(fileURL).toExternalForm().replace(" ", "%20");
- file = new File(new URI(urlString));
+
+ file = new File(new URI(urlString).getJavaUri());
JarFile jarFile = new JarFile(file);
Manifest manifest = jarFile.getManifest();
Attributes attributes = manifest.getMainAttributes();
throw new IllegalStateException(urise);
} catch (IOException ioe) {
throw new IllegalStateException(ioe);
- }
+ } catch (IllegalArgumentException iae) {
+ String message = iae.getMessage().concat("uri" + jar);
+ throw new IllegalStateException(message);
+ }
}
}
} catch (BundleException e) {