org.eclipse.mtl.engine.service
Class MTLDynamicTemplatesRegistry

java.lang.Object
  extended by org.eclipse.mtl.engine.service.MTLDynamicTemplatesRegistry

public final class MTLDynamicTemplatesRegistry
extends java.lang.Object

This will allow MTL to dynamically resolve templates overrides within the modules registered by this registry.

Take note that all modules will be loaded in the registry's resource set if loaded from the registry through addModulesFrom(File).

Since:
0.8

Field Summary
static MTLDynamicTemplatesRegistry INSTANCE
          Singleton instance of the registry.
 
Method Summary
 boolean addModule(Module module)
          Adds a module to the registry.
 boolean addModules(java.util.Collection<Module> modules)
          Adds a set of module to the registry.
 void addModulesFrom(java.io.File file)
          This will register all modules that can be retrieved from file.
 void clearRegistry()
          Clears all registered modules out of the registry.
 void clearRegistryResourceSet()
          This can be used to clear the registry's resource set from manually loaded Modules.
 java.util.Set<Module> getRegisteredModules()
          Returns all registered modules.
 boolean removeModule(Module module)
          Removes a module from the registry.
 boolean removeModules(java.util.Collection<Module> modules)
          Removes a set of modules from the registry.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

INSTANCE

public static final MTLDynamicTemplatesRegistry INSTANCE
Singleton instance of the registry.

Method Detail

addModule

public boolean addModule(Module module)
Adds a module to the registry.

Parameters:
module - Module that is to be registered for dynamic template resolution.
Returns:
true if the set didn't already contain module.

addModules

public boolean addModules(java.util.Collection<Module> modules)
Adds a set of module to the registry.

Parameters:
modules - Modules that are to be registered for dynamic template resolution.
Returns:
true if the set didn't already contain one of the modules contained by modules.

addModulesFrom

public void addModulesFrom(java.io.File file)
This will register all modules that can be retrieved from file.

That is, if file is a directory, this will iterate over all its direct and indirect children (except for "CVS" and ".svn" named sub-directories), then load and register all child representing a module. Otherwise, if file itself represents a module, it will be loaded and registered.

If file is neither a module nor a directory, this will have no effect.

Parameters:
file - The module to register or directory to iterate over for modules.

getRegisteredModules

public java.util.Set<Module> getRegisteredModules()
Returns all registered modules. The returned set is a copy of this instance's.

Returns:
A copy of the registered modules set.

removeModule

public boolean removeModule(Module module)
Removes a module from the registry.

Parameters:
module - Module that is to be removed from dynamic template resolution.
Returns:
true if the set contained module.

removeModules

public boolean removeModules(java.util.Collection<Module> modules)
Removes a set of modules from the registry.

Parameters:
modules - Modules that are to be removed from dynamic template resolution.
Returns:
true if the set has been changed.

clearRegistry

public void clearRegistry()
Clears all registered modules out of the registry.


clearRegistryResourceSet

public void clearRegistryResourceSet()
This can be used to clear the registry's resource set from manually loaded Modules. Take note that modules loaded from extension points will not be cleared by this.


Copyright 2008 Obeo
All Rights Reserved.