Package org.jcsp.net.dynamic
Class DynamicClassLoader
- java.lang.Object
-
- org.jcsp.net.dynamic.DynamicClassLoader
-
- All Implemented Interfaces:
Service
public class DynamicClassLoader extends java.lang.Object implements Service
A service implementation for supporting dynamic class transfer at a node. When started, JFTP server andClassManangerprocesses will be spawned and send/receive filters created. To support dynamic class loading over a given channel, plug the TX filter into the sending end and the RX filter into the receiving end. The channel can then be used normally.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description classDynamicClassLoader.DynamicClassLoaderUserObjectUser interface to obtain the TX and RX filters from the service once it has been started.
-
Field Summary
Fields Modifier and Type Field Description private DeserializeChannelFilterchannelRxFilterThe RX filter created when the service started, returned bygetChannelRxFilter.private DataSerializationFilterchannelTxFilterThe TX filter created when the service started, returned bygetChannelTxFilter.private ClassManagercmThe class manager process started by the service.static java.lang.StringnameDefault service name.private static FilternonDynamicClassLoadingRxFilterThe alternative RX filter that does not support dynamic class loading, returned bygetNonDynamicClassLoadingRxFilter.private booleanrunningStores the current state of the service.
-
Constructor Summary
Constructors Constructor Description DynamicClassLoader()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description FiltergetChannelRxFilter()Returns the RX filter to be used at the receiving end of a channel if dynamic class loading is to be supported over that channel.FiltergetChannelTxFilter()Returns the TX filter to be used at the sending end of a channel if dynamic class loading is to be supported over that channel.static FiltergetNonDynamicClassLoadingRxFilter()An alternative RX filter that does not support dynamic class loading but will properly unmarshal objects wrapped up by a TX filter.ServiceUserObjectgetUserObject()Returns the service user object.booleaninit(ServiceSettings settings)Initializes the dynamic loader service.booleanisRunning()Returns true iff the service is running.booleanstart()Starts the dynamic loader service by spawningClassManagerandJFTPprocesses.booleanstop()Stops the dynamic loader service.
-
-
-
Field Detail
-
running
private boolean running
Stores the current state of the service.
-
channelTxFilter
private DataSerializationFilter channelTxFilter
The TX filter created when the service started, returned bygetChannelTxFilter.
-
channelRxFilter
private DeserializeChannelFilter channelRxFilter
The RX filter created when the service started, returned bygetChannelRxFilter.
-
cm
private ClassManager cm
The class manager process started by the service.
-
name
public static final java.lang.String name
Default service name.- See Also:
- Constant Field Values
-
nonDynamicClassLoadingRxFilter
private static Filter nonDynamicClassLoadingRxFilter
The alternative RX filter that does not support dynamic class loading, returned bygetNonDynamicClassLoadingRxFilter.
-
-
Method Detail
-
start
public boolean start()
Starts the dynamic loader service by spawningClassManagerandJFTPprocesses.
-
stop
public boolean stop()
Stops the dynamic loader service.
-
init
public boolean init(ServiceSettings settings)
Initializes the dynamic loader service.
-
isRunning
public boolean isRunning()
Returns true iff the service is running.
-
getUserObject
public ServiceUserObject getUserObject() throws java.lang.SecurityException
Returns the service user object.- Specified by:
getUserObjectin interfaceService- Returns:
- a
ServiceUserObject. - Throws:
java.lang.SecurityException- if the calling Thread does not have access to the object.
-
getChannelTxFilter
public Filter getChannelTxFilter()
Returns the TX filter to be used at the sending end of a channel if dynamic class loading is to be supported over that channel. If there is a TX filter at the sending end, there must be a RX filter at the receiving end.
-
getChannelRxFilter
public Filter getChannelRxFilter()
Returns the RX filter to be used at the receiving end of a channel if dynamic class loading is to be supported over that channel. The filter returned is safe to use if there is no TX filter at the sending end.
-
getNonDynamicClassLoadingRxFilter
public static Filter getNonDynamicClassLoadingRxFilter()
An alternative RX filter that does not support dynamic class loading but will properly unmarshal objects wrapped up by a TX filter.
-
-