org.argoprint.persistence
Class TemplateMetaFile

java.lang.Object
  extended by org.argoprint.persistence.TemplateMetaFile
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable

public class TemplateMetaFile
extends java.lang.Object
implements java.lang.Cloneable, java.io.Serializable

This class represents the metadata for a template file. This metadata is saved in an XML file in the .argouml/templates directory

Author:
mfortner
See Also:
Serialized Form

Field Summary
static org.apache.log4j.Logger LOG
           
 
Constructor Summary
TemplateMetaFile()
          Constructor
TemplateMetaFile(java.lang.String templateFile, java.lang.String outputFile, java.lang.String name, java.lang.String description, java.lang.String group, java.lang.String category, boolean isDefaultTemplate)
          Constructor
 
Method Summary
 java.lang.Object clone()
           
 java.lang.String getCategory()
          Gets the category for the template.
 java.lang.String getDescription()
          Gets the description for the template.
 java.lang.String getGroup()
          Gets the group for the template.
 java.lang.String getName()
          Gets the name for the template.
 java.lang.String getOutputFile()
          Gets the name of the output file.
 java.lang.String getTemplateFile()
          Gets the location of the template file.
 java.io.InputStream getTemplateStream()
          Read the template out of a file in the classpath.
 java.lang.String getType()
          Gets the extension of the template file.
 boolean isDefaultTemplate()
          Indicates whether or not the template is one of the default templates and thus cannot be deleted or modified.
 boolean isLocalTemplate()
          Indicates whether the template file is stored locally.
 boolean isSelected()
          Indicates whether the template meta file has been selected in a table model.
 void setCategory(java.lang.String category)
          Sets the category of the template.
 void setDefaultTemplate(boolean isDefaultTemplate)
          Determines whether or not the template is one of the default templates and thus cannot be deleted or modified.
 void setDescription(java.lang.String description)
          Sets the description of the template.
 void setGroup(java.lang.String group)
          Sets the group for the template.
 void setName(java.lang.String name)
          Sets the name for the template.
 void setOutputFile(java.lang.String outputFile)
          Sets the output file name used by the template.
 void setSelected(boolean selected)
          Determines whether the template meta file has been selected in a table model.
 void setTemplateFile(java.lang.String templateFile)
          Sets the location of the template file.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

LOG

public static final transient org.apache.log4j.Logger LOG
Constructor Detail

TemplateMetaFile

public TemplateMetaFile(java.lang.String templateFile,
                        java.lang.String outputFile,
                        java.lang.String name,
                        java.lang.String description,
                        java.lang.String group,
                        java.lang.String category,
                        boolean isDefaultTemplate)
Constructor

Parameters:
templateFile - The path to the template file
outputFile - The output file name.
name - The name of the template.
description - A description of the file.
group - A grouping used for the template.
category - A category used for the template.
isDefaultTemplate - Indicates that the template is a default template.

TemplateMetaFile

public TemplateMetaFile()
Constructor

Method Detail

isLocalTemplate

public boolean isLocalTemplate()
Indicates whether the template file is stored locally.

Returns:

getCategory

public java.lang.String getCategory()
Gets the category for the template.

Returns:
the category for the template

setCategory

public void setCategory(java.lang.String category)
Sets the category of the template.

Parameters:
category - the category of the template

getType

public java.lang.String getType()
Gets the extension of the template file.

Returns:
the extension of the template file

getTemplateFile

public java.lang.String getTemplateFile()
Gets the location of the template file.

Returns:

setTemplateFile

public void setTemplateFile(java.lang.String templateFile)
Sets the location of the template file.

Parameters:
templateFile - The template file.

getOutputFile

public java.lang.String getOutputFile()
Gets the name of the output file. The output directory is supplied at file generation time.

Returns:
A string containing the output file name.

setOutputFile

public void setOutputFile(java.lang.String outputFile)
Sets the output file name used by the template.

Parameters:
outputFile - The output file.

getName

public java.lang.String getName()
Gets the name for the template.

Returns:
the name for the template

setName

public void setName(java.lang.String name)
Sets the name for the template.

Parameters:
name - the name for the template

getDescription

public java.lang.String getDescription()
Gets the description for the template.

Returns:
the description for the template.

setDescription

public void setDescription(java.lang.String description)
Sets the description of the template.

Parameters:
description - the description of the template.

getGroup

public java.lang.String getGroup()
Gets the group for the template.

Returns:
the group for the template

setGroup

public void setGroup(java.lang.String group)
Sets the group for the template.

Parameters:
group - the group for the template

isSelected

public boolean isSelected()
Indicates whether the template meta file has been selected in a table model.

Returns:
true if the template has been selected.

setSelected

public void setSelected(boolean selected)
Determines whether the template meta file has been selected in a table model.

Parameters:
selected - whether or not the template is selected.

isDefaultTemplate

public boolean isDefaultTemplate()
Indicates whether or not the template is one of the default templates and thus cannot be deleted or modified.

Returns:

setDefaultTemplate

public void setDefaultTemplate(boolean isDefaultTemplate)
Determines whether or not the template is one of the default templates and thus cannot be deleted or modified.

Parameters:
isDefaultTemplate -

getTemplateStream

public java.io.InputStream getTemplateStream()
                                      throws java.io.IOException
Read the template out of a file in the classpath. The template may be one of the standard templates found in the JAR or they may be a template file found on a web server, or in a local directory

Returns:
null if the file protocol attribute is not supported (i.e. not "file://" or not "http://")
Throws:
java.io.IOException - If there is a problem creating an input stream.

toString

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

clone

public java.lang.Object clone()
                       throws java.lang.CloneNotSupportedException
Overrides:
clone in class java.lang.Object
Throws:
java.lang.CloneNotSupportedException