Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

ch.ethz.prose
Class LocalAspectManager  view LocalAspectManager download LocalAspectManager.java

java.lang.Object
  extended bych.ethz.prose.LocalAspectManager
All Implemented Interfaces:
AspectManager, ch.ethz.prose.engine.ClassLoadListener
Direct Known Subclasses:
SecureLocalAspectManager

public class LocalAspectManager
extends java.lang.Object
implements AspectManager, ch.ethz.prose.engine.ClassLoadListener

Class LocalAspectManager extends AspectManager and implements a local extension manager. Upon creation, a LocalAspectManager registers itself as a listener of class load events into the current JoinPointManager.

Version:
$Revision: 1.1.1.1 $

Nested Class Summary
(package private) static class LocalAspectManager.TransactionGroup
           
 
Field Summary
(package private) static int ABORT
           
(package private) static int COMMIT
           
private  boolean isConnectedToVM
           
private  boolean isStarted
           
protected  ch.ethz.prose.engine.JoinPointManager jpm
           
private  java.util.Set theExtensions
           
private  java.util.HashMap txMap
           
 
Constructor Summary
protected LocalAspectManager(boolean isConnected, ch.ethz.jvmai.JVMAspectInterface ai)
          Create a new LocalAspectManager with no aspects inserted and create a JoinPointManager.
 
Method Summary
 void abort(java.lang.Object txId)
          Abort the transaction txId.
 void classLoaded(java.lang.Class newClass)
          This method is called every time a new class has been successfully loaded and prepared into the system.
 void commit(java.lang.Object txId)
          Commit the transaction txId.
protected  void createJoinPointManager(boolean isConnected, ch.ethz.jvmai.JVMAspectInterface ai)
          This Method is going to be overwritten from a subclass of LocalAspectManager that wants to register its own JoinPointManager.
 void doInsertExtension(Aspect ext)
          Insert the extension ext into the extension manager.
 void doWithdrawExtension(Aspect ext)
          Unregister the crosscuts belonging to ext from the corresponding JoinPointManager
protected  void finalize()
          Remove all inserted extensions from this extension manager, disconnect the joinpoint manager from the JVMAI System and deconstruct it.
private  void finishTransaction(java.lang.Object transactionId, int commitOrAbort)
           
 java.util.List getAllAspects()
          Return the list of extensions currently inserted into the system.
 ch.ethz.prose.engine.JoinPointManager getJoinPointManager()
          Return the JoinPointManager of this extension manager.
private  LocalAspectManager.TransactionGroup getTransactionGroup(java.lang.Object transactionId)
           
 void insert(Aspect x)
          Insert the aspect asp into this AspectManager The insertion of the crosscuts belonging to the specified aspect is done in the proper order (first crosscut is registered as first).
 void insert(Aspect x, java.lang.Object txId)
          Insert the aspect ext within the boundaries of the transaction txId.
 boolean isConnectedToVM()
          Return the boolean status that indicates if this extension manager is connected to the VM through its joinpoint manager or if it is the test manager and has no connection to the VM.
private  void prepareInsertExtension(Aspect ext, java.lang.Object transactionId)
           
private  void prepareWithdrawExtension(Aspect ext, java.lang.Object transactionId)
           
private  void registerCrosscuts(Aspect ext, java.lang.Class cls)
           
 void startup()
          This method has to be called before an AspectManager is used.
 void teardown()
          This method has to be called before an AspectManager is destroyed.
 void withdraw(Aspect x)
          Withdraw the aspect ext from this AspectManager.
 void withdraw(Aspect x, java.lang.Object txId)
          Withdraw the aspect ext within the boundaries of the transaction txId.
private  void withdrawAll()
           
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ABORT

static int ABORT

COMMIT

static int COMMIT

txMap

private java.util.HashMap txMap

theExtensions

private java.util.Set theExtensions

isConnectedToVM

private boolean isConnectedToVM

isStarted

private boolean isStarted

jpm

protected ch.ethz.prose.engine.JoinPointManager jpm
Constructor Detail

LocalAspectManager

protected LocalAspectManager(boolean isConnected,
                             ch.ethz.jvmai.JVMAspectInterface ai)
Create a new LocalAspectManager with no aspects inserted and create a JoinPointManager. register this extension manager as a class load listener of the current JoinPointManager.

Method Detail

createJoinPointManager

protected void createJoinPointManager(boolean isConnected,
                                      ch.ethz.jvmai.JVMAspectInterface ai)
This Method is going to be overwritten from a subclass of LocalAspectManager that wants to register its own JoinPointManager.


startup

public void startup()
This method has to be called before an AspectManager is used.

Specified by:
startup in interface AspectManager

teardown

public void teardown()
This method has to be called before an AspectManager is destroyed.

Specified by:
teardown in interface AspectManager

classLoaded

public void classLoaded(java.lang.Class newClass)
This method is called every time a new class has been successfully loaded and prepared into the system. It implements the functionality needed to update the extensions currently inserted into this extension to the current state of the system. For example, if a new class is loaded that contains join-points cross-cut by an existing crosscut E.C, the crosscut in question will be added as a listener of the JoinPointManager.

Specified by:
classLoaded in interface ch.ethz.prose.engine.ClassLoadListener

getTransactionGroup

private LocalAspectManager.TransactionGroup getTransactionGroup(java.lang.Object transactionId)

prepareInsertExtension

private void prepareInsertExtension(Aspect ext,
                                    java.lang.Object transactionId)

prepareWithdrawExtension

private void prepareWithdrawExtension(Aspect ext,
                                      java.lang.Object transactionId)

finishTransaction

private void finishTransaction(java.lang.Object transactionId,
                               int commitOrAbort)

insert

public void insert(Aspect x,
                   java.lang.Object txId)
Description copied from interface: AspectManager
Insert the aspect ext within the boundaries of the transaction txId. The advice corresponding to this aspects will come into effect only after commiting txId. Two transactions are the same if the txId objects are equal and their hashCode generate the same values.

Specified by:
insert in interface AspectManager

withdraw

public void withdraw(Aspect x,
                     java.lang.Object txId)
Description copied from interface: AspectManager
Withdraw the aspect ext within the boundaries of the transaction txId. The advice corresponding to this aspects will remain into effect only until commiting txId. Two transactions are the same if the txId objects are equal and their hashCode generate the same values.

Specified by:
withdraw in interface AspectManager

insert

public void insert(Aspect x)
Description copied from interface: AspectManager
Insert the aspect asp into this AspectManager The insertion of the crosscuts belonging to the specified aspect is done in the proper order (first crosscut is registered as first). If several aspects extend the same join-points, the oder in which advices are called corresponds to the priority of the

Specified by:
insert in interface AspectManager

withdraw

public void withdraw(Aspect x)
Description copied from interface: AspectManager
Withdraw the aspect ext from this AspectManager. Note that the specified extension has to be the same object as the one to be withdrawn. Because an extension usually has its own state, the application layer using an extension manager has to find out which extension object to withdraw, by inspecting the getAllAspects() set.

Specified by:
withdraw in interface AspectManager

commit

public void commit(java.lang.Object txId)
Description copied from interface: AspectManager
Commit the transaction txId. All woven aspects start executing advice, all unwoven (withdrawn) aspects cease executing advice.

Specified by:
commit in interface AspectManager

abort

public void abort(java.lang.Object txId)
Description copied from interface: AspectManager
Abort the transaction txId. This implies that all aspects withdraw during this transction remain woven, while all aspects inserted during this transaction are never activated.

Specified by:
abort in interface AspectManager

doInsertExtension

public void doInsertExtension(Aspect ext)
                       throws AspectManagerException
Insert the extension ext into the extension manager. This involves registering the ext's crosscut into the current JoinPointManager.


registerCrosscuts

private void registerCrosscuts(Aspect ext,
                               java.lang.Class cls)

doWithdrawExtension

public void doWithdrawExtension(Aspect ext)
Unregister the crosscuts belonging to ext from the corresponding JoinPointManager


getAllAspects

public java.util.List getAllAspects()
Return the list of extensions currently inserted into the system.

Specified by:
getAllAspects in interface AspectManager

getJoinPointManager

public ch.ethz.prose.engine.JoinPointManager getJoinPointManager()
Return the JoinPointManager of this extension manager.

Specified by:
getJoinPointManager in interface AspectManager

isConnectedToVM

public boolean isConnectedToVM()
Return the boolean status that indicates if this extension manager is connected to the VM through its joinpoint manager or if it is the test manager and has no connection to the VM.


withdrawAll

private void withdrawAll()

finalize

protected void finalize()
Remove all inserted extensions from this extension manager, disconnect the joinpoint manager from the JVMAI System and deconstruct it.