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

The following are top voted examples for showing how to use com.sun.corba.se.impl.orbutil.ORBConstants. 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: CorbaMessageMediatorImpl.java   View source code 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 2
Project: OpenJSharp   File: CorbaMessageMediatorImpl.java   View source code 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 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: 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 5
Project: openjdk-jdk10   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 6
Project: OpenJSharp   File: NameServer.java   View source code 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 7
Project: openjdk-jdk10   File: TOAImpl.java   View source code 6 votes vote down vote up
public TOAImpl( ORB orb, TransientObjectManager tom, String codebase )
{
    super( orb ) ;
    servants = tom ;

    // Make the object key template
    int serverid = ((ORB)getORB()).getTransientServerId();
    int scid = ORBConstants.TOA_SCID ;

    ObjectKeyTemplate oktemp = new JIDLObjectKeyTemplate( orb, scid, serverid ) ;

    // REVISIT - POA specific
    Policies policies = Policies.defaultPolicies;

    // REVISIT - absorb codebase into a policy
    initializeTemplate( oktemp, true,
                        policies,
                        codebase,
                        null, // manager id
                        oktemp.getObjectAdapterId()
                        ) ;
}
 
Example 8
Project: openjdk-jdk10   File: ParserTable.java   View source code 6 votes vote down vote up
private Operation makeFSOperation() {
    Operation fschecker = new Operation() {
        public Object operate( Object value )
        {
            int giopFragmentSize = ((Integer)value).intValue() ;
            if (giopFragmentSize < ORBConstants.GIOP_FRAGMENT_MINIMUM_SIZE){
                throw wrapper.fragmentSizeMinimum( new Integer( giopFragmentSize ),
                    new Integer( ORBConstants.GIOP_FRAGMENT_MINIMUM_SIZE ) ) ;
            }

            if (giopFragmentSize % ORBConstants.GIOP_FRAGMENT_DIVISOR != 0)
                throw wrapper.fragmentSizeDiv( new Integer( giopFragmentSize ),
                        new Integer( ORBConstants.GIOP_FRAGMENT_DIVISOR ) ) ;

            return value ;
        }
    } ;

    Operation result = OperationFactory.compose( OperationFactory.integerAction(),
        fschecker ) ;
    return result ;
}
 
Example 9
Project: OpenJSharp   File: CDROutputStream_1_2.java   View source code 6 votes vote down vote up
protected void alignAndReserve(int align, int n) {

        // headerPadding bit is set by the write operation of RequestMessage_1_2
        // or ReplyMessage_1_2 classes. When set, the very first body write
        // operation (from the stub code) would trigger an alignAndReserve
        // method call, that would in turn add the appropriate header padding,
        // such that the body is aligned on a 8-octet boundary. The padding
        // is required for GIOP versions 1.2 and above, only if body is present.
        if (headerPadding == true) {
            headerPadding = false;
            alignOnBoundary(ORBConstants.GIOP_12_MSG_BODY_ALIGNMENT);
        }

        // In GIOP 1.2, we always end fragments at our
        // fragment size, which is an "evenly divisible
        // 8 byte boundary" (aka divisible by 16).  A fragment can
        // end with appropriate alignment padding, but no padding
        // is needed with respect to the next GIOP fragment
        // header since it ends on an 8 byte boundary.

        bbwi.position(bbwi.position() + computeAlignment(align));

        if (bbwi.position() + n  > bbwi.buflen)
            grow(align, n);
    }
 
Example 10
Project: openjdk-jdk10   File: CDROutputStream_1_2.java   View source code 6 votes vote down vote up
protected void alignAndReserve(int align, int n) {

        // headerPadding bit is set by the write operation of RequestMessage_1_2
        // or ReplyMessage_1_2 classes. When set, the very first body write
        // operation (from the stub code) would trigger an alignAndReserve
        // method call, that would in turn add the appropriate header padding,
        // such that the body is aligned on a 8-octet boundary. The padding
        // is required for GIOP versions 1.2 and above, only if body is present.
        if (headerPadding == true) {
            headerPadding = false;
            alignOnBoundary(ORBConstants.GIOP_12_MSG_BODY_ALIGNMENT);
        }

        // In GIOP 1.2, we always end fragments at our
        // fragment size, which is an "evenly divisible
        // 8 byte boundary" (aka divisible by 16).  A fragment can
        // end with appropriate alignment padding, but no padding
        // is needed with respect to the next GIOP fragment
        // header since it ends on an 8 byte boundary.

        bbwi.position(bbwi.position() + computeAlignment(align));

        if (bbwi.position() + n  > bbwi.buflen)
            grow(align, n);
    }
 
Example 11
Project: OpenJSharp   File: INSURLOperationImpl.java   View source code 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 12
Project: openjdk-jdk10   File: DataCollectorBase.java   View source code 6 votes vote down vote up
protected void checkPropertyDefaults()
{
    String host =
        resultProps.getProperty( ORBConstants.INITIAL_HOST_PROPERTY ) ;

    if ((host == null) || (host.equals("")))
        setProperty( ORBConstants.INITIAL_HOST_PROPERTY,
            configurationHostName );

    String serverHost =
        resultProps.getProperty( ORBConstants.SERVER_HOST_PROPERTY ) ;

    if (serverHost == null ||
        serverHost.equals("") ||
        serverHost.equals("0.0.0.0") ||
        serverHost.equals("::") ||
        serverHost.toLowerCase().equals("::ffff:0.0.0.0"))
    {
        setProperty(ORBConstants.SERVER_HOST_PROPERTY,
                    localHostName);
        setProperty(ORBConstants.LISTEN_ON_ALL_INTERFACES,
                    ORBConstants.LISTEN_ON_ALL_INTERFACES);
    }
}
 
Example 13
Project: openjdk-jdk10   File: INSURLOperationImpl.java   View source code 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 14
Project: OpenJSharp   File: ParserTable.java   View source code 6 votes vote down vote up
private Operation makeFSOperation() {
    Operation fschecker = new Operation() {
        public Object operate( Object value )
        {
            int giopFragmentSize = ((Integer)value).intValue() ;
            if (giopFragmentSize < ORBConstants.GIOP_FRAGMENT_MINIMUM_SIZE){
                throw wrapper.fragmentSizeMinimum( new Integer( giopFragmentSize ),
                    new Integer( ORBConstants.GIOP_FRAGMENT_MINIMUM_SIZE ) ) ;
            }

            if (giopFragmentSize % ORBConstants.GIOP_FRAGMENT_DIVISOR != 0)
                throw wrapper.fragmentSizeDiv( new Integer( giopFragmentSize ),
                        new Integer( ORBConstants.GIOP_FRAGMENT_DIVISOR ) ) ;

            return value ;
        }
    } ;

    Operation result = OperationFactory.compose( OperationFactory.integerAction(),
        fschecker ) ;
    return result ;
}
 
Example 15
Project: OpenJSharp   File: ORBImpl.java   View source code 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 16
Project: openjdk-jdk10   File: ORBImpl.java   View source code 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 17
Project: OpenJSharp   File: DataCollectorBase.java   View source code 6 votes vote down vote up
protected void checkPropertyDefaults()
{
    String host =
        resultProps.getProperty( ORBConstants.INITIAL_HOST_PROPERTY ) ;

    if ((host == null) || (host.equals("")))
        setProperty( ORBConstants.INITIAL_HOST_PROPERTY,
            configurationHostName );

    String serverHost =
        resultProps.getProperty( ORBConstants.SERVER_HOST_PROPERTY ) ;

    if (serverHost == null ||
        serverHost.equals("") ||
        serverHost.equals("0.0.0.0") ||
        serverHost.equals("::") ||
        serverHost.toLowerCase().equals("::ffff:0.0.0.0"))
    {
        setProperty(ORBConstants.SERVER_HOST_PROPERTY,
                    localHostName);
        setProperty(ORBConstants.LISTEN_ON_ALL_INTERFACES,
                    ORBConstants.LISTEN_ON_ALL_INTERFACES);
    }
}
 
Example 18
Project: openjdk-jdk10   File: CorbaMessageMediatorImpl.java   View source code 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 19
Project: openjdk-jdk10   File: CorbaMessageMediatorImpl.java   View source code 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 20
Project: openjdk-jdk10   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 21
Project: openjdk-jdk10   File: ProcessMonitorThread.java   View source code 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 22
Project: OpenJSharp   File: IIOPFactories.java   View source code 5 votes vote down vote up
public static IdentifiableFactory makeRequestPartitioningComponentFactory()
{
    return new EncapsulationFactoryBase(ORBConstants.TAG_REQUEST_PARTITIONING_ID) {
        public Identifiable readContents(InputStream in)
        {
            int threadPoolToUse = in.read_ulong();
            Identifiable comp =
                new RequestPartitioningComponentImpl(threadPoolToUse);
            return comp;
        }
    };
}
 
Example 23
Project: openjdk-jdk10   File: SocketOrChannelConnectionImpl.java   View source code 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);
}
 
Example 24
Project: OpenJSharp   File: ServerMain.java   View source code 5 votes vote down vote up
private void redirectIOStreams()
{
    // redirect out and err streams
    try {
        String logDirName =
            System.getProperty( ORBConstants.DB_DIR_PROPERTY ) +
            System.getProperty("file.separator") +
            ORBConstants.SERVER_LOG_DIR +
            System.getProperty("file.separator");

        File logDir = new File(logDirName);
        String server = System.getProperty(
            ORBConstants.SERVER_ID_PROPERTY ) ;

        FileOutputStream foutStream =
            new FileOutputStream(logDirName + server+".out", true);
        FileOutputStream ferrStream =
            new FileOutputStream(logDirName + server+".err", true);

        PrintStream pSout = new PrintStream(foutStream, true);
        PrintStream pSerr = new PrintStream(ferrStream, true);

        System.setOut(pSout);
        System.setErr(pSerr);

        logInformation( "Server started" ) ;

    } catch (Exception ex) {}
}
 
Example 25
Project: OpenJSharp   File: ServerMain.java   View source code 5 votes vote down vote up
private int getServerId()
{
    Integer serverId = Integer.getInteger( ORBConstants.SERVER_ID_PROPERTY ) ;

    if (serverId == null)
        logTerminal( "", NO_SERVER_ID ) ;

    return serverId.intValue() ;
}
 
Example 26
Project: OpenJSharp   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 ) ;
    }
}
 
Example 27
Project: OpenJSharp   File: RepositoryImpl.java   View source code 5 votes vote down vote up
/**
 * Typically the Repositoy is created within the ORBd VM but it can
 * be independently started as well.
 */
public static void main(String args[]) {
    boolean debug = false ;
    for (int ctr=0; ctr<args.length; ctr++)
        if (args[ctr].equals("-debug"))
            debug = true ;

    try {
        // See Bug 4396928 for more information about why we are
        // initializing the ORBClass to PIORB (now ORBImpl, but see the bug).
        Properties props = new Properties();
        props.put("org.omg.CORBA.ORBClass",
            "com.sun.corba.se.impl.orb.ORBImpl");
        ORB orb = (ORB) ORB.init(args, props);

        // create the repository object
        String db = System.getProperty( ORBConstants.DB_PROPERTY,
                ORBConstants.DEFAULT_DB_NAME );
        RepositoryImpl repository = new RepositoryImpl(orb, new File(db),
                                                       debug);

        // wait for shutdown
        orb.run();
    } catch (Exception ex) {
        ex.printStackTrace();
    }
}
 
Example 28
Project: openjdk-jdk10   File: RequestPartitioningComponentImpl.java   View source code 5 votes vote down vote up
public RequestPartitioningComponentImpl(int thePartitionToUse) {
    if (thePartitionToUse < ORBConstants.REQUEST_PARTITIONING_MIN_THREAD_POOL_ID ||
        thePartitionToUse > ORBConstants.REQUEST_PARTITIONING_MAX_THREAD_POOL_ID) {
        throw wrapper.invalidRequestPartitioningComponentValue(
              new Integer(thePartitionToUse),
              new Integer(ORBConstants.REQUEST_PARTITIONING_MIN_THREAD_POOL_ID),
              new Integer(ORBConstants.REQUEST_PARTITIONING_MAX_THREAD_POOL_ID));
    }
    partitionToUse = thePartitionToUse;
}
 
Example 29
Project: openjdk-jdk10   File: CDRInputStream_1_2.java   View source code 5 votes vote down vote up
protected void alignAndCheck(int align, int n) {

        // headerPadding bit is set by read method of the RequestMessage_1_2
        // or ReplyMessage_1_2 classes. When set, the very first body read
        // operation (from the stub code) would trigger an alignAndCheck
        // method call, that would in turn skip the header padding that was
        // inserted during the earlier write operation by the sender. The
        // padding ensures that the body is aligned on an 8-octet boundary,
        // for GIOP versions 1.2 and beyond.
        if (headerPadding == true) {
            headerPadding = false;
            alignOnBoundary(ORBConstants.GIOP_12_MSG_BODY_ALIGNMENT);
        }

        checkBlockLength(align, n);

        // WARNING: Must compute real alignment after calling
        // checkBlockLength since it may move the position

        // In GIOP 1.2, a fragment may end with some alignment
        // padding (which leads to all fragments ending perfectly
        // on evenly divisible 8 byte boundaries).  A new fragment
        // never requires alignment with the header since it ends
        // on an 8 byte boundary.

        int alignIncr = computeAlignment(bbwi.position(),align);
        bbwi.position(bbwi.position() + alignIncr);

        if (bbwi.position() + n > bbwi.buflen) {
            grow(1, n);
        }
    }
 
Example 30
Project: openjdk-jdk10   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 31
Project: openjdk-jdk10   File: POAPolicyMediatorBase.java   View source code 5 votes vote down vote up
POAPolicyMediatorBase( Policies policies, POAImpl poa )
{
    if (policies.isSingleThreaded())
        throw poa.invocationWrapper().singleThreadNotSupported() ;

    POAManagerImpl poam = (POAManagerImpl)(poa.the_POAManager()) ;
    POAFactory poaf = poam.getFactory() ;
    delegateImpl = (DelegateImpl)(poaf.getDelegateImpl()) ;
    this.policies = policies ;
    this.poa = poa ;
    orb = (ORB)poa.getORB() ;

    switch (policies.servantCachingLevel()) {
        case ServantCachingPolicy.NO_SERVANT_CACHING :
            scid = ORBConstants.TRANSIENT_SCID ;
            break ;
        case ServantCachingPolicy.FULL_SEMANTICS :
            scid = ORBConstants.SC_TRANSIENT_SCID ;
            break ;
        case ServantCachingPolicy.INFO_ONLY_SEMANTICS :
            scid = ORBConstants.IISC_TRANSIENT_SCID ;
            break ;
        case ServantCachingPolicy.MINIMAL_SEMANTICS :
            scid = ORBConstants.MINSC_TRANSIENT_SCID ;
            break ;
    }

    if ( policies.isTransient() ) {
        serverid = orb.getTransientServerId();
    } else {
        serverid = orb.getORBData().getPersistentServerId();
        scid = ORBConstants.makePersistent( scid ) ;
    }

    isImplicit = policies.isImplicitlyActivated() ;
    isUnique = policies.isUniqueIds() ;
    isSystemId = policies.isSystemAssignedIds() ;

    sysIdCounter = 0 ;
}
 
Example 32
Project: OpenJSharp   File: NameServiceStartThread.java   View source code 5 votes vote down vote up
public void run( )
{
    try {
        // start Name Service
        NameService nameService = new NameService(orb, dbDir );
        NamingContext rootContext = nameService.initialNamingContext();
        orb.register_initial_reference(
            ORBConstants.PERSISTENT_NAME_SERVICE_NAME, rootContext );
    } catch( Exception e ) {
        System.err.println(
            "NameService did not start successfully" );
        e.printStackTrace( );
    }
}
 
Example 33
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 34
Project: openjdk-jdk10   File: IIOPEndpointInfo.java   View source code 5 votes vote down vote up
IIOPEndpointInfo( ) {
    // Default IIOP Version
    major = ORBConstants.DEFAULT_INS_GIOP_MAJOR_VERSION;
    minor = ORBConstants.DEFAULT_INS_GIOP_MINOR_VERSION;
    // Default host is localhost
    host = ORBConstants.DEFAULT_INS_HOST;
    // Default INS Port
    port = ORBConstants.DEFAULT_INS_PORT;
}
 
Example 35
Project: OpenJSharp   File: IIOPEndpointInfo.java   View source code 5 votes vote down vote up
IIOPEndpointInfo( ) {
    // Default IIOP Version
    major = ORBConstants.DEFAULT_INS_GIOP_MAJOR_VERSION;
    minor = ORBConstants.DEFAULT_INS_GIOP_MINOR_VERSION;
    // Default host is localhost
    host = ORBConstants.DEFAULT_INS_HOST;
    // Default INS Port
    port = ORBConstants.DEFAULT_INS_PORT;
}
 
Example 36
Project: openjdk-jdk10   File: PIHandlerImpl.java   View source code 5 votes vote down vote up
public PIHandlerImpl( ORB orb, String[] args ) {
    this.orb = orb ;
    wrapper = InterceptorsSystemException.get( orb,
        CORBALogDomains.RPC_PROTOCOL ) ;
    orbutilWrapper = ORBUtilSystemException.get( orb,
        CORBALogDomains.RPC_PROTOCOL ) ;
    omgWrapper = OMGSystemException.get( orb,
        CORBALogDomains.RPC_PROTOCOL ) ;
    arguments = args ;

    // Create codec factory:
    codecFactory = new CodecFactoryImpl( orb );

    // Create new interceptor list:
    interceptorList = new InterceptorList( wrapper );

    // Create a new PICurrent.
    current = new PICurrent( orb );

    // Create new interceptor invoker, initially disabled:
    interceptorInvoker = new InterceptorInvoker( orb, interceptorList,
                                                 current );

    // Register the PI current and Codec factory objects
    orb.getLocalResolver().register( ORBConstants.PI_CURRENT_NAME,
        ClosureFactory.makeConstant( current ) ) ;
    orb.getLocalResolver().register( ORBConstants.CODEC_FACTORY_NAME,
        ClosureFactory.makeConstant( codecFactory ) ) ;
}
 
Example 37
Project: OpenJSharp   File: Policies.java   View source code 5 votes vote down vote up
public final int servantCachingLevel()
{
    Integer key = new Integer( ORBConstants.SERVANT_CACHING_POLICY ) ;
    ServantCachingPolicy policy = (ServantCachingPolicy)policyMap.get( key ) ;
    if (policy == null)
        return ServantCachingPolicy.NO_SERVANT_CACHING ;
    else
        return policy.getType() ;
}
 
Example 38
Project: OpenJSharp   File: Policies.java   View source code 5 votes vote down vote up
public final int getCopierId()
{
    Integer key = new Integer( ORBConstants.COPY_OBJECT_POLICY ) ;
    CopyObjectPolicy policy = (CopyObjectPolicy)policyMap.get( key ) ;
    if (policy != null)
        return policy.getValue() ;
    else
        return defaultObjectCopierFactoryId ;
}
 
Example 39
Project: OpenJSharp   File: POAPolicyMediatorBase.java   View source code 5 votes vote down vote up
POAPolicyMediatorBase( Policies policies, POAImpl poa )
{
    if (policies.isSingleThreaded())
        throw poa.invocationWrapper().singleThreadNotSupported() ;

    POAManagerImpl poam = (POAManagerImpl)(poa.the_POAManager()) ;
    POAFactory poaf = poam.getFactory() ;
    delegateImpl = (DelegateImpl)(poaf.getDelegateImpl()) ;
    this.policies = policies ;
    this.poa = poa ;
    orb = (ORB)poa.getORB() ;

    switch (policies.servantCachingLevel()) {
        case ServantCachingPolicy.NO_SERVANT_CACHING :
            scid = ORBConstants.TRANSIENT_SCID ;
            break ;
        case ServantCachingPolicy.FULL_SEMANTICS :
            scid = ORBConstants.SC_TRANSIENT_SCID ;
            break ;
        case ServantCachingPolicy.INFO_ONLY_SEMANTICS :
            scid = ORBConstants.IISC_TRANSIENT_SCID ;
            break ;
        case ServantCachingPolicy.MINIMAL_SEMANTICS :
            scid = ORBConstants.MINSC_TRANSIENT_SCID ;
            break ;
    }

    if ( policies.isTransient() ) {
        serverid = orb.getTransientServerId();
    } else {
        serverid = orb.getORBData().getPersistentServerId();
        scid = ORBConstants.makePersistent( scid ) ;
    }

    isImplicit = policies.isImplicitlyActivated() ;
    isUnique = policies.isUniqueIds() ;
    isSystemId = policies.isSystemAssignedIds() ;

    sysIdCounter = 0 ;
}
 
Example 40
Project: OpenJSharp   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 ) ) ;
}