summaryrefslogtreecommitdiffstats
path: root/branches/sca-equinox/modules/node-api/src/main/java/org/apache/tuscany/sca/node/ContributionLocationHelper.java
diff options
context:
space:
mode:
authorjsdelfino <jsdelfino@13f79535-47bb-0310-9956-ffa450edef68>2008-10-09 06:33:54 +0000
committerjsdelfino <jsdelfino@13f79535-47bb-0310-9956-ffa450edef68>2008-10-09 06:33:54 +0000
commitefe3363a815a777ecd283928900404dea84a7e1f (patch)
tree42522fd01e6af981f8ff94663d911d56744154d5 /branches/sca-equinox/modules/node-api/src/main/java/org/apache/tuscany/sca/node/ContributionLocationHelper.java
parentaacabe1650e380595a8d701123394d791656d17d (diff)
Work in progress. Fixed implementation of NodeImpl, now working without dependencies on implementations from other bundles (except RuntimeAssemblyFactory, which will need to be cleaned up too). Started to remove dependencies on host-embedded and port code to NodeFactory and Node, as an interim step to bring them up, before porting them to the OSGi-enabled node launcher.
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@703068 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to '')
-rw-r--r--branches/sca-equinox/modules/node-api/src/main/java/org/apache/tuscany/sca/node/ContributionLocationHelper.java (renamed from branches/sca-equinox/modules/host-embedded/src/test/java/org/apache/tuscany/sca/host/embedded/test/extension/TestImplementationFactory.java)24
1 files changed, 18 insertions, 6 deletions
diff --git a/branches/sca-equinox/modules/host-embedded/src/test/java/org/apache/tuscany/sca/host/embedded/test/extension/TestImplementationFactory.java b/branches/sca-equinox/modules/node-api/src/main/java/org/apache/tuscany/sca/node/ContributionLocationHelper.java
index 9200d850bb..74ebe556bc 100644
--- a/branches/sca-equinox/modules/host-embedded/src/test/java/org/apache/tuscany/sca/host/embedded/test/extension/TestImplementationFactory.java
+++ b/branches/sca-equinox/modules/node-api/src/main/java/org/apache/tuscany/sca/node/ContributionLocationHelper.java
@@ -17,21 +17,33 @@
* under the License.
*/
-package org.apache.tuscany.sca.host.embedded.test.extension;
+package org.apache.tuscany.sca.node;
+import java.net.URL;
+import java.security.AccessController;
+import java.security.PrivilegedAction;
/**
- * A factory for the test implementation model.
+ * ContributionLocationHelper
*
- * @version $Rev$ $Date$
+ * @version $Rev: $ $Date: $
*/
-public interface TestImplementationFactory {
+public class ContributionLocationHelper {
/**
- * Creates a new test implementation.
+ * Returns the location of the SCA contribution containing the given class.
*
+ * @param anchorClass
* @return
*/
- TestImplementation createTestImplementation();
+ public static String getContributionLocation(final Class<?> anchorClass) {
+ URL url = AccessController.doPrivileged(new PrivilegedAction<URL>() {
+ public URL run() {
+ return anchorClass.getProtectionDomain().getCodeSource().getLocation();
+ }
+ });
+ String uri = url.toString();
+ return uri;
+ }
}