org.objectweb.jac.aspects.distribution
Class DeploymentAC

java.lang.Object
  extended byorg.objectweb.jac.core.AspectComponent
      extended byorg.objectweb.jac.aspects.distribution.DeploymentAC
All Implemented Interfaces:
BaseProgramListener, DeploymentConf, Serializable

public class DeploymentAC
extends AspectComponent
implements DeploymentConf

This aspect component implements a generic deployment aspect.

Author:
Renaud Pawlak
See Also:
DeploymentConf, DeploymentRule, Serialized Form

Field Summary
static String REFS
          the name of the metadata that tells whether the parameters of a methods are references (TRUE) or values (FALSE).
 
Fields inherited from class org.objectweb.jac.core.AspectComponent
application, blockKeywords, cr, currentConfigMethod, currentImports, firstCall, NOT_SHARED, SHARED, startWeavingCCount, startWeavingCount, startWeavingMethod, startWeavingType, systemListener, wrappers
 
Fields inherited from interface org.objectweb.jac.core.BaseProgramListener
FOUND_OBJECT
 
Constructor Summary
DeploymentAC()
           
 
Method Summary
 void createAsynchronousStubsFor(String name, String serverHost, String hosts)
          This configuration method creates the stubs with an asynchronous type (org.objectweb.jac.core.dist.NonBlockingStubWrapper).
 void createStubsFor(String name, String serverHost, String hosts)
          This configuration method creates the stubs with the default type (org.objectweb.jac.core.dist.StubWrapper).
 void createTypedStubsFor(String name, String serverHost, String hosts, String stubType)
          This configuration method creates remote-access stubs for the object called name on all the client-hosts defined by the hosts expression.
 void deploy(String deploymentHost, String nameRegexp, String containerName)
          This configuration method creates a deployment rule that tells that the objects that match are deployed on a given remote container.
 void replicate(String deploymentHost, String nameRegexp, String contRegexp)
          This configuration method creates a deployment rule that replicates an original object on a set of containers.
 void setParametersPassingMode(MethodItem method, Boolean[] refs)
          Defines the passing mode of the parameters for a given method.
 void setTransient(ClassItem classItem, String fieldName)
          This configuration method sets a field to be transient.
 Wrappee whenDeserialized(SerializedJacObject orgObject, Wrappee finalObject)
          Fill the field values when the forwarding is disabled for this object..
 Wrappee whenSerialized(Wrappee orgObject, SerializedJacObject finalObject)
          Force the treatment of the objects that are being serialized.
 
Methods inherited from class org.objectweb.jac.core.AspectComponent
addWrapper, afterApplicationStarted, afterRunningWrapper, afterWrap, afterWrappeeInit, attr, attrdef, beforeConfiguration, beforeReload, beforeRunningWrapper, beforeWrappeeInit, configure, defines, defineTimer, doRegister, doUnregister, error, getAC, getApplication, getBlockKeywords, getConfigurationMethods, getConfigurationMethodsName, getConfigurationMethodsName, getDefaultConfigs, getName, getNameCounters, getWrappers, init, isConfigurationMethod, isSystemListener, onExit, pointcut, pointcut, pointcut, pointcut, pointcut, pointcut, pointcut, pointcut, setApplication, setAttribute, setAttribute, setAttribute, setSystemListener, simulateUsingNewInstance, unweave, unwrapAll, updateNameCounters, warning, weave, whenClone, whenCloseDisplay, whenConfigured, whenDeleted, whenFree, whenGetObjects, whenNameObject, whenObjectMiss, whenReload, whenRemoteInstantiation, whenTopologyChanged, whenUsingNewClass, whenUsingNewInstance
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

REFS

public static final String REFS
the name of the metadata that tells whether the parameters of a methods are references (TRUE) or values (FALSE).

See Also:
Constant Field Values
Constructor Detail

DeploymentAC

public DeploymentAC()
Method Detail

whenSerialized

public Wrappee whenSerialized(Wrappee orgObject,
                              SerializedJacObject finalObject)
Force the treatment of the objects that are being serialized. This allows the deployment aspect to be sure that an object that is passed as a parameter of a remote invocation is already deployed when arriving on the new site. If none of the deployment rule can be applied on the serialized object, then the object will not be a forwarder but a copy of the original object.

Specified by:
whenSerialized in interface BaseProgramListener
Overrides:
whenSerialized in class AspectComponent
Parameters:
finalObject - the structure to store the serialized infos
orgObject - the object being serialized
Returns:
the object being serialized (usually orgObject, but not necessarily).
See Also:
SerializedJacObject, JacObjectOutputStream

whenDeserialized

public Wrappee whenDeserialized(SerializedJacObject orgObject,
                                Wrappee finalObject)
Fill the field values when the forwarding is disabled for this object..

Specified by:
whenDeserialized in interface BaseProgramListener
Overrides:
whenDeserialized in class AspectComponent
Parameters:
orgObject - the JAC object that is being deserialized.
finalObject - the object being deserialized
Returns:
the object being deserialized (usually finalObject but not necessarily)
See Also:
SerializedJacObject, JacObjectInputStream

deploy

public void deploy(String deploymentHost,
                   String nameRegexp,
                   String containerName)
Description copied from interface: DeploymentConf
This configuration method creates a deployment rule that tells that the objects that match are deployed on a given remote container.

Specified by:
deploy in interface DeploymentConf
Parameters:
deploymentHost - the host from where the objects are deployed
nameRegexp - all the objects for which the name will match this pattern will be deployed with this rule
containerName - the container that will hold the objects

replicate

public void replicate(String deploymentHost,
                      String nameRegexp,
                      String contRegexp)
Description copied from interface: DeploymentConf
This configuration method creates a deployment rule that replicates an original object on a set of containers.

Specified by:
replicate in interface DeploymentConf
Parameters:
deploymentHost - the host from where the objects are deployed
nameRegexp - all the objects for which the name will match this regular expression will be replicated
contRegexp - identifies the containers that will hold the replication group (one replica per container)

createTypedStubsFor

public void createTypedStubsFor(String name,
                                String serverHost,
                                String hosts,
                                String stubType)
Description copied from interface: DeploymentConf
This configuration method creates remote-access stubs for the object called name on all the client-hosts defined by the hosts expression.

Specified by:
createTypedStubsFor in interface DeploymentConf
Parameters:
name - the name of the object the stubs are created for
serverHost - the name of the container the server is located
hosts - an expression telling where the stubs are deployed
stubType - the type of the stub (a StubWrapper subclass)

createStubsFor

public void createStubsFor(String name,
                           String serverHost,
                           String hosts)
Description copied from interface: DeploymentConf
This configuration method creates the stubs with the default type (org.objectweb.jac.core.dist.StubWrapper).

Specified by:
createStubsFor in interface DeploymentConf
Parameters:
name - the name of the object the stubs are created for
serverHost - the name of the container the server is located
hosts - an expression telling where the stubs are deployed

createAsynchronousStubsFor

public void createAsynchronousStubsFor(String name,
                                       String serverHost,
                                       String hosts)
Description copied from interface: DeploymentConf
This configuration method creates the stubs with an asynchronous type (org.objectweb.jac.core.dist.NonBlockingStubWrapper).

Specified by:
createAsynchronousStubsFor in interface DeploymentConf
Parameters:
name - the name of the object the stubs are created for
serverHost - the name of the container the server is located
hosts - an expression telling where the stubs are deployed

setTransient

public void setTransient(ClassItem classItem,
                         String fieldName)
Description copied from interface: DeploymentConf
This configuration method sets a field to be transient.

Specified by:
setTransient in interface DeploymentConf
Parameters:
classItem - the class item of the field
fieldName - the field name

setParametersPassingMode

public void setParametersPassingMode(MethodItem method,
                                     Boolean[] refs)
Description copied from interface: DeploymentConf
Defines the passing mode of the parameters for a given method.

When a method is fowarded to a remote host by a stub (wrapper), the parameters of this method can be passed by value (then the whole object is serialized on the local host and deserialized on the remote host) or by reference (then the object's state is not serialized and it is bounded to a remote object on the remote host).

Specified by:
setParametersPassingMode in interface DeploymentConf
Parameters:
method - the method that holds the parameters
refs - TRUE or FALSE for each parameter... by default, the parameters are passed by value