diff options
author | rfeng <rfeng@13f79535-47bb-0310-9956-ffa450edef68> | 2010-01-27 04:33:47 +0000 |
---|---|---|
committer | rfeng <rfeng@13f79535-47bb-0310-9956-ffa450edef68> | 2010-01-27 04:33:47 +0000 |
commit | 0c1527f0415fb7d6c06b0ad2a1d4ce73cd728852 (patch) | |
tree | 7d0658a2e64c4fdec2957090fc70dfd0efed09d7 /sca-java-2.x/trunk/modules/contribution-osgi/src/main/java/org/apache/tuscany/sca | |
parent | c2dfd0917dbb0793b7934ccc298e03187e6e3418 (diff) |
Fix multiple concurrency related issues
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@903542 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'sca-java-2.x/trunk/modules/contribution-osgi/src/main/java/org/apache/tuscany/sca')
-rw-r--r-- | sca-java-2.x/trunk/modules/contribution-osgi/src/main/java/org/apache/tuscany/sca/contribution/osgi/impl/OSGiBundleContributionScanner.java | 37 |
1 files changed, 10 insertions, 27 deletions
diff --git a/sca-java-2.x/trunk/modules/contribution-osgi/src/main/java/org/apache/tuscany/sca/contribution/osgi/impl/OSGiBundleContributionScanner.java b/sca-java-2.x/trunk/modules/contribution-osgi/src/main/java/org/apache/tuscany/sca/contribution/osgi/impl/OSGiBundleContributionScanner.java index 5e32a9a62e..111f1f370c 100644 --- a/sca-java-2.x/trunk/modules/contribution-osgi/src/main/java/org/apache/tuscany/sca/contribution/osgi/impl/OSGiBundleContributionScanner.java +++ b/sca-java-2.x/trunk/modules/contribution-osgi/src/main/java/org/apache/tuscany/sca/contribution/osgi/impl/OSGiBundleContributionScanner.java @@ -57,8 +57,6 @@ public class OSGiBundleContributionScanner implements ContributionScanner { return PackageType.BUNDLE; } - - public List<Artifact> scan(Contribution contribution) throws ContributionReadException { Bundle bundle = OSGiBundleActivator.findBundle(contribution.getLocation()); @@ -99,22 +97,28 @@ public class OSGiBundleContributionScanner implements ContributionScanner { //Add artifact to list Artifact artifact = contributionFactory.createArtifact(); artifact.setURI(entryName); - artifact.setLocation(getArtifactURL(contribution, entryName).toString()); + artifact.setLocation(entry.toString()); artifacts.add(artifact); //if Artifact is a JAR, add jar artifacts as well + /* if (entryName.endsWith(".jar") && bundleClassPath.contains(entryName)) { List<String> jarArtifactURIs = getJarArtifacts(entry, entry.openStream()); for( String uri : jarArtifactURIs) { Artifact jarArtifact = contributionFactory.createArtifact(); jarArtifact.setURI(uri); - jarArtifact.setLocation(getArtifactURL(contribution, uri).toString()); - + URL url = bundle.getResource(uri); + String location = null; + if(url!=null) { + location = url.toString(); + } + jarArtifact.setLocation(location); artifacts.add(jarArtifact); } } + */ } } catch (Exception e) { @@ -125,7 +129,7 @@ public class OSGiBundleContributionScanner implements ContributionScanner { contribution.setClassLoader(new BundleClassLoader(bundle)); return artifacts; } - + /** * Retrieve a list of Artifact URIs for a given JAR * @param packageSourceURL @@ -184,27 +188,6 @@ public class OSGiBundleContributionScanner implements ContributionScanner { } - /** - * Given an artifact URI, return it's location URL - * - * @param contribution - * @param artifact - * @return - * @throws ContributionReadException - */ - private URL getArtifactURL(Contribution contribution, String artifact) throws ContributionReadException { - Bundle bundle = null; - try { - bundle = OSGiBundleActivator.findBundle(contribution.getLocation()); - if (bundle != null) { - URL url = bundle.getResource(artifact); - return url; - } - } catch (Exception e) { - } - return null; - } - private static class BundleClassLoader extends ClassLoader { private Bundle bundle; |