org.andromda.core.cartridge
Class Cartridge

java.lang.Object
  extended by org.andromda.core.namespace.BaseNamespaceComponent
      extended by org.andromda.core.common.BasePlugin
          extended by org.andromda.core.cartridge.Cartridge
All Implemented Interfaces:
Plugin, NamespaceComponent

public class Cartridge
extends BasePlugin

The AndroMDA Cartridge implementation of the Plugin. Cartridge instances are configured from META-INF/andromda/cartridge.xml files discovered on the classpath.

Author:
Matthias Bohlen , Chad Brandon

Constructor Summary
Cartridge()
           
 
Method Summary
 void addCondition(java.lang.String name, java.lang.String value)
          Adds the outputCondition given the name and value to the outputConditions map.
 void addResource(Resource resource)
          Adds a resource to the list of defined resources.
 java.util.Map getConditions()
          Gets the current outputConditions defined within this cartridge
 java.util.List getResources()
          Returns the list of templates configured in this cartridge.
protected  void populateTemplateContext(java.util.Map templateContext)
          Populates the templateContext with the properties and template objects defined in the plugin's descriptor.
 void processModelElements(MetafacadeFactory factory)
          Processes all model elements with relevant stereotypes by retrieving the model elements from the model facade contained within the context.
protected  void processResource(Resource resource)
          Processes the given resource
protected  void processTemplate(MetafacadeFactory factory, Template template)
          Processes the given template.
protected  void processTemplateWithMetafacades(MetafacadeFactory factory, Template template)
          Processes all modelElements for this template.
protected  void processTemplateWithoutMetafacades(Template template)
          Processes the template without metafacades.
 void shutdown()
          Override to provide cartridge specific shutdown (
 
Methods inherited from class org.andromda.core.common.BasePlugin
addMacrolibrary, addPropertyReference, addTemplateObject, getContents, getLogger, getMergeLocation, getPropertyReferences, getTemplateEngine, getTemplateObjects, initialize, setTemplateEngineClass, toString
 
Methods inherited from class org.andromda.core.namespace.BaseNamespaceComponent
getNamespace, getResource, setNamespace, setResource
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.andromda.core.namespace.NamespaceComponent
getNamespace, getResource, setNamespace, setResource
 

Constructor Detail

Cartridge

public Cartridge()
Method Detail

processModelElements

public void processModelElements(MetafacadeFactory factory)
Processes all model elements with relevant stereotypes by retrieving the model elements from the model facade contained within the context.

Parameters:
factory - the metafacade factory (which is used to manage the lifecycle of metafacades).

processTemplate

protected void processTemplate(MetafacadeFactory factory,
                               Template template)
Processes the given template.

Parameters:
factory - the metafacade factory instance.
template - the Template instance to process.

processTemplateWithMetafacades

protected void processTemplateWithMetafacades(MetafacadeFactory factory,
                                              Template template)
Processes all modelElements for this template.

Parameters:
factory - the metafacade factory
template - the template to process

processTemplateWithoutMetafacades

protected void processTemplateWithoutMetafacades(Template template)
Processes the template without metafacades. This is useful if you need to generate something that is part of your cartridge, however you only need to use a property passed in from a namespace or a template object defined in your cartridge descriptor.

Parameters:
template - the template to process.

processResource

protected void processResource(Resource resource)
Processes the given resource

Parameters:
resource - the resource to process.

getResources

public java.util.List getResources()
Returns the list of templates configured in this cartridge.

Returns:
List the template list.

addResource

public void addResource(Resource resource)
Adds a resource to the list of defined resources.

Parameters:
resource - the new resource to add

populateTemplateContext

protected void populateTemplateContext(java.util.Map templateContext)
Populates the templateContext with the properties and template objects defined in the plugin's descriptor. If the templateContext is null, a new Map instance will be created before populating the context.

Overrides:
populateTemplateContext in class BasePlugin
Parameters:
templateContext - the context of the template to populate.

addCondition

public void addCondition(java.lang.String name,
                         java.lang.String value)
Adds the outputCondition given the name and value to the outputConditions map.

Parameters:
name - the name of the outputCondition.
value - the value of the outputCondition.

getConditions

public java.util.Map getConditions()
Gets the current outputConditions defined within this cartridge


shutdown

public void shutdown()
Override to provide cartridge specific shutdown (

Specified by:
shutdown in interface Plugin
Overrides:
shutdown in class BasePlugin
See Also:
Plugin.shutdown()


Copyright © 2003-2008 AndroMDA.org. All Rights Reserved.