GERONIMO-5582 add web url in eba porlet
git-svn-id: https://svn.apache.org/repos/asf/geronimo/server/trunk@1157383 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/plugins/console/console-base-portlets/pom.xml b/plugins/console/console-base-portlets/pom.xml
index 57f7955..cc8015a 100644
--- a/plugins/console/console-base-portlets/pom.xml
+++ b/plugins/console/console-base-portlets/pom.xml
@@ -108,6 +108,13 @@
<scope>provided</scope>
</dependency>
+ <dependency>
+ <groupId>org.apache.geronimo.modules</groupId>
+ <artifactId>geronimo-aries</artifactId>
+ <version>${project.version}</version>
+ <scope>provided</scope>
+ </dependency>
+
<!-- FIXME : this should be replaced by org.apache.aries.util in next release -->
<dependency>
<groupId>org.apache.aries.application</groupId>
diff --git a/plugins/console/console-base-portlets/src/main/java/org/apache/geronimo/console/configmanager/ConfigManagerPortlet.java b/plugins/console/console-base-portlets/src/main/java/org/apache/geronimo/console/configmanager/ConfigManagerPortlet.java
index 76c9ec3..5d1f149 100644
--- a/plugins/console/console-base-portlets/src/main/java/org/apache/geronimo/console/configmanager/ConfigManagerPortlet.java
+++ b/plugins/console/console-base-portlets/src/main/java/org/apache/geronimo/console/configmanager/ConfigManagerPortlet.java
@@ -43,6 +43,7 @@
import org.apache.geronimo.gbean.GBeanData;
import org.apache.geronimo.j2ee.j2eeobjectnames.NameFactory;
import org.apache.geronimo.kernel.DependencyManager;
+import org.apache.geronimo.kernel.GBeanNotFoundException;
import org.apache.geronimo.kernel.InternalKernelException;
import org.apache.geronimo.kernel.Kernel;
import org.apache.geronimo.kernel.KernelRegistry;
@@ -60,6 +61,9 @@
import org.apache.geronimo.kernel.repository.MissingDependencyException;
import org.apache.geronimo.management.geronimo.WebModule;
import org.apache.geronimo.web.info.WebAppInfo;
+import org.apache.geronimo.aries.ApplicationGBean;
+import org.osgi.framework.Bundle;
+import org.osgi.framework.BundleContext;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -299,6 +303,31 @@
}
}
}
+ } else if (info.getType() == ConfigurationModuleType.EBA) {
+ Configuration config = configManager.getConfiguration(info.getConfigID());
+ if(config != null){
+ for(Map.Entry<AbstractName, GBeanData> entry : config.getGBeans().entrySet()) {
+ if(entry.getKey().getNameProperty(NameFactory.J2EE_TYPE).equals("GBean")) {
+ try {
+ ApplicationGBean applicationGBean = (ApplicationGBean)PortletManager.getKernel().getGBean(entry.getKey());
+ long[] bundleIds = applicationGBean.getApplicationContentBundleIds();
+ BundleContext bundleContext = config.getBundleContext();
+ for (long id : bundleIds){
+ Bundle bundle = bundleContext.getBundle(id);
+ if (bundle != null && bundle.getHeaders().get("Web-ContextPath") != null){
+ details.getContextPaths().add((String)bundle.getHeaders().get("Web-ContextPath"));
+ }
+ }
+ } catch (GBeanNotFoundException e) {
+ logger.error("Configuration not found", e);
+ } catch (InternalKernelException e) {
+ logger.error("Configuration not found", e);
+ } catch (IllegalStateException e) {
+ logger.error("Configuration not found", e);
+ }
+ }
+ }
+ }
} else if (info.getType().equals(ConfigurationModuleType.CAR)) {
Configuration config = configManager.getConfiguration(info.getConfigID());
details.setClientAppServerSide(config.getOwnedConfigurations().size() > 0);
@@ -423,7 +452,8 @@
private boolean showWebInfo() {
return ConfigurationModuleType.WAR.getName().equalsIgnoreCase(moduleType) ||
- ConfigurationModuleType.EAR.getName().equalsIgnoreCase(moduleType);
+ ConfigurationModuleType.EAR.getName().equalsIgnoreCase(moduleType) ||
+ ConfigurationModuleType.EBA.getName().equalsIgnoreCase(moduleType);
}
protected void doHelp(RenderRequest renderRequest, RenderResponse renderResponse) throws PortletException, IOException {