org.omg.CosNaming.NamingContext Java Examples

The following examples show how to use org.omg.CosNaming.NamingContext. 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: NamingContextImpl.java    From JDKSourceCode1.8 with MIT License 6 votes vote down vote up
/**
 * Create a NamingContext object and return its object reference.
 * @return an object reference for a new NamingContext object implemented
 * by this Name Server.
 * @exception org.omg.CORBA.SystemException One of a fixed set of CORBA
 * system exceptions.
 */
public synchronized NamingContext new_context()
{
    // Create actually creates a new naming context
    lifecycleLogger.fine( "Creating New Naming Context " );
    NamingContextDataStore impl = (NamingContextDataStore)this;
    synchronized (impl) {
        NamingContext nctx = impl.NewContext();
        if( nctx != null ) {
            lifecycleLogger.fine( LogKeywords.LIFECYCLE_CREATE_SUCCESS );
        } else {
            // If naming context is null, then that must be a serious
            // error.
            lifecycleLogger.severe ( LogKeywords.LIFECYCLE_CREATE_FAILURE );
        }
        return nctx;
    }
}
 
Example #2
Source File: NameServer.java    From openjdk-8 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 #3
Source File: NamingContextImpl.java    From openjdk-8 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Create a NamingContext object and return its object reference.
 * @return an object reference for a new NamingContext object implemented
 * by this Name Server.
 * @exception org.omg.CORBA.SystemException One of a fixed set of CORBA
 * system exceptions.
 */
public synchronized NamingContext new_context()
{
    // Create actually creates a new naming context
    lifecycleLogger.fine( "Creating New Naming Context " );
    NamingContextDataStore impl = (NamingContextDataStore)this;
    synchronized (impl) {
        NamingContext nctx = impl.NewContext();
        if( nctx != null ) {
            lifecycleLogger.fine( LogKeywords.LIFECYCLE_CREATE_SUCCESS );
        } else {
            // If naming context is null, then that must be a serious
            // error.
            lifecycleLogger.severe ( LogKeywords.LIFECYCLE_CREATE_FAILURE );
        }
        return nctx;
    }
}
 
Example #4
Source File: NameServer.java    From TencentKona-8 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 #5
Source File: NameServer.java    From hottub 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 #6
Source File: NamingContextImpl.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Create a NamingContext object and return its object reference.
 * @return an object reference for a new NamingContext object implemented
 * by this Name Server.
 * @exception org.omg.CORBA.SystemException One of a fixed set of CORBA
 * system exceptions.
 */
public synchronized NamingContext new_context()
{
    // Create actually creates a new naming context
    lifecycleLogger.fine( "Creating New Naming Context " );
    NamingContextDataStore impl = (NamingContextDataStore)this;
    synchronized (impl) {
        NamingContext nctx = impl.NewContext();
        if( nctx != null ) {
            lifecycleLogger.fine( LogKeywords.LIFECYCLE_CREATE_SUCCESS );
        } else {
            // If naming context is null, then that must be a serious
            // error.
            lifecycleLogger.severe ( LogKeywords.LIFECYCLE_CREATE_FAILURE );
        }
        return nctx;
    }
}
 
Example #7
Source File: NameServer.java    From JDKSourceCode1.8 with MIT License 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 #8
Source File: NameServer.java    From openjdk-jdk8u-backup 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 #9
Source File: NamingContextImpl.java    From openjdk-8-source with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Create a NamingContext object and return its object reference.
 * @return an object reference for a new NamingContext object implemented
 * by this Name Server.
 * @exception org.omg.CORBA.SystemException One of a fixed set of CORBA
 * system exceptions.
 */
public synchronized NamingContext new_context()
{
    // Create actually creates a new naming context
    lifecycleLogger.fine( "Creating New Naming Context " );
    NamingContextDataStore impl = (NamingContextDataStore)this;
    synchronized (impl) {
        NamingContext nctx = impl.NewContext();
        if( nctx != null ) {
            lifecycleLogger.fine( LogKeywords.LIFECYCLE_CREATE_SUCCESS );
        } else {
            // If naming context is null, then that must be a serious
            // error.
            lifecycleLogger.severe ( LogKeywords.LIFECYCLE_CREATE_FAILURE );
        }
        return nctx;
    }
}
 
Example #10
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 #11
Source File: NameServer.java    From jdk1.8-source-analysis with Apache License 2.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 #12
Source File: NamingContextImpl.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Create a NamingContext object and return its object reference.
 * @return an object reference for a new NamingContext object implemented
 * by this Name Server.
 * @exception org.omg.CORBA.SystemException One of a fixed set of CORBA
 * system exceptions.
 */
public synchronized NamingContext new_context()
{
    // Create actually creates a new naming context
    lifecycleLogger.fine( "Creating New Naming Context " );
    NamingContextDataStore impl = (NamingContextDataStore)this;
    synchronized (impl) {
        NamingContext nctx = impl.NewContext();
        if( nctx != null ) {
            lifecycleLogger.fine( LogKeywords.LIFECYCLE_CREATE_SUCCESS );
        } else {
            // If naming context is null, then that must be a serious
            // error.
            lifecycleLogger.severe ( LogKeywords.LIFECYCLE_CREATE_FAILURE );
        }
        return nctx;
    }
}
 
Example #13
Source File: NameServer.java    From openjdk-jdk9 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 #14
Source File: NamingContextImpl.java    From jdk8u60 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Create a NamingContext object and return its object reference.
 * @return an object reference for a new NamingContext object implemented
 * by this Name Server.
 * @exception org.omg.CORBA.SystemException One of a fixed set of CORBA
 * system exceptions.
 */
public synchronized NamingContext new_context()
{
    // Create actually creates a new naming context
    lifecycleLogger.fine( "Creating New Naming Context " );
    NamingContextDataStore impl = (NamingContextDataStore)this;
    synchronized (impl) {
        NamingContext nctx = impl.NewContext();
        if( nctx != null ) {
            lifecycleLogger.fine( LogKeywords.LIFECYCLE_CREATE_SUCCESS );
        } else {
            // If naming context is null, then that must be a serious
            // error.
            lifecycleLogger.severe ( LogKeywords.LIFECYCLE_CREATE_FAILURE );
        }
        return nctx;
    }
}
 
Example #15
Source File: NamingContextImpl.java    From jdk1.8-source-analysis with Apache License 2.0 6 votes vote down vote up
/**
 * Create a NamingContext object and return its object reference.
 * @return an object reference for a new NamingContext object implemented
 * by this Name Server.
 * @exception org.omg.CORBA.SystemException One of a fixed set of CORBA
 * system exceptions.
 */
public synchronized NamingContext new_context()
{
    // Create actually creates a new naming context
    lifecycleLogger.fine( "Creating New Naming Context " );
    NamingContextDataStore impl = (NamingContextDataStore)this;
    synchronized (impl) {
        NamingContext nctx = impl.NewContext();
        if( nctx != null ) {
            lifecycleLogger.fine( LogKeywords.LIFECYCLE_CREATE_SUCCESS );
        } else {
            // If naming context is null, then that must be a serious
            // error.
            lifecycleLogger.severe ( LogKeywords.LIFECYCLE_CREATE_FAILURE );
        }
        return nctx;
    }
}
 
Example #16
Source File: NameServer.java    From jdk8u60 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 #17
Source File: NameServer.java    From openjdk-jdk8u 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 #18
Source File: NamingContextImpl.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
/**
* Implements resolving a NameComponent in this context and
* narrowing it to CosNaming::NamingContext. It will throw appropriate
* exceptions if not found or not narrowable.
* @param impl an implementation of NamingContextDataStore
* @param n a NameComponents which is the name to be found.
* @exception org.omg.CosNaming.NamingContextPackage.NotFound The
* first component could not be resolved.
* @exception org.omg.CosNaming.NamingContextPackage.CannotProceed Could not proceed
* in resolving the first component of the supplied name.
* @exception org.omg.CORBA.SystemException One of a fixed set of CORBA system exceptions.
* @see resolve
*/
 protected static NamingContext resolveFirstAsContext(NamingContextDataStore impl,
                                                      NameComponent[] n)
     throws org.omg.CosNaming.NamingContextPackage.NotFound {
     org.omg.CORBA.Object topRef = null;
     BindingTypeHolder bth = new BindingTypeHolder();
     NamingContext context = null;

     synchronized (impl) {
         // Resolve first  - must be resolveable
         topRef = impl.Resolve(n[0],bth);
         if (topRef == null) {
             // It was not bound
             throw new NotFound(NotFoundReason.missing_node,n);
         }
     }

     // Was it bound as a context?
     if (bth.value != BindingType.ncontext) {
         // It was not a context
         throw new NotFound(NotFoundReason.not_context,n);
     }

     // Narrow to a naming context
     try {
         context = NamingContextHelper.narrow(topRef);
     } catch (org.omg.CORBA.BAD_PARAM ex) {
         // It was not a context
         throw new NotFound(NotFoundReason.not_context,n);
     }

     // Hmm. must be ok
     return context;
 }
 
Example #19
Source File: NamingContextImpl.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
/**
* Implements resolving a NameComponent in this context and
* narrowing it to CosNaming::NamingContext. It will throw appropriate
* exceptions if not found or not narrowable.
* @param impl an implementation of NamingContextDataStore
* @param n a NameComponents which is the name to be found.
* @exception org.omg.CosNaming.NamingContextPackage.NotFound The
* first component could not be resolved.
* @exception org.omg.CosNaming.NamingContextPackage.CannotProceed Could not proceed
* in resolving the first component of the supplied name.
* @exception org.omg.CORBA.SystemException One of a fixed set of CORBA system exceptions.
* @see resolve
*/
 protected static NamingContext resolveFirstAsContext(NamingContextDataStore impl,
                                                      NameComponent[] n)
     throws org.omg.CosNaming.NamingContextPackage.NotFound {
     org.omg.CORBA.Object topRef = null;
     BindingTypeHolder bth = new BindingTypeHolder();
     NamingContext context = null;

     synchronized (impl) {
         // Resolve first  - must be resolveable
         topRef = impl.Resolve(n[0],bth);
         if (topRef == null) {
             // It was not bound
             throw new NotFound(NotFoundReason.missing_node,n);
         }
     }

     // Was it bound as a context?
     if (bth.value != BindingType.ncontext) {
         // It was not a context
         throw new NotFound(NotFoundReason.not_context,n);
     }

     // Narrow to a naming context
     try {
         context = NamingContextHelper.narrow(topRef);
     } catch (org.omg.CORBA.BAD_PARAM ex) {
         // It was not a context
         throw new NotFound(NotFoundReason.not_context,n);
     }

     // Hmm. must be ok
     return context;
 }
 
Example #20
Source File: NamingContextImpl.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Bind a NamingContext under a name in this NamingContext. If the name
 * contains multiple (n) components, the first n-1 components will be
 * resolved in this NamingContext and the object bound in resulting
 * NamingContext. If a binding under the supplied name already exists it
 * will be unbound first. The NamingContext will participate in recursive
 * resolving.
 * @param n a sequence of NameComponents which is the name under which
 * the object will be bound.
 * @param obj the object reference to be bound.
 * @exception org.omg.CosNaming.NamingContextPackage.NotFound A name with
 * multiple components was supplied, but the first component could not be
 * resolved.
 * @exception org.omg.CosNaming.NamingContextPackage.CannotProceed Could not
 * proceed in resolving the n-1 components of the supplied name.
 * @exception org.omg.CosNaming.NamingContextPackage.InvalidName The
 * supplied name is invalid (i.e., has length less than 1).
 * @exception org.omg.CORBA.SystemException One of a fixed set of CORBA
 * system exceptions.
 * @see doBind
 */
public  void rebind_context(NameComponent[] n, NamingContext nc)
    throws org.omg.CosNaming.NamingContextPackage.NotFound,
           org.omg.CosNaming.NamingContextPackage.CannotProceed,
           org.omg.CosNaming.NamingContextPackage.InvalidName
{
    if( nc == null )
    {
        updateLogger.warning( LogKeywords.NAMING_REBIND_FAILURE +
            " NULL Context cannot be Bound " );
        throw wrapper.objectIsNull() ;
    }
    try {
        // doBind implements all four flavors of binding
        NamingContextDataStore impl = (NamingContextDataStore)this;
        doBind(impl,n,nc,true,BindingType.ncontext);
    } catch (org.omg.CosNaming.NamingContextPackage.AlreadyBound ex) {
        // This should not happen
        updateLogger.warning( LogKeywords.NAMING_REBIND_FAILURE +
            NamingUtils.getDirectoryStructuredName( n ) +
            " is already bound to a CORBA Object" );
        throw wrapper.namingCtxRebindctxAlreadyBound( ex ) ;
    }
    if( updateLogger.isLoggable( Level.FINE ) ) {
        // isLoggable call to make sure that we save some precious
        // processor cycles, if there is no need to log.
        updateLogger.fine( LogKeywords.NAMING_REBIND_SUCCESS + " Name = " +
            NamingUtils.getDirectoryStructuredName( n ) );
    }
}
 
Example #21
Source File: NamingContextImpl.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Create a new NamingContext, bind it in this Naming Context and return
 * its object reference. This is equivalent to using new_context() followed
 * by bind_context() with the supplied name and the object reference for
 * the newly created NamingContext.
 * @param n a sequence of NameComponents which is the name to be unbound.
 * @return an object reference for a new NamingContext object implemented
 * by this Name Server, bound to the supplied name.
 * @exception org.omg.CosNaming.NamingContextPackage.AlreadyBound An object
 * is already bound under the supplied name.
 * @exception org.omg.CosNaming.NamingContextPackage.NotFound A name with
 * multiple components was supplied, but the first component could not be
 * resolved.
 * @exception org.omg.CosNaming.NamingContextPackage.CannotProceed Could not
 * proceed in resolving the n-1 components of the supplied name.
 * @exception org.omg.CosNaming.NamingContextPackage.InvalidName The
 * supplied name is invalid (i.e., has length less than 1).
 * @exception org.omg.CORBA.SystemException One of a fixed set of CORBA
 * system exceptions.
 * @see new_context
 * @see bind_context
 */
public  NamingContext bind_new_context(NameComponent[] n)
    throws org.omg.CosNaming.NamingContextPackage.NotFound,
           org.omg.CosNaming.NamingContextPackage.AlreadyBound,
           org.omg.CosNaming.NamingContextPackage.CannotProceed,
           org.omg.CosNaming.NamingContextPackage.InvalidName
{
    NamingContext nc = null;
    NamingContext rnc = null;
    try {
        if (debug)
            dprint("bind_new_context " + nameToString(n));
        // The obvious solution:
        nc = this.new_context();
        this.bind_context(n,nc);
        rnc = nc;
        nc = null;
    } finally {
        try {
            if(nc != null)
                nc.destroy();
        } catch (org.omg.CosNaming.NamingContextPackage.NotEmpty e) {
        }
    }
    if( updateLogger.isLoggable( Level.FINE ) ) {
        // isLoggable call to make sure that we save some precious
        // processor cycles, if there is no need to log.
        updateLogger.fine ( LogKeywords.NAMING_BIND +
            "New Context Bound To " +
            NamingUtils.getDirectoryStructuredName( n ) );
    }
    return rnc;
}
 
Example #22
Source File: NamingContextImpl.java    From JDKSourceCode1.8 with MIT License 5 votes vote down vote up
/**
* Implements resolving a NameComponent in this context and
* narrowing it to CosNaming::NamingContext. It will throw appropriate
* exceptions if not found or not narrowable.
* @param impl an implementation of NamingContextDataStore
* @param n a NameComponents which is the name to be found.
* @exception org.omg.CosNaming.NamingContextPackage.NotFound The
* first component could not be resolved.
* @exception org.omg.CosNaming.NamingContextPackage.CannotProceed Could not proceed
* in resolving the first component of the supplied name.
* @exception org.omg.CORBA.SystemException One of a fixed set of CORBA system exceptions.
* @see resolve
*/
 protected static NamingContext resolveFirstAsContext(NamingContextDataStore impl,
                                                      NameComponent[] n)
     throws org.omg.CosNaming.NamingContextPackage.NotFound {
     org.omg.CORBA.Object topRef = null;
     BindingTypeHolder bth = new BindingTypeHolder();
     NamingContext context = null;

     synchronized (impl) {
         // Resolve first  - must be resolveable
         topRef = impl.Resolve(n[0],bth);
         if (topRef == null) {
             // It was not bound
             throw new NotFound(NotFoundReason.missing_node,n);
         }
     }

     // Was it bound as a context?
     if (bth.value != BindingType.ncontext) {
         // It was not a context
         throw new NotFound(NotFoundReason.not_context,n);
     }

     // Narrow to a naming context
     try {
         context = NamingContextHelper.narrow(topRef);
     } catch (org.omg.CORBA.BAD_PARAM ex) {
         // It was not a context
         throw new NotFound(NotFoundReason.not_context,n);
     }

     // Hmm. must be ok
     return context;
 }
 
Example #23
Source File: NameServiceStartThread.java    From jdk1.8-source-analysis with Apache License 2.0 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 #24
Source File: NamingContextImpl.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
/**
* Implements resolving a NameComponent in this context and
* narrowing it to CosNaming::NamingContext. It will throw appropriate
* exceptions if not found or not narrowable.
* @param impl an implementation of NamingContextDataStore
* @param n a NameComponents which is the name to be found.
* @exception org.omg.CosNaming.NamingContextPackage.NotFound The
* first component could not be resolved.
* @exception org.omg.CosNaming.NamingContextPackage.CannotProceed Could not proceed
* in resolving the first component of the supplied name.
* @exception org.omg.CORBA.SystemException One of a fixed set of CORBA system exceptions.
* @see resolve
*/
 protected static NamingContext resolveFirstAsContext(NamingContextDataStore impl,
                                                      NameComponent[] n)
     throws org.omg.CosNaming.NamingContextPackage.NotFound {
     org.omg.CORBA.Object topRef = null;
     BindingTypeHolder bth = new BindingTypeHolder();
     NamingContext context = null;

     synchronized (impl) {
         // Resolve first  - must be resolveable
         topRef = impl.Resolve(n[0],bth);
         if (topRef == null) {
             // It was not bound
             throw new NotFound(NotFoundReason.missing_node,n);
         }
     }

     // Was it bound as a context?
     if (bth.value != BindingType.ncontext) {
         // It was not a context
         throw new NotFound(NotFoundReason.not_context,n);
     }

     // Narrow to a naming context
     try {
         context = NamingContextHelper.narrow(topRef);
     } catch (org.omg.CORBA.BAD_PARAM ex) {
         // It was not a context
         throw new NotFound(NotFoundReason.not_context,n);
     }

     // Hmm. must be ok
     return context;
 }
 
Example #25
Source File: NameServiceStartThread.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 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 #26
Source File: NamingContextImpl.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Create a new NamingContext, bind it in this Naming Context and return
 * its object reference. This is equivalent to using new_context() followed
 * by bind_context() with the supplied name and the object reference for
 * the newly created NamingContext.
 * @param n a sequence of NameComponents which is the name to be unbound.
 * @return an object reference for a new NamingContext object implemented
 * by this Name Server, bound to the supplied name.
 * @exception org.omg.CosNaming.NamingContextPackage.AlreadyBound An object
 * is already bound under the supplied name.
 * @exception org.omg.CosNaming.NamingContextPackage.NotFound A name with
 * multiple components was supplied, but the first component could not be
 * resolved.
 * @exception org.omg.CosNaming.NamingContextPackage.CannotProceed Could not
 * proceed in resolving the n-1 components of the supplied name.
 * @exception org.omg.CosNaming.NamingContextPackage.InvalidName The
 * supplied name is invalid (i.e., has length less than 1).
 * @exception org.omg.CORBA.SystemException One of a fixed set of CORBA
 * system exceptions.
 * @see new_context
 * @see bind_context
 */
public  NamingContext bind_new_context(NameComponent[] n)
    throws org.omg.CosNaming.NamingContextPackage.NotFound,
           org.omg.CosNaming.NamingContextPackage.AlreadyBound,
           org.omg.CosNaming.NamingContextPackage.CannotProceed,
           org.omg.CosNaming.NamingContextPackage.InvalidName
{
    NamingContext nc = null;
    NamingContext rnc = null;
    try {
        if (debug)
            dprint("bind_new_context " + nameToString(n));
        // The obvious solution:
        nc = this.new_context();
        this.bind_context(n,nc);
        rnc = nc;
        nc = null;
    } finally {
        try {
            if(nc != null)
                nc.destroy();
        } catch (org.omg.CosNaming.NamingContextPackage.NotEmpty e) {
        }
    }
    if( updateLogger.isLoggable( Level.FINE ) ) {
        // isLoggable call to make sure that we save some precious
        // processor cycles, if there is no need to log.
        updateLogger.fine ( LogKeywords.NAMING_BIND +
            "New Context Bound To " +
            NamingUtils.getDirectoryStructuredName( n ) );
    }
    return rnc;
}
 
Example #27
Source File: NamingContextImpl.java    From JDKSourceCode1.8 with MIT License 5 votes vote down vote up
/**
 * Bind a NamingContext under a name in this NamingContext. If the name
 * contains multiple (n) components, the first n-1 components will be
 * resolved in this NamingContext and the object bound in resulting
 * NamingContext. If a binding under the supplied name already exists it
 * will be unbound first. The NamingContext will participate in recursive
 * resolving.
 * @param n a sequence of NameComponents which is the name under which
 * the object will be bound.
 * @param obj the object reference to be bound.
 * @exception org.omg.CosNaming.NamingContextPackage.NotFound A name with
 * multiple components was supplied, but the first component could not be
 * resolved.
 * @exception org.omg.CosNaming.NamingContextPackage.CannotProceed Could not
 * proceed in resolving the n-1 components of the supplied name.
 * @exception org.omg.CosNaming.NamingContextPackage.InvalidName The
 * supplied name is invalid (i.e., has length less than 1).
 * @exception org.omg.CORBA.SystemException One of a fixed set of CORBA
 * system exceptions.
 * @see doBind
 */
public  void rebind_context(NameComponent[] n, NamingContext nc)
    throws org.omg.CosNaming.NamingContextPackage.NotFound,
           org.omg.CosNaming.NamingContextPackage.CannotProceed,
           org.omg.CosNaming.NamingContextPackage.InvalidName
{
    if( nc == null )
    {
        updateLogger.warning( LogKeywords.NAMING_REBIND_FAILURE +
            " NULL Context cannot be Bound " );
        throw wrapper.objectIsNull() ;
    }
    try {
        // doBind implements all four flavors of binding
        NamingContextDataStore impl = (NamingContextDataStore)this;
        doBind(impl,n,nc,true,BindingType.ncontext);
    } catch (org.omg.CosNaming.NamingContextPackage.AlreadyBound ex) {
        // This should not happen
        updateLogger.warning( LogKeywords.NAMING_REBIND_FAILURE +
            NamingUtils.getDirectoryStructuredName( n ) +
            " is already bound to a CORBA Object" );
        throw wrapper.namingCtxRebindctxAlreadyBound( ex ) ;
    }
    if( updateLogger.isLoggable( Level.FINE ) ) {
        // isLoggable call to make sure that we save some precious
        // processor cycles, if there is no need to log.
        updateLogger.fine( LogKeywords.NAMING_REBIND_SUCCESS + " Name = " +
            NamingUtils.getDirectoryStructuredName( n ) );
    }
}
 
Example #28
Source File: NameServiceStartThread.java    From JDKSourceCode1.8 with MIT License 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 #29
Source File: NamingContextImpl.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Bind a NamingContext under a name in this NamingContext. If the name
 * contains multiple (n) components, the first n-1 components will be
 * resolved in this NamingContext and the object bound in resulting
 * NamingContext. If a binding under the supplied name already exists it
 * will be unbound first. The NamingContext will participate in recursive
 * resolving.
 * @param n a sequence of NameComponents which is the name under which
 * the object will be bound.
 * @param obj the object reference to be bound.
 * @exception org.omg.CosNaming.NamingContextPackage.NotFound A name with
 * multiple components was supplied, but the first component could not be
 * resolved.
 * @exception org.omg.CosNaming.NamingContextPackage.CannotProceed Could not
 * proceed in resolving the n-1 components of the supplied name.
 * @exception org.omg.CosNaming.NamingContextPackage.InvalidName The
 * supplied name is invalid (i.e., has length less than 1).
 * @exception org.omg.CORBA.SystemException One of a fixed set of CORBA
 * system exceptions.
 * @see doBind
 */
public  void rebind_context(NameComponent[] n, NamingContext nc)
    throws org.omg.CosNaming.NamingContextPackage.NotFound,
           org.omg.CosNaming.NamingContextPackage.CannotProceed,
           org.omg.CosNaming.NamingContextPackage.InvalidName
{
    if( nc == null )
    {
        updateLogger.warning( LogKeywords.NAMING_REBIND_FAILURE +
            " NULL Context cannot be Bound " );
        throw wrapper.objectIsNull() ;
    }
    try {
        // doBind implements all four flavors of binding
        NamingContextDataStore impl = (NamingContextDataStore)this;
        doBind(impl,n,nc,true,BindingType.ncontext);
    } catch (org.omg.CosNaming.NamingContextPackage.AlreadyBound ex) {
        // This should not happen
        updateLogger.warning( LogKeywords.NAMING_REBIND_FAILURE +
            NamingUtils.getDirectoryStructuredName( n ) +
            " is already bound to a CORBA Object" );
        throw wrapper.namingCtxRebindctxAlreadyBound( ex ) ;
    }
    if( updateLogger.isLoggable( Level.FINE ) ) {
        // isLoggable call to make sure that we save some precious
        // processor cycles, if there is no need to log.
        updateLogger.fine( LogKeywords.NAMING_REBIND_SUCCESS + " Name = " +
            NamingUtils.getDirectoryStructuredName( n ) );
    }
}
 
Example #30
Source File: NameServiceStartThread.java    From openjdk-8-source with GNU General Public License v2.0 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( );
    }
}