com.sun.corba.se.impl.orbutil.ORBConstants Java Examples

The following examples show how to use com.sun.corba.se.impl.orbutil.ORBConstants. 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: ProcessMonitorThread.java    From JDKSourceCode1.8 with MIT License 6 votes vote down vote up
static void start( HashMap serverTable ) {
    int sleepTime = ORBConstants.DEFAULT_SERVER_POLLING_TIME;

    String pollingTime = System.getProperties().getProperty(
        ORBConstants.SERVER_POLLING_TIME );

    if ( pollingTime != null ) {
        try {
            sleepTime = Integer.parseInt( pollingTime );
        } catch (Exception e ) {
            // Too late to complain, Just use the default
            // sleepTime
        }
    }

    instance = new ProcessMonitorThread( serverTable,
        sleepTime );
    instance.setDaemon( true );
    instance.start();
}
 
Example #2
Source File: BufferManagerWriteGrow.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Returns the correct buffer size for this type of
 * buffer manager as set in the ORB.
 */
public int getBufferSize() {
    ORBData orbData = null;
    int bufferSize = ORBConstants.GIOP_DEFAULT_BUFFER_SIZE;
    if (orb != null) {
        orbData = orb.getORBData();
        if (orbData != null) {
            bufferSize = orbData.getGIOPBufferSize();
            dprint("BufferManagerWriteGrow.getBufferSize: bufferSize == " + bufferSize);
        } else {
            dprint("BufferManagerWriteGrow.getBufferSize: orbData reference is NULL");
        }
    } else {
        dprint("BufferManagerWriteGrow.getBufferSize: orb reference is NULL");
    }
    return bufferSize;
}
 
Example #3
Source File: NameServer.java    From openjdk-8-source with GNU General Public License v2.0 6 votes vote down vote up
protected void run()
{
    try {

        // create the persistent name service
        NameService ns = new NameService(orb, dbDir);

        // add root naming context to initial naming
        NamingContext rootContext = ns.initialNamingContext();
        InitialNameService ins = InitialNameServiceHelper.narrow(
                                 orb.resolve_initial_references(
                                 ORBConstants.INITIAL_NAME_SERVICE_NAME ));
        ins.bind( "NameService", rootContext, true);
        System.out.println(CorbaResourceUtil.getText("pnameserv.success"));

        // wait for invocations
        orb.run();

    } catch (Exception ex) {

        ex.printStackTrace(System.err);
    }
}
 
Example #4
Source File: DataCollectorBase.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
public DataCollectorBase( Properties props, String localHostName,
    String configurationHostName )
{
    // XXX This is fully initialized here.  So do we ever want to
    // generalize this (or perhaps this is the wrong place for this?)
    URLPropertyNames = new HashSet() ;
    URLPropertyNames.add( ORBConstants.INITIAL_SERVICES_PROPERTY ) ;

    propertyNames = new HashSet() ;

    // Make sure that we are ready to handle -ORBInitRef.  This is special
    // due to the need to handle multiple -ORBInitRef args as prefix
    // parsing.
    propertyNames.add( ORBConstants.ORB_INIT_REF_PROPERTY ) ;

    propertyPrefixes = new HashSet() ;

    this.originalProps = props ;
    this.localHostName = localHostName ;
    this.configurationHostName = configurationHostName ;
    setParserCalled = false ;
    resultProps = new Properties() ;
}
 
Example #5
Source File: ORBD.java    From hottub with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Ensure that the Db directory exists. If not, create the Db
 * and the log directory and return true. Otherwise return false.
 */
protected boolean createSystemDirs(String defaultDbDir)
{
    boolean dirCreated = false;
    Properties props = System.getProperties();
    String fileSep = props.getProperty("file.separator");

    // determine the ORB db directory
    dbDir = new File (props.getProperty( ORBConstants.DB_DIR_PROPERTY,
        props.getProperty("user.dir") + fileSep + defaultDbDir));

    // create the db and the logs directories
    dbDirName = dbDir.getAbsolutePath();
    props.put(ORBConstants.DB_DIR_PROPERTY, dbDirName);
    if (!dbDir.exists()) {
        dbDir.mkdir();
        dirCreated = true;
    }

    File logDir = new File (dbDir, ORBConstants.SERVER_LOG_DIR ) ;
    if (!logDir.exists()) logDir.mkdir();

    return dirCreated;
}
 
Example #6
Source File: CorbaMessageMediatorImpl.java    From jdk1.8-source-analysis with Apache License 2.0 6 votes vote down vote up
private byte getStreamFormatVersionForThisRequest(IOR ior,
                                                  GIOPVersion giopVersion)
{

    byte localMaxVersion
        = ORBUtility.getMaxStreamFormatVersion();

    IOR effectiveTargetIOR =
        ((CorbaContactInfo)this.contactInfo).getEffectiveTargetIOR();
    IIOPProfileTemplate temp =
        (IIOPProfileTemplate)effectiveTargetIOR.getProfile().getTaggedProfileTemplate();
    Iterator iter = temp.iteratorById(TAG_RMI_CUSTOM_MAX_STREAM_FORMAT.value);
    if (!iter.hasNext()) {
        // Didn't have the max stream format version tagged
        // component.
        if (giopVersion.lessThan(GIOPVersion.V1_3))
            return ORBConstants.STREAM_FORMAT_VERSION_1;
        else
            return ORBConstants.STREAM_FORMAT_VERSION_2;
    }

    byte remoteMaxVersion
        = ((MaxStreamFormatVersionComponent)iter.next()).getMaxStreamFormatVersion();

    return (byte)Math.min(localMaxVersion, remoteMaxVersion);
}
 
Example #7
Source File: ORBD.java    From jdk1.8-source-analysis with Apache License 2.0 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 #8
Source File: CorbaMessageMediatorImpl.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
private CDROutputObject createAppropriateOutputObject(
    CorbaMessageMediator messageMediator,
    Message msg, LocateReplyMessage reply)
{
    CDROutputObject outputObject;

    if (msg.getGIOPVersion().lessThan(GIOPVersion.V1_2)) {
        // locate msgs 1.0 & 1.1 :=> grow,
        outputObject = sun.corba.OutputStreamFactory.newCDROutputObject(
                         (ORB) messageMediator.getBroker(),
                         this,
                         GIOPVersion.V1_0,
                         (CorbaConnection) messageMediator.getConnection(),
                         reply,
                         ORBConstants.STREAM_FORMAT_VERSION_1);
    } else {
        // 1.2 :=> stream
        outputObject = sun.corba.OutputStreamFactory.newCDROutputObject(
                         (ORB) messageMediator.getBroker(),
                         messageMediator,
                         reply,
                         ORBConstants.STREAM_FORMAT_VERSION_1);
    }
    return outputObject;
}
 
Example #9
Source File: CorbaMessageMediatorImpl.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
private CDROutputObject createAppropriateOutputObject(
    CorbaMessageMediator messageMediator,
    Message msg, LocateReplyMessage reply)
{
    CDROutputObject outputObject;

    if (msg.getGIOPVersion().lessThan(GIOPVersion.V1_2)) {
        // locate msgs 1.0 & 1.1 :=> grow,
        outputObject = sun.corba.OutputStreamFactory.newCDROutputObject(
                         (ORB) messageMediator.getBroker(),
                         this,
                         GIOPVersion.V1_0,
                         (CorbaConnection) messageMediator.getConnection(),
                         reply,
                         ORBConstants.STREAM_FORMAT_VERSION_1);
    } else {
        // 1.2 :=> stream
        outputObject = sun.corba.OutputStreamFactory.newCDROutputObject(
                         (ORB) messageMediator.getBroker(),
                         messageMediator,
                         reply,
                         ORBConstants.STREAM_FORMAT_VERSION_1);
    }
    return outputObject;
}
 
Example #10
Source File: CorbaMessageMediatorImpl.java    From hottub with GNU General Public License v2.0 6 votes vote down vote up
private CDROutputObject createAppropriateOutputObject(
    CorbaMessageMediator messageMediator,
    Message msg, LocateReplyMessage reply)
{
    CDROutputObject outputObject;

    if (msg.getGIOPVersion().lessThan(GIOPVersion.V1_2)) {
        // locate msgs 1.0 & 1.1 :=> grow,
        outputObject = sun.corba.OutputStreamFactory.newCDROutputObject(
                         (ORB) messageMediator.getBroker(),
                         this,
                         GIOPVersion.V1_0,
                         (CorbaConnection) messageMediator.getConnection(),
                         reply,
                         ORBConstants.STREAM_FORMAT_VERSION_1);
    } else {
        // 1.2 :=> stream
        outputObject = sun.corba.OutputStreamFactory.newCDROutputObject(
                         (ORB) messageMediator.getBroker(),
                         messageMediator,
                         reply,
                         ORBConstants.STREAM_FORMAT_VERSION_1);
    }
    return outputObject;
}
 
Example #11
Source File: DataCollectorBase.java    From openjdk-8-source with GNU General Public License v2.0 6 votes vote down vote up
private void setProperty( String name, String value )
{
    if( name.equals( ORBConstants.ORB_INIT_REF_PROPERTY ) ) {
        // Value is <name>=<URL>
        StringTokenizer st = new StringTokenizer( value, "=" ) ;
        if (st.countTokens() != 2)
            throw new IllegalArgumentException() ;

        String refName = st.nextToken() ;
        String refValue = st.nextToken() ;

        resultProps.setProperty( name + "." + refName, refValue ) ;
    } else {
        resultProps.setProperty( name, value ) ;
    }
}
 
Example #12
Source File: NamingContextImpl.java    From jdk1.8-source-analysis with Apache License 2.0 6 votes vote down vote up
private synchronized void createbiPOA( ) {
    if( biPOA != null ) {
        return;
    }
    try {
        POA rootPOA = (POA) orb.resolve_initial_references(
            ORBConstants.ROOT_POA_NAME );
        rootPOA.the_POAManager().activate( );

        int i = 0;
        Policy[] poaPolicy = new Policy[3];
        poaPolicy[i++] = rootPOA.create_lifespan_policy(
            LifespanPolicyValue.TRANSIENT);
        poaPolicy[i++] = rootPOA.create_id_assignment_policy(
            IdAssignmentPolicyValue.SYSTEM_ID);
        poaPolicy[i++] = rootPOA.create_servant_retention_policy(
            ServantRetentionPolicyValue.RETAIN);
        biPOA = rootPOA.create_POA("BindingIteratorPOA", null, poaPolicy );
        biPOA.the_POAManager().activate( );
    } catch( Exception e ) {
        throw readWrapper.namingCtxBindingIteratorCreate( e ) ;
    }
}
 
Example #13
Source File: CorbaMessageMediatorImpl.java    From hottub with GNU General Public License v2.0 6 votes vote down vote up
/**
 * If the RMI-IIOP maximum stream format version service context
 * is present, it indicates the maximum stream format version we
 * could use for the reply.  If it isn't present, the default is
 * 2 for GIOP 1.3 or greater, 1 for lower.
 *
 * This is only sent on requests.  Clients can find out the
 * server's maximum by looking for a tagged component in the IOR.
 */
public byte getStreamFormatVersionForReply() {

    // NOTE: The request service contexts may indicate the max.
    ServiceContexts svc = getRequestServiceContexts();

    MaxStreamFormatVersionServiceContext msfvsc
        = (MaxStreamFormatVersionServiceContext)svc.get(
            MaxStreamFormatVersionServiceContext.SERVICE_CONTEXT_ID);

    if (msfvsc != null) {
        byte localMaxVersion = ORBUtility.getMaxStreamFormatVersion();
        byte remoteMaxVersion = msfvsc.getMaximumStreamFormatVersion();

        return (byte)Math.min(localMaxVersion, remoteMaxVersion);
    } else {
        // Defaults to 1 for GIOP 1.2 or less, 2 for
        // GIOP 1.3 or higher.
        if (getGIOPVersion().lessThan(GIOPVersion.V1_3))
            return ORBConstants.STREAM_FORMAT_VERSION_1;
        else
            return ORBConstants.STREAM_FORMAT_VERSION_2;
    }
}
 
Example #14
Source File: CorbaMessageMediatorImpl.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
private CDROutputObject createAppropriateOutputObject(
    CorbaMessageMediator messageMediator,
    Message msg, LocateReplyMessage reply)
{
    CDROutputObject outputObject;

    if (msg.getGIOPVersion().lessThan(GIOPVersion.V1_2)) {
        // locate msgs 1.0 & 1.1 :=> grow,
        outputObject = sun.corba.OutputStreamFactory.newCDROutputObject(
                         (ORB) messageMediator.getBroker(),
                         this,
                         GIOPVersion.V1_0,
                         (CorbaConnection) messageMediator.getConnection(),
                         reply,
                         ORBConstants.STREAM_FORMAT_VERSION_1);
    } else {
        // 1.2 :=> stream
        outputObject = sun.corba.OutputStreamFactory.newCDROutputObject(
                         (ORB) messageMediator.getBroker(),
                         messageMediator,
                         reply,
                         ORBConstants.STREAM_FORMAT_VERSION_1);
    }
    return outputObject;
}
 
Example #15
Source File: IORImpl.java    From openjdk-8-source with GNU General Public License v2.0 6 votes vote down vote up
public String stringify()
{
    StringWriter bs;

    MarshalOutputStream s =
        sun.corba.OutputStreamFactory.newEncapsOutputStream(factory);
    s.putEndian();
    write( (OutputStream)s );
    bs = new StringWriter();
    try {
        s.writeTo(new HexOutputStream(bs));
    } catch (IOException ex) {
        throw wrapper.stringifyWriteError( ex ) ;
    }

    return ORBConstants.STRINGIFY_PREFIX + bs;
}
 
Example #16
Source File: POAFactory.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
public synchronized POA getRootPOA()
{
    if (rootPOA == null) {
        // See if we are trying to getRootPOA while shutting down the ORB.
        if (isShuttingDown) {
            throw omgWrapper.noObjectAdaptor( ) ;
        }

        try {
            Object obj = orb.resolve_initial_references(
                ORBConstants.ROOT_POA_NAME ) ;
            rootPOA = (POAImpl)obj ;
        } catch (InvalidName inv) {
            throw wrapper.cantResolveRootPoa( inv ) ;
        }
    }

    return rootPOA;
}
 
Example #17
Source File: CorbaMessageMediatorImpl.java    From jdk8u60 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * If the RMI-IIOP maximum stream format version service context
 * is present, it indicates the maximum stream format version we
 * could use for the reply.  If it isn't present, the default is
 * 2 for GIOP 1.3 or greater, 1 for lower.
 *
 * This is only sent on requests.  Clients can find out the
 * server's maximum by looking for a tagged component in the IOR.
 */
public byte getStreamFormatVersionForReply() {

    // NOTE: The request service contexts may indicate the max.
    ServiceContexts svc = getRequestServiceContexts();

    MaxStreamFormatVersionServiceContext msfvsc
        = (MaxStreamFormatVersionServiceContext)svc.get(
            MaxStreamFormatVersionServiceContext.SERVICE_CONTEXT_ID);

    if (msfvsc != null) {
        byte localMaxVersion = ORBUtility.getMaxStreamFormatVersion();
        byte remoteMaxVersion = msfvsc.getMaximumStreamFormatVersion();

        return (byte)Math.min(localMaxVersion, remoteMaxVersion);
    } else {
        // Defaults to 1 for GIOP 1.2 or less, 2 for
        // GIOP 1.3 or higher.
        if (getGIOPVersion().lessThan(GIOPVersion.V1_3))
            return ORBConstants.STREAM_FORMAT_VERSION_1;
        else
            return ORBConstants.STREAM_FORMAT_VERSION_2;
    }
}
 
Example #18
Source File: ORBD.java    From TencentKona-8 with GNU General Public License v2.0 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 #19
Source File: ServerTool.java    From jdk8u60 with 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 #20
Source File: ProcessMonitorThread.java    From openjdk-8-source with GNU General Public License v2.0 6 votes vote down vote up
static void start( HashMap serverTable ) {
    int sleepTime = ORBConstants.DEFAULT_SERVER_POLLING_TIME;

    String pollingTime = System.getProperties().getProperty(
        ORBConstants.SERVER_POLLING_TIME );

    if ( pollingTime != null ) {
        try {
            sleepTime = Integer.parseInt( pollingTime );
        } catch (Exception e ) {
            // Too late to complain, Just use the default
            // sleepTime
        }
    }

    instance = new ProcessMonitorThread( serverTable,
        sleepTime );
    instance.setDaemon( true );
    instance.start();
}
 
Example #21
Source File: DataCollectorBase.java    From JDKSourceCode1.8 with MIT License 6 votes vote down vote up
public DataCollectorBase( Properties props, String localHostName,
    String configurationHostName )
{
    // XXX This is fully initialized here.  So do we ever want to
    // generalize this (or perhaps this is the wrong place for this?)
    URLPropertyNames = new HashSet() ;
    URLPropertyNames.add( ORBConstants.INITIAL_SERVICES_PROPERTY ) ;

    propertyNames = new HashSet() ;

    // Make sure that we are ready to handle -ORBInitRef.  This is special
    // due to the need to handle multiple -ORBInitRef args as prefix
    // parsing.
    propertyNames.add( ORBConstants.ORB_INIT_REF_PROPERTY ) ;

    propertyPrefixes = new HashSet() ;

    this.originalProps = props ;
    this.localHostName = localHostName ;
    this.configurationHostName = configurationHostName ;
    setParserCalled = false ;
    resultProps = new Properties() ;
}
 
Example #22
Source File: ORBImpl.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
public boolean isLocalServerId( int subcontractId, int serverId )
{
    synchronized (this) {
            checkShutdownState();
    }
    if ((subcontractId < ORBConstants.FIRST_POA_SCID) ||
        (subcontractId > ORBConstants.MAX_POA_SCID))
        return serverId == getTransientServerId( ) ;

    // XXX isTransient info should be stored in subcontract registry
    if (ORBConstants.isTransient( subcontractId ))
        return (serverId == getTransientServerId()) ;
    else if (configData.getPersistentServerIdInitialized())
        return (serverId == configData.getPersistentServerId()) ;
    else
        return false ;
}
 
Example #23
Source File: POAFactory.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
public synchronized POA getRootPOA()
{
    if (rootPOA == null) {
        // See if we are trying to getRootPOA while shutting down the ORB.
        if (isShuttingDown) {
            throw omgWrapper.noObjectAdaptor( ) ;
        }

        try {
            Object obj = orb.resolve_initial_references(
                ORBConstants.ROOT_POA_NAME ) ;
            rootPOA = (POAImpl)obj ;
        } catch (InvalidName inv) {
            throw wrapper.cantResolveRootPoa( inv ) ;
        }
    }

    return rootPOA;
}
 
Example #24
Source File: ORBImpl.java    From openjdk-8-source with GNU General Public License v2.0 6 votes vote down vote up
public boolean isLocalServerId( int subcontractId, int serverId )
{
    synchronized (this) {
            checkShutdownState();
    }
    if ((subcontractId < ORBConstants.FIRST_POA_SCID) ||
        (subcontractId > ORBConstants.MAX_POA_SCID))
        return serverId == getTransientServerId( ) ;

    // XXX isTransient info should be stored in subcontract registry
    if (ORBConstants.isTransient( subcontractId ))
        return (serverId == getTransientServerId()) ;
    else if (configData.getPersistentServerIdInitialized())
        return (serverId == configData.getPersistentServerId()) ;
    else
        return false ;
}
 
Example #25
Source File: ServerTool.java    From openjdk-jdk8u-backup with 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 #26
Source File: POAFactory.java    From openjdk-8-source with GNU General Public License v2.0 6 votes vote down vote up
public synchronized POA getRootPOA()
{
    if (rootPOA == null) {
        // See if we are trying to getRootPOA while shutting down the ORB.
        if (isShuttingDown) {
            throw omgWrapper.noObjectAdaptor( ) ;
        }

        try {
            Object obj = orb.resolve_initial_references(
                ORBConstants.ROOT_POA_NAME ) ;
            rootPOA = (POAImpl)obj ;
        } catch (InvalidName inv) {
            throw wrapper.cantResolveRootPoa( inv ) ;
        }
    }

    return rootPOA;
}
 
Example #27
Source File: INSURLOperationImpl.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
/** This static method takes a Stringified IOR and converts it into IOR object.
  * It is the caller's responsibility to only pass strings that start with "IOR:".
  */
private org.omg.CORBA.Object getIORFromString( String str )
{
    // Length must be even for str to be valid
    if ( (str.length() & 1) == 1 )
        throw wrapper.badStringifiedIorLen() ;

    byte[] buf = new byte[(str.length() - ORBConstants.STRINGIFY_PREFIX.length()) / NIBBLES_PER_BYTE];
    for (int i=ORBConstants.STRINGIFY_PREFIX.length(), j=0; i < str.length(); i +=NIBBLES_PER_BYTE, j++) {
         buf[j] = (byte)((ORBUtility.hexOf(str.charAt(i)) << UN_SHIFT) & 0xF0);
         buf[j] |= (byte)(ORBUtility.hexOf(str.charAt(i+1)) & 0x0F);
    }
    EncapsInputStream s = EncapsInputStreamFactory.newEncapsInputStream(orb, buf, buf.length,
            orb.getORBData().getGIOPVersion());
    s.consumeEndian();
    return s.read_Object() ;
}
 
Example #28
Source File: ORBD.java    From openjdk-8-source with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Ensure that the Db directory exists. If not, create the Db
 * and the log directory and return true. Otherwise return false.
 */
protected boolean createSystemDirs(String defaultDbDir)
{
    boolean dirCreated = false;
    Properties props = System.getProperties();
    String fileSep = props.getProperty("file.separator");

    // determine the ORB db directory
    dbDir = new File (props.getProperty( ORBConstants.DB_DIR_PROPERTY,
        props.getProperty("user.dir") + fileSep + defaultDbDir));

    // create the db and the logs directories
    dbDirName = dbDir.getAbsolutePath();
    props.put(ORBConstants.DB_DIR_PROPERTY, dbDirName);
    if (!dbDir.exists()) {
        dbDir.mkdir();
        dirCreated = true;
    }

    File logDir = new File (dbDir, ORBConstants.SERVER_LOG_DIR ) ;
    if (!logDir.exists()) logDir.mkdir();

    return dirCreated;
}
 
Example #29
Source File: EncapsOutputStream.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
public EncapsOutputStream(ORB orb,
                          GIOPVersion version,
                          boolean isLittleEndian)
{
    super(orb, version, Message.CDR_ENC_VERSION, isLittleEndian,
          BufferManagerFactory.newBufferManagerWrite(
                                    BufferManagerFactory.GROW,
                                    Message.CDR_ENC_VERSION,
                                    orb),
          ORBConstants.STREAM_FORMAT_VERSION_1,
          usePooledByteBuffers);
}
 
Example #30
Source File: SocketOrChannelConnectionImpl.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
protected void sendHelper(GIOPVersion giopVersion, Message msg)
    throws IOException
{
    // REVISIT: See comments in CDROutputObject constructor.
    CDROutputObject outputObject =
        sun.corba.OutputStreamFactory.newCDROutputObject((ORB)orb, null, giopVersion,
                            this, msg, ORBConstants.STREAM_FORMAT_VERSION_1);
    msg.write(outputObject);

    outputObject.writeTo(this);
}