summaryrefslogtreecommitdiffstats
path: root/java/sca/modules/extensibility
diff options
context:
space:
mode:
authorjsdelfino <jsdelfino@13f79535-47bb-0310-9956-ffa450edef68>2008-09-09 09:17:30 +0000
committerjsdelfino <jsdelfino@13f79535-47bb-0310-9956-ffa450edef68>2008-09-09 09:17:30 +0000
commitdc15447dfebac2b0218cb1ce6903923c574c84df (patch)
tree5cf9aba844a018bccab0743005af5d3701e98cce /java/sca/modules/extensibility
parent7ea46da4356a04cd45cfa1cadcad9f7fdb28aa7f (diff)
Fixes to get the Equinox integration working. Use the parent classloader instead of the Thread context classloader as parent of the contribution classloader. Use the ServiceDiscovery to get instances of DocumentBuilderFactory and TransformerFactory. Pass these factories around instead of creating new instances in different places. Clarified the few prints in the calculator-osgi sample showing which classloader is used.
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@693411 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'java/sca/modules/extensibility')
-rw-r--r--java/sca/modules/extensibility/src/main/java/org/apache/tuscany/sca/extensibility/ServiceDiscovery.java18
1 files changed, 18 insertions, 0 deletions
diff --git a/java/sca/modules/extensibility/src/main/java/org/apache/tuscany/sca/extensibility/ServiceDiscovery.java b/java/sca/modules/extensibility/src/main/java/org/apache/tuscany/sca/extensibility/ServiceDiscovery.java
index 79b92e0390..c1bbfeb8e0 100644
--- a/java/sca/modules/extensibility/src/main/java/org/apache/tuscany/sca/extensibility/ServiceDiscovery.java
+++ b/java/sca/modules/extensibility/src/main/java/org/apache/tuscany/sca/extensibility/ServiceDiscovery.java
@@ -20,6 +20,8 @@
package org.apache.tuscany.sca.extensibility;
import java.io.IOException;
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
import java.security.AccessController;
import java.security.PrivilegedAction;
import java.util.HashSet;
@@ -148,5 +150,21 @@ public class ServiceDiscovery {
}
return services.iterator().next().loadClass();
}
+
+ /**
+ * Create a new instance of a factory service class.
+ *
+ * @param serviceInterface
+ * @return service implementation class
+ * @throws SecurityException
+ * @throws NoSuchMethodException
+ * @throws InvocationTargetException
+ * @throws IllegalAccessException
+ */
+ public Object newFactoryClassInstance(final Class<?> serviceInterface) throws SecurityException, NoSuchMethodException, InvocationTargetException, IllegalAccessException {
+ Method newInstanceMethod = serviceInterface.getMethod("newInstance");
+ Object factory = newInstanceMethod.invoke(null);
+ return factory;
+ }
}