本文整理汇总了Java中org.omg.CORBA.portable.ObjectImpl类的典型用法代码示例。如果您正苦于以下问题:Java ObjectImpl类的具体用法?Java ObjectImpl怎么用?Java ObjectImpl使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ObjectImpl类属于org.omg.CORBA.portable包,在下文中一共展示了ObjectImpl类的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: activateTie
import org.omg.CORBA.portable.ObjectImpl; //导入依赖的package包/类
/** Given any Tie, return the corresponding object refernce, activating
* the Servant if necessary.
*/
public static org.omg.CORBA.Object activateTie( Tie tie )
{
/** Any implementation of Tie should be either a Servant or an ObjectImpl,
* depending on which style of code generation is used. rmic -iiop by
* default results in an ObjectImpl-based Tie, while rmic -iiop -poa
* results in a Servant-based Tie. Dynamic RMI-IIOP also uses Servant-based
* Ties (see impl.presentation.rmi.ReflectiveTie).
*/
if (tie instanceof ObjectImpl) {
return tie.thisObject() ;
} else if (tie instanceof Servant) {
Servant servant = (Servant)tie ;
return activateServant( servant ) ;
} else {
throw wrapper.badActivateTieCall() ;
}
}
示例2: narrow
import org.omg.CORBA.portable.ObjectImpl; //导入依赖的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);
}
}
示例3: narrow
import org.omg.CORBA.portable.ObjectImpl; //导入依赖的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();
}
示例4: getWriteStatement
import org.omg.CORBA.portable.ObjectImpl; //导入依赖的package包/类
/**
* Get the statement for writing the variable of the given type to the GIOP ({@link org.omg.CORBA_2_3.portable.OutputStream) stream. The
* stream is always named "out".
*
* @param c
* the class of the object being written
* @param variable
* the variable, where the object value is stored
* @param r
* the parent generator, used to name the class
* @return the write statement.
*/
public static String getWriteStatement(Class c, String variable, SourceGiopRmicCompiler r)
{
if (c.equals(boolean.class))
return "out.write_boolean(" + variable + ");";
if (c.equals(byte.class))
return "out.write_octet(" + variable + ");";
else if (c.equals(short.class))
return "out.write_int(" + variable + ");";
else if (c.equals(int.class))
return "out.write_long(" + variable + ");";
else if (c.equals(long.class))
return "out.write_long_long(" + variable + ");";
else if (c.equals(double.class))
return "out.write_double(" + variable + ");";
else if (c.equals(float.class))
return "out.write_float(" + variable + ");";
else if (c.equals(char.class))
return "out.write_char(" + variable + ");";
else if (Remote.class.isAssignableFrom(c))
return "Util.writeRemoteObject(out, " + variable + ");";
else if (ObjectImpl.class.isAssignableFrom(c))
return "out.write_Object(" + variable + ");";
else
return "out.write_value(" + variable + ", " + r.name(c) + ".class);";
}
示例5: getNameInNamespace
import org.omg.CORBA.portable.ObjectImpl; //导入依赖的package包/类
/**
* Returs the full name of this naming context. The returned string is not a
* JNDI composite name and should not be passed directly to the methods of the
* naming context. This implementation returns the IOR.
*
* @return the full name of this naming context, in its own namespace.
* @throws OperationNotSupportedException
* if the naming system, represented by this context, does not
* support the notation of the full name.
* @throws NamingException
*/
public String getNameInNamespace() throws NamingException
{
if (orb != null)
return orb.object_to_string(service);
else
{
try
{
ObjectImpl impl = (ObjectImpl) service;
return impl._orb().object_to_string(impl);
}
catch (ClassCastException e)
{
throw new UnsupportedOperationException();
}
}
}
示例6: object_to_string
import org.omg.CORBA.portable.ObjectImpl; //导入依赖的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();
}
示例7: createIOR
import org.omg.CORBA.portable.ObjectImpl; //导入依赖的package包/类
/**
* Create IOR for the given object references.
*/
protected IOR createIOR(Connected_objects.cObject ref)
throws BAD_OPERATION
{
IOR ior = new IOR();
ior.key = ref.key;
ior.Internet.port = ref.port;
if (ref.object instanceof ObjectImpl)
{
ObjectImpl imp = (ObjectImpl) ref.object;
if (imp._ids().length > 0)
ior.Id = imp._ids() [ 0 ];
}
if (ior.Id == null)
ior.Id = ref.object.getClass().getName();
ior.Internet.host = CollocatedOrbs.localHost;
ior.Internet.port = ref.port;
return ior;
}
示例8: prepareObject
import org.omg.CORBA.portable.ObjectImpl; //导入依赖的package包/类
/**
* Prepare object for connecting it to this ORB.
*
* @param object the object being connected.
*
* @throws BAD_PARAM if the object does not implement the
* {@link InvokeHandler}).
*/
protected void prepareObject(org.omg.CORBA.Object object, IOR ior)
throws BAD_PARAM
{
/*
* if (!(object instanceof InvokeHandler)) throw new
* BAD_PARAM(object.getClass().getName() + " does not implement
* InvokeHandler. " );
*/
// If no delegate is set, set the default delegate.
if (object instanceof ObjectImpl)
{
ObjectImpl impl = (ObjectImpl) object;
try
{
if (impl._get_delegate() == null)
impl._set_delegate(new SimpleDelegate(this, ior));
}
catch (BAD_OPERATION ex)
{
// Some colaborants may throw this exception.
impl._set_delegate(new SimpleDelegate(this, ior));
}
}
}
示例9: is_a
import org.omg.CORBA.portable.ObjectImpl; //导入依赖的package包/类
/**
* Check if this object can be referenced by the given repository id.
*
* @param target the CORBA object, must be an instance of
* {@link org.omg.CORBA.portable.ObjectImpl}.
*
* @param repositoryIdentifer the repository id.
*
* @return true if the passed parameter is a repository id of this
* CORBA object.
*/
public boolean is_a(org.omg.CORBA.Object target, String repositoryIdentifer)
{
if (!(target instanceof ObjectImpl))
throw new NO_IMPLEMENT("Supported only for org.omg.CORBA.portable.ObjectImpl");
ObjectImpl imp = (ObjectImpl) target;
String[] ids = imp._ids();
for (int i = 0; i < ids.length; i++)
{
if (ids [ i ].equals(repositoryIdentifer))
return true;
}
return false;
}
示例10: getWriteStatement
import org.omg.CORBA.portable.ObjectImpl; //导入依赖的package包/类
/**
* Get the statement for writing the variable of the given type to the GIOP ({@link org.omg.CORBA_2_3.portable.OutputStream) stream. The
* stream is always named "out".
*
* @param c
* the class of the object being written
* @param variable
* the variable, where the object value is stored
* @param r
* the parent generator, used to name the class
* @return the write statement.
*/
public static String getWriteStatement(Class c, String variable, SourceGiopRmicCompiler r)
{
if (c.equals(boolean.class))
return "out.write_boolean(" + variable + ");";
if (c.equals(byte.class))
return "out.write_octet(" + variable + ");";
else if (c.equals(short.class))
return "out.write_int(" + variable + ");";
else if (c.equals(int.class))
return "out.write_long(" + variable + ");";
else if (c.equals(long.class))
return "out.write_long_long(" + variable + ");";
else if (c.equals(double.class))
return "out.write_double(" + variable + ");";
else if (c.equals(float.class))
return "out.write_float(" + variable + ");";
else if (c.equals(char.class))
return "out.write_char(" + variable + ");";
else if (Remote.class.isAssignableFrom(c))
return "Util.writeRemoteObject(out, " + variable + ");";
else if (ObjectImpl.class.isAssignableFrom(c))
return "out.write_Object(" + variable + ");";
else
return "out.write_value(" + variable + ", " + r.name(c) + ".class);";
}
示例11: getNameInNamespace
import org.omg.CORBA.portable.ObjectImpl; //导入依赖的package包/类
/**
* Returs the full name of this naming context. The returned string is not a
* JNDI composite name and should not be passed directly to the methods of the
* naming context. This implementation returns the IOR.
*
* @return the full name of this naming context, in its own namespace.
* @throws OperationNotSupportedException
* if the naming system, represented by this context, does not
* support the notation of the full name.
* @throws NamingException
*/
public String getNameInNamespace() throws NamingException
{
if (orb != null)
return orb.object_to_string(service);
else
{
try
{
ObjectImpl impl = (ObjectImpl) service;
return impl._orb().object_to_string(impl);
}
catch (ClassCastException e)
{
throw new UnsupportedOperationException();
}
}
}