org.opencms.db
Class CmsDriverManager

java.lang.Object
  extended byorg.opencms.db.CmsDriverManager
All Implemented Interfaces:
I_CmsEventListener

public final class CmsDriverManager
extends java.lang.Object
implements I_CmsEventListener

The OpenCms driver manager.

Since:
6.0.0
Author:
Alexander Kandzior, Thomas Weckert, Carsten Weinholz, Michael Emmerich, Michael Moossen

Field Summary
static java.lang.String CACHE_ALL_PROPERTIES
          Cache key for all properties.
static java.lang.String CONFIGURATION_BACKUP
          "driver.backup" string in the configuration-file.
static java.lang.String CONFIGURATION_CACHE
          "cache" string in the configuration-file.
static java.lang.String CONFIGURATION_DB
          "db" string in the configuration-file.
static java.lang.String CONFIGURATION_PROJECT
          "driver.project" string in the configuration-file.
static java.lang.String CONFIGURATION_USER
          "driver.user" string in the configuration-file.
static java.lang.String CONFIGURATION_VFS
          "driver.vfs" string in the configuration-file.
static java.lang.String CONFIGURATION_WORKFLOW
          "driver.workflow" string in the configuration-file.
static java.lang.String LOST_AND_FOUND_FOLDER
          The vfs path of the loast and found folder.
static int MAX_VFS_RESOURCE_PATH_LENGTH
          The maximum length of a VFS resource path.
static int NOTHING_CHANGED
          Key for indicating no changes.
static java.lang.String READ_IGNORE_PARENT
          Indicates to ignore the resource path when matching resources.
static int READ_IGNORE_STATE
          Indicates to ignore the resource state when matching resources.
static long READ_IGNORE_TIME
          Indicates to ignore the time value.
static int READ_IGNORE_TYPE
          Indicates to ignore the resource type when matching resources.
static int READMODE_EXCLUDE_STATE
          Indicates to match resources NOT having the given state.
static int READMODE_EXCLUDE_TREE
          Indicates to match immediate children only.
static int READMODE_EXCLUDE_TYPE
          Indicates to match resources NOT having the given type.
static int READMODE_IGNORESTATE
          Mode for reading project resources from the db.
static int READMODE_INCLUDE_PROJECT
          Indicates to match resources in given project only.
static int READMODE_INCLUDE_TREE
          Indicates to match all successors.
static int READMODE_MATCHSTATE
          Mode for reading project resources from the db.
static int READMODE_ONLY_FILES
          Indicates if only file resources should be read.
static int READMODE_ONLY_FOLDERS
          Indicates if only folder resources should be read.
static int READMODE_UNMATCHSTATE
          Mode for reading project resources from the db.
static int UPDATE_ALL
          Key to indicate complete update.
static int UPDATE_RESOURCE
          Key to indicate update of resource record.
static int UPDATE_RESOURCE_STATE
          Key to indicate update of resource state.
static int UPDATE_STRUCTURE
          Key to indicate update of structure record.
static int UPDATE_STRUCTURE_STATE
          Key to indicate update of structure state.
 
Fields inherited from interface org.opencms.main.I_CmsEventListener
EVENT_BEFORE_PUBLISH_PROJECT, EVENT_CLEAR_CACHES, EVENT_CLEAR_OFFLINE_CACHES, EVENT_CLEAR_ONLINE_CACHES, EVENT_CLEAR_PRINCIPAL_CACHES, EVENT_FLEX_CACHE_CLEAR, EVENT_FLEX_PURGE_JSP_REPOSITORY, EVENT_LOGIN_USER, EVENT_PROJECT_MODIFIED, EVENT_PROPERTY_DEFINITION_CREATED, EVENT_PROPERTY_DEFINITION_MODIFIED, EVENT_PROPERTY_MODIFIED, EVENT_PUBLISH_PROJECT, EVENT_RESOURCE_AND_PROPERTIES_MODIFIED, EVENT_RESOURCE_COPIED, EVENT_RESOURCE_CREATED, EVENT_RESOURCE_DELETED, EVENT_RESOURCE_LIST_MODIFIED, EVENT_RESOURCE_MODIFIED, EVENT_RESOURCES_AND_PROPERTIES_MODIFIED, EVENT_RESOURCES_MODIFIED, EVENT_UPDATE_EXPORTS, KEY_DBCONTEXT, KEY_PROJECTID, KEY_PUBLISHID, KEY_PUBLISHLIST, KEY_REPORT, LISTENERS_FOR_ALL_EVENTS
 
Method Summary
 void acceptTask(CmsDbContext dbc, int taskId)
          Updates the state of the given task as accepted by the current user.
 void addUserToGroup(CmsDbContext dbc, java.lang.String username, java.lang.String groupname)
          Adds a user to a group.
 CmsUser addWebUser(CmsDbContext dbc, java.lang.String name, java.lang.String password, java.lang.String group, java.lang.String description, java.util.Map additionalInfos)
          Creates a new web user.
 CmsUser addWebUser(CmsDbContext dbc, java.lang.String name, java.lang.String password, java.lang.String group, java.lang.String additionalGroup, java.lang.String description, java.util.Map additionalInfos)
          Adds a web user to the Cms.
 void backupProject(CmsDbContext dbc, int tagId, long publishDate)
          Creates a backup of the current project.
 void changeLastModifiedProjectId(CmsDbContext dbc, CmsResource resource)
          Changes the project id of the resource to the current project, indicating that the resource was last modified in this project.
 void changeLock(CmsDbContext dbc, CmsResource resource)
          Changes the lock of a resource to the current user, that is "steals" the lock from another user.
 void changeUserType(CmsDbContext dbc, CmsUser user, int userType)
          Changes the user type of the user.
 void changeUserType(CmsDbContext dbc, CmsUUID userId, int userType)
          Changes the user type of the user.
 void changeUserType(CmsDbContext dbc, java.lang.String username, int userType)
          Changes the user type of the user.
 void chflags(CmsDbContext dbc, CmsResource resource, int flags)
          Changes the resource flags of a resource.
 void chtype(CmsDbContext dbc, CmsResource resource, int type)
          Changes the resource type of a resource.
 void cmsEvent(CmsEvent event)
          Acknowledge the occurrence of the specified event, implement this method to check for CmsEvents in your class.
protected  CmsFolder convertResourceToFolder(CmsResource resource)
          Converts a resource to a folder (if possible).
 void copyAccessControlEntries(CmsDbContext dbc, CmsResource source, CmsResource destination, boolean updateLastModifiedInfo)
          Copies the access control entries of a given resource to a destination resorce.
 void copyResource(CmsDbContext dbc, CmsResource source, java.lang.String destination, int siblingMode)
          Copies a resource.
 void copyResourceToProject(CmsDbContext dbc, CmsResource resource)
          Copies a resource to the current project of the user.
 int countLockedResources(CmsDbContext dbc, java.lang.String foldername)
          Counts the locked resources in a given folder.
 int countLockedResources(CmsProject project)
          Counts the locked resources in this project.
 CmsGroup createGroup(CmsDbContext dbc, CmsUUID id, java.lang.String name, java.lang.String description, int flags, java.lang.String parent)
          Add a new group to the Cms.
 CmsTask createProject(CmsDbContext dbc, java.lang.String projectName, java.lang.String roleName, long timeout, int priority)
          Creates a new task for project creation.
 CmsProject createProject(CmsDbContext dbc, java.lang.String name, java.lang.String description, java.lang.String groupname, java.lang.String managergroupname, int projecttype)
          Creates a project.
 CmsPropertyDefinition createPropertyDefinition(CmsDbContext dbc, java.lang.String name)
          Creates a property definition.
 CmsResource createResource(CmsDbContext dbc, java.lang.String resourcePath, CmsResource resource, byte[] content, java.util.List properties, boolean importCase)
          Creates a new resource with the provided content and properties.
 CmsResource createResource(CmsDbContext dbc, java.lang.String resourcename, int type, byte[] content, java.util.List properties)
          Creates a new resource of the given resource type with the provided content and properties.
 void createSibling(CmsDbContext dbc, CmsResource source, java.lang.String destination, java.util.List properties)
          Creates a new sibling of the source resource.
 CmsTask createTask(CmsDbContext dbc, CmsUser currentUser, int projectid, java.lang.String agentName, java.lang.String roleName, java.lang.String taskName, java.lang.String taskComment, int taskType, long timeout, int priority)
          Creates a new task.
 CmsTask createTask(CmsDbContext dbc, java.lang.String agentName, java.lang.String roleName, java.lang.String taskname, long timeout, int priority)
          Creates a new task.
 CmsProject createTempfileProject(CmsDbContext dbc)
          Creates the project for the temporary workplace files.
 CmsUser createUser(CmsDbContext dbc, java.lang.String name, java.lang.String password, java.lang.String description, java.util.Map additionalInfos)
          Creates a new user.
 void deleteAllProperties(CmsDbContext dbc, java.lang.String resourcename)
          Deletes all property values of a file or folder.
 void deleteAllStaticExportPublishedResources(CmsDbContext dbc, int linkType)
          Deletes all entries in the published resource table.
 void deleteBackup(CmsDbContext dbc, CmsResource res)
          Deletes all backup versions of a single resource.
 void deleteBackups(CmsDbContext dbc, long timestamp, int versions, I_CmsReport report)
          Deletes the versions from the backup tables that are older then the given timestamp and/or number of remaining versions.
 void deleteGroup(CmsDbContext dbc, CmsGroup group, CmsUUID replacementId)
          Deletes a group, where all permissions, users and childs of the group are transfered to a replacement group.
 void deleteGroup(CmsDbContext dbc, java.lang.String name)
          Deletes a user group.
 void deleteProject(CmsDbContext dbc, CmsProject deleteProject)
          Deletes a project.
 void deletePropertyDefinition(CmsDbContext dbc, java.lang.String name)
          Deletes a property definition.
 void deleteResource(CmsDbContext dbc, CmsResource resource, int siblingMode)
          Deletes a resource.
 void deleteStaticExportPublishedResource(CmsDbContext dbc, java.lang.String resourceName, int linkType, java.lang.String linkParameter)
          Deletes an entry in the published resource table.
 void deleteUser(CmsDbContext dbc, CmsProject project, java.lang.String username, java.lang.String replacementUsername)
          Deletes a user, where all permissions and resources attributes of the user were transfered to a replacement user, if given.
 void deleteWebUser(CmsDbContext dbc, CmsUUID userId)
          Deletes a web user from the Cms.
 void destroy()
          Destroys this driver manager.
 void endTask(CmsDbContext dbc, int taskid)
          Ends a task.
 boolean existsResourceId(CmsDbContext dbc, CmsUUID resourceId)
          Tests if a resource with the given resourceId does already exist in the Database.
 CmsPublishList fillPublishList(CmsDbContext dbc, CmsPublishList publishList)
          Fills the given publish list with the the VFS resources that actually get published.
protected  void finalize()
          Releases any allocated resources during garbage collection.
 void forwardTask(CmsDbContext dbc, int taskid, java.lang.String newRoleName, java.lang.String newUserName)
          Forwards a task to a new user.
 java.util.List getAccessControlEntries(CmsDbContext dbc, CmsResource resource, boolean getInherited)
          Returns the list of access control entries of a resource given its name.
 CmsAccessControlList getAccessControlList(CmsDbContext dbc, CmsResource resource)
          Returns the full access control list of a given resource.
 CmsAccessControlList getAccessControlList(CmsDbContext dbc, CmsResource resource, boolean inheritedOnly)
          Returns the access control list of a given resource.
 int getActiveConnections(java.lang.String dbPoolUrl)
          Returns the number of active connections managed by a pool.
 java.util.List getAllAccessibleProjects(CmsDbContext dbc)
          Returns all projects which are owned by the current user or which are accessible by the current user.
 java.util.List getAllBackupProjects(CmsDbContext dbc)
          Returns a Vector with all projects from history.
 java.util.List getAllManageableProjects(CmsDbContext dbc)
          Returns all projects which are owned by the current user or which are manageable for the group of the user.
 I_CmsBackupDriver getBackupDriver()
          Returns the backup driver.
 int getBackupTagId(CmsDbContext dbc)
          Returns the next version id for the published backup resources.
 java.util.List getChild(CmsDbContext dbc, java.lang.String groupname)
          Returns all child groups of a group.
 java.util.List getChilds(CmsDbContext dbc, java.lang.String groupname)
          Returns all child groups of a group.
 java.util.Map getConfigurations()
          Method to access the configurations of the properties-file.
 java.util.List getDirectGroupsOfUser(CmsDbContext dbc, java.lang.String username)
          Returns the list of groups to which the user directly belongs to.
 java.util.List getGroups(CmsDbContext dbc)
          Returns all available groups.
 java.util.List getGroupsOfUser(CmsDbContext dbc, java.lang.String username)
          Returns the groups of a user.
 java.util.List getGroupsOfUser(CmsDbContext dbc, java.lang.String username, java.lang.String remoteAddress)
          Returns the groups of a Cms user filtered by the specified IP address.
 CmsXmlDocumentLinkValidator getHtmlLinkValidator()
          Returns the HTML link validator.
 int getIdleConnections(java.lang.String dbPoolUrl)
          Returns the number of idle connections managed by a pool.
 CmsLock getLock(CmsDbContext dbc, CmsResource resource)
          Returns the lock state of a resource.
 CmsGroup getParent(CmsDbContext dbc, java.lang.String groupname)
          Returns the parent group of a group.
 CmsPermissionSetCustom getPermissions(CmsDbContext dbc, CmsResource resource, CmsUser user)
          Returns the set of permissions of the current user for a given resource.
 I_CmsProjectDriver getProjectDriver()
          Returns the project driver.
 java.util.List getResourcesForPrincipal(CmsDbContext dbc, CmsProject project, CmsUUID principalId, CmsPermissionSet permissions, boolean includeAttr)
          Returns all resources associated to a given principal via an ACE with the given permissions.
 CmsSqlManager getSqlManager()
          Returns an instance of the common sql manager.
 java.lang.String getTaskPar(CmsDbContext dbc, int taskId, java.lang.String parName)
          Returns the value of the given parameter for the given task.
 int getTaskType(CmsDbContext dbc, java.lang.String taskName)
          Returns the template task id for a given taskname.
 I_CmsUserDriver getUserDriver()
          Returns the user driver.
 java.util.List getUsers(CmsDbContext dbc)
          Returns all available users.
 java.util.List getUsers(CmsDbContext dbc, int type)
          Returns all users from a given type.
 java.util.List getUsersOfGroup(CmsDbContext dbc, java.lang.String groupname)
          Returns a list of users in a group.
 I_CmsVfsDriver getVfsDriver()
          Returns the VFS driver.
 I_CmsWorkflowDriver getWorkflowDriver()
          Returns the workflow driver.
 void importAccessControlEntries(CmsDbContext dbc, CmsResource resource, java.util.List acEntries)
          Writes a vector of access control entries as new access control entries of a given resource.
 CmsUser importUser(CmsDbContext dbc, java.lang.String id, java.lang.String name, java.lang.String password, java.lang.String description, java.lang.String firstname, java.lang.String lastname, java.lang.String email, java.lang.String address, int flags, int type, java.util.Map additionalInfos)
          Creates a new user by import.
 void init(CmsConfigurationManager configurationManager, java.util.Map configuration, I_CmsVfsDriver vfsDriver, I_CmsUserDriver userDriver, I_CmsProjectDriver projectDriver, I_CmsWorkflowDriver workflowDriver, I_CmsBackupDriver backupDriver)
          Initializes the driver and sets up all required modules and connections.
 boolean isInsideCurrentProject(CmsDbContext dbc, java.lang.String resourcename)
          Checks if the specified resource is inside the current project.
 boolean isLocked(CmsDbContext dbc, CmsResource resource)
          Proves if a resource is locked.
 boolean isTempfileProject(CmsProject project)
          Checks if a project is the tempfile project.
 boolean isUser(CmsDbContext dbc)
          Determines if the user is a member of the default users group.
protected  boolean isWebgroup(CmsDbContext dbc, CmsGroup group)
          Checks if this is a valid group for webusers.
 boolean labelResource(CmsDbContext dbc, CmsResource resource, java.lang.String newResource, int action)
          Checks if one of the resources (except the resource itself) is a sibling in a "labeled" site folder.
 CmsUser lockedBy(CmsDbContext dbc, CmsResource resource)
          Returns the user, who had locked the resource.
 void lockResource(CmsDbContext dbc, CmsResource resource, int mode)
          Locks a resource.
 CmsUser loginUser(CmsDbContext dbc, java.lang.String userName, java.lang.String password, java.lang.String remoteAddress, int userType)
          Attempts to authenticate a user into OpenCms with the given password.
 I_CmsPrincipal lookupPrincipal(CmsDbContext dbc, CmsUUID principalId)
          Lookup and read the user or group with the given UUID.
 I_CmsPrincipal lookupPrincipal(CmsDbContext dbc, java.lang.String principalName)
          Lookup and read the user or group with the given name.
 java.lang.String moveToLostAndFound(CmsDbContext dbc, java.lang.String resourcename, boolean returnNameOnly)
          Moves a resource to the "lost and found" folder.
 java.lang.Object newDriverInstance(CmsConfigurationManager configurationManager, java.lang.String driverName, java.util.List successiveDrivers)
          Gets a new driver instance.
 java.lang.Object newDriverInstance(org.apache.commons.collections.ExtendedProperties configuration, java.lang.String driverName, java.lang.String driverPoolUrl)
          Method to create a new instance of a driver.
static CmsDriverManager newInstance(CmsConfigurationManager configurationManager, CmsSecurityManager securityManager, I_CmsDbContextFactory runtimeInfoFactory)
          Reads the required configurations from the opencms.properties file and creates the various drivers to access the cms resources.
 void newPoolInstance(java.util.Map configuration, java.lang.String poolName)
          Method to create a new instance of a pool.
 void publishProject(CmsObject cms, CmsDbContext dbc, CmsPublishList publishList, I_CmsReport report)
          Publishes the resources of a specified publish list.
 void reactivateTask(CmsDbContext dbc, int taskId)
          Reactivates a task.
 CmsAccessControlEntry readAccessControlEntry(CmsDbContext dbc, CmsResource resource, CmsUUID principal)
          Reads an access control entry from the cms.
 CmsUser readAgent(CmsDbContext dbc, CmsTask task)
          Reads the agent of a task.
 java.util.List readAllBackupFileHeaders(CmsDbContext dbc, CmsResource resource)
          Reads all file headers of a file.
 java.util.List readAllPropertyDefinitions(CmsDbContext dbc)
          Reads all property definitions for the given mapping type.
 CmsBackupResource readBackupFile(CmsDbContext dbc, int tagId, CmsResource resource)
          Returns a file from the history.
 CmsBackupProject readBackupProject(CmsDbContext dbc, int tagId)
          Returns a backup project.
 java.util.List readBackupPropertyObjects(CmsDbContext dbc, CmsBackupResource resource)
          Reads the list of CmsProperty objects that belong the the given backup resource.
 java.util.List readChangedResourcesInsideProject(CmsDbContext dbc, int projectId, int resourceType)
          Reads all resources that are inside and changed in a specified project.
 java.util.List readChildResources(CmsDbContext dbc, CmsResource resource, CmsResourceFilter filter, boolean getFolders, boolean getFiles)
          Returns the child resources of a resource, that is the resources contained in a folder.
 CmsFile readFile(CmsDbContext dbc, CmsResource resource, CmsResourceFilter filter)
          Reads a file resource (including it's binary content) from the VFS, using the specified resource filter.
 CmsFolder readFolder(CmsDbContext dbc, java.lang.String resourcename, CmsResourceFilter filter)
          Reads a folder from the VFS, using the specified resource filter.
 java.util.List readGivenTasks(CmsDbContext dbc, int projectId, java.lang.String ownerName, int taskType, java.lang.String orderBy, java.lang.String sort)
          Reads all given tasks from a user for a project.
 CmsGroup readGroup(CmsDbContext dbc, CmsProject project)
          Reads the group of a project.
 CmsGroup readGroup(CmsDbContext dbc, CmsTask task)
          Reads the group (role) of a task.
 CmsGroup readGroup(CmsDbContext dbc, CmsUUID groupId)
          Reads a group based on its id.
 CmsGroup readGroup(CmsDbContext dbc, java.lang.String groupname)
          Reads a group based on its name.
 CmsGroup readManagerGroup(CmsDbContext dbc, CmsProject project)
          Reads the manager group of a project.
 CmsUser readOriginalAgent(CmsDbContext dbc, CmsTask task)
          Reads the original agent of a task.
 CmsUser readOwner(CmsDbContext dbc, CmsProject project)
          Reads the owner of a project.
 CmsUser readOwner(CmsDbContext dbc, CmsTask task)
          Reads the owner (initiator) of a task.
 CmsUser readOwner(CmsDbContext dbc, CmsTaskLog log)
          Reads the owner of a tasklog.
 java.util.List readPath(CmsDbContext dbc, int projectId, java.lang.String path, CmsResourceFilter filter)
          Builds a list of resources for a given path.
 CmsProject readProject(CmsDbContext dbc, CmsTask task)
          Reads a project of a given task.
 CmsProject readProject(CmsDbContext dbc, int id)
          Reads a project given the projects id.
 CmsProject readProject(CmsDbContext dbc, java.lang.String name)
          Reads a project.
 java.util.List readProjectLogs(CmsDbContext dbc, int projectId)
          Reads all task log entries for a project.
 java.util.List readProjectResources(CmsDbContext dbc, CmsProject project)
          Returns the list of all resource names that define the "view" of the given project.
 java.util.List readProjectView(CmsDbContext dbc, int projectId, int state)
          Reads all resources of a project that match a given state from the VFS.
 CmsPropertyDefinition readPropertyDefinition(CmsDbContext dbc, java.lang.String name)
          Reads a property definition.
 CmsProperty readPropertyObject(CmsDbContext dbc, CmsResource resource, java.lang.String key, boolean search)
          Reads a property object from a resource specified by a property name.
 java.util.List readPropertyObjects(CmsDbContext dbc, CmsResource resource, boolean search)
          Reads all property objects mapped to a specified resource from the database.
 java.util.List readPublishedResources(CmsDbContext dbc, CmsUUID publishHistoryId)
          Reads the resources that were published in a publish task for a given publish history ID.
 java.util.List readPublishProjectView(CmsDbContext dbc, int projectId, java.lang.String criteria)
          Reads all project resources that belong to a given view criteria.
 CmsResource readResource(CmsDbContext dbc, java.lang.String resourcePath, CmsResourceFilter filter)
          Reads a resource from the VFS, using the specified resource filter.
 java.util.List readResources(CmsDbContext dbc, CmsResource parent, CmsResourceFilter filter, boolean readTree)
          Reads all resources below the given path matching the filter criteria, including the full tree below the path only in case the readTree parameter is true.
 java.util.List readResourcesWithProperty(CmsDbContext dbc, java.lang.String path, java.lang.String propertyDefinition)
          Reads all resources that have a value set for the specified property (definition) in the given path.
 java.util.List readResourcesWithProperty(CmsDbContext dbc, java.lang.String path, java.lang.String propertyDefinition, java.lang.String value)
          Reads all resources that have a value (containing the given value string) set for the specified property (definition) in the given path.
 java.util.Set readResponsiblePrincipals(CmsDbContext dbc, CmsResource resource)
          Returns the set of users that are responsible for a specific resource.
 java.util.Set readResponsibleUsers(CmsDbContext dbc, CmsResource resource)
          Returns the set of users that are responsible for a specific resource.
 java.util.List readSiblings(CmsDbContext dbc, CmsResource resource, CmsResourceFilter filter)
          Returns a List of all siblings of the specified resource, the specified resource being always part of the result set.
 java.lang.String readStaticExportPublishedResourceParameters(CmsDbContext dbc, java.lang.String rfsName)
          Returns the parameters of a resource in the table of all published template resources.
 java.util.List readStaticExportResources(CmsDbContext dbc, int parameterResources, long timestamp)
          Returns a list of all template resources which must be processed during a static export.
 CmsTask readTask(CmsDbContext dbc, int id)
          Reads the task with the given id.
 java.util.List readTaskLogs(CmsDbContext dbc, int taskid)
          Reads log entries for a task.
 java.util.List readTasksForProject(CmsDbContext dbc, int projectId, int tasktype, java.lang.String orderBy, java.lang.String sort)
          Reads all tasks for a project.
 java.util.List readTasksForRole(CmsDbContext dbc, int projectId, java.lang.String roleName, int tasktype, java.lang.String orderBy, java.lang.String sort)
          Reads all tasks for a role in a project.
 java.util.List readTasksForUser(CmsDbContext dbc, int projectId, java.lang.String userName, int taskType, java.lang.String orderBy, java.lang.String sort)
          Reads all tasks for a user in a project.
 CmsUser readUser(CmsDbContext dbc, CmsUUID id)
          Returns a user object based on the id of a user.
 CmsUser readUser(CmsDbContext dbc, java.lang.String username)
          Returns a user object.
 CmsUser readUser(CmsDbContext dbc, java.lang.String username, int type)
          Returns a user object.
 CmsUser readUser(CmsDbContext dbc, java.lang.String username, java.lang.String password)
          Returns a user object if the password for the user is correct.
 CmsUser readWebUser(CmsDbContext dbc, java.lang.String username)
          Read a web user from the database.
 CmsUser readWebUser(CmsDbContext dbc, java.lang.String username, java.lang.String password)
          Returns a user object if the password for the user is correct.
 void removeAccessControlEntry(CmsDbContext dbc, CmsResource resource, CmsUUID principal)
          Removes an access control entry for a given resource and principal.
 void removeResourceFromProject(CmsDbContext dbc, CmsResource resource)
          Removes a resource from the current project of the user.
 void removeUserFromGroup(CmsDbContext dbc, java.lang.String username, java.lang.String groupname)
          Removes a user from a group.
 void replaceResource(CmsDbContext dbc, CmsResource resource, int type, byte[] content, java.util.List properties)
          Replaces the content, type and properties of a resource.
 void resetPassword(CmsDbContext dbc, java.lang.String username, java.lang.String oldPassword, java.lang.String newPassword)
          Resets the password for a specified user.
 void restoreResource(CmsDbContext dbc, CmsResource resource, int tag)
          Restores a file in the current project with a version from the backup archive.
 void setDateExpired(CmsDbContext dbc, CmsResource resource, long dateExpired)
          Changes the "expire" date of a resource.
 void setDateLastModified(CmsDbContext dbc, CmsResource resource, long dateLastModified)
          Changes the "last modified" timestamp of a resource.
 void setDateReleased(CmsDbContext dbc, CmsResource resource, long dateReleased)
          Changes the "release" date of a resource.
 void setName(CmsDbContext dbc, int taskId, java.lang.String name)
          Set a new name for a task.
 void setParentGroup(CmsDbContext dbc, java.lang.String groupName, java.lang.String parentGroupName)
          Sets a new parent group for an already existing group.
 void setPassword(CmsDbContext dbc, java.lang.String username, java.lang.String newPassword)
          Sets the password for a user.
 void setPriority(CmsDbContext dbc, int taskId, int priority)
          Set priority of a task.
 void setTaskPar(CmsDbContext dbc, int taskId, java.lang.String parName, java.lang.String parValue)
          Set a Parameter for a task.
 void setTimeout(CmsDbContext dbc, int taskId, long timeout)
          Set the timeout of a task.
 void undoChanges(CmsDbContext dbc, CmsResource resource)
          Undos all changes in the resource by restoring the version from the online project to the current offline project.
 void unlockProject(CmsProject project)
          Unlocks all resources in the given project.
 void unlockResource(CmsDbContext dbc, CmsResource resource)
          Unlocks a resource.
 void updateExportPoints(CmsDbContext dbc, I_CmsReport report)
          Update the export points.
 boolean userInGroup(CmsDbContext dbc, java.lang.String username, java.lang.String groupname)
          Returns true if a user is member of the given group.
 java.util.Map validateHtmlLinks(CmsObject cms, CmsPublishList publishList, I_CmsReport report)
          Validates the HTML links in the unpublished files of the specified publish list, if a file resource type implements the interface I_CmsXmlDocumentLinkValidatable.
 void validatePassword(java.lang.String password)
          This method checks if a new password follows the rules for new passwords, which are defined by a Class implementing the I_CmsPasswordHandler interface and configured in the opencms.properties file.
 void writeAccessControlEntry(CmsDbContext dbc, CmsResource resource, CmsAccessControlEntry ace)
          Writes an access control entries to a given resource.
 void writeExportPoints(CmsDbContext dbc, int projectId, I_CmsReport report, CmsUUID publishHistoryId)
          Writes all export points into the file system for a publish task specified by its publish history ID.
 CmsFile writeFile(CmsDbContext dbc, CmsFile resource)
          Writes a resource to the OpenCms VFS, including it's content.
 void writeGroup(CmsDbContext dbc, CmsGroup group)
          Writes an already existing group.
 void writeProject(CmsDbContext dbc, CmsProject project)
          Writes an already existing project.
 void writePropertyObject(CmsDbContext dbc, CmsResource resource, CmsProperty property)
          Writes a property for a specified resource.
 void writePropertyObjects(CmsDbContext dbc, CmsResource resource, java.util.List properties)
          Writes a list of properties for a specified resource.
 void writeResource(CmsDbContext dbc, CmsResource resource)
          Writes a resource to the OpenCms VFS.
 void writeStaticExportPublishedResource(CmsDbContext dbc, java.lang.String resourceName, int linkType, java.lang.String linkParameter, long timestamp)
          Inserts an entry in the published resource table.
 void writeTaskLog(CmsDbContext dbc, int taskid, java.lang.String comment)
          Writes a new user tasklog for a task.
 void writeTaskLog(CmsDbContext dbc, int taskId, java.lang.String comment, int type)
          Writes a new task log entry for a task.
 void writeUser(CmsDbContext dbc, CmsUser user)
          Updates the user information.
 void writeWebUser(CmsDbContext dbc, CmsUser user)
          Updates the user information of a web user.
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CACHE_ALL_PROPERTIES

public static final java.lang.String CACHE_ALL_PROPERTIES
Cache key for all properties.

See Also:
Constant Field Values

CONFIGURATION_BACKUP

public static final java.lang.String CONFIGURATION_BACKUP
"driver.backup" string in the configuration-file.

See Also:
Constant Field Values

CONFIGURATION_CACHE

public static final java.lang.String CONFIGURATION_CACHE
"cache" string in the configuration-file.

See Also:
Constant Field Values

CONFIGURATION_DB

public static final java.lang.String CONFIGURATION_DB
"db" string in the configuration-file.

See Also:
Constant Field Values

CONFIGURATION_PROJECT

public static final java.lang.String CONFIGURATION_PROJECT
"driver.project" string in the configuration-file.

See Also:
Constant Field Values

CONFIGURATION_USER

public static final java.lang.String CONFIGURATION_USER
"driver.user" string in the configuration-file.

See Also:
Constant Field Values

CONFIGURATION_VFS

public static final java.lang.String CONFIGURATION_VFS
"driver.vfs" string in the configuration-file.

See Also:
Constant Field Values

CONFIGURATION_WORKFLOW

public static final java.lang.String CONFIGURATION_WORKFLOW
"driver.workflow" string in the configuration-file.

See Also:
Constant Field Values

LOST_AND_FOUND_FOLDER

public static final java.lang.String LOST_AND_FOUND_FOLDER
The vfs path of the loast and found folder.

See Also:
Constant Field Values

MAX_VFS_RESOURCE_PATH_LENGTH

public static final int MAX_VFS_RESOURCE_PATH_LENGTH
The maximum length of a VFS resource path.

See Also:
Constant Field Values

NOTHING_CHANGED

public static final int NOTHING_CHANGED
Key for indicating no changes.

See Also:
Constant Field Values

READ_IGNORE_PARENT

public static final java.lang.String READ_IGNORE_PARENT
Indicates to ignore the resource path when matching resources.


READ_IGNORE_STATE

public static final int READ_IGNORE_STATE
Indicates to ignore the resource state when matching resources.

See Also:
Constant Field Values

READ_IGNORE_TIME

public static final long READ_IGNORE_TIME
Indicates to ignore the time value.

See Also:
Constant Field Values

READ_IGNORE_TYPE

public static final int READ_IGNORE_TYPE
Indicates to ignore the resource type when matching resources.

See Also:
Constant Field Values

READMODE_EXCLUDE_STATE

public static final int READMODE_EXCLUDE_STATE
Indicates to match resources NOT having the given state.

See Also:
Constant Field Values

READMODE_EXCLUDE_TREE

public static final int READMODE_EXCLUDE_TREE
Indicates to match immediate children only.

See Also:
Constant Field Values

READMODE_EXCLUDE_TYPE

public static final int READMODE_EXCLUDE_TYPE
Indicates to match resources NOT having the given type.

See Also:
Constant Field Values

READMODE_IGNORESTATE

public static final int READMODE_IGNORESTATE
Mode for reading project resources from the db.

See Also:
Constant Field Values

READMODE_INCLUDE_PROJECT

public static final int READMODE_INCLUDE_PROJECT
Indicates to match resources in given project only.

See Also:
Constant Field Values

READMODE_INCLUDE_TREE

public static final int READMODE_INCLUDE_TREE
Indicates to match all successors.

See Also:
Constant Field Values

READMODE_MATCHSTATE

public static final int READMODE_MATCHSTATE
Mode for reading project resources from the db.

See Also:
Constant Field Values

READMODE_ONLY_FILES

public static final int READMODE_ONLY_FILES
Indicates if only file resources should be read.

See Also:
Constant Field Values

READMODE_ONLY_FOLDERS

public static final int READMODE_ONLY_FOLDERS
Indicates if only folder resources should be read.

See Also:
Constant Field Values

READMODE_UNMATCHSTATE

public static final int READMODE_UNMATCHSTATE
Mode for reading project resources from the db.

See Also:
Constant Field Values

UPDATE_ALL

public static final int UPDATE_ALL
Key to indicate complete update.

See Also:
Constant Field Values

UPDATE_RESOURCE

public static final int UPDATE_RESOURCE
Key to indicate update of resource record.

See Also:
Constant Field Values

UPDATE_RESOURCE_STATE

public static final int UPDATE_RESOURCE_STATE
Key to indicate update of resource state.

See Also:
Constant Field Values

UPDATE_STRUCTURE

public static final int UPDATE_STRUCTURE
Key to indicate update of structure record.

See Also:
Constant Field Values

UPDATE_STRUCTURE_STATE

public static final int UPDATE_STRUCTURE_STATE
Key to indicate update of structure state.

See Also:
Constant Field Values
Method Detail

newInstance

public static CmsDriverManager newInstance(CmsConfigurationManager configurationManager,
                                           CmsSecurityManager securityManager,
                                           I_CmsDbContextFactory runtimeInfoFactory)
                                    throws CmsInitException
Reads the required configurations from the opencms.properties file and creates the various drivers to access the cms resources.

The initialization process of the driver manager and its drivers is split into the following phases:

Parameters:
configurationManager - the configuration manager
securityManager - the security manager
runtimeInfoFactory - the initialized OpenCms runtime info factory
Returns:
CmsDriverManager the instanciated driver manager
Throws:
CmsInitException - if the driver manager couldn't be instanciated

acceptTask

public void acceptTask(CmsDbContext dbc,
                       int taskId)
                throws CmsException
Updates the state of the given task as accepted by the current user.

Parameters:
dbc - the current database context
taskId - the Id of the task to accept
Throws:
CmsException - if something goes wrong

addUserToGroup

public void addUserToGroup(CmsDbContext dbc,
                           java.lang.String username,
                           java.lang.String groupname)
                    throws CmsException,
                           CmsDbEntryNotFoundException
Adds a user to a group.

Parameters:
dbc - the current database context
username - the name of the user that is to be added to the group
groupname - the name of the group
Throws:
CmsException - if operation was not succesfull
CmsDbEntryNotFoundException - if the given user or the given group was not found

addWebUser

public CmsUser addWebUser(CmsDbContext dbc,
                          java.lang.String name,
                          java.lang.String password,
                          java.lang.String group,
                          java.lang.String description,
                          java.util.Map additionalInfos)
                   throws CmsException,
                          CmsSecurityException,
                          CmsIllegalArgumentException,
                          CmsDbEntryNotFoundException
Creates a new web user.

A web user has no access to the workplace but is able to access personalized functions controlled by the OpenCms.
Moreover, a web user can be created by any user, the intention being that a "Guest" user can create a personalized account for himself.

Parameters:
dbc - the current database context
name - the new name for the user
password - the new password for the user
group - the default groupname for the user
description - the description for the user
additionalInfos - a Map with additional infos for the user Infos may be stored into the Usertables (depending on the implementation).
Returns:
the new user will be returned
Throws:
CmsException - if operation was not succesfull
CmsSecurityException - if the password is not valid
CmsIllegalArgumentException - if the provided name has an illegal format (length == 0)
CmsDbEntryNotFoundException - if the user for the given name or the given group was not found

addWebUser

public CmsUser addWebUser(CmsDbContext dbc,
                          java.lang.String name,
                          java.lang.String password,
                          java.lang.String group,
                          java.lang.String additionalGroup,
                          java.lang.String description,
                          java.util.Map additionalInfos)
                   throws CmsException,
                          CmsDbEntryNotFoundException,
                          CmsIllegalArgumentException,
                          CmsSecurityException
Adds a web user to the Cms.

A web user has no access to the workplace but is able to access personalized functions controlled by the OpenCms.

Parameters:
dbc - the current database context
name - the new name for the user
password - the new password for the user
group - the default groupname for the user
additionalGroup - an additional group for the user
description - the description for the user
additionalInfos - a Hashtable with additional infos for the user, these Infos may be stored into the Usertables (depending on the implementation)
Returns:
the new user will be returned
Throws:
CmsException - if operation was not succesfull
CmsSecurityException - if the password is not valid
CmsIllegalArgumentException - if the provided name has an illegal format (length == 0)
CmsDbEntryNotFoundException - if the user for the given name or the given group was not found

backupProject

public void backupProject(CmsDbContext dbc,
                          int tagId,
                          long publishDate)
                   throws CmsDataAccessException
Creates a backup of the current project.

Parameters:
dbc - the current database context
tagId - the version of the backup
publishDate - the date of publishing
Throws:
CmsDataAccessException - if operation was not succesful

changeLastModifiedProjectId

public void changeLastModifiedProjectId(CmsDbContext dbc,
                                        CmsResource resource)
                                 throws CmsException
Changes the project id of the resource to the current project, indicating that the resource was last modified in this project.

Parameters:
dbc - the current database context
resource - theresource to apply this operation to
Throws:
CmsException - if something goes wrong
See Also:
CmsObject.changeLastModifiedProjectId(String), I_CmsResourceType.changeLastModifiedProjectId(CmsObject, CmsSecurityManager, CmsResource)

changeLock

public void changeLock(CmsDbContext dbc,
                       CmsResource resource)
                throws CmsException,
                       CmsSecurityException
Changes the lock of a resource to the current user, that is "steals" the lock from another user.

Parameters:
dbc - the current database context
resource - the resource to change the lock for
Throws:
CmsException - if something goes wrong
CmsSecurityException - if something goes wrong
See Also:
CmsObject.changeLock(String), I_CmsResourceType.changeLock(CmsObject, CmsSecurityManager, CmsResource), CmsSecurityManager.hasPermissions(CmsRequestContext, CmsResource, CmsPermissionSet, boolean, CmsResourceFilter)

changeUserType

public void changeUserType(CmsDbContext dbc,
                           CmsUser user,
                           int userType)
                    throws CmsDataAccessException
Changes the user type of the user.

Parameters:
dbc - the current database context
user - the user to change
userType - the new usertype of the user
Throws:
CmsDataAccessException - if something goes wrong

changeUserType

public void changeUserType(CmsDbContext dbc,
                           CmsUUID userId,
                           int userType)
                    throws CmsDataAccessException,
                           CmsDbEntryNotFoundException,
                           CmsDbSqlException
Changes the user type of the user.

Parameters:
dbc - the current database context
userId - the id of the user to change
userType - the new usertype of the user
Throws:
CmsDataAccessException - if something goes wrong
CmsDataAccessException - if an underlying Exception related to runtime type instantiation (IOException, ClassCastException) occurs.
CmsDbSqlException - if an underlying Exception related to data retrieval (SQLException) occurs.
CmsDbEntryNotFoundException - if the user corresponding to the given id does not exist in the database

changeUserType

public void changeUserType(CmsDbContext dbc,
                           java.lang.String username,
                           int userType)
                    throws CmsException
Changes the user type of the user.

Only the administrator can change the type.

Parameters:
dbc - the current database context
username - the name of the user to change
userType - the new usertype of the user
Throws:
CmsException - if something goes wrong

chflags

public void chflags(CmsDbContext dbc,
                    CmsResource resource,
                    int flags)
             throws CmsException
Changes the resource flags of a resource.

The 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.

Parameters:
dbc - the current database context
resource - the resource to change the flags for
flags - the new resource flags for this resource
Throws:
CmsException - if something goes wrong
See Also:
CmsObject.chflags(String, int), I_CmsResourceType.chflags(CmsObject, CmsSecurityManager, CmsResource, int)

chtype

public void chtype(CmsDbContext dbc,
                   CmsResource resource,
                   int type)
            throws CmsException
Changes the resource type of a resource.

OpenCms 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.

Parameters:
dbc - the current database context
resource - the resource to change the type for
type - the new resource type for this resource
Throws:
CmsException - if something goes wrong
See Also:
CmsObject.chtype(String, int), I_CmsResourceType.chtype(CmsObject, CmsSecurityManager, CmsResource, int)

cmsEvent

public void cmsEvent(CmsEvent event)
Description copied from interface: I_CmsEventListener
Acknowledge the occurrence of the specified event, implement this method to check for CmsEvents in your class.

Specified by:
cmsEvent in interface I_CmsEventListener
Parameters:
event - CmsEvent that has occurred
See Also:
I_CmsEventListener.cmsEvent(org.opencms.main.CmsEvent)

copyAccessControlEntries

public void copyAccessControlEntries(CmsDbContext dbc,
                                     CmsResource source,
                                     CmsResource destination,
                                     boolean updateLastModifiedInfo)
                              throws CmsException
Copies the access control entries of a given resource to a destination resorce.

Already existing access control entries of the destination resource are removed.

Parameters:
dbc - the current database context
source - the resource to copy the access control entries from
destination - the resource to which the access control entries are copied
updateLastModifiedInfo - if true, user and date "last modified" information on the target resource will be updated
Throws:
CmsException - if something goes wrong

copyResource

public void copyResource(CmsDbContext dbc,
                         CmsResource source,
                         java.lang.String destination,
                         int siblingMode)
                  throws CmsException,
                         CmsIllegalArgumentException
Copies a resource.

You must ensure that the destination path is anabsolute, vaild and existing VFS path. Relative paths from the source are currently not supported.

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:

Parameters:
dbc - the current database context
source - the resource to copy
destination - the name of the copy destination with complete path
siblingMode - indicates how to handle siblings during copy
Throws:
CmsException - if something goes wrong
CmsIllegalArgumentException - if the source argument is null or of length 0
See Also:
CmsObject.copyResource(String, String, int), I_CmsResourceType.copyResource(CmsObject, CmsSecurityManager, CmsResource, String, int)

copyResourceToProject

public void copyResourceToProject(CmsDbContext dbc,
                                  CmsResource resource)
                           throws CmsException
Copies a resource to the current project of the user.

Parameters:
dbc - the current database context
resource - the resource to apply this operation to
Throws:
CmsException - if something goes wrong
See Also:
CmsObject.copyResourceToProject(String), I_CmsResourceType.copyResourceToProject(CmsObject, CmsSecurityManager, CmsResource)

countLockedResources

public int countLockedResources(CmsDbContext dbc,
                                java.lang.String foldername)
                         throws CmsLockException
Counts the locked resources in a given folder.

Parameters:
dbc - the current database context
foldername - the folder to search in
Returns:
the amount of locked resources in this project
Throws:
CmsLockException - if the current project is locked

countLockedResources

public int countLockedResources(CmsProject project)
                         throws CmsLockException
Counts the locked resources in this project.

Parameters:
project - the project to count the locked resources in
Returns:
the amount of locked resources in this project
Throws:
CmsLockException - if the given project itself is locked

createGroup

public CmsGroup createGroup(CmsDbContext dbc,
                            CmsUUID id,
                            java.lang.String name,
                            java.lang.String description,
                            int flags,
                            java.lang.String parent)
                     throws CmsIllegalArgumentException,
                            CmsDataAccessException
Add a new group to the Cms.

Only the admin can do this. Only users, which are in the group "administrators" are granted.

Parameters:
dbc - the current database context
id - the id of the new group
name - the name of the new group
description - the description for the new group
flags - the flags for the new group
parent - the name of the parent group (or null)
Returns:
new created group
Throws:
CmsDataAccessException - if the creation of the group failed
CmsIllegalArgumentException - if the length of the given name was below 1

createProject

public CmsTask createProject(CmsDbContext dbc,
                             java.lang.String projectName,
                             java.lang.String roleName,
                             long timeout,
                             int priority)
                      throws CmsDataAccessException
Creates a new task for project creation.

Parameters:
dbc - the current database context
projectName - name of the project
roleName - usergroup for the project
timeout - time when the Project must finished
priority - priority for the Project
Returns:
the new task project
Throws:
CmsDataAccessException - if something goes wrong

createProject

public CmsProject createProject(CmsDbContext dbc,
                                java.lang.String name,
                                java.lang.String description,
                                java.lang.String groupname,
                                java.lang.String managergroupname,
                                int projecttype)
                         throws CmsIllegalArgumentException,
                                CmsDataAccessException
Creates a project.

Parameters:
dbc - the current database context
name - the name of the project to create
description - the description of the project
groupname - the project user group to be set
managergroupname - the project manager group to be set
projecttype - the type of the project
Returns:
the created project
Throws:
CmsIllegalArgumentException - if the chosen name is already used by the online project
CmsDataAccessException - if something goes wrong

createPropertyDefinition

public CmsPropertyDefinition createPropertyDefinition(CmsDbContext dbc,
                                                      java.lang.String name)
                                               throws CmsException
Creates a property definition.

Property definitions are valid for all resource types.

Parameters:
dbc - the current database context
name - the name of the property definition to create
Returns:
the created property definition
Throws:
CmsException - if something goes wrong

createResource

public CmsResource createResource(CmsDbContext dbc,
                                  java.lang.String resourcePath,
                                  CmsResource resource,
                                  byte[] content,
                                  java.util.List properties,
                                  boolean importCase)
                           throws CmsException
Creates a new resource with the provided content and properties.

The content parameter may be null if the resource id already exists. If so, the created resource will be made a sibling of the existing resource, the existing content will remain unchanged. This is used during file import for import of siblings as the manifest.xml only contains one binary copy per file. If the resource id exists but the content is not null, the created resource will be made a sibling of the existing resource, and both will share the new content.

Note: the id used to identify the content record (pk of the record) is generated on each call of this method (with valid content) !

Parameters:
dbc - the current database context
resourcePath - the name of the resource to create (full path)
resource - the new resource to create
content - the content for the new resource
properties - the properties for the new resource
importCase - if true, signals that this operation is done while importing resource, causing different lock behaviour and potential "lost and found" usage
Returns:
the created resource
Throws:
CmsException - if something goes wrong

createResource

public CmsResource createResource(CmsDbContext dbc,
                                  java.lang.String resourcename,
                                  int type,
                                  byte[] content,
                                  java.util.List properties)
                           throws CmsException,
                                  CmsIllegalArgumentException
Creates a new resource of the given resource type with the provided content and properties.

If the provided content is null and the resource is not a folder, the content will be set to an empty byte array.

Parameters:
dbc - the current database context
resourcename - the name of the resource to create (full path)
type - the type of the resource to create
content - the content for the new resource
properties - the properties for the new resource
Returns:
the created resource
Throws:
CmsException - if something goes wrong
CmsIllegalArgumentException - if the resourcename argument is null or of length 0
See Also:
CmsObject.createResource(String, int, byte[], List), CmsObject.createResource(String, int), I_CmsResourceType.createResource(CmsObject, CmsSecurityManager, String, byte[], List)

createSibling

public void createSibling(CmsDbContext dbc,
                          CmsResource source,
                          java.lang.String destination,
                          java.util.List properties)
                   throws CmsException
Creates a new sibling of the source resource.

Parameters:
dbc - the current database context
source - the resource to create a sibling for
destination - the name of the sibling to create with complete path
properties - the individual properties for the new sibling
Throws:
CmsException - if something goes wrong
See Also:
CmsObject.createSibling(String, String, List), I_CmsResourceType.createSibling(CmsObject, CmsSecurityManager, CmsResource, String, List)

createTask

public CmsTask createTask(CmsDbContext dbc,
                          CmsUser currentUser,
                          int projectid,
                          java.lang.String agentName,
                          java.lang.String roleName,
                          java.lang.String taskName,
                          java.lang.String taskComment,
                          int taskType,
                          long timeout,
                          int priority)
                   throws CmsException
Creates a new task.

Parameters:
dbc - the current database context
currentUser - the current user
projectid - the current project id
agentName - user who will edit the task
roleName - usergroup for the task
taskName - name of the task
taskType - type of the task
taskComment - description of the task
timeout - time when the task must finished
priority - Id for the priority
Returns:
a new task object
Throws:
CmsException - if something goes wrong

createTask

public CmsTask createTask(CmsDbContext dbc,
                          java.lang.String agentName,
                          java.lang.String roleName,
                          java.lang.String taskname,
                          long timeout,
                          int priority)
                   throws CmsException
Creates a new task.

This is just a more limited version of the createTask(CmsDbContext, CmsUser, int, String, String, String, String, int, long, int) method, where:

Parameters:
dbc - the current database context
agentName - the user who will edit the task
roleName - a usergroup for the task
taskname - the name of the task
timeout - the time when the task must finished
priority - the id for the priority of the task
Returns:
the created task
Throws:
CmsException - if something goes wrong

createTempfileProject

public CmsProject createTempfileProject(CmsDbContext dbc)
                                 throws CmsException
Creates the project for the temporary workplace files.

Parameters:
dbc - the current database context
Returns:
the created project for the temporary workplace files
Throws:
CmsException - if something goes wrong

createUser

public CmsUser createUser(CmsDbContext dbc,
                          java.lang.String name,
                          java.lang.String password,
                          java.lang.String description,
                          java.util.Map additionalInfos)
                   throws CmsException,
                          CmsIllegalArgumentException
Creates a new user.

Parameters:
dbc - the current database context
name - the name for the new user
password - the password for the new user
description - the description for the new user
additionalInfos - the additional infos for the user
Returns:
the created user
Throws:
CmsException - if something goes wrong
CmsIllegalArgumentException - if the name for the user is not valid
See Also:
CmsObject.createUser(String, String, String, Map)

deleteAllProperties

public void deleteAllProperties(CmsDbContext dbc,
                                java.lang.String resourcename)
                         throws CmsException
Deletes all property values of a file or folder.

If there are no other siblings than the specified resource, both the structure and resource property values get deleted. If the specified resource has siblings, only the structure property values get deleted.

Parameters:
dbc - the current database context
resourcename - the name of the resource for which all properties should be deleted
Throws:
CmsException - if operation was not successful

deleteAllStaticExportPublishedResources

public void deleteAllStaticExportPublishedResources(CmsDbContext dbc,
                                                    int linkType)
                                             throws CmsException
Deletes all entries in the published resource table.

Parameters:
dbc - the current database context
linkType - the type of resource deleted (0= non-paramter, 1=parameter)
Throws:
CmsException - if something goes wrong

deleteBackup

public void deleteBackup(CmsDbContext dbc,
                         CmsResource res)
                  throws CmsDataAccessException
Deletes all backup versions of a single resource.

Parameters:
dbc - the current database context
res - the resource to delete all backups from
Throws:
CmsDataAccessException - if operation was not succesful

deleteBackups

public void deleteBackups(CmsDbContext dbc,
                          long timestamp,
                          int versions,
                          I_CmsReport report)
                   throws CmsException
Deletes the versions from the backup tables that are older then the given timestamp and/or number of remaining versions.

The number of verions always wins, i.e. if the given timestamp would delete more versions than given in the versions parameter, the timestamp will be ignored.

Deletion will delete file header, content and properties.

Parameters:
dbc - the current database context
timestamp - timestamp which defines the date after which backup resources must be deleted
versions - the number of versions per file which should kept in the system
report - the report for output logging
Throws:
CmsException - if operation was not succesful

deleteGroup

public void deleteGroup(CmsDbContext dbc,
                        CmsGroup group,
                        CmsUUID replacementId)
                 throws CmsDataAccessException,
                        CmsException
Deletes a group, where all permissions, users and childs of the group are transfered to a replacement group.

Parameters:
dbc - the current request context
group - the id of the group to be deleted
replacementId - the id of the group to be transfered, can be null
Throws:
CmsException - if operation was not succesfull
CmsDataAccessException - if group to be deleted contains user

deleteGroup

public void deleteGroup(CmsDbContext dbc,
                        java.lang.String name)
                 throws CmsDataAccessException,
                        CmsException
Deletes a user group.

Only groups that contain no subgroups can be deleted.

Parameters:
dbc - the current database context
name - the name of the group that is to be deleted
Throws:
CmsException - if operation was not succesfull
CmsDataAccessException - if group to be deleted contains user

deleteProject

public void deleteProject(CmsDbContext dbc,
                          CmsProject deleteProject)
                   throws CmsException
Deletes a project.

Only the admin or the owner of the project can do this.

Parameters:
dbc - the current database context
deleteProject - the project to be deleted
Throws:
CmsException - if something goes wrong

deletePropertyDefinition

public void deletePropertyDefinition(CmsDbContext dbc,
                                     java.lang.String name)
                              throws CmsException
Deletes a property definition.

Parameters:
dbc - the current database context
name - the name of the property definition to delete
Throws:
CmsException - if something goes wrong

deleteResource

public void deleteResource(CmsDbContext dbc,
                           CmsResource resource,
                           int siblingMode)
                    throws CmsException
Deletes a resource.

The siblingMode parameter controls how to handle siblings during the delete operation. Possible values for this parameter are:

Parameters:
dbc - the current database context
resource - the name of the resource to delete (full path)
siblingMode - indicates how to handle siblings of the deleted resource
Throws:
CmsException - if something goes wrong
See Also:
CmsObject.deleteResource(String, int), I_CmsResourceType.deleteResource(CmsObject, CmsSecurityManager, CmsResource, int)

deleteStaticExportPublishedResource

public void deleteStaticExportPublishedResource(CmsDbContext dbc,
                                                java.lang.String resourceName,
                                                int linkType,
                                                java.lang.String linkParameter)
                                         throws CmsException
Deletes an entry in the published resource table.

Parameters:
dbc - the current database context
resourceName - The name of the resource to be deleted in the static export
linkType - the type of resource deleted (0= non-paramter, 1=parameter)
linkParameter - the parameters ofthe resource
Throws:
CmsException - if something goes wrong

deleteUser

public void deleteUser(CmsDbContext dbc,
                       CmsProject project,
                       java.lang.String username,
                       java.lang.String replacementUsername)
                throws CmsException
Deletes a user, where all permissions and resources attributes of the user were transfered to a replacement user, if given.

Only users, which are in the group "administrators" are granted.

Parameters:
dbc - the current database context
project - the current project
username - the name of the user to be deleted
replacementUsername - the name of the user to be transfered, can be null
Throws:
CmsException - if operation was not succesfull

deleteWebUser

public void deleteWebUser(CmsDbContext dbc,
                          CmsUUID userId)
                   throws CmsException
Deletes a web user from the Cms.

Parameters:
dbc - the current database context
userId - the Id of the user to be deleted
Throws:
CmsException - if operation was not succesfull

destroy

public void destroy()
             throws java.lang.Throwable
Destroys this driver manager.

Throws:
java.lang.Throwable - if something goes wrong

endTask

public void endTask(CmsDbContext dbc,
                    int taskid)
             throws CmsException
Ends a task.

Parameters:
dbc - the current databsae context
taskid - the ID of the task to end
Throws:
CmsException - if something goes wrong

existsResourceId

public boolean existsResourceId(CmsDbContext dbc,
                                CmsUUID resourceId)
                         throws CmsException
Tests if a resource with the given resourceId does already exist in the Database.

Parameters:
dbc - the current database context
resourceId - the resource id to test for
Returns:
true if a resource with the given id was found, false otherweise
Throws:
CmsException - if something goes wrong

fillPublishList

public CmsPublishList fillPublishList(CmsDbContext dbc,
                                      CmsPublishList publishList)
                               throws CmsException
Fills the given publish list with the the VFS resources that actually get published.

Please refer to the source code of this method for the rules on how to decide whether a new/changed/deleted CmsResource object can be published or not.

Parameters:
dbc - the current database context
publishList - must be initialized with basic publish information (Project or direct publish operation)
Returns:
the given publish list filled with all new/changed/deleted files from the current (offline) project that will be published actually
Throws:
CmsException - if something goes wrong
See Also:
CmsPublishList

forwardTask

public void forwardTask(CmsDbContext dbc,
                        int taskid,
                        java.lang.String newRoleName,
                        java.lang.String newUserName)
                 throws CmsException
Forwards a task to a new user.

Parameters:
dbc - the current database context
taskid - the Id of the task to forward
newRoleName - the new group name for the task
newUserName - the new user who gets the task. if it is empty, a new agent will automatic selected
Throws:
CmsException - if something goes wrong

getAccessControlEntries

public java.util.List getAccessControlEntries(CmsDbContext dbc,
                                              CmsResource resource,
                                              boolean getInherited)
                                       throws CmsException
Returns the list of access control entries of a resource given its name.

Parameters:
dbc - the current database context
resource - the resource to read the access control entries for
getInherited - true if the result should include all access control entries inherited by parent folders
Returns:
a list of CmsAccessControlEntry objects defining all permissions for the given resource
Throws:
CmsException - if something goes wrong

getAccessControlList

public CmsAccessControlList getAccessControlList(CmsDbContext dbc,
                                                 CmsResource resource)
                                          throws CmsException
Returns the full access control list of a given resource.

Parameters:
dbc - the current database context
resource - the resource
Returns:
the access control list of the resource
Throws:
CmsException - if something goes wrong

getAccessControlList

public CmsAccessControlList getAccessControlList(CmsDbContext dbc,
                                                 CmsResource resource,
                                                 boolean inheritedOnly)
                                          throws CmsException
Returns the access control list of a given resource.

If inheritedOnly is set, only inherited access control entries are returned.

Note: For file resources, *all* permissions set at the immediate parent folder are inherited, not only these marked to inherit.

Parameters:
dbc - the current database context
resource - the resource
inheritedOnly - skip non-inherited entries if set
Returns:
the access control list of the resource
Throws:
CmsException - if something goes wrong

getActiveConnections

public int getActiveConnections(java.lang.String dbPoolUrl)
                         throws CmsDbException
Returns the number of active connections managed by a pool.

Parameters:
dbPoolUrl - the url of a pool
Returns:
the number of active connections
Throws:
CmsDbException - if something goes wrong

getAllAccessibleProjects

public java.util.List getAllAccessibleProjects(CmsDbContext dbc)
                                        throws CmsException
Returns all projects which are owned by the current user or which are accessible by the current user.

Parameters:
dbc - the current database context
Returns:
a list of objects of type CmsProject
Throws:
CmsException - if something goes wrong

getAllBackupProjects

public java.util.List getAllBackupProjects(CmsDbContext dbc)
                                    throws CmsException
Returns a Vector with all projects from history.

Parameters:
dbc - the current database context
Returns:
list of CmsBackupProject objects with all projects from history.
Throws:
CmsException - if operation was not succesful

getAllManageableProjects

public java.util.List getAllManageableProjects(CmsDbContext dbc)
                                        throws CmsException
Returns all projects which are owned by the current user or which are manageable for the group of the user.

Parameters:
dbc - the current database context
Returns:
a list of objects of type CmsProject
Throws:
CmsException - if operation was not succesful

getBackupDriver

public I_CmsBackupDriver getBackupDriver()
Returns the backup driver.

Returns:
the backup driver

getBackupTagId

public int getBackupTagId(CmsDbContext dbc)
Returns the next version id for the published backup resources.

Parameters:
dbc - the current database context
Returns:
the new version id

getChild

public java.util.List getChild(CmsDbContext dbc,
                               java.lang.String groupname)
                        throws CmsException
Returns all child groups of a group.

Parameters:
dbc - the current database context
groupname - the name of the group
Returns:
a list of all child CmsGroup objects
Throws:
CmsException - if operation was not succesful

getChilds

public java.util.List getChilds(CmsDbContext dbc,
                                java.lang.String groupname)
                         throws CmsException
Returns all child groups of a group.

This method also returns all sub-child groups of the current group.

Parameters:
dbc - the current database context
groupname - the name of the group
Returns:
a list of all child CmsGroup objects or null
Throws:
CmsException - if operation was not succesful

getConfigurations

public java.util.Map getConfigurations()
Method to access the configurations of the properties-file.

All users are granted.

Returns:
the Configurations of the properties-file

getDirectGroupsOfUser

public java.util.List getDirectGroupsOfUser(CmsDbContext dbc,
                                            java.lang.String username)
                                     throws CmsException
Returns the list of groups to which the user directly belongs to.

Parameters:
dbc - the current database context
username - The name of the user
Returns:
a list of CmsGroup objects
Throws:
CmsException - Throws CmsException if operation was not succesful

getGroups

public java.util.List getGroups(CmsDbContext dbc)
                         throws CmsException
Returns all available groups.

Parameters:
dbc - the current database context
Returns:
a list of all available CmsGroup objects
Throws:
CmsException - if operation was not succesful

getGroupsOfUser

public java.util.List getGroupsOfUser(CmsDbContext dbc,
                                      java.lang.String username)
                               throws CmsException
Returns the groups of a user.

Parameters:
dbc - the current database context
username - the name of the user
Returns:
a list of CmsGroup objects
Throws:
CmsException - if operation was not succesful

getGroupsOfUser

public java.util.List getGroupsOfUser(CmsDbContext dbc,
                                      java.lang.String username,
                                      java.lang.String remoteAddress)
                               throws CmsException
Returns the groups of a Cms user filtered by the specified IP address.

Parameters:
dbc - the current database context
username - the name of the user
remoteAddress - the IP address to filter the groups in the result list
Returns:
a list of CmsGroup objects
Throws:
CmsException - if operation was not succesful

getHtmlLinkValidator

public CmsXmlDocumentLinkValidator getHtmlLinkValidator()
Returns the HTML link validator.

Returns:
the HTML link validator
See Also:
CmsXmlDocumentLinkValidator

getIdleConnections

public int getIdleConnections(java.lang.String dbPoolUrl)
                       throws CmsDbException
Returns the number of idle connections managed by a pool.

Parameters:
dbPoolUrl - the url of a pool
Returns:
the number of idle connections
Throws:
CmsDbException - if something goes wrong

getLock

public CmsLock getLock(CmsDbContext dbc,
                       CmsResource resource)
                throws CmsException
Returns the lock state of a resource.

Parameters:
dbc - the current database context
resource - the resource to return the lock state for
Returns:
the lock state of the resource
Throws:
CmsException - if something goes wrong

getParent

public CmsGroup getParent(CmsDbContext dbc,
                          java.lang.String groupname)
                   throws CmsException
Returns the parent group of a group.

Parameters:
dbc - the current database context
groupname - the name of the group
Returns:
group the parent group or null
Throws:
CmsException - if operation was not succesful

getPermissions

public CmsPermissionSetCustom getPermissions(CmsDbContext dbc,
                                             CmsResource resource,
                                             CmsUser user)
                                      throws CmsException
Returns the set of permissions of the current user for a given resource.

Parameters:
dbc - the current database context
resource - the resource
user - the user
Returns:
bitset with allowed permissions
Throws:
CmsException - if something goes wrong

getProjectDriver

public I_CmsProjectDriver getProjectDriver()
Returns the project driver.

Returns:
the project driver

getResourcesForPrincipal

public java.util.List getResourcesForPrincipal(CmsDbContext dbc,
                                               CmsProject project,
                                               CmsUUID principalId,
                                               CmsPermissionSet permissions,
                                               boolean includeAttr)
                                        throws CmsException
Returns all resources associated to a given principal via an ACE with the given permissions.

If the includeAttr flag is set it returns also all resources associated to a given principal through some of following attributes.

Parameters:
dbc - the current database context
project - the to read the entries from
principalId - the id of the principal
permissions - a set of permissions to match, can be null for all ACEs
includeAttr - a flag to include resources associated by attributes
Returns:
a list of CmsResource objects
Throws:
CmsException - if something goes wrong

getSqlManager

public CmsSqlManager getSqlManager()
Returns an instance of the common sql manager.

Returns:
an instance of the common sql manager

getTaskPar

public java.lang.String getTaskPar(CmsDbContext dbc,
                                   int taskId,
                                   java.lang.String parName)
                            throws CmsException
Returns the value of the given parameter for the given task.

Parameters:
dbc - the current database context
taskId - the Id of the task
parName - name of the parameter
Returns:
task parameter value
Throws:
CmsException - if something goes wrong

getTaskType

public int getTaskType(CmsDbContext dbc,
                       java.lang.String taskName)
                throws CmsException
Returns the template task id for a given taskname.

Parameters:
dbc - the current database context
taskName - the name of the task
Returns:
the id of the task template
Throws:
CmsException - if operation was not successful

getUserDriver

public I_CmsUserDriver getUserDriver()
Returns the user driver.

Returns:
the user driver

getUsers

public java.util.List getUsers(CmsDbContext dbc)
                        throws CmsException
Returns all available users.

Parameters:
dbc - the current database context
Returns:
a list of all available CmsUser objects
Throws:
CmsException - if operation was not succesful

getUsers

public java.util.List getUsers(CmsDbContext dbc,
                               int type)
                        throws CmsException
Returns all users from a given type.

Parameters:
dbc - the current database context
type - the type of the users
Returns:
a list of all CmsUser objects of the given type
Throws:
CmsException - if operation was not succesful

getUsersOfGroup

public java.util.List getUsersOfGroup(CmsDbContext dbc,
                                      java.lang.String groupname)
                               throws CmsException
Returns a list of users in a group.

Parameters:
dbc - the current database context
groupname - the name of the group to list users from
Returns:
all CmsUser objects in the group
Throws:
CmsException - if operation was not succesful

getVfsDriver

public I_CmsVfsDriver getVfsDriver()
Returns the VFS driver.

Returns:
the VFS driver

getWorkflowDriver

public I_CmsWorkflowDriver getWorkflowDriver()
Returns the workflow driver.

Returns:
the workflow driver

importAccessControlEntries

public void importAccessControlEntries(CmsDbContext dbc,
                                       CmsResource resource,
                                       java.util.List acEntries)
                                throws CmsException
Writes a vector of access control entries as new access control entries of a given resource.

Already existing access control entries of this resource are removed before. Access is granted, if:

Parameters:
dbc - the current database context
resource - the resource
acEntries - a list of CmsAccessControlEntry objects
Throws:
CmsException - if something goes wrong

importUser

public CmsUser importUser(CmsDbContext dbc,
                          java.lang.String id,
                          java.lang.String name,
                          java.lang.String password,
                          java.lang.String description,
                          java.lang.String firstname,
                          java.lang.String lastname,
                          java.lang.String email,
                          java.lang.String address,
                          int flags,
                          int type,
                          java.util.Map additionalInfos)
                   throws CmsException
Creates a new user by import.

Parameters:
dbc - the current database context
id - the id of the user
name - the new name for the user
password - the new password for the user
description - the description for the user
firstname - the firstname of the user
lastname - the lastname of the user
email - the email of the user
address - the address of the user
flags - the flags for a user (for example I_CmsPrincipal.FLAG_ENABLED)
type - the type of the user
additionalInfos - the additional user infos
Returns:
the imported user
Throws:
CmsException - if something goes wrong

init

public void init(CmsConfigurationManager configurationManager,
                 java.util.Map configuration,
                 I_CmsVfsDriver vfsDriver,
                 I_CmsUserDriver userDriver,
                 I_CmsProjectDriver projectDriver,
                 I_CmsWorkflowDriver workflowDriver,
                 I_CmsBackupDriver backupDriver)
          throws CmsException,
                 java.lang.Exception
Initializes the driver and sets up all required modules and connections.

Parameters:
configurationManager - the configuration manager
configuration - the OpenCms configuration
vfsDriver - the vfsdriver
userDriver - the userdriver
projectDriver - the projectdriver
workflowDriver - the workflowdriver
backupDriver - the backupdriver
Throws:
CmsException - if something goes wrong
java.lang.Exception - if something goes wrong

isInsideCurrentProject

public boolean isInsideCurrentProject(CmsDbContext dbc,
                                      java.lang.String resourcename)
Checks if the specified resource is inside the current project.

The project "view" is determined by a set of path prefixes. If the resource starts with any one of this prefixes, it is considered to be "inside" the project.

Parameters:
dbc - the current database context
resourcename - the specified resource name (full path)
Returns:
true, if the specified resource is inside the current project

isLocked

public boolean isLocked(CmsDbContext dbc,
                        CmsResource resource)
                 throws CmsException
Proves if a resource is locked.

Parameters:
dbc - the current database context
resource - the resource
Returns:
true, if and only if the resource is currently locked
Throws:
CmsException - if something goes wrong
See Also:
CmsLockManager.isLocked(org.opencms.db.CmsDriverManager, CmsDbContext, CmsResource)

isTempfileProject

public boolean isTempfileProject(CmsProject project)
Checks if a project is the tempfile project.

Parameters:
project - the project to test
Returns:
true if the project is the tempfile project

isUser

public boolean isUser(CmsDbContext dbc)
               throws CmsException
Determines if the user is a member of the default users group.

All users are granted.

Parameters:
dbc - the current database context
Returns:
true, if the users current group is the projectleader-group, else it returns false
Throws:
CmsException - if operation was not succesful

labelResource

public boolean labelResource(CmsDbContext dbc,
                             CmsResource resource,
                             java.lang.String newResource,
                             int action)
                      throws CmsDataAccessException
Checks if one of the resources (except the resource itself) is a sibling in a "labeled" site folder.

This method is used when creating a new sibling (use the newResource parameter & action = 1) or deleting/importing a resource (call with action = 2).

Parameters:
dbc - the current database context
resource - the resource
newResource - absolute path for a resource sibling which will be created
action - the action which has to be performed (1 = create VFS link, 2 all other actions)
Returns:
true if the flag should be set for the resource, otherwise false
Throws:
CmsDataAccessException - if something goes wrong

lockedBy

public CmsUser lockedBy(CmsDbContext dbc,
                        CmsResource resource)
                 throws CmsException
Returns the user, who had locked the resource.

A user can lock a resource, so he is the only one who can write this resource. This methods checks, if a resource was locked.

Parameters:
dbc - the current database context
resource - the resource
Returns:
the user, who had locked the resource
Throws:
CmsException - will be thrown, if the user has not the rights for this resource

lockResource

public void lockResource(CmsDbContext dbc,
                         CmsResource resource,
                         int mode)
                  throws CmsException
Locks a resource.

The mode parameter controls what kind of lock is used. Possible values for this parameter are:

Parameters:
dbc - the current database context
resource - the resource to lock
mode - flag indicating the mode for the lock
Throws:
CmsException - if something goes wrong
See Also:
CmsObject.lockResource(String, int), I_CmsResourceType.lockResource(CmsObject, CmsSecurityManager, CmsResource, int)

loginUser

public CmsUser loginUser(CmsDbContext dbc,
                         java.lang.String userName,
                         java.lang.String password,
                         java.lang.String remoteAddress,
                         int userType)
                  throws CmsAuthentificationException,
                         CmsDataAccessException,
                         CmsPasswordEncryptionException
Attempts to authenticate a user into OpenCms with the given password.

Parameters:
dbc - the current database context
userName - the name of the user to be logged in
password - the password of the user
remoteAddress - the ip address of the request
userType - the user type to log in (System user or Web user)
Returns:
the logged in user
Throws:
CmsAuthentificationException - if the login was not successful
CmsDataAccessException - in case of errors accessing the database
CmsPasswordEncryptionException - in case of errors encrypting the users password

lookupPrincipal

public I_CmsPrincipal lookupPrincipal(CmsDbContext dbc,
                                      CmsUUID principalId)
Lookup and read the user or group with the given UUID.

Parameters:
dbc - the current database context
principalId - the UUID of the principal to lookup
Returns:
the principal (group or user) if found, otherwise null

lookupPrincipal

public I_CmsPrincipal lookupPrincipal(CmsDbContext dbc,
                                      java.lang.String principalName)
Lookup and read the user or group with the given name.

Parameters:
dbc - the current database context
principalName - the name of the principal to lookup
Returns:
the principal (group or user) if found, otherwise null

moveToLostAndFound

public java.lang.String moveToLostAndFound(CmsDbContext dbc,
                                           java.lang.String resourcename,
                                           boolean returnNameOnly)
                                    throws CmsException,
                                           CmsIllegalArgumentException
Moves a resource to the "lost and found" folder.

The method can also be used to check get the name of a resource in the "lost and found" folder only without actually moving the the resource. To do this, the returnNameOnly flag must be set to true.

Parameters:
dbc - the current database context
resourcename - the name of the resource to apply this operation to
returnNameOnly - if true, only the name of the resource in the "lost and found" folder is returned, the move operation is not really performed
Returns:
the name of the resource inside the "lost and found" folder
Throws:
CmsException - if something goes wrong
CmsIllegalArgumentException - if the resourcename argument is null or of length 0
See Also:
CmsObject.moveToLostAndFound(String), CmsObject.getLostAndFoundName(String)

newDriverInstance

public java.lang.Object newDriverInstance(CmsConfigurationManager configurationManager,
                                          java.lang.String driverName,
                                          java.util.List successiveDrivers)
                                   throws CmsInitException
Gets a new driver instance.

Parameters:
configurationManager - the configuration manager
driverName - the driver name
successiveDrivers - the list of successive drivers
Returns:
the driver object
Throws:
CmsInitException - if the selected driver could not be initialized

newDriverInstance

public java.lang.Object newDriverInstance(org.apache.commons.collections.ExtendedProperties configuration,
                                          java.lang.String driverName,
                                          java.lang.String driverPoolUrl)
                                   throws CmsException
Method to create a new instance of a driver.

Parameters:
configuration - the configurations from the propertyfile
driverName - the class name of the driver
driverPoolUrl - the pool url for the driver
Returns:
an initialized instance of the driver
Throws:
CmsException - if something goes wrong

newPoolInstance

public void newPoolInstance(java.util.Map configuration,
                            java.lang.String poolName)
                     throws CmsInitException
Method to create a new instance of a pool.

Parameters:
configuration - the configurations from the propertyfile
poolName - the configuration name of the pool
Throws:
CmsInitException - if the pools could not be initialized

publishProject

public void publishProject(CmsObject cms,
                           CmsDbContext dbc,
                           CmsPublishList publishList,
                           I_CmsReport report)
                    throws CmsException
Publishes the resources of a specified publish list.

Parameters:
cms - the current request context
dbc - the current database context
publishList - a publish list
report - an instance of I_CmsReport to print messages
Throws:
CmsException - if something goes wrong
See Also:
fillPublishList(CmsDbContext, CmsPublishList)

reactivateTask

public void reactivateTask(CmsDbContext dbc,
                           int taskId)
                    throws CmsException
Reactivates a task.

Setting its state to CmsTaskService.TASK_STATE_STARTED and the percentage to zero.

Parameters:
dbc - the current database context
taskId - the id of the task to reactivate
Throws:
CmsException - if something goes wrong

readAccessControlEntry

public CmsAccessControlEntry readAccessControlEntry(CmsDbContext dbc,
                                                    CmsResource resource,
                                                    CmsUUID principal)
                                             throws CmsException
Reads an access control entry from the cms.

The access control entries of a resource are readable by everyone.

Parameters:
dbc - the current database context
resource - the resource
principal - the id of a group or a user any other entity
Returns:
an access control entry that defines the permissions of the entity for the given resource
Throws:
CmsException - if something goes wrong

readAgent

public CmsUser readAgent(CmsDbContext dbc,
                         CmsTask task)
                  throws CmsException
Reads the agent of a task.

Parameters:
dbc - the current database context
task - the task to read the agent from
Returns:
the owner of a task
Throws:
CmsException - if something goes wrong

readAllBackupFileHeaders

public java.util.List readAllBackupFileHeaders(CmsDbContext dbc,
                                               CmsResource resource)
                                        throws CmsException
Reads all file headers of a file.
This method returns a list with the history of all file headers, i.e. the file headers of a file, independent of the project they were attached to.
The reading excludes the file content.

Parameters:
dbc - the current database context
resource - the resource to read the backup resources for
Returns:
a list of file headers, as CmsBackupResource objects, read from the Cms
Throws:
CmsException - if something goes wrong

readAllPropertyDefinitions

public java.util.List readAllPropertyDefinitions(CmsDbContext dbc)
                                          throws CmsException
Reads all property definitions for the given mapping type.

Parameters:
dbc - the current database context
Returns:
a list with the CmsPropertyDefinition objects (may be empty)
Throws:
CmsException - if something goes wrong

readBackupFile

public CmsBackupResource readBackupFile(CmsDbContext dbc,
                                        int tagId,
                                        CmsResource resource)
                                 throws CmsException
Returns a file from the history.
The reading includes the file content.

Parameters:
dbc - the current database context
tagId - the desired tag ID of the file
resource - the resource to read the historic version of
Returns:
the file read
Throws:
CmsException - if operation was not succesful

readBackupProject

public CmsBackupProject readBackupProject(CmsDbContext dbc,
                                          int tagId)
                                   throws CmsException
Returns a backup project.

Parameters:
dbc - the current database context
tagId - the tagId of the project
Returns:
the requested backup project
Throws:
CmsException - if something goes wrong

readBackupPropertyObjects

public java.util.List readBackupPropertyObjects(CmsDbContext dbc,
                                                CmsBackupResource resource)
                                         throws CmsException
Reads the list of CmsProperty objects that belong the the given backup resource.

Parameters:
dbc - the current database context
resource - the backup resource to read the properties from
Returns:
the list of CmsProperty objects that belong the the given backup resource
Throws:
CmsException - if something goes wrong

readChangedResourcesInsideProject

public java.util.List readChangedResourcesInsideProject(CmsDbContext dbc,
                                                        int projectId,
                                                        int resourceType)
                                                 throws CmsException
Reads all resources that are inside and changed in a specified project.

Parameters:
dbc - the current database context
projectId - the ID of the project
resourceType - <0 if files and folders should be read, 0 if only folders should be read, >0 if only files should be read
Returns:
a List with all resources inside the specified project
Throws:
CmsException - if somethong goes wrong

readChildResources

public java.util.List readChildResources(CmsDbContext dbc,
                                         CmsResource resource,
                                         CmsResourceFilter filter,
                                         boolean getFolders,
                                         boolean getFiles)
                                  throws CmsException
Returns the child resources of a resource, that is the resources contained in a folder.

With the parameters getFolders and getFiles you can control what type of resources you want in the result list: files, folders, or both.

This method is mainly used by the workplace explorer.

Parameters:
dbc - the current database context
resource - the resource to return the child resources for
filter - the resource filter to use
getFolders - if true the child folders are included in the result
getFiles - if true the child files are included in the result
Returns:
a list of all child resources
Throws:
CmsException - if something goes wrong

readFile

public CmsFile readFile(CmsDbContext dbc,
                        CmsResource resource,
                        CmsResourceFilter filter)
                 throws CmsException
Reads a file resource (including it's binary content) from the VFS, using the specified resource filter.

In case you do not need the file content, use readResource(CmsDbContext, String, CmsResourceFilter) instead.

The specified filter controls what kind of resources should be "found" during the read operation. This will depend on the application. For example, using CmsResourceFilter.DEFAULT will only return currently "valid" resources, while using CmsResourceFilter.IGNORE_EXPIRATION will ignore the date release / date expired information of the resource.

Parameters:
dbc - the current database context
resource - the base file resource (without content)
filter - the filter object
Returns:
the file read from the VFS
Throws:
CmsException - if operation was not succesful

readFolder

public CmsFolder readFolder(CmsDbContext dbc,
                            java.lang.String resourcename,
                            CmsResourceFilter filter)
                     throws CmsDataAccessException
Reads a folder from the VFS, using the specified resource filter.

Parameters:
dbc - the current database context
resourcename - the name of the folder to read (full path)
filter - the resource filter to use while reading
Returns:
the folder that was read
Throws:
CmsDataAccessException - if something goes wrong
See Also:
readResource(CmsDbContext, String, CmsResourceFilter), CmsObject.readFolder(String), CmsObject.readFolder(String, CmsResourceFilter)

readGivenTasks

public java.util.List readGivenTasks(CmsDbContext dbc,
                                     int projectId,
                                     java.lang.String ownerName,
                                     int taskType,
                                     java.lang.String orderBy,
                                     java.lang.String sort)
                              throws CmsException
Reads all given tasks from a user for a project.

The tasktype parameter will filter the tasks. The possible values for this parameter are:

Parameters:
dbc - the current database context
projectId - the id of the project in which the tasks are defined
ownerName - the owner of the task
taskType - the type of task you want to read
orderBy - specifies how to order the tasks
sort - sorting of the tasks
Returns:
a list of given CmsTask objects for a user for a project
Throws:
CmsException - if operation was not successful

readGroup

public CmsGroup readGroup(CmsDbContext dbc,
                          CmsProject project)
Reads the group of a project.

Parameters:
dbc - the current database context
project - the project to read from
Returns:
the group of a resource

readGroup

public CmsGroup readGroup(CmsDbContext dbc,
                          CmsTask task)
                   throws CmsException
Reads the group (role) of a task.

Parameters:
dbc - the current database context
task - the task to read from
Returns:
the group of a resource
Throws:
CmsException - if operation was not succesful

readGroup

public CmsGroup readGroup(CmsDbContext dbc,
                          CmsUUID groupId)
                   throws CmsException
Reads a group based on its id.

Parameters:
dbc - the current database context
groupId - the id of the group that is to be read
Returns:
the requested group
Throws:
CmsException - if operation was not succesful

readGroup

public CmsGroup readGroup(CmsDbContext dbc,
                          java.lang.String groupname)
                   throws CmsDataAccessException
Reads a group based on its name.

Parameters:
dbc - the current database context
groupname - the name of the group that is to be read
Returns:
the requested group
Throws:
CmsDataAccessException - if operation was not succesful

readManagerGroup

public CmsGroup readManagerGroup(CmsDbContext dbc,
                                 CmsProject project)
Reads the manager group of a project.

Parameters:
dbc - the current database context
project - the project to read from
Returns:
the group of a resource

readOriginalAgent

public CmsUser readOriginalAgent(CmsDbContext dbc,
                                 CmsTask task)
                          throws CmsException
Reads the original agent of a task.

Parameters:
dbc - the current database context
task - the task to read the original agent from
Returns:
the owner of a task
Throws:
CmsException - if something goes wrong

readOwner

public CmsUser readOwner(CmsDbContext dbc,
                         CmsProject project)
                  throws CmsException
Reads the owner of a project.

Parameters:
dbc - the current database context
project - the project to get the owner from
Returns:
the owner of a resource
Throws:
CmsException - if something goes wrong

readOwner

public CmsUser readOwner(CmsDbContext dbc,
                         CmsTask task)
                  throws CmsException
Reads the owner (initiator) of a task.

Parameters:
dbc - the current database context
task - the task to read the owner from
Returns:
the owner of a task
Throws:
CmsException - if something goes wrong

readOwner

public CmsUser readOwner(CmsDbContext dbc,
                         CmsTaskLog log)
                  throws CmsException
Reads the owner of a tasklog.

Parameters:
dbc - the current database context
log - the tasklog
Returns:
the owner of a resource
Throws:
CmsException - if something goes wrong

readPath

public java.util.List readPath(CmsDbContext dbc,
                               int projectId,
                               java.lang.String path,
                               CmsResourceFilter filter)
                        throws CmsException
Builds a list of resources for a given path.

Parameters:
dbc - the current database context
projectId - the project to lookup the resource
path - the requested path
filter - a filter object (only "includeDeleted" information is used!)
Returns:
list of CmsResources
Throws:
CmsException - if something goes wrong

readProject

public CmsProject readProject(CmsDbContext dbc,
                              CmsTask task)
                       throws CmsException
Reads a project of a given task.

Parameters:
dbc - the current database context
task - the task to read the project of
Returns:
the project of the task
Throws:
CmsException - if something goes wrong

readProject

public CmsProject readProject(CmsDbContext dbc,
                              int id)
                       throws CmsDataAccessException
Reads a project given the projects id.

Parameters:
dbc - the current database context
id - the id of the project
Returns:
the project read
Throws:
CmsDataAccessException - if something goes wrong

readProject

public CmsProject readProject(CmsDbContext dbc,
                              java.lang.String name)
                       throws CmsException
Reads a project.

Important: Since a project name can be used multiple times, this is NOT the most efficient way to read the project. This is only a convenience for front end developing. Reading a project by name will return the first project with that name. All core classes must use the id version readProject(CmsDbContext, int) to ensure the right project is read.

Parameters:
dbc - the current database context
name - the name of the project
Returns:
the project read
Throws:
CmsException - if something goes wrong

readProjectLogs

public java.util.List readProjectLogs(CmsDbContext dbc,
                                      int projectId)
                               throws CmsException
Reads all task log entries for a project.

Parameters:
dbc - the current database context
projectId - the id of the project for which the tasklog will be read
Returns:
a list of CmsTaskLog objects
Throws:
CmsException - if something goes wrong

readProjectResources

public java.util.List readProjectResources(CmsDbContext dbc,
                                           CmsProject project)
                                    throws CmsException
Returns the list of all resource names that define the "view" of the given project.

Parameters:
dbc - the current database context
project - the project to get the project resources for
Returns:
the list of all resources, as String objects that define the "view" of the given project.
Throws:
CmsException - if something goes wrong

readProjectView

public java.util.List readProjectView(CmsDbContext dbc,
                                      int projectId,
                                      int state)
                               throws CmsException
Reads all resources of a project that match a given state from the VFS.

Possible values for the state parameter are:

Parameters:
dbc - the current database context
projectId - the id of the project to read the file resources for
state - the resource state to match
Returns:
a list of CmsResource objects matching the filter criteria
Throws:
CmsException - if something goes wrong
See Also:
CmsObject.readProjectView(int, int)

readPropertyDefinition

public CmsPropertyDefinition readPropertyDefinition(CmsDbContext dbc,
                                                    java.lang.String name)
                                             throws CmsException
Reads a property definition.

If no property definition with the given name is found, null is returned.

Parameters:
dbc - the current database context
name - the name of the property definition to read
Returns:
the property definition that was read, or null if there is no property definition with the given name.
Throws:
CmsException - if something goes wrong

readPropertyObject

public CmsProperty readPropertyObject(CmsDbContext dbc,
                                      CmsResource resource,
                                      java.lang.String key,
                                      boolean search)
                               throws CmsException
Reads a property object from a resource specified by a property name.

Returns CmsProperty.getNullProperty() if the property is not found.

Parameters:
dbc - the current database context
resource - the resource where the property is read from
key - the property key name
search - if true, the property is searched on all parent folders of the resource. if it's not found attached directly to the resource.
Returns:
the required property, or CmsProperty.getNullProperty() if the property was not found
Throws:
CmsException - if something goes wrong

readPropertyObjects

public java.util.List readPropertyObjects(CmsDbContext dbc,
                                          CmsResource resource,
                                          boolean search)
                                   throws CmsException
Reads all property objects mapped to a specified resource from the database.

All properties in the result List will be in frozen (read only) state, so you can't change the values.

Returns an empty list if no properties are found at all.

Parameters:
dbc - the current database context
resource - the resource where the properties are read from
search - true, if the properties should be searched on all parent folders if not found on the resource
Returns:
a list of CmsProperty objects containing the structure and/or resource value
Throws:
CmsException - if something goes wrong
See Also:
CmsObject.readPropertyObjects(String, boolean)

readPublishedResources

public java.util.List readPublishedResources(CmsDbContext dbc,
                                             CmsUUID publishHistoryId)
                                      throws CmsException
Reads the resources that were published in a publish task for a given publish history ID.

Parameters:
dbc - the current database context
publishHistoryId - unique int ID to identify each publish task in the publish history
Returns:
a list of CmsPublishedResource objects
Throws:
CmsException - if something goes wrong

readPublishProjectView

public java.util.List readPublishProjectView(CmsDbContext dbc,
                                             int projectId,
                                             java.lang.String criteria)
                                      throws CmsException
Reads all project resources that belong to a given view criteria.

A view criteria can be "new", "changed" and "deleted" and the result contains those resources in the project whose state is equal to the selected value.

Parameters:
dbc - the current database context
projectId - the preoject to read from
criteria - the view criteria, can be "new", "changed" or "deleted"
Returns:
all project resources that belong to the given view criteria
Throws:
CmsException - if something goes wrong

readResource

public CmsResource readResource(CmsDbContext dbc,
                                java.lang.String resourcePath,
                                CmsResourceFilter filter)
                         throws CmsDataAccessException
Reads a resource from the VFS, using the specified resource filter.

Parameters:
dbc - the current database context
resourcePath - the name of the resource to read (full path)
filter - the resource filter to use while reading
Returns:
the resource that was read
Throws:
CmsDataAccessException - if something goes wrong
See Also:
CmsObject.readResource(String, CmsResourceFilter), CmsObject.readResource(String), CmsFile.upgrade(CmsResource, CmsObject)

readResources

public java.util.List readResources(CmsDbContext dbc,
                                    CmsResource parent,
                                    CmsResourceFilter filter,
                                    boolean readTree)
                             throws CmsException,
                                    CmsDataAccessException
Reads all resources below the given path matching the filter criteria, including the full tree below the path only in case the readTree parameter is true.

Parameters:
dbc - the current database context
parent - the parent path to read the resources from
filter - the filter
readTree - true to read all subresources
Returns:
a list of CmsResource objects matching the filter criteria
Throws:
CmsDataAccessException - if the bare reading of the resources fails
CmsException - if security and permission checks for the resources read fail

readResourcesWithProperty

public java.util.List readResourcesWithProperty(CmsDbContext dbc,
                                                java.lang.String path,
                                                java.lang.String propertyDefinition)
                                         throws CmsException
Reads all resources that have a value set for the specified property (definition) in the given path.

Both individual and shared properties of a resource are checked.

Parameters:
dbc - the current database context
path - the folder to get the resources with the property from
propertyDefinition - the name of the property (definition) to check for
Returns:
a list of all CmsResource objects that have a value set for the specified property.
Throws:
CmsException - if something goes wrong

readResourcesWithProperty

public java.util.List readResourcesWithProperty(CmsDbContext dbc,
                                                java.lang.String path,
                                                java.lang.String propertyDefinition,
                                                java.lang.String value)
                                         throws CmsException
Reads all resources that have a value (containing the given value string) set for the specified property (definition) in the given path.

Both individual and shared properties of a resource are checked.

Parameters:
dbc - the current database context
path - the folder to get the resources with the property from
propertyDefinition - the name of the property (definition) to check for
value - the string to search in the value of the property
Returns:
a list of all CmsResource objects that have a value set for the specified property.
Throws:
CmsException - if something goes wrong

readResponsiblePrincipals

public java.util.Set readResponsiblePrincipals(CmsDbContext dbc,
                                               CmsResource resource)
                                        throws CmsException
Returns the set of users that are responsible for a specific resource.

Parameters:
dbc - the current database context
resource - the resource to get the responsible users from
Returns:
the set of users that are responsible for a specific resource
Throws:
CmsException - if something goes wrong

readResponsibleUsers

public java.util.Set readResponsibleUsers(CmsDbContext dbc,
                                          CmsResource resource)
                                   throws CmsException
Returns the set of users that are responsible for a specific resource.

Parameters:
dbc - the current database context
resource - the resource to get the responsible users from
Returns:
the set of users that are responsible for a specific resource
Throws:
CmsException - if something goes wrong

readSiblings

public java.util.List readSiblings(CmsDbContext dbc,
                                   CmsResource resource,
                                   CmsResourceFilter filter)
                            throws CmsException
Returns a List of all siblings of the specified resource, the specified resource being always part of the result set.

The result is a list of CmsResource objects.

Parameters:
dbc - the current database context
resource - the resource to read the siblings for
filter - a filter object
Returns:
a list of CmsResource Objects that are siblings to the specified resource, including the specified resource itself
Throws:
CmsException - if something goes wrong

readStaticExportPublishedResourceParameters

public java.lang.String readStaticExportPublishedResourceParameters(CmsDbContext dbc,
                                                                    java.lang.String rfsName)
                                                             throws CmsException
Returns the parameters of a resource in the table of all published template resources.

Parameters:
dbc - the current database context
rfsName - the rfs name of the resource
Returns:
the paramter string of the requested resource
Throws:
CmsException - if something goes wrong

readStaticExportResources

public java.util.List readStaticExportResources(CmsDbContext dbc,
                                                int parameterResources,
                                                long timestamp)
                                         throws CmsException
Returns a list of all template resources which must be processed during a static export.

Parameters:
dbc - the current database context
parameterResources - flag for reading resources with parameters (1) or without (0)
timestamp - for reading the data from the db
Returns:
a list of template resources as String objects
Throws:
CmsException - if something goes wrong

readTask

public CmsTask readTask(CmsDbContext dbc,
                        int id)
                 throws CmsException
Reads the task with the given id.

Parameters:
dbc - the current database context
id - the id for the task to read
Returns:
the task with the given id
Throws:
CmsException - if something goes wrong

readTaskLogs

public java.util.List readTaskLogs(CmsDbContext dbc,
                                   int taskid)
                            throws CmsException
Reads log entries for a task.

Parameters:
dbc - the current satabase context
taskid - the task for the tasklog to read
Returns:
a list of CmsTaskLog objects
Throws:
CmsException - if something goes wrong

readTasksForProject

public java.util.List readTasksForProject(CmsDbContext dbc,
                                          int projectId,
                                          int tasktype,
                                          java.lang.String orderBy,
                                          java.lang.String sort)
                                   throws CmsException
Reads all tasks for a project.

The tasktype parameter will filter the tasks. The possible values are:

Parameters:
dbc - the current database context
projectId - the id of the project in which the tasks are defined. Can be null to select all tasks
tasktype - the type of task you want to read
orderBy - specifies how to order the tasks
sort - sort order: C_SORT_ASC, C_SORT_DESC, or null
Returns:
a list of CmsTask objects for the project
Throws:
CmsException - if operation was not successful

readTasksForRole

public java.util.List readTasksForRole(CmsDbContext dbc,
                                       int projectId,
                                       java.lang.String roleName,
                                       int tasktype,
                                       java.lang.String orderBy,
                                       java.lang.String sort)
                                throws CmsException
Reads all tasks for a role in a project.

The tasktype parameter will filter the tasks. The possible values for this parameter are:

Parameters:
dbc - the current database context
projectId - the id of the Project in which the tasks are defined
roleName - the role who has to process the task
tasktype - the type of task you want to read
orderBy - specifies how to order the tasks
sort - sort order C_SORT_ASC, C_SORT_DESC, or null
Returns:
list of CmsTask objects for the role
Throws:
CmsException - if operation was not successful

readTasksForUser

public java.util.List readTasksForUser(CmsDbContext dbc,
                                       int projectId,
                                       java.lang.String userName,
                                       int taskType,
                                       java.lang.String orderBy,
                                       java.lang.String sort)
                                throws CmsException
Reads all tasks for a user in a project.

The tasktype parameter will filter the tasks. The possible values for this parameter are:

Parameters:
dbc - the current database context
projectId - the id of the Project in which the tasks are defined
userName - the user who has to process the task
taskType - the type of task you want to read
orderBy - specifies how to order the tasks
sort - sort order C_SORT_ASC, C_SORT_DESC, or null
Returns:
a list of CmsTask objects for the user
Throws:
CmsException - if operation was not successful

readUser

public CmsUser readUser(CmsDbContext dbc,
                        CmsUUID id)
                 throws CmsException
Returns a user object based on the id of a user.

Parameters:
dbc - the current database context
id - the id of the user to read
Returns:
the user read
Throws:
CmsException - if something goes wrong

readUser

public CmsUser readUser(CmsDbContext dbc,
                        java.lang.String username)
                 throws CmsDataAccessException
Returns a user object.

Parameters:
dbc - the current database context
username - the name of the user that is to be read
Returns:
user read
Throws:
CmsDataAccessException - if operation was not succesful

readUser

public CmsUser readUser(CmsDbContext dbc,
                        java.lang.String username,
                        int type)
                 throws CmsDataAccessException,
                        CmsDbSqlException,
                        CmsDbEntryNotFoundException
Returns a user object.

Parameters:
dbc - the current database context
username - the name of the user that is to be read
type - the type of the user
Returns:
user read
Throws:
CmsDataAccessException - if an underlying Exception related to runtime type instantiation (IOException, ClassCastException) occurs
CmsDbSqlException - if an underlying Exception related to data retrieval (SQLException) occurs
CmsDbEntryNotFoundException - if the user corresponding to the given id does not exist in the database

readUser

public CmsUser readUser(CmsDbContext dbc,
                        java.lang.String username,
                        java.lang.String password)
                 throws CmsException
Returns a user object if the password for the user is correct.

If the user/pwd pair is not valid a CmsException is thrown.

Parameters:
dbc - the current database context
username - the username of the user that is to be read
password - the password of the user that is to be read
Returns:
user read
Throws:
CmsException - if operation was not succesful

readWebUser

public CmsUser readWebUser(CmsDbContext dbc,
                           java.lang.String username)
                    throws CmsException
Read a web user from the database.

Parameters:
dbc - the current database context
username - the web user to read
Returns:
the read web user
Throws:
CmsException - if the user could not be read.

readWebUser

public CmsUser readWebUser(CmsDbContext dbc,
                           java.lang.String username,
                           java.lang.String password)
                    throws CmsException
Returns a user object if the password for the user is correct.

If the user/pwd pair is not valid a CmsException is thrown.

Parameters:
dbc - the current database context
username - the username of the user that is to be read
password - the password of the user that is to be read
Returns:
the webuser read
Throws:
CmsException - if operation was not succesful

removeAccessControlEntry

public void removeAccessControlEntry(CmsDbContext dbc,
                                     CmsResource resource,
                                     CmsUUID principal)
                              throws CmsException
Removes an access control entry for a given resource and principal.

Parameters:
dbc - the current database context
resource - the resource
principal - the id of the principal to remove the the access control entry for
Throws:
CmsException - if something goes wrong

removeResourceFromProject

public void removeResourceFromProject(CmsDbContext dbc,
                                      CmsResource resource)
                               throws CmsException
Removes a resource from the current project of the user.

Parameters:
dbc - the current database context
resource - the resource to apply this operation to
Throws:
CmsException - if something goes wrong
See Also:
CmsObject.copyResourceToProject(String), I_CmsResourceType.copyResourceToProject(CmsObject, CmsSecurityManager, CmsResource)

removeUserFromGroup

public void removeUserFromGroup(CmsDbContext dbc,
                                java.lang.String username,
                                java.lang.String groupname)
                         throws CmsException,
                                CmsIllegalArgumentException,
                                CmsDbEntryNotFoundException,
                                CmsSecurityException
Removes a user from a group.

Parameters:
dbc - the current database context
username - the name of the user that is to be removed from the group
groupname - the name of the group
Throws:
CmsException - if operation was not succesful
CmsIllegalArgumentException - if the given user was not member in the given group
CmsDbEntryNotFoundException - if the given group was not found
CmsSecurityException - if the given user was read as 'null' from the database

replaceResource

public void replaceResource(CmsDbContext dbc,
                            CmsResource resource,
                            int type,
                            byte[] content,
                            java.util.List properties)
                     throws CmsException
Replaces the content, type and properties of a resource.

Parameters:
dbc - the current database context
resource - the name of the resource to apply this operation to
type - the new type of the resource
content - the new content of the resource
properties - the new properties of the resource
Throws:
CmsException - if something goes wrong
See Also:
CmsObject.replaceResource(String, int, byte[], List), I_CmsResourceType.replaceResource(CmsObject, CmsSecurityManager, CmsResource, int, byte[], List)

resetPassword

public void resetPassword(CmsDbContext dbc,
                          java.lang.String username,
                          java.lang.String oldPassword,
                          java.lang.String newPassword)
                   throws CmsException,
                          CmsSecurityException
Resets the password for a specified user.

Parameters:
dbc - the current database context
username - the name of the user
oldPassword - the old password
newPassword - the new password
Throws:
CmsException - if the user data could not be read from the database
CmsSecurityException - if the specified username and old password could not be verified

restoreResource

public void restoreResource(CmsDbContext dbc,
                            CmsResource resource,
                            int tag)
                     throws CmsException
Restores a file in the current project with a version from the backup archive.

Parameters:
dbc - the current database context
resource - the resource to restore from the archive
tag - the tag (version) id to resource form the archive
Throws:
CmsException - if something goes wrong
See Also:
CmsObject.restoreResourceBackup(String, int), I_CmsResourceType.restoreResourceBackup(CmsObject, CmsSecurityManager, CmsResource, int)

setDateExpired

public void setDateExpired(CmsDbContext dbc,
                           CmsResource resource,
                           long dateExpired)
                    throws CmsDataAccessException
Changes the "expire" date of a resource.

Parameters:
dbc - the current database context
resource - the resource to touch
dateExpired - the new expire date of the resource
Throws:
CmsDataAccessException - if something goes wrong
See Also:
CmsObject.setDateExpired(String, long, boolean), I_CmsResourceType.setDateExpired(CmsObject, CmsSecurityManager, CmsResource, long, boolean)

setDateLastModified

public void setDateLastModified(CmsDbContext dbc,
                                CmsResource resource,
                                long dateLastModified)
                         throws CmsDataAccessException
Changes the "last modified" timestamp of a resource.

Parameters:
dbc - the current database context
resource - the resource to touch
dateLastModified - the new last modified date of the resource
Throws:
CmsDataAccessException - if something goes wrong
See Also:
CmsObject.setDateLastModified(String, long, boolean), I_CmsResourceType.setDateLastModified(CmsObject, CmsSecurityManager, CmsResource, long, boolean)

setDateReleased

public void setDateReleased(CmsDbContext dbc,
                            CmsResource resource,
                            long dateReleased)
                     throws CmsDataAccessException
Changes the "release" date of a resource.

Parameters:
dbc - the current database context
resource - the resource to touch
dateReleased - the new release date of the resource
Throws:
CmsDataAccessException - if something goes wrong
See Also:
CmsObject.setDateReleased(String, long, boolean), I_CmsResourceType.setDateReleased(CmsObject, CmsSecurityManager, CmsResource, long, boolean)

setName

public void setName(CmsDbContext dbc,
                    int taskId,
                    java.lang.String name)
             throws CmsException,
                    CmsDataAccessException,
                    CmsIllegalArgumentException
Set a new name for a task.

Parameters:
dbc - the current database context
taskId - the Id of the task to set the percentage
name - the new name value
Throws:
CmsException - if an error occurs while writing workflow system task logs
CmsDataAccessException - if an error occurs while reading the task from or writing it to the underlying workflow driver
CmsIllegalArgumentException - if argument name is null or has a length of zero

setParentGroup

public void setParentGroup(CmsDbContext dbc,
                           java.lang.String groupName,
                           java.lang.String parentGroupName)
                    throws CmsException,
                           CmsDataAccessException
Sets a new parent group for an already existing group.

Parameters:
dbc - the current database context
groupName - the name of the group that should be written
parentGroupName - the name of the parent group to set, or null if the parent group should be deleted.
Throws:
CmsException - if operation was not succesfull
CmsDataAccessException - if the group with groupName could not be read from VFS

setPassword

public void setPassword(CmsDbContext dbc,
                        java.lang.String username,
                        java.lang.String newPassword)
                 throws CmsException,
                        CmsIllegalArgumentException
Sets the password for a user.

Parameters:
dbc - the current database context
username - the name of the user
newPassword - the new password
Throws:
CmsException - if operation was not succesfull
CmsIllegalArgumentException - if the user with the username was not found

setPriority

public void setPriority(CmsDbContext dbc,
                        int taskId,
                        int priority)
                 throws CmsException,
                        CmsDataAccessException
Set priority of a task.

Parameters:
dbc - the current database context
taskId - the Id of the task to set the percentage
priority - the priority value
Throws:
CmsException - if writing to the system task log failed
CmsDataAccessException - if reading or writing of the task failed

setTaskPar

public void setTaskPar(CmsDbContext dbc,
                       int taskId,
                       java.lang.String parName,
                       java.lang.String parValue)
                throws CmsDataAccessException
Set a Parameter for a task.

Parameters:
dbc - the current database context
taskId - the Id of the task
parName - name of the parameter
parValue - value if the parameter
Throws:
CmsDataAccessException - if something goes wrong

setTimeout

public void setTimeout(CmsDbContext dbc,
                       int taskId,
                       long timeout)
                throws CmsException,
                       CmsDataAccessException
Set the timeout of a task.

Parameters:
dbc - the current database context
taskId - the Id of the task to set the percentage
timeout - new timeout value
Throws:
CmsException - if writing to the system task log failed
CmsDataAccessException - if reading or writing of the task failed

undoChanges

public void undoChanges(CmsDbContext dbc,
                        CmsResource resource)
                 throws CmsException
Undos all changes in the resource by restoring the version from the online project to the current offline project.

Parameters:
dbc - the current database context
resource - the name of the resource to apply this operation to
Throws:
CmsException - if something goes wrong
See Also:
CmsObject.undoChanges(String, boolean), I_CmsResourceType.undoChanges(CmsObject, CmsSecurityManager, CmsResource, boolean)

unlockProject

public void unlockProject(CmsProject project)
                   throws CmsLockException
Unlocks all resources in the given project.

Parameters:
project - the project to unlock the resources in
Throws:
CmsLockException - if something goes wrong

unlockResource

public void unlockResource(CmsDbContext dbc,
                           CmsResource resource)
                    throws CmsException
Unlocks a resource.

Parameters:
dbc - the current database context
resource - the resource to unlock
Throws:
CmsException - if something goes wrong
See Also:
CmsObject.unlockResource(String), I_CmsResourceType.unlockResource(CmsObject, CmsSecurityManager, CmsResource)

updateExportPoints

public void updateExportPoints(CmsDbContext dbc,
                               I_CmsReport report)
Update the export points.

All files and folders "inside" an export point are written.

Parameters:
dbc - the current database context
report - an I_CmsReport instance to print output message, or null to write messages to the log file

userInGroup

public boolean userInGroup(CmsDbContext dbc,
                           java.lang.String username,
                           java.lang.String groupname)
                    throws CmsException
Returns true if a user is member of the given group.

Parameters:
dbc - the current database context
username - the name of the user to check
groupname - the name of the group to check
Returns:
true, if the user is in the group, false otherwise
Throws:
CmsException - if something goes wrong

validateHtmlLinks

public java.util.Map validateHtmlLinks(CmsObject cms,
                                       CmsPublishList publishList,
                                       I_CmsReport report)
                                throws java.lang.Exception
Validates the HTML links in the unpublished files of the specified publish list, if a file resource type implements the interface I_CmsXmlDocumentLinkValidatable.

Parameters:
cms - the current user's Cms object
publishList - an OpenCms publish list
report - a report to write the messages to
Returns:
a map with lists of invalid links (String objects) keyed by resource names
Throws:
java.lang.Exception - if something goes wrong
See Also:
fillPublishList(CmsDbContext, CmsPublishList)

validatePassword

public void validatePassword(java.lang.String password)
                      throws CmsSecurityException
This method checks if a new password follows the rules for new passwords, which are defined by a Class implementing the I_CmsPasswordHandler interface and configured in the opencms.properties file.

If this method throws no exception the password is valid.

Parameters:
password - the new password that has to be checked
Throws:
CmsSecurityException - if the password is not valid

writeAccessControlEntry

public void writeAccessControlEntry(CmsDbContext dbc,
                                    CmsResource resource,
                                    CmsAccessControlEntry ace)
                             throws CmsException
Writes an access control entries to a given resource.

Parameters:
dbc - the current database context
resource - the resource
ace - the entry to write
Throws:
CmsException - if something goes wrong

writeExportPoints

public void writeExportPoints(CmsDbContext dbc,
                              int projectId,
                              I_CmsReport report,
                              CmsUUID publishHistoryId)
Writes all export points into the file system for a publish task specified by its publish history ID.

Parameters:
dbc - the current database context
projectId - the id of the project that was published
report - an I_CmsReport instance to print output message, or null to write messages to the log file
publishHistoryId - unique int ID to identify each publish task in the publish history

writeFile

public CmsFile writeFile(CmsDbContext dbc,
                         CmsFile resource)
                  throws CmsException
Writes a resource to the OpenCms VFS, including it's content.

Applies only to resources of type CmsFile i.e. resources that have a binary content attached.

Certain resource types might apply content validation or transformation rules before the resource is actually written to the VFS. The returned result might therefore be a modified version from the provided original.

Parameters:
dbc - the current database context
resource - the resource to apply this operation to
Returns:
the written resource (may have been modified)
Throws:
CmsException - if something goes wrong
See Also:
CmsObject.writeFile(CmsFile), I_CmsResourceType.writeFile(CmsObject, CmsSecurityManager, CmsFile)

writeGroup

public void writeGroup(CmsDbContext dbc,
                       CmsGroup group)
                throws CmsException
Writes an already existing group.

The group id has to be a valid OpenCms group id.
The group with the given id will be completely overriden by the given data.

Parameters:
dbc - the current database context
group - the group that should be written
Throws:
CmsException - if operation was not succesfull

writeProject

public void writeProject(CmsDbContext dbc,
                         CmsProject project)
                  throws CmsException
Writes an already existing project.

The project id has to be a valid OpenCms project id.
The project with the given id will be completely overriden by the given data.

Parameters:
dbc - the current database context
project - the project that should be written
Throws:
CmsException - if operation was not successful

writePropertyObject

public void writePropertyObject(CmsDbContext dbc,
                                CmsResource resource,
                                CmsProperty property)
                         throws CmsException
Writes a property for a specified resource.

Parameters:
dbc - the current database context
resource - the resource to write the property for
property - the property to write
Throws:
CmsException - if something goes wrong
See Also:
CmsObject.writePropertyObject(String, CmsProperty), I_CmsResourceType.writePropertyObject(CmsObject, CmsSecurityManager, CmsResource, CmsProperty)

writePropertyObjects

public void writePropertyObjects(CmsDbContext dbc,
                                 CmsResource resource,
                                 java.util.List properties)
                          throws CmsException
Writes a list of properties for a specified resource.

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.

Parameters:
dbc - the current database context
resource - the resource to write the properties for
properties - the list of properties to write
Throws:
CmsException - if something goes wrong
See Also:
CmsObject.writePropertyObjects(String, List), I_CmsResourceType.writePropertyObjects(CmsObject, CmsSecurityManager, CmsResource, List)

writeResource

public void writeResource(CmsDbContext dbc,
                          CmsResource resource)
                   throws CmsException
Writes a resource to the OpenCms VFS.

Parameters:
dbc - the current database context
resource - the resource to write
Throws:
CmsException - if something goes wrong

writeStaticExportPublishedResource

public void writeStaticExportPublishedResource(CmsDbContext dbc,
                                               java.lang.String resourceName,
                                               int linkType,
                                               java.lang.String linkParameter,
                                               long timestamp)
                                        throws CmsException
Inserts an entry in the published resource table.

This is done during static export.

Parameters:
dbc - the current database context
resourceName - The name of the resource to be added to the static export
linkType - the type of resource exported (0= non-paramter, 1=parameter)
linkParameter - the parameters added to the resource
timestamp - a timestamp for writing the data into the db
Throws:
CmsException - if something goes wrong

writeTaskLog

public void writeTaskLog(CmsDbContext dbc,
                         int taskid,
                         java.lang.String comment)
                  throws CmsException
Writes a new user tasklog for a task.

Parameters:
dbc - the current database context
taskid - the Id of the task
comment - description for the log
Throws:
CmsException - if something goes wrong

writeTaskLog

public void writeTaskLog(CmsDbContext dbc,
                         int taskId,
                         java.lang.String comment,
                         int type)
                  throws CmsException
Writes a new task log entry for a task.

Parameters:
dbc - the current database context
taskId - the Id of the task
comment - description for the log
type - type of the tasklog. User tasktypes must be greater then 100
Throws:
CmsException - something goes wrong

writeUser

public void writeUser(CmsDbContext dbc,
                      CmsUser user)
               throws CmsException
Updates the user information.

The user id has to be a valid OpenCms user id.
The user with the given id will be completely overriden by the given data.

Parameters:
dbc - the current database context
user - the user to be updated
Throws:
CmsException - if operation was not succesful

writeWebUser

public void writeWebUser(CmsDbContext dbc,
                         CmsUser user)
                  throws CmsException
Updates the user information of a web user.
Only a web user can be updated this way.

The user id has to be a valid OpenCms user id.
The user with the given id will be completely overriden by the given data.

Parameters:
dbc - the current database context
user - the user to be updated
Throws:
CmsException - if operation was not succesful

convertResourceToFolder

protected CmsFolder convertResourceToFolder(CmsResource resource)
                                     throws CmsVfsResourceNotFoundException
Converts a resource to a folder (if possible).

Parameters:
resource - the resource to convert
Returns:
the converted resource
Throws:
CmsVfsResourceNotFoundException - if the resource is not a folder

finalize

protected void finalize()
                 throws java.lang.Throwable
Releases any allocated resources during garbage collection.

Throws:
java.lang.Throwable
See Also:
Object.finalize()

isWebgroup

protected boolean isWebgroup(CmsDbContext dbc,
                             CmsGroup group)
                      throws CmsException
Checks if this is a valid group for webusers.

Parameters:
dbc - the current database context
group - the group to be checked
Returns:
true if the group does not belong to users, administrators or projectmanagers
Throws:
CmsException - if operation was not succesful