Java Code Examples for org.omg.CosNaming.NameComponent

The following are top voted examples for showing how to use org.omg.CosNaming.NameComponent. 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: NamingContextImpl.java   View source code 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 2
Project: OpenJSharp   File: NamingContextImpl.java   View source code 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 3
Project: OpenJSharp   File: NamingContextImpl.java   View source code 6 votes vote down vote up
public static String nameToString(NameComponent[] name)
{
    StringBuffer s = new StringBuffer("{");
    if (name != null || name.length > 0) {
        for (int i=0;i<name.length;i++) {
            if (i>0)
                s.append(",");
            s.append("[").
                append(name[i].id).
                append(",").
                append(name[i].kind).
                append("]");
        }
    }
    s.append("}");
    return s.toString();
}
 
Example 4
Project: OpenJSharp   File: TransientNamingContext.java   View source code 6 votes vote down vote up
/**
 * Binds the object to the name component as the specified binding type.
 * It creates a InternalBindingKey object and a InternalBindingValue
 * object and inserts them in the hash table.
 * @param n A single org.omg.CosNaming::NameComponent under which the
 * object will be bound.
 * @param obj An object reference to be bound under the supplied name.
 * @param bt The type of the binding (i.e., as object or as context).
 * @exception org.omg.CORBA.SystemException One of a fixed set of CORBA
 * system exceptions.
 */
public final void Bind(NameComponent n, org.omg.CORBA.Object obj,
                       BindingType bt)
    throws org.omg.CORBA.SystemException
{
    // Create a key and a value
    InternalBindingKey key = new InternalBindingKey(n);
    NameComponent[] name = new NameComponent[1];
    name[0] = n;
    Binding b = new Binding(name,bt);
    InternalBindingValue value = new InternalBindingValue(b,null);
    value.theObjectRef = obj;
    // insert it
    InternalBindingValue oldValue =
        (InternalBindingValue)this.theHashtable.put(key,value);

    if (oldValue != null) {
        updateLogger.warning( LogKeywords.NAMING_BIND + "Name " +
            getName( n ) + " Was Already Bound" );
        throw wrapper.transNcBindAlreadyBound() ;
    }
    if( updateLogger.isLoggable( Level.FINE ) ) {
        updateLogger.fine( LogKeywords.NAMING_BIND_SUCCESS +
            "Name Component: " + n.id + "." + n.kind );
    }
}
 
Example 5
Project: OpenJSharp   File: TransientNamingContext.java   View source code 6 votes vote down vote up
/**
 * Deletes the binding with the supplied name. It creates a
 * InternalBindingKey and uses it to remove the value associated
 * with the key. If nothing is found an exception is thrown, otherwise
 * the element is removed from the hash table.
 * @param n a NameComponent which is the name to unbind
 * @return the object reference bound to the name, or null if not found.
 * @exception org.omg.CORBA.SystemException One of a fixed set of CORBA
 * system exceptions.
 */
public final org.omg.CORBA.Object Unbind(NameComponent n)
    throws org.omg.CORBA.SystemException
{
    // Create a key and remove it from the hashtable
    InternalBindingKey key = new InternalBindingKey(n);
    InternalBindingValue value =
        (InternalBindingValue)this.theHashtable.remove(key);

    // Return what was found
    if (value == null) {
        if( updateLogger.isLoggable( Level.FINE ) ) {
            updateLogger.fine( LogKeywords.NAMING_UNBIND_FAILURE +
                " There was no binding with the name " + getName( n ) +
                " to Unbind " );
        }
        return null;
    } else {
        if( updateLogger.isLoggable( Level.FINE ) ) {
            updateLogger.fine( LogKeywords.NAMING_UNBIND_SUCCESS +
                " NameComponent:  " + getName( n ) );
        }
        return value.theObjectRef;
   }
}
 
Example 6
Project: OpenJSharp   File: InterOperableNamingImpl.java   View source code 6 votes vote down vote up
/**
 * Method which stringifies the Name Components given as the input
 * parameter.
 *
 * @param n Array of Name Components (Simple or Compound Names)
 * @return string which is the stringified reference.
 */
public String convertToString( org.omg.CosNaming.NameComponent[]
                               theNameComponents )
{
    String theConvertedString =
        convertNameComponentToString( theNameComponents[0] );
    String temp;
    for( int i = 1; i < theNameComponents.length; i++ ) {
        temp = convertNameComponentToString( theNameComponents[i] );
        if( temp != null ) {
             theConvertedString =
             theConvertedString + "/" +  convertNameComponentToString(
                 theNameComponents[i] );
        }
    }
    return theConvertedString;
}
 
Example 7
Project: OpenJSharp   File: InterOperableNamingImpl.java   View source code 6 votes vote down vote up
/**
  * Method which converts the Stringified name into Array of Name Components.
  *
  * @param string which is the stringified name.
  * @return  Array of Name Components (Simple or Compound Names)
  */
public org.omg.CosNaming.NameComponent[] convertToNameComponent(
    String theStringifiedName )
    throws org.omg.CosNaming.NamingContextPackage.InvalidName
{
     String[] theStringifiedNameComponents =
              breakStringToNameComponents( theStringifiedName );
     if( ( theStringifiedNameComponents == null )
      || (theStringifiedNameComponents.length == 0 ) )
     {
         return null;
     }
     NameComponent[] theNameComponents =
         new NameComponent[theStringifiedNameComponents.length];
     for( int i = 0; i < theStringifiedNameComponents.length; i++ ) {
         theNameComponents[i] = createNameComponentFromString(
             theStringifiedNameComponents[i] );
     }
     return theNameComponents;
}
 
Example 8
Project: OpenJSharp   File: PersistentBindingIterator.java   View source code 6 votes vote down vote up
/**
* Returns the next binding in the NamingContext. Uses the enumeration
* object to determine if there are more bindings and if so, returns
* the next binding from the InternalBindingValue.
* @param b The Binding as an out parameter.
* @return true if there were more bindings.
*/
 final public boolean NextOne(org.omg.CosNaming.BindingHolder b)
 {
     // If there are more elements get the next element
     boolean hasMore = theEnumeration.hasMoreElements();
     if (hasMore) {
         InternalBindingKey theBindingKey =
              ((InternalBindingKey)theEnumeration.nextElement());
         InternalBindingValue theElement =
             (InternalBindingValue)theHashtable.get( theBindingKey );
         NameComponent n = new NameComponent( theBindingKey.id, theBindingKey.kind );
         NameComponent[] nlist = new NameComponent[1];
         nlist[0] = n;
         BindingType theType = theElement.theBindingType;

         b.value =
             new Binding( nlist, theType );
     } else {
         // Return empty but marshalable binding
         b.value = new Binding(new NameComponent[0],BindingType.nobject);
     }
     return hasMore;
 }
 
Example 9
Project: openjdk-jdk10   File: NamingContextImpl.java   View source code 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 10
Project: openjdk-jdk10   File: NamingContextImpl.java   View source code 6 votes vote down vote up
/**
 * This operation resolves the Stringified name into the object
 * reference.
 * @param sn Stringified Name of the object
 * @exception org.omg.CosNaming.NamingContextPackage.NotFound
 * Indicates there is no object reference for the given name.
 * @exception org.omg.CosNaming.NamingContextPackage.CannotProceed
 * Indicates that the given compound name is incorrect
 * @exception org.omg.CosNaming.NamingContextExtPackage.InvalidName
 * Indicates the name does not identify a binding.
 * @exception org.omg.CosNaming.NamingContextPackage.AlreadyBound
 * Indicates the name is already bound.
 *
 */
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 11
Project: openjdk-jdk10   File: NamingContextImpl.java   View source code 6 votes vote down vote up
public static String nameToString(NameComponent[] name)
{
    StringBuffer s = new StringBuffer("{");
    if (name != null || name.length > 0) {
        for (int i=0;i<name.length;i++) {
            if (i>0)
                s.append(",");
            s.append("[").
                append(name[i].id).
                append(",").
                append(name[i].kind).
                append("]");
        }
    }
    s.append("}");
    return s.toString();
}
 
Example 12
Project: openjdk-jdk10   File: TransientNamingContext.java   View source code 6 votes vote down vote up
/**
 * Binds the object to the name component as the specified binding type.
 * It creates a InternalBindingKey object and a InternalBindingValue
 * object and inserts them in the hash table.
 * @param n A single org.omg.CosNaming::NameComponent under which the
 * object will be bound.
 * @param obj An object reference to be bound under the supplied name.
 * @param bt The type of the binding (i.e., as object or as context).
 * @exception org.omg.CORBA.SystemException One of a fixed set of CORBA
 * system exceptions.
 */
public final void Bind(NameComponent n, org.omg.CORBA.Object obj,
                       BindingType bt)
    throws org.omg.CORBA.SystemException
{
    // Create a key and a value
    InternalBindingKey key = new InternalBindingKey(n);
    NameComponent[] name = new NameComponent[1];
    name[0] = n;
    Binding b = new Binding(name,bt);
    InternalBindingValue value = new InternalBindingValue(b,null);
    value.theObjectRef = obj;
    // insert it
    InternalBindingValue oldValue =
        (InternalBindingValue)this.theHashtable.put(key,value);

    if (oldValue != null) {
        updateLogger.warning( LogKeywords.NAMING_BIND + "Name " +
            getName( n ) + " Was Already Bound" );
        throw wrapper.transNcBindAlreadyBound() ;
    }
    if( updateLogger.isLoggable( Level.FINE ) ) {
        updateLogger.fine( LogKeywords.NAMING_BIND_SUCCESS +
            "Name Component: " + n.id + "." + n.kind );
    }
}
 
Example 13
Project: openjdk-jdk10   File: TransientNamingContext.java   View source code 6 votes vote down vote up
/**
 * Deletes the binding with the supplied name. It creates a
 * InternalBindingKey and uses it to remove the value associated
 * with the key. If nothing is found an exception is thrown, otherwise
 * the element is removed from the hash table.
 * @param n a NameComponent which is the name to unbind
 * @return the object reference bound to the name, or null if not found.
 * @exception org.omg.CORBA.SystemException One of a fixed set of CORBA
 * system exceptions.
 */
public final org.omg.CORBA.Object Unbind(NameComponent n)
    throws org.omg.CORBA.SystemException
{
    // Create a key and remove it from the hashtable
    InternalBindingKey key = new InternalBindingKey(n);
    InternalBindingValue value =
        (InternalBindingValue)this.theHashtable.remove(key);

    // Return what was found
    if (value == null) {
        if( updateLogger.isLoggable( Level.FINE ) ) {
            updateLogger.fine( LogKeywords.NAMING_UNBIND_FAILURE +
                " There was no binding with the name " + getName( n ) +
                " to Unbind " );
        }
        return null;
    } else {
        if( updateLogger.isLoggable( Level.FINE ) ) {
            updateLogger.fine( LogKeywords.NAMING_UNBIND_SUCCESS +
                " NameComponent:  " + getName( n ) );
        }
        return value.theObjectRef;
   }
}
 
Example 14
Project: openjdk-jdk10   File: InterOperableNamingImpl.java   View source code 6 votes vote down vote up
/**
 * Method which stringifies the Name Components given as the input
 * parameter.
 *
 * @param n Array of Name Components (Simple or Compound Names)
 * @return string which is the stringified reference.
 */
public String convertToString( org.omg.CosNaming.NameComponent[]
                               theNameComponents )
{
    String theConvertedString =
        convertNameComponentToString( theNameComponents[0] );
    String temp;
    for( int i = 1; i < theNameComponents.length; i++ ) {
        temp = convertNameComponentToString( theNameComponents[i] );
        if( temp != null ) {
             theConvertedString =
             theConvertedString + "/" +  convertNameComponentToString(
                 theNameComponents[i] );
        }
    }
    return theConvertedString;
}
 
Example 15
Project: openjdk-jdk10   File: InterOperableNamingImpl.java   View source code 6 votes vote down vote up
/**
  * Method which converts the Stringified name into Array of Name Components.
  *
  * @param string which is the stringified name.
  * @return  Array of Name Components (Simple or Compound Names)
  */
public org.omg.CosNaming.NameComponent[] convertToNameComponent(
    String theStringifiedName )
    throws org.omg.CosNaming.NamingContextPackage.InvalidName
{
     String[] theStringifiedNameComponents =
              breakStringToNameComponents( theStringifiedName );
     if( ( theStringifiedNameComponents == null )
      || (theStringifiedNameComponents.length == 0 ) )
     {
         return null;
     }
     NameComponent[] theNameComponents =
         new NameComponent[theStringifiedNameComponents.length];
     for( int i = 0; i < theStringifiedNameComponents.length; i++ ) {
         theNameComponents[i] = createNameComponentFromString(
             theStringifiedNameComponents[i] );
     }
     return theNameComponents;
}
 
Example 16
Project: openjdk-jdk10   File: PersistentBindingIterator.java   View source code 6 votes vote down vote up
/**
* Returns the next binding in the NamingContext. Uses the enumeration
* object to determine if there are more bindings and if so, returns
* the next binding from the InternalBindingValue.
* @param b The Binding as an out parameter.
* @return true if there were more bindings.
*/
 final public boolean NextOne(org.omg.CosNaming.BindingHolder b)
 {
     // If there are more elements get the next element
     boolean hasMore = theEnumeration.hasMoreElements();
     if (hasMore) {
         InternalBindingKey theBindingKey =
              ((InternalBindingKey)theEnumeration.nextElement());
         InternalBindingValue theElement =
             (InternalBindingValue)theHashtable.get( theBindingKey );
         NameComponent n = new NameComponent( theBindingKey.id, theBindingKey.kind );
         NameComponent[] nlist = new NameComponent[1];
         nlist[0] = n;
         BindingType theType = theElement.theBindingType;

         b.value =
             new Binding( nlist, theType );
     } else {
         // Return empty but marshalable binding
         b.value = new Binding(new NameComponent[0],BindingType.nobject);
     }
     return hasMore;
 }
 
Example 17
Project: jdk8u_corba   File: InterOperableNamingImpl.java   View source code 6 votes vote down vote up
/**
  * Method which converts the Stringified name into Array of Name Components.
  *
  * @param string which is the stringified name.
  * @return  Array of Name Components (Simple or Compound Names)
  */
public org.omg.CosNaming.NameComponent[] convertToNameComponent(
    String theStringifiedName )
    throws org.omg.CosNaming.NamingContextPackage.InvalidName
{
     String[] theStringifiedNameComponents =
              breakStringToNameComponents( theStringifiedName );
     if( ( theStringifiedNameComponents == null )
      || (theStringifiedNameComponents.length == 0 ) )
     {
         return null;
     }
     NameComponent[] theNameComponents =
         new NameComponent[theStringifiedNameComponents.length];
     for( int i = 0; i < theStringifiedNameComponents.length; i++ ) {
         theNameComponents[i] = createNameComponentFromString(
             theStringifiedNameComponents[i] );
     }
     return theNameComponents;
}
 
Example 18
Project: openjdk9   File: NamingContextImpl.java   View source code 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
Project: openjdk9   File: NamingContextImpl.java   View source code 6 votes vote down vote up
/**
 * This operation resolves the Stringified name into the object
 * reference.
 * @param sn Stringified Name of the object
 * @exception org.omg.CosNaming.NamingContextPackage.NotFound
 * Indicates there is no object reference for the given name.
 * @exception org.omg.CosNaming.NamingContextPackage.CannotProceed
 * Indicates that the given compound name is incorrect
 * @exception org.omg.CosNaming.NamingContextExtPackage.InvalidName
 * Indicates the name does not identify a binding.
 * @exception org.omg.CosNaming.NamingContextPackage.AlreadyBound
 * Indicates the name is already bound.
 *
 */
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
Project: openjdk9   File: NamingContextImpl.java   View source code 6 votes vote down vote up
public static String nameToString(NameComponent[] name)
{
    StringBuffer s = new StringBuffer("{");
    if (name != null || name.length > 0) {
        for (int i=0;i<name.length;i++) {
            if (i>0)
                s.append(",");
            s.append("[").
                append(name[i].id).
                append(",").
                append(name[i].kind).
                append("]");
        }
    }
    s.append("}");
    return s.toString();
}
 
Example 21
Project: openjdk9   File: TransientNamingContext.java   View source code 6 votes vote down vote up
/**
 * Binds the object to the name component as the specified binding type.
 * It creates a InternalBindingKey object and a InternalBindingValue
 * object and inserts them in the hash table.
 * @param n A single org.omg.CosNaming::NameComponent under which the
 * object will be bound.
 * @param obj An object reference to be bound under the supplied name.
 * @param bt The type of the binding (i.e., as object or as context).
 * @exception org.omg.CORBA.SystemException One of a fixed set of CORBA
 * system exceptions.
 */
public final void Bind(NameComponent n, org.omg.CORBA.Object obj,
                       BindingType bt)
    throws org.omg.CORBA.SystemException
{
    // Create a key and a value
    InternalBindingKey key = new InternalBindingKey(n);
    NameComponent[] name = new NameComponent[1];
    name[0] = n;
    Binding b = new Binding(name,bt);
    InternalBindingValue value = new InternalBindingValue(b,null);
    value.theObjectRef = obj;
    // insert it
    InternalBindingValue oldValue =
        (InternalBindingValue)this.theHashtable.put(key,value);

    if (oldValue != null) {
        updateLogger.warning( LogKeywords.NAMING_BIND + "Name " +
            getName( n ) + " Was Already Bound" );
        throw wrapper.transNcBindAlreadyBound() ;
    }
    if( updateLogger.isLoggable( Level.FINE ) ) {
        updateLogger.fine( LogKeywords.NAMING_BIND_SUCCESS +
            "Name Component: " + n.id + "." + n.kind );
    }
}
 
Example 22
Project: openjdk9   File: TransientNamingContext.java   View source code 6 votes vote down vote up
/**
 * Deletes the binding with the supplied name. It creates a
 * InternalBindingKey and uses it to remove the value associated
 * with the key. If nothing is found an exception is thrown, otherwise
 * the element is removed from the hash table.
 * @param n a NameComponent which is the name to unbind
 * @return the object reference bound to the name, or null if not found.
 * @exception org.omg.CORBA.SystemException One of a fixed set of CORBA
 * system exceptions.
 */
public final org.omg.CORBA.Object Unbind(NameComponent n)
    throws org.omg.CORBA.SystemException
{
    // Create a key and remove it from the hashtable
    InternalBindingKey key = new InternalBindingKey(n);
    InternalBindingValue value =
        (InternalBindingValue)this.theHashtable.remove(key);

    // Return what was found
    if (value == null) {
        if( updateLogger.isLoggable( Level.FINE ) ) {
            updateLogger.fine( LogKeywords.NAMING_UNBIND_FAILURE +
                " There was no binding with the name " + getName( n ) +
                " to Unbind " );
        }
        return null;
    } else {
        if( updateLogger.isLoggable( Level.FINE ) ) {
            updateLogger.fine( LogKeywords.NAMING_UNBIND_SUCCESS +
                " NameComponent:  " + getName( n ) );
        }
        return value.theObjectRef;
   }
}
 
Example 23
Project: openjdk9   File: InterOperableNamingImpl.java   View source code 6 votes vote down vote up
/**
 * Method which stringifies the Name Components given as the input
 * parameter.
 *
 * @param n Array of Name Components (Simple or Compound Names)
 * @return string which is the stringified reference.
 */
public String convertToString( org.omg.CosNaming.NameComponent[]
                               theNameComponents )
{
    String theConvertedString =
        convertNameComponentToString( theNameComponents[0] );
    String temp;
    for( int i = 1; i < theNameComponents.length; i++ ) {
        temp = convertNameComponentToString( theNameComponents[i] );
        if( temp != null ) {
             theConvertedString =
             theConvertedString + "/" +  convertNameComponentToString(
                 theNameComponents[i] );
        }
    }
    return theConvertedString;
}
 
Example 24
Project: openjdk9   File: InterOperableNamingImpl.java   View source code 6 votes vote down vote up
/**
  * Method which converts the Stringified name into Array of Name Components.
  *
  * @param string which is the stringified name.
  * @return  Array of Name Components (Simple or Compound Names)
  */
public org.omg.CosNaming.NameComponent[] convertToNameComponent(
    String theStringifiedName )
    throws org.omg.CosNaming.NamingContextPackage.InvalidName
{
     String[] theStringifiedNameComponents =
              breakStringToNameComponents( theStringifiedName );
     if( ( theStringifiedNameComponents == null )
      || (theStringifiedNameComponents.length == 0 ) )
     {
         return null;
     }
     NameComponent[] theNameComponents =
         new NameComponent[theStringifiedNameComponents.length];
     for( int i = 0; i < theStringifiedNameComponents.length; i++ ) {
         theNameComponents[i] = createNameComponentFromString(
             theStringifiedNameComponents[i] );
     }
     return theNameComponents;
}
 
Example 25
Project: javify   File: PersistentContext.java   View source code 6 votes vote down vote up
/**
 * Create a new context and give it a given name (bound it) in the current
 * context. The method benefits from passing the better readable context name.
 *
 * @param a_name the name being given to the new context.
 * @return the newly created context.
 * @throws AlreadyBound if the name is already in use.
 * @throws InvalidName if the name has zero length or otherwise invalid.
 */
public NamingContext bind_new_context(NameComponent[] a_name)
    throws NotFound, AlreadyBound, CannotProceed, InvalidName
{
  if (named_contexts.containsKey(a_name[0])
      || named_objects.containsKey(a_name[0]))
    throw new AlreadyBound();

  NameTransformer transformer = new NameTransformer();

  File ctxFolder = new File(contextFolder,
                            transformer.toString(a_name).replace('/', '.')
                                + ".v" + getNum());

  NamingContext child = new PersistentContext(orb, ctxFolder, true);
  bind_context(a_name, child);
  return child;
}
 
Example 26
Project: openjdk9   File: PersistentBindingIterator.java   View source code 6 votes vote down vote up
/**
* Returns the next binding in the NamingContext. Uses the enumeration
* object to determine if there are more bindings and if so, returns
* the next binding from the InternalBindingValue.
* @param b The Binding as an out parameter.
* @return true if there were more bindings.
*/
 final public boolean NextOne(org.omg.CosNaming.BindingHolder b)
 {
     // If there are more elements get the next element
     boolean hasMore = theEnumeration.hasMoreElements();
     if (hasMore) {
         InternalBindingKey theBindingKey =
              ((InternalBindingKey)theEnumeration.nextElement());
         InternalBindingValue theElement =
             (InternalBindingValue)theHashtable.get( theBindingKey );
         NameComponent n = new NameComponent( theBindingKey.id, theBindingKey.kind );
         NameComponent[] nlist = new NameComponent[1];
         nlist[0] = n;
         BindingType theType = theElement.theBindingType;

         b.value =
             new Binding( nlist, theType );
     } else {
         // Return empty but marshalable binding
         b.value = new Binding(new NameComponent[0],BindingType.nobject);
     }
     return hasMore;
 }
 
Example 27
Project: jdk8u_corba   File: PersistentBindingIterator.java   View source code 6 votes vote down vote up
/**
* Returns the next binding in the NamingContext. Uses the enumeration
* object to determine if there are more bindings and if so, returns
* the next binding from the InternalBindingValue.
* @param b The Binding as an out parameter.
* @return true if there were more bindings.
*/
 final public boolean NextOne(org.omg.CosNaming.BindingHolder b)
 {
     // If there are more elements get the next element
     boolean hasMore = theEnumeration.hasMoreElements();
     if (hasMore) {
         InternalBindingKey theBindingKey =
              ((InternalBindingKey)theEnumeration.nextElement());
         InternalBindingValue theElement =
             (InternalBindingValue)theHashtable.get( theBindingKey );
         NameComponent n = new NameComponent( theBindingKey.id, theBindingKey.kind );
         NameComponent[] nlist = new NameComponent[1];
         nlist[0] = n;
         BindingType theType = theElement.theBindingType;

         b.value =
             new Binding( nlist, theType );
     } else {
         // Return empty but marshalable binding
         b.value = new Binding(new NameComponent[0],BindingType.nobject);
     }
     return hasMore;
 }
 
Example 28
Project: jdk8u_corba   File: InterOperableNamingImpl.java   View source code 6 votes vote down vote up
/**
 * Method which stringifies the Name Components given as the input
 * parameter.
 *
 * @param n Array of Name Components (Simple or Compound Names)
 * @return string which is the stringified reference.
 */
public String convertToString( org.omg.CosNaming.NameComponent[]
                               theNameComponents )
{
    String theConvertedString =
        convertNameComponentToString( theNameComponents[0] );
    String temp;
    for( int i = 1; i < theNameComponents.length; i++ ) {
        temp = convertNameComponentToString( theNameComponents[i] );
        if( temp != null ) {
             theConvertedString =
             theConvertedString + "/" +  convertNameComponentToString(
                 theNameComponents[i] );
        }
    }
    return theConvertedString;
}
 
Example 29
Project: javify   File: NameTransformer.java   View source code 6 votes vote down vote up
/**
 * Converts the name into its string representation, as defined in
 * the specification CORBA naming service.
 *
 * A string representation for the name consists of the name components,
 * separated by a slash '/' character (for example, 'a/b/c'). If the
 * {@link NameComponent#kind} field is  not empty, it is given after
 * period ('.'), for example 'a.b/c.d/.' .
 * The period alone represents node where part where both
 * {@link NameComponent#kind} and {@link NameComponent#id} are empty strings.
 *
 * If slash or dot are part of the name, they are escaped by backslash ('\').
 * If the backslash itself is part of the name, it is doubled.
 *
 * @param a_name a name to convert.
 * @return a string representation.
 */
public String toString(NameComponent[] a_name)
                throws InvalidName
{
  NameValidator.check(a_name);

  CPStringBuilder b = new CPStringBuilder();

  NameComponent n;

  for (int ni = 0; ni < a_name.length; ni++)
    {
      n = a_name [ ni ];
      appEscaping(b, n.id);
      if (n.kind.length() > 0)
        {
          b.append('.');
          appEscaping(b, n.kind);
        }

      if (ni < a_name.length - 1)
        b.append('/');
    }
  return b.toString();
}
 
Example 30
Project: lookaside_java-1.8.0-openjdk   File: NamingContextImpl.java   View source code 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 31
Project: lookaside_java-1.8.0-openjdk   File: NamingContextImpl.java   View source code 6 votes vote down vote up
public static String nameToString(NameComponent[] name)
{
    StringBuffer s = new StringBuffer("{");
    if (name != null || name.length > 0) {
        for (int i=0;i<name.length;i++) {
            if (i>0)
                s.append(",");
            s.append("[").
                append(name[i].id).
                append(",").
                append(name[i].kind).
                append("]");
        }
    }
    s.append("}");
    return s.toString();
}
 
Example 32
Project: lookaside_java-1.8.0-openjdk   File: TransientNamingContext.java   View source code 6 votes vote down vote up
/**
 * Binds the object to the name component as the specified binding type.
 * It creates a InternalBindingKey object and a InternalBindingValue
 * object and inserts them in the hash table.
 * @param n A single org.omg.CosNaming::NameComponent under which the
 * object will be bound.
 * @param obj An object reference to be bound under the supplied name.
 * @param bt The type of the binding (i.e., as object or as context).
 * @exception org.omg.CORBA.SystemException One of a fixed set of CORBA
 * system exceptions.
 */
public final void Bind(NameComponent n, org.omg.CORBA.Object obj,
                       BindingType bt)
    throws org.omg.CORBA.SystemException
{
    // Create a key and a value
    InternalBindingKey key = new InternalBindingKey(n);
    NameComponent[] name = new NameComponent[1];
    name[0] = n;
    Binding b = new Binding(name,bt);
    InternalBindingValue value = new InternalBindingValue(b,null);
    value.theObjectRef = obj;
    // insert it
    InternalBindingValue oldValue =
        (InternalBindingValue)this.theHashtable.put(key,value);

    if (oldValue != null) {
        updateLogger.warning( LogKeywords.NAMING_BIND + "Name " +
            getName( n ) + " Was Already Bound" );
        throw wrapper.transNcBindAlreadyBound() ;
    }
    if( updateLogger.isLoggable( Level.FINE ) ) {
        updateLogger.fine( LogKeywords.NAMING_BIND_SUCCESS +
            "Name Component: " + n.id + "." + n.kind );
    }
}
 
Example 33
Project: lookaside_java-1.8.0-openjdk   File: TransientNamingContext.java   View source code 6 votes vote down vote up
/**
 * Deletes the binding with the supplied name. It creates a
 * InternalBindingKey and uses it to remove the value associated
 * with the key. If nothing is found an exception is thrown, otherwise
 * the element is removed from the hash table.
 * @param n a NameComponent which is the name to unbind
 * @return the object reference bound to the name, or null if not found.
 * @exception org.omg.CORBA.SystemException One of a fixed set of CORBA
 * system exceptions.
 */
public final org.omg.CORBA.Object Unbind(NameComponent n)
    throws org.omg.CORBA.SystemException
{
    // Create a key and remove it from the hashtable
    InternalBindingKey key = new InternalBindingKey(n);
    InternalBindingValue value =
        (InternalBindingValue)this.theHashtable.remove(key);

    // Return what was found
    if (value == null) {
        if( updateLogger.isLoggable( Level.FINE ) ) {
            updateLogger.fine( LogKeywords.NAMING_UNBIND_FAILURE +
                " There was no binding with the name " + getName( n ) +
                " to Unbind " );
        }
        return null;
    } else {
        if( updateLogger.isLoggable( Level.FINE ) ) {
            updateLogger.fine( LogKeywords.NAMING_UNBIND_SUCCESS +
                " NameComponent:  " + getName( n ) );
        }
        return value.theObjectRef;
   }
}
 
Example 34
Project: lookaside_java-1.8.0-openjdk   File: InterOperableNamingImpl.java   View source code 6 votes vote down vote up
/**
  * Method which converts the Stringified name into Array of Name Components.
  *
  * @param string which is the stringified name.
  * @return  Array of Name Components (Simple or Compound Names)
  */
public org.omg.CosNaming.NameComponent[] convertToNameComponent(
    String theStringifiedName )
    throws org.omg.CosNaming.NamingContextPackage.InvalidName
{
     String[] theStringifiedNameComponents =
              breakStringToNameComponents( theStringifiedName );
     if( ( theStringifiedNameComponents == null )
      || (theStringifiedNameComponents.length == 0 ) )
     {
         return null;
     }
     NameComponent[] theNameComponents =
         new NameComponent[theStringifiedNameComponents.length];
     for( int i = 0; i < theStringifiedNameComponents.length; i++ ) {
         theNameComponents[i] = createNameComponentFromString(
             theStringifiedNameComponents[i] );
     }
     return theNameComponents;
}
 
Example 35
Project: jdk8u_corba   File: TransientNamingContext.java   View source code 6 votes vote down vote up
/**
 * Deletes the binding with the supplied name. It creates a
 * InternalBindingKey and uses it to remove the value associated
 * with the key. If nothing is found an exception is thrown, otherwise
 * the element is removed from the hash table.
 * @param n a NameComponent which is the name to unbind
 * @return the object reference bound to the name, or null if not found.
 * @exception org.omg.CORBA.SystemException One of a fixed set of CORBA
 * system exceptions.
 */
public final org.omg.CORBA.Object Unbind(NameComponent n)
    throws org.omg.CORBA.SystemException
{
    // Create a key and remove it from the hashtable
    InternalBindingKey key = new InternalBindingKey(n);
    InternalBindingValue value =
        (InternalBindingValue)this.theHashtable.remove(key);

    // Return what was found
    if (value == null) {
        if( updateLogger.isLoggable( Level.FINE ) ) {
            updateLogger.fine( LogKeywords.NAMING_UNBIND_FAILURE +
                " There was no binding with the name " + getName( n ) +
                " to Unbind " );
        }
        return null;
    } else {
        if( updateLogger.isLoggable( Level.FINE ) ) {
            updateLogger.fine( LogKeywords.NAMING_UNBIND_SUCCESS +
                " NameComponent:  " + getName( n ) );
        }
        return value.theObjectRef;
   }
}
 
Example 36
Project: lookaside_java-1.8.0-openjdk   File: PersistentBindingIterator.java   View source code 6 votes vote down vote up
/**
* Returns the next binding in the NamingContext. Uses the enumeration
* object to determine if there are more bindings and if so, returns
* the next binding from the InternalBindingValue.
* @param b The Binding as an out parameter.
* @return true if there were more bindings.
*/
 final public boolean NextOne(org.omg.CosNaming.BindingHolder b)
 {
     // If there are more elements get the next element
     boolean hasMore = theEnumeration.hasMoreElements();
     if (hasMore) {
         InternalBindingKey theBindingKey =
              ((InternalBindingKey)theEnumeration.nextElement());
         InternalBindingValue theElement =
             (InternalBindingValue)theHashtable.get( theBindingKey );
         NameComponent n = new NameComponent( theBindingKey.id, theBindingKey.kind );
         NameComponent[] nlist = new NameComponent[1];
         nlist[0] = n;
         BindingType theType = theElement.theBindingType;

         b.value =
             new Binding( nlist, theType );
     } else {
         // Return empty but marshalable binding
         b.value = new Binding(new NameComponent[0],BindingType.nobject);
     }
     return hasMore;
 }
 
Example 37
Project: javify   File: NameValidator.java   View source code 6 votes vote down vote up
/**
 * Check the given name. This method must be package level, as it is
 * not defined in the API.
 *
 * @param name the name to check.
 *
 * @throws InvalidName if the given name is not valid.
 */
public static void check(NameComponent[] name)
           throws InvalidName
{
  if (name == null)
    throw new InvalidName("name=null");

  if (name.length == 0)
    throw new InvalidName("name.length=0");

  for (int i = 0; i < name.length; i++)
    {
      if (name [ i ] == null)
        throw new InvalidName("name[" + i + "]=null");
      if (name [ i ].id == null)
        throw new InvalidName("name[" + i + "].id=null");
      if (name [ i ].kind == null)
        throw new InvalidName("name[" + i + "].kind=null");
    }
}
 
Example 38
Project: jdk8u_corba   File: NamingContextImpl.java   View source code 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 39
Project: OpenJSharp   File: NamingContextImpl.java   View source code 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 40
Project: OpenJSharp   File: NamingContextImpl.java   View source code 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 ) );
    }
}