public NetworkConnector[] getConnectorsForContainer(Object container, String protocol) {
if(protocol == null) {
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 Tomcat connectors
for (Iterator it = set.iterator(); it.hasNext();) {
AbstractName name = (AbstractName) it.next(); // a single Tomcat connector
GBeanData data = kernel.getGBeanData(name);
ReferencePatterns refs = data.getReferencePatterns(ConnectorGBean.CONNECTOR_CONTAINER_REFERENCE);
if(containerName.equals(refs.getAbstractName())) {
try {
String testProtocol = (String) kernel.getAttribute(name, "protocol");
if(testProtocol != null && testProtocol.equals(protocol)) {
results.add(mgr.createProxy(name, TomcatWebConnector.class.getClassLoader()));
}
} catch (Exception e) {
log.error("Unable to look up protocol for connector '"+name+"'",e);
}
break;