com.sun.corba.se.impl.naming.cosnaming.NamingContextDataStore Java Examples

The following examples show how to use com.sun.corba.se.impl.naming.cosnaming.NamingContextDataStore. 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
/**
* Destroy this NamingContext object. If this NamingContext contains
* no bindings, the NamingContext is deleted.
* @exception org.omg.CosNaming.NamingContextPackage.NotEmpty This NamingContext
* is not empty (i.e., contains bindings).
* @exception org.omg.CORBA.SystemException One of a fixed set of CORBA system exceptions.
*/
 public  void destroy()
     throws org.omg.CosNaming.NamingContextPackage.NotEmpty
 {
     if (debug)
         dprint("destroy ");
     NamingContextDataStore impl = (NamingContextDataStore)this;
     synchronized (impl) {
         if (impl.IsEmpty() == true)
             // The context is empty so it can be destroyed
             impl.Destroy();
         else
             // This context is not empty!
             throw new org.omg.CosNaming.NamingContextPackage.NotEmpty();
     }
 }
 
Example #2
Source File: NamingContextImpl.java    From jdk8u60 with GNU General Public License v2.0 6 votes vote down vote up
/**
* Destroy this NamingContext object. If this NamingContext contains
* no bindings, the NamingContext is deleted.
* @exception org.omg.CosNaming.NamingContextPackage.NotEmpty This NamingContext
* is not empty (i.e., contains bindings).
* @exception org.omg.CORBA.SystemException One of a fixed set of CORBA system exceptions.
*/
 public  void destroy()
     throws org.omg.CosNaming.NamingContextPackage.NotEmpty
 {
     if (debug)
         dprint("destroy ");
     NamingContextDataStore impl = (NamingContextDataStore)this;
     synchronized (impl) {
         if (impl.IsEmpty() == true)
             // The context is empty so it can be destroyed
             impl.Destroy();
         else
             // This context is not empty!
             throw new org.omg.CosNaming.NamingContextPackage.NotEmpty();
     }
 }
 
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: NamingContextImpl.java    From hottub with GNU General Public License v2.0 6 votes vote down vote up
/**
* Destroy this NamingContext object. If this NamingContext contains
* no bindings, the NamingContext is deleted.
* @exception org.omg.CosNaming.NamingContextPackage.NotEmpty This NamingContext
* is not empty (i.e., contains bindings).
* @exception org.omg.CORBA.SystemException One of a fixed set of CORBA system exceptions.
*/
 public  void destroy()
     throws org.omg.CosNaming.NamingContextPackage.NotEmpty
 {
     if (debug)
         dprint("destroy ");
     NamingContextDataStore impl = (NamingContextDataStore)this;
     synchronized (impl) {
         if (impl.IsEmpty() == true)
             // The context is empty so it can be destroyed
             impl.Destroy();
         else
             // This context is not empty!
             throw new org.omg.CosNaming.NamingContextPackage.NotEmpty();
     }
 }
 
Example #5
Source File: NamingContextImpl.java    From openjdk-8-source with GNU General Public License v2.0 6 votes vote down vote up
/**
 * List the contents of this NamingContest. A sequence of bindings
 * is returned (a BindingList) containing up to the number of requested
 * bindings, and a BindingIterator object reference is returned for
 * iterating over the remaining bindings.
 * @param how_many The number of requested bindings in the BindingList.
 * @param bl The BindingList as an out parameter.
 * @param bi The BindingIterator as an out parameter.
 * @exception org.omg.CORBA.SystemException One of a fixed set of CORBA
 * system exceptions.
 * @see BindingListHolder
 * @see BindingIteratorImpl
 */
public  void list(int how_many, BindingListHolder bl,
    BindingIteratorHolder bi)
{
    // List actually generates the list
    NamingContextDataStore impl = (NamingContextDataStore)this;
    synchronized (impl) {
        impl.List(how_many,bl,bi);
    }
    if( readLogger.isLoggable( Level.FINE ) && (bl.value != null )) {
        // isLoggable call to make sure that we save some precious
        // processor cycles, if there is no need to log.
        readLogger.fine ( LogKeywords.NAMING_LIST_SUCCESS +
            "list(" + how_many + ") -> bindings[" + bl.value.length +
            "] + iterator: " + bi.value);
    }
}
 
Example #6
Source File: NamingContextImpl.java    From openjdk-jdk8u-backup 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: NamingContextImpl.java    From openjdk-8 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * List the contents of this NamingContest. A sequence of bindings
 * is returned (a BindingList) containing up to the number of requested
 * bindings, and a BindingIterator object reference is returned for
 * iterating over the remaining bindings.
 * @param how_many The number of requested bindings in the BindingList.
 * @param bl The BindingList as an out parameter.
 * @param bi The BindingIterator as an out parameter.
 * @exception org.omg.CORBA.SystemException One of a fixed set of CORBA
 * system exceptions.
 * @see BindingListHolder
 * @see BindingIteratorImpl
 */
public  void list(int how_many, BindingListHolder bl,
    BindingIteratorHolder bi)
{
    // List actually generates the list
    NamingContextDataStore impl = (NamingContextDataStore)this;
    synchronized (impl) {
        impl.List(how_many,bl,bi);
    }
    if( readLogger.isLoggable( Level.FINE ) && (bl.value != null )) {
        // isLoggable call to make sure that we save some precious
        // processor cycles, if there is no need to log.
        readLogger.fine ( LogKeywords.NAMING_LIST_SUCCESS +
            "list(" + how_many + ") -> bindings[" + bl.value.length +
            "] + iterator: " + bi.value);
    }
}
 
Example #8
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 #9
Source File: NamingContextImpl.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 6 votes vote down vote up
/**
 * This operation resolves the Stringified name into the object
 * reference.
 * @param sn Stringified Name of the object <p>
 * @exception org.omg.CosNaming.NamingContextPackage.NotFound
 * Indicates there is no object reference for the given name. <p>
 * @exception org.omg.CosNaming.NamingContextPackage.CannotProceed
 * Indicates that the given compound name is incorrect <p>
 * @exception org.omg.CosNaming.NamingContextExtPackage.InvalidName
 * Indicates the name does not identify a binding.<p>
 * @exception org.omg.CosNaming.NamingContextPackage.AlreadyBound
 * Indicates the name is already bound.<p>
 *
 */
public org.omg.CORBA.Object resolve_str(String sn)
    throws org.omg.CosNaming.NamingContextPackage.NotFound,
           org.omg.CosNaming.NamingContextPackage.CannotProceed,
           org.omg.CosNaming.NamingContextPackage.InvalidName
{
    org.omg.CORBA.Object theObject = null;
    // Name valid?
    if  ( (sn == null ) || (sn.length() == 0) )
    {
            throw new InvalidName();
    }
    NamingContextDataStore impl = (NamingContextDataStore)this;
    org.omg.CosNaming.NameComponent[] theNameComponents =
            insImpl.convertToNameComponent( sn );

    if( ( theNameComponents == null ) || (theNameComponents.length == 0 ) )
    {
            throw new InvalidName();
    }
    theObject = resolve( theNameComponents );
    return theObject;
}
 
Example #10
Source File: NamingContextImpl.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
/**
 * List the contents of this NamingContest. A sequence of bindings
 * is returned (a BindingList) containing up to the number of requested
 * bindings, and a BindingIterator object reference is returned for
 * iterating over the remaining bindings.
 * @param how_many The number of requested bindings in the BindingList.
 * @param bl The BindingList as an out parameter.
 * @param bi The BindingIterator as an out parameter.
 * @exception org.omg.CORBA.SystemException One of a fixed set of CORBA
 * system exceptions.
 * @see BindingListHolder
 * @see BindingIteratorImpl
 */
public  void list(int how_many, BindingListHolder bl,
    BindingIteratorHolder bi)
{
    // List actually generates the list
    NamingContextDataStore impl = (NamingContextDataStore)this;
    synchronized (impl) {
        impl.List(how_many,bl,bi);
    }
    if( readLogger.isLoggable( Level.FINE ) && (bl.value != null )) {
        // isLoggable call to make sure that we save some precious
        // processor cycles, if there is no need to log.
        readLogger.fine ( LogKeywords.NAMING_LIST_SUCCESS +
            "list(" + how_many + ") -> bindings[" + bl.value.length +
            "] + iterator: " + bi.value);
    }
}
 
Example #11
Source File: NamingContextImpl.java    From JDKSourceCode1.8 with MIT License 6 votes vote down vote up
/**
 * This operation resolves the Stringified name into the object
 * reference.
 * @param sn Stringified Name of the object <p>
 * @exception org.omg.CosNaming.NamingContextPackage.NotFound
 * Indicates there is no object reference for the given name. <p>
 * @exception org.omg.CosNaming.NamingContextPackage.CannotProceed
 * Indicates that the given compound name is incorrect <p>
 * @exception org.omg.CosNaming.NamingContextExtPackage.InvalidName
 * Indicates the name does not identify a binding.<p>
 * @exception org.omg.CosNaming.NamingContextPackage.AlreadyBound
 * Indicates the name is already bound.<p>
 *
 */
public org.omg.CORBA.Object resolve_str(String sn)
    throws org.omg.CosNaming.NamingContextPackage.NotFound,
           org.omg.CosNaming.NamingContextPackage.CannotProceed,
           org.omg.CosNaming.NamingContextPackage.InvalidName
{
    org.omg.CORBA.Object theObject = null;
    // Name valid?
    if  ( (sn == null ) || (sn.length() == 0) )
    {
            throw new InvalidName();
    }
    NamingContextDataStore impl = (NamingContextDataStore)this;
    org.omg.CosNaming.NameComponent[] theNameComponents =
            insImpl.convertToNameComponent( sn );

    if( ( theNameComponents == null ) || (theNameComponents.length == 0 ) )
    {
            throw new InvalidName();
    }
    theObject = resolve( theNameComponents );
    return theObject;
}
 
Example #12
Source File: NamingContextImpl.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * List the contents of this NamingContest. A sequence of bindings
 * is returned (a BindingList) containing up to the number of requested
 * bindings, and a BindingIterator object reference is returned for
 * iterating over the remaining bindings.
 * @param how_many The number of requested bindings in the BindingList.
 * @param bl The BindingList as an out parameter.
 * @param bi The BindingIterator as an out parameter.
 * @exception org.omg.CORBA.SystemException One of a fixed set of CORBA
 * system exceptions.
 * @see BindingListHolder
 * @see BindingIteratorImpl
 */
public  void list(int how_many, BindingListHolder bl,
    BindingIteratorHolder bi)
{
    // List actually generates the list
    NamingContextDataStore impl = (NamingContextDataStore)this;
    synchronized (impl) {
        impl.List(how_many,bl,bi);
    }
    if( readLogger.isLoggable( Level.FINE ) && (bl.value != null )) {
        // isLoggable call to make sure that we save some precious
        // processor cycles, if there is no need to log.
        readLogger.fine ( LogKeywords.NAMING_LIST_SUCCESS +
            "list(" + how_many + ") -> bindings[" + bl.value.length +
            "] + iterator: " + bi.value);
    }
}
 
Example #13
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 #14
Source File: NamingContextImpl.java    From jdk1.8-source-analysis with Apache License 2.0 6 votes vote down vote up
/**
 * Destroy this NamingContext object. If this NamingContext contains
 * no bindings, the NamingContext is deleted.
 * @exception org.omg.CosNaming.NamingContextPackage.NotEmpty This
 * NamingContext is not empty (i.e., contains bindings).
 * @exception org.omg.CORBA.SystemException One of a fixed set of CORBA
 * system exceptions.
 */
public  void destroy()
    throws org.omg.CosNaming.NamingContextPackage.NotEmpty
{
    lifecycleLogger.fine( "Destroying Naming Context " );
    NamingContextDataStore impl = (NamingContextDataStore)this;
    synchronized (impl) {
        if (impl.IsEmpty() == true) {
            // The context is empty so it can be destroyed
            impl.Destroy();
            lifecycleLogger.fine ( LogKeywords.LIFECYCLE_DESTROY_SUCCESS );
        }
        else {
            // This context is not empty!
            // Not a fatal error, warning should do.
            lifecycleLogger.warning( LogKeywords.LIFECYCLE_DESTROY_FAILURE +
                " NamingContext children are not destroyed still.." );
            throw new NotEmpty();
        }
    }
}
 
Example #15
Source File: NamingContextImpl.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
/**
* This operation creates a stringified name from the array of Name
* components.
* @param n Name of the object <p>
* @exception org.omg.CosNaming.NamingContextExtPackage.InvalidName
* Indicates the name does not identify a binding.<p>
*
*/
public String to_string(org.omg.CosNaming.NameComponent[] n)
     throws org.omg.CosNaming.NamingContextPackage.InvalidName
{
    // Name valid?
    if ( (n == null ) || (n.length == 0) )
    {
            throw new InvalidName();
    }
    NamingContextDataStore impl = (NamingContextDataStore)this;

    String theStringifiedName = insImpl.convertToString( n );

    if( theStringifiedName == null )
    {
            throw new InvalidName();
    }

    return theStringifiedName;
}
 
Example #16
Source File: NamingContextImpl.java    From openjdk-8 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * This operation resolves the Stringified name into the object
 * reference.
 * @param sn Stringified Name of the object <p>
 * @exception org.omg.CosNaming.NamingContextPackage.NotFound
 * Indicates there is no object reference for the given name. <p>
 * @exception org.omg.CosNaming.NamingContextPackage.CannotProceed
 * Indicates that the given compound name is incorrect <p>
 * @exception org.omg.CosNaming.NamingContextExtPackage.InvalidName
 * Indicates the name does not identify a binding.<p>
 * @exception org.omg.CosNaming.NamingContextPackage.AlreadyBound
 * Indicates the name is already bound.<p>
 *
 */
public org.omg.CORBA.Object resolve_str(String sn)
    throws org.omg.CosNaming.NamingContextPackage.NotFound,
           org.omg.CosNaming.NamingContextPackage.CannotProceed,
           org.omg.CosNaming.NamingContextPackage.InvalidName
{
    org.omg.CORBA.Object theObject = null;
    // Name valid?
    if  ( (sn == null ) || (sn.length() == 0) )
    {
            throw new InvalidName();
    }
    NamingContextDataStore impl = (NamingContextDataStore)this;
    org.omg.CosNaming.NameComponent[] theNameComponents =
            insImpl.convertToNameComponent( sn );

    if( ( theNameComponents == null ) || (theNameComponents.length == 0 ) )
    {
            throw new InvalidName();
    }
    theObject = resolve( theNameComponents );
    return theObject;
}
 
Example #17
Source File: NamingContextImpl.java    From openjdk-8-source with GNU General Public License v2.0 6 votes vote down vote up
/**
* Destroy this NamingContext object. If this NamingContext contains
* no bindings, the NamingContext is deleted.
* @exception org.omg.CosNaming.NamingContextPackage.NotEmpty This NamingContext
* is not empty (i.e., contains bindings).
* @exception org.omg.CORBA.SystemException One of a fixed set of CORBA system exceptions.
*/
 public  void destroy()
     throws org.omg.CosNaming.NamingContextPackage.NotEmpty
 {
     if (debug)
         dprint("destroy ");
     NamingContextDataStore impl = (NamingContextDataStore)this;
     synchronized (impl) {
         if (impl.IsEmpty() == true)
             // The context is empty so it can be destroyed
             impl.Destroy();
         else
             // This context is not empty!
             throw new org.omg.CosNaming.NamingContextPackage.NotEmpty();
     }
 }
 
Example #18
Source File: NamingContextImpl.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
/**
* This operation creates a stringified name from the array of Name
* components.
* @param n Name of the object
* @exception org.omg.CosNaming.NamingContextExtPackage.InvalidName
* Indicates the name does not identify a binding.
*/
public String to_string(org.omg.CosNaming.NameComponent[] n)
     throws org.omg.CosNaming.NamingContextPackage.InvalidName
{
    // Name valid?
    if ( (n == null ) || (n.length == 0) )
    {
            throw new InvalidName();
    }
    NamingContextDataStore impl = (NamingContextDataStore)this;

    String theStringifiedName = insImpl.convertToString( n );

    if( theStringifiedName == null )
    {
            throw new InvalidName();
    }

    return theStringifiedName;
}
 
Example #19
Source File: NamingContextImpl.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
/**
 * This operation resolves the Stringified name into the object
 * reference.
 * @param sn Stringified Name of the object <p>
 * @exception org.omg.CosNaming.NamingContextPackage.NotFound
 * Indicates there is no object reference for the given name. <p>
 * @exception org.omg.CosNaming.NamingContextPackage.CannotProceed
 * Indicates that the given compound name is incorrect <p>
 * @exception org.omg.CosNaming.NamingContextExtPackage.InvalidName
 * Indicates the name does not identify a binding.<p>
 * @exception org.omg.CosNaming.NamingContextPackage.AlreadyBound
 * Indicates the name is already bound.<p>
 *
 */
public org.omg.CORBA.Object resolve_str(String sn)
    throws org.omg.CosNaming.NamingContextPackage.NotFound,
           org.omg.CosNaming.NamingContextPackage.CannotProceed,
           org.omg.CosNaming.NamingContextPackage.InvalidName
{
    org.omg.CORBA.Object theObject = null;
    // Name valid?
    if  ( (sn == null ) || (sn.length() == 0) )
    {
            throw new InvalidName();
    }
    NamingContextDataStore impl = (NamingContextDataStore)this;
    org.omg.CosNaming.NameComponent[] theNameComponents =
            insImpl.convertToNameComponent( sn );

    if( ( theNameComponents == null ) || (theNameComponents.length == 0 ) )
    {
            throw new InvalidName();
    }
    theObject = resolve( theNameComponents );
    return theObject;
}
 
Example #20
Source File: NamingContextImpl.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 6 votes vote down vote up
/**
* This operation creates a stringified name from the array of Name
* components.
* @param n Name of the object <p>
* @exception org.omg.CosNaming.NamingContextExtPackage.InvalidName
* Indicates the name does not identify a binding.<p>
*
*/
public String to_string(org.omg.CosNaming.NameComponent[] n)
     throws org.omg.CosNaming.NamingContextPackage.InvalidName
{
    // Name valid?
    if ( (n == null ) || (n.length == 0) )
    {
            throw new InvalidName();
    }
    NamingContextDataStore impl = (NamingContextDataStore)this;

    String theStringifiedName = insImpl.convertToString( n );

    if( theStringifiedName == null )
    {
            throw new InvalidName();
    }

    return theStringifiedName;
}
 
Example #21
Source File: NamingContextImpl.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
/**
* Implements resolving names in this NamingContext. The first component
* of the supplied name is resolved in this NamingContext by calling
* Resolve(). If there are no more components in the name, the
* resulting object reference is returned. Otherwise, the resulting object
* reference must have been bound as a context and be narrowable to
* a NamingContext. If this is the case, the remaining
* components of the name is resolved in the resulting NamingContext.
* This method is static for maximal reuse - even for extended naming
* context implementations where the recursive semantics still apply.
* @param impl an implementation of NamingContextDataStore
* @param n a sequence of NameComponents which is the name to be resolved.
* @return the object reference 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 first component 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 resolve
*/
 public static org.omg.CORBA.Object doResolve(NamingContextDataStore impl,
                                              NameComponent[] n)
     throws org.omg.CosNaming.NamingContextPackage.NotFound,
            org.omg.CosNaming.NamingContextPackage.CannotProceed,
            org.omg.CosNaming.NamingContextPackage.InvalidName
 {
     org.omg.CORBA.Object obj = null;
     BindingTypeHolder bth = new BindingTypeHolder();

     // Length must be greater than 0
     if (n.length < 1)
         throw new org.omg.CosNaming.NamingContextPackage.InvalidName();

     // The identifier must be set
     if (n.length == 1) {
         synchronized (impl) {
             // Resolve first level in this context
             obj = impl.Resolve(n[0],bth);
         }
         if (obj == null) {
             // Object was not found
             throw new org.omg.CosNaming.NamingContextPackage.NotFound(NotFoundReason.missing_node,n);
         }
         return obj;
     } else {
         // n.length > 1
         if ( (n[1].id.length() == 0) && (n[1].kind.length() == 0 ) )
             throw new org.omg.CosNaming.NamingContextPackage.InvalidName();

         NamingContext context = resolveFirstAsContext(impl,n);

         // Compute restOfName = name[1..length]
         NameComponent[] tail = new NameComponent[n.length -1];
         System.arraycopy(n,1,tail,0,n.length-1);

         // Resolve rest of name in context
         return context.resolve(tail);
     }
 }
 
Example #22
Source File: NamingContextImpl.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
/**
* Implements resolving names in this NamingContext. The first component
* of the supplied name is resolved in this NamingContext by calling
* Resolve(). If there are no more components in the name, the
* resulting object reference is returned. Otherwise, the resulting object
* reference must have been bound as a context and be narrowable to
* a NamingContext. If this is the case, the remaining
* components of the name is resolved in the resulting NamingContext.
* This method is static for maximal reuse - even for extended naming
* context implementations where the recursive semantics still apply.
* @param impl an implementation of NamingContextDataStore
* @param n a sequence of NameComponents which is the name to be resolved.
* @return the object reference 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 first component 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 resolve
*/
 public static org.omg.CORBA.Object doResolve(NamingContextDataStore impl,
                                              NameComponent[] n)
     throws org.omg.CosNaming.NamingContextPackage.NotFound,
            org.omg.CosNaming.NamingContextPackage.CannotProceed,
            org.omg.CosNaming.NamingContextPackage.InvalidName
 {
     org.omg.CORBA.Object obj = null;
     BindingTypeHolder bth = new BindingTypeHolder();

     // Length must be greater than 0
     if (n.length < 1)
         throw new org.omg.CosNaming.NamingContextPackage.InvalidName();

     // The identifier must be set
     if (n.length == 1) {
         synchronized (impl) {
             // Resolve first level in this context
             obj = impl.Resolve(n[0],bth);
         }
         if (obj == null) {
             // Object was not found
             throw new org.omg.CosNaming.NamingContextPackage.NotFound(NotFoundReason.missing_node,n);
         }
         return obj;
     } else {
         // n.length > 1
         if ( (n[1].id.length() == 0) && (n[1].kind.length() == 0 ) )
             throw new org.omg.CosNaming.NamingContextPackage.InvalidName();

         NamingContext context = resolveFirstAsContext(impl,n);

         // Compute restOfName = name[1..length]
         NameComponent[] tail = new NameComponent[n.length -1];
         System.arraycopy(n,1,tail,0,n.length-1);

         // Resolve rest of name in context
         return context.resolve(tail);
     }
 }
 
Example #23
Source File: NamingContextImpl.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
/**
* List the contents of this NamingContest. A sequence of bindings
* is returned (a BindingList) containing up to the number of requested
* bindings, and a BindingIterator object reference is returned for
* iterating over the remaining bindings.
* @param how_many The number of requested bindings in the BindingList.
* @param bl The BindingList as an out parameter.
* @param bi The BindingIterator as an out parameter.
* @exception org.omg.CORBA.SystemException One of a fixed set of CORBA system exceptions.
* @see BindingListHolder
* @see BindingIteratorImpl
*/
 public  void list(int how_many, BindingListHolder bl, BindingIteratorHolder bi)
 {
     if (debug)
         dprint("list(" + how_many + ")");
     // List actually generates the list
     NamingContextDataStore impl = (NamingContextDataStore)this;
     synchronized (impl) {
         impl.List(how_many,bl,bi);
     }
     if (debug && bl.value != null)
         dprint("list(" + how_many + ") -> bindings[" + bl.value.length +
                "] + iterator: " + bi.value);
 }
 
Example #24
Source File: NamingContextImpl.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
/**
* Implements resolving names in this NamingContext. The first component
* of the supplied name is resolved in this NamingContext by calling
* Resolve(). If there are no more components in the name, the
* resulting object reference is returned. Otherwise, the resulting object
* reference must have been bound as a context and be narrowable to
* a NamingContext. If this is the case, the remaining
* components of the name is resolved in the resulting NamingContext.
* This method is static for maximal reuse - even for extended naming
* context implementations where the recursive semantics still apply.
* @param impl an implementation of NamingContextDataStore
* @param n a sequence of NameComponents which is the name to be resolved.
* @return the object reference 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 first component 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 resolve
*/
 public static org.omg.CORBA.Object doResolve(NamingContextDataStore impl,
                                              NameComponent[] n)
     throws org.omg.CosNaming.NamingContextPackage.NotFound,
            org.omg.CosNaming.NamingContextPackage.CannotProceed,
            org.omg.CosNaming.NamingContextPackage.InvalidName
 {
     org.omg.CORBA.Object obj = null;
     BindingTypeHolder bth = new BindingTypeHolder();

     // Length must be greater than 0
     if (n.length < 1)
         throw new org.omg.CosNaming.NamingContextPackage.InvalidName();

     // The identifier must be set
     if (n.length == 1) {
         synchronized (impl) {
             // Resolve first level in this context
             obj = impl.Resolve(n[0],bth);
         }
         if (obj == null) {
             // Object was not found
             throw new org.omg.CosNaming.NamingContextPackage.NotFound(NotFoundReason.missing_node,n);
         }
         return obj;
     } else {
         // n.length > 1
         if ( (n[1].id.length() == 0) && (n[1].kind.length() == 0 ) )
             throw new org.omg.CosNaming.NamingContextPackage.InvalidName();

         NamingContext context = resolveFirstAsContext(impl,n);

         // Compute restOfName = name[1..length]
         NameComponent[] tail = new NameComponent[n.length -1];
         System.arraycopy(n,1,tail,0,n.length-1);

         // Resolve rest of name in context
         return context.resolve(tail);
     }
 }
 
Example #25
Source File: NamingContextImpl.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
/**
* This operation creates a URL based "iiopname://" format name
* from the Stringified Name of the object.
* @param addr internet based address of the host machine where
* Name Service is running <p>
* @param sn Stringified Name of the object <p>
* @exception org.omg.CosNaming.NamingContextExtPackage.InvalidName
* Indicates the name does not identify a binding.<p>
* @exception org.omg.CosNaming.NamingContextPackage.InvalidAddress
* Indicates the internet based address of the host machine is
* incorrect <p>
*
*/

public String to_url(String addr, String sn)
    throws org.omg.CosNaming.NamingContextExtPackage.InvalidAddress,
           org.omg.CosNaming.NamingContextPackage.InvalidName
{
    // Name valid?
    if  ( (sn == null ) || (sn.length() == 0) )
    {
        throw new InvalidName();
    }
    if( addr == null )
    {
        throw new
            org.omg.CosNaming.NamingContextExtPackage.InvalidAddress();
    }
    NamingContextDataStore impl = (NamingContextDataStore)this;
    String urlBasedAddress = null;
    urlBasedAddress = insImpl.createURLBasedAddress( addr, sn );
    // Extra check to see that corba name url created is valid as per
    // INS spec grammer.
    try {
        INSURLHandler.getINSURLHandler( ).parseURL( urlBasedAddress );
    } catch( BAD_PARAM e ) {
        throw new
            org.omg.CosNaming.NamingContextExtPackage.InvalidAddress();
    }
    return urlBasedAddress;
}
 
Example #26
Source File: NamingContextImpl.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Bind an object under a name in this NamingContext. If the name
 * contains multiple (n) components, n-1 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. If the
 * object to be bound is a NamingContext it will not participate in
 * a recursive resolve.
 * @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(NameComponent[] n, org.omg.CORBA.Object obj)
    throws       org.omg.CosNaming.NamingContextPackage.NotFound,
                 org.omg.CosNaming.NamingContextPackage.CannotProceed,
                 org.omg.CosNaming.NamingContextPackage.InvalidName
{
    if( obj == null )
    {
        updateLogger.warning( LogKeywords.NAMING_REBIND_FAILURE +
            " NULL Object cannot be Bound " );
        throw wrapper.objectIsNull() ;
    }
    try {
        // doBind implements all four flavors of binding
        NamingContextDataStore impl = (NamingContextDataStore)this;
        doBind(impl,n,obj,true,BindingType.nobject);
    } catch (org.omg.CosNaming.NamingContextPackage.AlreadyBound ex) {
        updateLogger.warning( LogKeywords.NAMING_REBIND_FAILURE +
            NamingUtils.getDirectoryStructuredName( n ) +
            " is already bound to a Naming Context" );
        // This should not happen
        throw wrapper.namingCtxRebindAlreadyBound( 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 #27
Source File: NamingContextImpl.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
/**
* List the contents of this NamingContest. A sequence of bindings
* is returned (a BindingList) containing up to the number of requested
* bindings, and a BindingIterator object reference is returned for
* iterating over the remaining bindings.
* @param how_many The number of requested bindings in the BindingList.
* @param bl The BindingList as an out parameter.
* @param bi The BindingIterator as an out parameter.
* @exception org.omg.CORBA.SystemException One of a fixed set of CORBA system exceptions.
* @see BindingListHolder
* @see BindingIteratorImpl
*/
 public  void list(int how_many, BindingListHolder bl, BindingIteratorHolder bi)
 {
     if (debug)
         dprint("list(" + how_many + ")");
     // List actually generates the list
     NamingContextDataStore impl = (NamingContextDataStore)this;
     synchronized (impl) {
         impl.List(how_many,bl,bi);
     }
     if (debug && bl.value != null)
         dprint("list(" + how_many + ") -> bindings[" + bl.value.length +
                "] + iterator: " + bi.value);
 }
 
Example #28
Source File: NamingContextImpl.java    From openjdk-8 with GNU General Public License v2.0 5 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
     if (debug)
         dprint("new_context()");
     NamingContextDataStore impl = (NamingContextDataStore)this;
     synchronized (impl) {
         return impl.NewContext();
     }
 }
 
Example #29
Source File: NamingContextImpl.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
/**
* This operation creates a URL based "iiopname://" format name
* from the Stringified Name of the object.
* @param addr internet based address of the host machine where
* Name Service is running
* @param sn Stringified Name of the object
* @exception org.omg.CosNaming.NamingContextExtPackage.InvalidName
* Indicates the name does not identify a binding.
* @exception org.omg.CosNaming.NamingContextPackage.InvalidAddress
* Indicates the internet based address of the host machine is
* incorrect
*/

public String to_url(String addr, String sn)
    throws org.omg.CosNaming.NamingContextExtPackage.InvalidAddress,
           org.omg.CosNaming.NamingContextPackage.InvalidName
{
    // Name valid?
    if  ( (sn == null ) || (sn.length() == 0) )
    {
        throw new InvalidName();
    }
    if( addr == null )
    {
        throw new
            org.omg.CosNaming.NamingContextExtPackage.InvalidAddress();
    }
    NamingContextDataStore impl = (NamingContextDataStore)this;
    String urlBasedAddress = null;
    urlBasedAddress = insImpl.createURLBasedAddress( addr, sn );
    // Extra check to see that corba name url created is valid as per
    // INS spec grammer.
    try {
        INSURLHandler.getINSURLHandler( ).parseURL( urlBasedAddress );
    } catch( BAD_PARAM e ) {
        throw new
            org.omg.CosNaming.NamingContextExtPackage.InvalidAddress();
    }
    return urlBasedAddress;
}
 
Example #30
Source File: NamingContextImpl.java    From jdk1.8-source-analysis with Apache License 2.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 org.omg.CosNaming.NamingContextPackage.NotFound(NotFoundReason.missing_node,n);
         }
     }

     // Was it bound as a context?
     if (bth.value != BindingType.ncontext) {
         // It was not a context
         throw new org.omg.CosNaming.NamingContextPackage.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 org.omg.CosNaming.NamingContextPackage.NotFound(NotFoundReason.not_context,n);
     }

     // Hmm. must be ok
     return context;
 }