Package eu.tneitzel.rmg.utils
Class ActivatableWrapper
- java.lang.Object
-
- eu.tneitzel.rmg.utils.RemoteObjectWrapper
-
- eu.tneitzel.rmg.utils.ActivatableWrapper
-
public class ActivatableWrapper extends RemoteObjectWrapper
The ActivatableWrapper class extends RemoteObjectWrapper and is used for wrapping ActivatableRef. By using the activate method of ActivatableWrapper, it is possible to turn it into an UnicastWrapper.- Author:
- Tobias Neitzel (@qtc_de)
-
-
Field Summary
Fields Modifier and Type Field Description UIDactivationUIDactivationUID-
Fields inherited from class eu.tneitzel.rmg.utils.RemoteObjectWrapper
boundName, knownEndpoint, remoteObject
-
-
Constructor Summary
Constructors Constructor Description ActivatableWrapper(Remote remoteObject, String boundName, RemoteRef ref)ActivatableWrapper is constructed from a remote object.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description UnicastWrapperactivate()Activate the ActivatableWrapper.UnicastWrappergetActivated()Return the currently set activatedRef.StringgetActivatorEndpoint()Return a formatted string in host:port format for the Activator endpoint.-
Methods inherited from class eu.tneitzel.rmg.utils.RemoteObjectWrapper
fromBoundNames, getByName, getInstance, getInstance, getInterfaceName, getUnicastWrapper, getUnicastWrappers, isKnown
-
-
-
-
Field Detail
-
activationUID
public final UID activationUID
activationUID
-
-
Constructor Detail
-
ActivatableWrapper
public ActivatableWrapper(Remote remoteObject, String boundName, RemoteRef ref) throws IllegalArgumentException, IllegalAccessException, NoSuchFieldException, SecurityException
ActivatableWrapper is constructed from a remote object. It expects the underlying RemoteRef to be an ActivatableRef and attempts to extract the ActivationID from it. The ActivationID is then used to obtain the actual UID used for activation and the reference to the Activator. To provide compatibility to newer Java versions, the constructor uses reflection to perform operations on classes that are contained in the activation system. This allows them to be dynamically generated if they are missing. During the enum action, it is possible to use the RMGOptions.ACTIVATE option to activate an ActivatableWrapper and to display properties of the UnicastRef that is obtained during activation. For all other operations, activation is done implicitly. The third argument seems superfluous, as the ref is already contained in the remote object. However, ActivatableWrapper should be created by using the getInstance method of RemoteObjectWrapper. This one extracts the reference from the remote object anyway to check whether it is a UnicastRef or ActivatableRef. Therefore, we can reuse this extracted ref instead of performing another extraction.- Parameters:
remoteObject- Incoming RemoteObject, usually obtained by an RMI lookup callboundName- The bound name that the remoteObject uses inside the RMI registryref- ActivatableRef to wrap around- Throws:
IllegalArgumentException- if reflective access failsIllegalAccessException- if reflective access failsNoSuchFieldException- if reflective access failsSecurityException- if reflective access fails
-
-
Method Detail
-
activate
public UnicastWrapper activate() throws IllegalArgumentException, IllegalAccessException, NoSuchFieldException, SecurityException
Activate the ActivatableWrapper. Sends an activate call to the associated Activator and attempts to obtain a UnicastRef for the desired remote object.- Returns:
- UnicastWrapper that contains the activated reference
- Throws:
IllegalArgumentException- if reflective access failsIllegalAccessException- if reflective access failsNoSuchFieldException- if reflective access failsSecurityException- if reflective access fails
-
getActivated
public UnicastWrapper getActivated()
Return the currently set activatedRef. This is probably null, if the wrapper was not previously activated. Use the activate method instead, if you want to ensure activation.- Returns:
- activatedRef or null
-
getActivatorEndpoint
public String getActivatorEndpoint()
Return a formatted string in host:port format for the Activator endpoint.- Returns:
- String representation of the activator endpoint
-
-