geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From xuhaih...@apache.org
Subject svn commit: r832682 - /geronimo/server/trunk/plugins/console/console-core/src/main/java/org/apache/geronimo/console/util/PortletManager.java
Date Wed, 04 Nov 2009 08:46:59 GMT
Author: xuhaihong
Date: Wed Nov  4 08:46:57 2009
New Revision: 832682

URL: http://svn.apache.org/viewvc?rev=832682&view=rev
Log:
GERONIMO-4931 Enable ActiveMQ plugin in the OSGI environment.
Update the helper method in the PortletManager to get the bundle object of the template rar
resource

Modified:
    geronimo/server/trunk/plugins/console/console-core/src/main/java/org/apache/geronimo/console/util/PortletManager.java

Modified: geronimo/server/trunk/plugins/console/console-core/src/main/java/org/apache/geronimo/console/util/PortletManager.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/console/console-core/src/main/java/org/apache/geronimo/console/util/PortletManager.java?rev=832682&r1=832681&r2=832682&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/console/console-core/src/main/java/org/apache/geronimo/console/util/PortletManager.java
(original)
+++ geronimo/server/trunk/plugins/console/console-core/src/main/java/org/apache/geronimo/console/util/PortletManager.java
Wed Nov  4 08:46:57 2009
@@ -17,7 +17,6 @@
 package org.apache.geronimo.console.util;
 
 import java.io.File;
-import java.util.Collections;
 import java.util.Map;
 
 import javax.naming.InitialContext;
@@ -58,6 +57,8 @@
 import org.apache.geronimo.management.geronimo.WebManager;
 import org.apache.geronimo.system.logging.SystemLog;
 import org.osgi.framework.Bundle;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.BundleException;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -374,10 +375,9 @@
         }
         return null;
     }
-    
+
     public static Bundle getRepositoryEntryBundle(PortletRequest request, String repositoryURI)
{
         J2EEServer server = getCurrentServer(request);
-        Repository[] repos = server.getRepositories();
         Artifact uri = Artifact.create(repositoryURI);
         if (!uri.isResolved()) {
             Artifact[] all = server.getConfigurationManager().getArtifactResolver().queryArtifacts(uri);
@@ -387,7 +387,15 @@
                 uri = all[all.length - 1];
             }
         }
-        return getConfigurationManager().getBundle(uri);
+        try {
+            Kernel kernel = getKernel();
+            BundleContext bundleContext = kernel.getBundleFor(kernel.getKernelName()).getBundleContext();
+            //TODO Figure out who should be responsible for uninstalling it, and whether
we need to start the bundle
+            //Currently, this method is only used for resource reading, seems no need to
start the bundle.
+            return bundleContext.installBundle("mvn:" + uri.getGroupId() + "/" + uri.getArtifactId()
+ "/" + uri.getVersion() + ("jar".equals(uri.getType()) ? "" : "/" + uri.getType()));
+        } catch (Exception e) {
+            return null;
+        }
     }
 
     public static J2EEDeployedObject getModule(PortletRequest request, Artifact configuration)
{



Mime
View raw message