本文整理汇总了Java中org.omg.CosNaming.NamingContextHelper类的典型用法代码示例。如果您正苦于以下问题:Java NamingContextHelper类的具体用法?Java NamingContextHelper怎么用?Java NamingContextHelper使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
NamingContextHelper类属于org.omg.CosNaming包,在下文中一共展示了NamingContextHelper类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: listBindings
import org.omg.CosNaming.NamingContextHelper; //导入依赖的package包/类
/**
* Creates and returns the enumeration over the name - object bindings that
* are present the given subcontext. The enumeration elements have the type of
* {@link Binding}, providing also information about the class of the bound
* object. The behaviour in the case if the bindings are added or removed
* later is not defined. The contents of the subcontexts are not included.
*
* @param name
* the name of the subcontext
* @return the enumeration over the names, known for the given subcontext.
* @throws NamingException
*/
public NamingEnumeration listBindings(Name name) throws NamingException
{
BindingIteratorHolder bi = new BindingIteratorHolder();
BindingListHolder bl = new BindingListHolder();
NamingContext subcontext;
if (name.size() == 0)
subcontext = service;
else
{
try
{
subcontext = (NamingContextHelper.narrow(service.resolve(toGiop(name))));
}
catch (Exception e)
{
throw new NamingException(e.toString());
}
}
subcontext.list(howMany, bl, bi);
return new ListBindingsEnumeration(bl, bi, howMany, subcontext);
}
示例2: listBindings
import org.omg.CosNaming.NamingContextHelper; //导入依赖的package包/类
/**
* Creates and returns the enumeration over the name - object bindings that
* are present the given subcontext. The enumeration elements have the type of
* {@link Binding}, providing also information about the class of the bound
* object. The behaviour in the case if the bindings are added or removed
* later is not defined. The contents of the subcontexts are not included.
*
* @param name
* the name of the subcontext
* @return the enumeration over the names, known for the given subcontext.
* @throws NamingException
*/
public NamingEnumeration listBindings(Name name) throws NamingException
{
BindingIteratorHolder bi = new BindingIteratorHolder();
BindingListHolder bl = new BindingListHolder();
NamingContext subcontext;
if (name.size() == 0)
subcontext = service;
else
{
try
{
subcontext = (NamingContextHelper.narrow(service.resolve(toGiop(name))));
}
catch (Exception e)
{
throw new NamingException(e.toString());
}
}
subcontext.list(howMany, bl, bi);
return new ListBindingsEnumeration(bl, bi, howMany, subcontext);
}
示例3: connect
import org.omg.CosNaming.NamingContextHelper; //导入依赖的package包/类
/**
* Connect to the RMI server
*
* @throws RemoteException
*/
public void connect() {
try {
// ghetto hardcode the parameters
ORB orb = ORB.init(new String[]{"-ORBInitialHost", "localhost", "-ORBInitialPort", "8989"}, null);
org.omg.CORBA.Object objRef = orb.resolve_initial_references("NameService");
NamingContext ncRef = NamingContextHelper.narrow(objRef);
NameComponent nc = new NameComponent(station, "");
NameComponent path[] = {nc};
instance = StationInterfaceHelper.narrow(ncRef.resolve(path));
this.log.log("Connected!");
} catch (Exception ex) {
log.log(ex.toString() + ex.getMessage());
}
}
示例4: resolveFirstAsContext
import org.omg.CosNaming.NamingContextHelper; //导入依赖的package包/类
/**
* Implements resolving a NameComponent in this context and
* narrowing it to CosNaming::NamingContext. It will throw appropriate
* exceptions if not found or not narrowable.
* @param impl an implementation of NamingContextDataStore
* @param n a NameComponents which is the name to be found.
* @exception org.omg.CosNaming.NamingContextPackage.NotFound The
* first component could not be resolved.
* @exception org.omg.CosNaming.NamingContextPackage.CannotProceed Could not proceed
* in resolving the first component of the supplied name.
* @exception org.omg.CORBA.SystemException One of a fixed set of CORBA system exceptions.
* @see resolve
*/
protected static NamingContext resolveFirstAsContext(NamingContextDataStore impl,
NameComponent[] n)
throws org.omg.CosNaming.NamingContextPackage.NotFound {
org.omg.CORBA.Object topRef = null;
BindingTypeHolder bth = new BindingTypeHolder();
NamingContext context = null;
synchronized (impl) {
// Resolve first - must be resolveable
topRef = impl.Resolve(n[0],bth);
if (topRef == null) {
// It was not bound
throw new NotFound(NotFoundReason.missing_node,n);
}
}
// Was it bound as a context?
if (bth.value != BindingType.ncontext) {
// It was not a context
throw new NotFound(NotFoundReason.not_context,n);
}
// Narrow to a naming context
try {
context = NamingContextHelper.narrow(topRef);
} catch (org.omg.CORBA.BAD_PARAM ex) {
// It was not a context
throw new NotFound(NotFoundReason.not_context,n);
}
// Hmm. must be ok
return context;
}
示例5: getObjectReferenceFromKey
import org.omg.CosNaming.NamingContextHelper; //导入依赖的package包/类
/**
* getObjectReferenceFromKey returns the Object reference from the objectkey using POA.create_reference_with_id method
* @param Object Key as String
* @returns reference an CORBA.Object.
*/
org.omg.CORBA.Object getObjectReferenceFromKey( String key )
{
org.omg.CORBA.Object theObject = null;
try
{
theObject = nsPOA.create_reference_with_id( key.getBytes( ), NamingContextHelper.id( ) );
}
catch (Exception e )
{
theObject = null;
}
return theObject;
}
示例6: getObjectReferenceFromKey
import org.omg.CosNaming.NamingContextHelper; //导入依赖的package包/类
/**
* getObjectReferenceFromKey returns the Object reference from the objectkey using POA.create_reference_with_id method
* @param Object Key as String
* @return a CORBA.Object reference.
*/
org.omg.CORBA.Object getObjectReferenceFromKey( String key )
{
org.omg.CORBA.Object theObject = null;
try
{
theObject = nsPOA.create_reference_with_id( key.getBytes( ), NamingContextHelper.id( ) );
}
catch (Exception e )
{
theObject = null;
}
return theObject;
}
示例7: read
import org.omg.CosNaming.NamingContextHelper; //导入依赖的package包/类
/**
* Read the exception from the given CDR stream.
*/
public static CannotProceed read(InputStream istream)
{
CannotProceed value = new CannotProceed();
// read and discard the repository ID
istream.read_string();
value.cxt = NamingContextHelper.read(istream);
value.rest_of_name = NameHelper.read(istream);
return value;
}
示例8: type
import org.omg.CosNaming.NamingContextHelper; //导入依赖的package包/类
/**
* Create the type code for this exception.
*/
public static TypeCode type()
{
ORB orb = OrbRestricted.Singleton;
StructMember[] members = new StructMember[ 2 ];
TypeCode member;
member = NamingContextHelper.type();
members [ 0 ] = new StructMember("cxt", member, null);
member = NameComponentHelper.type();
member = orb.create_sequence_tc(0, member);
member = orb.create_alias_tc(NameHelper.id(), "Name", member);
members [ 1 ] = new StructMember("rest_of_name", member, null);
return orb.create_struct_tc(id(), "CannotProceed", members);
}
示例9: write
import org.omg.CosNaming.NamingContextHelper; //导入依赖的package包/类
/**
* Write the exception to the CDR output stream.
*/
public static void write(OutputStream ostream, CannotProceed value)
{
// write the repository ID
ostream.write_string(id());
NamingContextHelper.write(ostream, value.cxt);
NameHelper.write(ostream, value.rest_of_name);
}
示例10: list
import org.omg.CosNaming.NamingContextHelper; //导入依赖的package包/类
/**
* Creates and returns the enumeration over the name bindings that are present
* the given subcontext. The enumeration elements have the type of
* {@link NameClassPair}, providing also information about the class of the
* bound object. The behaviour in the case if the bindings are added or
* removed later is not defined. The contents of the subcontexts are not
* included.
*
* @param name
* the name of the subcontext
* @return the enumeration over the names, known for the given subcontext.
* @throws NamingException
*/
public NamingEnumeration list(Name name) throws NamingException
{
BindingIteratorHolder bi = new BindingIteratorHolder();
BindingListHolder bl = new BindingListHolder();
NamingContext subcontext;
if (name.size() == 0)
subcontext = service;
else
{
try
{
subcontext = (NamingContextHelper.narrow(service.resolve(toGiop(name))));
}
catch (Exception e)
{
throw new NamingException(e.toString());
}
}
subcontext.list(howMany, bl, bi);
return new ListEnumeration(bl, bi, howMany);
}
示例11: list
import org.omg.CosNaming.NamingContextHelper; //导入依赖的package包/类
/**
* Creates and returns the enumeration over the name bindings that are present
* the given subcontext. The enumeration elements have the type of
* {@link NameClassPair}, providing also information about the class of the
* bound object. The behaviour in the case if the bindings are added or
* removed later is not defined. The contents of the subcontexts are not
* included.
*
* @param name
* the name of the subcontext
* @return the enumeration over the names, known for the given subcontext.
* @throws NamingException
*/
public NamingEnumeration list(String name) throws NamingException
{
BindingIteratorHolder bi = new BindingIteratorHolder();
BindingListHolder bl = new BindingListHolder();
NamingContext subcontext;
String [] n = split(name);
NamingContextExt service = getService(n[0]);
if (n[1].length() == 0)
subcontext = service;
else
{
try
{
subcontext = (NamingContextHelper.narrow(service.resolve_str(n[1])));
}
catch (Exception e)
{
throw new NamingException(e.toString());
}
}
subcontext.list(howMany, bl, bi);
return new ListEnumeration(bl, bi, howMany);
}
示例12: listBindings
import org.omg.CosNaming.NamingContextHelper; //导入依赖的package包/类
/**
* Creates and returns the enumeration over the name - object bindings that
* are present the given subcontext. The enumeration elements have the type of
* {@link Binding}, providing also information about the class of the bound
* object. The behaviour in the case if the bindings are added or removed
* later is not defined. The contents of the subcontexts are not included.
*
* @param name
* the name of the subcontext
* @return the enumeration over the names, known for the given subcontext.
* @throws NamingException
*/
public NamingEnumeration listBindings(String name) throws NamingException
{
BindingIteratorHolder bi = new BindingIteratorHolder();
BindingListHolder bl = new BindingListHolder();
NamingContext subcontext;
String [] n = split(name);
NamingContextExt service = getService(n[0]);
if (n[1].length() == 0)
subcontext = service;
else
{
try
{
subcontext = (NamingContextHelper.narrow(service.resolve_str(n[1])));
}
catch (Exception e)
{
throw new NamingException(e.toString());
}
}
subcontext.list(howMany, bl, bi);
return new ListBindingsEnumeration(bl, bi, howMany, subcontext);
}
示例13: type
import org.omg.CosNaming.NamingContextHelper; //导入依赖的package包/类
/**
* Create the type code for this exception.
*/
public static TypeCode type()
{
ORB orb = OrbRestricted.Singleton;
StructMember[] members = new StructMember[ 2 ];
TypeCode member;
member = NamingContextHelper.type();
members [ 0 ] = new StructMember("cxt", member, null);
member = NameComponentHelper.type();
member = orb.create_sequence_tc(0, member);
member = orb.create_alias_tc(NameHelper.id(), "Name", member);
members [ 1 ] = new StructMember("rest_of_name", member, null);
return orb.create_struct_tc(id(), "CannotProceed", members);
}
示例14: list
import org.omg.CosNaming.NamingContextHelper; //导入依赖的package包/类
/**
* Creates and returns the enumeration over the name bindings that are present
* the given subcontext. The enumeration elements have the type of
* {@link NameClassPair}, providing also information about the class of the
* bound object. The behaviour in the case if the bindings are added or
* removed later is not defined. The contents of the subcontexts are not
* included.
*
* @param name
* the name of the subcontext
* @return the enumeration over the names, known for the given subcontext.
* @throws NamingException
*/
public NamingEnumeration list(Name name) throws NamingException
{
BindingIteratorHolder bi = new BindingIteratorHolder();
BindingListHolder bl = new BindingListHolder();
NamingContext subcontext;
if (name.size() == 0)
subcontext = service;
else
{
try
{
subcontext = (NamingContextHelper.narrow(service.resolve(toGiop(name))));
}
catch (Exception e)
{
throw new NamingException(e.toString());
}
}
subcontext.list(howMany, bl, bi);
return new ListEnumeration(bl, bi, howMany);
}
示例15: list
import org.omg.CosNaming.NamingContextHelper; //导入依赖的package包/类
/**
* Creates and returns the enumeration over the name bindings that are present
* the given subcontext. The enumeration elements have the type of
* {@link NameClassPair}, providing also information about the class of the
* bound object. The behaviour in the case if the bindings are added or
* removed later is not defined. The contents of the subcontexts are not
* included.
*
* @param name
* the name of the subcontext
* @return the enumeration over the names, known for the given subcontext.
* @throws NamingException
*/
public NamingEnumeration list(String name) throws NamingException
{
BindingIteratorHolder bi = new BindingIteratorHolder();
BindingListHolder bl = new BindingListHolder();
NamingContext subcontext;
String [] n = split(name);
NamingContextExt service = getService(n[0]);
if (n[1].length() == 0)
subcontext = service;
else
{
try
{
subcontext = (NamingContextHelper.narrow(service.resolve_str(n[1])));
}
catch (Exception e)
{
throw new NamingException(e.toString());
}
}
subcontext.list(howMany, bl, bi);
return new ListEnumeration(bl, bi, howMany);
}