use of org.apache.cxf.endpoint.ServerRegistry in project fabric8 by jboss-fuse.
the class EnableJMXFeature method initialize.
@Override
public void initialize(Bus bus) {
List<Server> servers = new ArrayList<Server>();
ServerRegistry serverRegistry = bus.getExtension(ServerRegistry.class);
servers.addAll(serverRegistry.getServers());
for (Iterator<Server> iter = servers.iterator(); iter.hasNext(); ) {
Server server = (Server) iter.next();
ManagedApi mApi = new ManagedApi(bus, server.getEndpoint(), server);
InstrumentationManager iMgr = bus.getExtension(InstrumentationManager.class);
if (iMgr == null) {
iMgr = new InstrumentationManagerImpl(bus);
}
((InstrumentationManagerImpl) iMgr).setUsePlatformMBeanServer(true);
((InstrumentationManagerImpl) iMgr).setCreateMBServerConnectorFactory(false);
((InstrumentationManagerImpl) iMgr).setEnabled(true);
((InstrumentationManagerImpl) iMgr).init();
if (iMgr != null) {
try {
iMgr.register(mApi);
} catch (JMException jmex) {
jmex.printStackTrace();
LOG.log(Level.WARNING, "Registering ManagedApi failed.", jmex);
}
}
}
}
use of org.apache.cxf.endpoint.ServerRegistry in project tesb-rt-se by Talend.
the class LocatorRegistrarTest method addRegisteredServers.
private Bus addRegisteredServers(Bus bus, List<Server> registeredServers) {
ServerRegistry sr = createMock(ServerRegistry.class);
expect(sr.getServers()).andStubReturn(registeredServers);
expect(bus.getExtension(ServerRegistry.class)).andStubReturn(sr);
return null;
}
use of org.apache.cxf.endpoint.ServerRegistry in project tesb-rt-se by Talend.
the class SingleBusLocatorRegistrarTest method addRegisteredServers.
private Bus addRegisteredServers(Bus bus, List<Server> registeredServers) {
ServerRegistry sr = createMock(ServerRegistry.class);
expect(sr.getServers()).andStubReturn(registeredServers);
expect(bus.getExtension(ServerRegistry.class)).andStubReturn(sr);
return null;
}
use of org.apache.cxf.endpoint.ServerRegistry in project tesb-rt-se by Talend.
the class SingleBusLocatorRegistrar method registerAvailableServers.
private void registerAvailableServers() {
ServerRegistry serverRegistry = bus.getExtension(ServerRegistry.class);
List<Server> servers = serverRegistry.getServers();
for (Server server : servers) {
registerServer(server);
}
}
use of org.apache.cxf.endpoint.ServerRegistry in project tesb-rt-se by Talend.
the class AuxiliaryStorageRestServiceSecurityProvider method init.
public void init() {
if (Authentication.NO == auxiliaryStorageAuthentication) {
return;
}
// TODO: !!! find more correct way to enable/switch(?) security on provider endpoint
Bus serverBus = server.getBus();
ServerRegistry registry = serverBus.getExtension(ServerRegistry.class);
List<Server> servers = registry.getServers();
for (Server sr : servers) {
EndpointInfo ei = sr.getEndpoint().getEndpointInfo();
if (null != ei && ei.getAddress().endsWith(server.getAddress())) {
registry.unregister(sr);
sr.destroy();
}
}
@SuppressWarnings("unchecked") List<Object> providers = (List<Object>) server.getProviders();
if (Authentication.BASIC == auxiliaryStorageAuthentication) {
JAASAuthenticationFilter jaasAuthFilter = new JAASAuthenticationFilter();
jaasAuthFilter.setContextName("karaf");
providers.add(jaasAuthFilter);
server.setProviders(providers);
}
if (Authentication.SAML == auxiliaryStorageAuthentication) {
Map<String, Object> endpointProps = new HashMap<String, Object>();
endpointProps.put(SecurityConstants.SIGNATURE_PROPERTIES, signatureProperties);
endpointProps.put(SecurityConstants.SIGNATURE_USERNAME, signatureUsername);
endpointProps.put(ENDPOINT_SIGNATURE_PASSWORD, signaturePassword);
endpointProps.put(SecurityConstants.CALLBACK_HANDLER, new WSPasswordCallbackHandler(signatureUsername, signaturePassword));
Map<String, Object> properties = server.getProperties();
if (null == properties) {
properties = new HashMap<String, Object>();
}
properties.putAll(endpointProps);
server.setProperties(properties);
SamlHeaderInHandler samlHandler = new SamlHeaderInHandler();
providers.add(samlHandler);
server.setProviders(providers);
}
server.create();
}
Aggregations