Java Code Examples for org.omg.CORBA.ORB

The following examples show how to use org.omg.CORBA.ORB. These examples are extracted from open source projects. 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 want to check out the right sidebar which shows the related API usage.
Example 1
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 2
Source Project: hottub   Source File: ServerTool.java    License: GNU General Public License v2.0 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
Source Project: cxf   Source File: CorbaUtils.java    License: Apache License 2.0 6 votes vote down vote up
private static TypeCode getAnonTypeCode(ORB orb,
                                        QName type,
                                        Object obj,
                                        CorbaTypeMap typeMap,
                                        Stack<QName> seenTypes) {
    TypeCode tc = null;
    if (obj instanceof Anonarray) {
        Anonarray anonArrayType = (Anonarray)obj;
        tc = orb.create_array_tc((int) anonArrayType.getBound(),
                                 getTypeCode(orb, anonArrayType.getElemtype(), typeMap, seenTypes));
    } else if (obj instanceof Anonfixed) {
        Anonfixed anonFixedType = (Anonfixed) obj;
        tc = orb.create_fixed_tc((short) anonFixedType.getDigits(), (short) anonFixedType.getScale());
    } else if (obj instanceof Anonsequence) {
        Anonsequence anonSeqType = (Anonsequence)obj;
        tc = orb.create_sequence_tc((int) anonSeqType.getBound(),
                                    getTypeCode(orb, anonSeqType.getElemtype(), typeMap, seenTypes));
    } else if (obj instanceof Anonstring) {
        Anonstring anonStringType = (Anonstring)obj;
        tc = orb.create_string_tc((int)anonStringType.getBound());
    } else if (obj instanceof Anonwstring) {
        Anonwstring anonWStringType = (Anonwstring)obj;
        tc = orb.create_wstring_tc((int)anonWStringType.getBound());
    }
    return tc;
}
 
Example 4
Source Project: openjdk-jdk8u   Source File: ValueUtility.java    License: GNU General Public License v2.0 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 5
Source Project: hottub   Source File: CodecFactoryImpl.java    License: GNU General Public License v2.0 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 6
/**
 * 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 7
Source Project: hottub   Source File: StubIORImpl.java    License: GNU General Public License v2.0 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 8
Source Project: JDKSourceCode1.8   Source File: CodecFactoryImpl.java    License: MIT License 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
Source Project: hottub   Source File: ValueUtility.java    License: GNU General Public License v2.0 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 10
Source Project: cxf   Source File: CorbaUtils.java    License: Apache License 2.0 6 votes vote down vote up
public static TypeCode getPrimitiveTypeCode(ORB orb, QName type) {
    TCKind kind = PRIMITIVE_TYPECODES.get(type);
    if (kind != null) {
        return orb.get_primitive_tc(kind);
    }

    // There is a possiblitity that the idl type will not have its namespace URI set if it has
    // been read directly from the WSDL file as a string. Try with the standard corba namespace URI.
    if (type.getNamespaceURI() == null) {
        QName uriIdltype = new QName(CorbaConstants.NU_WSDL_CORBA, type.getLocalPart(), type.getPrefix());

        kind = PRIMITIVE_TYPECODES.get(uriIdltype);
        if (kind != null) {
            return orb.get_primitive_tc(kind);
        }
    }
    return null;
}
 
Example 11
Source Project: hottub   Source File: ServerTool.java    License: GNU General Public License v2.0 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 12
/**
  * 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.
  * @param java.lang.Exception a Java exception.
  * @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 13
Source Project: openjdk-jdk9   Source File: ServerTool.java    License: GNU General Public License v2.0 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 14
Source Project: openjdk-jdk8u-backup   Source File: Stub.java    License: GNU General Public License v2.0 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 15
Source Project: hottub   Source File: Util.java    License: GNU General Public License v2.0 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 16
Source Project: openjdk-8-source   Source File: StubAdapter.java    License: GNU General Public License v2.0 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 17
Source Project: jdk8u60   Source File: StubAdapter.java    License: GNU General Public License v2.0 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 18
public SocketInfo getEndPointInfo(ORB orb,
                                    IOR ior,
                                    SocketInfo socketInfo)
{
    IIOPProfileTemplate temp =
        (IIOPProfileTemplate)ior.getProfile().getTaggedProfileTemplate() ;
    IIOPAddress primary = temp.getPrimaryAddress() ;

    return new EndPointInfoImpl(ORBSocketFactory.IIOP_CLEAR_TEXT,
                                primary.getPort(),
                                primary.getHost().toLowerCase());
}
 
Example 19
Source Project: cxf   Source File: CorbaExceptionListener.java    License: Apache License 2.0 5 votes vote down vote up
public CorbaExceptionListener(CorbaObjectHandler handler,
                              CorbaTypeMap map,
                              ORB orbRef,
                              ServiceInfo serviceInfo) {
    super(handler);
    orb = orbRef;
    typeMap = map;
    sInfo = serviceInfo;
    exMembers = ((Exception) handler.getType()).getMember();
}
 
Example 20
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 21
Source Project: cxf   Source File: SystemExceptionHelper.java    License: Apache License 2.0 5 votes vote down vote up
public TypeCode _type() {
    if (typeCode == null) {
        ORB orb = ORB.init();
        StructMember[] smBuf = new StructMember[2];
        TypeCode minortc = orb.get_primitive_tc(TCKind.tk_long);
        smBuf[0] = new StructMember("minor", minortc, null);

        String[] csLabels = {"COMPLETED_YES", "COMPLETED_NO", "COMPLETED_MAYBE"};
        TypeCode completedtc = orb
            .create_enum_tc("IDL:omg.org/CORBA/CompletionStatus:1.0",
                          "CompletionStatus", csLabels);

        smBuf[1] = new StructMember("completed", completedtc, null);
        String id;
        String name;
        if (value == null) {
            name = "SystemException";
            id = "IDL:omg.org/CORBA/SystemException:1.0";
        } else {
            String className = value.getClass().getName();
            name = className.substring(className.lastIndexOf('.') + 1);
            id = "IDL:omg.org/CORBA/" + name + ":1.0";
        }

        typeCode = orb.create_exception_tc(id, name, smBuf);
    }
    return typeCode;
}
 
Example 22
/**
 * 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 23
Source Project: cxf   Source File: CorbaPrimitiveSequenceEventProducer.java    License: Apache License 2.0 5 votes vote down vote up
public CorbaPrimitiveSequenceEventProducer(CorbaObjectHandler h,
                                           ServiceInfo service,
                                           ORB orbRef) {
    CorbaSequenceHandler handler = (CorbaSequenceHandler)h;
    iterator = handler.getElements().iterator();
    orb = orbRef;
    serviceInfo = service;
}
 
Example 24
Source Project: hottub   Source File: ServerTool.java    License: GNU General Public License v2.0 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 25
Source Project: cxf   Source File: CorbaAnyEventProducer.java    License: Apache License 2.0 5 votes vote down vote up
public CorbaAnyEventProducer(CorbaObjectHandler h, ServiceInfo info, ORB orbRef) {
    handler = (CorbaAnyHandler)h;
    name = handler.getName();
    orb = orbRef;
    serviceInfo = info;

    containedType = getAnyContainedType(handler.getValue());
    handler.setAnyContainedType(containedType);

    if (containedType != null) {
        QName containedSchemaType = convertIdlToSchemaType(containedType);

        XMLEventFactory factory = XMLEventFactory.newInstance();

        attributes = new ArrayList<>();
        attributes.add(factory.createAttribute(new QName(W3CConstants.NU_SCHEMA_XSI, "type"),
                                               ANY_TYPE_PREFIX + ":"
                                               + containedSchemaType.getLocalPart()));
        namespaces = new ArrayList<>();
        namespaces.add(factory.createNamespace(ANY_TYPE_PREFIX,
                                               containedSchemaType.getNamespaceURI()));
    }

    CorbaTypeEventProducer containedProducer =
        CorbaHandlerUtils.getTypeEventProducer(containedType, serviceInfo, orb);
    if (containedProducer instanceof AbstractStartEndEventProducer) {
        iterator = ((AbstractStartEndEventProducer)containedProducer).getNestedTypes();
    } else {
        List<CorbaTypeEventProducer> prods = new ArrayList<>();
        CorbaSimpleAnyContainedTypeEventProducer simpleProducer =
            new CorbaSimpleAnyContainedTypeEventProducer(containedProducer.getText());
        prods.add(simpleProducer);
        producers = prods.iterator();
    }
}
 
Example 26
public SocketInfo getEndPointInfo(ORB orb,
                                    IOR ior,
                                    SocketInfo socketInfo)
{
    IIOPProfileTemplate temp =
        (IIOPProfileTemplate)ior.getProfile().getTaggedProfileTemplate() ;
    IIOPAddress primary = temp.getPrimaryAddress() ;

    return new EndPointInfoImpl(ORBSocketFactory.IIOP_CLEAR_TEXT,
                                primary.getPort(),
                                primary.getHost().toLowerCase());
}
 
Example 27
Source Project: jdk8u60   Source File: ServerTool.java    License: GNU General Public License v2.0 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 28
OrbReuseTracker(ORB orb) {
    this.orb = orb;
    referenceCnt++;
    if (debug) {
         System.out.println("New OrbReuseTracker created");
    }
}
 
Example 29
Source Project: cxf   Source File: CorbaStreamableTest.java    License: 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-Binding");
    orb = ORB.init(new String[0], props);
}
 
Example 30
Source Project: JDKSourceCode1.8   Source File: Stub.java    License: MIT License 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);
    }

}