com.jalios.jcms
Class TypeProcessor

java.lang.Object
  extended by com.jalios.jcms.TypeProcessor
All Implemented Interfaces:
JcmsConstants, TypeConstants, JaliosConstants

public class TypeProcessor
extends Object
implements TypeConstants, JcmsConstants

This class generates all the resources (Java classes and JSPs) used by the Custom Publication Types and Custom Extension Types.

This class replaces TypeGenerator class. It uses now a template mechanism to produces all the source code (Java and JSP)

Since:
jcms-3.0
Version:
$Revision: 29941 $
Author:
Olivier Dedieu

Field Summary
protected  List<String> compileList
           
protected  ArrayList<String> compilerCmdLine
           
static TypeFieldEntry[] EMPTY_TYPEFIELDENTRY_ARRAY
           
protected  List<String> extendedTypeList
           
protected  Map<String,String> extensionsTabsMap
           
protected  List<Class<?>> hbmList
           
static String REVISION
           
protected  Runtime rt
           
 
Fields inherited from interface com.jalios.jcms.TypeConstants
CHANGE_LEVEL_CLASS, CHANGE_LEVEL_JSP, CHANGE_LEVEL_NONE, DISPLAY_TPLT_TAG, EXTENSIONS_XML, FIELD_ELT, FIELD_NEW_MARK, FIELD_UPDATED_MARK, FIELDS_ELT, FILE_INDEX_LISTENER, LINK_INDEX_LISTENER, OLD_TYPES_DIR, PACKAGE_NAME, QUERY_TPLT_TAG, TAB_ELT, TABS_ELT, TEMPLATE_TAG, TEMPLATES_SUFFIX, TEMPLATES_TAG, TITLE_ELT, TYPE_ELT, TYPE_FORCE_UPDATE_MARK, TYPE_NEW_MARK, TYPE_UPDATED_MARK, TYPES_DIR, TYPES_XML
 
Fields inherited from interface com.jalios.jcms.JcmsConstants
ADATE_SEARCH, ADMIN_NOTES_PROP, ADVANCED_TAB, ARCHIVES_DIR, ASCII_WIDTH, CATEGORY_TAB, CDATE_SEARCH, COMMON_ALARM, CONTENT_TAB, COOKIE_MAX_AGE, CRYPT_MD5, CRYPT_UNDEFINED, CRYPT_UNIX, CTRL_TOPIC_INTERNAL, CTRL_TOPIC_REF, CTRL_TOPIC_VALUE, CTRL_TOPIC_WRITE, CUSTOM_PROP, DOCCHOOSER_HEIGHT, DOCCHOOSER_WIDTH, DOCS_DIR, EDATE_SEARCH, EMAIL_REGEXP, ERROR_MSG, FORBIDDEN_FILE_ACCESS, FORBIDDEN_REDIRECT, FORCE_REDIRECT, ICON_ARCHIVE, ICON_LOCK, ICON_LOCK_STRONG, ICON_WARN, ICON_WH_BOOK_CLOSED, ICON_WH_BOOK_OPEN, INFORMATION_MSG, JALIOS_JUNIT_PROP, JCMS_CADDY, JCMS_MSG_LIST, JSYNC_DOWNLOAD_DIR, JSYNC_SYNC_ALARM, LOG_FILE, LOG_TOPIC_SECURITY, LOGGER_PROP, LOGGER_XMLPROP, MBR_PHOTO_DIR, MDATE_SEARCH, MONITOR_XML, OP_CREATE, OP_DEEP_COPY, OP_DEEP_DELETE, OP_DELETE, OP_MERGE, OP_UPDATE, PDATE_SEARCH, PHOTO_DIR, PHOTO_ICON, PHOTO_ICON_HEIGHT, PHOTO_ICON_WIDTH, PHOTO_LARGE, PHOTO_LARGE_HEIGHT, PHOTO_LARGE_WIDTH, PHOTO_NORMAL, PHOTO_NORMAL_HEIGHT, PHOTO_NORMAL_WIDTH, PHOTO_SMALL, PHOTO_SMALL_HEIGHT, PHOTO_SMALL_WIDTH, PHOTO_TINY, PHOTO_TINY_HEIGHT, PHOTO_TINY_WIDTH, PREVIOUS_TAB, PRINT_VIEW, PRIVATE_FILE_ACCESS, PUBLIC_FILE_ACCESS, READ_RIGHT_TAB, SDATE_SEARCH, SEARCHENGINE_ALARM, SESSION_AUTHORIZED_FILENAMES_SET, STATS_REPORT_DIR, STATUS_PROP, STORE_XML, TEMPLATE_TAB, THUMBNAIL_LARGE_HEIGHT, THUMBNAIL_LARGE_WIDTH, THUMBNAIL_SMALL_HEIGHT, THUMBNAIL_SMALL_WIDTH, UDATE_SEARCH, UPDATE_RIGHT_TAB, UPLOAD_DIR, URL_REGEXP, WARNING_MSG, WEBAPP_PROP, WFEXPRESS_ALARM, WFREMINDER_ALARM, WORKFLOW_TAB, WORKFLOW_XML
 
Fields inherited from interface com.jalios.util.JaliosConstants
CRLF, MILLIS_IN_ONE_DAY, MILLIS_IN_ONE_HOUR, MILLIS_IN_ONE_MINUTE, MILLIS_IN_ONE_MONTH, MILLIS_IN_ONE_SECOND, MILLIS_IN_ONE_WEEK, MILLIS_IN_ONE_YEAR
 
Method Summary
 void applyTypeChange()
           
 TypeFieldEntry[] getAllTypeFieldEntries(Class<?> clazz)
          Return an array of TypeFieldEntry bound to given Class.
 TypeFieldEntry[] getAllTypeFieldEntries(String clazzName)
          Return an array of TypeFieldEntry bound to given Class represented by its class name.
 org.jdom.Document getCurrentTypeDocument()
           
 Map<String,Class<?>> getCustomExtensionMap()
          Retrieves the map of custom extension
 List<Class<?>> getCustomTypeList()
           
 List<String> getExtendedTypeList()
          Returns all the classes which have a Data extension.
Usually: "Category", "FileDocument", "Group", "Member", "Workspace"
 Map<String,String> getExtensionsTabsMap()
           
 List<Class<?>> getHbmList()
          Returns the list of class an HBM has been generated.
static TypeProcessor getInstance()
          Returns the TypeProcessor singleton instance.
 org.jdom.Document getNewTypeDocument(boolean create)
           
 int getTypeChangeLevel()
           
 String getTypeDescription(Class<?> clazz, String lang)
          Returns the description of a given type (class) localized for the given language.
 org.jdom.Document getTypeDocument()
           
 TypeEntry getTypeEntry(Class<?> clazz)
          Return the TypeEntry class associated to the given Class.
 TypeEntry getTypeEntry(String clazzName)
          Return the TypeEntry class associated to the given Class name.
 TypeFieldEntry[] getTypeFieldEntries(Class<?> clazz)
          Return an array of TypeFieldEntry bound to given Class.
 TypeFieldEntry[] getTypeFieldEntries(String clazzName)
          Return an array of TypeFieldEntry bound to given Class represented by its class name.
 String getTypeLabel(Class<?> clazz)
          Deprecated. since jcms-5.7.0
 String getTypeLabel(Class<?> clazz, String lang)
          Returns the label of a given type (class) localized for the given language.
 boolean isCompilationDone()
           
 boolean isInGeneratedDir(File file)
          Looks if the file is under a generation files (classes/generated and types).
static void markTypeAsUpdated(org.jdom.Element typeElt, boolean markSubTypes, boolean forceUpdate)
          Mark the given type as updated and also its sub-types (and their "super" field)
 void processTypes()
          Generate all type's resources from the types/ directory (for old JCMS data, convert types.xml file, to the new types organization and extensions.xml file to the new extensions organization)
 void revertTypeDocument()
          Revert the currently edited TypeDocument.
 void saveNewTypeDocument(boolean restartChannel)
          Saves the currently edited TypeDocument.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

REVISION

public static final String REVISION
See Also:
Constant Field Values

EMPTY_TYPEFIELDENTRY_ARRAY

public static final TypeFieldEntry[] EMPTY_TYPEFIELDENTRY_ARRAY

extendedTypeList

protected List<String> extendedTypeList

extensionsTabsMap

protected Map<String,String> extensionsTabsMap

compilerCmdLine

protected ArrayList<String> compilerCmdLine

rt

protected Runtime rt

compileList

protected List<String> compileList

hbmList

protected List<Class<?>> hbmList
Method Detail

getInstance

public static TypeProcessor getInstance()
Returns the TypeProcessor singleton instance.
Initialize it if it was not already done. Channel must be available!

Returns:
the TypeProcessor singleton instance

getCurrentTypeDocument

public org.jdom.Document getCurrentTypeDocument()
Returns:
the jdom Document instance of the current type
Since:
jcms-3.0

getTypeDocument

public org.jdom.Document getTypeDocument()
Returns:
the jdom Document containing all Types Element
Since:
jcms-3.0

getNewTypeDocument

public org.jdom.Document getNewTypeDocument(boolean create)
Parameters:
create - whether a new one should be created if it has not been created yet
Returns:
the Document (copy of getTypeDocument() being edited)
Since:
jcms-3.0

revertTypeDocument

public void revertTypeDocument()
Revert the currently edited TypeDocument.

Since:
jcms-3.0

getCustomTypeList

public List<Class<?>> getCustomTypeList()
Returns:
a list of Class
Since:
jcms-3.0

getCustomExtensionMap

public Map<String,Class<?>> getCustomExtensionMap()
Retrieves the map of custom extension

Returns:
the map of string to class
Since:
jcms-3.0

getExtendedTypeList

public List<String> getExtendedTypeList()
Returns all the classes which have a Data extension.
Usually: "Category", "FileDocument", "Group", "Member", "Workspace"

Returns:
a List of String.

getExtensionsTabsMap

public Map<String,String> getExtensionsTabsMap()

getHbmList

public List<Class<?>> getHbmList()
Returns the list of class an HBM has been generated.

Returns:
the list of class an HBM has been generated.
Since:
jcms-6.0.0

processTypes

public void processTypes()
                  throws Exception
Generate all type's resources from the types/ directory (for old JCMS data, convert types.xml file, to the new types organization and extensions.xml file to the new extensions organization)

Throws:
Exception
Since:
jcms-3.0

isInGeneratedDir

public boolean isInGeneratedDir(File file)
Looks if the file is under a generation files (classes/generated and types).

Parameters:
file - A possibly generated file
Returns:
true if the file is in under generated directory
Since:
JCMS-6.0.2

saveNewTypeDocument

public void saveNewTypeDocument(boolean restartChannel)
                         throws IOException
Saves the currently edited TypeDocument. Once saved, the newTypeDocument object is reset to null.

Parameters:
restartChannel - if true, once the new types was successfully saved, the channel is restarted
Throws:
IOException - if an error occurs during saving

applyTypeChange

public void applyTypeChange()
                     throws Exception
Throws:
Exception
Since:
jcms-3.0

getTypeChangeLevel

public int getTypeChangeLevel()
Returns:
the kind of type changed occured (none/jsp/class)
Since:
jcms-3.0

getTypeEntry

public TypeEntry getTypeEntry(Class<?> clazz)
Return the TypeEntry class associated to the given Class. Return null if no TypeEntry is bound to clazz.

Parameters:
clazz - the Class of which to find the TypeEntry
Returns:
the TypeEntry associated to the given class or null if not available.

getTypeEntry

public TypeEntry getTypeEntry(String clazzName)
Return the TypeEntry class associated to the given Class name. Return null if no TypeEntry is bound to clazzName.

Parameters:
clazzName - the String representing the name the Class of which to find the TypeEntry
Returns:
the TypeEntry associated to the given class or null if not available.

getTypeFieldEntries

public TypeFieldEntry[] getTypeFieldEntries(Class<?> clazz)
Return an array of TypeFieldEntry bound to given Class.
This array does not contain inherited TypeFieldEntry from super classes of given Class.

Parameters:
clazz - the Class of which to find the TypeFieldEntry.
Returns:
an array of TypeFieldEntry containing all Field used by Class or an empty array (never return null)
Since:
jcms-5.5

getTypeFieldEntries

public TypeFieldEntry[] getTypeFieldEntries(String clazzName)
Return an array of TypeFieldEntry bound to given Class represented by its class name.
This array does not contain inherited TypeFieldEntry from super classes of given Class.

Parameters:
clazzName - the String representing the name the Class of which to find the TypeFieldEntry
Returns:
an array of TypeFieldEntry containing all Field used by Class or an empty array (never return null)
Since:
jcms-5.5

getAllTypeFieldEntries

public TypeFieldEntry[] getAllTypeFieldEntries(Class<?> clazz)
Return an array of TypeFieldEntry bound to given Class.
This array does contain inherited TypeFieldEntry from super classes of given Class.

Parameters:
clazz - the Class of which to find the TypeFieldEntry.
Returns:
an array of TypeFieldEntry containing all Field used by Class or an empty array (never return null)
Since:
jcms-5.5

getAllTypeFieldEntries

public TypeFieldEntry[] getAllTypeFieldEntries(String clazzName)
Return an array of TypeFieldEntry bound to given Class represented by its class name.
This array does contain inherited TypeFieldEntry from super classes of given Class.

Parameters:
clazzName - the String representing the name the Class of which to find the TypeFieldEntry
Returns:
an array of TypeFieldEntry containing all Field used by Class or an empty array (never return null)
Since:
jcms-5.5

getTypeLabel

@Deprecated
public String getTypeLabel(Class<?> clazz)
Deprecated. since jcms-5.7.0

Returns the label of a given type (if TypeEntry is not null use it, otherwise return the short class name)

Parameters:
clazz - the class to get the label
Returns:
the type label
Since:
jcms-5.0.0
See Also:
getTypeLabel(Class, String)

getTypeLabel

public String getTypeLabel(Class<?> clazz,
                           String lang)
Returns the label of a given type (class) localized for the given language.

Parameters:
clazz - the class
lang - the language
Returns:
the type label
Since:
jcms-5.7.0

getTypeDescription

public String getTypeDescription(Class<?> clazz,
                                 String lang)
Returns the description of a given type (class) localized for the given language.

Parameters:
clazz - the class
lang - the language
Returns:
the Type description
Since:
jcms-5.0.0

markTypeAsUpdated

public static void markTypeAsUpdated(org.jdom.Element typeElt,
                                     boolean markSubTypes,
                                     boolean forceUpdate)
Mark the given type as updated and also its sub-types (and their "super" field)

Parameters:
typeElt - the type to mark as updated
markSubTypes - if true, marks all its sub-types as updated
forceUpdate - if true, the type (and sub-types if 'markSubTypes' is true) will be force to be updated (i.e. regenerated)
Since:
jcms-4.0

isCompilationDone

public boolean isCompilationDone()


Copyright © 2001-2010 Jalios SA. All Rights Reserved.