本文整理汇总了Java中org.omg.CORBA.portable.Delegate类的典型用法代码示例。如果您正苦于以下问题:Java Delegate类的具体用法?Java Delegate怎么用?Java Delegate使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Delegate类属于org.omg.CORBA.portable包,在下文中一共展示了Delegate类的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: equals
import org.omg.CORBA.portable.Delegate; //导入依赖的package包/类
/**
* This method overrides the org.omg.CORBA.portable.Delegate.equals method,
* and does the equality check based on IOR equality.
*/
public boolean equals(org.omg.CORBA.Object self, java.lang.Object other)
{
if (other == null)
return false ;
if (!StubAdapter.isStub(other)) {
return false;
}
Delegate delegate = StubAdapter.getDelegate( other ) ;
if (delegate == null)
return false ;
if (delegate instanceof CorbaClientDelegateImpl) {
CorbaClientDelegateImpl otherDel = (CorbaClientDelegateImpl)
delegate ;
IOR otherIor = otherDel.contactInfoList.getTargetIOR();
return this.contactInfoList.getTargetIOR().equals(otherIor);
}
// Come here if other is not implemented by our ORB.
return false;
}
示例2: isLocal
import org.omg.CORBA.portable.Delegate; //导入依赖的package包/类
private boolean isLocal()
{
boolean result = false ;
Delegate delegate = StubAdapter.getDelegate( stub ) ;
if (delegate instanceof CorbaClientDelegate) {
CorbaClientDelegate cdel = (CorbaClientDelegate)delegate ;
ContactInfoList cil = cdel.getContactInfoList() ;
if (cil instanceof CorbaContactInfoList) {
CorbaContactInfoList ccil = (CorbaContactInfoList)cil ;
LocalClientRequestDispatcher lcrd =
ccil.getLocalClientRequestDispatcher() ;
result = lcrd.useLocalInvocation( null ) ;
}
}
return result ;
}
示例3: getDelegate
import org.omg.CORBA.portable.Delegate; //导入依赖的package包/类
public Delegate getDelegate( ORB orb )
{
// write the IOR components to an org.omg.CORBA.portable.OutputStream
OutputStream ostr = orb.create_output_stream();
ostr.write_long(typeData.length);
ostr.write_octet_array(typeData, 0, typeData.length);
ostr.write_long(profileTags.length);
for (int i = 0; i < profileTags.length; i++) {
ostr.write_long(profileTags[i]);
ostr.write_long(profileData[i].length);
ostr.write_octet_array(profileData[i], 0, profileData[i].length);
}
InputStream istr = ostr.create_input_stream() ;
// read the IOR back from the stream
org.omg.CORBA.Object obj = (org.omg.CORBA.Object)istr.read_Object();
return StubAdapter.getDelegate( obj ) ;
}
示例4: narrow
import org.omg.CORBA.portable.Delegate; //导入依赖的package包/类
/**
* Cast the passed object into the Policy. If the
* object has a different java type, create an instance
* of the _PolicyStub, using the same delegate, as for
* the passed parameter. Hence, unlike java type cast,
* this method may return a different object, than has been passed.
*
* @param obj the object to narrow.
* @return narrowed instance.
* @throws BAD_PARAM if the passed object is not a Policy.
*/
public static Policy narrow(org.omg.CORBA.Object obj)
{
if (obj == null)
return null;
else if (obj instanceof Policy)
return (Policy) obj;
else
{
// Check for the policy id cannot be performed because
// this helper must read various subclasses of the Policy,
// and the IOR profile currently supports only one id.
Delegate delegate = ((ObjectImpl) obj)._get_delegate();
return new _PolicyStub(delegate);
}
}
示例5: narrow
import org.omg.CORBA.portable.Delegate; //导入依赖的package包/类
/**
* Cast the passed object into the NamingContext. If the
* object has a different java type, create an instance
* of the NamingContext, using the same delegate, as for
* the passed parameter.
*
* If the object repository Id indicates that it is an instance of
* {@link NamingContextExt} that is a subclass of the NamingContext,
* the functionality is delegated to {@link NamingContextHelper#narrow}.
*
* @param obj the object to cast.
* @return casted instance.
*
* @throws BAD_PARAM if the passed object is not an instance of
* {@link NamingContext} or {@link NamingContextExt}.
*/
public static NamingContext narrow(org.omg.CORBA.Object obj)
{
if (obj == null)
return null;
else if (obj instanceof NamingContext)
return (NamingContext) obj;
else if (obj._is_a(id()))
{
Delegate delegate = ((ObjectImpl) obj)._get_delegate();
return new _NamingContextStub(delegate);
}
else if (obj._is_a(NamingContextExtHelper.id()))
return NamingContextExtHelper.narrow(obj);
else
throw new BAD_PARAM();
}
示例6: object_to_string
import org.omg.CORBA.portable.Delegate; //导入依赖的package包/类
/**
* Get the IOR reference string for the given object. The string embeds
* information about the object repository Id, its access key and the server
* internet address and port. With this information, the object can be found
* by another ORB, possibly located on remote computer.
*
* @param forObject CORBA object
* @return the object IOR representation.
*
* @throws BAD_PARAM if the object has not been previously connected to this
* ORB.
*
* @throws BAD_OPERATION in the unlikely case if the local host address cannot
* be resolved.
*
* @see string_to_object(String)
*/
public String object_to_string(org.omg.CORBA.Object forObject)
{
// Handle the case when the object is known, but not local.
if (forObject instanceof ObjectImpl)
{
Delegate delegate = ((ObjectImpl) forObject)._get_delegate();
if (delegate instanceof SimpleDelegate)
return ((SimpleDelegate) delegate).getIor().toStringifiedReference();
}
// Handle the case when the object is local.
Connected_objects.cObject rec = connected_objects.getKey(forObject);
if (rec == null)
throw new BAD_PARAM("The object " + forObject +
" has not been previously connected to this ORB"
);
IOR ior = createIOR(rec);
return ior.toStringifiedReference();
}