Java Code Examples for org.omg.CORBA.ORB

The following are top voted examples for showing how to use org.omg.CORBA.ORB. These examples are extracted from open source projects. You can vote up the examples you like and your votes will be used in our system to generate more good examples.
Example 1
Project: OpenJSharp   File: ServerMain.java   View source code 6 votes vote down vote up
private Method getNamedMethod( Class serverClass, String methodName )
{
    Class argTypes[] = new Class[] { org.omg.CORBA.ORB.class } ;
    Method method = null ;

    try {
        method = serverClass.getDeclaredMethod( methodName, argTypes ) ;
    } catch (Exception exc) {
        return null ;
    }

    if (!isPublicStaticVoid( method ))
        return null ;

    return method ;
}
 
Example 2
Project: OpenJSharp   File: ServerTool.java   View source code 6 votes vote down vote up
public boolean processCommand( String[] cmdArgs, ORB orb, PrintStream out )
{
    if ((cmdArgs.length == 2) && cmdArgs[0].equals( "-applicationName" )) {
        String str = (String)cmdArgs[1] ;

        try {
            Repository repository = RepositoryHelper.narrow(
                orb.resolve_initial_references( ORBConstants.SERVER_REPOSITORY_NAME ));

            try {
                int result = repository.getServerID( str ) ;
                out.println() ;
                out.println(CorbaResourceUtil.getText("servertool.getserverid2", str, Integer.toString(result)));
                out.println() ;
            } catch (ServerNotRegistered e) {
                out.println(CorbaResourceUtil.getText("servertool.nosuchserver"));
            }
        } catch (Exception ex) {
            ex.printStackTrace() ;
        }

        return commandDone ;
    } else
        return parseError ;
}
 
Example 3
Project: OpenJSharp   File: ServerTool.java   View source code 6 votes vote down vote up
public boolean processCommand(String[] cmdArgs, ORB orb, PrintStream out)
{
    try {
        Repository repository = RepositoryHelper.narrow(
            orb.resolve_initial_references( ORBConstants.SERVER_REPOSITORY_NAME ));

        String[] applicationNames = repository.getApplicationNames();

        out.println(CorbaResourceUtil.getText("servertool.listappnames2"));
        out.println();
        for (int i=0; i < applicationNames.length; i++)
            out.println( "\t" + applicationNames[i] ) ;
    } catch (Exception ex) {
        ex.printStackTrace();
    }

    return commandDone;
}
 
Example 4
Project: openjdk-jdk10   File: SetDefaultORBTest.java   View source code 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
Project: OpenJSharp   File: TransientNamingContext.java   View source code 6 votes vote down vote up
/**
 * Constructs a new TransientNamingContext object.
 * @param orb an orb object.
 * @param initial the initial naming context.
 * @exception Exception a Java exception thrown of the base class cannot
 * initialize.
 */
public TransientNamingContext(com.sun.corba.se.spi.orb.ORB orb,
    org.omg.CORBA.Object initial,
    POA nsPOA )
    throws java.lang.Exception
{
    super(orb, nsPOA );
    wrapper = NamingSystemException.get( orb, CORBALogDomains.NAMING ) ;

    this.localRoot = initial;
    readLogger = orb.getLogger( CORBALogDomains.NAMING_READ);
    updateLogger = orb.getLogger( CORBALogDomains.NAMING_UPDATE);
    lifecycleLogger = orb.getLogger(
        CORBALogDomains.NAMING_LIFECYCLE);
    lifecycleLogger.fine( "Root TransientNamingContext LIFECYCLE.CREATED" );
}
 
Example 6
Project: OpenJSharp   File: DynamicStubImpl.java   View source code 6 votes vote down vote up
public Object readResolve()
{
    String repositoryId = ior.getRepositoryId() ;
    String cname = RepositoryId.cache.getId( repositoryId ).getClassName() ;

    Class cls = null ;

    try {
        cls = JDKBridge.loadClass( cname, null, null ) ;
    } catch (ClassNotFoundException exc) {
        // XXX log this
    }

    PresentationManager pm =
        com.sun.corba.se.spi.orb.ORB.getPresentationManager() ;
    PresentationManager.ClassData classData = pm.getClassData( cls ) ;
    InvocationHandlerFactoryImpl ihfactory =
        (InvocationHandlerFactoryImpl)classData.getInvocationHandlerFactory() ;
    return ihfactory.getInvocationHandler( this ) ;
}
 
Example 7
Project: OpenJSharp   File: CodecFactoryImpl.java   View source code 6 votes vote down vote up
/**
 * Creates a new CodecFactory implementation.  Stores the ORB that
 * created this factory, for later use by the Codec.
 */
public CodecFactoryImpl( ORB orb ) {
    this.orb = orb;
    wrapper = ORBUtilSystemException.get(
        (com.sun.corba.se.spi.orb.ORB)orb,
        CORBALogDomains.RPC_PROTOCOL ) ;

    // Precreate a codec for version 1.0 through
    // 1.(MAX_MINOR_VERSION_SUPPORTED).  This can be
    // done since Codecs are immutable in their current implementation.
    // This is an optimization that eliminates the overhead of creating
    // a new Codec each time create_codec is called.
    for( int minor = 0; minor <= MAX_MINOR_VERSION_SUPPORTED; minor++ ) {
        codecs[minor] = new CDREncapsCodec( orb, 1, minor );
    }
}
 
Example 8
Project: openjdk-jdk10   File: CodecFactoryImpl.java   View source code 6 votes vote down vote up
/**
 * Creates a new CodecFactory implementation.  Stores the ORB that
 * created this factory, for later use by the Codec.
 */
public CodecFactoryImpl( ORB orb ) {
    this.orb = orb;
    wrapper = ORBUtilSystemException.get(
        (com.sun.corba.se.spi.orb.ORB)orb,
        CORBALogDomains.RPC_PROTOCOL ) ;

    // Precreate a codec for version 1.0 through
    // 1.(MAX_MINOR_VERSION_SUPPORTED).  This can be
    // done since Codecs are immutable in their current implementation.
    // This is an optimization that eliminates the overhead of creating
    // a new Codec each time create_codec is called.
    for( int minor = 0; minor <= MAX_MINOR_VERSION_SUPPORTED; minor++ ) {
        codecs[minor] = new CDREncapsCodec( orb, 1, minor );
    }
}
 
Example 9
Project: OpenJSharp   File: StubIORImpl.java   View source code 6 votes vote down vote up
public Delegate getDelegate( ORB orb )
{
    // write the IOR components to an org.omg.CORBA.portable.OutputStream
    OutputStream ostr = orb.create_output_stream();
    ostr.write_long(typeData.length);
    ostr.write_octet_array(typeData, 0, typeData.length);
    ostr.write_long(profileTags.length);
    for (int i = 0; i < profileTags.length; i++) {
        ostr.write_long(profileTags[i]);
        ostr.write_long(profileData[i].length);
        ostr.write_octet_array(profileData[i], 0, profileData[i].length);
    }

    InputStream istr = ostr.create_input_stream() ;

    // read the IOR back from the stream
    org.omg.CORBA.Object obj = (org.omg.CORBA.Object)istr.read_Object();
    return StubAdapter.getDelegate( obj ) ;
}
 
Example 10
Project: OpenJSharp   File: ValueUtility.java   View source code 6 votes vote down vote up
public static TypeCode getPrimitiveTypeCodeForClass (ORB orb,
                                                     Class c,
                                                     ValueHandler vh) {

    if (c == Integer.TYPE) {
        return orb.get_primitive_tc (TCKind.tk_long);
    } else if (c == Byte.TYPE) {
        return orb.get_primitive_tc (TCKind.tk_octet);
    } else if (c == Long.TYPE) {
        return orb.get_primitive_tc (TCKind.tk_longlong);
    } else if (c == Float.TYPE) {
        return orb.get_primitive_tc (TCKind.tk_float);
    } else if (c == Double.TYPE) {
        return orb.get_primitive_tc (TCKind.tk_double);
    } else if (c == Short.TYPE) {
        return orb.get_primitive_tc (TCKind.tk_short);
    } else if (c == Character.TYPE) {
        return orb.get_primitive_tc (((ValueHandlerImpl)vh).getJavaCharTCKind());
    } else if (c == Boolean.TYPE) {
        return orb.get_primitive_tc (TCKind.tk_boolean);
    } else {
        // _REVISIT_ Not sure if this is right.
        return orb.get_primitive_tc (TCKind.tk_any);
    }
}
 
Example 11
Project: jdk8u-jdk   File: SetDefaultORBTest.java   View source code 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 12
Project: openjdk-jdk10   File: ServerMain.java   View source code 6 votes vote down vote up
private Method getNamedMethod( Class serverClass, String methodName )
{
    Class argTypes[] = new Class[] { org.omg.CORBA.ORB.class } ;
    Method method = null ;

    try {
        method = serverClass.getDeclaredMethod( methodName, argTypes ) ;
    } catch (Exception exc) {
        return null ;
    }

    if (!isPublicStaticVoid( method ))
        return null ;

    return method ;
}
 
Example 13
Project: openjdk-jdk10   File: ServerMain.java   View source code 6 votes vote down vote up
ServerCallback(ORB orb, Method installMethod, Method uninstallMethod,
    Method shutdownMethod )
{
    this.orb = orb;
    this.installMethod = installMethod ;
    this.uninstallMethod = uninstallMethod ;
    this.shutdownMethod = shutdownMethod ;

    orb.connect( this ) ;

    methodArgs = new Object[] { orb } ;
}
 
Example 14
Project: openjdk-jdk10   File: DynamicStubImpl.java   View source code 6 votes vote down vote up
public Object readResolve()
{
    String repositoryId = ior.getRepositoryId() ;
    String cname = RepositoryId.cache.getId( repositoryId ).getClassName() ;

    Class cls = null ;

    try {
        cls = JDKBridge.loadClass( cname, null, null ) ;
    } catch (ClassNotFoundException exc) {
        // XXX log this
    }

    PresentationManager pm =
        com.sun.corba.se.spi.orb.ORB.getPresentationManager() ;
    PresentationManager.ClassData classData = pm.getClassData( cls ) ;
    InvocationHandlerFactoryImpl ihfactory =
        (InvocationHandlerFactoryImpl)classData.getInvocationHandlerFactory() ;
    return ihfactory.getInvocationHandler( this ) ;
}
 
Example 15
Project: openjdk-jdk10   File: ValueUtility.java   View source code 6 votes vote down vote up
private static TypeCode createTypeCodeForClassInternal (ORB orb,
                                                        java.lang.Class c,
                                                        ValueHandler vh,
                                                        IdentityKeyValueStack createdIDs)
{
    // This wrapper method is the protection against infinite recursion.
    TypeCode tc = null;
    String id = (String)createdIDs.get(c);
    if (id != null) {
        return orb.create_recursive_tc(id);
    } else {
        id = vh.getRMIRepositoryID(c);
        if (id == null) id = "";
        // cache the rep id BEFORE creating a new typecode.
        // so that recursive tc can look up the rep id.
        createdIDs.push(c, id);
        tc = createTypeCodeInternal(orb, c, vh, id, createdIDs);
        createdIDs.pop();
        return tc;
    }
}
 
Example 16
Project: openjdk-jdk10   File: ServerTool.java   View source code 6 votes vote down vote up
public boolean processCommand(String[] cmdArgs, ORB orb, PrintStream out)
{
    try {
        Repository repository = RepositoryHelper.narrow(
            orb.resolve_initial_references( ORBConstants.SERVER_REPOSITORY_NAME ));

        String[] applicationNames = repository.getApplicationNames();

        out.println(CorbaResourceUtil.getText("servertool.listappnames2"));
        out.println();
        for (int i=0; i < applicationNames.length; i++)
            out.println( "\t" + applicationNames[i] ) ;
    } catch (Exception ex) {
        ex.printStackTrace();
    }

    return commandDone;
}
 
Example 17
Project: OpenJSharp   File: Servant.java   View source code 5 votes vote down vote up
/**
 * Allows the servant to obtain the object reference for
 * the target CORBA Object it is incarnating for that request.
 * @param orb ORB with which the servant is associated.
 * @return <code>_this_object</code> reference associated with the request.
 */
final public org.omg.CORBA.Object _this_object(ORB orb) {
    try {
        ((org.omg.CORBA_2_3.ORB)orb).set_delegate(this);
    }
    catch(ClassCastException e) {
        throw
            new
            org.omg.CORBA.BAD_PARAM
            ("POA Servant requires an instance of org.omg.CORBA_2_3.ORB");
    }
    return _this_object();
}
 
Example 18
Project: OpenJSharp   File: StubAdapter.java   View source code 5 votes vote down vote up
public static ORB getORB( Object stub )
{
    if (stub instanceof DynamicStub)
        return ((DynamicStub)stub).getORB() ;
    else if (stub instanceof ObjectImpl)
        return (ORB)((ObjectImpl)stub)._orb() ;
    else
        throw wrapper.getOrbRequiresStub() ;
}
 
Example 19
Project: OpenJSharp   File: StubAdapter.java   View source code 5 votes vote down vote up
public static void connect( Object stub,
    ORB orb ) throws java.rmi.RemoteException
{
    if (stub instanceof DynamicStub)
        ((DynamicStub)stub).connect(
            (com.sun.corba.se.spi.orb.ORB)orb ) ;
    else if (stub instanceof javax.rmi.CORBA.Stub)
        ((javax.rmi.CORBA.Stub)stub).connect( orb ) ;
    else if (stub instanceof ObjectImpl)
        orb.connect( (org.omg.CORBA.Object)stub ) ;
    else
        throw wrapper.connectRequiresStub() ;
}
 
Example 20
Project: OpenJSharp   File: ServerMain.java   View source code 5 votes vote down vote up
ServerCallback(ORB orb, Method installMethod, Method uninstallMethod,
    Method shutdownMethod )
{
    this.orb = orb;
    this.installMethod = installMethod ;
    this.uninstallMethod = uninstallMethod ;
    this.shutdownMethod = shutdownMethod ;

    orb.connect( this ) ;

    methodArgs = new Object[] { orb } ;
}
 
Example 21
Project: OpenJSharp   File: ServerTool.java   View source code 5 votes vote down vote up
static int getServerIdForAlias( ORB orb, String applicationName ) throws ServerNotRegistered
{
    try {
        Repository rep = RepositoryHelper.narrow(
            orb.resolve_initial_references( ORBConstants.SERVER_REPOSITORY_NAME ) ) ;
        int serverid = rep.getServerID(applicationName);

        return rep.getServerID( applicationName ) ;
    } catch (Exception ex) {
        throw (new ServerNotRegistered());
    }
}
 
Example 22
Project: OpenJSharp   File: ServerTool.java   View source code 5 votes vote down vote up
public boolean processCommand(String[] cmdArgs, ORB orb, PrintStream out)
{
    ServerDef serverDef;

    // process the list active servers command
    try {
        Repository repository = RepositoryHelper.narrow(
            orb.resolve_initial_references( ORBConstants.SERVER_REPOSITORY_NAME ));

        Activator activator = ActivatorHelper.narrow(
            orb.resolve_initial_references( ORBConstants.SERVER_ACTIVATOR_NAME ));

        int[] servers = activator.getActiveServers();

        out.println(CorbaResourceUtil.getText("servertool.list2"));

        ListServers.sortServers(servers);
        for (int i=0; i < servers.length; i++) {
            try {
                serverDef = repository.getServer(servers[i]);
                out.println("\t   " + servers[i] + "\t\t" +
                            serverDef.serverName + "\t\t" +
                            serverDef.applicationName);
            } catch (ServerNotRegistered e) {}
        }
    } catch (Exception ex) {
        ex.printStackTrace();
    }

    return commandDone;
}
 
Example 23
Project: OpenJSharp   File: TransientNameService.java   View source code 5 votes vote down vote up
/**
 * Constructs a new TransientNameService, and creates an initial
 * NamingContext, whose object
 * reference can be obtained by the initialNamingContext method.
 * @param orb The ORB object
 * @exception org.omg.CORBA.INITIALIZE Thrown if
 * the TransientNameService cannot initialize.
 */
public TransientNameService(com.sun.corba.se.spi.orb.ORB orb )
    throws org.omg.CORBA.INITIALIZE
{
    // Default constructor uses "NameService" as the key for the Root Naming
    // Context. If default constructor is used then INS's object key for
    // Transient Name Service is "NameService"
    initialize( orb, "NameService" );
}
 
Example 24
Project: OpenJSharp   File: BindingIteratorImpl.java   View source code 5 votes vote down vote up
/**
 * Create a binding iterator servant.
 * runs the super constructor.
 * @param orb an ORB object.
 * @exception java.lang.Exception a Java exception.
 */
public BindingIteratorImpl(ORB orb)
    throws java.lang.Exception
{
    super();
    this.orb = orb ;
}
 
Example 25
Project: OpenJSharp   File: TransientBindingIterator.java   View source code 5 votes vote down vote up
/**
  * Constructs a new TransientBindingIterator object.
  * @param orb a org.omg.CORBA.ORB object.
  * @param aTable A hashtable containing InternalBindingValues which is
  * the content of the TransientNamingContext.
  * @param java.lang.Exception a Java exception.
  * @exception Exception a Java exception thrown of the base class cannot
  * initialize.
*/
 public TransientBindingIterator(ORB orb, Hashtable aTable,
     POA thePOA )
     throws java.lang.Exception
 {
     super(orb);
     theHashtable = aTable;
     theEnumeration = this.theHashtable.elements();
     currentSize = this.theHashtable.size();
     this.nsPOA = thePOA;
 }
 
Example 26
Project: OpenJSharp   File: CDREncapsCodec.java   View source code 5 votes vote down vote up
/**
 * Convert the given any into a CDR encapsulated octet sequence.
 * If sendTypeCode is true, the type code is sent with the message, as in
 * a standard encapsulation.  If it is false, only the data is sent.
 * Either way, the endian type is sent as the first part of the message.
 */
private byte[] encodeImpl( Any data, boolean sendTypeCode )
    throws InvalidTypeForEncoding
{
    if( data == null )
        throw wrapper.nullParam() ;

    // _REVISIT_ Note that InvalidTypeForEncoding is never thrown in
    // the body of this method.  This is due to the fact that CDR*Stream
    // will never throw an exception if the encoding is invalid.  To
    // fix this, the CDROutputStream must know the version of GIOP it
    // is encoding for and it must check to ensure that, for example,
    // wstring cannot be encoded in GIOP 1.0.
    //
    // As part of the GIOP 1.2 work, the CDRInput and OutputStream will
    // be versioned.  This can be handled once this work is complete.

    // Create output stream with default endianness.
    EncapsOutputStream cdrOut =
        sun.corba.OutputStreamFactory.newEncapsOutputStream(
        (com.sun.corba.se.spi.orb.ORB)orb, giopVersion );

    // This is an encapsulation, so put out the endian:
    cdrOut.putEndian();

    // Sometimes encode type code:
    if( sendTypeCode ) {
        cdrOut.write_TypeCode( data.type() );
    }

    // Encode value and return.
    data.write_value( cdrOut );

    return cdrOut.toByteArray();
}
 
Example 27
Project: OpenJSharp   File: ValueUtility.java   View source code 5 votes vote down vote up
public static TypeCode createTypeCodeForClass (ORB orb, java.lang.Class c, ValueHandler vh) {
    // Maps classes to repositoryIDs strings. This is used to detect recursive types.
    IdentityKeyValueStack createdIDs = new IdentityKeyValueStack();
    // Stores all types created for resolving indirect types at the end.
    TypeCode tc = createTypeCodeForClassInternal(orb, c, vh, createdIDs);
    return tc;
}
 
Example 28
Project: openjdk-jdk10   File: Util.java   View source code 5 votes vote down vote up
/**
 * Copies or connects an array of objects. Used by local stubs
 * to copy any number of actual parameters, preserving sharing
 * across parameters as necessary to support RMI semantics.
 * @param obj the objects to copy or connect.
 * @param orb the ORB.
 * @return the copied or connected objects.
 * @exception RemoteException if any object could not be copied or connected.
 */
public static Object[] copyObjects (Object[] obj, ORB orb)
    throws RemoteException {

    if (utilDelegate != null) {
        return utilDelegate.copyObjects(obj, orb);
    }

    return null;
}
 
Example 29
Project: OpenJSharp   File: Util.java   View source code 5 votes vote down vote up
/**
 * Copies or connects an array of objects. Used by local stubs
 * to copy any number of actual parameters, preserving sharing
 * across parameters as necessary to support RMI semantics.
 * @param obj the objects to copy or connect.
 * @param orb the ORB.
 * @return the copied or connected objects.
 * @exception RemoteException if any object could not be copied or connected.
 */
public static Object[] copyObjects (Object[] obj, ORB orb)
    throws RemoteException {

    if (utilDelegate != null) {
        return utilDelegate.copyObjects(obj, orb);
    }

    return null;
}
 
Example 30
Project: openjdk-jdk10   File: Stub.java   View source code 5 votes vote down vote up
/**
 * Connects this stub to an ORB. Required after the stub is deserialized
 * but not after it is demarshalled by an ORB stream. If an unconnected
 * stub is passed to an ORB stream for marshalling, it is implicitly
 * connected to that ORB. Application code should not call this method
 * directly, but should call the portable wrapper method
 * {@link javax.rmi.PortableRemoteObject#connect}.
 * @param orb the ORB to connect to.
 * @exception RemoteException if the stub is already connected to a different
 * ORB, or if the stub does not represent an exported remote or local object.
 */
public void connect(ORB orb) throws RemoteException {

    if (stubDelegate == null) {
        setDefaultDelegate();
    }

    if (stubDelegate != null) {
        stubDelegate.connect(this, orb);
    }

}
 
Example 31
Project: OpenJSharp   File: OrbReuseTracker.java   View source code 5 votes vote down vote up
OrbReuseTracker(ORB orb) {
    this.orb = orb;
    referenceCnt++;
    if (debug) {
         System.out.println("New OrbReuseTracker created");
    }
}
 
Example 32
Project: openjdk-jdk10   File: PersistentBindingIterator.java   View source code 5 votes vote down vote up
/**
  * Constructs a new PersistentBindingIterator object.
  * @param orb a org.omg.CORBA.ORB object.
  * @param aTable A hashtable containing InternalBindingValues which is
  * the content of the PersistentNamingContext.
  * @exception Exception a Java exception thrown of the base class cannot
  * initialize.
*/
 public PersistentBindingIterator(org.omg.CORBA.ORB orb, Hashtable aTable,
     POA thePOA ) throws java.lang.Exception
 {
     super(orb);
     this.orb = orb;
     theHashtable = aTable;
     theEnumeration = this.theHashtable.keys();
     currentSize = this.theHashtable.size();
     biPOA = thePOA;
 }
 
Example 33
Project: jdk8u-jdk   File: OrbReuseTracker.java   View source code 5 votes vote down vote up
OrbReuseTracker(ORB orb) {
    this.orb = orb;
    referenceCnt++;
    if (debug) {
         System.out.println("New OrbReuseTracker created");
    }
}
 
Example 34
Project: openjdk-jdk10   File: CDREncapsCodec.java   View source code 5 votes vote down vote up
/**
 * Convert the given any into a CDR encapsulated octet sequence.
 * If sendTypeCode is true, the type code is sent with the message, as in
 * a standard encapsulation.  If it is false, only the data is sent.
 * Either way, the endian type is sent as the first part of the message.
 */
private byte[] encodeImpl( Any data, boolean sendTypeCode )
    throws InvalidTypeForEncoding
{
    if( data == null )
        throw wrapper.nullParam() ;

    // _REVISIT_ Note that InvalidTypeForEncoding is never thrown in
    // the body of this method.  This is due to the fact that CDR*Stream
    // will never throw an exception if the encoding is invalid.  To
    // fix this, the CDROutputStream must know the version of GIOP it
    // is encoding for and it must check to ensure that, for example,
    // wstring cannot be encoded in GIOP 1.0.
    //
    // As part of the GIOP 1.2 work, the CDRInput and OutputStream will
    // be versioned.  This can be handled once this work is complete.

    // Create output stream with default endianness.
    EncapsOutputStream cdrOut =
        sun.corba.OutputStreamFactory.newEncapsOutputStream(
        (com.sun.corba.se.spi.orb.ORB)orb, giopVersion );

    // This is an encapsulation, so put out the endian:
    cdrOut.putEndian();

    // Sometimes encode type code:
    if( sendTypeCode ) {
        cdrOut.write_TypeCode( data.type() );
    }

    // Encode value and return.
    data.write_value( cdrOut );

    return cdrOut.toByteArray();
}
 
Example 35
Project: openjdk-jdk10   File: OrbPropertiesTest.java   View source code 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 36
Project: openjdk-jdk10   File: OrbReuseTracker.java   View source code 5 votes vote down vote up
OrbReuseTracker(ORB orb) {
    this.orb = orb;
    referenceCnt++;
    if (debug) {
         System.out.println("New OrbReuseTracker created");
    }
}
 
Example 37
Project: openjdk-jdk10   File: Servant.java   View source code 5 votes vote down vote up
/**
 * Allows the servant to obtain the object reference for
 * the target CORBA Object it is incarnating for that request.
 * @param orb ORB with which the servant is associated.
 * @return <code>_this_object</code> reference associated with the request.
 */
final public org.omg.CORBA.Object _this_object(ORB orb) {
    try {
        ((org.omg.CORBA_2_3.ORB)orb).set_delegate(this);
    }
    catch(ClassCastException e) {
        throw
            new
            org.omg.CORBA.BAD_PARAM
            ("POA Servant requires an instance of org.omg.CORBA_2_3.ORB");
    }
    return _this_object();
}
 
Example 38
Project: openjdk-jdk10   File: StubAdapter.java   View source code 5 votes vote down vote up
public static ORB getORB( Object stub )
{
    if (stub instanceof DynamicStub)
        return ((DynamicStub)stub).getORB() ;
    else if (stub instanceof ObjectImpl)
        return (ORB)((ObjectImpl)stub)._orb() ;
    else
        throw wrapper.getOrbRequiresStub() ;
}
 
Example 39
Project: openjdk-jdk10   File: StubAdapter.java   View source code 5 votes vote down vote up
public static void connect( Object stub,
    ORB orb ) throws java.rmi.RemoteException
{
    if (stub instanceof DynamicStub)
        ((DynamicStub)stub).connect(
            (com.sun.corba.se.spi.orb.ORB)orb ) ;
    else if (stub instanceof javax.rmi.CORBA.Stub)
        ((javax.rmi.CORBA.Stub)stub).connect( orb ) ;
    else if (stub instanceof ObjectImpl)
        orb.connect( (org.omg.CORBA.Object)stub ) ;
    else
        throw wrapper.connectRequiresStub() ;
}
 
Example 40
Project: openjdk-jdk10   File: ServerMain.java   View source code 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 ) ;
    }
}