org.spicefactory.pimento.generator.ant
Class AbstractCinnamonGeneratorTask

java.lang.Object
  extended by org.apache.tools.ant.ProjectComponent
      extended by org.apache.tools.ant.Task
          extended by org.spicefactory.pimento.generator.ant.AbstractCinnamonGeneratorTask
All Implemented Interfaces:
Cloneable
Direct Known Subclasses:
CinnamonGeneratorTask, SpringGeneratorTask

public abstract class AbstractCinnamonGeneratorTask
extends org.apache.tools.ant.Task

Abstract base class for Ant Task that generates AS3 source code for service interfaces and proxies and Parsley XML configuration files. The two concrete implementations are SpringGeneratorTask for setups that use Spring for configuration and CinnamonGeneratorTask for Cinnamon's custom XML configuration format.

Author:
Jens Halm

Field Summary
 
Fields inherited from class org.apache.tools.ant.Task
target, taskName, taskType, wrapper
 
Fields inherited from class org.apache.tools.ant.ProjectComponent
description, location, project
 
Constructor Summary
AbstractCinnamonGeneratorTask()
           
 
Method Summary
 void addAs3SourceGenerator(SourceGeneratorSettings settings)
          Adds the settings for generating AS3 service interfaces and proxies.
 void addPackageMapping(Mapping mapping)
          Adds a mapping that maps Java package names to AS3 package names.
 void addParsleyConfigGenerator(ConfigGeneratorSettings settings)
          Adds the settings for generating the Parsley XML configuration file.
 void addTypeMapping(Mapping mapping)
          Adds a mapping that maps Java class names to AS3 class names.
protected abstract  ConfigurationBuilder createConfigurationBuilder(File configFile)
          Creates the ConfigurationBuilder implementation this Ant Task should use.
 void execute()
           
 void setConfigFile(File configFile)
          Sets the Cinnamon configuration file.
 void setNamingStrategy(String namingStrategy)
          Sets the naming strategy to use for generating class names for proxies from the names of the service interfaces.
 void setTemplateDir(File templateDir)
          Sets the directory where all FreeMarker templates used by this Task are located.
 
Methods inherited from class org.apache.tools.ant.Task
bindToOwner, getOwningTarget, getRuntimeConfigurableWrapper, getTaskName, getTaskType, getWrapper, handleErrorFlush, handleErrorOutput, handleFlush, handleInput, handleOutput, init, isInvalid, log, log, log, log, maybeConfigure, perform, reconfigure, setOwningTarget, setRuntimeConfigurableWrapper, setTaskName, setTaskType
 
Methods inherited from class org.apache.tools.ant.ProjectComponent
clone, getDescription, getLocation, getProject, setDescription, setLocation, setProject
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AbstractCinnamonGeneratorTask

public AbstractCinnamonGeneratorTask()
Method Detail

setConfigFile

public void setConfigFile(File configFile)
Sets the Cinnamon configuration file. The required type of this file depends on the value of the configMode property. If the value is spring this file must be a Spring configuration file, otherwise it has to be Cinnamons own XML format.

Parameters:
configFile - the Cinnamon configuration file.

setTemplateDir

public void setTemplateDir(File templateDir)
Sets the directory where all FreeMarker templates used by this Task are located. The Ant Task needs the following three files in that directory: interface.ftl, implementation.ftl and configuration.ftl.

Parameters:
templateDir - the directory where all FreeMarker templates used by this Task are located

setNamingStrategy

public void setNamingStrategy(String namingStrategy)
Sets the naming strategy to use for generating class names for proxies from the names of the service interfaces.

Parameters:
namingStrategy - the naming strategy to use

addAs3SourceGenerator

public void addAs3SourceGenerator(SourceGeneratorSettings settings)
Adds the settings for generating AS3 service interfaces and proxies.

Parameters:
settings - the settings for generating AS3 service interfaces and proxies

addParsleyConfigGenerator

public void addParsleyConfigGenerator(ConfigGeneratorSettings settings)
Adds the settings for generating the Parsley XML configuration file.

Parameters:
settings - the settings for generating the Parsley XML configuration file

addPackageMapping

public void addPackageMapping(Mapping mapping)
Adds a mapping that maps Java package names to AS3 package names. This mapping type will be used for AS3 service interfaces and proxy classes.

Parameters:
mapping - a mapping that maps Java package names to AS3 package names

addTypeMapping

public void addTypeMapping(Mapping mapping)
Adds a mapping that maps Java class names to AS3 class names. This mapping type will be used for method parameters and result types.

Parameters:
mapping - a mapping that maps Java class names to AS3 class names

execute

public void execute()
             throws org.apache.tools.ant.BuildException
Overrides:
execute in class org.apache.tools.ant.Task
Throws:
org.apache.tools.ant.BuildException

createConfigurationBuilder

protected abstract ConfigurationBuilder createConfigurationBuilder(File configFile)
Creates the ConfigurationBuilder implementation this Ant Task should use.

There are two builtin implementation: SpringConfigurationBuilder which uses a Spring ApplicationContext for configuration and XmlConfigurationParser which processes Cinnamon's own custom XML configuration format.

Parameters:
configFile - the file to load the configuration from
Returns:
the ConfigurationBuilder implementation this Ant Task should use