org.andromda.core.common
Class BasePlugin

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

public abstract class BasePlugin
extends BaseNamespaceComponent
implements Plugin

Represents the base plugin of AndroMDA. All Plugin instances inherit from this class.

Author:
Chad Brandon

Constructor Summary
BasePlugin()
           
 
Method Summary
 void addMacrolibrary(java.lang.String macrolibrary)
          Adds a macro library to the TemplateEngine used by this BasePlugin.
 void addPropertyReference(java.lang.String reference)
          Adds a property reference.
 void addTemplateObject(TemplateObject templateObject)
          Adds the templateObject to the collection of template objects that will be made available to the plugin during processing.
 java.util.List getContents()
          Returns a list containing the name of each resource contained within the plugin.
protected  org.apache.log4j.Logger getLogger()
          Retrieves the logger instance that should be used for logging output for the plugin sub classes.
protected  java.net.URL getMergeLocation()
          Gets the current merge location for this plugin.
 java.lang.String[] getPropertyReferences()
          Gets all property references available for this cartridge.
 TemplateEngine getTemplateEngine()
          Gets the TemplateEngine which implements the template processing.
 java.util.Collection getTemplateObjects()
          Returns all the TemplateObject objects that are available to this Plugin.
 void initialize()
          Initializes the plugin.
protected  void populateTemplateContext(java.util.Map templateContext)
          Populates the templateContext with the properties and template objects defined in the plugin's descriptor.
 void setTemplateEngineClass(java.lang.String templateEngineClass)
          Sets the template engine class for this cartridge.
 void shutdown()
          Shuts down the plugin.
 java.lang.String 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

BasePlugin

public BasePlugin()
Method Detail

initialize

public void initialize()
                throws java.lang.Exception
Description copied from interface: Plugin
Initializes the plugin.

Specified by:
initialize in interface Plugin
Throws:
java.lang.Exception
See Also:
Plugin.initialize()

getMergeLocation

protected java.net.URL getMergeLocation()
Gets the current merge location for this plugin.

Returns:
the merge location (a file path).

shutdown

public void shutdown()
Description copied from interface: Plugin
Shuts down the plugin. The meaning of this is defined by the plugin itself. At least, it should close any logfiles.

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

addTemplateObject

public void addTemplateObject(TemplateObject templateObject)
Adds the templateObject to the collection of template objects that will be made available to the plugin during processing.

Parameters:
templateObject - the TemplateObject to add.

addMacrolibrary

public void addMacrolibrary(java.lang.String macrolibrary)
Adds a macro library to the TemplateEngine used by this BasePlugin.

Parameters:
macrolibrary -

getTemplateObjects

public java.util.Collection getTemplateObjects()
Description copied from interface: Plugin
Returns all the TemplateObject objects that are available to this Plugin.

Specified by:
getTemplateObjects in interface Plugin
Returns:
a collection of TemplateObjects.
See Also:
Plugin.getTemplateObjects()

setTemplateEngineClass

public void setTemplateEngineClass(java.lang.String templateEngineClass)
Sets the template engine class for this cartridge.

Parameters:
templateEngineClass - the Class of the template engine implementation.

getTemplateEngine

public TemplateEngine getTemplateEngine()
Description copied from interface: Plugin
Gets the TemplateEngine which implements the template processing.

Specified by:
getTemplateEngine in interface Plugin
Returns:
TemplateEngine
See Also:
Plugin.getTemplateEngine()

getPropertyReferences

public java.lang.String[] getPropertyReferences()
Description copied from interface: Plugin
Gets all property references available for this cartridge. This is an array of names corresponding to property references.

Specified by:
getPropertyReferences in interface Plugin
Returns:
the Map of property references.
See Also:
Plugin.getPropertyReferences()

addPropertyReference

public void addPropertyReference(java.lang.String reference)
Adds a property reference. Property references are those properties that are expected to be supplied by the calling client. These supplied properties are made available to the template during processing.

Parameters:
reference - the namespace of the reference.

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.

Parameters:
templateContext - the context of the template to populate.

getContents

public java.util.List getContents()
Description copied from interface: Plugin
Returns a list containing the name of each resource contained within the plugin.

Specified by:
getContents in interface Plugin
See Also:
Plugin.getContents()

getLogger

protected org.apache.log4j.Logger getLogger()
Retrieves the logger instance that should be used for logging output for the plugin sub classes.

Returns:
the logger.

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object
See Also:
Object.toString()


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