geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From xuhaih...@apache.org
Subject svn commit: r1227586 - in /geronimo/server/branches/3.0-beta: framework/modules/geronimo-system/src/main/java/org/apache/geronimo/system/configuration/ plugins/sharedlib/geronimo-sharedlib/src/main/java/org/apache/geronimo/system/sharedlib/
Date Thu, 05 Jan 2012 13:39:45 GMT
Author: xuhaihong
Date: Thu Jan  5 13:39:45 2012
New Revision: 1227586

URL: http://svn.apache.org/viewvc?rev=1227586&view=rev
Log:
GERONIMO-6254 Shared library does not work in the deployment process

Modified:
    geronimo/server/branches/3.0-beta/framework/modules/geronimo-system/src/main/java/org/apache/geronimo/system/configuration/DependencyManager.java
    geronimo/server/branches/3.0-beta/plugins/sharedlib/geronimo-sharedlib/src/main/java/org/apache/geronimo/system/sharedlib/SharedLibExtender.java

Modified: geronimo/server/branches/3.0-beta/framework/modules/geronimo-system/src/main/java/org/apache/geronimo/system/configuration/DependencyManager.java
URL: http://svn.apache.org/viewvc/geronimo/server/branches/3.0-beta/framework/modules/geronimo-system/src/main/java/org/apache/geronimo/system/configuration/DependencyManager.java?rev=1227586&r1=1227585&r2=1227586&view=diff
==============================================================================
--- geronimo/server/branches/3.0-beta/framework/modules/geronimo-system/src/main/java/org/apache/geronimo/system/configuration/DependencyManager.java
(original)
+++ geronimo/server/branches/3.0-beta/framework/modules/geronimo-system/src/main/java/org/apache/geronimo/system/configuration/DependencyManager.java
Thu Jan  5 13:39:45 2012
@@ -290,8 +290,14 @@ public class DependencyManager implement
         }
     }
 
-    private void addArtifactBundleEntry(Bundle bundle) {
-        Artifact artifact = toArtifact(bundle.getLocation());
+    private PluginArtifactType addArtifactBundleEntry(Bundle bundle) {
+        PluginArtifactType pluginArtifactType = getCachedPluginMetadata(bundle);
+        Artifact artifact;
+        if (pluginArtifactType == null) {
+            artifact = toArtifact(bundle.getLocation());
+        } else {
+            artifact = pluginArtifactType.getModuleId().toArtifact();
+        }
         if (artifact != null) {
             artifactBundleMap.put(artifact, bundle);
             bundleIdArtifactMap.put(bundle.getBundleId(), artifact);
@@ -300,13 +306,13 @@ public class DependencyManager implement
                 log.debug("fail to resovle artifact from the bundle location " + bundle.getLocation());
             }
         }
+        return pluginArtifactType;
     }
 
     private void removeArtifactBundleEntry(Bundle bundle) {
-        Artifact artifact = toArtifact(bundle.getLocation());
+        Artifact artifact = bundleIdArtifactMap.remove(bundle.getBundleId());
         if (artifact != null) {
             artifactBundleMap.remove(artifact);
-            bundleIdArtifactMap.remove(bundle.getBundleId());
         }
     }
 
@@ -428,8 +434,7 @@ public class DependencyManager implement
         if (bundleIdArtifactMap.containsKey(bundle.getBundleId())) {
             return;
         }
-        addArtifactBundleEntry(bundle);
-        PluginArtifactType pluginArtifactType = getCachedPluginMetadata(bundle);
+        PluginArtifactType pluginArtifactType = addArtifactBundleEntry(bundle);
         if (pluginArtifactType == null) {
             return;
         }

Modified: geronimo/server/branches/3.0-beta/plugins/sharedlib/geronimo-sharedlib/src/main/java/org/apache/geronimo/system/sharedlib/SharedLibExtender.java
URL: http://svn.apache.org/viewvc/geronimo/server/branches/3.0-beta/plugins/sharedlib/geronimo-sharedlib/src/main/java/org/apache/geronimo/system/sharedlib/SharedLibExtender.java?rev=1227586&r1=1227585&r2=1227586&view=diff
==============================================================================
--- geronimo/server/branches/3.0-beta/plugins/sharedlib/geronimo-sharedlib/src/main/java/org/apache/geronimo/system/sharedlib/SharedLibExtender.java
(original)
+++ geronimo/server/branches/3.0-beta/plugins/sharedlib/geronimo-sharedlib/src/main/java/org/apache/geronimo/system/sharedlib/SharedLibExtender.java
Thu Jan  5 13:39:45 2012
@@ -21,6 +21,7 @@ import java.util.ArrayList;
 import java.util.LinkedList;
 import java.util.List;
 import java.util.Map;
+import java.util.Set;
 import java.util.concurrent.ConcurrentHashMap;
 import java.util.concurrent.locks.ReentrantLock;
 
@@ -32,7 +33,6 @@ import org.apache.geronimo.gbean.annotat
 import org.apache.geronimo.gbean.annotation.SpecialAttributeType;
 import org.apache.geronimo.hook.BundleHelper;
 import org.apache.geronimo.hook.SharedLibraryRegistry;
-import org.apache.geronimo.kernel.config.Configuration;
 import org.apache.geronimo.kernel.config.ConfigurationManager;
 import org.apache.geronimo.kernel.repository.Artifact;
 import org.apache.geronimo.system.configuration.DependencyManager;
@@ -64,7 +64,8 @@ public class SharedLibExtender implement
 
     private final ReentrantLock registerLock = new ReentrantLock();
 
-    public SharedLibExtender(@ParamSpecial(type = SpecialAttributeType.bundleContext) BundleContext
bundleContext,
+    public SharedLibExtender(
+            @ParamSpecial(type = SpecialAttributeType.bundleContext) BundleContext bundleContext,
             @ParamReference(name = "DependencyManager") DependencyManager dependencyManager,
             @ParamReference(name = "ConfigurationManager", namingType = "ConfigurationManager")
ConfigurationManager configurationManager) {
         this.dependencyManager = dependencyManager;
@@ -100,20 +101,14 @@ public class SharedLibExtender implement
     }
 
     private void installSharedLibs(Bundle appBundle) {
-        Artifact artifact = dependencyManager.getArtifact(appBundle.getBundleId());
-        if (artifact == null) {
-            if (logger.isDebugEnabled()) {
-                logger.debug("Unable to recongnize the artifact id for the bundle " + appBundle.getSymbolicName());
-            }
-            return;
-        }
-        if (!configurationManager.isConfiguration(artifact)) {
-            return;
-        }
-        Configuration configuration = configurationManager.getConfiguration(artifact);
+        Set<Long> dependentBundleIds = dependencyManager.getFullDependentBundleIds(appBundle.getBundleId());
         List<Bundle> dependentSharedLibBundles = new ArrayList<Bundle>();
-        for (Artifact parentArtifact : configuration.getDependencyNode().getParents()) {
-            List<Bundle> sharedLibBundles = configruationSharedLibBundlesMap.get(parentArtifact);
+        for (Long bundleId : dependentBundleIds) {
+            Artifact currArtifact = dependencyManager.getArtifact(bundleId);
+            if (currArtifact == null) {
+                continue;
+            }
+            List<Bundle> sharedLibBundles = configruationSharedLibBundlesMap.get(currArtifact);
             if (sharedLibBundles != null) {
                 dependentSharedLibBundles.addAll(sharedLibBundles);
             }



Mime
View raw message