use of org.wildfly.iiop.openjdk.service.CorbaORBService in project wildfly by wildfly.
the class IIOPSubsystemAdd method launchServices.
protected void launchServices(final OperationContext context, final ModelNode model) throws OperationFailedException {
IIOPLogger.ROOT_LOGGER.activatingSubsystem();
// set the ORBUseDynamicStub system property.
WildFlySecurityManager.setPropertyPrivileged("org.jboss.com.sun.CORBA.ORBUseDynamicStub", "true");
// we set the same stub factory to both the static and dynamic stub factory. As there is no way to dynamically change
// the userDynamicStubs's property at runtime it is possible for the ORB class's <clinit> method to be
// called before this property is set.
// TODO: investigate a better way to handle this
com.sun.corba.se.spi.orb.ORB.getPresentationManager().setStubFactoryFactory(true, new DelegatingStubFactoryFactory());
com.sun.corba.se.spi.orb.ORB.getPresentationManager().setStubFactoryFactory(false, new DelegatingStubFactoryFactory());
// setup naming.
InitialContext.addUrlContextFactory("corbaloc", JBossCNCtxFactory.INSTANCE);
InitialContext.addUrlContextFactory("corbaname", JBossCNCtxFactory.INSTANCE);
InitialContext.addUrlContextFactory("IOR", JBossCNCtxFactory.INSTANCE);
InitialContext.addUrlContextFactory("iiopname", JBossCNCtxFactory.INSTANCE);
InitialContext.addUrlContextFactory("iiop", JBossCNCtxFactory.INSTANCE);
context.addStep(new AbstractDeploymentChainStep() {
@Override
public void execute(DeploymentProcessorTarget processorTarget) {
processorTarget.addDeploymentProcessor(IIOPExtension.SUBSYSTEM_NAME, Phase.DEPENDENCIES, Phase.DEPENDENCIES_IIOP_OPENJDK, new IIOPDependencyProcessor());
processorTarget.addDeploymentProcessor(IIOPExtension.SUBSYSTEM_NAME, Phase.PARSE, Phase.PARSE_IIOP_OPENJDK, new IIOPMarkerProcessor());
processorTarget.addDeploymentProcessor(IIOPExtension.SUBSYSTEM_NAME, Phase.INSTALL, Phase.INSTALL_IIOP_CLEAR_CACHES, new IIOPClearCachesProcessor());
}
}, OperationContext.Stage.RUNTIME);
// get the configured ORB properties.
Properties props = this.getConfigurationProperties(context, model);
// setup the ORB initializers using the configured properties.
this.setupInitializers(props);
// setup the SSL socket factories, if necessary.
final boolean sslConfigured = this.setupSSLFactories(props);
// create the service that initializes and starts the CORBA ORB.
CorbaORBService orbService = new CorbaORBService(props);
final ServiceBuilder<ORB> builder = context.getServiceTarget().addService(CorbaORBService.SERVICE_NAME, orbService);
org.jboss.as.server.Services.addServerExecutorDependency(builder, orbService.getExecutorInjector());
// if a security domain has been specified, add a dependency to the domain service.
String securityDomain = props.getProperty(Constants.SECURITY_SECURITY_DOMAIN);
if (securityDomain != null) {
builder.requires(context.getCapabilityServiceName(Capabilities.LEGACY_SECURITY_DOMAIN_CAPABILITY, securityDomain, null));
builder.requires(DefaultNamespaceContextSelectorService.SERVICE_NAME);
}
// add dependencies to the ssl context services if needed.
final String serverSSLContextName = props.getProperty(Constants.SERVER_SSL_CONTEXT);
if (serverSSLContextName != null) {
ServiceName serverContextServiceName = context.getCapabilityServiceName(Capabilities.SSL_CONTEXT_CAPABILITY, serverSSLContextName, SSLContext.class);
builder.requires(serverContextServiceName);
}
final String clientSSLContextName = props.getProperty(Constants.CLIENT_SSL_CONTEXT);
if (clientSSLContextName != null) {
ServiceName clientContextServiceName = context.getCapabilityServiceName(Capabilities.SSL_CONTEXT_CAPABILITY, clientSSLContextName, SSLContext.class);
builder.requires(clientContextServiceName);
}
// if an authentication context has ben specified, add a dependency to its service.
final String authContext = props.getProperty(Constants.ORB_INIT_AUTH_CONTEXT);
if (authContext != null) {
ServiceName authContextServiceName = context.getCapabilityServiceName(Capabilities.AUTH_CONTEXT_CAPABILITY, authContext, AuthenticationContext.class);
builder.requires(authContextServiceName);
}
final boolean serverRequiresSsl = IIOPRootDefinition.SERVER_REQUIRES_SSL.resolveModelAttribute(context, model).asBoolean();
// inject the socket bindings that specify IIOP and IIOP/SSL ports.
String socketBinding = props.getProperty(Constants.ORB_SOCKET_BINDING);
if (socketBinding != null) {
if (!serverRequiresSsl) {
builder.addDependency(SocketBinding.JBOSS_BINDING_NAME.append(socketBinding), SocketBinding.class, orbService.getIIOPSocketBindingInjector());
} else {
IIOPLogger.ROOT_LOGGER.wontUseCleartextSocket();
}
}
String sslSocketBinding = props.getProperty(Constants.ORB_SSL_SOCKET_BINDING);
if (sslSocketBinding != null) {
builder.addDependency(SocketBinding.JBOSS_BINDING_NAME.append(sslSocketBinding), SocketBinding.class, orbService.getIIOPSSLSocketBindingInjector());
}
// create the IOR security config metadata service.
final IORSecurityConfigMetaData securityConfigMetaData = this.createIORSecurityConfigMetaData(context, model, sslConfigured, serverRequiresSsl);
final IORSecConfigMetaDataService securityConfigMetaDataService = new IORSecConfigMetaDataService(securityConfigMetaData);
context.getServiceTarget().addService(IORSecConfigMetaDataService.SERVICE_NAME, securityConfigMetaDataService).setInitialMode(ServiceController.Mode.ACTIVE).install();
builder.requires(IORSecConfigMetaDataService.SERVICE_NAME);
// set the initial mode and install the service.
builder.setInitialMode(ServiceController.Mode.ACTIVE).install();
// create the service the initializes the Root POA.
CorbaPOAService rootPOAService = new CorbaPOAService("RootPOA", "poa", serverRequiresSsl);
context.getServiceTarget().addService(CorbaPOAService.ROOT_SERVICE_NAME, rootPOAService).addDependency(CorbaORBService.SERVICE_NAME, ORB.class, rootPOAService.getORBInjector()).setInitialMode(ServiceController.Mode.ACTIVE).install();
// create the service the initializes the interface repository POA.
final CorbaPOAService irPOAService = new CorbaPOAService("IRPOA", "irpoa", serverRequiresSsl, IdAssignmentPolicyValue.USER_ID, null, null, LifespanPolicyValue.PERSISTENT, null, null, null);
context.getServiceTarget().addService(CorbaPOAService.INTERFACE_REPOSITORY_SERVICE_NAME, irPOAService).addDependency(CorbaPOAService.ROOT_SERVICE_NAME, POA.class, irPOAService.getParentPOAInjector()).setInitialMode(ServiceController.Mode.ACTIVE).install();
// create the service that initializes the naming service POA.
final CorbaPOAService namingPOAService = new CorbaPOAService("Naming", null, serverRequiresSsl, IdAssignmentPolicyValue.USER_ID, null, null, LifespanPolicyValue.PERSISTENT, null, null, null);
context.getServiceTarget().addService(CorbaPOAService.SERVICE_NAME.append("namingpoa"), namingPOAService).addDependency(CorbaPOAService.ROOT_SERVICE_NAME, POA.class, namingPOAService.getParentPOAInjector()).setInitialMode(ServiceController.Mode.ACTIVE).install();
// create the CORBA naming service.
final CorbaNamingService namingService = new CorbaNamingService(props);
context.getServiceTarget().addService(CorbaNamingService.SERVICE_NAME, namingService).addDependency(CorbaORBService.SERVICE_NAME, ORB.class, namingService.getORBInjector()).addDependency(CorbaPOAService.ROOT_SERVICE_NAME, POA.class, namingService.getRootPOAInjector()).addDependency(CorbaPOAService.SERVICE_NAME.append("namingpoa"), POA.class, namingService.getNamingPOAInjector()).setInitialMode(ServiceController.Mode.ACTIVE).install();
configureClientSecurity(props);
}
Aggregations