xdoclet.plugins
Class ScriptPlugin

java.lang.Object
  |
  +--java.beans.beancontext.BeanContextChildSupport
        |
        +--java.beans.beancontext.BeanContextSupport
              |
              +--xdoclet.beans.BeanContextSupportEx
                    |
                    +--xdoclet.Plugin
                          |
                          +--xdoclet.plugins.ScriptPlugin
All Implemented Interfaces:
BeanContext, BeanContextChild, BeanContextServiceRevokedListener, BeanContextServicesListener, Collection, DesignMode, EventListener, PropertyChangeListener, Serializable, VetoableChangeListener, Visibility
Direct Known Subclasses:
JellyPlugin, VelocityPlugin

public abstract class ScriptPlugin
extends Plugin

Base class for plugins based on scripting.

Version:
$Revision: 1.10 $
Author:
Aslak Hellesøy
See Also:
Serialized Form

Field Summary
 
Fields inherited from class java.beans.beancontext.BeanContextSupport
bcmListeners, children, designTime, locale, okToUseGui
 
Fields inherited from class java.beans.beancontext.BeanContextChildSupport
beanContext, beanContextChildPeer, pcSupport, rejectedSetBCOnce, vcSupport
 
Fields inherited from interface java.beans.beancontext.BeanContext
globalHierarchyLock
 
Fields inherited from interface java.beans.DesignMode
PROPERTYNAME
 
Constructor Summary
ScriptPlugin()
           
 
Method Summary
 Property createProperty()
           
 void execute()
          Generates the content.
protected  void generate(File destinationFile, Collection metaData)
          Generates a file.
protected  void generate(File destinationFile, Object metaData)
          Generates a file.
protected  Map getContextObjects()
          Subclasses can call this method prior to generation to put additional objects on the context.
 String getTemplatePath()
          Gets the template name.
protected  void setContextObject(String name, Object obj)
          Allows subclasses to set an additional object in the context.
 void setTemplatePath(String templateName)
          Sets the path to the template.
protected  void validate()
           
 
Methods inherited from class xdoclet.Plugin
Acleanup, AcreateMetadataCollection, AgetFilenameSubstitutionValue, AgetPackageName, AsetClasspath, checkClass, createAccept, createPackageSubstitution, getDestinationDir, getDestinationFileForAll, getDestinationFileForOne, getEncoding, getFileName, getFilteredMetadataCollection, getMetadataProvider, getName, getPackageName, getXDoclet, isGenerateOneFile, jxpath, setDestination, setDestinationDir, setEncoding, setFileName, setMetadataProvider, setName, setPackageName
 
Methods inherited from class xdoclet.beans.BeanContextSupportEx
add, createInvocations, getInvocations, getParent, setParent
 
Methods inherited from class java.beans.beancontext.BeanContextSupport
addAll, addBeanContextMembershipListener, avoidingGui, bcsChildren, bcsPreDeserializationHook, bcsPreSerializationHook, childDeserializedHook, childJustAddedHook, childJustRemovedHook, classEquals, clear, contains, containsAll, containsKey, copyChildren, createBCSChild, deserialize, dontUseGui, fireChildrenAdded, fireChildrenRemoved, getBeanContextPeer, getChildBeanContextChild, getChildBeanContextMembershipListener, getChildPropertyChangeListener, getChildSerializable, getChildVetoableChangeListener, getChildVisibility, getLocale, getResource, getResourceAsStream, initialize, instantiateChild, isDesignTime, isEmpty, isSerializing, iterator, needsGui, okToUseGui, propertyChange, readChildren, remove, remove, removeAll, removeBeanContextMembershipListener, retainAll, serialize, setDesignTime, setLocale, size, toArray, toArray, validatePendingAdd, validatePendingRemove, vetoableChange, writeChildren
 
Methods inherited from class java.beans.beancontext.BeanContextChildSupport
addPropertyChangeListener, addVetoableChangeListener, firePropertyChange, fireVetoableChange, getBeanContext, getBeanContextChildPeer, initializeBeanContextResources, isDelegated, releaseBeanContextResources, removePropertyChangeListener, removeVetoableChangeListener, serviceAvailable, serviceRevoked, setBeanContext, validatePendingSetBeanContext
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface java.beans.beancontext.BeanContextChild
addPropertyChangeListener, addVetoableChangeListener, getBeanContext, removePropertyChangeListener, removeVetoableChangeListener, setBeanContext
 
Methods inherited from interface java.util.Collection
equals, hashCode
 

Constructor Detail

ScriptPlugin

public ScriptPlugin()
Method Detail

getTemplatePath

public final String getTemplatePath()
Gets the template name.

Returns:
the template name

setTemplatePath

public void setTemplatePath(String templateName)
Sets the path to the template. This should be a relative path. The template will be searched for on the classpath, using the relative path inside jar files or directories.

Parameters:
templateName - relative path to the template to use.

validate

protected void validate()
                 throws XDocletException
Overrides:
validate in class Plugin
XDocletException

execute

public void execute()
             throws IOException,
                    XDocletException
Description copied from class: Plugin
Generates the content.

Overrides:
execute in class Plugin
Throws:
XDocletException
IOException

createProperty

public final Property createProperty()

generate

protected void generate(File destinationFile,
                        Collection metaData)
                 throws IOException,
                        XDocletException
Description copied from class: Plugin
Generates a file.

Specified by:
generate in class Plugin
Parameters:
destinationFile - file to be generated.
metaData - metadata used during generation.
Throws:
IOException - if an IO error occurs.
XDocletException - if generation fails.

generate

protected void generate(File destinationFile,
                        Object metaData)
                 throws IOException,
                        XDocletException
Description copied from class: Plugin
Generates a file.

Specified by:
generate in class Plugin
Parameters:
destinationFile - file to be generated.
metaData - metadata used during generation.
Throws:
XDocletException - if generation fails.
IOException - if an IO error occurs.

getContextObjects

protected final Map getContextObjects()
Subclasses can call this method prior to generation to put additional objects on the context.

Returns:
a Map that will be put on Velocity's context.

setContextObject

protected final void setContextObject(String name,
                                      Object obj)
Allows subclasses to set an additional object in the context.



Copyright © 2000-2003 XDoclet Team. All Rights Reserved.