Java Code Examples for org.omg.CORBA.ORB#init()

The following examples show how to use org.omg.CORBA.ORB#init() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: SetDefaultORBTest.java    From jdk8u_jdk with GNU General Public License v2.0 6 votes vote down vote up
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");
    }
}
 
Example 2
Source File: SetDefaultORBTest.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 6 votes vote down vote up
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");
    }
}
 
Example 3
Source File: CorbaBindingHelper.java    From cxf with Apache License 2.0 6 votes vote down vote up
public static synchronized ORB getDefaultORB(OrbConfig config) {
    if (defaultORB == null) {
        Properties props = System.getProperties();
        Properties configSpecifiedOrbProperties = config.getOrbProperties();
        props.putAll(configSpecifiedOrbProperties);
        if (config.getOrbClass() != null) {
            props.put("org.omg.CORBA.ORBClass", config.getOrbClass());
        }
        if (config.getOrbSingletonClass() != null) {
            props.put("org.omg.CORBA.ORBSingletonClass", config.getOrbSingletonClass());
        }
        List<String> orbArgs = config.getOrbArgs();
        defaultORB = ORB.init(orbArgs.toArray(new String[0]), props);
        if (defaultORB == null) {
            LOG.severe("Could not create instance of the ORB");
            throw new CorbaBindingException("Could not create instance of the ORB");
        }
    }
    return defaultORB;
}
 
Example 4
Source File: SetDefaultORBTest.java    From jdk8u-dev-jdk with GNU General Public License v2.0 6 votes vote down vote up
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");
    }
}
 
Example 5
Source File: SetDefaultORBTest.java    From jdk8u-jdk with GNU General Public License v2.0 6 votes vote down vote up
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");
    }
}
 
Example 6
Source File: CorbaAnyHandlerTest.java    From cxf with Apache License 2.0 5 votes vote down vote up
@Before
public void setUp() throws Exception {

    java.util.Properties props = System.getProperties();
    props.put("yoko.orb.id", "CXF-CORBA-Server-Binding");
    orb = ORB.init(new String[0], props);
}
 
Example 7
Source File: ServerMain.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
private void registerCallback( Class serverClass )
{
    Method installMethod = getNamedMethod( serverClass, "install" ) ;
    Method uninstallMethod = getNamedMethod( serverClass, "uninstall" ) ;
    Method shutdownMethod = getNamedMethod( serverClass, "shutdown" ) ;

    Properties props = new Properties() ;
    props.put( "org.omg.CORBA.ORBClass",
        "com.sun.corba.se.impl.orb.ORBImpl" ) ;
    // NOTE: Very important to pass this property, otherwise the
    // Persistent Server registration will be unsucessfull.
    props.put( ORBConstants.ACTIVATED_PROPERTY, "false" );
    String args[] = null ;
    ORB orb = ORB.init( args, props ) ;

    ServerCallback serverObj = new ServerCallback( orb,
        installMethod, uninstallMethod, shutdownMethod ) ;

    int serverId = getServerId() ;

    try {
        Activator activator = ActivatorHelper.narrow(
            orb.resolve_initial_references( ORBConstants.SERVER_ACTIVATOR_NAME ));
        activator.active(serverId, serverObj);
    } catch (Exception ex) {
        logTerminal( "exception " + ex.getMessage(),
            REGISTRATION_FAILED ) ;
    }
}
 
Example 8
Source File: ServerMain.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
private void registerCallback( Class serverClass )
{
    Method installMethod = getNamedMethod( serverClass, "install" ) ;
    Method uninstallMethod = getNamedMethod( serverClass, "uninstall" ) ;
    Method shutdownMethod = getNamedMethod( serverClass, "shutdown" ) ;

    Properties props = new Properties() ;
    props.put( "org.omg.CORBA.ORBClass",
        "com.sun.corba.se.impl.orb.ORBImpl" ) ;
    // NOTE: Very important to pass this property, otherwise the
    // Persistent Server registration will be unsucessfull.
    props.put( ORBConstants.ACTIVATED_PROPERTY, "false" );
    String args[] = null ;
    ORB orb = ORB.init( args, props ) ;

    ServerCallback serverObj = new ServerCallback( orb,
        installMethod, uninstallMethod, shutdownMethod ) ;

    int serverId = getServerId() ;

    try {
        Activator activator = ActivatorHelper.narrow(
            orb.resolve_initial_references( ORBConstants.SERVER_ACTIVATOR_NAME ));
        activator.active(serverId, serverObj);
    } catch (Exception ex) {
        logTerminal( "exception " + ex.getMessage(),
            REGISTRATION_FAILED ) ;
    }
}
 
Example 9
Source File: OrbFactory.java    From tomee with Apache License 2.0 5 votes vote down vote up
public ORB create() {
    ORB orb = SystemInstance.get().getComponent(ORB.class);
    if (orb == null) {
        // todo add support for args and properties
        orb = ORB.init();
        SystemInstance.get().setComponent(ORB.class, orb);
    }
    return orb;
}
 
Example 10
Source File: ServerMain.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
private void registerCallback( Class serverClass )
{
    Method installMethod = getNamedMethod( serverClass, "install" ) ;
    Method uninstallMethod = getNamedMethod( serverClass, "uninstall" ) ;
    Method shutdownMethod = getNamedMethod( serverClass, "shutdown" ) ;

    Properties props = new Properties() ;
    props.put( "org.omg.CORBA.ORBClass",
        "com.sun.corba.se.impl.orb.ORBImpl" ) ;
    // NOTE: Very important to pass this property, otherwise the
    // Persistent Server registration will be unsucessfull.
    props.put( ORBConstants.ACTIVATED_PROPERTY, "false" );
    String args[] = null ;
    ORB orb = ORB.init( args, props ) ;

    ServerCallback serverObj = new ServerCallback( orb,
        installMethod, uninstallMethod, shutdownMethod ) ;

    int serverId = getServerId() ;

    try {
        Activator activator = ActivatorHelper.narrow(
            orb.resolve_initial_references( ORBConstants.SERVER_ACTIVATOR_NAME ));
        activator.active(serverId, serverObj);
    } catch (Exception ex) {
        logTerminal( "exception " + ex.getMessage(),
            REGISTRATION_FAILED ) ;
    }
}
 
Example 11
Source File: OrbPropertiesTest.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
public static void main(String[] args) throws Exception {
    updateOrbPropertiesFile();
    // create and initialize the ORB
    ORB orb = ORB.init(args, null);
    if (!(orb instanceof TestOrbImpl)) {
        throw new RuntimeException("org.omg.CORBA.ORBClass property not set as expected");
    }
    ORB singletonOrb = ORB.init();
    System.out.println("singletonOrb class == " + singletonOrb.getClass().getName());
    if (!(singletonOrb instanceof TestSingletonOrbImpl)) {
        throw new RuntimeException("org.omg.CORBA.ORBSingletonClass property not set as expected");
    }

}
 
Example 12
Source File: IIOPProxyImpl.java    From jdk8u-jdk with GNU General Public License v2.0 4 votes vote down vote up
@Override
public Object createOrb(String[] args, Properties props) {
    return ORB.init(args, props);
}
 
Example 13
Source File: IIOPProxyImpl.java    From openjdk-jdk8u with GNU General Public License v2.0 4 votes vote down vote up
@Override
public Object createOrb(String[] args, Properties props) {
    return ORB.init(args, props);
}
 
Example 14
Source File: CorbaEnumHandlerTest.java    From cxf with Apache License 2.0 4 votes vote down vote up
@Before
public void setUp() throws Exception {
    java.util.Properties props = System.getProperties();
    props.put("yoko.orb.id", "CXF-CORBA-Server-Binding");
    orb = ORB.init(new String[0], props);
}
 
Example 15
Source File: IIOPProxyImpl.java    From JDKSourceCode1.8 with MIT License 4 votes vote down vote up
@Override
public Object createOrb(String[] args, Properties props) {
    return ORB.init(args, props);
}
 
Example 16
Source File: CorbaPrimitiveHandlerTest.java    From cxf with Apache License 2.0 4 votes vote down vote up
@Before
public void setUp() throws Exception {
    java.util.Properties props = System.getProperties();
    props.put("yoko.orb.id", "CXF-CORBA-Server-Binding");
    orb = ORB.init(new String[0], props);
}
 
Example 17
Source File: IIOPProxyImpl.java    From jdk8u-jdk with GNU General Public License v2.0 4 votes vote down vote up
@Override
public Object createOrb(String[] args, Properties props) {
    return ORB.init(args, props);
}
 
Example 18
Source File: IIOPProxyImpl.java    From openjdk-8 with GNU General Public License v2.0 4 votes vote down vote up
@Override
public Object createOrb(String[] args, Properties props) {
    return ORB.init(args, props);
}
 
Example 19
Source File: ServerTool.java    From hottub with GNU General Public License v2.0 4 votes vote down vote up
void run(String[] args)
{
    String[] cmd = null;

    // if command specified in the args, get it
    for (int i=0; i < args.length; i++) {

        if (args[i].equals(commandArg)) {
            // get the command
            int cmdLen = args.length - i - 1;
            cmd = new String[cmdLen];
            for (int j=0; j < cmdLen; j++) cmd[j] = args[++i];

            break;
        }
    }

    try {
        // create the POA ORB
        Properties props = System.getProperties() ;
        props.put("org.omg.CORBA.ORBClass",
            "com.sun.corba.se.impl.orb.ORBImpl" );
        orb = (ORB) ORB.init(args, props);

        // if command specified in the args, process it
        if (cmd != null)  executeCommand(cmd);
        else { // process commands interactively

            // create a buffered reader to read commands from standard in
            BufferedReader in = new
                BufferedReader(new InputStreamReader(System.in));

            // print tool banner
            System.out.println(CorbaResourceUtil.getText("servertool.banner"));

            // process commands until user quits
            while (true) {
                cmd = readCommand(in);
                if (cmd != null) executeCommand(cmd);
                else printAvailableCommands();
            }
        }
    } catch (Exception ex) {
        System.out.println(CorbaResourceUtil.getText("servertool.usage", "servertool"));
        System.out.println();
        ex.printStackTrace();
    }
}
 
Example 20
Source File: CorbaConduitTest.java    From cxf with Apache License 2.0 3 votes vote down vote up
@Before
public void setUp() throws Exception {
    control = EasyMock.createNiceControl();

    bus = BusFactory.getDefaultBus();

    java.util.Properties props = System.getProperties();


    props.put("yoko.orb.id", "CXF-CORBA-Server-Binding");
    orb = ORB.init(new String[0], props);
    orbConfig = new OrbConfig();
}