org.apache.lenya.cms.authoring
Class DefaultCreator

java.lang.Object
  extended by org.apache.lenya.cms.authoring.DefaultCreator
All Implemented Interfaces:
ParentChildCreatorInterface
Direct Known Subclasses:
DefaultBranchCreator, DefaultLeafCreator

public abstract class DefaultCreator
extends java.lang.Object
implements ParentChildCreatorInterface


Field Summary
static java.lang.String RESOURCE_META_NAME
           
static java.lang.String RESOURCE_NAME
           
static java.lang.String SAMPLE_META_NAME
           
static java.lang.String SAMPLE_NAME
           
 
Fields inherited from interface org.apache.lenya.cms.authoring.ParentChildCreatorInterface
BRANCH_NODE, LEAF_NODE
 
Constructor Summary
DefaultCreator()
           
 
Method Summary
 void create(Publication publication, java.io.File samplesDir, java.io.File parentDir, java.lang.String parentId, java.lang.String childId, short childType, java.lang.String childName, java.lang.String language, java.util.Map parameters)
          DOCUMENT ME!
 java.lang.String generateTreeId(java.lang.String childId, short childType)
          Generate a tree id by returning the child ID.
protected abstract  java.lang.String getChildFileName(Publication publication, java.lang.String area, java.lang.String parentId, java.lang.String childId, java.lang.String language)
          Deprecated. because it implies not to use the DocumentIdToPathMapper Get the file name of the child
protected  java.lang.String getChildMetaFileName(java.io.File parentDir, java.lang.String childId, java.lang.String language)
          Get the file name of the meta file
 java.lang.String getChildName(java.lang.String childname)
          Create Child Name for tree entry
 short getChildType(short childType)
          Return the child type by simply returning the child type.
protected  java.lang.String getLanguageSuffix(java.lang.String language)
          Create the language suffix for a file name given a language string
 java.lang.String getSampleResourceName()
          Get filename of template/sample
 void init(org.apache.avalon.framework.configuration.Configuration conf)
          Configures the Creator, based on a configuration file.
protected  void transformMetaXML(org.w3c.dom.Document doc, java.lang.String childId, short childType, java.lang.String childName, java.util.Map parameters)
          Apply some transformation on the meta file of newly created child.
protected  void transformXML(org.w3c.dom.Document doc, java.lang.String childId, short childType, java.lang.String childName, java.util.Map parameters)
          Apply some transformation on the newly created child.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

RESOURCE_NAME

public static final java.lang.String RESOURCE_NAME
See Also:
Constant Field Values

RESOURCE_META_NAME

public static final java.lang.String RESOURCE_META_NAME
See Also:
Constant Field Values

SAMPLE_NAME

public static final java.lang.String SAMPLE_NAME
See Also:
Constant Field Values

SAMPLE_META_NAME

public static final java.lang.String SAMPLE_META_NAME
See Also:
Constant Field Values
Constructor Detail

DefaultCreator

public DefaultCreator()
Method Detail

init

public void init(org.apache.avalon.framework.configuration.Configuration conf)
Description copied from interface: ParentChildCreatorInterface
Configures the Creator, based on a configuration file.

Specified by:
init in interface ParentChildCreatorInterface
Parameters:
conf - DOCUMENT ME!
See Also:
ParentChildCreatorInterface.init(Configuration)

generateTreeId

public java.lang.String generateTreeId(java.lang.String childId,
                                       short childType)
                                throws java.lang.Exception
Generate a tree id by returning the child ID.

Specified by:
generateTreeId in interface ParentChildCreatorInterface
Parameters:
childId - a String value
childType - a short value
Returns:
a String value
Throws:
java.lang.Exception - if an error occurs

getChildType

public short getChildType(short childType)
                   throws java.lang.Exception
Return the child type by simply returning the child type.

Specified by:
getChildType in interface ParentChildCreatorInterface
Parameters:
childType - a short value
Returns:
a short value
Throws:
java.lang.Exception - if an error occurs

getChildName

public java.lang.String getChildName(java.lang.String childname)
                              throws java.lang.Exception
Create Child Name for tree entry

Specified by:
getChildName in interface ParentChildCreatorInterface
Parameters:
childname - a String value
Returns:
a String for Child Name for tree entry
Throws:
java.lang.Exception - if an error occurs

create

public void create(Publication publication,
                   java.io.File samplesDir,
                   java.io.File parentDir,
                   java.lang.String parentId,
                   java.lang.String childId,
                   short childType,
                   java.lang.String childName,
                   java.lang.String language,
                   java.util.Map parameters)
            throws java.lang.Exception
DOCUMENT ME!

Specified by:
create in interface ParentChildCreatorInterface
Parameters:
samplesDir - DOCUMENT ME!
parentDir - DOCUMENT ME!
childId - DOCUMENT ME!
childType - DOCUMENT ME!
childName - the name of the child
language - for which the document is created
parameters - additional parameters that can be considered when creating the child
publication - the publication context.
parentId - the parent id of the new document
Throws:
java.lang.Exception - DOCUMENT ME!

transformXML

protected void transformXML(org.w3c.dom.Document doc,
                            java.lang.String childId,
                            short childType,
                            java.lang.String childName,
                            java.util.Map parameters)
                     throws java.lang.Exception
Apply some transformation on the newly created child.

Parameters:
doc - the xml document
childId - the id of the child
childType - the type of child
childName - the name of the child
parameters - additional parameters that can be used in the transformation
Throws:
java.lang.Exception - if the transformation fails

transformMetaXML

protected void transformMetaXML(org.w3c.dom.Document doc,
                                java.lang.String childId,
                                short childType,
                                java.lang.String childName,
                                java.util.Map parameters)
                         throws java.lang.Exception
Apply some transformation on the meta file of newly created child.

Parameters:
doc - the xml document
childId - the id of the child
childType - the type of child
childName - the name of the child
parameters - additional parameters that can be used in the transformation
Throws:
java.lang.Exception - if the transformation fails

getChildFileName

protected abstract java.lang.String getChildFileName(Publication publication,
                                                     java.lang.String area,
                                                     java.lang.String parentId,
                                                     java.lang.String childId,
                                                     java.lang.String language)
Deprecated. because it implies not to use the DocumentIdToPathMapper Get the file name of the child

Parameters:
parentDir - the parent directory
childId - the id of the child
language - for which the document is created
Returns:
the file name of the child

getChildMetaFileName

protected java.lang.String getChildMetaFileName(java.io.File parentDir,
                                                java.lang.String childId,
                                                java.lang.String language)
Get the file name of the meta file

Parameters:
parentDir - the parent directory
childId - the id of the child
language - for which the document is created
Returns:
the name of the meta file

getLanguageSuffix

protected java.lang.String getLanguageSuffix(java.lang.String language)
Create the language suffix for a file name given a language string

Parameters:
language - the language
Returns:
the suffix for the language dependant file name

getSampleResourceName

public java.lang.String getSampleResourceName()
Get filename of template/sample



Copyright © 1999-2005 Apache Software Foundation. All Rights Reserved.