You are viewing a plain text version of this content. The canonical link for it is here.
Posted to scm@geronimo.apache.org by am...@apache.org on 2006/04/06 06:00:37 UTC
svn commit: r391894 [3/3] - in /geronimo/branches/1.1:
applications/console-core/src/java/org/apache/geronimo/console/util/
applications/console-standard/src/java/org/apache/geronimo/console/databasemanager/wizard/
applications/console-standard/src/jav...
Modified: geronimo/branches/1.1/modules/management/src/java/org/apache/geronimo/management/geronimo/WebManager.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/modules/management/src/java/org/apache/geronimo/management/geronimo/WebManager.java?rev=391894&r1=391893&r2=391894&view=diff
==============================================================================
--- geronimo/branches/1.1/modules/management/src/java/org/apache/geronimo/management/geronimo/WebManager.java (original)
+++ geronimo/branches/1.1/modules/management/src/java/org/apache/geronimo/management/geronimo/WebManager.java Wed Apr 5 21:00:33 2006
@@ -16,7 +16,7 @@
*/
package org.apache.geronimo.management.geronimo;
-import org.apache.geronimo.gbean.AbstractName;
+import java.util.Map;
/**
* Specialization of NetworkManager for web containers.
@@ -29,34 +29,35 @@
public final static String PROTOCOL_AJP = "AJP";
/**
- * Gets the name of the product that this manager manages.
- */
- public String getProductName(); //todo: move into NetworkManager
-
- /**
- * Creates a new connector, and returns the ObjectName for it. Note that
- * the connector may well require further customization before being fully
- * functional (e.g. SSL settings for a secure connector). This may need
- * to be done before starting the resulting connector.
+ * Creates and returns a new web connector. Note that the connector may
+ * well require further customization before being fully functional (e.g.
+ * SSL settings for a secure connector). This may need to be done before
+ * starting the resulting connector.
*
- * @param containerName
- * @param uniqueName A name fragment that's unique to this
- * connector
- * @param protocol The protocol that the connector should use
- * @param host The host name or IP that the connector should
- * listen on
- * @param port The port that the connector should listen on
+ * @param container The container to add the connector to
+ * @param uniqueName A name fragment that's unique to this connector
+ * @param protocol The protocol that the connector should use
+ * @param host The host name or IP that the connector should listen on
+ * @param port The port that the connector should listen on
*
* @return The ObjectName of the new connector.
*/
- public AbstractName addConnector(AbstractName containerName, String uniqueName, String protocol, String host, int port);
+ public WebConnector addConnector(WebContainer container, String uniqueName, String protocol, String host, int port);
/**
- * Gets the ObjectName of the WebAccessLog implementation for a web
- * container. May be null if the access log cannot be managed.
+ * Gets the WebAccessLog implementation for a web container.
+ * May be null if the access log cannot be managed.
*
- * @param containerObjectName The ObjectName of the container whose access
+ * @param container The container whose access log is interesting
*
*/
- public AbstractName getAccessLog(String containerObjectName);
+ public WebAccessLog getAccessLog(WebContainer container);
+
+ /**
+ * Generates a Map where the keys are web container object names (as Strings)
+ * and the values are URLs (as Strings) to connect to a web app running in
+ * the matching container (though the web app context needs to be added to
+ * the end to be complete).
+ */
+ public Map mapContainersToURLs();
}
Modified: geronimo/branches/1.1/modules/security/src/java/org/apache/geronimo/security/jaas/JaasLoginModuleChain.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/modules/security/src/java/org/apache/geronimo/security/jaas/JaasLoginModuleChain.java?rev=391894&r1=391893&r2=391894&view=diff
==============================================================================
--- geronimo/branches/1.1/modules/security/src/java/org/apache/geronimo/security/jaas/JaasLoginModuleChain.java (original)
+++ geronimo/branches/1.1/modules/security/src/java/org/apache/geronimo/security/jaas/JaasLoginModuleChain.java Wed Apr 5 21:00:33 2006
@@ -21,12 +21,10 @@
*/
public interface JaasLoginModuleChain {
/**
- * Gets the ObjectName of the login module that this node in the
- * chain corresponds to (a LoginModuleGBean).
- *
- * @return The ObjectName of the login module GBean, in String form.
+ * Gets the login module that this node in the chain corresponds to
+ * (a LoginModuleGBean).
*/
- String getLoginModuleName();
+ LoginModuleSettings getLoginModule();
/**
* Gets the ObjectName of the next node in the chain after this one
@@ -35,7 +33,7 @@
* @return The ObjectName of the next node, in String form, or null
* if this is the last.
*/
- public String getNextName();
+ public JaasLoginModuleChain getNext();
/**
* The String form of the control flag for the login module at this
Modified: geronimo/branches/1.1/modules/security/src/java/org/apache/geronimo/security/jaas/JaasLoginModuleUse.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/modules/security/src/java/org/apache/geronimo/security/jaas/JaasLoginModuleUse.java?rev=391894&r1=391893&r2=391894&view=diff
==============================================================================
--- geronimo/branches/1.1/modules/security/src/java/org/apache/geronimo/security/jaas/JaasLoginModuleUse.java (original)
+++ geronimo/branches/1.1/modules/security/src/java/org/apache/geronimo/security/jaas/JaasLoginModuleUse.java Wed Apr 5 21:00:33 2006
@@ -67,7 +67,7 @@
return loginModule;
}
- public JaasLoginModuleUse getNext() {
+ public JaasLoginModuleChain getNext() {
return next;
}
Modified: geronimo/branches/1.1/modules/security/src/java/org/apache/geronimo/security/jaas/server/JaasLoginService.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/modules/security/src/java/org/apache/geronimo/security/jaas/server/JaasLoginService.java?rev=391894&r1=391893&r2=391894&view=diff
==============================================================================
--- geronimo/branches/1.1/modules/security/src/java/org/apache/geronimo/security/jaas/server/JaasLoginService.java (original)
+++ geronimo/branches/1.1/modules/security/src/java/org/apache/geronimo/security/jaas/server/JaasLoginService.java Wed Apr 5 21:00:33 2006
@@ -90,7 +90,7 @@
/**
* GBean property
*/
- public Collection getRealms() throws GeronimoSecurityException {
+ public Collection getRealms() {
return realms;
}
Modified: geronimo/branches/1.1/modules/security/src/java/org/apache/geronimo/security/jaas/server/JaasLoginServiceMBean.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/modules/security/src/java/org/apache/geronimo/security/jaas/server/JaasLoginServiceMBean.java?rev=391894&r1=391893&r2=391894&view=diff
==============================================================================
--- geronimo/branches/1.1/modules/security/src/java/org/apache/geronimo/security/jaas/server/JaasLoginServiceMBean.java (original)
+++ geronimo/branches/1.1/modules/security/src/java/org/apache/geronimo/security/jaas/server/JaasLoginServiceMBean.java Wed Apr 5 21:00:33 2006
@@ -24,6 +24,7 @@
import javax.security.auth.login.LoginException;
import org.apache.geronimo.common.GeronimoSecurityException;
+import org.apache.geronimo.management.geronimo.LoginService;
/**
@@ -32,44 +33,7 @@
*
* @version $Rev$ $Date$
*/
-public interface JaasLoginServiceMBean {
- /**
- * Return the object name of this login service.
- *
- * @return the object name of this service
- */
- public String getObjectName();
-
- /**
- * GBean property
- */
- public Collection getRealms() throws GeronimoSecurityException;
-
- /**
- * GBean property
- */
- public void setRealms(Collection realms);
-
- /**
- * GBean property
- */
- public int getMaxLoginDurationMillis();
-
- /**
- * GBean property
- */
- public void setMaxLoginDurationMillis(int maxLoginDurationMillis);
-
- /**
- * GBean property
- */
- public int getExpiredLoginScanIntervalMillis();
-
- /**
- * GBean property
- */
- public void setExpiredLoginScanIntervalMillis(int expiredLoginScanIntervalMillis);
-
+public interface JaasLoginServiceMBean extends LoginService {
/**
* Starts a new authentication process on behalf of an end user. The
* returned session id will identify that user throughout the user's interaction
Modified: geronimo/branches/1.1/modules/security/src/java/org/apache/geronimo/security/realm/GenericSecurityRealm.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/modules/security/src/java/org/apache/geronimo/security/realm/GenericSecurityRealm.java?rev=391894&r1=391893&r2=391894&view=diff
==============================================================================
--- geronimo/branches/1.1/modules/security/src/java/org/apache/geronimo/security/realm/GenericSecurityRealm.java (original)
+++ geronimo/branches/1.1/modules/security/src/java/org/apache/geronimo/security/realm/GenericSecurityRealm.java Wed Apr 5 21:00:33 2006
@@ -34,6 +34,7 @@
import org.apache.geronimo.security.jaas.server.JaasLoginModuleConfiguration;
import org.apache.geronimo.security.jaas.JaasLoginModuleUse;
import org.apache.geronimo.security.jaas.LoginModuleControlFlag;
+import org.apache.geronimo.security.jaas.JaasLoginModuleChain;
import org.apache.geronimo.security.jaas.server.JaasLoginServiceMBean;
import org.apache.geronimo.system.serverinfo.ServerInfo;
@@ -109,10 +110,8 @@
return config;
}
- public String getLoginModuleChainName() {
- //TODO configid which is correct?
-// return kernel.getAbstractNameFor(loginModuleUse).getObjectName().getCanonicalName();
- return kernel.getAbstractNameFor(loginModuleUse).toURI().toString();
+ public JaasLoginModuleChain getLoginModuleChain() {
+ return loginModuleUse;
}
/**
Modified: geronimo/branches/1.1/modules/security/src/java/org/apache/geronimo/security/realm/SecurityRealm.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/modules/security/src/java/org/apache/geronimo/security/realm/SecurityRealm.java?rev=391894&r1=391893&r2=391894&view=diff
==============================================================================
--- geronimo/branches/1.1/modules/security/src/java/org/apache/geronimo/security/realm/SecurityRealm.java (original)
+++ geronimo/branches/1.1/modules/security/src/java/org/apache/geronimo/security/realm/SecurityRealm.java Wed Apr 5 21:00:33 2006
@@ -18,22 +18,17 @@
package org.apache.geronimo.security.realm;
import org.apache.geronimo.security.jaas.server.JaasLoginModuleConfiguration;
+import org.apache.geronimo.security.jaas.JaasLoginModuleChain;
/**
* @version $Rev$ $Date$
*/
-public interface SecurityRealm {
+public interface SecurityRealm extends org.apache.geronimo.management.geronimo.SecurityRealm {
static final String BASE_OBJECT_NAME = "geronimo.security:type=SecurityRealm";
/**
- * The name of the realm, which must be unique across all realms in the
- * server.
- */
- public String getRealmName();
-
- /**
* Gets the JAAS configuration for this security realm.
*/
public JaasLoginModuleConfiguration[] getAppConfigurationEntries();
@@ -61,10 +56,8 @@
public String[] getLoginDomains();
/**
- * Gets the ObjectName of the first JaasLoginModuleChain node in the
- * chain of LoginModules for this realm.
- *
- * @return The ObjectName, in String form.
+ * Gets the first JaasLoginModuleChain node in the chain of LoginModules
+ * for this realm.
*/
- public String getLoginModuleChainName();
+ public JaasLoginModuleChain getLoginModuleChain();
}
Modified: geronimo/branches/1.1/modules/system/src/java/org/apache/geronimo/system/main/WebAppUtil.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/modules/system/src/java/org/apache/geronimo/system/main/WebAppUtil.java?rev=391894&r1=391893&r2=391894&view=diff
==============================================================================
--- geronimo/branches/1.1/modules/system/src/java/org/apache/geronimo/system/main/WebAppUtil.java (original)
+++ geronimo/branches/1.1/modules/system/src/java/org/apache/geronimo/system/main/WebAppUtil.java Wed Apr 5 21:00:33 2006
@@ -45,26 +45,9 @@
Map containers = new HashMap();
Set set = kernel.listGBeans(new AbstractNameQuery("org.apache.geronimo.management.geronimo.WebManager"));
for (Iterator it = set.iterator(); it.hasNext();) {
- AbstractName mgrName = (AbstractName) it.next();
- AbstractName[] cntNames = (AbstractName[]) kernel.getAttribute(mgrName, "containers");
- for (int i = 0; i < cntNames.length; i++) {
- AbstractName cntName = cntNames[i];
- AbstractName[] cncNames = (AbstractName[]) kernel.invoke(mgrName, "getConnectorsForContainer", new Object[]{cntName}, new String[]{AbstractName.class.getName()});
- Map map = new HashMap();
- for (int j = 0; j < cncNames.length; j++) {
- AbstractName cncName = cncNames[j];
- String protocol = (String) kernel.getAttribute(cncName, "protocol");
- String url = (String) kernel.getAttribute(cncName, "connectUrl");
- map.put(protocol, url);
- }
- String urlPrefix = "";
- if((urlPrefix = (String) map.get("HTTP")) == null) {
- if((urlPrefix = (String) map.get("HTTPS")) == null) {
- urlPrefix = (String) map.get("AJP");
- }
- }
- containers.put(cntName.getObjectName().getCanonicalName(), urlPrefix);
- }
+ AbstractName manager = (AbstractName) it.next();
+ Map results = (Map)kernel.invoke(manager, "mapContainersToURLs");
+ containers.putAll(results);
}
return containers;
}
Modified: geronimo/branches/1.1/modules/tomcat-builder/project.xml
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/modules/tomcat-builder/project.xml?rev=391894&r1=391893&r2=391894&view=diff
==============================================================================
--- geronimo/branches/1.1/modules/tomcat-builder/project.xml (original)
+++ geronimo/branches/1.1/modules/tomcat-builder/project.xml Wed Apr 5 21:00:33 2006
@@ -182,6 +182,12 @@
<dependency>
<groupId>geronimo</groupId>
+ <artifactId>geronimo-core</artifactId>
+ <version>${pom.currentVersion}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>geronimo</groupId>
<artifactId>geronimo-system</artifactId>
<version>${pom.currentVersion}</version>
</dependency>
Modified: geronimo/branches/1.1/modules/tomcat/src/java/org/apache/geronimo/tomcat/TomcatManagerImpl.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/modules/tomcat/src/java/org/apache/geronimo/tomcat/TomcatManagerImpl.java?rev=391894&r1=391893&r2=391894&view=diff
==============================================================================
--- geronimo/branches/1.1/modules/tomcat/src/java/org/apache/geronimo/tomcat/TomcatManagerImpl.java (original)
+++ geronimo/branches/1.1/modules/tomcat/src/java/org/apache/geronimo/tomcat/TomcatManagerImpl.java Wed Apr 5 21:00:33 2006
@@ -26,10 +26,15 @@
import org.apache.geronimo.gbean.ReferencePatterns;
import org.apache.geronimo.kernel.GBeanNotFoundException;
import org.apache.geronimo.kernel.Kernel;
+import org.apache.geronimo.kernel.proxy.ProxyManager;
import org.apache.geronimo.kernel.config.ConfigurationUtil;
import org.apache.geronimo.kernel.config.EditableConfigurationManager;
import org.apache.geronimo.kernel.config.InvalidConfigException;
import org.apache.geronimo.management.geronimo.WebManager;
+import org.apache.geronimo.management.geronimo.NetworkConnector;
+import org.apache.geronimo.management.geronimo.WebContainer;
+import org.apache.geronimo.management.geronimo.WebConnector;
+import org.apache.geronimo.management.geronimo.WebAccessLog;
import org.apache.geronimo.system.serverinfo.ServerInfo;
import org.apache.geronimo.j2ee.j2eeobjectnames.NameFactory;
@@ -37,12 +42,14 @@
import java.util.Iterator;
import java.util.List;
import java.util.Set;
+import java.util.Map;
+import java.util.HashMap;
/**
* Tomcat implementation of the WebManager management API. Knows how to
* manipulate other Tomcat objects for management purposes.
*
- * @version $Rev: 385487 $ $Date$
+ * @version $Rev$ $Date$
*/
public class TomcatManagerImpl implements WebManager {
private final static Log log = LogFactory.getLog(TomcatManagerImpl.class);
@@ -57,18 +64,19 @@
}
/**
- * Creates a new connector, and returns the ObjectName for it. Note that the connector may well require further
- * customization before being fully functional (e.g. SSL settings for a secure connector). This may need to be done
- * before starting the resulting connector.
+ * Creates and returns a new connector. Note that the connector may well
+ * require further customization before being fully functional (e.g. SSL
+ * settings for a secure connector). This may need to be done before
+ * starting the resulting connector.
*
- * @param containerName
- * @param uniqueName A name fragment that's unique to this connector
- * @param protocol The protocol that the connector should use
- * @param host The host name or IP that the connector should listen on
- * @param port The port that the connector should listen on
- * @return The ObjectName of the new connector.
+ * @param container The container to add the connector to
+ * @param uniqueName A name fragment that's unique to this connector
+ * @param protocol The protocol that the connector should use
+ * @param host The host name or IP that the connector should listen on
+ * @param port The port that the connector should listen on
*/
- public AbstractName addConnector(AbstractName containerName, String uniqueName, String protocol, String host, int port) {
+ public WebConnector addConnector(WebContainer container, String uniqueName, String protocol, String host, int port) {
+ AbstractName containerName = kernel.getAbstractNameFor(container);
AbstractName name = kernel.getNaming().createChildName(containerName, "TomcatWebConnector-" + protocol + "-" + uniqueName, NameFactory.GERONIMO_SERVICE);
GBeanData connector;
if(protocol.equals(PROTOCOL_HTTP)) {
@@ -95,7 +103,7 @@
if(mgr != null) {
try {
mgr.addGBeanToConfiguration(containerName.getArtifact(), connector, false);
- return name;
+ return (WebConnector) kernel.getProxyManager().createProxy(name, TomcatWebConnector.class.getClassLoader());
} catch (InvalidConfigException e) {
log.error("Unable to add GBean", e);
return null;
@@ -111,10 +119,17 @@
/**
* Gets the network containers.
*/
- public AbstractName[] getContainers() {
+ public Object[] getContainers() {
+ ProxyManager proxyManager = kernel.getProxyManager();
AbstractNameQuery query = new AbstractNameQuery(TomcatWebContainer.class.getName());
Set names = kernel.listGBeans(query);
- return (AbstractName[]) names.toArray(new AbstractName[names.size()]);
+ TomcatWebContainer[] results = new TomcatWebContainer[names.size()];
+ int i=0;
+ for (Iterator it = names.iterator(); it.hasNext(); i++) {
+ AbstractName name = (AbstractName) it.next();
+ results[i] = (TomcatWebContainer) proxyManager.createProxy(name, TomcatWebContainer.class.getClassLoader());
+ }
+ return results;
}
/**
@@ -167,67 +182,78 @@
*
* @param protocol A protocol as returned by getSupportedProtocols
*/
- public AbstractName[] getConnectors(String protocol) {
+ public NetworkConnector[] getConnectors(String protocol) {
+ if(protocol == null) {
+ return getConnectors();
+ }
+ List result = new ArrayList();
+ ProxyManager proxyManager = kernel.getProxyManager();
AbstractNameQuery query = new AbstractNameQuery(TomcatWebConnector.class.getName());
Set names = kernel.listGBeans(query);
- List result = new ArrayList();
for (Iterator it = names.iterator(); it.hasNext();) {
AbstractName name = (AbstractName) it.next();
try {
if (kernel.getAttribute(name, "protocol").equals(protocol)) {
- result.add(name);
+ result.add(proxyManager.createProxy(name, TomcatWebConnector.class.getClassLoader()));
}
} catch (Exception e) {
log.error("Unable to check the protocol for a connector", e);
}
}
- return (AbstractName[]) result.toArray(new AbstractName[result.size()]);
+ return (TomcatWebConnector[]) result.toArray(new TomcatWebConnector[names.size()]);
}
- public AbstractName getAccessLog(String containerObjectName) {
+ public WebAccessLog getAccessLog(WebContainer container) {
AbstractNameQuery query = new AbstractNameQuery(TomcatLogManager.class.getName());
Set names = kernel.listGBeans(query);
if(names.size() == 0) {
return null;
} else if(names.size() > 1) {
- throw new IllegalStateException("Should not be more than one Jetty access log manager");
+ throw new IllegalStateException("Should not be more than one Tomcat access log manager");
}
- return (AbstractName)names.iterator().next();
+ return (WebAccessLog) kernel.getProxyManager().createProxy((AbstractName)names.iterator().next(), TomcatLogManager.class.getClassLoader());
}
/**
* Gets the ObjectNames of any existing connectors associated with this network technology.
*/
- public AbstractName[] getConnectors() {
+ public NetworkConnector[] getConnectors() {
+ ProxyManager proxyManager = kernel.getProxyManager();
AbstractNameQuery query = new AbstractNameQuery(TomcatWebConnector.class.getName());
Set names = kernel.listGBeans(query);
- return (AbstractName[]) names.toArray(new AbstractName[names.size()]);
+ TomcatWebConnector[] results = new TomcatWebConnector[names.size()];
+ int i=0;
+ for (Iterator it = names.iterator(); it.hasNext(); i++) {
+ AbstractName name = (AbstractName) it.next();
+ results[i] = (TomcatWebConnector) proxyManager.createProxy(name, TomcatWebConnector.class.getClassLoader());
+ }
+ return results;
}
/**
* Gets the ObjectNames of any existing connectors for the specified container for the specified protocol.
*
- * @param containerName
* @param protocol A protocol as returned by getSupportedProtocols
*/
- public AbstractName[] getConnectorsForContainer(AbstractName containerName, String protocol) {
+ public NetworkConnector[] getConnectorsForContainer(Object container, String protocol) {
if(protocol == null) {
- return getConnectorsForContainer(containerName);
+ return getConnectorsForContainer(container);
}
+ AbstractName containerName = kernel.getAbstractNameFor(container);
+ ProxyManager mgr = kernel.getProxyManager();
try {
List results = new ArrayList();
AbstractNameQuery query = new AbstractNameQuery(TomcatWebConnector.class.getName());
- Set set = kernel.listGBeans(query); // all Jetty connectors
+ Set set = kernel.listGBeans(query); // all Tomcat connectors
for (Iterator it = set.iterator(); it.hasNext();) {
- AbstractName name = (AbstractName) it.next(); // a single Jetty connector
+ AbstractName name = (AbstractName) it.next(); // a single Tomcat connector
GBeanData data = kernel.getGBeanData(name);
ReferencePatterns refs = data.getReferencePatterns(ConnectorGBean.CONNECTOR_CONTAINER_REFERENCE);
- //TODO configid need to verify that the refpattern is resolved
if(containerName.equals(refs.getAbstractName())) {
try {
String testProtocol = (String) kernel.getAttribute(name, "protocol");
if(testProtocol != null && testProtocol.equals(protocol)) {
- results.add(name);
+ results.add(mgr.createProxy(name, TomcatWebConnector.class.getClassLoader()));
}
} catch (Exception e) {
log.error("Unable to look up protocol for connector '"+name+"'",e);
@@ -235,34 +261,58 @@
break;
}
}
- return (AbstractName[]) results.toArray(new AbstractName[results.size()]);
+ return (TomcatWebConnector[]) results.toArray(new TomcatWebConnector[results.size()]);
} catch (Exception e) {
- throw new IllegalArgumentException("Unable to look up connectors for Jetty container '"+containerName +"': "+e);
+ throw (IllegalArgumentException)new IllegalArgumentException("Unable to look up connectors for Tomcat container '"+containerName +"': ").initCause(e);
}
}
/**
* Gets the ObjectNames of any existing connectors for the specified container.
- * @param containerName
*/
- public AbstractName[] getConnectorsForContainer(AbstractName containerName) {
+ public NetworkConnector[] getConnectorsForContainer(Object container) {
+ AbstractName containerName = kernel.getAbstractNameFor(container);
+ ProxyManager mgr = kernel.getProxyManager();
try {
List results = new ArrayList();
AbstractNameQuery query = new AbstractNameQuery(TomcatWebConnector.class.getName());
- Set set = kernel.listGBeans(query); // all Jetty connectors
+ Set set = kernel.listGBeans(query); // all Tomcat connectors
for (Iterator it = set.iterator(); it.hasNext();) {
- AbstractName name = (AbstractName) it.next(); // a single Jetty connector
+ AbstractName name = (AbstractName) it.next(); // a single Tomcat connector
GBeanData data = kernel.getGBeanData(name);
ReferencePatterns refs = data.getReferencePatterns(ConnectorGBean.CONNECTOR_CONTAINER_REFERENCE);
- //TODO configid need to verify that the refpattern is resolved
if (containerName.equals(refs.getAbstractName())) {
- results.add(name);
+ results.add(mgr.createProxy(name, TomcatWebConnector.class.getClassLoader()));
}
}
- return (AbstractName[]) results.toArray(new AbstractName[results.size()]);
+ return (TomcatWebConnector[]) results.toArray(new TomcatWebConnector[results.size()]);
} catch (Exception e) {
- throw new IllegalArgumentException("Unable to look up connectors for Tomcat container '"+containerName +"': "+e);
+ throw (IllegalArgumentException) new IllegalArgumentException("Unable to look up connectors for Tomcat container '"+containerName).initCause(e);
+ }
+ }
+
+ public Map mapContainersToURLs() {
+ WebContainer[] webContainers = (WebContainer[]) getContainers();
+ Map results = new HashMap();
+ for (int i = 0; i < webContainers.length; i++) {
+ WebContainer container = webContainers[i];
+ WebConnector[] connectors = (WebConnector[]) getConnectorsForContainer(container);
+ Map map = new HashMap();
+ for (int j = 0; j < connectors.length; j++) {
+ WebConnector connector = connectors[j];
+ String protocol = connector.getProtocol();
+ String url = connector.getConnectUrl();
+ map.put(protocol, url);
+ }
+ String urlPrefix;
+ if((urlPrefix = (String) map.get("HTTP")) == null) {
+ if((urlPrefix = (String) map.get("HTTPS")) == null) {
+ urlPrefix = (String) map.get("AJP");
+ }
+ }
+ results.put(kernel.getAbstractNameFor(container).getObjectName().getCanonicalName(), urlPrefix);
}
+ return results;
}
public static final GBeanInfo GBEAN_INFO;