ConForM.CoopnTools.CoKer.CoalaMgr
Class CoalaMgr

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

public class CoalaMgr
extends java.lang.Object

Coala source Manager. This class essentially defines the services provided by the Coala source manager.


Field Summary
static java.lang.String VERSION
          Coopn source Manager version;
 
Constructor Summary
CoalaMgr(CoopnMgr coopnMgr, PackageMgr mgr, CoopnEnv env)
          Constructor.
 
Method Summary
 CoopnMgr coopnMgr()
          Get the associated coopn manager.
 java.lang.String displayModuleName(CoalaModuleName elem)
          ModuleName to String conversion.
 java.lang.String displayName(CoalaName elem)
          Name to String conversion.
 void dispose()
          Leave a coala manager.
 CoalaModuleName evalModuleName(java.lang.String string)
          String to ModuleName conversion.
 CoalaName evalName(java.lang.String string)
          String to Name conversion.
 CoalaModule getAndObserveModule(java.lang.String name, CoalaModuleObserver observer)
          Get a moduland register a module observer.
 java.lang.String[] getDependencies(java.lang.String name)
          Get the dependencies of a module.
 CoalaModule getModule(java.lang.String name)
          Get a module.
 CoopnUser lockCoalaModule(java.lang.String moduleName, CoopnUser user)
          Lock a coala file containg a particular module.
 PackageMgr packageMgr()
          Get the associated package manager.
 void reloadModule(java.lang.String moduleName)
          Reload a coala module from the disk.
 void unlock(java.lang.String moduleName)
          Unlock a coala file containg a particular module.
 void unregisterObserver(java.lang.String name, CoalaModuleObserver observer)
          unregister a module observer.
 void use()
          Uses a coala 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
Coopn source Manager version;
Constructor Detail

CoalaMgr

public CoalaMgr(CoopnMgr coopnMgr,
                PackageMgr mgr,
                CoopnEnv env)
         throws java.lang.IllegalArgumentException
Constructor. Build and use a new coala source manager. If a coala manager is already created, it simply returns. Else, the project specified the the environment is used to configurate the manager and to load the associated project files.
Parameters:
coalaMgr - the associated coala manager
mgr - the associated project manager
env - the environment of the coala manager
Throws:
java.lang.IllegalArgumentException - the environment is absent or inconsistent.
Method Detail

use

public void use()
Uses a coala manager.

dispose

public void dispose()
Leave a coala manager. This method release the resources used by this coala source manager.

packageMgr

public PackageMgr packageMgr()
Get the associated package manager.

coopnMgr

public CoopnMgr coopnMgr()
Get the associated coopn manager.

lockCoalaModule

public CoopnUser lockCoalaModule(java.lang.String moduleName,
                                 CoopnUser user)
Lock a coala file containg a particular module. The coala manager is locked for the user. Other users cannot put locks on particular modules, nor acquire a lock for the coala manager. An user may acquire more than a lock, but it must unlock each of the locks for allowing another one to put locks.
Parameters:
moduleName - the coala module to lock
user - the user who want to acquire the lock

unlock

public void unlock(java.lang.String moduleName)
            throws java.lang.IllegalAccessException
Unlock a coala file containg a particular module. The user unlocks the coala manager.
Parameters:
moduleName - the coala module to lock

getModule

public CoalaModule getModule(java.lang.String name)
                      throws java.lang.IllegalArgumentException
Get a module. Deliver an up-to-date version of the desired module.
Parameters:
name - the module name
Returns:
the CoalaModule corresponding to the name.
Throws:
java.lang.IllegalArgumentException - the module cannot be delivered (because it is not found, erroneous, and so on).

getAndObserveModule

public CoalaModule getAndObserveModule(java.lang.String name,
                                       CoalaModuleObserver observer)
                                throws java.lang.IllegalArgumentException
Get a moduland register a module observer.
Parameters:
name - the module name
observer - the module observer
Returns:
the CoalaModule corresponding to the name.
Throws:
java.lang.IllegalArgumentException - the module cannot be delivered (because it is not found, erroneous, and so on).

unregisterObserver

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

reloadModule

public void reloadModule(java.lang.String moduleName)
                  throws java.lang.IllegalAccessException
Reload a coala module from the disk.
Parameters:
moduleName - the module name
Throws:
java.lang.IllegalArgumentException - the module is not found.
java.lang.IllegalAccessException - the module is not locked.

getDependencies

public java.lang.String[] getDependencies(java.lang.String name)
                                   throws java.lang.IllegalArgumentException
Get the dependencies of a module. An up-to-date version of the module is found, and its dependencies are returned. In other words, this methods returns the list of all modules necessitated to "execute" this module.
Parameters:
name - the module name
Returns:
an array of strings containing all dependencies.
Throws:
java.lang.IllegalArgumentException - the module cannot be delivered (because it is not found, erroneous, and so on).

evalName

public CoalaName evalName(java.lang.String string)
                   throws java.lang.IllegalArgumentException
String to Name conversion. Evaluates a string into a valid Coala name.
Parameters:
string - the string to evaluates
Returns:
the desired Coala element.
Throws:
java.lang.IllegalArgumentException - the element cannot be delivered (because it is erroneous, and so on).

displayName

public java.lang.String displayName(CoalaName elem)
                             throws java.lang.IllegalArgumentException
Name to String conversion. Display a Name into a string representing it.
Parameters:
elem - the element to display
Returns:
the desired string.
Throws:
java.lang.IllegalArgumentException - the string cannot be delivered (because it is erroneous, and so on).

evalModuleName

public CoalaModuleName evalModuleName(java.lang.String string)
                               throws java.lang.IllegalArgumentException
String to ModuleName conversion. Evaluates a string into a valid Coopn module name.
Parameters:
string - the string to evaluates
Returns:
the desired Coopn element.
Throws:
java.lang.IllegalArgumentException - the element cannot be delivered (because it is erroneous, and so on).

displayModuleName

public java.lang.String displayModuleName(CoalaModuleName elem)
                                   throws java.lang.IllegalArgumentException
ModuleName to String conversion. Display a module name into a string representing it.
Parameters:
elem - the element to display
Returns:
the desired string.
Throws:
java.lang.IllegalArgumentException - the string cannot be delivered (because it is erroneous, and so on).