本文整理汇总了Java中org.omg.CosNaming.NamingContextExtHelper类的典型用法代码示例。如果您正苦于以下问题:Java NamingContextExtHelper类的具体用法?Java NamingContextExtHelper怎么用?Java NamingContextExtHelper使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
NamingContextExtHelper类属于org.omg.CosNaming包,在下文中一共展示了NamingContextExtHelper类的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getDefaultNameService
import org.omg.CosNaming.NamingContextExtHelper; //导入依赖的package包/类
/**
* Get the default naming service for the case when there no NameService
* entries.
*/
protected org.omg.CORBA.Object getDefaultNameService()
{
if (initial_references.containsKey(NAME_SERVICE))
return (org.omg.CORBA.Object) initial_references.get(NAME_SERVICE);
IOR ior = new IOR();
ior.Id = NamingContextExtHelper.id();
ior.Internet.host = ns_host;
ior.Internet.port = ns_port;
ior.key = NamingServiceTransient.getDefaultKey();
IorObject iorc = new IorObject(this, ior);
NamingContextExt namer = NamingContextExtHelper.narrow(iorc);
initial_references.put(NAME_SERVICE, namer);
return namer;
}
示例2: resolveCorbaname
import org.omg.CosNaming.NamingContextExtHelper; //导入依赖的package包/类
/**
* resolves a corbaname: url that is encapsulated in a CorbanameURL object.
*
* @return the CORBA.Object if resolution is successful
*/
private org.omg.CORBA.Object resolveCorbaname( CorbanameURL theCorbaName ) {
org.omg.CORBA.Object result = null;
try {
NamingContextExt theNamingContext = null;
if( theCorbaName.getRIRFlag( ) ) {
// Case 1 of corbaname: rir#
theNamingContext = getDefaultRootNamingContext( );
} else {
// Case 2 of corbaname: ::hostname#
org.omg.CORBA.Object corbalocResult =
getIORUsingCorbaloc( theCorbaName );
if( corbalocResult == null ) {
return null;
}
theNamingContext =
NamingContextExtHelper.narrow( corbalocResult );
}
String StringifiedName = theCorbaName.getStringifiedName( );
if( StringifiedName == null ) {
// This means return the Root Naming context
return theNamingContext;
} else {
return theNamingContext.resolve_str( StringifiedName );
}
} catch( Exception e ) {
clearRootNamingContextCache( );
return null;
}
}
示例3: getDefaultRootNamingContext
import org.omg.CosNaming.NamingContextExtHelper; //导入依赖的package包/类
/**
* This is required for corbaname: resolution. Currently we
* are not caching RootNamingContext as the reference to rootNamingContext
* may not be Persistent in all the implementations.
* _REVISIT_ to clear the rootNamingContext in case of COMM_FAILURE.
*
* @return the org.omg.COSNaming.NamingContextExt if resolution is
* successful
*
*/
private NamingContextExt getDefaultRootNamingContext( ) {
synchronized( rootContextCacheLock ) {
if( rootNamingContextExt == null ) {
try {
rootNamingContextExt =
NamingContextExtHelper.narrow(
orb.getLocalResolver().resolve( "NameService" ) );
} catch( Exception e ) {
rootNamingContextExt = null;
}
}
}
return rootNamingContextExt;
}
示例4: resolveObject
import org.omg.CosNaming.NamingContextExtHelper; //导入依赖的package包/类
public static org.omg.CORBA.Object resolveObject(AxisService service, org.omg.CORBA_2_3.ORB orb) throws CorbaInvocationException {
org.omg.CORBA.Object obj;
try {
Parameter namingServiceUrl = service.getParameter(NAMING_SERVICE_URL);
Parameter objectName = service.getParameter(OBJECT_NAME);
Parameter iorFilePath = service.getParameter(IOR_FILE_PATH);
Parameter iorString = service.getParameter(IOR_STRING);
if (namingServiceUrl!=null && objectName!=null) {
obj = orb.string_to_object(((String) namingServiceUrl.getValue()).trim());
NamingContextExt nc = NamingContextExtHelper.narrow(obj);
obj = nc.resolve(nc.to_name(((String) objectName.getValue()).trim()));
} else if (iorFilePath!=null) {
FileReader fileReader = new FileReader(((String) iorFilePath.getValue()).trim());
char[] buf = new char[1000];
fileReader.read(buf);
obj = orb.string_to_object((new String(buf)).trim());
fileReader.close();
} else if (iorString!=null) {
obj = orb.string_to_object(((String) iorString.getValue()).trim());
} else {
throw new CorbaInvocationException("cannot resolve object");
}
} catch (NotFound notFound) {
throw new CorbaInvocationException("cannot resolve object", notFound);
} catch (CannotProceed cannotProceed) {
throw new CorbaInvocationException("cannot resolve object", cannotProceed);
} catch (InvalidName invalidName) {
throw new CorbaInvocationException("cannot resolve object", invalidName);
} catch (IOException e) {
throw new CorbaInvocationException("cannot resolve object", e);
}
return obj;
}