org.apache.cocoon.ant
Class CocoonTask

java.lang.Object
  extended byorg.apache.tools.ant.ProjectComponent
      extended byorg.apache.tools.ant.Task
          extended byorg.apache.cocoon.ant.CocoonTask

public class CocoonTask
extends org.apache.tools.ant.Task

Ant task for running Cocoon.

Version:
CVS $Id: CocoonTask.java 155061 2005-02-23 20:10:26Z cziegeler $
Author:
huber@apache.org

Nested Class Summary
static class CocoonTask.CocoonFactory
          A factory creating Cocoon objects.
static class CocoonTask.LogLevelOption
          Enumerated attribute with the values "DEBUG", "INFO", "WARN", "ERROR", and "FATAL_ERROR"
 
Field Summary
protected static String DEFAULT_ACCEPT
          Accept header used in the Cocoon processing stage
protected static String DEFAULT_USER_AGENT
          User-agent header used in the Cocoon processing stage
 
Fields inherited from class org.apache.tools.ant.Task
description, location, target, taskName, taskType, wrapper
 
Fields inherited from class org.apache.tools.ant.ProjectComponent
project
 
Constructor Summary
CocoonTask()
          Creates a new instance of CocoonTask
 
Method Summary
protected  void checkValidity()
          Check if all parameters for running Cocoon are set properly
 org.apache.tools.ant.types.Path createClasspath()
          Deprecated. no need for creating an additional classloader
 void execute()
          Execute the ant task launching Cocoon
protected  File getContextDirFile(File contextDir, String name)
          Gets the contextDirFile attribute of the CocoonTask object.
protected  File getDir(String dir, boolean create, String type)
          Get a File representing a directory.
 void setAcceptHeader(String acceptHeader)
          Sets the acceptHeader attribute of the CocoonTask object
 void setAgentHeader(String agentHeader)
          Sets the agentHeader attribute of the CocoonTask object
 void setClasspathRef(org.apache.tools.ant.types.Reference r)
          Adds a reference to a CLASSPATH defined elsewhere.
 void setConfigFile(File configFile)
          Sets the configFile attribute of the CocoonTask object
 void setContextDir(File contextDir)
          Sets the contextDir attribute of the CocoonTask object
 void setDestDir(File destDir)
          Sets the destDir attribute of the CocoonTask object
 void setFollowLinks(boolean followLinks)
          Sets the followLinks attribute of the CocoonTask object
 void setLogger(String logger)
          Sets the logger attribute of the CocoonTask object
 void setLogkitXconf(File logkitXconf)
          Sets the logkitXconf attribute of the CocoonTask object
 void setLogLevel(CocoonTask.LogLevelOption logLevelOption)
          Sets the logLevel attribute of the CocoonTask object
 void setPrecompileOnly(boolean preCompileOnly)
          Sets the precompileOnly attribute of the CocoonTask object
 void setTargets(String targets)
          Sets the targets attribute of the CocoonTask object
 void setWorkDir(File workDir)
          Sets the workDir attribute of the CocoonTask object
 
Methods inherited from class org.apache.tools.ant.Task
getDescription, getLocation, getOwningTarget, getRuntimeConfigurableWrapper, getTaskName, getTaskType, getWrapper, handleErrorFlush, handleErrorOutput, handleFlush, handleInput, handleOutput, init, isInvalid, log, log, maybeConfigure, perform, reconfigure, setDescription, setLocation, setOwningTarget, setRuntimeConfigurableWrapper, setTaskName, setTaskType
 
Methods inherited from class org.apache.tools.ant.ProjectComponent
getProject, setProject
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_USER_AGENT

protected static final String DEFAULT_USER_AGENT
User-agent header used in the Cocoon processing stage


DEFAULT_ACCEPT

protected static final String DEFAULT_ACCEPT
Accept header used in the Cocoon processing stage

See Also:
Constant Field Values
Constructor Detail

CocoonTask

public CocoonTask()
Creates a new instance of CocoonTask

Method Detail

setLogkitXconf

public void setLogkitXconf(File logkitXconf)
Sets the logkitXconf attribute of the CocoonTask object

Parameters:
logkitXconf - The new logkitXconf value

setLogger

public void setLogger(String logger)
Sets the logger attribute of the CocoonTask object

Parameters:
logger - The new logger value

setLogLevel

public void setLogLevel(CocoonTask.LogLevelOption logLevelOption)
Sets the logLevel attribute of the CocoonTask object

Parameters:
logLevelOption - The new logLevel value

setAcceptHeader

public void setAcceptHeader(String acceptHeader)
Sets the acceptHeader attribute of the CocoonTask object

Parameters:
acceptHeader - The new acceptHeader value

setAgentHeader

public void setAgentHeader(String agentHeader)
Sets the agentHeader attribute of the CocoonTask object

Parameters:
agentHeader - The new agentHeader value

setPrecompileOnly

public void setPrecompileOnly(boolean preCompileOnly)
Sets the precompileOnly attribute of the CocoonTask object

Parameters:
preCompileOnly - The new precompileOnly value

setFollowLinks

public void setFollowLinks(boolean followLinks)
Sets the followLinks attribute of the CocoonTask object

Parameters:
followLinks - The new followLinks value

setTargets

public void setTargets(String targets)
Sets the targets attribute of the CocoonTask object

Parameters:
targets - The new targets value

setDestDir

public void setDestDir(File destDir)
Sets the destDir attribute of the CocoonTask object

Parameters:
destDir - The new destDir value

setWorkDir

public void setWorkDir(File workDir)
Sets the workDir attribute of the CocoonTask object

Parameters:
workDir - The new workDir value

setContextDir

public void setContextDir(File contextDir)
Sets the contextDir attribute of the CocoonTask object

Parameters:
contextDir - The new contextDir value

setConfigFile

public void setConfigFile(File configFile)
Sets the configFile attribute of the CocoonTask object

Parameters:
configFile - The new configFile value

setClasspathRef

public void setClasspathRef(org.apache.tools.ant.types.Reference r)
Adds a reference to a CLASSPATH defined elsewhere.

Parameters:
r - The new classpathRef value

createClasspath

public org.apache.tools.ant.types.Path createClasspath()
Deprecated. no need for creating an additional classloader

Creates a nested classpath element.

Returns:
Path created

execute

public void execute()
             throws org.apache.tools.ant.BuildException
Execute the ant task launching Cocoon

Throws:
org.apache.tools.ant.BuildException - thrown if Cocoon processing fails

getContextDirFile

protected File getContextDirFile(File contextDir,
                                 String name)
Gets the contextDirFile attribute of the CocoonTask object. Try to locate a file name relative to Cocoon's context directory. Check ${contextDir}/WEB-INF, ${contextDir}/ locations if there is a file named name.

Parameters:
contextDir - Cocoon's context directory
name - a pure file name
Returns:
File full path of an existing file name, or null

getDir

protected File getDir(String dir,
                      boolean create,
                      String type)
               throws org.apache.tools.ant.BuildException
Get a File representing a directory. Create, and check existance, read- writeability of a directory.

Parameters:
dir - a String with a directory name
type - a String describing the type of directory
create - true if directory should be created
Returns:
a File value
Throws:
org.apache.tools.ant.BuildException - throw if checks fails

checkValidity

protected void checkValidity()
                      throws org.apache.tools.ant.BuildException
Check if all parameters for running Cocoon are set properly

Throws:
org.apache.tools.ant.BuildException - is thrown if at least one parameter is invalid


Copyright ? 1999-2005 The Apache Software Foundation. All Rights Reserved.