org.andromda.core.cartridge
Class Resource

java.lang.Object
  extended by org.andromda.core.cartridge.Resource
Direct Known Subclasses:
Template

public class Resource
extends java.lang.Object

This class implements the <resource> tag in a cartridge descriptor file and represents the base cartridge resource element.

Author:
Chad Brandon

Constructor Summary
Resource()
           
 
Method Summary
 Cartridge getCartridge()
          The cartridge that owns this resource.
 java.lang.String getOutlet()
          Gets the logical location to which output from this resource will be written.
 java.lang.String getOutputCondition()
          Gets the outputCondition that must evaluate to true in order for the template to be written.
 java.io.File getOutputLocation(java.lang.Object[] arguments, java.io.File directory, java.lang.String outputPattern)
          Returns the fully qualified name of the resource output to be written, this means: the output pattern has been translated the output directory name has been prepended
 java.lang.String getOutputPattern()
          Gets the pattern that is used to build the name of the output file.
 java.lang.String getPath()
          Gets the path to the cartridge resource.
 boolean isLastModifiedCheck()
          Whether or not a last modified check should be performed before writing the resource.
 boolean isOverwrite()
          Tells us whether output files produced by this resource should be overwritten if they already exist.
 void setCartridge(Cartridge cartridge)
          Sets the Cartridge parent to which this Resource belongs.
 void setLastModifiedCheck(boolean lastModifiedCheck)
          Sets whether or not a last modified check should be performed before writing the resource.
 void setOutlet(java.lang.String outlet)
          Sets the logical location to which output from this resource will be written.
 void setOutputCondition(java.lang.String outputCondition)
          Sets the outputCondition that must evaluate to true in order for the template to be written.
 void setOutputPattern(java.lang.String outputPattern)
          Sets the pattern that is used to build the name of the output file.
 void setOverwrite(boolean overwrite)
          Sets whether output files produced by this resource should be overwritten if they already exist.
 void setPath(java.lang.String path)
          Sets the path to the cartridge resource.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Resource

public Resource()
Method Detail

getOutlet

public java.lang.String getOutlet()
Gets the logical location to which output from this resource will be written.

Returns:
Returns the outlet.

setOutlet

public void setOutlet(java.lang.String outlet)
Sets the logical location to which output from this resource will be written.

Parameters:
outlet - The outlet to set.

setOutputCondition

public void setOutputCondition(java.lang.String outputCondition)
Sets the outputCondition that must evaluate to true in order for the template to be written.

Parameters:
outputCondition - the template engine outputCondition.

getOutputCondition

public java.lang.String getOutputCondition()
Gets the outputCondition that must evaluate to true in order for the template to be written.

Returns:
the template engine outputCondition.

getOutputLocation

public java.io.File getOutputLocation(java.lang.Object[] arguments,
                                      java.io.File directory,
                                      java.lang.String outputPattern)
Returns the fully qualified name of the resource output to be written, this means:

Parameters:
arguments - any arguments to be inserted into the MessageFormat style messages.
directory - the directory to which output will be written.
outputPattern - if undefined, the value of getOutputPattern() will be used.
Returns:
File absolute directory.

isOverwrite

public boolean isOverwrite()
Tells us whether output files produced by this resource should be overwritten if they already exist. Overwriting can be turned on and off for entire cartridges by setting the overwrite property in a namespace. This is useful for cartridge developers when they always want produced resources to be overwritten at first.

Returns:
Returns the overwrite.

setOverwrite

public void setOverwrite(boolean overwrite)
Sets whether output files produced by this resource should be overwritten if they already exist.

Parameters:
overwrite - The overwrite to set.

setLastModifiedCheck

public void setLastModifiedCheck(boolean lastModifiedCheck)
Sets whether or not a last modified check should be performed before writing the resource.

Parameters:
lastModifiedCheck - true/false

isLastModifiedCheck

public boolean isLastModifiedCheck()
Whether or not a last modified check should be performed before writing the resource.

Returns:
true/false

getPath

public java.lang.String getPath()
Gets the path to the cartridge resource.

Returns:
Returns the path.

setPath

public void setPath(java.lang.String path)
Sets the path to the cartridge resource.

Parameters:
path - The path to set.

getCartridge

public Cartridge getCartridge()
The cartridge that owns this resource.

Returns:
Returns the owning cartridge.

setCartridge

public void setCartridge(Cartridge cartridge)
Sets the Cartridge parent to which this Resource belongs.

Parameters:
cartridge - the parent Cartridge to set.

setOutputPattern

public void setOutputPattern(java.lang.String outputPattern)
Sets the pattern that is used to build the name of the output file.

Parameters:
outputPattern - the pattern in java.text.MessageFormat syntax

getOutputPattern

public java.lang.String getOutputPattern()
Gets the pattern that is used to build the name of the output file.

Returns:
String the pattern in java.text.MessageFormat syntax


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