org.hibernate.tool.hbm2x.doc
Class DocFileManager

java.lang.Object
  extended by org.hibernate.tool.hbm2x.doc.DocFileManager

public class DocFileManager
extends Object

Class used to manage the files created during the documentation generation process. This manager is needed to manage references between files.

Author:
Ricardo C. Moral, Amit Bhayani

Constructor Summary
DocFileManager(DocHelper docHelper, File pRootFolder)
          Constructor.
 
Method Summary
static void copy(ClassLoader loader, String fileName, File to)
          Copy a File.
 DocFile getAllEntitiesDocFile()
          Returns the DocFile responsible for generating allclasses.html
 DocFile getAllPackagesDocFile()
          Returns the DocFile responsible for generating allpackages.html
 DocFile getAllSchemasDocFile()
          Return the all schemas DocFile.
 DocFile getAllTablesDocFile()
          Return the all tables DocFile.
 DocFolder getAssetsDocFolder()
          Returns the DocFolder for the helper files.
 DocFile getClassIndexDocFile()
          Returns the class index DocFile
 DocFile getClassSummaryFile()
          Returns the summary index DocFile
 DocFile getCssStylesDocFile()
          Returns the DocFile for the CSS definitions.
 DocFile getEntityDocFile(POJOClass pc)
          Returns the DocFile responsible to generate the .html for each classes.
 DocFile getEntityDocFileByDeclarationName(POJOClass pc)
          Get the DocFile corresponding to POJOClass.
 DocFile getExtendsImageDocFile()
          Returns the DocFile for the extends Image.
 DocFile getHibernateImageDocFile()
          Returns the DocFile for the Hibernate Image.
 DocFile getMainIndexDocFile()
          Returns the DocFile for the main index.
 DocFile getPackageEntityListDocFile(String packageName)
          Returns the DocFile responsible to generate classes.html corresponding to packageName passed
 DocFile getPackageSummaryDocFile(String packageName)
          get DocFile responsible to generate summary.html for corresponding packageName passed
 String getRef(DocFile from, DocFile to)
          Return the relative reference between the specified files.
 DocFolder getRootDocFolder()
           
 DocFile getSchemaSummaryDocFile(String schemaName)
          Return the summary DocFile for the specified schema FQN.
 DocFile getSchemaTableListDocFile(String schemaName)
          Return the Table List DocFile for the specified schema FQN.
 DocFile getTableDocFile(org.hibernate.mapping.Table table)
          Return the DocFile for the specified Table.
 DocFile getTableIndexDocFile()
          Return the table index DocFile.
 DocFile getTableSummaryDocFile()
          Return the table summary DocFile.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DocFileManager

public DocFileManager(DocHelper docHelper,
                      File pRootFolder)
Constructor.

Parameters:
docHelper - the doc helper.
pRootFolder - the root folder for the documentation.
Method Detail

getRootDocFolder

public DocFolder getRootDocFolder()

getAssetsDocFolder

public DocFolder getAssetsDocFolder()
Returns the DocFolder for the helper files.

Returns:
the value.

getCssStylesDocFile

public DocFile getCssStylesDocFile()
Returns the DocFile for the CSS definitions.

Returns:
the value.

getHibernateImageDocFile

public DocFile getHibernateImageDocFile()
Returns the DocFile for the Hibernate Image.

Returns:
the value.

getExtendsImageDocFile

public DocFile getExtendsImageDocFile()
Returns the DocFile for the extends Image.

Returns:
the value.

getMainIndexDocFile

public DocFile getMainIndexDocFile()
Returns the DocFile for the main index.

Returns:
the value.

getTableIndexDocFile

public DocFile getTableIndexDocFile()
Return the table index DocFile.

Returns:
the table index DocFile.

getClassIndexDocFile

public DocFile getClassIndexDocFile()
Returns the class index DocFile

Returns:
class index DocFile

getClassSummaryFile

public DocFile getClassSummaryFile()
Returns the summary index DocFile

Returns:
summary index DocFile

getAllPackagesDocFile

public DocFile getAllPackagesDocFile()
Returns the DocFile responsible for generating allpackages.html

Returns:
DocFile

getAllEntitiesDocFile

public DocFile getAllEntitiesDocFile()
Returns the DocFile responsible for generating allclasses.html

Returns:

getPackageEntityListDocFile

public DocFile getPackageEntityListDocFile(String packageName)
Returns the DocFile responsible to generate classes.html corresponding to packageName passed

Parameters:
packageName - Package name which acts as key to get DocFile value object from packageEntityListDocFile
Returns:
DocFile for classes.html

getTableSummaryDocFile

public DocFile getTableSummaryDocFile()
Return the table summary DocFile.

Returns:
the table summary DocFile.

getAllSchemasDocFile

public DocFile getAllSchemasDocFile()
Return the all schemas DocFile.

Returns:
the all schemas DocFile.

getAllTablesDocFile

public DocFile getAllTablesDocFile()
Return the all tables DocFile.

Returns:
the all tables DocFile.

getTableDocFile

public DocFile getTableDocFile(org.hibernate.mapping.Table table)
Return the DocFile for the specified Table.

Parameters:
table - the Table.
Returns:
the DocFile.

getEntityDocFileByDeclarationName

public DocFile getEntityDocFileByDeclarationName(POJOClass pc)
Get the DocFile corresponding to POJOClass. But if the POJOClass is ComponentPOJO, it is created on fly and we are not implementing .equals method hence get by getQualifiedDeclarationName.

Parameters:
pc - DocFile corresponding to this POJOClass
Returns:
DocFile

getEntityDocFile

public DocFile getEntityDocFile(POJOClass pc)
Returns the DocFile responsible to generate the .html for each classes.

Parameters:
pc - The DocFile corresponding to this pc is retrieved from entityDocFiles
Returns:
DocFile

getSchemaSummaryDocFile

public DocFile getSchemaSummaryDocFile(String schemaName)
Return the summary DocFile for the specified schema FQN.

Parameters:
schemaName - the name of the schema.
Returns:
the DocFile.

getPackageSummaryDocFile

public DocFile getPackageSummaryDocFile(String packageName)
get DocFile responsible to generate summary.html for corresponding packageName passed

Parameters:
packageName - DocFile corresponding to this packagename is retrieved from packageSummaryDocFiles
Returns:
DocFile

getSchemaTableListDocFile

public DocFile getSchemaTableListDocFile(String schemaName)
Return the Table List DocFile for the specified schema FQN.

Parameters:
schemaName - the name of the schema.
Returns:
the DocFile.

getRef

public String getRef(DocFile from,
                     DocFile to)
Return the relative reference between the specified files.

Parameters:
from - the origin.
to - the target.
Throws:
IllegalArgumentException - if any parameter is null.

copy

public static void copy(ClassLoader loader,
                        String fileName,
                        File to)
                 throws IOException
Copy a File. TODO: this method ignores custom provided templatepath. Want to call freemarker to get the resourceloaders but they are hidden, so we need another way. ..and if we use currentthread classloader you might conflict with the projects tools.jar

Parameters:
fileName - the name of the file to copy.
to - the target file.
Throws:
IOException - in case of error.