本文整理汇总了Java中org.omg.CosNaming.NameComponent类的典型用法代码示例。如果您正苦于以下问题:Java NameComponent类的具体用法?Java NameComponent怎么用?Java NameComponent使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
NameComponent类属于org.omg.CosNaming包,在下文中一共展示了NameComponent类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: to_string
import org.omg.CosNaming.NameComponent; //导入依赖的package包/类
/**
* 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;
}
示例2: resolve_str
import org.omg.CosNaming.NameComponent; //导入依赖的package包/类
/**
* 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;
}
示例3: nameToString
import org.omg.CosNaming.NameComponent; //导入依赖的package包/类
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();
}
示例4: Bind
import org.omg.CosNaming.NameComponent; //导入依赖的package包/类
/**
* 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 );
}
}
示例5: Unbind
import org.omg.CosNaming.NameComponent; //导入依赖的package包/类
/**
* 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;
}
}
示例6: convertToString
import org.omg.CosNaming.NameComponent; //导入依赖的package包/类
/**
* 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;
}
示例7: convertToNameComponent
import org.omg.CosNaming.NameComponent; //导入依赖的package包/类
/**
* 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;
}
示例8: NextOne
import org.omg.CosNaming.NameComponent; //导入依赖的package包/类
/**
* 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;
}
示例9: to_string
import org.omg.CosNaming.NameComponent; //导入依赖的package包/类
/**
* 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;
}
示例10: resolve_str
import org.omg.CosNaming.NameComponent; //导入依赖的package包/类
/**
* 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;
}
示例11: bind_new_context
import org.omg.CosNaming.NameComponent; //导入依赖的package包/类
/**
* 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;
}
示例12: toString
import org.omg.CosNaming.NameComponent; //导入依赖的package包/类
/**
* 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();
}
示例13: check
import org.omg.CosNaming.NameComponent; //导入依赖的package包/类
/**
* 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");
}
}
示例14: rebind
import org.omg.CosNaming.NameComponent; //导入依赖的package包/类
/**
* 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 ) );
}
}
示例15: rebind_context
import org.omg.CosNaming.NameComponent; //导入依赖的package包/类
/**
* 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 ) );
}
}