org.omg.CosNaming.NameComponent Java Examples
The following examples show how to use
org.omg.CosNaming.NameComponent.
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 TencentKona-8 with GNU General Public License v2.0 | 6 votes |
/** * 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 #2
Source File: PersistentBindingIterator.java From TencentKona-8 with GNU General Public License v2.0 | 6 votes |
/** * 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 #3
Source File: NamingContextImpl.java From openjdk-jdk8u with GNU General Public License v2.0 | 6 votes |
/** * 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 #4
Source File: TransientNamingContext.java From openjdk-jdk8u with GNU General Public License v2.0 | 6 votes |
/** * 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
Source File: InterOperableNamingImpl.java From jdk1.8-source-analysis with Apache License 2.0 | 6 votes |
/** * 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 #6
Source File: NamingContextImpl.java From jdk8u60 with GNU General Public License v2.0 | 6 votes |
/** * 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 #7
Source File: PersistentBindingIterator.java From jdk8u60 with GNU General Public License v2.0 | 6 votes |
/** * 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 #8
Source File: NamingContextImpl.java From JDKSourceCode1.8 with MIT License | 6 votes |
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 #9
Source File: TransientNamingContext.java From JDKSourceCode1.8 with MIT License | 6 votes |
/** * 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 #10
Source File: NamingContextImpl.java From jdk1.8-source-analysis with Apache License 2.0 | 6 votes |
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 #11
Source File: TransientNamingContext.java From TencentKona-8 with GNU General Public License v2.0 | 6 votes |
/** * 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 #12
Source File: TransientNamingContext.java From TencentKona-8 with GNU General Public License v2.0 | 6 votes |
/** * 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
Source File: NamingContextImpl.java From jdk1.8-source-analysis with Apache License 2.0 | 6 votes |
/** * 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 #14
Source File: PersistentBindingIterator.java From JDKSourceCode1.8 with MIT License | 6 votes |
/** * 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 #15
Source File: InterOperableNamingImpl.java From JDKSourceCode1.8 with MIT License | 6 votes |
/** * 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
Source File: TransientNamingContext.java From jdk8u60 with GNU General Public License v2.0 | 6 votes |
/** * 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 #17
Source File: NamingContextImpl.java From JDKSourceCode1.8 with MIT License | 6 votes |
/** * 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 #18
Source File: CNNameParser.java From dragonwell8_jdk with GNU General Public License v2.0 | 5 votes |
/** * Returns the INS stringified form of a NameComponent[]. * Used by CNCtx.getNameInNamespace(), CNCompoundName.toString(). */ static String cosNameToInsString(NameComponent[] cname) { StringBuffer str = new StringBuffer(); for ( int i = 0; i < cname.length; i++) { if ( i > 0) { str.append(compSeparator); } str.append(stringifyComponent(cname[i])); } return str.toString(); }
Example #19
Source File: CNNameParser.java From jdk8u60 with GNU General Public License v2.0 | 5 votes |
private static String stringifyComponent(NameComponent comp) { StringBuffer one = new StringBuffer(escape(comp.id)); if (comp.kind != null && !comp.kind.equals("")) { one.append(kindSeparator + escape(comp.kind)); } if (one.length() == 0) { return ""+kindSeparator; // if neither id nor kind specified } else { return one.toString(); } }
Example #20
Source File: NamingContextImpl.java From jdk1.8-source-analysis with Apache License 2.0 | 5 votes |
/** * This operation converts a Stringified Name into an equivalent array * of Name Components. * @param sn Stringified Name of the object <p> * @exception org.omg.CosNaming.NamingContextExtPackage.InvalidName * Indicates the name does not identify a binding.<p> * */ public org.omg.CosNaming.NameComponent[] to_name(String sn) throws org.omg.CosNaming.NamingContextPackage.InvalidName { // 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(); } for( int i = 0; i < theNameComponents.length; i++ ) { // If there is a name component whose id and kind null or // zero length string, then an invalid name exception needs to be // raised. if ( ( ( theNameComponents[i].id == null ) ||( theNameComponents[i].id.length() == 0 ) ) &&( ( theNameComponents[i].kind == null ) ||( theNameComponents[i].kind.length() == 0 ) ) ) { throw new InvalidName(); } } return theNameComponents; }
Example #21
Source File: CNNameParser.java From jdk8u60 with GNU General Public License v2.0 | 5 votes |
/** * Creates a CompositeName from a NameComponent[]. * Used by ExceptionMapper and CNBindingEnumeration to convert * a NameComponent[] into a composite name. */ static Name cosNameToName(NameComponent[] cname) { Name nm = new CompositeName(); for ( int i = 0; cname != null && i < cname.length; i++) { try { nm.add(stringifyComponent(cname[i])); } catch (InvalidNameException e) { // ignore } } return nm; }
Example #22
Source File: NamingContextImpl.java From TencentKona-8 with GNU General Public License v2.0 | 5 votes |
/** * This operation converts a Stringified Name into an equivalent array * of Name Components. * @param sn Stringified Name of the object <p> * @exception org.omg.CosNaming.NamingContextExtPackage.InvalidName * Indicates the name does not identify a binding.<p> * */ public org.omg.CosNaming.NameComponent[] to_name(String sn) throws org.omg.CosNaming.NamingContextPackage.InvalidName { // 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(); } for( int i = 0; i < theNameComponents.length; i++ ) { // If there is a name component whose id and kind null or // zero length string, then an invalid name exception needs to be // raised. if ( ( ( theNameComponents[i].id == null ) ||( theNameComponents[i].id.length() == 0 ) ) &&( ( theNameComponents[i].kind == null ) ||( theNameComponents[i].kind.length() == 0 ) ) ) { throw new InvalidName(); } } return theNameComponents; }
Example #23
Source File: TransientBindingIterator.java From jdk8u60 with GNU General Public License v2.0 | 5 votes |
/** * 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) { b.value = ((InternalBindingValue)theEnumeration.nextElement()).theBinding; currentSize--; } else { // Return empty but marshalable binding b.value = new Binding(new NameComponent[0],BindingType.nobject); } return hasMore; }
Example #24
Source File: NamingContextImpl.java From openjdk-jdk8u with GNU General Public License v2.0 | 5 votes |
/** * 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 #25
Source File: NamingUtils.java From TencentKona-8 with GNU General Public License v2.0 | 5 votes |
/** * A utility method that takes Array of NameComponent and converts * into a directory structured name in the format of /id1.kind1/id2.kind2.. * This is used mainly for Logging. */ static String getDirectoryStructuredName( NameComponent[] name ) { StringBuffer directoryStructuredName = new StringBuffer("/"); for( int i = 0; i < name.length; i++ ) { directoryStructuredName.append( name[i].id + "." + name[i].kind ); } return directoryStructuredName.toString( ); }
Example #26
Source File: NamingContextImpl.java From TencentKona-8 with GNU General Public License v2.0 | 5 votes |
/** * 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 |
/** * 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 #28
Source File: NamingUtils.java From JDKSourceCode1.8 with MIT License | 5 votes |
/** * A utility method that takes Array of NameComponent and converts * into a directory structured name in the format of /id1.kind1/id2.kind2.. * This is used mainly for Logging. */ static String getDirectoryStructuredName( NameComponent[] name ) { StringBuffer directoryStructuredName = new StringBuffer("/"); for( int i = 0; i < name.length; i++ ) { directoryStructuredName.append( name[i].id + "." + name[i].kind ); } return directoryStructuredName.toString( ); }
Example #29
Source File: InternalBindingKey.java From TencentKona-8 with GNU General Public License v2.0 | 5 votes |
protected void setup(NameComponent n) { this.name = n; // Precompute lengths and values since they will not change if( this.name.id != null ) { idLen = this.name.id.length(); } if( this.name.kind != null ) { kindLen = this.name.kind.length(); } hashVal = 0; if (idLen > 0) hashVal += this.name.id.hashCode(); if (kindLen > 0) hashVal += this.name.kind.hashCode(); }
Example #30
Source File: TransientBindingIterator.java From TencentKona-8 with GNU General Public License v2.0 | 5 votes |
/** * 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) { b.value = ((InternalBindingValue)theEnumeration.nextElement()).theBinding; currentSize--; } else { // Return empty but marshalable binding b.value = new Binding(new NameComponent[0],BindingType.nobject); } return hasMore; }