Java Code Examples for com.sun.corba.se.spi.orb.ORB

The following are top voted examples for showing how to use com.sun.corba.se.spi.orb.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: openjdk-jdk10   File: MessageBase.java   View source code 6 votes vote down vote up
/**
 * Construct an ObjectKey from a byte[].
 *
 * @return ObjectKey the object key.
 */
static ObjectKey extractObjectKey(byte[] objKey, ORB orb) {

    try {
        if (objKey != null) {
            ObjectKey objectKey =
                orb.getObjectKeyFactory().create(objKey);
            if (objectKey != null) {
                return objectKey;
            }
        }
    } catch (Exception e) {
        // XXX log this exception
    }

    // This exception is thrown if any exceptions are raised while
    // extracting the object key or if the object key is empty.
    throw wrapper.invalidObjectKey();
}
 
Example 2
Project: OpenJSharp   File: EncapsInputStream.java   View source code 6 votes vote down vote up
/**
 * Full constructor with a CodeBase parameter useful for
 * unmarshaling RMI-IIOP valuetypes (technically against the
 * intention of an encapsulation, but necessary due to OMG
 * issue 4795.  Used by ServiceContexts.
 */
public EncapsInputStream(org.omg.CORBA.ORB orb,
                         byte[] data,
                         int size,
                         GIOPVersion version,
                         CodeBase codeBase) {
    super(orb,
          ByteBuffer.wrap(data),
          size,
          false,
          version, Message.CDR_ENC_VERSION,
          BufferManagerFactory.newBufferManagerRead(
                                  BufferManagerFactory.GROW,
                                  Message.CDR_ENC_VERSION,
                                  (ORB)orb));

    this.codeBase = codeBase;

    performORBVersionSpecificInit();
}
 
Example 3
Project: OpenJSharp   File: ORBD.java   View source code 6 votes vote down vote up
protected ORB createORB(String[] args)
{
    Properties props = System.getProperties();

    // For debugging.
    //props.put( ORBConstants.DEBUG_PROPERTY, "naming" ) ;
    //props.put( ORBConstants.DEBUG_PROPERTY, "transport,giop,naming" ) ;

    props.put( ORBConstants.SERVER_ID_PROPERTY, "1000" ) ;
    props.put( ORBConstants.PERSISTENT_SERVER_PORT_PROPERTY,
        props.getProperty( ORBConstants.ORBD_PORT_PROPERTY,
            Integer.toString(
                ORBConstants.DEFAULT_ACTIVATION_PORT ) ) ) ;

    // See Bug 4396928 for more information about why we are initializing
    // the ORBClass to PIORB (now ORBImpl, but should check the bugid).
    props.put("org.omg.CORBA.ORBClass",
        "com.sun.corba.se.impl.orb.ORBImpl");

    return (ORB) ORB.init(args, props);
}
 
Example 4
Project: openjdk-jdk10   File: ServiceContexts.java   View source code 6 votes vote down vote up
/**
 * Read the Service contexts from the input stream.
 */
public ServiceContexts(InputStream s)
{
    this( (ORB)(s.orb()) ) ;

    // We need to store this so that we can have access
    // to the CodeBase for unmarshaling possible
    // RMI-IIOP valuetype data within an encapsulation.
    // (Known case: UnknownExceptionInfo)
    codeBase = ((CDRInputStream)s).getCodeBase();

    createMapFromInputStream(s);

    // Fix for bug 4904723
    giopVersion = ((CDRInputStream)s).getGIOPVersion();
}
 
Example 5
Project: OpenJSharp   File: CDROutputStream.java   View source code 6 votes vote down vote up
public static CDROutputStreamBase newOutputStream(
        ORB orb, GIOPVersion version, byte encodingVersion) {
    switch(version.intValue()) {
        case GIOPVersion.VERSION_1_0:
            return new CDROutputStream_1_0();
        case GIOPVersion.VERSION_1_1:
            return new CDROutputStream_1_1();
    case GIOPVersion.VERSION_1_2:
        if (encodingVersion != Message.CDR_ENC_VERSION) {
            return
                new IDLJavaSerializationOutputStream(encodingVersion);
        }
        return new CDROutputStream_1_2();
    default:
            ORBUtilSystemException wrapper = ORBUtilSystemException.get( orb,
                CORBALogDomains.RPC_ENCODING ) ;
            // REVISIT - what is appropriate?  INTERNAL exceptions
            // are really hard to track later.
            throw wrapper.unsupportedGiopVersion( version ) ;
    }
}
 
Example 6
Project: openjdk-jdk10   File: ORBConfiguratorImpl.java   View source code 6 votes vote down vote up
private void initializeNaming( ORB orb )
{
    LocalResolver localResolver = ResolverDefault.makeLocalResolver() ;
    orb.setLocalResolver( localResolver ) ;

    Resolver bootResolver = ResolverDefault.makeBootstrapResolver( orb,
        orb.getORBData().getORBInitialHost(),
        orb.getORBData().getORBInitialPort() ) ;

    Operation urlOperation = ResolverDefault.makeINSURLOperation( orb,
        bootResolver ) ;
    orb.setURLOperation( urlOperation ) ;

    Resolver irResolver = ResolverDefault.makeORBInitRefResolver( urlOperation,
        orb.getORBData().getORBInitialReferences() ) ;

    Resolver dirResolver = ResolverDefault.makeORBDefaultInitRefResolver(
        urlOperation, orb.getORBData().getORBDefaultInitialReference() ) ;

    Resolver resolver =
        ResolverDefault.makeCompositeResolver( localResolver,
            ResolverDefault.makeCompositeResolver( irResolver,
                ResolverDefault.makeCompositeResolver( dirResolver,
                    bootResolver ) ) ) ;
    orb.setResolver( resolver ) ;
}
 
Example 7
Project: OpenJSharp   File: ORBConfiguratorImpl.java   View source code 6 votes vote down vote up
private void initializeNaming( ORB orb )
{
    LocalResolver localResolver = ResolverDefault.makeLocalResolver() ;
    orb.setLocalResolver( localResolver ) ;

    Resolver bootResolver = ResolverDefault.makeBootstrapResolver( orb,
        orb.getORBData().getORBInitialHost(),
        orb.getORBData().getORBInitialPort() ) ;

    Operation urlOperation = ResolverDefault.makeINSURLOperation( orb,
        bootResolver ) ;
    orb.setURLOperation( urlOperation ) ;

    Resolver irResolver = ResolverDefault.makeORBInitRefResolver( urlOperation,
        orb.getORBData().getORBInitialReferences() ) ;

    Resolver dirResolver = ResolverDefault.makeORBDefaultInitRefResolver(
        urlOperation, orb.getORBData().getORBDefaultInitialReference() ) ;

    Resolver resolver =
        ResolverDefault.makeCompositeResolver( localResolver,
            ResolverDefault.makeCompositeResolver( irResolver,
                ResolverDefault.makeCompositeResolver( dirResolver,
                    bootResolver ) ) ) ;
    orb.setResolver( resolver ) ;
}
 
Example 8
Project: openjdk-jdk10   File: Util.java   View source code 6 votes vote down vote up
/**
 * When using our own ORB and Any implementations, we need to get
 * the ORB version and create the type code appropriately.  This is
 * to overcome a bug in which the JDK 1.3.x ORBs used a tk_char
 * rather than a tk_wchar to describe a Java char field.
 *
 * This only works in RMI-IIOP with Util.writeAny since we actually
 * know what ORB and stream we're writing with when we insert
 * the value.
 *
 * Returns null if it wasn't possible to create the TypeCode (means
 * it wasn't our ORB or Any implementation).
 *
 * This does not handle null objs.
 */
private TypeCode createTypeCode(Serializable obj,
                                org.omg.CORBA.Any any,
                                org.omg.CORBA.ORB orb) {

    if (any instanceof com.sun.corba.se.impl.corba.AnyImpl &&
        orb instanceof ORB) {

        com.sun.corba.se.impl.corba.AnyImpl anyImpl
            = (com.sun.corba.se.impl.corba.AnyImpl)any;

        ORB ourORB = (ORB)orb;

        return anyImpl.createTypeCodeForClass(obj.getClass(), ourORB);

    } else
        return null;
}
 
Example 9
Project: OpenJSharp   File: SharedCDRContactInfoImpl.java   View source code 6 votes vote down vote up
public MessageMediator createMessageMediator(Broker broker,
                                             ContactInfo contactInfo,
                                             Connection connection,
                                             String methodName,
                                             boolean isOneWay)
{
    if (connection != null) {
        /// XXX LOGGING
        throw new RuntimeException("connection is not null");
    }

    CorbaMessageMediator messageMediator =
        new CorbaMessageMediatorImpl(
            (ORB) broker,
            contactInfo,
            null, // Connection;
            GIOPVersion.chooseRequestVersion( (ORB)broker,
                 effectiveTargetIOR),
            effectiveTargetIOR,
            requestId++, // Fake RequestId
            getAddressingDisposition(),
            methodName,
            isOneWay);

    return messageMediator;
}
 
Example 10
Project: OpenJSharp   File: MessageBase.java   View source code 6 votes vote down vote up
/**
 * Construct an ObjectKey from a byte[].
 *
 * @return ObjectKey the object key.
 */
static ObjectKey extractObjectKey(byte[] objKey, ORB orb) {

    try {
        if (objKey != null) {
            ObjectKey objectKey =
                orb.getObjectKeyFactory().create(objKey);
            if (objectKey != null) {
                return objectKey;
            }
        }
    } catch (Exception e) {
        // XXX log this exception
    }

    // This exception is thrown if any exceptions are raised while
    // extracting the object key or if the object key is empty.
    throw wrapper.invalidObjectKey();
}
 
Example 11
Project: OpenJSharp   File: ORBInitInfoImpl.java   View source code 6 votes vote down vote up
/**
 * Creates a new ORBInitInfoImpl object (scoped to package)
 *
 * @param args The arguments passed to ORB_init.
 */
ORBInitInfoImpl( ORB orb, String[] args,
    String orbId, CodecFactory codecFactory )
{
    this.orb = orb;

    wrapper = InterceptorsSystemException.get( orb,
        CORBALogDomains.RPC_PROTOCOL ) ;
    orbutilWrapper = ORBUtilSystemException.get( orb,
        CORBALogDomains.RPC_PROTOCOL ) ;
    omgWrapper = OMGSystemException.get( orb,
        CORBALogDomains.RPC_PROTOCOL ) ;

    this.args = args;
    this.orbId = orbId;
    this.codecFactory = codecFactory;
}
 
Example 12
Project: openjdk-jdk10   File: NamingContextImpl.java   View source code 6 votes vote down vote up
/**
 * Create a naming context servant.
 * Runs the super constructor.
 * @param orb an ORB object.
 * @param objKey as String
 * @param theNameService as NameService
 * @param theServantManagerImpl as ServantManagerImpl
 * @exception java.lang.Exception a Java exception.
 */

public NamingContextImpl(ORB orb, String objKey,
    NameService theNameService, ServantManagerImpl theServantManagerImpl  )
    throws Exception
{
    super();

    this.orb = orb;
    readWrapper = NamingSystemException.get( orb,
        CORBALogDomains.NAMING_READ ) ;
    updateWrapper = NamingSystemException.get( orb,
        CORBALogDomains.NAMING_UPDATE ) ;

    debug = true ; // orb.namingDebugFlag ;
    this.objKey = objKey;
    theNameServiceHandle = theNameService;
    theServantManagerImplHandle = theServantManagerImpl;
    insImpl =
        new com.sun.corba.se.impl.naming.cosnaming.InterOperableNamingImpl();
}
 
Example 13
Project: OpenJSharp   File: SpecialMethod.java   View source code 6 votes vote down vote up
public CorbaMessageMediator invoke(java.lang.Object servant,
                                   CorbaMessageMediator request,
                                   byte[] objectId,
                                   ObjectAdapter objectAdapter)
{
    ORB orb = (ORB)request.getBroker() ;
    ORBUtilSystemException wrapper = ORBUtilSystemException.get( orb,
        CORBALogDomains.OA_INVOCATION ) ;

    if ((servant == null) || (servant instanceof NullServant)) {
        return request.getProtocolHandler().createSystemExceptionResponse(
            request, wrapper.badSkeleton(), null);
    } else {
        return request.getProtocolHandler().createSystemExceptionResponse(
            request, wrapper.getinterfaceNotImplemented(), null);
    }
}
 
Example 14
Project: OpenJSharp   File: CorbaClientRequestDispatcherImpl.java   View source code 6 votes vote down vote up
protected void getExceptionDetailMessage(
    CorbaMessageMediator  messageMediator,
    ORBUtilSystemException wrapper)
{
    ServiceContext sc = messageMediator.getReplyServiceContexts()
        .get(ExceptionDetailMessage.value);
    if (sc == null)
        return ;

    if (! (sc instanceof UnknownServiceContext)) {
        throw wrapper.badExceptionDetailMessageServiceContextType();
    }
    byte[] data = ((UnknownServiceContext)sc).getData();
    EncapsInputStream in =
            EncapsInputStreamFactory.newEncapsInputStream((ORB)messageMediator.getBroker(),
                                  data, data.length);
    in.consumeEndian();

    String msg =
          "----------BEGIN server-side stack trace----------\n"
        + in.read_wstring() + "\n"
        + "----------END server-side stack trace----------";

    messageMediator.setReplyExceptionDetailMessage(msg);
}
 
Example 15
Project: OpenJSharp   File: Util.java   View source code 6 votes vote down vote up
/**
 * This is used to create the TypeCode for a null reference.
 * It also handles backwards compatibility with JDK 1.3.x.
 *
 * This method will not return null.
 */
private TypeCode createTypeCodeForNull(org.omg.CORBA.ORB orb)
{
    if (orb instanceof ORB) {

        ORB ourORB = (ORB)orb;

        // Preserve backwards compatibility with Kestrel and Ladybird
        // by not fully implementing interop issue resolution 3857,
        // and returning a null TypeCode with a tk_value TCKind.
        // If we're not talking to Kestrel or Ladybird, fall through
        // to the abstract interface case (also used for foreign ORBs).
        if (!ORBVersionFactory.getFOREIGN().equals(ourORB.getORBVersion()) &&
            ORBVersionFactory.getNEWER().compareTo(ourORB.getORBVersion()) > 0) {

            return orb.get_primitive_tc(TCKind.tk_value);
        }
    }

    // Use tk_abstract_interface as detailed in the resolution

    // REVISIT: Define this in IDL and get the ID in generated code
    String abstractBaseID = "IDL:omg.org/CORBA/AbstractBase:1.0";

    return orb.create_abstract_interface_tc(abstractBaseID, "");
}
 
Example 16
Project: OpenJSharp   File: LocalClientRequestDispatcherBase.java   View source code 6 votes vote down vote up
protected LocalClientRequestDispatcherBase(ORB orb, int scid, IOR ior)
{
    this.orb = orb ;

    TaggedProfile prof = ior.getProfile() ;
    servantIsLocal = orb.getORBData().isLocalOptimizationAllowed() &&
        prof.isLocal();

    ObjectKeyTemplate oktemp = prof.getObjectKeyTemplate() ;
    this.scid = oktemp.getSubcontractId() ;
    RequestDispatcherRegistry sreg = orb.getRequestDispatcherRegistry() ;
    oaf = sreg.getObjectAdapterFactory( scid ) ;
    oaid = oktemp.getObjectAdapterId() ;
    ObjectId oid = prof.getObjectId() ;
    objectId = oid.getId() ;
}
 
Example 17
Project: openjdk-jdk10   File: ORBUtility.java   View source code 6 votes vote down vote up
/** Obtains an IOR for the object reference obj, first connecting it to
* the ORB if necessary.
* @return IOR the IOR that represents this objref.  This will
* never be null.
* @exception BAD_OPERATION if the object could not be connected,
* if a connection attempt was needed.
* @exception BAD_PARAM if obj is a local object, or else was
* created by a foreign ORB.
*/
public static IOR connectAndGetIOR( ORB orb, org.omg.CORBA.Object obj )
{
    IOR result ;
    try {
        result = getIOR( obj ) ;
    } catch (BAD_OPERATION bop) {
        if (StubAdapter.isStub(obj)) {
            try {
                StubAdapter.connect( obj, orb ) ;
            } catch (java.rmi.RemoteException exc) {
                throw wrapper.connectingServant( exc ) ;
            }
        } else {
            orb.connect( obj ) ;
        }

        result = getIOR( obj ) ;
    }

    return result ;
}
 
Example 18
Project: openjdk-jdk10   File: EncapsInputStreamFactory.java   View source code 5 votes vote down vote up
public static EncapsInputStream newEncapsInputStream(
        final org.omg.CORBA.ORB orb, final byte[] data, final int size,
        final GIOPVersion version) {
    return AccessController
            .doPrivileged(new PrivilegedAction<EncapsInputStream>() {
                @Override
                public EncapsInputStream run() {
                    return new EncapsInputStream(orb, data, size, version);
                }
            });
}
 
Example 19
Project: OpenJSharp   File: EncapsInputStreamFactory.java   View source code 5 votes vote down vote up
public static TypeCodeInputStream newTypeCodeInputStream(
        final org.omg.CORBA.ORB orb, final ByteBuffer byteBuffer,
        final int size, final boolean littleEndian,
        final GIOPVersion version) {
    return AccessController
            .doPrivileged(new PrivilegedAction<TypeCodeInputStream>() {
                @Override
                public TypeCodeInputStream run() {
                    return new TypeCodeInputStream(orb, byteBuffer, size,
                            littleEndian, version);
                }
            });
}
 
Example 20
Project: OpenJSharp   File: SocketOrChannelAcceptorImpl.java   View source code 5 votes vote down vote up
public InputObject createInputObject(Broker broker,
                                     MessageMediator messageMediator)
{
    CorbaMessageMediator corbaMessageMediator = (CorbaMessageMediator)
        messageMediator;
    return new CDRInputObject((ORB)broker,
                              (CorbaConnection)messageMediator.getConnection(),
                              corbaMessageMediator.getDispatchBuffer(),
                              corbaMessageMediator.getDispatchHeader());
}
 
Example 21
Project: OpenJSharp   File: MessageBase.java   View source code 5 votes vote down vote up
public static Message readGIOPBody(ORB orb,
                                   CorbaConnection connection,
                                   Message msg)
{
    ReadTimeouts readTimeouts =
                       orb.getORBData().getTransportTCPReadTimeouts();
    ByteBuffer buf = msg.getByteBuffer();

    buf.position(MessageBase.GIOPMessageHeaderLength);
    int msgSizeMinusHeader =
        msg.getSize() - MessageBase.GIOPMessageHeaderLength;
    try {
        buf = connection.read(buf,
                      GIOPMessageHeaderLength, msgSizeMinusHeader,
                      readTimeouts.get_max_time_to_wait());
    } catch (IOException e) {
        throw wrapper.ioexceptionWhenReadingConnection(e);
    }

    msg.setByteBuffer(buf);

    if (orb.giopDebugFlag) {
        dprint(".readGIOPBody: received message:");
        ByteBuffer viewBuffer = buf.asReadOnlyBuffer();
        viewBuffer.position(0).limit(msg.getSize());
        ByteBufferWithInfo bbwi = new ByteBufferWithInfo(orb, viewBuffer);
        CDRInputStream_1_0.printBuffer(bbwi);
    }

    return msg;
}
 
Example 22
Project: openjdk-jdk10   File: DynStructImpl.java   View source code 5 votes vote down vote up
protected DynStructImpl(ORB orb, TypeCode typeCode) {
    // We can be sure that typeCode is of kind tk_struct
    super(orb, typeCode);
    // For DynStruct, the operation sets the current position to -1
    // for empty exceptions and to zero for all other TypeCodes.
    // The members (if any) are (recursively) initialized to their default values.
    index = 0;
}
 
Example 23
Project: openjdk-jdk10   File: CDRInputObject.java   View source code 5 votes vote down vote up
public CDRInputObject(ORB orb,
                      CorbaConnection corbaConnection,
                      ByteBuffer byteBuffer,
                      Message header)
{
    super(orb, byteBuffer, header.getSize(), header.isLittleEndian(),
          header.getGIOPVersion(), header.getEncodingVersion(),
          BufferManagerFactory.newBufferManagerRead(
                                      header.getGIOPVersion(),
                                      header.getEncodingVersion(),
                                      orb));

    this.corbaConnection = corbaConnection;
    this.orb = orb ;
    this.wrapper = ORBUtilSystemException.get( orb,
        CORBALogDomains.RPC_ENCODING ) ;
    this.omgWrapper = OMGSystemException.get( orb,
        CORBALogDomains.RPC_ENCODING ) ;

    if (orb.transportDebugFlag) {
        dprint(".CDRInputObject constructor:");
    }

    getBufferManager().init(header);

    this.header = header;

    unmarshaledHeader = false;

    setIndex(Message.GIOPMessageHeaderLength);

    setBufferLength(header.getSize());
}
 
Example 24
Project: openjdk-jdk10   File: CorbaTransportManagerImpl.java   View source code 5 votes vote down vote up
public CorbaTransportManagerImpl(ORB orb)
{
    this.orb = orb;
    acceptors = new ArrayList();
    outboundConnectionCaches = new HashMap();
    inboundConnectionCaches = new HashMap();
    selector = new SelectorImpl(orb);
}
 
Example 25
Project: openjdk-jdk10   File: RequestDispatcherDefault.java   View source code 5 votes vote down vote up
public static LocalClientRequestDispatcherFactory makeInfoOnlyServantCacheLocalClientRequestDispatcherFactory( final ORB orb )
{
    return new LocalClientRequestDispatcherFactory() {
        public LocalClientRequestDispatcher create( int id, IOR ior ) {
            return new InfoOnlyServantCacheLocalCRDImpl( orb, id, ior ) ;
        }
    } ;
}
 
Example 26
Project: openjdk-jdk10   File: EncapsInputStream.java   View source code 5 votes vote down vote up
public EncapsInputStream(org.omg.CORBA.ORB orb, ByteBuffer byteBuffer,
                         int size, boolean littleEndian,
                         GIOPVersion version) {
    super(orb, byteBuffer, size, littleEndian,
          version, Message.CDR_ENC_VERSION,
          BufferManagerFactory.newBufferManagerRead(
                                  BufferManagerFactory.GROW,
                                  Message.CDR_ENC_VERSION,
                                  (com.sun.corba.se.spi.orb.ORB)orb));

    performORBVersionSpecificInit();
}
 
Example 27
Project: openjdk-jdk10   File: IIOPProfileTemplateImpl.java   View source code 5 votes vote down vote up
public IIOPProfileTemplateImpl( ORB orb, GIOPVersion version, IIOPAddress primary )
{
    this.orb = orb ;
    this.giopVersion = version ;
    this.primary = primary ;
    if (giopVersion.getMinor() == 0)
        // Adding tagged components is not allowed for IIOP 1.0,
        // so this template is complete and should be made immutable.
        makeImmutable() ;
}
 
Example 28
Project: OpenJSharp   File: UtilSystemException.java   View source code 5 votes vote down vote up
public static UtilSystemException get( String logDomain )
{
    UtilSystemException wrapper = 
        (UtilSystemException) ORB.staticGetLogWrapper( logDomain, 
            "UTIL", factory ) ;
    return wrapper ;
}
 
Example 29
Project: OpenJSharp   File: CorbaTransportManagerImpl.java   View source code 5 votes vote down vote up
public CorbaTransportManagerImpl(ORB orb)
{
    this.orb = orb;
    acceptors = new ArrayList();
    outboundConnectionCaches = new HashMap();
    inboundConnectionCaches = new HashMap();
    selector = new SelectorImpl(orb);
}
 
Example 30
Project: OpenJSharp   File: RequestMessage_1_2.java   View source code 5 votes vote down vote up
RequestMessage_1_2(ORB orb, int _request_id, byte _response_flags,
        byte[] _reserved, TargetAddress _target,
        String _operation, ServiceContexts _service_contexts) {
    super(Message.GIOPBigMagic, GIOPVersion.V1_2, FLAG_NO_FRAG_BIG_ENDIAN,
        Message.GIOPRequest, 0);
    this.orb = orb;
    this.wrapper = ORBUtilSystemException.get( orb,
        CORBALogDomains.RPC_PROTOCOL ) ;
    request_id = _request_id;
    response_flags = _response_flags;
    reserved = _reserved;
    target = _target;
    operation = _operation;
    service_contexts = _service_contexts;
}
 
Example 31
Project: openjdk-jdk10   File: POAFactory.java   View source code 5 votes vote down vote up
public void init( ORB orb )
{
    this.orb = orb ;
    wrapper = POASystemException.get( orb,
        CORBALogDomains.OA_LIFECYCLE ) ;
    omgWrapper = OMGSystemException.get( orb,
        CORBALogDomains.OA_LIFECYCLE ) ;
    delegateImpl = new DelegateImpl( orb, this ) ;
    registerRootPOA() ;

    POACurrent poaCurrent = new POACurrent(orb);
    orb.getLocalResolver().register( ORBConstants.POA_CURRENT_NAME,
        ClosureFactory.makeConstant( poaCurrent ) ) ;
}
 
Example 32
Project: openjdk-jdk10   File: StubFactoryFactoryDynamicBase.java   View source code 5 votes vote down vote up
public PresentationManager.StubFactory createStubFactory(
    String className, boolean isIDLStub, String remoteCodeBase,
    Class expectedClass, ClassLoader classLoader)
{
    Class cls = null ;

    try {
        cls = Util.loadClass( className, remoteCodeBase, classLoader ) ;
    } catch (ClassNotFoundException exc) {
        throw wrapper.classNotFound3(
            CompletionStatus.COMPLETED_MAYBE, exc, className ) ;
    }

    PresentationManager pm = ORB.getPresentationManager() ;

    if (IDLEntity.class.isAssignableFrom( cls ) &&
        !Remote.class.isAssignableFrom( cls )) {
        // IDL stubs must always use static factories.
        PresentationManager.StubFactoryFactory sff =
            pm.getStubFactoryFactory( false ) ;
        PresentationManager.StubFactory sf =
            sff.createStubFactory( className, true, remoteCodeBase,
                expectedClass, classLoader ) ;
        return sf ;
    } else {
        PresentationManager.ClassData classData = pm.getClassData( cls ) ;
        return makeDynamicStubFactory( pm, classData, classLoader ) ;
    }
}
 
Example 33
Project: OpenJSharp   File: ServiceContexts.java   View source code 5 votes vote down vote up
private static boolean isDebugging( InputStream is )
{
    ORB orb = (ORB)(is.orb()) ;
    if (orb==null)
        return false ;
    return orb.serviceContextDebugFlag ;
}
 
Example 34
Project: OpenJSharp   File: CorbaMessageMediatorImpl.java   View source code 5 votes vote down vote up
private void endRequest(CorbaMessageMediator messageMediator)
{
    ORB orb = (ORB) messageMediator.getBroker();
    if (orb.subcontractDebugFlag) {
        dprint(".handleRequest<-: " + opAndId(messageMediator));
    }

    // release NIO ByteBuffers to ByteBufferPool

    try {
        OutputObject outputObj = messageMediator.getOutputObject();
        if (outputObj != null) {
            outputObj.close();
        }
        InputObject inputObj = messageMediator.getInputObject();
        if (inputObj != null) {
            inputObj.close();
        }
    } catch (IOException ex) {
        // Given what close() does, this catch shouldn't ever happen.
        // See CDRInput/OutputObject.close() for more info.
        // It also won't result in a Corba error if an IOException happens.
        if (orb.subcontractDebugFlag) {
            dprint(".endRequest: IOException:" + ex.getMessage(), ex);
        }
    } finally {
        ((CorbaConnection)messageMediator.getConnection()).serverRequestProcessingEnds();
    }
}
 
Example 35
Project: OpenJSharp   File: TypeCodeImpl.java   View source code 5 votes vote down vote up
public TypeCodeImpl(ORB orb,
                    int creationKind,
                    int bound,
                    int offset)
                    // for recursive sequences
{
    this(orb) ;

    if (creationKind == TCKind._tk_sequence) {
        _kind               = creationKind;
        _length             = bound;
        _parentOffset       = offset;
    } // else initializes to null
}
 
Example 36
Project: OpenJSharp   File: POALocalCRDImpl.java   View source code 5 votes vote down vote up
public POALocalCRDImpl( ORB orb, int scid, IOR ior)
{
    super( (com.sun.corba.se.spi.orb.ORB)orb, scid, ior );
    wrapper = ORBUtilSystemException.get( orb,
        CORBALogDomains.RPC_PROTOCOL ) ;
    poaWrapper = POASystemException.get( orb,
        CORBALogDomains.RPC_PROTOCOL ) ;
}
 
Example 37
Project: OpenJSharp   File: IORSystemException.java   View source code 5 votes vote down vote up
public static IORSystemException get( String logDomain )
{
    IORSystemException wrapper = 
        (IORSystemException) ORB.staticGetLogWrapper( logDomain, 
            "IOR", factory ) ;
    return wrapper ;
}
 
Example 38
Project: openjdk-jdk10   File: NamingContextImpl.java   View source code 5 votes vote down vote up
/**
 * Create a naming context servant.
 * Runs the super constructor.
 * @param orb an ORB object.
 * @exception java.lang.Exception a Java exception.
 */
public NamingContextImpl(ORB orb, POA poa) throws java.lang.Exception {
    super();
    this.orb = orb;
    wrapper = NamingSystemException.get( orb,
        CORBALogDomains.NAMING_UPDATE ) ;

    insImpl = new InterOperableNamingImpl( );
    this.nsPOA = poa;
    readLogger = orb.getLogger( CORBALogDomains.NAMING_READ);
    updateLogger = orb.getLogger( CORBALogDomains.NAMING_UPDATE);
    lifecycleLogger = orb.getLogger(
        CORBALogDomains.NAMING_LIFECYCLE);
}
 
Example 39
Project: openjdk-jdk10   File: OutputStreamFactory.java   View source code 5 votes vote down vote up
public static CDROutputObject newCDROutputObject(
        final ORB orb, final MessageMediator messageMediator,
        final Message header, final byte streamFormatVersion,
        final int strategy) {
    return AccessController.doPrivileged(
        new PrivilegedAction<CDROutputObject>() {
            @Override
            public CDROutputObject run() {
                return new CDROutputObject(orb, messageMediator,
                    header, streamFormatVersion, strategy);
            }
    });
}
 
Example 40
Project: openjdk-jdk10   File: CorbaClientRequestDispatcherImpl.java   View source code 5 votes vote down vote up
protected void addServiceContexts(CorbaMessageMediator messageMediator)
{
    ORB orb = (ORB)messageMediator.getBroker();
    CorbaConnection c = (CorbaConnection) messageMediator.getConnection();
    GIOPVersion giopVersion = messageMediator.getGIOPVersion();

    ServiceContexts contexts = messageMediator.getRequestServiceContexts();

    addCodeSetServiceContext(c, contexts, giopVersion);

    // Add the RMI-IIOP max stream format version
    // service context to every request.  Once we have GIOP 1.3,
    // we could skip it since we now support version 2, but
    // probably safer to always send it.
    contexts.put(MaxStreamFormatVersionServiceContext.singleton);

    // ORBVersion servicecontext needs to be sent
    ORBVersionServiceContext ovsc = new ORBVersionServiceContext(
                    ORBVersionFactory.getORBVersion() ) ;
    contexts.put( ovsc ) ;

    // NOTE : We only want to send the runtime context the first time
    if ((c != null) && !c.isPostInitialContexts()) {
        // Do not do c.setPostInitialContexts() here.
        // If a client interceptor send_request does a ForwardRequest
        // which ends up using the same connection then the service
        // context would not be sent.
        SendingContextServiceContext scsc =
            new SendingContextServiceContext( orb.getFVDCodeBaseIOR() ) ; //d11638
        contexts.put( scsc ) ;
    }
}