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(JettyWebConnector.class.getName());
Set set = kernel.listGBeans(query); // all Jetty connectors
for (Iterator it = set.iterator(); it.hasNext();) {
AbstractName name = (AbstractName) it.next(); // a single Jetty connector
GBeanData data = kernel.getGBeanData(name);
ReferencePatterns refs = data.getReferencePatterns(JettyConnector.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, JettyWebConnector.class.getClassLoader()));
}
} catch (Exception e) {
log.error("Unable to look up protocol for connector '" + name + "'", e);
}
break;