|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||
java.lang.Objectorg.opencms.file.types.A_CmsResourceType
public abstract class A_CmsResourceType
Base implementation for resource type classes.
| Nested Class Summary |
|---|
| Nested classes/interfaces inherited from interface org.opencms.file.types.I_CmsResourceType |
|---|
I_CmsResourceType.Formatter |
| Field Summary | |
|---|---|
static java.lang.String |
CONFIGURATION_GALLERY_JAVASCRIPT_PATH
Configuration key for optional javascript in galleries. |
static java.lang.String |
CONFIGURATION_GALLERY_PREVIEW_PROVIDER
Configuration key for optional preview provider in galleries. |
static java.lang.String |
CONFIGURATION_GALLERY_TYPE_NAMES
Configuration key for the optional folder class name. |
static java.lang.String |
CONFIGURATION_INTERNAL
Configuration key for the (optional) internal flag. |
static java.lang.String |
DEFAULT_GALLERY_PREVIEW_PROVIDER
The default gallery preview provider. |
protected boolean |
m_addititionalModuleResourceType
Flag for showing that this is an additional resource type which is defined in a module. |
protected java.lang.String |
m_className
The configured class name of this resource type. |
protected CmsParameterConfiguration |
m_configuration
Configuration parameters. |
protected java.util.List<CmsConfigurationCopyResource> |
m_copyResources
The list of resources to copy. |
protected java.util.List<CmsProperty> |
m_defaultProperties
The list of configured default properties. |
protected boolean |
m_frozen
Indicates that the configuration of the resource type has been frozen. |
protected java.lang.String |
m_galleryPreviewProvider
The gallery preview provider. |
protected java.util.List<java.lang.String> |
m_mappings
Contains the file extensions mapped to this resource type. |
protected java.lang.String |
m_moduleName
The module name if this is an additional resource type which is defined in a module. |
protected int |
m_typeId
The configured id of this resource type. |
protected java.lang.String |
m_typeName
The configured name of this resource type. |
static java.lang.String |
MACRO_RESOURCE_FOLDER_PATH
Macro for the folder path of the current resource. |
static java.lang.String |
MACRO_RESOURCE_FOLDER_PATH_TOUCH
Macro for the folder path of the current resource, with touch enabled for the copied resources. |
static java.lang.String |
MACRO_RESOURCE_NAME
Macro for the name of the current resource. |
static java.lang.String |
MACRO_RESOURCE_PARENT_PATH
Macro for the parent folder path of the current resource. |
static java.lang.String |
MACRO_RESOURCE_ROOT_PATH
Macro for the root path of the current resource. |
static java.lang.String |
MACRO_RESOURCE_SITE_PATH
Macro for the site path of the current resource. |
| Fields inherited from interface org.opencms.file.types.I_CmsResourceType |
|---|
ADD_MAPPING_METHOD, ADD_RESOURCE_TYPE_METHOD, CONFIGURATION_PROPERTY_CREATE, CONFIGURATION_RESOURCE_TYPE_ID, CONFIGURATION_RESOURCE_TYPE_NAME, PROPERTY_ON_RESOURCE, PROPERTY_ON_STRUCTURE |
| Fields inherited from interface org.opencms.configuration.I_CmsConfigurationParameterHandler |
|---|
ADD_PARAMETER_METHOD, INIT_CONFIGURATION_METHOD |
| Constructor Summary | |
|---|---|
A_CmsResourceType()
Default constructor, used to initialize some member variables. |
|
| Method Summary | |
|---|---|
void |
addConfigurationParameter(java.lang.String paramName,
java.lang.String paramValue)
Adds a configuration parameter to this parameter configurable class instance. |
void |
addCopyResource(java.lang.String source,
java.lang.String target,
java.lang.String type)
Adds a new "copy resource" to this resource type, allowed only during the configuration phase. |
void |
addDefaultProperty(CmsProperty property)
Adds a default property to this resource type, allowed only during the configuration phase. |
void |
addMappingType(java.lang.String mapping)
Maps a file extension to a resource type. |
void |
changeLock(CmsObject cms,
CmsSecurityManager securityManager,
CmsResource resource)
Changes the lock of a resource to the current user, that is "steals" the lock from another user. |
void |
chflags(CmsObject cms,
CmsSecurityManager securityManager,
CmsResource resource,
int flags)
Changes the resource flags of a resource. |
void |
chtype(CmsObject cms,
CmsSecurityManager securityManager,
CmsResource resource,
int type)
Changes the resource type of a resource. |
void |
copyResource(CmsObject cms,
CmsSecurityManager securityManager,
CmsResource source,
java.lang.String destination,
CmsResource.CmsResourceCopyMode siblingMode)
Copies a resource. |
void |
copyResourceToProject(CmsObject cms,
CmsSecurityManager securityManager,
CmsResource resource)
Copies a resource to the current project of the user. |
protected CmsResource |
createRelations(CmsObject cms,
CmsSecurityManager securityManager,
java.lang.String resourceName)
Creates the relation information for the resource with the given resource name. |
CmsResource |
createResource(CmsObject cms,
CmsSecurityManager securityManager,
java.lang.String resourcename,
byte[] content,
java.util.List<CmsProperty> properties)
Creates a new resource of the given resource type with the provided content and properties. |
CmsResource |
createSibling(CmsObject cms,
CmsSecurityManager securityManager,
CmsResource source,
java.lang.String destination,
java.util.List<CmsProperty> properties)
Creates a new sibling of the source resource. |
void |
deleteResource(CmsObject cms,
CmsSecurityManager securityManager,
CmsResource resource,
CmsResource.CmsResourceDeleteMode siblingMode)
Deletes a resource given its name. |
boolean |
equals(java.lang.Object obj)
Returns true, if this resource type is equal to the given Object. |
java.lang.String |
getAdjustLinksFolder()
Gets the folder for which the links should be adjusted after processing the copy resources. |
java.lang.String |
getCachePropertyDefault()
Returns the default for the cache property setting of this resource type. |
java.lang.String |
getClassName()
Returns the configured class name of this resource type. |
CmsParameterConfiguration |
getConfiguration()
Returns the parameters of this configurable class instance, or null if the class does not need any parameters. |
java.util.List<CmsConfigurationCopyResource> |
getConfiguredCopyResources()
Returns the (unmodifiable) list of copy resources. |
java.util.List<CmsProperty> |
getConfiguredDefaultProperties()
Returns the default properties for this resource type in an unmodifiable List. |
java.util.List<java.lang.String> |
getConfiguredMappings()
Returns the file extensions mappings for this resource type in an unmodifiable List. |
CmsFormatterConfiguration |
getFormattersForResource(CmsObject cms,
CmsResource res)
Returns the formatter configuration for the given resource. |
java.lang.String |
getGalleryPreviewProvider()
Returns the gallery preview provider class name. |
java.util.List<I_CmsResourceType> |
getGalleryTypes()
Returns the gallery types for this resource type. |
abstract int |
getLoaderId()
Returns the loader type id of this resource type. |
protected CmsMacroResolver |
getMacroResolver(CmsObject cms,
java.lang.String resourcename)
Creates a macro resolver based on the current users OpenCms context and the provided resource name. |
java.lang.String |
getModuleName()
Returns the module name if this is an additional resource type which is defined in a module, or null. |
protected I_CmsResourceType |
getResourceType(CmsResource resource)
Convenience method to get the initialized resource type instance for the given resource, with a fall back to special "unknown" resource types in case the resource type is not configured. |
int |
getTypeId()
Returns the type id of this resource type. |
java.lang.String |
getTypeName()
Returns the name of this resource type. |
int |
hashCode()
The hash code implementation simply returns the unique type id of this resource type. |
CmsResource |
importResource(CmsObject cms,
CmsSecurityManager securityManager,
java.lang.String resourcename,
CmsResource resource,
byte[] content,
java.util.List<CmsProperty> properties)
Imports a resource to the OpenCms VFS. |
void |
initConfiguration()
Initializes a configuration after all parameters have been added. |
void |
initConfiguration(java.lang.String name,
java.lang.String id,
java.lang.String className)
Special version of the configuration initialization used with resource types to set resource type, id and class name, required for the XML configuration. |
void |
initialize(CmsObject cms)
Initializes this resource type. |
boolean |
isAdditionalModuleResourceType()
Indicates that this is an additional resource type which is defined in a module. |
boolean |
isDirectEditable()
Returns true if this resource type is direct editable. |
boolean |
isFolder()
Returns true if this resource type is a folder. |
boolean |
isIdentical(I_CmsResourceType type)
Tests if the given resource type definition is identical to this resource type definition. |
void |
lockResource(CmsObject cms,
CmsSecurityManager securityManager,
CmsResource resource,
CmsLockType type)
Locks a resource. |
void |
moveResource(CmsObject cms,
CmsSecurityManager securityManager,
CmsResource resource,
java.lang.String destination)
Moves a resource to the given destination. |
protected void |
processCopyResources(CmsObject cms,
java.lang.String resourcename,
CmsMacroResolver resolver)
Processes the copy resources of this resource type. |
protected java.util.List<CmsProperty> |
processDefaultProperties(java.util.List<CmsProperty> properties,
CmsMacroResolver resolver)
Returns a list of property objects that are attached to the resource on creation. |
void |
removeResourceFromProject(CmsObject cms,
CmsSecurityManager securityManager,
CmsResource resource)
Removes a resource from the current project of the user. |
void |
replaceResource(CmsObject cms,
CmsSecurityManager securityManager,
CmsResource resource,
int type,
byte[] content,
java.util.List<CmsProperty> properties)
Replaces the content, type and properties of a resource. |
void |
restoreResource(CmsObject cms,
CmsSecurityManager securityManager,
CmsResource resource,
int version)
Restores a resource in the current project with a version from the historical archive. |
void |
setAdditionalModuleResourceType(boolean additionalType)
Sets the additional resource type flag. |
void |
setAdjustLinksFolder(java.lang.String adjustLinksFolder)
Sets the folder for adjusting links after copying the copy-resources. |
void |
setDateExpired(CmsObject cms,
CmsSecurityManager securityManager,
CmsResource resource,
long dateExpired,
boolean recursive)
Changes the "expire" date of a resource. |
void |
setDateLastModified(CmsObject cms,
CmsSecurityManager securityManager,
CmsResource resource,
long dateLastModified,
boolean recursive)
Changes the "last modified" date of a resource. |
void |
setDateReleased(CmsObject cms,
CmsSecurityManager securityManager,
CmsResource resource,
long dateReleased,
boolean recursive)
Changes the "release" date of a resource. |
void |
setModuleName(java.lang.String moduleName)
Sets the module name if this is an additional resource type which is defined in a module, or null. |
java.lang.String |
toString()
|
void |
undelete(CmsObject cms,
CmsSecurityManager securityManager,
CmsResource resource,
boolean recursive)
Undeletes a resource. |
void |
undoChanges(CmsObject cms,
CmsSecurityManager securityManager,
CmsResource resource,
CmsResource.CmsResourceUndoMode mode)
Undos all changes in the resource by restoring the version from the online project to the current offline project. |
void |
unlockResource(CmsObject cms,
CmsSecurityManager securityManager,
CmsResource resource)
Unlocks a resource. |
protected void |
updateRelationForUndo(CmsObject cms,
CmsSecurityManager securityManager,
CmsResource resource)
Update the relations after an undo changes operation. |
CmsFile |
writeFile(CmsObject cms,
CmsSecurityManager securityManager,
CmsFile resource)
Writes a resource, including it's content. |
void |
writePropertyObject(CmsObject cms,
CmsSecurityManager securityManager,
CmsResource resource,
CmsProperty property)
Writes a property for a specified resource. |
void |
writePropertyObjects(CmsObject cms,
CmsSecurityManager securityManager,
CmsResource resource,
java.util.List<CmsProperty> properties)
Writes a list of properties for a specified resource. |
| Methods inherited from class java.lang.Object |
|---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
public static final java.lang.String CONFIGURATION_GALLERY_JAVASCRIPT_PATH
public static final java.lang.String CONFIGURATION_GALLERY_PREVIEW_PROVIDER
public static final java.lang.String CONFIGURATION_GALLERY_TYPE_NAMES
public static final java.lang.String CONFIGURATION_INTERNAL
public static final java.lang.String DEFAULT_GALLERY_PREVIEW_PROVIDER
public static final java.lang.String MACRO_RESOURCE_FOLDER_PATH
public static final java.lang.String MACRO_RESOURCE_FOLDER_PATH_TOUCH
public static final java.lang.String MACRO_RESOURCE_NAME
public static final java.lang.String MACRO_RESOURCE_PARENT_PATH
public static final java.lang.String MACRO_RESOURCE_ROOT_PATH
public static final java.lang.String MACRO_RESOURCE_SITE_PATH
protected boolean m_addititionalModuleResourceType
protected java.lang.String m_className
protected CmsParameterConfiguration m_configuration
protected java.util.List<CmsConfigurationCopyResource> m_copyResources
protected java.util.List<CmsProperty> m_defaultProperties
protected boolean m_frozen
protected java.util.List<java.lang.String> m_mappings
protected java.lang.String m_moduleName
protected int m_typeId
protected java.lang.String m_typeName
protected java.lang.String m_galleryPreviewProvider
| Constructor Detail |
|---|
public A_CmsResourceType()
| Method Detail |
|---|
public void addConfigurationParameter(java.lang.String paramName,
java.lang.String paramValue)
I_CmsConfigurationParameterHandler
addConfigurationParameter in interface I_CmsConfigurationParameterHandlerparamName - the name of the parameterparamValue - the value for the parameterI_CmsConfigurationParameterHandler.addConfigurationParameter(java.lang.String, java.lang.String)
public void addCopyResource(java.lang.String source,
java.lang.String target,
java.lang.String type)
throws CmsConfigurationException
The "copy resources" are copied to the specified location after a new resource of this type is created. Usually this feature is used to populate a newly created folder with some default resources.
If target is null, the macro MACRO_RESOURCE_FOLDER_PATH is used as default.
If type is null, the copy type CmsResource.COPY_AS_NEW is used as default.
source - the source resourcetarget - the target resource (may contain macros)type - the type of the copy, for example "as new", "as sibling" etc
CmsConfigurationException - if the configuration is already frozen
public void addDefaultProperty(CmsProperty property)
throws CmsConfigurationException
property - the default property to add
CmsConfigurationException - if the configuration is already frozenpublic void addMappingType(java.lang.String mapping)
I_CmsResourceTypeWhen uploading files into OpenCms, they must be mapped to the different OpenCms resource types. The configuration, to map which extension to which resouce type is done in the OpenCms VFS configuration.
addMappingType in interface I_CmsResourceTypemapping - the file extension mapped to the resource typeI_CmsResourceType.addMappingType(java.lang.String)
public void changeLock(CmsObject cms,
CmsSecurityManager securityManager,
CmsResource resource)
throws CmsException
I_CmsResourceType
changeLock in interface I_CmsResourceTypecms - the current cms contextsecurityManager - the initialized OpenCms security managerresource - the name of the resource to change the lock with complete path
CmsException - if something goes wrongI_CmsResourceType.changeLock(org.opencms.file.CmsObject, CmsSecurityManager, CmsResource)
public void chflags(CmsObject cms,
CmsSecurityManager securityManager,
CmsResource resource,
int flags)
throws CmsException
I_CmsResourceTypeThe resource flags are used to indicate various "special" conditions for a resource. Most notably, the "internal only" setting which signals that a resource can not be directly requested with it's URL.
chflags in interface I_CmsResourceTypecms - the initialized CmsObjectsecurityManager - the initialized OpenCms security managerresource - the resource to change the flags forflags - the new resource flags for this resource
CmsException - if something goes wrongI_CmsResourceType.chflags(org.opencms.file.CmsObject, CmsSecurityManager, CmsResource, int)
public void chtype(CmsObject cms,
CmsSecurityManager securityManager,
CmsResource resource,
int type)
throws CmsException
I_CmsResourceTypeOpenCms handles resources according to the resource type, not the file suffix. This is e.g. why a JSP in OpenCms can have the suffix ".html" instead of ".jsp" only. Changing the resource type makes sense e.g. if you want to make a plain text file a JSP resource, or a binary file an image, etc.
chtype in interface I_CmsResourceTypecms - the initialized CmsObjectsecurityManager - the initialized OpenCms security managerresource - the resource to change the type fortype - the new resource type for this resource
CmsException - if something goes wrongI_CmsResourceType.chtype(org.opencms.file.CmsObject, CmsSecurityManager, CmsResource, int)
public void copyResource(CmsObject cms,
CmsSecurityManager securityManager,
CmsResource source,
java.lang.String destination,
CmsResource.CmsResourceCopyMode siblingMode)
throws CmsException
I_CmsResourceTypeYou must ensure that the destination path is an absolute, valid and existing VFS path. Relative paths from the source are currently not supported.
The copied resource will always be locked to the current user after the copy operation.
In case the target resource already exists, it is overwritten with the source resource.
The siblingMode parameter controls how to handle siblings
during the copy operation.
Possible values for this parameter are:
copyResource in interface I_CmsResourceTypecms - the initialized CmsObjectsecurityManager - the initialized OpenCms security managersource - the resource to copydestination - the name of the copy destination with complete pathsiblingMode - indicates how to handle siblings during copy
CmsException - if something goes wrongI_CmsResourceType.copyResource(org.opencms.file.CmsObject, CmsSecurityManager, CmsResource, java.lang.String, CmsResource.CmsResourceCopyMode)
public void copyResourceToProject(CmsObject cms,
CmsSecurityManager securityManager,
CmsResource resource)
throws CmsException
I_CmsResourceTypeThis is used to extend the current users project with the specified resource, in case that the resource is not yet part of the project. The resource is not really copied like in a regular copy operation, it is in fact only "enabled" in the current users project.
copyResourceToProject in interface I_CmsResourceTypecms - the initialized CmsObjectsecurityManager - the initialized OpenCms security managerresource - the resource to apply this operation to
CmsException - if something goes wrongI_CmsResourceType.copyResourceToProject(org.opencms.file.CmsObject, CmsSecurityManager, CmsResource)
public CmsResource createResource(CmsObject cms,
CmsSecurityManager securityManager,
java.lang.String resourcename,
byte[] content,
java.util.List<CmsProperty> properties)
throws CmsException
I_CmsResourceType
createResource in interface I_CmsResourceTypecms - the initialized CmsObjectsecurityManager - the initialized OpenCms security managerresourcename - the name of the resource to create (full path)content - the content for the new resourceproperties - the properties for the new resource
CmsException - if something goes wrongI_CmsResourceType.createResource(org.opencms.file.CmsObject, CmsSecurityManager, java.lang.String, byte[], List)
public CmsResource createSibling(CmsObject cms,
CmsSecurityManager securityManager,
CmsResource source,
java.lang.String destination,
java.util.List<CmsProperty> properties)
throws CmsException
I_CmsResourceType
createSibling in interface I_CmsResourceTypecms - the current cms contextsecurityManager - the initialized OpenCms security managersource - the resource to create a sibling fordestination - the name of the sibling to create with complete pathproperties - the individual properties for the new sibling
CmsException - if something goes wrongI_CmsResourceType.createSibling(org.opencms.file.CmsObject, org.opencms.db.CmsSecurityManager, CmsResource, java.lang.String, java.util.List)
public void deleteResource(CmsObject cms,
CmsSecurityManager securityManager,
CmsResource resource,
CmsResource.CmsResourceDeleteMode siblingMode)
throws CmsException
I_CmsResourceType
The siblingMode parameter controls how to handle siblings
during the delete operation.
Possible values for this parameter are:
deleteResource in interface I_CmsResourceTypecms - the initialized CmsObjectsecurityManager - the initialized OpenCms security managerresource - the resource to deletesiblingMode - indicates how to handle siblings of the deleted resource
CmsException - if something goes wrongI_CmsResourceType.deleteResource(org.opencms.file.CmsObject, CmsSecurityManager, CmsResource, CmsResource.CmsResourceDeleteMode)public boolean equals(java.lang.Object obj)
true, if this resource type is equal to the given Object.
Please note: A resource type is identified by it's id getTypeId() and it's name getTypeName().
Two resource types are considered equal, if either their id or their name is equal.
This is to prevent issues in the configuration with multiple occurrences of the same name or id.
equals in class java.lang.Objectobj - the Object to compare this resource type with
true, if this resource type is equal to the given ObjectgetTypeId(),
getTypeName(),
isIdentical(I_CmsResourceType),
Object.equals(java.lang.Object)public java.lang.String getAdjustLinksFolder()
I_CmsResourceType
getAdjustLinksFolder in interface I_CmsResourceTypeI_CmsResourceType.getAdjustLinksFolder()public java.lang.String getCachePropertyDefault()
I_CmsResourceTypecache property setting of this resource type.
The cache property is used by the Flex cache implementation
to build the cache key that controls the caching behaviour of a resource.
If null is returnd, this is the same as turning the cache
off by default for this resource type.
getCachePropertyDefault in interface I_CmsResourceTypecache property setting of this resource typeI_CmsResourceType.getCachePropertyDefault()public java.lang.String getClassName()
getClassName in interface I_CmsResourceTypeI_CmsResourceType.getClassName()public CmsParameterConfiguration getConfiguration()
I_CmsConfigurationParameterHandlernull if the class does not need any parameters.
getConfiguration in interface I_CmsConfigurationParameterHandlernull if the class does not need any parametersI_CmsConfigurationParameterHandler.getConfiguration()public java.util.List<CmsConfigurationCopyResource> getConfiguredCopyResources()
getConfiguredCopyResources in interface I_CmsResourceTypepublic java.util.List<CmsProperty> getConfiguredDefaultProperties()
getConfiguredDefaultProperties in interface I_CmsResourceTypepublic java.util.List<java.lang.String> getConfiguredMappings()
I_CmsResourceType
getConfiguredMappings in interface I_CmsResourceTypeI_CmsResourceType.getConfiguredMappings()
public CmsFormatterConfiguration getFormattersForResource(CmsObject cms,
CmsResource res)
I_CmsResourceType
getFormattersForResource in interface I_CmsResourceTypecms - the current cms contextres - the resource to get the formatter configuration for
I_CmsResourceType.getFormattersForResource(org.opencms.file.CmsObject, org.opencms.file.CmsResource)public java.lang.String getGalleryPreviewProvider()
I_CmsResourceType
getGalleryPreviewProvider in interface I_CmsResourceTypeI_CmsResourceType.getGalleryPreviewProvider()public java.util.List<I_CmsResourceType> getGalleryTypes()
I_CmsResourceType
getGalleryTypes in interface I_CmsResourceTypenull will be returnedI_CmsResourceType.getGalleryTypes()public abstract int getLoaderId()
I_CmsResourceType
getLoaderId in interface I_CmsResourceTypeI_CmsResourceType.getLoaderId()public java.lang.String getModuleName()
I_CmsResourceTypenull.
getModuleName in interface I_CmsResourceTypenullI_CmsResourceType.getModuleName()public int getTypeId()
I_CmsResourceType
getTypeId in interface I_CmsResourceTypeI_CmsResourceType.getTypeId()public java.lang.String getTypeName()
I_CmsResourceType
getTypeName in interface I_CmsResourceTypeI_CmsResourceType.getTypeName()public int hashCode()
hashCode in class java.lang.ObjectgetTypeId(),
Object.hashCode()
public CmsResource importResource(CmsObject cms,
CmsSecurityManager securityManager,
java.lang.String resourcename,
CmsResource resource,
byte[] content,
java.util.List<CmsProperty> properties)
throws CmsException
I_CmsResourceTypeIf a resource already exists in the VFS (i.e. has the same name and same id) it is replaced by the imported resource.
If a resource with the same name but a different id exists, the imported resource is (usually) moved to the "lost and found" folder.
importResource in interface I_CmsResourceTypecms - the initialized CmsObjectsecurityManager - the initialized OpenCms security managerresourcename - the target name (with full path) for the resource after importresource - the resource to be importedcontent - the content of the resourceproperties - the properties of the resource
CmsException - if something goes wrongI_CmsResourceType.importResource(org.opencms.file.CmsObject, CmsSecurityManager, java.lang.String, org.opencms.file.CmsResource, byte[], List)public final void initConfiguration()
I_CmsConfigurationParameterHandler
initConfiguration in interface I_CmsConfigurationParameterHandlerI_CmsConfigurationParameterHandler.initConfiguration()
public void initConfiguration(java.lang.String name,
java.lang.String id,
java.lang.String className)
throws CmsConfigurationException
I_CmsResourceTypePlease note: Many resource types defined in the core have in fact a fixed resource type and a fixed id. Configurable name and id is used only for certain types.
The provided named class must implement this interface ().
Usually the provided class name should be the class name of the resource type instance,
but this may be different in special cases or configuration errors.
For example, if a module is imported that contains it's own resource type class files,
the included class file are usually not be available until the server is restarted.
If the named class given in the XML configuration (or module manifest.xml) is not available,
or not implementing I_CmsResourceType,
then I_CmsResourceType is used for the resource type instance.CmsResourceTypeUnknown
initConfiguration in interface I_CmsResourceTypename - the resource type nameid - the resource type idclassName - the class name of the resource type (read from the XML configuration)
CmsConfigurationException - if the configuration is invalidI_CmsResourceType.initConfiguration(java.lang.String, java.lang.String, java.lang.String)public void initialize(CmsObject cms)
I_CmsResourceTypeThis method will be called once during the OpenCms initialization processs. The VFS will already be available at the time the method is called.
initialize in interface I_CmsResourceTypecms - a OpenCms context initialized with "Admin" permissionsI_CmsResourceType.initialize(org.opencms.file.CmsObject)public boolean isAdditionalModuleResourceType()
I_CmsResourceType
isAdditionalModuleResourceType in interface I_CmsResourceTypeI_CmsResourceType.isAdditionalModuleResourceType()public boolean isDirectEditable()
I_CmsResourceTypetrue if this resource type is direct editable.
isDirectEditable in interface I_CmsResourceTypetrue if this resource type is direct editableI_CmsResourceType.isDirectEditable()public boolean isFolder()
I_CmsResourceTypetrue if this resource type is a folder.
isFolder in interface I_CmsResourceTypetrue if this resource type is a folderI_CmsResourceType.isFolder()public boolean isIdentical(I_CmsResourceType type)
I_CmsResourceType
Two resource types are considered identical if their names I_CmsResourceType.getTypeName()
and their ids I_CmsResourceType.getTypeId() are both the same.
Please note: Two resource type are considered equal in the sense of Object.equals(Object) if
either if their names I_CmsResourceType.getTypeName() or their ids I_CmsResourceType.getTypeId() are equal.
isIdentical in interface I_CmsResourceTypetype - another resource type
I_CmsResourceType.isIdentical(org.opencms.file.types.I_CmsResourceType)
public void lockResource(CmsObject cms,
CmsSecurityManager securityManager,
CmsResource resource,
CmsLockType type)
throws CmsException
I_CmsResourceType
The type parameter controls what kind of lock is used.
Possible values for this parameter are:
lockResource in interface I_CmsResourceTypecms - the initialized CmsObjectsecurityManager - the initialized OpenCms security managerresource - the resource to locktype - type of the lock
CmsException - if something goes wrongI_CmsResourceType.lockResource(org.opencms.file.CmsObject, org.opencms.db.CmsSecurityManager, org.opencms.file.CmsResource, org.opencms.lock.CmsLockType)
public void moveResource(CmsObject cms,
CmsSecurityManager securityManager,
CmsResource resource,
java.lang.String destination)
throws CmsException,
CmsIllegalArgumentException
I_CmsResourceTypeA move operation in OpenCms is always a copy (as sibling) followed by a delete, this is a result of the online/offline structure of the OpenCms VFS. This way you can see the deleted files/folders in the offline project, and you will be unable to undelete them.
moveResource in interface I_CmsResourceTypecms - the current cms contextsecurityManager - the initialized OpenCms security managerresource - the resource to movedestination - the destination resource name
CmsException - if something goes wrong
CmsIllegalArgumentException - if the source argument is null or of length 0I_CmsResourceType.moveResource(org.opencms.file.CmsObject, org.opencms.db.CmsSecurityManager, org.opencms.file.CmsResource, java.lang.String)
public void removeResourceFromProject(CmsObject cms,
CmsSecurityManager securityManager,
CmsResource resource)
throws CmsException
I_CmsResourceTypeThis is used to reduce the current users project with the specified resource, in case that the resource is already part of the project. The resource is not really removed like in a regular copy operation, it is in fact only "disabled" in the current users project.
removeResourceFromProject in interface I_CmsResourceTypecms - the initialized CmsObjectsecurityManager - the initialized OpenCms security managerresource - the resource to apply this operation to
CmsException - if something goes wrongI_CmsResourceType.removeResourceFromProject(org.opencms.file.CmsObject, org.opencms.db.CmsSecurityManager, org.opencms.file.CmsResource)
public void replaceResource(CmsObject cms,
CmsSecurityManager securityManager,
CmsResource resource,
int type,
byte[] content,
java.util.List<CmsProperty> properties)
throws CmsException
I_CmsResourceType
replaceResource in interface I_CmsResourceTypecms - the current cms contextsecurityManager - the initialized OpenCms security managerresource - the name of the resource to replacetype - the new type of the resourcecontent - the new content of the resourceproperties - the new properties of the resource
CmsException - if something goes wrongI_CmsResourceType.replaceResource(org.opencms.file.CmsObject, CmsSecurityManager, CmsResource, int, byte[], List)
public void restoreResource(CmsObject cms,
CmsSecurityManager securityManager,
CmsResource resource,
int version)
throws CmsException
I_CmsResourceType
restoreResource in interface I_CmsResourceTypecms - the current cms contextsecurityManager - the initialized OpenCms security managerresource - the resource to restore from the archiveversion - the version number of the resource to restore
CmsException - if something goes wrongI_CmsResourceType.restoreResource(org.opencms.file.CmsObject, CmsSecurityManager, CmsResource, int)public void setAdditionalModuleResourceType(boolean additionalType)
I_CmsResourceType
setAdditionalModuleResourceType in interface I_CmsResourceTypeadditionalType - true or falseI_CmsResourceType.setAdditionalModuleResourceType(boolean)public void setAdjustLinksFolder(java.lang.String adjustLinksFolder)
I_CmsResourceType
setAdjustLinksFolder in interface I_CmsResourceTypeadjustLinksFolder - the folder for which links should be adjustedI_CmsResourceType.setAdjustLinksFolder(String)
public void setDateExpired(CmsObject cms,
CmsSecurityManager securityManager,
CmsResource resource,
long dateExpired,
boolean recursive)
throws CmsException
I_CmsResourceType
setDateExpired in interface I_CmsResourceTypecms - the current cms contextsecurityManager - the initialized OpenCms security managerresource - the resource to touchdateExpired - the new expire date of the changed resourcerecursive - if this operation is to be applied recursively to all resources in a folder
CmsException - if something goes wrongI_CmsResourceType.setDateExpired(org.opencms.file.CmsObject, CmsSecurityManager, CmsResource, long, boolean)
public void setDateLastModified(CmsObject cms,
CmsSecurityManager securityManager,
CmsResource resource,
long dateLastModified,
boolean recursive)
throws CmsException
I_CmsResourceType
setDateLastModified in interface I_CmsResourceTypecms - the current cms contextsecurityManager - the initialized OpenCms security managerresource - the resource to touchdateLastModified - timestamp the new timestamp of the changed resourcerecursive - if this operation is to be applied recursively to all resources in a folder
CmsException - if something goes wrongI_CmsResourceType.setDateLastModified(org.opencms.file.CmsObject, CmsSecurityManager, CmsResource, long, boolean)
public void setDateReleased(CmsObject cms,
CmsSecurityManager securityManager,
CmsResource resource,
long dateReleased,
boolean recursive)
throws CmsException
I_CmsResourceType
setDateReleased in interface I_CmsResourceTypecms - the current cms contextsecurityManager - the initialized OpenCms security managerresource - the resource to touchdateReleased - the new release date of the changed resourcerecursive - if this operation is to be applied recursively to all resources in a folder
CmsException - if something goes wrongI_CmsResourceType.setDateReleased(org.opencms.file.CmsObject, CmsSecurityManager, CmsResource, long, boolean)public void setModuleName(java.lang.String moduleName)
I_CmsResourceTypenull.
setModuleName in interface I_CmsResourceTypemoduleName - the module name if this is an additional resource type which is defined in a module, or nullI_CmsResourceType.setModuleName(java.lang.String)public java.lang.String toString()
toString in class java.lang.ObjectObject.toString()
public void undelete(CmsObject cms,
CmsSecurityManager securityManager,
CmsResource resource,
boolean recursive)
throws CmsException
I_CmsResourceTypeOnly resources that have already been published once can be undeleted, if a "new" resource is deleted it can not be undeleted.
undelete in interface I_CmsResourceTypecms - the current cms contextsecurityManager - the initialized OpenCms security managerresource - the resource to undeleterecursive - if this operation is to be applied recursively to all resources in a folder
CmsException - if something goes wrongI_CmsResourceType.undelete(org.opencms.file.CmsObject, CmsSecurityManager, CmsResource, boolean)
public void undoChanges(CmsObject cms,
CmsSecurityManager securityManager,
CmsResource resource,
CmsResource.CmsResourceUndoMode mode)
throws CmsException
I_CmsResourceType
undoChanges in interface I_CmsResourceTypecms - the current cms contextsecurityManager - the initialized OpenCms security managerresource - the resource to undo the changes formode - the undo mode, one of the CmsResource.CmsResourceUndoMode#UNDO_XXX constants
CmsException - if something goes wrongI_CmsResourceType.undoChanges(org.opencms.file.CmsObject, CmsSecurityManager, CmsResource, CmsResource.CmsResourceUndoMode)
public void unlockResource(CmsObject cms,
CmsSecurityManager securityManager,
CmsResource resource)
throws CmsException
I_CmsResourceType
unlockResource in interface I_CmsResourceTypecms - the current cms contextsecurityManager - the initialized OpenCms security managerresource - the resource to unlock
CmsException - if something goes wrongI_CmsResourceType.unlockResource(org.opencms.file.CmsObject, CmsSecurityManager, CmsResource)
public CmsFile writeFile(CmsObject cms,
CmsSecurityManager securityManager,
CmsFile resource)
throws CmsException
I_CmsResourceType
Applies only to resources of type
that have a binary content attached.CmsFile
writeFile in interface I_CmsResourceTypecms - the current cms contextsecurityManager - the initialized OpenCms security managerresource - the resource to apply this operation to
CmsException - if something goes wrongI_CmsResourceType.writeFile(org.opencms.file.CmsObject, CmsSecurityManager, CmsFile)
public void writePropertyObject(CmsObject cms,
CmsSecurityManager securityManager,
CmsResource resource,
CmsProperty property)
throws CmsException
I_CmsResourceType
writePropertyObject in interface I_CmsResourceTypecms - the current cms contextsecurityManager - the initialized OpenCms security managerresource - the resource to write the property forproperty - the property to write
CmsException - if something goes wrongI_CmsResourceType.writePropertyObject(org.opencms.file.CmsObject, org.opencms.db.CmsSecurityManager, CmsResource, org.opencms.file.CmsProperty)
public void writePropertyObjects(CmsObject cms,
CmsSecurityManager securityManager,
CmsResource resource,
java.util.List<CmsProperty> properties)
throws CmsException
I_CmsResourceType
Code calling this method has to ensure that the no properties
a, b are contained in the specified list so that a.equals(b),
otherwise an exception is thrown.
writePropertyObjects in interface I_CmsResourceTypecms - the current cms contextsecurityManager - the initialized OpenCms security managerresource - the resource to write the properties forproperties - the list of properties to write
CmsException - if something goes wrongI_CmsResourceType.writePropertyObjects(org.opencms.file.CmsObject, org.opencms.db.CmsSecurityManager, CmsResource, java.util.List)
protected CmsResource createRelations(CmsObject cms,
CmsSecurityManager securityManager,
java.lang.String resourceName)
throws CmsException
cms - the cms contextsecurityManager - the security managerresourceName - the resource name of the resource to update the relations for
CmsException - if something goes wrong
protected CmsMacroResolver getMacroResolver(CmsObject cms,
java.lang.String resourcename)
cms - the current OpenCms user contextresourcename - the resource name for macros like MACRO_RESOURCE_FOLDER_PATH
protected I_CmsResourceType getResourceType(CmsResource resource)
resource - the resource to get the type for
CmsResourceManager.getResourceType(int)
protected void processCopyResources(CmsObject cms,
java.lang.String resourcename,
CmsMacroResolver resolver)
cms - the current OpenCms user contextresourcename - the name of the base resourceresolver - the resolver used for resolving target macro names
protected java.util.List<CmsProperty> processDefaultProperties(java.util.List<CmsProperty> properties,
CmsMacroResolver resolver)
It's possible to use OpenCms macros for the property values.
Please see CmsMacroResolver for allowed macro values.
properties - the (optional) properties provided by the userresolver - the resolver used to resolve the macro values
protected void updateRelationForUndo(CmsObject cms,
CmsSecurityManager securityManager,
CmsResource resource)
throws CmsException
cms - the cms contextsecurityManager - the security managerresource - the resource that has been undone
CmsException - if something goes wrong
|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||