Search in sources :

Example 21 with ORB

use of org.omg.CORBA.ORB 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() {

        public void execute(DeploymentProcessorTarget processorTarget) {
            processorTarget.addDeploymentProcessor(IIOPExtension.SUBSYSTEM_NAME, Phase.DEPENDENCIES, Phase.DEPENDENCIES_JDKORB, new IIOPDependencyProcessor());
            processorTarget.addDeploymentProcessor(IIOPExtension.SUBSYSTEM_NAME, Phase.PARSE, Phase.PARSE_JDKORB, new IIOPMarkerProcessor());
        }
    }, 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(), false);
    // 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.addDependency(SECURITY_DOMAIN_SERVICE_NAME.append(securityDomain));
    // 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(SSL_CONTEXT_CAPABILITY, serverSSLContextName, SSLContext.class);
        builder.addDependency(serverContextServiceName);
    }
    final String clientSSLContextName = props.getProperty(Constants.CLIENT_SSL_CONTEXT);
    if (clientSSLContextName != null) {
        ServiceName clientContextServiceName = context.getCapabilityServiceName(SSL_CONTEXT_CAPABILITY, clientSSLContextName, SSLContext.class);
        builder.addDependency(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(AUTH_CONTEXT_CAPABILITY, authContext, AuthenticationContext.class);
        builder.addDependency(authContextServiceName);
    }
    // inject the socket bindings that specify IIOP and IIOP/SSL ports.
    String socketBinding = props.getProperty(Constants.ORB_SOCKET_BINDING);
    builder.addDependency(SocketBinding.JBOSS_BINDING_NAME.append(socketBinding), SocketBinding.class, orbService.getIIOPSocketBindingInjector());
    String sslSocketBinding = props.getProperty(Constants.ORB_SSL_SOCKET_BINDING);
    if (sslSocketBinding != null) {
        if (!sslConfigured) {
            throw IIOPLogger.ROOT_LOGGER.sslPortWithoutSslConfiguration();
        }
        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);
    final IORSecConfigMetaDataService securityConfigMetaDataService = new IORSecConfigMetaDataService(securityConfigMetaData);
    context.getServiceTarget().addService(IORSecConfigMetaDataService.SERVICE_NAME, securityConfigMetaDataService).setInitialMode(ServiceController.Mode.ACTIVE).install();
    builder.addDependency(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");
    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", 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, 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);
}
Also used : CorbaNamingService(org.wildfly.iiop.openjdk.service.CorbaNamingService) IIOPDependencyProcessor(org.wildfly.iiop.openjdk.deployment.IIOPDependencyProcessor) CorbaORBService(org.wildfly.iiop.openjdk.service.CorbaORBService) POA(org.omg.PortableServer.POA) IIOPMarkerProcessor(org.wildfly.iiop.openjdk.deployment.IIOPMarkerProcessor) CorbaPOAService(org.wildfly.iiop.openjdk.service.CorbaPOAService) Properties(java.util.Properties) IORSecurityConfigMetaData(org.jboss.metadata.ejb.jboss.IORSecurityConfigMetaData) DeploymentProcessorTarget(org.jboss.as.server.DeploymentProcessorTarget) ServiceName(org.jboss.msc.service.ServiceName) IORSecConfigMetaDataService(org.wildfly.iiop.openjdk.service.IORSecConfigMetaDataService) DelegatingStubFactoryFactory(org.wildfly.iiop.openjdk.rmi.DelegatingStubFactoryFactory) AbstractDeploymentChainStep(org.jboss.as.server.AbstractDeploymentChainStep) ORB(org.omg.CORBA.ORB)

Example 22 with ORB

use of org.omg.CORBA.ORB in project wildfly by wildfly.

the class CorbaUtils method initAppletORB.

/**
     * This method returns a new ORB instance for the given applet
     * without creating a static dependency on java.applet.
     */
private static ORB initAppletORB(Object applet, Properties orbProp) {
    try {
        Class<?> appletClass = Class.forName("java.applet.Applet", true, null);
        if (!appletClass.isInstance(applet)) {
            throw new ClassCastException(applet.getClass().getName());
        }
        // invoke the static method ORB.init(applet, orbProp);
        Method method = ORB.class.getMethod("init", appletClass, Properties.class);
        return (ORB) method.invoke(null, applet, orbProp);
    } catch (ClassNotFoundException e) {
        // non-null; so throw CCE
        throw new ClassCastException(applet.getClass().getName());
    } catch (NoSuchMethodException e) {
        throw new AssertionError(e);
    } catch (InvocationTargetException e) {
        Throwable cause = e.getCause();
        if (cause instanceof RuntimeException) {
            throw (RuntimeException) cause;
        } else if (cause instanceof Error) {
            throw (Error) cause;
        }
        throw new AssertionError(e);
    } catch (IllegalAccessException iae) {
        throw new AssertionError(iae);
    }
}
Also used : Method(java.lang.reflect.Method) ORB(org.omg.CORBA.ORB) InvocationTargetException(java.lang.reflect.InvocationTargetException)

Example 23 with ORB

use of org.omg.CORBA.ORB in project jdk8u_jdk by JetBrains.

the class SetDefaultORBTest method main.

public static void main(String[] args) {
    Properties systemProperties = System.getProperties();
    systemProperties.setProperty("org.omg.CORBA.ORBSingletonClass", "com.sun.corba.se.impl.orb.ORBSingleton");
    System.setSecurityManager(new SecurityManager());
    Properties props = new Properties();
    props.put("org.omg.CORBA.ORBClass", "com.sun.corba.se.impl.orb.ORBImpl");
    ORB orb = ORB.init(args, props);
    Class<?> orbClass = orb.getClass();
    if (orbClass.getName().equals("com.sun.corba.se.impl.orb.ORBImpl")) {
        System.out.println("orbClass is com.sun.corba.se.impl.orb.ORBimpl  as expected");
    } else {
        throw new RuntimeException("com.sun.corba.se.impl.orb.ORBimpl class expected for ORBImpl");
    }
    ORB singletonORB = ORB.init();
    Class<?> singletoneOrbClass = singletonORB.getClass();
    if (singletoneOrbClass.getName().equals("com.sun.corba.se.impl.orb.ORBSingleton")) {
        System.out.println("singeletonOrbClass is com.sun.corba.se.impl.orb.ORBSingleton  as expected");
    } else {
        throw new RuntimeException("com.sun.corba.se.impl.orb.ORBSingleton class expected for ORBSingleton");
    }
}
Also used : Properties(java.util.Properties) ORB(org.omg.CORBA.ORB)

Example 24 with ORB

use of org.omg.CORBA.ORB in project cxf by apache.

the class CorbaServerConduitTest method testPrepare.

@Test
public void testPrepare() throws Exception {
    setupServiceInfo("http://cxf.apache.org/bindings/corba/simple", "/wsdl_corbabinding/simpleIdl.wsdl", "SimpleCORBAService", "SimpleCORBAPort");
    CorbaDestination destination = new CorbaDestination(endpointInfo, orbConfig);
    CorbaServerConduit conduit = new CorbaServerConduit(endpointInfo, destination.getAddress(), targetObject, null, orbConfig, corbaTypeMap);
    CorbaMessage message = new CorbaMessage(new MessageImpl());
    try {
        conduit.prepare(message);
    } catch (Exception ex) {
        ex.printStackTrace();
    }
    OutputStream os = message.getContent(OutputStream.class);
    assertTrue("OutputStream should not be null", os != null);
    ORB orb2 = (ORB) message.get("orb");
    assertTrue("Orb should not be null", orb2 != null);
    Object obj = message.get("endpoint");
    assertTrue("EndpointReferenceType should not be null", obj != null);
    assertTrue("passed in targetObject is used", targetObject.equals(message.get(CorbaConstants.CORBA_ENDPOINT_OBJECT)));
    destination.shutdown();
}
Also used : OutputStream(java.io.OutputStream) MessageImpl(org.apache.cxf.message.MessageImpl) ORB(org.omg.CORBA.ORB) Test(org.junit.Test)

Example 25 with ORB

use of org.omg.CORBA.ORB in project cxf by apache.

the class CorbaStreamInInterceptor method handleRequest.

private void handleRequest(Message msg) {
    ORB orb;
    ServiceInfo service;
    CorbaDestination destination;
    if (msg.getDestination() != null) {
        destination = (CorbaDestination) msg.getDestination();
    } else {
        destination = (CorbaDestination) msg.getExchange().getDestination();
    }
    service = destination.getBindingInfo().getService();
    CorbaMessage message = (CorbaMessage) msg;
    Exchange exchange = message.getExchange();
    CorbaTypeMap typeMap = message.getCorbaTypeMap();
    BindingInfo bInfo = destination.getBindingInfo();
    InterfaceInfo info = bInfo.getInterface();
    String opName = exchange.get(String.class);
    Iterator<BindingOperationInfo> i = bInfo.getOperations().iterator();
    OperationType opType = null;
    BindingOperationInfo bopInfo = null;
    QName opQName = null;
    while (i.hasNext()) {
        bopInfo = i.next();
        if (bopInfo.getName().getLocalPart().equals(opName)) {
            opType = bopInfo.getExtensor(OperationType.class);
            opQName = bopInfo.getName();
            break;
        }
    }
    if (opType == null) {
        throw new RuntimeException("Couldn't find the binding operation for " + opName);
    }
    orb = exchange.get(ORB.class);
    ServerRequest request = exchange.get(ServerRequest.class);
    NVList list = prepareArguments(message, info, opType, opQName, typeMap, destination, service);
    request.arguments(list);
    message.setList(list);
    HandlerIterator paramIterator = new HandlerIterator(message, true);
    CorbaTypeEventProducer eventProducer = null;
    BindingMessageInfo msgInfo = bopInfo.getInput();
    boolean wrap = false;
    if (bopInfo.isUnwrappedCapable()) {
        wrap = true;
    }
    if (wrap) {
        // wrapper element around our args
        QName wrapperElementQName = msgInfo.getMessageInfo().getName();
        eventProducer = new WrappedParameterSequenceEventProducer(wrapperElementQName, paramIterator, service, orb);
    } else {
        eventProducer = new ParameterEventProducer(paramIterator, service, orb);
    }
    CorbaStreamReader reader = new CorbaStreamReader(eventProducer);
    message.setContent(XMLStreamReader.class, reader);
}
Also used : CorbaTypeMap(org.apache.cxf.binding.corba.CorbaTypeMap) BindingOperationInfo(org.apache.cxf.service.model.BindingOperationInfo) WrappedParameterSequenceEventProducer(org.apache.cxf.binding.corba.types.WrappedParameterSequenceEventProducer) CorbaMessage(org.apache.cxf.binding.corba.CorbaMessage) QName(javax.xml.namespace.QName) HandlerIterator(org.apache.cxf.binding.corba.types.HandlerIterator) CorbaStreamReader(org.apache.cxf.binding.corba.runtime.CorbaStreamReader) ServiceInfo(org.apache.cxf.service.model.ServiceInfo) Exchange(org.apache.cxf.message.Exchange) ParameterEventProducer(org.apache.cxf.binding.corba.types.ParameterEventProducer) CorbaDestination(org.apache.cxf.binding.corba.CorbaDestination) BindingMessageInfo(org.apache.cxf.service.model.BindingMessageInfo) BindingInfo(org.apache.cxf.service.model.BindingInfo) InterfaceInfo(org.apache.cxf.service.model.InterfaceInfo) OperationType(org.apache.cxf.binding.corba.wsdl.OperationType) CorbaTypeEventProducer(org.apache.cxf.binding.corba.types.CorbaTypeEventProducer) ServerRequest(org.omg.CORBA.ServerRequest) NVList(org.omg.CORBA.NVList) ORB(org.omg.CORBA.ORB)

Aggregations

ORB (org.omg.CORBA.ORB)66 POA (org.omg.PortableServer.POA)11 Properties (java.util.Properties)9 NamingException (javax.naming.NamingException)8 AcsProfilingORB (org.jacorb.orb.acs.AcsProfilingORB)6 Logger (java.util.logging.Logger)5 StartException (org.jboss.msc.service.StartException)4 Any (org.omg.CORBA.Any)4 ManagerImpl (com.cosylab.acs.maci.manager.ManagerImpl)3 IOException (java.io.IOException)3 MessageImpl (org.apache.cxf.message.MessageImpl)3 Test (org.junit.Test)3 Monitorlong (alma.ACS.Monitorlong)2 DAL (com.cosylab.CDB.DAL)2 HandleDataStore (com.cosylab.acs.maci.manager.HandleDataStore)2 FileWriter (java.io.FileWriter)2 OutputStream (java.io.OutputStream)2 PrintWriter (java.io.PrintWriter)2 InvocationTargetException (java.lang.reflect.InvocationTargetException)2 MalformedURLException (java.net.MalformedURLException)2