ConForM.CoopnTools.CoKer.AspectMgr
Class AspectMgr

java.lang.Object
  |
  +--ConForM.CoopnTools.CoKer.AspectMgr.AspectMgr

public class AspectMgr
extends java.lang.Object

Aspect Manager. This class essentially defines the services provided by the aspect manager.


Field Summary
static java.lang.String VERSION
          Package Manager version;
 
Constructor Summary
AspectMgr(PackageMgr packageMgr, CoopnEnv env)
          Constructor.
 
Method Summary
 java.lang.String aspectModule(CoopnSyntacticElement element, CoopnSyntacticSymbol symbol, java.lang.String elementDescr)
          Return the standard name of aspect module for syntactic elements of particular symbol.
 java.lang.String aspectModule(CoopnSyntacticModule mod)
          Return the standard name of aspect module for syntactic modules.
 java.lang.String aspectModule(CoopnSyntacticSymbol symbol)
          Return the standard name of aspect module for syntactic symbols.
 java.lang.String aspectModule(java.lang.String moduleName)
          Return the standard name of aspect module for a module given by its name.
 java.lang.String aspectName(CoopnSyntacticElement element, CoopnSyntacticSymbol symbol, java.lang.String elementDescr)
          Return the standard name of aspect for syntactic elements of particular symbol.
 java.lang.String aspectName(CoopnSyntacticModule mod)
          Return the standard name of aspect for syntactic modules.
 java.lang.String aspectName(CoopnSyntacticSymbol symbol)
          Return the standard name of aspect for syntactic symbols.
 java.lang.String aspectName(java.lang.String moduleName)
          Return the standard name of aspect for a module given by its name.
 void createAspectModule(java.lang.String aspectName)
          Creates a package.
 boolean defined(java.lang.String module)
          Look if the aspect module containing an element is already defined.
 void dispose()
          Leave a package manager.
 Aspect getAspect(java.lang.String module, java.lang.String name)
          Get the aspect of an element.
 CoopnUser lockModule(java.lang.String aspectName, CoopnUser user)
          Lock an aspect module.
 PackageMgr packageMgr()
          Get the associated package manager.
 void registerObserver(java.lang.String aspectName, AspectModuleObserver observer)
          Register an aspect module observer.
 void reloadAspectModule(java.lang.String aspectName)
          Reload an aspect module from the disk.
 void setAspect(java.lang.String module, java.lang.String name, Aspect aspect)
          Set the aspect of an element.
 void unlockModule(java.lang.String aspectName)
          Unlock an aspect module.
 void unregisterObserver(java.lang.String aspectName, AspectModuleObserver observer)
          unregister an aspect module observer.
 void use()
          Uses an aspect manager.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

VERSION

public static final java.lang.String VERSION
Package Manager version;
Constructor Detail

AspectMgr

public AspectMgr(PackageMgr packageMgr,
                 CoopnEnv env)
          throws java.lang.IllegalArgumentException
Constructor. Build and use a new aspect manager.
Parameters:
packageMgr - the associated package manager
env - the environment of the aspect manager
Throws:
java.lang.IllegalArgumentException - the environment is absent or inconsistent.
java.io.IOException - error was detected when loading the package files used by the project.
Method Detail

use

public void use()
Uses an aspect manager.

dispose

public void dispose()
Leave a package manager. This method release the resources used by this manager, if it is not used any more.

packageMgr

public PackageMgr packageMgr()
Get the associated package manager.

aspectModule

public java.lang.String aspectModule(java.lang.String moduleName)
Return the standard name of aspect module for a module given by its name.

aspectModule

public java.lang.String aspectModule(CoopnSyntacticModule mod)
Return the standard name of aspect module for syntactic modules.

aspectModule

public java.lang.String aspectModule(CoopnSyntacticSymbol symbol)
Return the standard name of aspect module for syntactic symbols.

aspectModule

public java.lang.String aspectModule(CoopnSyntacticElement element,
                                     CoopnSyntacticSymbol symbol,
                                     java.lang.String elementDescr)
Return the standard name of aspect module for syntactic elements of particular symbol.
Parameters:
element - the element
symbol - the symbol
elementDescr - a description of the element; a String or null

aspectName

public java.lang.String aspectName(java.lang.String moduleName)
Return the standard name of aspect for a module given by its name.

aspectName

public java.lang.String aspectName(CoopnSyntacticModule mod)
Return the standard name of aspect for syntactic modules.

aspectName

public java.lang.String aspectName(CoopnSyntacticSymbol symbol)
Return the standard name of aspect for syntactic symbols.

aspectName

public java.lang.String aspectName(CoopnSyntacticElement element,
                                   CoopnSyntacticSymbol symbol,
                                   java.lang.String elementDescr)
Return the standard name of aspect for syntactic elements of particular symbol.
Parameters:
element - the element
symbol - the symbol
elementDescr - a description of the element; a String or null

defined

public boolean defined(java.lang.String module)
                throws java.lang.IllegalArgumentException
Look if the aspect module containing an element is already defined. The element is identified by a name and a module name.
Parameters:
module - the module
Returns:
true iff the module defining the element is already defined.
Throws:
java.lang.IllegalArgumentException - the aspect cannot be delivered (because it is not found, erroneous, and so on).

getAspect

public Aspect getAspect(java.lang.String module,
                        java.lang.String name)
                 throws java.lang.IllegalArgumentException
Get the aspect of an element. Deliver an up-to-date version of the desired aspect. The element is identified by a name and a module name.
Parameters:
module - the module
name - the name
Returns:
the aspect of the symbol.
Throws:
java.lang.IllegalArgumentException - the aspect cannot be delivered (because it is not found, erroneous, and so on).

setAspect

public void setAspect(java.lang.String module,
                      java.lang.String name,
                      Aspect aspect)
               throws java.lang.IllegalAccessException
Set the aspect of an element. Store a version of the desired aspect. The element is identified by a name and a module name.
Parameters:
module - the module
name - the name
aspect - the aspect of the element.
Throws:
java.lang.IllegalArgumentException - the aspect cannot be stored.
java.lang.IllegalAccessException - locking error

registerObserver

public void registerObserver(java.lang.String aspectName,
                             AspectModuleObserver observer)
                      throws java.lang.IllegalArgumentException
Register an aspect module observer.
Parameters:
aspectName - the aspect module name
observer - the aspect module observer
Throws:
java.lang.IllegalArgumentException - A problem occured with the environment.

unregisterObserver

public void unregisterObserver(java.lang.String aspectName,
                               AspectModuleObserver observer)
unregister an aspect module observer.
Parameters:
aspectName - the aspect name
observer - the aspect module observer
Throws:
java.lang.IllegalArgumentException - A problem occured with the environment.

reloadAspectModule

public void reloadAspectModule(java.lang.String aspectName)
                        throws java.lang.IllegalAccessException
Reload an aspect module from the disk.
Parameters:
aspectName - the aspect name
Throws:
java.lang.IllegalArgumentException - the package is not found.
java.lang.IllegalAccessException - the package is not locked.

createAspectModule

public void createAspectModule(java.lang.String aspectName)
                        throws java.lang.IllegalAccessException
Creates a package.
Parameters:
packageName - the package name
comment - the associated comment; may be null
version - the package version; may be null
date - the package date; may be null
Throws:
java.lang.IllegalArgumentException - problem with arguments.
java.lang.IllegalAccessException - the package is not locked.

lockModule

public CoopnUser lockModule(java.lang.String aspectName,
                            CoopnUser user)
Lock an aspect module. Only one lock may exist on an aspect module at the same time. Only locked modules may be modified.
Parameters:
aspectName - the package to lock
user - the user who want to acquire the lock
Returns:
null iff this operation succeeded, i.e. if the lock is granted; the user which already has the lock else.
Throws:
java.lang.IllegalArgumentException - an argument is illegal

unlockModule

public void unlockModule(java.lang.String aspectName)
Unlock an aspect module. If the package module was locked, it is stored on disk (if needed). Else, nothing happens...