|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--java.beans.beancontext.BeanContextChildSupport | +--java.beans.beancontext.BeanContextSupport | +--xdoclet.beans.BeanContextSupportEx | +--xdoclet.Plugin
A Plugin is responsible for the generation of a particular kind of file. It is also an abstraction of underlying generation mechanisms such as Velocity, Jelly and Betwixt.
A plugin also implements BeanContextChild
,
because it might be used in a Java Beans compliant environment such as
an IDE. Therefore, this class is implicitly a Collection
,
and all contained objects (package substitutions etc) are contained directly
in the instances of this class. They are filtered out by various internal
Predicate
s.
A plugin can operate in two different modes, depending on the value of the fileName:
PluginFactory
,
XDoclet
,
Serialized FormField 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 | |
Plugin()
|
Method Summary | |
void |
Acleanup()
|
Collection |
AcreateMetadataCollection()
|
String |
AgetFilenameSubstitutionValue(Object o)
|
String |
AgetPackageName(Object o)
|
void |
AsetClasspath(String classpath)
|
protected static void |
checkClass(String className)
Throws XDocletException if a specific class is not on the CP. |
Accept |
createAccept()
Creates a new Accept |
PackageSubstitution |
createPackageSubstitution()
Creates a new PackageSubstitution |
void |
execute()
Generates the content. |
protected abstract void |
generate(File destinationFile,
Collection metaData)
Generates a file. |
protected abstract void |
generate(File destinationFile,
Object metaData)
Generates a file. |
File |
getDestinationDir()
Returns the destination directory (without package directory). |
File |
getDestinationFileForAll()
Returns the destination file derived from a particular object. |
File |
getDestinationFileForOne(Object object)
Returns the destination file derived from a particular object. |
String |
getEncoding()
Gets the XML encoding. |
String |
getFileName()
|
protected Collection |
getFilteredMetadataCollection()
Gets all accepted objects. |
protected MetadataProvider |
getMetadataProvider()
|
String |
getName()
Gets the name of the plugin. |
String |
getPackageName()
|
XDoclet |
getXDoclet()
|
protected boolean |
isGenerateOneFile()
Indicates whether or not to generate one file per metadata object or one file for all metadata objects. |
Object |
jxpath(Object contextBean,
String xpath)
Hook to JXPath, which lets templates query the datamodel with xpath. |
void |
setDestination(String destination)
Sets the destination directory. |
void |
setDestinationDir(File destinationDir)
Sets (and creates) the destination directory. |
void |
setEncoding(String encoding)
Sets the encoding to use. |
void |
setFileName(String fileName)
Sets the file name of the generated file(s). |
void |
setMetadataProvider(MetadataProvider metadataProvider)
|
void |
setName(String name)
Sets the name of the plugin. |
void |
setPackageName(String packageName)
Sets the package name of the generated files. |
protected void |
validate()
|
Methods inherited from class xdoclet.beans.BeanContextSupportEx |
add, createInvocations, getInvocations, getParent, setParent |
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 |
public Plugin()
Method Detail |
public XDoclet getXDoclet()
public void setMetadataProvider(MetadataProvider metadataProvider)
protected MetadataProvider getMetadataProvider()
public final String getName()
public final void setName(String name)
name
- the name of the plugin.public String getEncoding()
setEncoding(java.lang.String)
public void setEncoding(String encoding)
encoding
- the encoding to use.public File getDestinationDir()
public void setDestinationDir(File destinationDir)
destinationDir
- the directory where the plugin will write its files.public void setDestination(String destination)
destination
- the directory where the plugin will write its files.public void setFileName(String fileName)
fileName
- the name of the generated file(s).public final String getFileName()
public final Accept createAccept()
public final PackageSubstitution createPackageSubstitution()
public void execute() throws IOException, XDocletException
XDocletException
IOException
protected abstract void generate(File destinationFile, Collection metaData) throws IOException, XDocletException
destinationFile
- file to be generated.metaData
- metadata used during generation.
XDocletException
- if generation fails.
IOException
- if an IO error occurs.protected abstract void generate(File destinationFile, Object metaData) throws IOException, XDocletException
destinationFile
- file to be generated.metaData
- metadata used during generation.
XDocletException
- if generation fails.
IOException
- if an IO error occurs.protected void validate() throws XDocletException
XDocletException
protected boolean isGenerateOneFile()
true
if the fileName does not contain "{0}"
.setFileName(java.lang.String)
public final void setPackageName(String packageName)
packageName
- the package name.public final String getPackageName()
protected final Collection getFilteredMetadataCollection() throws XDocletException
createAccept()
and call setPredicate on it, using
a predicate from the xdoclet.util.predicates package. If no predicate
is set, all classes that were parsed will be returned.
XDocletException
public final File getDestinationFileForAll() throws XDocletException
XDocletException
public final File getDestinationFileForOne(Object object) throws XDocletException
object
- the object the generated file is derived from
XDocletException
protected static void checkClass(String className) throws XDocletException
className
- the name of the class to check.
XDocletException
public Object jxpath(Object contextBean, String xpath)
contextBean
- the bean to query.xpath
- the xpath expression.
public final Collection AcreateMetadataCollection() throws XDocletException
XDocletException
public final String AgetFilenameSubstitutionValue(Object o) throws XDocletException
XDocletException
public final String AgetPackageName(Object o)
public final void Acleanup() throws XDocletException
XDocletException
public final void AsetClasspath(String classpath) throws XDocletException
XDocletException
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |