- java.lang.Object
-
- org.omg.CORBA.portable.ObjectImpl
-
- All Implemented Interfaces:
Object
- Direct Known Subclasses:
_BindingIteratorStub
,_DynAnyFactoryStub
,_DynAnyStub
,_DynArrayStub
,_DynEnumStub
,_DynFixedStub
,_DynSequenceStub
,_DynStructStub
,_DynUnionStub
,_DynValueStub
,_IDLTypeStub
,_NamingContextExtStub
,_NamingContextStub
,_PolicyStub
,_ServantActivatorStub
,_ServantLocatorStub
,DynamicImplementation
,ObjectImpl
public abstract class ObjectImpl extends Object implements Object
The common base class for all stub classes; provides default implementations of theorg.omg.CORBA.Object
methods. All method implementations are forwarded to aDelegate
object stored in theObjectImpl
instance.ObjectImpl
allows for portable stubs because theDelegate
can be implemented by a different vendor-specific ORB.
-
-
Constructor Summary
Constructors Constructor Description ObjectImpl()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description Request
_create_request(Context ctx, String operation, NVList arg_list, NamedValue result)
Creates aRequest
object that contains the given context, method, argument list, and container for the result.Request
_create_request(Context ctx, String operation, NVList arg_list, NamedValue result, ExceptionList exceptions, ContextList contexts)
Creates aRequest
object that contains the given context, method, argument list, container for the result, exceptions, and list of property names to be used in resolving the context strings.Object
_duplicate()
Returns a duplicate of thisObjectImpl
object.Delegate
_get_delegate()
Retrieves the reference to the vendor-specificDelegate
object to which thisObjectImpl
object delegates all methods invoked on it.DomainManager[]
_get_domain_managers()
Retrieves a list of the domain managers for thisObjectImpl
object.Object
_get_interface_def()
Retrieves the interface definition for thisObjectImpl
object.Policy
_get_policy(int policy_type)
Retrieves thePolicy
object for thisObjectImpl
object that has the given policy type.int
_hash(int maximum)
Retrieves the hash code that serves as an ORB-internal identifier for thisObjectImpl
object.abstract String[]
_ids()
Retrieves a string array containing the repository identifiers supported by thisObjectImpl
object.InputStream
_invoke(OutputStream output)
Invokes an operation and returns anInputStream
object for reading the response.boolean
_is_a(String repository_id)
Checks whether the object identified by the given repository identifier is anObjectImpl
object.boolean
_is_equivalent(Object that)
Checks whether the the givenObjectImpl
object is equivalent to thisObjectImpl
object.boolean
_is_local()
Checks whether thisObjectImpl
object is implemented by a local servant.boolean
_non_existent()
Checks whether the server object for thisObjectImpl
object has been destroyed.ORB
_orb()
Returns a reference to the ORB associated with this object and its delegate.void
_release()
Releases the resources associated with thisObjectImpl
object.void
_releaseReply(InputStream input)
Releases the given reply stream back to the ORB when unmarshalling has completed after a call to the method_invoke
.Request
_request(String operation)
Creates aRequest
object containing the given method that can be used with the Dynamic Invocation Interface.OutputStream
_request(String operation, boolean responseExpected)
Returns anOutputStream
object to use for marshalling the arguments of the given method.void
_servant_postinvoke(ServantObject servant)
Is called by the local stub after it has invoked an operation on the local servant that was previously retrieved from a call to the method_servant_preinvoke
.ServantObject
_servant_preinvoke(String operation, Class expectedType)
Returns a Java reference to the local servant that should be used for sending a request for the method specified.void
_set_delegate(Delegate delegate)
Sets the Delegate for thisObjectImpl
instance to the givenDelegate
object.Object
_set_policy_override(Policy[] policies, SetOverrideType set_add)
Sets thisObjectImpl
object's override type for the given policies to the given instance ofSetOverrideType
.boolean
equals(Object obj)
Compares thisObjectImpl
object with the given one for equality.int
hashCode()
Returns the hash code for thisObjectImpl
object.String
toString()
Returns aString
object that represents thisObjectImpl
object.
-
-
-
Method Detail
-
_get_delegate
public Delegate _get_delegate()
Retrieves the reference to the vendor-specificDelegate
object to which thisObjectImpl
object delegates all methods invoked on it.- Returns:
- the Delegate contained in this ObjectImpl instance
- Throws:
BAD_OPERATION
- if the delegate has not been set- See Also:
_set_delegate(org.omg.CORBA.portable.Delegate)
-
_set_delegate
public void _set_delegate(Delegate delegate)
Sets the Delegate for thisObjectImpl
instance to the givenDelegate
object. All method invocations on thisObjectImpl
object will be forwarded to this delegate.- Parameters:
delegate
- theDelegate
instance to which all method calls on thisObjectImpl
object will be delegated; may be implemented by a third-party ORB- See Also:
_get_delegate()
-
_ids
public abstract String[] _ids()
Retrieves a string array containing the repository identifiers supported by thisObjectImpl
object. For example, for a stub, this method returns information about all the interfaces supported by the stub.- Returns:
- the array of all repository identifiers supported by this
ObjectImpl
instance
-
_duplicate
public Object _duplicate()
Returns a duplicate of thisObjectImpl
object.- Specified by:
_duplicate
in interfaceObject
- Returns:
- an
orb.omg.CORBA.Object
object that is a duplicate of this object
-
_release
public void _release()
Releases the resources associated with thisObjectImpl
object.
-
_is_a
public boolean _is_a(String repository_id)
Checks whether the object identified by the given repository identifier is anObjectImpl
object.
-
_is_equivalent
public boolean _is_equivalent(Object that)
Checks whether the the givenObjectImpl
object is equivalent to thisObjectImpl
object.- Specified by:
_is_equivalent
in interfaceObject
- Parameters:
that
- an instance ofObjectImpl
to compare with thisObjectImpl
object- Returns:
true
if the given object is equivalent to thisObjectImpl
object;false
otherwise
-
_non_existent
public boolean _non_existent()
Checks whether the server object for thisObjectImpl
object has been destroyed.- Specified by:
_non_existent
in interfaceObject
- Returns:
true
if the ORB knows authoritatively that the server object does not exist;false
otherwise
-
_hash
public int _hash(int maximum)
Retrieves the hash code that serves as an ORB-internal identifier for thisObjectImpl
object.
-
_request
public Request _request(String operation)
Creates aRequest
object containing the given method that can be used with the Dynamic Invocation Interface.
-
_create_request
public Request _create_request(Context ctx, String operation, NVList arg_list, NamedValue result)
Creates aRequest
object that contains the given context, method, argument list, and container for the result.- Specified by:
_create_request
in interfaceObject
- Parameters:
ctx
- the Context for the requestoperation
- the method that the newRequest
object will invokearg_list
- the arguments for the method; anNVList
in which each argument is aNamedValue
objectresult
- aNamedValue
object to be used for returning the result of executing the request's method- Returns:
- a new
Request
object initialized with the given context, method, argument list, and container for the return value - See Also:
Request
,NVList
,NamedValue
-
_create_request
public Request _create_request(Context ctx, String operation, NVList arg_list, NamedValue result, ExceptionList exceptions, ContextList contexts)
Creates aRequest
object that contains the given context, method, argument list, container for the result, exceptions, and list of property names to be used in resolving the context strings. ThisRequest
object is for use in the Dynamic Invocation Interface.- Specified by:
_create_request
in interfaceObject
- Parameters:
ctx
- theContext
object that contains the context strings that must be resolved before they are sent along with the requestoperation
- the method that the newRequest
object will invokearg_list
- the arguments for the method; anNVList
in which each argument is aNamedValue
objectresult
- aNamedValue
object to be used for returning the result of executing the request's methodexceptions
- a list of the exceptions that the given method throwscontexts
- a list of the properties that are needed to resolve the contexts in ctx; the strings in contexts are used as arguments to the methodContext.get_values
, which returns the value associated with the given property- Returns:
- a new
Request
object initialized with the given context strings to resolve, method, argument list, container for the result, exceptions, and list of property names to be used in resolving the context strings - See Also:
Request
,NVList
,NamedValue
,ExceptionList
,ContextList
-
_get_interface_def
public Object _get_interface_def()
Retrieves the interface definition for thisObjectImpl
object.- Specified by:
_get_interface_def
in interfaceObject
- Returns:
- the
org.omg.CORBA.Object
instance that is the interface definition for thisObjectImpl
object
-
_orb
public ORB _orb()
Returns a reference to the ORB associated with this object and its delegate. This is theORB
object that created the delegate.- Returns:
- the
ORB
instance that created theDelegate
object contained in thisObjectImpl
object
-
_get_policy
public Policy _get_policy(int policy_type)
Retrieves thePolicy
object for thisObjectImpl
object that has the given policy type.- Specified by:
_get_policy
in interfaceObject
- Parameters:
policy_type
- an int indicating the policy type- Returns:
- the
Policy
object that is the specified policy type and that applies to thisObjectImpl
object - See Also:
PolicyOperations.policy_type()
-
_get_domain_managers
public DomainManager[] _get_domain_managers()
Retrieves a list of the domain managers for thisObjectImpl
object.- Specified by:
_get_domain_managers
in interfaceObject
- Returns:
- an array containing the
DomainManager
objects for this instance ofObjectImpl
-
_set_policy_override
public Object _set_policy_override(Policy[] policies, SetOverrideType set_add)
Sets thisObjectImpl
object's override type for the given policies to the given instance ofSetOverrideType
.- Specified by:
_set_policy_override
in interfaceObject
- Parameters:
policies
- an array ofPolicy
objects with the policies that will replace the current policies or be added to the current policiesset_add
- eitherSetOverrideType.SET_OVERRIDE
, indicating that the given policies will replace any existing ones, orSetOverrideType.ADD_OVERRIDE
, indicating that the given policies should be added to any existing ones- Returns:
- an
Object
with the given policies replacing or added to its previous policies
-
_is_local
public boolean _is_local()
Checks whether thisObjectImpl
object is implemented by a local servant. If so, local invocation API's may be used.- Returns:
true
if this object is implemented by a local servant;false
otherwise
-
_servant_preinvoke
public ServantObject _servant_preinvoke(String operation, Class expectedType)
Returns a Java reference to the local servant that should be used for sending a request for the method specified. If thisObjectImpl
object is a local stub, it will invoke the_servant_preinvoke
method before sending a request in order to obtain theServantObject
instance to use.If a
ServantObject
object is returned, itsservant
field has been set to an object of the expected type (Note: the object may or may not be the actual servant instance). The local stub may cast the servant field to the expected type, and then invoke the operation directly. TheServantRequest
object is valid for only one invocation and cannot be used for more than one invocation.- Parameters:
operation
- aString
containing the name of the method to be invoked. This name should correspond to the method name as it would be encoded in a GIOP request.expectedType
- aClass
object representing the expected type of the servant that is returned. This expected type is theClass
object associated with the operations class for the stub's interface. For example, a stub for an interfaceFoo
would pass theClass
object for theFooOperations
interface.- Returns:
- (1) a
ServantObject
object, which may or may not be the actual servant instance, or (2)null
if (a) the servant is not local or (b) the servant has ceased to be local due to a ForwardRequest from a POA ServantManager - Throws:
BAD_PARAM
- if the servant is not the expected type
-
_servant_postinvoke
public void _servant_postinvoke(ServantObject servant)
Is called by the local stub after it has invoked an operation on the local servant that was previously retrieved from a call to the method_servant_preinvoke
. The_servant_postinvoke
method must be called if the_servant_preinvoke
method returned a non-null value, even if an exception was thrown by the method invoked by the servant. For this reason, the call to the method_servant_postinvoke
should be placed in a Javafinally
clause.- Parameters:
servant
- the instance of theServantObject
returned by the_servant_preinvoke
method
-
_request
public OutputStream _request(String operation, boolean responseExpected)
Returns anOutputStream
object to use for marshalling the arguments of the given method. This method is called by a stub, which must indicate if a response is expected, that is, whether or not the call is oneway.- Parameters:
operation
- a String giving the name of the method.responseExpected
- a boolean --true
if the request is not one way, that is, a response is expected- Returns:
- an
OutputStream
object for dispatching the request
-
_invoke
public InputStream _invoke(OutputStream output) throws ApplicationException, RemarshalException
Invokes an operation and returns anInputStream
object for reading the response. The stub provides theOutputStream
object that was previously returned by a call to the_request
method. The method specified as an argument to_request
when it was called previously is the method that this method invokes.If an exception occurs, the
_invoke
method may throw anApplicationException
object that contains an InputStream from which the user exception state may be unmarshalled.- Parameters:
output
- an OutputStream object for dispatching the request- Returns:
- an
InputStream
object containing the marshalled response to the method invoked - Throws:
ApplicationException
- if the invocation meets application-defined exceptionRemarshalException
- if the invocation leads to a remarshalling error- See Also:
_request(java.lang.String)
-
_releaseReply
public void _releaseReply(InputStream input)
Releases the given reply stream back to the ORB when unmarshalling has completed after a call to the method_invoke
. Calling this method is optional for the stub.- Parameters:
input
- theInputStream
object that was returned by the_invoke
method or theApplicationException.getInputStream
method; may benull
, in which case this method does nothing- See Also:
_invoke(org.omg.CORBA.portable.OutputStream)
-
toString
public String toString()
Returns aString
object that represents thisObjectImpl
object.
-
hashCode
public int hashCode()
Returns the hash code for thisObjectImpl
object.- Overrides:
hashCode
in classObject
- Returns:
- the hash code for this object
- See Also:
Object.equals(java.lang.Object)
,System.identityHashCode(java.lang.Object)
-
equals
public boolean equals(Object obj)
Compares thisObjectImpl
object with the given one for equality.- Overrides:
equals
in classObject
- Parameters:
obj
- the object with which to compare this object- Returns:
true
if the two objects are equal;false
otherwise- See Also:
Object.hashCode()
,HashMap
-
-