org.opencms.db
Class CmsDriverManager

java.lang.Object
  extended by org.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, Ruediger Kurz

Field Summary
static java.lang.String ATTRIBUTE_LOGIN
          Attribute login.
static java.lang.String ATTRIBUTE_USERADDINFO
          Attribute WRITE USER_ADDINFO.
static java.lang.String ATTRIBUTE_USERADDINFO_VALUE_DELETE
          Attribute WRITE USER_ADDINFO value delete.
static java.lang.String ATTRIBUTE_USERADDINFO_VALUE_INSERT
          Attribute WRITE USER_ADDINFO value insert.
static java.lang.String ATTRIBUTE_USERADDINFO_VALUE_UPDATE
          Attribute WRITE USER_ADDINFO value insert.
static java.lang.String CACHE_ALL_PROPERTIES
          Cache key for all properties.
static int CHANGED_ACCESSCONTROL
          Value to indicate a change in access control entries of a resource.
static int CHANGED_CONTENT
          Value to indicate a content change.
static int CHANGED_LASTMODIFIED
          Value to indicate a change in the lastmodified settings of a resource.
static int CHANGED_RESOURCE
          Value to indicate a change in the resource data.
static int CHANGED_TIMEFRAME
          Value to indicate a change in the availability timeframe.
static java.lang.String CONFIGURATION_BACKUP
          Deprecated. use CONFIGURATION_HISTORY instead
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_HISTORY
          "driver.history" 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 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 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 java.lang.String TEMP_FILE_PREFIX
          Prefix char for temporary files in the VFS.
static int UPDATE_ALL
          Key to indicate complete update.
static int UPDATE_RESOURCE
          Key to indicate update of resource record.
static int UPDATE_RESOURCE_PROJECT
          Key to indicate update of last modified project reference.
static int UPDATE_RESOURCE_STATE
          Key to indicate update of resource state.
static int UPDATE_RESOURCE_STATE_CONTENT
          Key to indicate update of resource state including the content date.
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_FULLSTATIC_EXPORT, EVENT_GROUP_MODIFIED, EVENT_LOGIN_USER, EVENT_OU_MODIFIED, EVENT_PROJECT_MODIFIED, EVENT_PROPERTY_DEFINITION_CREATED, EVENT_PROPERTY_DEFINITION_MODIFIED, EVENT_PROPERTY_MODIFIED, EVENT_PUBLISH_PROJECT, EVENT_REBUILD_SEARCHINDEXES, EVENT_RESOURCE_AND_PROPERTIES_MODIFIED, EVENT_RESOURCE_COPIED, EVENT_RESOURCE_CREATED, EVENT_RESOURCE_DELETED, EVENT_RESOURCE_MODIFIED, EVENT_RESOURCE_MOVED, EVENT_RESOURCES_AND_PROPERTIES_MODIFIED, EVENT_RESOURCES_MODIFIED, EVENT_UPDATE_EXPORTS, EVENT_USER_MODIFIED, KEY_CHANGE, KEY_DBCONTEXT, KEY_GROUP_ID, KEY_GROUP_NAME, KEY_INDEX_NAMES, KEY_OU_ID, KEY_OU_NAME, KEY_PROJECTID, KEY_PUBLISHID, KEY_PUBLISHLIST, KEY_REPORT, KEY_RESOURCE, KEY_RESOURCES, KEY_USER_ACTION, KEY_USER_ID, KEY_USER_NAME, LISTENERS_FOR_ALL_EVENTS, VALUE_GROUP_MODIFIED_ACTION_CREATE, VALUE_GROUP_MODIFIED_ACTION_DELETE, VALUE_GROUP_MODIFIED_ACTION_WRITE, VALUE_OU_MODIFIED_ACTION_CREATE, VALUE_OU_MODIFIED_ACTION_DELETE, VALUE_USER_MODIFIED_ACTION_ADD_USER_TO_GROUP, VALUE_USER_MODIFIED_ACTION_CREATE_USER, VALUE_USER_MODIFIED_ACTION_DELETE_USER, VALUE_USER_MODIFIED_ACTION_REMOVE_USER_FROM_GROUP, VALUE_USER_MODIFIED_ACTION_RESET_PASSWORD, VALUE_USER_MODIFIED_ACTION_SET_OU, VALUE_USER_MODIFIED_ACTION_WRITE_USER
 
Method Summary
 void addRelationToResource(CmsDbContext dbc, CmsResource resource, CmsResource target, CmsRelationType type, boolean importCase)
          Adds a new relation to the given resource.
 void addResourceToOrgUnit(CmsDbContext dbc, CmsOrganizationalUnit orgUnit, CmsResource resource)
          Adds a resource to the given organizational unit.
 void addUserToGroup(CmsDbContext dbc, java.lang.String username, java.lang.String groupname, boolean readRoles)
          Adds a user to a group.
 void changeLock(CmsDbContext dbc, CmsResource resource, CmsLockType lockType)
          Changes the lock of a resource to the current user, that is "steals" the lock from another user.
 java.util.List changeResourcesInFolderWithProperty(CmsDbContext dbc, CmsResource resource, java.lang.String propertyDefinition, java.lang.String oldValue, java.lang.String newValue, boolean recursive)
          Returns a list with all sub resources of a given folder that have set the given property, matching the current property's value with the given old value and replacing it by a given new value.
 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 resource.
 void copyResource(CmsDbContext dbc, CmsResource source, java.lang.String destination, CmsResource.CmsResourceCopyMode siblingMode)
          Copies a resource.
 void copyResourceToProject(CmsDbContext dbc, CmsResource resource)
          Copies a resource to the current project of the user.
 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.
 CmsOrganizationalUnit createOrganizationalUnit(CmsDbContext dbc, java.lang.String ouFqn, java.lang.String description, int flags, CmsResource resource)
          Creates a new organizational unit.
 CmsProject createProject(CmsDbContext dbc, java.lang.String name, java.lang.String description, java.lang.String groupname, java.lang.String managergroupname, CmsProject.CmsProjectType projecttype)
          Creates a project.
 CmsPropertyDefinition createPropertyDefinition(CmsDbContext dbc, java.lang.String name)
          Creates a property definition.
 void createPublishJob(CmsDbContext dbc, CmsPublishJobInfoBean publishJob)
          Creates a new publish job.
 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.
 CmsResource createSibling(CmsDbContext dbc, CmsResource source, java.lang.String destination, java.util.List properties)
          Creates a new sibling of the source resource.
 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 deleteGroup(CmsDbContext dbc, CmsGroup group, CmsUUID replacementId)
          Deletes a group, where all permissions, users and children of the group are transfered to a replacement group.
 void deleteHistoricalVersions(CmsDbContext dbc, int versionsToKeep, int versionsDeleted, long timeDeleted, I_CmsReport report)
          Deletes the versions from the history tables, keeping the given number of versions per resource.
 void deleteOrganizationalUnit(CmsDbContext dbc, CmsOrganizationalUnit organizationalUnit)
          Deletes an organizational unit.
 void deleteProject(CmsDbContext dbc, CmsProject deleteProject)
          Deletes a project.
 void deletePropertyDefinition(CmsDbContext dbc, java.lang.String name)
          Deletes a property definition.
 void deletePublishJob(CmsDbContext dbc, CmsUUID publishHistoryId)
          Deletes a publish job identified by its history id.
 void deletePublishList(CmsDbContext dbc, CmsUUID publishHistoryId)
          Deletes the publish list assigned to a publish job.
 void deleteRelationsForResource(CmsDbContext dbc, CmsResource resource, CmsRelationFilter filter)
          Deletes all relations for the given resource matching the given filter.
protected  void deleteRelationsWithSiblings(CmsDbContext dbc, CmsResource resource)
          Deletes all relations for the given resource and all its siblings.
 void deleteResource(CmsDbContext dbc, CmsResource resource, CmsResource.CmsResourceDeleteMode 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 destroy()
          Destroys this driver manager and releases all allocated resources.
 boolean existsResourceId(CmsDbContext dbc, CmsUUID resourceId)
          Tests if a resource with the given resourceId does already exist in the Database.
 void fillPublishList(CmsDbContext dbc, CmsPublishList publishList)
          Fills the given publish list with the the VFS resources that actually get published.
 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, CmsOrganizationalUnit orgUnit, boolean includeSubOus)
          Returns all projects which are owned by the current user or which are accessible by the current user.
 java.util.List getAllHistoricalProjects(CmsDbContext dbc)
          Returns a list with all projects from history.
 java.util.List getAllManageableProjects(CmsDbContext dbc, CmsOrganizationalUnit orgUnit, boolean includeSubOus)
          Returns all projects which are owned by the current user or which are manageable for the group of the user.
 java.util.List getChildren(CmsDbContext dbc, CmsGroup group, boolean includeSubChildren)
          Returns all child groups of a group.
 java.util.List getGroups(CmsDbContext dbc, CmsOrganizationalUnit orgUnit, boolean includeSubOus, boolean readRoles)
          Returns all groups of the given organizational unit.
 java.util.List getGroupsOfUser(CmsDbContext dbc, java.lang.String username, boolean readRoles)
          Returns the groups of an user filtered by the specified IP address.
 java.util.List getGroupsOfUser(CmsDbContext dbc, java.lang.String username, java.lang.String ouFqn, boolean includeChildOus, boolean readRoles, boolean directGroupsOnly, java.lang.String remoteAddress)
          Returns the groups of an user filtered by the specified IP address.
 I_CmsHistoryDriver getHistoryDriver()
          Returns the history driver.
 I_CmsHistoryDriver getHistoryDriver(CmsDbContext dbc)
          Returns the history driver for a given database context.
 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.
 java.util.List getLockedResources(CmsDbContext dbc, CmsResource resource, CmsLockFilter filter)
          Returns all locked resources in a given folder.
protected  CmsLockManager getLockManager()
          Returns the lock manager instance.
 int getNextPublishTag(CmsDbContext dbc)
          Returns the next publish tag for the published historical resources.
 java.util.List getOrganizationalUnits(CmsDbContext dbc, CmsOrganizationalUnit parent, boolean includeChildren)
          Returns all child organizational units of the given parent organizational unit including hierarchical deeper organization units if needed.
 java.util.List getOrgUnitsForRole(CmsDbContext dbc, CmsRole role, boolean includeSubOus)
          Returns all the organizational units for which the current user has the given role.
 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.
 I_CmsProjectDriver getProjectDriver(CmsDbContext dbc)
          Returns the project driver for a given DB context.
 I_CmsProjectDriver getProjectDriver(CmsDbContext dbc, I_CmsProjectDriver defaultDriver)
          Returns either the project driver for the DB context (if it has one) or a default project driver.
 CmsUUID getProjectId(CmsDbContext dbc, int id)
          Returns the uuid id for the given id.
 org.apache.commons.collections.ExtendedProperties getPropertyConfiguration()
          Returns the configuration read from the opencms.properties file.
 CmsPublishList getRelatedResourcesToPublish(CmsDbContext dbc, CmsPublishList publishList, CmsRelationFilter filter)
          Returns a new publish list that contains the unpublished resources related to all resources in the given publish list, the related resources exclude all resources in the given publish list and also locked (by other users) resources.
 java.util.List getRelationsForResource(CmsDbContext dbc, CmsResource resource, CmsRelationFilter filter)
          Returns all relations for the given resource matching the given filter.
 java.util.List getResourceOrgUnits(CmsDbContext dbc, CmsResource resource)
          Returns the list of organizational units the given resource belongs to.
 java.util.List getResourcesForOrganizationalUnit(CmsDbContext dbc, CmsOrganizationalUnit orgUnit)
          Returns all resources of the given organizational unit.
 java.util.Set 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.
 java.util.List getRolesForResource(CmsDbContext dbc, CmsUser user, CmsResource resource)
          Returns all roles the given user has for the given resource.
 java.util.List getRolesForUser(CmsDbContext dbc, CmsUser user)
          Returns all roles the given user has independent of the resource.
 CmsSecurityManager getSecurityManager()
          Returns the security manager this driver manager belongs to.
 CmsSqlManager getSqlManager()
          Returns an instance of the common sql manager.
 I_CmsUserDriver getUserDriver()
          Returns the user driver.
 I_CmsUserDriver getUserDriver(CmsDbContext dbc)
          Returns the user driver for a given database context.
 I_CmsUserDriver getUserDriver(CmsDbContext dbc, I_CmsUserDriver defaultDriver)
          Returns either the user driver for the given DB context (if it has one) or a default value instead.
 java.util.List getUsers(CmsDbContext dbc, CmsOrganizationalUnit orgUnit, boolean recursive)
          Returns all direct users of the given organizational unit.
 java.util.List getUsersOfGroup(CmsDbContext dbc, java.lang.String groupname, boolean includeOtherOuUsers, boolean directUsersOnly, boolean readRoles)
          Returns a list of users in a group.
 I_CmsVfsDriver getVfsDriver()
          Returns the VFS driver.
 I_CmsVfsDriver getVfsDriver(CmsDbContext dbc)
          Returns the VFS driver for the given database context.
 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 firstname, java.lang.String lastname, java.lang.String email, int flags, long dateCreated, java.util.Map additionalInfos)
          Creates a new user by import.
 void init(CmsConfigurationManager configurationManager)
          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 isTempfileProject(CmsProject project)
          Checks if a project is the tempfile project.
 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, CmsLockType type)
          Locks a resource.
 CmsUser loginUser(CmsDbContext dbc, java.lang.String userName, java.lang.String password, java.lang.String remoteAddress)
          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.
 void moveResource(CmsDbContext dbc, CmsResource source, java.lang.String destination, boolean internal)
          Moves a resource.
 java.lang.String moveToLostAndFound(CmsDbContext dbc, CmsResource resource, 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.
static CmsDriverManager newInstance(CmsConfigurationManager configurationManager, CmsSecurityManager securityManager, I_CmsDbContextFactory runtimeInfoFactory, CmsPublishEngine publishEngine)
          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 publishJob(CmsObject cms, CmsDbContext dbc, CmsPublishList publishList, I_CmsReport report)
          Publishes the given publish job.
 void publishProject(CmsObject cms, CmsDbContext dbc, CmsPublishList publishList, I_CmsReport report)
          Publishes the resources of a specified publish list.
 CmsAccessControlEntry readAccessControlEntry(CmsDbContext dbc, CmsResource resource, CmsUUID principal)
          Reads an access control entry from the cms.
 java.util.List readAllAvailableVersions(CmsDbContext dbc, CmsResource resource)
          Reads all versions of the given resource.
 java.util.List readAllPropertyDefinitions(CmsDbContext dbc)
          Reads all property definitions for the given mapping type.
 java.util.List readChildResources(CmsDbContext dbc, CmsResource resource, CmsResourceFilter filter, boolean getFolders, boolean getFiles, boolean checkPermissions)
          Returns the child resources of a resource, that is the resources contained in a folder.
 CmsResource readDefaultFile(CmsDbContext dbc, CmsResource resource)
          Returns the default file for the given folder.
 java.util.List readDeletedResources(CmsDbContext dbc, CmsResource resource, boolean readTree, boolean isVfsManager)
          Reads all deleted (historical) resources below the given path, including the full tree below the path, if required.
 CmsFile readFile(CmsDbContext dbc, CmsResource resource)
          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.
 CmsGroup readGroup(CmsDbContext dbc, CmsProject project)
          Reads the group of a project.
 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.
 CmsHistoryPrincipal readHistoricalPrincipal(CmsDbContext dbc, CmsUUID principalId)
          Reads a principal (an user or group) from the historical archive based on its ID.
 CmsHistoryProject readHistoryProject(CmsDbContext dbc, CmsUUID projectId)
          Returns the latest historical project entry with the given id.
 CmsHistoryProject readHistoryProject(CmsDbContext dbc, int publishTag)
          Returns a historical project entry.
 java.util.List readHistoryPropertyObjects(CmsDbContext dbc, I_CmsHistoryResource historyResource)
          Reads the list of all CmsProperty objects that belongs to the given historical resource.
 void readLocks(CmsDbContext dbc)
          Reads the locks that were saved to the database in the previous run of OpenCms.
 CmsGroup readManagerGroup(CmsDbContext dbc, CmsProject project)
          Reads the manager group of a project.
 CmsOrganizationalUnit readOrganizationalUnit(CmsDbContext dbc, java.lang.String ouFqn)
          Reads an organizational Unit based on its fully qualified name.
 CmsUser readOwner(CmsDbContext dbc, CmsProject project)
          Reads the owner of a project.
 java.util.List readPath(CmsDbContext dbc, java.lang.String path, CmsResourceFilter filter)
          Builds a list of resources for a given path.
 CmsProject readProject(CmsDbContext dbc, CmsUUID id)
          Reads a project given the projects id.
 CmsProject readProject(CmsDbContext dbc, java.lang.String name)
          Reads 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, CmsUUID projectId, CmsResourceState 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.
 CmsPublishJobInfoBean readPublishJob(CmsDbContext dbc, CmsUUID publishHistoryId)
          Reads a single publish job identified by its publish history id.
 java.util.List readPublishJobs(CmsDbContext dbc, long startTime, long endTime)
          Reads all available publish jobs.
 CmsPublishList readPublishList(CmsDbContext dbc, CmsUUID publishHistoryId)
          Reads the publish list assigned to a publish job.
 byte[] readPublishReportContents(CmsDbContext dbc, CmsUUID publishHistoryId)
          Reads the publish report assigned to a publish job.
 I_CmsHistoryResource readResource(CmsDbContext dbc, CmsResource resource, int version)
          Reads an historical resource entry for the given resource and with the given version number.
 CmsResource readResource(CmsDbContext dbc, CmsUUID structureID, CmsResourceFilter filter)
          Reads a resource from the VFS, using the specified resource filter.
 CmsResource readResource(CmsDbContext dbc, java.lang.String resourcePath, CmsResourceFilter filter)
          Reads a resource from the VFS, using the specified resource filter.
 I_CmsHistoryResource readResourceForPublishTag(CmsDbContext dbc, CmsResource resource, int publishTag)
          Deprecated. use readResource(CmsDbContext, CmsResource, int) instead but notice that the publishTag != version
 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, CmsResource folder, java.lang.String propertyDefinition, java.lang.String value, CmsResourceFilter filter)
          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.
 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, 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 removeResourceFromOrgUnit(CmsDbContext dbc, CmsOrganizationalUnit orgUnit, CmsResource resource)
          Removes a resource from the given organizational unit.
 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, boolean readRoles)
          Removes a user from a group.
 void repairCategories(CmsDbContext dbc, CmsUUID projectId, CmsResource resource)
          Repairs broken categories.
 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 restoreDeletedResource(CmsDbContext dbc, CmsUUID structureId)
          Restores a deleted resource identified by its structure id from the historical archive.
 void restoreResource(CmsDbContext dbc, CmsResource resource, int version)
          Restores a resource in the current project with a version from the historical 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 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 setUsersOrganizationalUnit(CmsDbContext dbc, CmsOrganizationalUnit orgUnit, CmsUser user)
          Moves an user to the given organizational unit.
 void undelete(CmsDbContext dbc, CmsResource resource)
          Undelete the resource.
 void undoChanges(CmsDbContext dbc, CmsResource resource, CmsResource.CmsResourceUndoMode mode)
          Undos all changes in the resource by restoring the version from the online project to the current offline project.
 void unlockProject(CmsProject project)
          Unlocks all resources in the given project.
 void unlockResource(CmsDbContext dbc, CmsResource resource, boolean force, boolean removeSystemLock)
          Unlocks a resource.
 void updateExportPoints(CmsDbContext dbc)
          Update the export points.
 void updateRelationsForResource(CmsDbContext dbc, CmsResource resource, java.util.List links)
          Updates/Creates the given relations for the given resource.
 boolean userInGroup(CmsDbContext dbc, java.lang.String username, java.lang.String groupname, boolean readRoles)
          Returns true if a user is member of the given group.
 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.
 java.util.Map validateRelations(CmsDbContext dbc, CmsPublishList publishList, I_CmsReport report)
          Validates the relations for the given resources.
 void writeAccessControlEntry(CmsDbContext dbc, CmsResource resource, CmsAccessControlEntry ace)
          Writes an access control entries to a given resource.
 void writeExportPoints(CmsDbContext dbc, I_CmsReport report, CmsUUID publishHistoryId)
          Writes all export points into the file system for the publish task specified by trhe given 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 writeHistoryProject(CmsDbContext dbc, int publishTag, long publishDate)
          Creates an historical entry of the current project.
 void writeLocks(CmsDbContext dbc)
          Writes the locks that are currently stored in-memory to the database to allow restoring them in future server startups.
 void writeOrganizationalUnit(CmsDbContext dbc, CmsOrganizationalUnit organizationalUnit)
          Writes an already existing organizational unit.
 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, boolean updateState)
          Writes a list of properties for a specified resource.
 void writePublishJob(CmsDbContext dbc, CmsPublishJobInfoBean publishJob)
          Updates a publish job.
 void writePublishReport(CmsDbContext dbc, CmsPublishJobInfoBean publishJob)
          Writes the publish report for a publish job.
 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 writeUser(CmsDbContext dbc, CmsUser user)
          Updates the user information.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ATTRIBUTE_LOGIN

public static final java.lang.String ATTRIBUTE_LOGIN
Attribute login.

See Also:
Constant Field Values

ATTRIBUTE_USERADDINFO

public static final java.lang.String ATTRIBUTE_USERADDINFO
Attribute WRITE USER_ADDINFO.

See Also:
Constant Field Values

ATTRIBUTE_USERADDINFO_VALUE_DELETE

public static final java.lang.String ATTRIBUTE_USERADDINFO_VALUE_DELETE
Attribute WRITE USER_ADDINFO value delete.

See Also:
Constant Field Values

ATTRIBUTE_USERADDINFO_VALUE_INSERT

public static final java.lang.String ATTRIBUTE_USERADDINFO_VALUE_INSERT
Attribute WRITE USER_ADDINFO value insert.

See Also:
Constant Field Values

ATTRIBUTE_USERADDINFO_VALUE_UPDATE

public static final java.lang.String ATTRIBUTE_USERADDINFO_VALUE_UPDATE
Attribute WRITE USER_ADDINFO value insert.

See Also:
Constant Field Values

CACHE_ALL_PROPERTIES

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

See Also:
Constant Field Values

CHANGED_ACCESSCONTROL

public static final int CHANGED_ACCESSCONTROL
Value to indicate a change in access control entries of a resource.

See Also:
Constant Field Values

CHANGED_CONTENT

public static final int CHANGED_CONTENT
Value to indicate a content change.

See Also:
Constant Field Values

CHANGED_LASTMODIFIED

public static final int CHANGED_LASTMODIFIED
Value to indicate a change in the lastmodified settings of a resource.

See Also:
Constant Field Values

CHANGED_RESOURCE

public static final int CHANGED_RESOURCE
Value to indicate a change in the resource data.

See Also:
Constant Field Values

CHANGED_TIMEFRAME

public static final int CHANGED_TIMEFRAME
Value to indicate a change in the availability timeframe.

See Also:
Constant Field Values

CONFIGURATION_BACKUP

public static final java.lang.String CONFIGURATION_BACKUP
Deprecated. use CONFIGURATION_HISTORY instead
"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_HISTORY

public static final java.lang.String CONFIGURATION_HISTORY
"driver.history" 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

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_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

TEMP_FILE_PREFIX

public static final java.lang.String TEMP_FILE_PREFIX
Prefix char for temporary files in the VFS.

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_PROJECT

public static final int UPDATE_RESOURCE_PROJECT
Key to indicate update of last modified project reference.

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_RESOURCE_STATE_CONTENT

public static final int UPDATE_RESOURCE_STATE_CONTENT
Key to indicate update of resource state including the content date.

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,
                                           CmsPublishEngine publishEngine)
                                    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
publishEngine - the publish engine
Returns:
CmsDriverManager the instantiated driver manager
Throws:
CmsInitException - if the driver manager couldn't be instantiated

addRelationToResource

public void addRelationToResource(CmsDbContext dbc,
                                  CmsResource resource,
                                  CmsResource target,
                                  CmsRelationType type,
                                  boolean importCase)
                           throws CmsException
Adds a new relation to the given resource.

Parameters:
dbc - the database context
resource - the resource to add the relation to
target - the target of the relation
type - the type of the relation
importCase - if importing relations
Throws:
CmsException - if something goes wrong

addResourceToOrgUnit

public void addResourceToOrgUnit(CmsDbContext dbc,
                                 CmsOrganizationalUnit orgUnit,
                                 CmsResource resource)
                          throws CmsException
Adds a resource to the given organizational unit.

Parameters:
dbc - the current db context
orgUnit - the organizational unit to add the resource to
resource - the resource that is to be added to the organizational unit
Throws:
CmsException - if something goes wrong
See Also:
CmsOrgUnitManager.addResourceToOrgUnit(CmsObject, String, String), CmsOrgUnitManager.addResourceToOrgUnit(CmsObject, String, String)

addUserToGroup

public void addUserToGroup(CmsDbContext dbc,
                           java.lang.String username,
                           java.lang.String groupname,
                           boolean readRoles)
                    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
readRoles - if reading roles or groups
Throws:
CmsException - if operation was not successful
CmsDbEntryNotFoundException - if the given user or the given group was not found
See Also:
removeUserFromGroup(CmsDbContext, String, String, boolean)

changeLock

public void changeLock(CmsDbContext dbc,
                       CmsResource resource,
                       CmsLockType lockType)
                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
lockType - the new lock type to set
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)

changeResourcesInFolderWithProperty

public java.util.List changeResourcesInFolderWithProperty(CmsDbContext dbc,
                                                          CmsResource resource,
                                                          java.lang.String propertyDefinition,
                                                          java.lang.String oldValue,
                                                          java.lang.String newValue,
                                                          boolean recursive)
                                                   throws CmsVfsException,
                                                          CmsException
Returns a list with all sub resources of a given folder that have set the given property, matching the current property's value with the given old value and replacing it by a given new value.

Parameters:
dbc - the current database context
resource - the resource on which property definition values are changed
propertyDefinition - the name of the propertydefinition to change the value
oldValue - the old value of the propertydefinition
newValue - the new value of the propertydefinition
recursive - if true, change the property value on the resource and recursively all property values on sub-resources (only for folders)
Returns:
a list with the CmsResource's where the property value has been changed
Throws:
CmsVfsException - for now only when the search for the oldvalue failed.
CmsException - if operation was not successful

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

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,
                         CmsResource.CmsResourceCopyMode siblingMode)
                  throws CmsException,
                         CmsIllegalArgumentException
Copies a resource.

You must ensure that the destination path is an absolute, valid 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
See Also:
CmsObject.copyResource(String, String, CmsResource.CmsResourceCopyMode), I_CmsResourceType.copyResource(CmsObject, CmsSecurityManager, CmsResource, String, CmsResource.CmsResourceCopyMode)

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(CmsProject project)
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

createGroup

public CmsGroup createGroup(CmsDbContext dbc,
                            CmsUUID id,
                            java.lang.String name,
                            java.lang.String description,
                            int flags,
                            java.lang.String parent)
                     throws CmsIllegalArgumentException,
                            CmsException
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:
CmsException - if the creation of the group failed
CmsIllegalArgumentException - if the length of the given name was below 1

createOrganizationalUnit

public CmsOrganizationalUnit createOrganizationalUnit(CmsDbContext dbc,
                                                      java.lang.String ouFqn,
                                                      java.lang.String description,
                                                      int flags,
                                                      CmsResource resource)
                                               throws CmsException
Creates a new organizational unit.

Parameters:
dbc - the current db context
ouFqn - the fully qualified name of the new organizational unit
description - the description of the new organizational unit
flags - the flags for the new organizational unit
resource - the first associated resource
Returns:
a CmsOrganizationalUnit object representing the newly created organizational unit
Throws:
CmsException - if operation was not successful
See Also:
CmsOrgUnitManager.createOrganizationalUnit(CmsObject, String, String, int, String)

createProject

public CmsProject createProject(CmsDbContext dbc,
                                java.lang.String name,
                                java.lang.String description,
                                java.lang.String groupname,
                                java.lang.String managergroupname,
                                CmsProject.CmsProjectType projecttype)
                         throws CmsIllegalArgumentException,
                                CmsException
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, or if the name is not valid
CmsException - 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

createPublishJob

public void createPublishJob(CmsDbContext dbc,
                             CmsPublishJobInfoBean publishJob)
                      throws CmsException
Creates a new publish job.

Parameters:
dbc - the current database context
publishJob - the publish job to create
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 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.

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 behavior 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 CmsResource 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
Returns:
the new created sibling
Throws:
CmsException - if something goes wrong
See Also:
CmsObject.createSibling(String, String, List), I_CmsResourceType.createSibling(CmsObject, CmsSecurityManager, CmsResource, String, List)

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

deleteGroup

public void deleteGroup(CmsDbContext dbc,
                        CmsGroup group,
                        CmsUUID replacementId)
                 throws CmsDataAccessException,
                        CmsException
Deletes a group, where all permissions, users and children 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 successful
CmsDataAccessException - if group to be deleted contains user

deleteHistoricalVersions

public void deleteHistoricalVersions(CmsDbContext dbc,
                                     int versionsToKeep,
                                     int versionsDeleted,
                                     long timeDeleted,
                                     I_CmsReport report)
                              throws CmsException
Deletes the versions from the history tables, keeping the given number of versions per resource.

if the cleanUp option is set, additionally versions of deleted resources will be removed.

Parameters:
dbc - the current database context
versionsToKeep - number of versions to keep, is ignored if negative
versionsDeleted - number of versions to keep for deleted resources, is ignored if negative
timeDeleted - deleted resources older than this will also be deleted, is ignored if negative
report - the report for output logging
Throws:
CmsException - if operation was not successful

deleteOrganizationalUnit

public void deleteOrganizationalUnit(CmsDbContext dbc,
                                     CmsOrganizationalUnit organizationalUnit)
                              throws CmsException
Deletes an organizational unit.

Only organizational units that contain no suborganizational unit can be deleted.

The organizational unit can not be delete if it is used in the request context, or if the current user belongs to it.

All users and groups in the given organizational unit will be deleted.

Parameters:
dbc - the current db context
organizationalUnit - the organizational unit to delete
Throws:
CmsException - if operation was not successful
See Also:
CmsOrgUnitManager.deleteOrganizationalUnit(CmsObject, String)

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

deletePublishJob

public void deletePublishJob(CmsDbContext dbc,
                             CmsUUID publishHistoryId)
                      throws CmsException
Deletes a publish job identified by its history id.

Parameters:
dbc - the current database context
publishHistoryId - the history id identifying the publish job
Throws:
CmsException - if something goes wrong

deletePublishList

public void deletePublishList(CmsDbContext dbc,
                              CmsUUID publishHistoryId)
                       throws CmsException
Deletes the publish list assigned to a publish job.

Parameters:
dbc - the current database context
publishHistoryId - the history id identifying the publish job
Throws:
CmsException - if something goes wrong

deleteRelationsForResource

public void deleteRelationsForResource(CmsDbContext dbc,
                                       CmsResource resource,
                                       CmsRelationFilter filter)
                                throws CmsException
Deletes all relations for the given resource matching the given filter.

Parameters:
dbc - the current db context
resource - the resource to delete the relations for
filter - the filter to use for deletion
Throws:
CmsException - if something goes wrong
See Also:
CmsSecurityManager.deleteRelationsForResource(CmsRequestContext, CmsResource, CmsRelationFilter)

deleteResource

public void deleteResource(CmsDbContext dbc,
                           CmsResource resource,
                           CmsResource.CmsResourceDeleteMode 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, CmsResource.CmsResourceDeleteMode), I_CmsResourceType.deleteResource(CmsObject, CmsSecurityManager, CmsResource, CmsResource.CmsResourceDeleteMode)

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-parameter, 1=parameter)
linkParameter - the parameters of the 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 successful

destroy

public void destroy()
Destroys this driver manager and releases all allocated resources.


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 void 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), the given publish list will be filled with all new/changed/deleted files from the current (offline) project that will be actually published
Throws:
CmsException - if something goes wrong
See Also:
CmsPublishList

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,
                                               CmsOrganizationalUnit orgUnit,
                                               boolean includeSubOus)
                                        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
orgUnit - the organizational unit to search project in
includeSubOus - if to include sub organizational units
Returns:
a list of objects of type CmsProject
Throws:
CmsException - if something goes wrong

getAllHistoricalProjects

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

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

getAllManageableProjects

public java.util.List getAllManageableProjects(CmsDbContext dbc,
                                               CmsOrganizationalUnit orgUnit,
                                               boolean includeSubOus)
                                        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
orgUnit - the organizational unit to search project in
includeSubOus - if to include sub organizational units
Returns:
a list of objects of type CmsProject
Throws:
CmsException - if operation was not successful

getChildren

public java.util.List getChildren(CmsDbContext dbc,
                                  CmsGroup group,
                                  boolean includeSubChildren)
                           throws CmsException
Returns all child groups of a group.

Parameters:
dbc - the current database context
group - the group to get the child for
includeSubChildren - if set also returns all sub-child groups of the given group
Returns:
a list of all child CmsGroup objects
Throws:
CmsException - if operation was not successful

getGroups

public java.util.List getGroups(CmsDbContext dbc,
                                CmsOrganizationalUnit orgUnit,
                                boolean includeSubOus,
                                boolean readRoles)
                         throws CmsException
Returns all groups of the given organizational unit.

Parameters:
dbc - the current db context
orgUnit - the organizational unit to get the groups for
includeSubOus - if all groups of sub-organizational units should be retrieved too
readRoles - if to read roles or groups
Returns:
all CmsGroup objects in the organizational unit
Throws:
CmsException - if operation was not successful
See Also:
CmsOrgUnitManager.getResourcesForOrganizationalUnit(CmsObject, String), CmsOrgUnitManager.getGroups(CmsObject, String, boolean)

getGroupsOfUser

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

Parameters:
dbc - the current database context
username - the name of the user
readRoles - if to read roles or groups
Returns:
the groups of the given user, as a list of CmsGroup objects
Throws:
CmsException - if something goes wrong

getGroupsOfUser

public java.util.List getGroupsOfUser(CmsDbContext dbc,
                                      java.lang.String username,
                                      java.lang.String ouFqn,
                                      boolean includeChildOus,
                                      boolean readRoles,
                                      boolean directGroupsOnly,
                                      java.lang.String remoteAddress)
                               throws CmsException
Returns the groups of an user filtered by the specified IP address.

Parameters:
dbc - the current database context
username - the name of the user
ouFqn - the fully qualified name of the organizational unit to restrict the result set for
includeChildOus - include groups of child organizational units
readRoles - if to read roles or groups
directGroupsOnly - if set only the direct assigned groups will be returned, if not also indirect groups
remoteAddress - the IP address to filter the groups in the result list
Returns:
a list of CmsGroup objects
Throws:
CmsException - if operation was not successful

getHistoryDriver

public I_CmsHistoryDriver getHistoryDriver()
Returns the history driver.

Returns:
the history driver

getHistoryDriver

public I_CmsHistoryDriver getHistoryDriver(CmsDbContext dbc)
Returns the history driver for a given database context.

Parameters:
dbc - the database context
Returns:
the history driver for the database context

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

getLockedResources

public java.util.List getLockedResources(CmsDbContext dbc,
                                         CmsResource resource,
                                         CmsLockFilter filter)
                                  throws CmsException
Returns all locked resources in a given folder.

Parameters:
dbc - the current database context
resource - the folder to search in
filter - the lock filter
Returns:
a list of locked resource paths (relative to current site)
Throws:
CmsException - if the current project is locked

getNextPublishTag

public int getNextPublishTag(CmsDbContext dbc)
Returns the next publish tag for the published historical resources.

Parameters:
dbc - the current database context
Returns:
the next available publish tag

getOrganizationalUnits

public java.util.List getOrganizationalUnits(CmsDbContext dbc,
                                             CmsOrganizationalUnit parent,
                                             boolean includeChildren)
                                      throws CmsException
Returns all child organizational units of the given parent organizational unit including hierarchical deeper organization units if needed.

Parameters:
dbc - the current db context
parent - the parent organizational unit, or null for the root
includeChildren - if hierarchical deeper organization units should also be returned
Returns:
a list of CmsOrganizationalUnit objects
Throws:
CmsException - if operation was not successful
See Also:
CmsOrgUnitManager.getOrganizationalUnits(CmsObject, String, boolean)

getOrgUnitsForRole

public java.util.List getOrgUnitsForRole(CmsDbContext dbc,
                                         CmsRole role,
                                         boolean includeSubOus)
                                  throws CmsException
Returns all the organizational units for which the current user has the given role.

Parameters:
dbc - the current database context
role - the role to check
includeSubOus - if sub organizational units should be included in the search
Returns:
a list of CmsOrganizationalUnit objects
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 successful

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:
bit set with allowed permissions
Throws:
CmsException - if something goes wrong

getProjectDriver

public I_CmsProjectDriver getProjectDriver()
Returns the project driver.

Returns:
the project driver

getProjectDriver

public I_CmsProjectDriver getProjectDriver(CmsDbContext dbc)
Returns the project driver for a given DB context.

Parameters:
dbc - the database context
Returns:
the project driver for the database context

getProjectDriver

public I_CmsProjectDriver getProjectDriver(CmsDbContext dbc,
                                           I_CmsProjectDriver defaultDriver)
Returns either the project driver for the DB context (if it has one) or a default project driver.

Parameters:
dbc - the DB context
defaultDriver - the driver which should be returned if there is no project driver for the DB context
Returns:
either the project driver for the DB context, or the default driver

getProjectId

public CmsUUID getProjectId(CmsDbContext dbc,
                            int id)
                     throws CmsException
Returns the uuid id for the given id.

TODO: remove this method as soon as possible

Parameters:
dbc - the current database context
id - the old project id
Returns:
the new uuid for the given id
Throws:
CmsException - if something goes wrong

getPropertyConfiguration

public org.apache.commons.collections.ExtendedProperties getPropertyConfiguration()
Returns the configuration read from the opencms.properties file.

Returns:
the configuration read from the opencms.properties file

getRelatedResourcesToPublish

public CmsPublishList getRelatedResourcesToPublish(CmsDbContext dbc,
                                                   CmsPublishList publishList,
                                                   CmsRelationFilter filter)
                                            throws CmsException
Returns a new publish list that contains the unpublished resources related to all resources in the given publish list, the related resources exclude all resources in the given publish list and also locked (by other users) resources.

Parameters:
dbc - the current database context
publishList - the publish list to exclude from result
filter - the relation filter to use to get the related resources
Returns:
a new publish list that contains the related resources
Throws:
CmsException - if something goes wrong
See Also:
CmsPublishManager.getRelatedResourcesToPublish(CmsObject, CmsPublishList)

getRelationsForResource

public java.util.List getRelationsForResource(CmsDbContext dbc,
                                              CmsResource resource,
                                              CmsRelationFilter filter)
                                       throws CmsException
Returns all relations for the given resource matching the given filter.

Parameters:
dbc - the current db context
resource - the resource to retrieve the relations for
filter - the filter to match the relation
Returns:
all CmsRelation objects for the given resource matching the given filter
Throws:
CmsException - if something goes wrong
See Also:
CmsSecurityManager.getRelationsForResource(CmsRequestContext, CmsResource, CmsRelationFilter)

getResourceOrgUnits

public java.util.List getResourceOrgUnits(CmsDbContext dbc,
                                          CmsResource resource)
                                   throws CmsException
Returns the list of organizational units the given resource belongs to.

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

getResourcesForOrganizationalUnit

public java.util.List getResourcesForOrganizationalUnit(CmsDbContext dbc,
                                                        CmsOrganizationalUnit orgUnit)
                                                 throws CmsException
Returns all resources of the given organizational unit.

Parameters:
dbc - the current db context
orgUnit - the organizational unit to get all resources for
Returns:
all CmsResource objects in the organizational unit
Throws:
CmsException - if operation was not successful
See Also:
CmsOrgUnitManager.getResourcesForOrganizationalUnit(CmsObject, String), CmsOrgUnitManager.getUsers(CmsObject, String, boolean), CmsOrgUnitManager.getGroups(CmsObject, String, boolean)

getResourcesForPrincipal

public java.util.Set 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 set of CmsResource objects
Throws:
CmsException - if something goes wrong

getRolesForResource

public java.util.List getRolesForResource(CmsDbContext dbc,
                                          CmsUser user,
                                          CmsResource resource)
                                   throws CmsException
Returns all roles the given user has for the given resource.

Parameters:
dbc - the current database context
user - the user to check
resource - the resource to check the roles for
Returns:
a list of CmsRole objects
Throws:
CmsException - if something goes wrong

getRolesForUser

public java.util.List getRolesForUser(CmsDbContext dbc,
                                      CmsUser user)
                               throws CmsException
Returns all roles the given user has independent of the resource.

Parameters:
dbc - the current database context
user - the user to check
Returns:
a list of CmsRole objects
Throws:
CmsException - if something goes wrong

getSecurityManager

public CmsSecurityManager getSecurityManager()
Returns the security manager this driver manager belongs to.

Returns:
the security manager this driver manager belongs to

getSqlManager

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

Returns:
an instance of the common sql manager

getUserDriver

public I_CmsUserDriver getUserDriver()
Returns the user driver.

Returns:
the user driver

getUserDriver

public I_CmsUserDriver getUserDriver(CmsDbContext dbc)
Returns the user driver for a given database context.

Parameters:
dbc - the database context
Returns:
the user driver for the database context

getUserDriver

public I_CmsUserDriver getUserDriver(CmsDbContext dbc,
                                     I_CmsUserDriver defaultDriver)
Returns either the user driver for the given DB context (if it has one) or a default value instead.

Parameters:
dbc - the DB context
defaultDriver - the driver that should be returned if no driver for the DB context was found
Returns:
either the user driver for the DB context, or defaultDriver if none were found

getUsers

public java.util.List getUsers(CmsDbContext dbc,
                               CmsOrganizationalUnit orgUnit,
                               boolean recursive)
                        throws CmsException
Returns all direct users of the given organizational unit.

Parameters:
dbc - the current db context
orgUnit - the organizational unit to get all users for
recursive - if all groups of sub-organizational units should be retrieved too
Returns:
all CmsUser objects in the organizational unit
Throws:
CmsException - if operation was not successful
See Also:
CmsOrgUnitManager.getResourcesForOrganizationalUnit(CmsObject, String), CmsOrgUnitManager.getUsers(CmsObject, String, boolean)

getUsersOfGroup

public java.util.List getUsersOfGroup(CmsDbContext dbc,
                                      java.lang.String groupname,
                                      boolean includeOtherOuUsers,
                                      boolean directUsersOnly,
                                      boolean readRoles)
                               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
includeOtherOuUsers - include users of other organizational units
directUsersOnly - if set only the direct assigned users will be returned, if not also indirect users, ie. members of parent roles, this parameter only works with roles
readRoles - if to read roles or groups
Returns:
all CmsUser objects in the group
Throws:
CmsException - if operation was not successful

getVfsDriver

public I_CmsVfsDriver getVfsDriver()
Returns the VFS driver.

Returns:
the VFS driver

getVfsDriver

public I_CmsVfsDriver getVfsDriver(CmsDbContext dbc)
Returns the VFS driver for the given database context.

Parameters:
dbc - the database context
Returns:
a VFS 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 firstname,
                          java.lang.String lastname,
                          java.lang.String email,
                          int flags,
                          long dateCreated,
                          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
firstname - the firstname of the user
lastname - the lastname of the user
email - the email of the user
flags - the flags for a user (for example I_CmsPrincipal.FLAG_ENABLED)
dateCreated - the creation date
additionalInfos - the additional user infos
Returns:
the imported user
Throws:
CmsException - if something goes wrong

init

public void init(CmsConfigurationManager configurationManager)
          throws CmsException,
                 java.lang.Exception
Initializes the driver and sets up all required modules and connections.

Parameters:
configurationManager - the configuration manager
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

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

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,
                         CmsLockType type)
                  throws CmsException
Locks a resource.

The type 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
type - type of the lock
Throws:
CmsException - if something goes wrong
See Also:
CmsObject.lockResource(String), CmsObject.lockResourceTemporary(String), I_CmsResourceType.lockResource(CmsObject, CmsSecurityManager, CmsResource, CmsLockType)

loginUser

public CmsUser loginUser(CmsDbContext dbc,
                         java.lang.String userName,
                         java.lang.String password,
                         java.lang.String remoteAddress)
                  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
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

moveResource

public void moveResource(CmsDbContext dbc,
                         CmsResource source,
                         java.lang.String destination,
                         boolean internal)
                  throws CmsException
Moves a resource.

You must ensure that the parent of the destination path is an absolute, valid and existing VFS path. Relative paths from the source are not supported.

The moved resource will always be locked to the current user after the move operation.

In case the target resource already exists, it will be overwritten with the source resource if possible.

Parameters:
dbc - the current database context
source - the resource to move
destination - the name of the move destination with complete path
internal - if set nothing more than the path is modified
Throws:
CmsException - if something goes wrong
See Also:
CmsSecurityManager.moveResource(CmsRequestContext, CmsResource, String)

moveToLostAndFound

public java.lang.String moveToLostAndFound(CmsDbContext dbc,
                                           CmsResource resource,
                                           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
resource - 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

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

publishJob

public void publishJob(CmsObject cms,
                       CmsDbContext dbc,
                       CmsPublishList publishList,
                       I_CmsReport report)
                throws CmsException
Publishes the given publish job.

Parameters:
cms - the cms context
dbc - the db context
publishList - the list of resources to publish
report - the report to write to
Throws:
CmsException - if something goes wrong

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)

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

readAllAvailableVersions

public java.util.List readAllAvailableVersions(CmsDbContext dbc,
                                               CmsResource resource)
                                        throws CmsException
Reads all versions of the given resource.
This method returns a list with the history of the given resource, i.e. the historical resource entries, 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 history for
Returns:
a list of file headers, as I_CmsHistoryResource objects
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

readChildResources

public java.util.List readChildResources(CmsDbContext dbc,
                                         CmsResource resource,
                                         CmsResourceFilter filter,
                                         boolean getFolders,
                                         boolean getFiles,
                                         boolean checkPermissions)
                                  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
checkPermissions - if the resources should be filtered with the current user permissions
Returns:
a list of all child resources
Throws:
CmsException - if something goes wrong

readDefaultFile

public CmsResource readDefaultFile(CmsDbContext dbc,
                                   CmsResource resource)
Returns the default file for the given folder.

If the given resource is a file, then this file is returned.

Otherwise, in case of a folder:

  1. the CmsPropertyDefinition.PROPERTY_DEFAULT_FILE is checked, and
  2. if still no file could be found, the configured default files in the opencms-vfs.xml configuration are iterated until a match is found, and
  3. if still no file could be found, null is retuned

Parameters:
dbc - the database context
resource - the folder to get the default file for
Returns:
the default file for the given folder
See Also:
CmsObject.readDefaultFile(String), readDefaultFile(CmsDbContext, CmsResource)

readDeletedResources

public java.util.List readDeletedResources(CmsDbContext dbc,
                                           CmsResource resource,
                                           boolean readTree,
                                           boolean isVfsManager)
                                    throws CmsException
Reads all deleted (historical) resources below the given path, including the full tree below the path, if required.

Parameters:
dbc - the current db context
resource - the parent resource to read the resources from
readTree - true to read all subresources
isVfsManager - true if the current user has the vfs manager role
Returns:
a list of I_CmsHistoryResource objects
Throws:
CmsException - if something goes wrong
See Also:
CmsObject.readResource(CmsUUID, int), CmsObject.readResources(String, CmsResourceFilter, boolean), CmsObject.readDeletedResources(String, boolean)

readFile

public CmsFile readFile(CmsDbContext dbc,
                        CmsResource resource)
                 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)
Returns:
the file read from the VFS
Throws:
CmsException - if operation was not successful

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)

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,
                          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 successful

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 successful

readHistoricalPrincipal

public CmsHistoryPrincipal readHistoricalPrincipal(CmsDbContext dbc,
                                                   CmsUUID principalId)
                                            throws CmsException
Reads a principal (an user or group) from the historical archive based on its ID.

Parameters:
dbc - the current database context
principalId - the id of the principal to read
Returns:
the historical principal entry with the given id
Throws:
CmsException - if something goes wrong, ie. CmsDbEntryNotFoundException
See Also:
CmsObject.readUser(CmsUUID), CmsObject.readGroup(CmsUUID), CmsObject.readHistoryPrincipal(CmsUUID)

readHistoryProject

public CmsHistoryProject readHistoryProject(CmsDbContext dbc,
                                            CmsUUID projectId)
                                     throws CmsException
Returns the latest historical project entry with the given id.

Parameters:
dbc - the current database context
projectId - the project id
Returns:
the requested historical project entry
Throws:
CmsException - if something goes wrong

readHistoryProject

public CmsHistoryProject readHistoryProject(CmsDbContext dbc,
                                            int publishTag)
                                     throws CmsException
Returns a historical project entry.

Parameters:
dbc - the current database context
publishTag - the publish tag of the project
Returns:
the requested historical project entry
Throws:
CmsException - if something goes wrong

readHistoryPropertyObjects

public java.util.List readHistoryPropertyObjects(CmsDbContext dbc,
                                                 I_CmsHistoryResource historyResource)
                                          throws CmsException
Reads the list of all CmsProperty objects that belongs to the given historical resource.

Parameters:
dbc - the current database context
historyResource - the historical resource to read the properties for
Returns:
the list of CmsProperty objects
Throws:
CmsException - if something goes wrong

readLocks

public void readLocks(CmsDbContext dbc)
               throws CmsException
Reads the locks that were saved to the database in the previous run of OpenCms.

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

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

readOrganizationalUnit

public CmsOrganizationalUnit readOrganizationalUnit(CmsDbContext dbc,
                                                    java.lang.String ouFqn)
                                             throws CmsException
Reads an organizational Unit based on its fully qualified name.

Parameters:
dbc - the current db context
ouFqn - the fully qualified name of the organizational Unit to be read
Returns:
the organizational Unit that with the provided fully qualified name
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

readPath

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

Parameters:
dbc - the current database context
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,
                              CmsUUID 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, CmsUUID) 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

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,
                                      CmsUUID projectId,
                                      CmsResourceState 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(CmsUUID, CmsResourceState)

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
Throws:
CmsException - a CmsDbEntryNotFoundException is thrown if the property definition does not exist

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

readPublishJob

public CmsPublishJobInfoBean readPublishJob(CmsDbContext dbc,
                                            CmsUUID publishHistoryId)
                                     throws CmsException
Reads a single publish job identified by its publish history id.

Parameters:
dbc - the current database context
publishHistoryId - unique id to identify the publish job in the publish history
Returns:
an object of type CmsPublishJobInfoBean
Throws:
CmsException - if something goes wrong

readPublishJobs

public java.util.List readPublishJobs(CmsDbContext dbc,
                                      long startTime,
                                      long endTime)
                               throws CmsException
Reads all available publish jobs.

Parameters:
dbc - the current database context
startTime - the start of the time range for finish time
endTime - the end of the time range for finish time
Returns:
a list of objects of type CmsPublishJobInfoBean
Throws:
CmsException - if something goes wrong

readPublishList

public CmsPublishList readPublishList(CmsDbContext dbc,
                                      CmsUUID publishHistoryId)
                               throws CmsException
Reads the publish list assigned to a publish job.

Parameters:
dbc - the current database context
publishHistoryId - the history id identifying the publish job
Returns:
the assigned publish list
Throws:
CmsException - if something goes wrong

readPublishReportContents

public byte[] readPublishReportContents(CmsDbContext dbc,
                                        CmsUUID publishHistoryId)
                                 throws CmsException
Reads the publish report assigned to a publish job.

Parameters:
dbc - the current database context
publishHistoryId - the history id identifying the publish job
Returns:
the content of the assigned publish report
Throws:
CmsException - if something goes wrong

readResource

public I_CmsHistoryResource readResource(CmsDbContext dbc,
                                         CmsResource resource,
                                         int version)
                                  throws CmsException
Reads an historical resource entry for the given resource and with the given version number.

Parameters:
dbc - the current db context
resource - the resource to be read
version - the version number to retrieve
Returns:
the resource that was read
Throws:
CmsException - if the resource could not be read for any reason
See Also:
CmsObject.restoreResourceVersion(CmsUUID, int), CmsObject.readResource(CmsUUID, int)

readResource

public CmsResource readResource(CmsDbContext dbc,
                                CmsUUID structureID,
                                CmsResourceFilter filter)
                         throws CmsDataAccessException
Reads a resource from the VFS, using the specified resource filter.

Parameters:
dbc - the current database context
structureID - the structure id of the resource to read
filter - the resource filter to use while reading
Returns:
the resource that was read
Throws:
CmsDataAccessException - if something goes wrong
See Also:
CmsObject.readResource(CmsUUID, CmsResourceFilter), CmsObject.readResource(CmsUUID)

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), CmsObject.readFile(CmsResource)

readResourceForPublishTag

public I_CmsHistoryResource readResourceForPublishTag(CmsDbContext dbc,
                                                      CmsResource resource,
                                                      int publishTag)
                                               throws CmsException
Deprecated. use readResource(CmsDbContext, CmsResource, int) instead but notice that the publishTag != version

Reads a resource in the current project with the given publish tag from the historical archive.

Parameters:
dbc - the current db context
resource - the resource to restore from the archive
publishTag - the publish tag of the resource
Returns:
the file in the current project with the given publish tag from the historical archive, or CmsVfsResourceNotFoundException if not found
Throws:
CmsException - if something goes wrong
See Also:
CmsObject.readResource(CmsUUID, int), CmsObject.readResourceByPublishTag(CmsUUID, int)

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,
                                                CmsResource folder,
                                                java.lang.String propertyDefinition,
                                                java.lang.String value,
                                                CmsResourceFilter filter)
                                         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.

If the value parameter is null, all resources having the given property set are returned.

Parameters:
dbc - the current database context
folder - 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
filter - the resource filter to apply to the result set
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 parameter 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

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 successful

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 successful

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

removeResourceFromOrgUnit

public void removeResourceFromOrgUnit(CmsDbContext dbc,
                                      CmsOrganizationalUnit orgUnit,
                                      CmsResource resource)
                               throws CmsException
Removes a resource from the given organizational unit.

Parameters:
dbc - the current db context
orgUnit - the organizational unit to remove the resource from
resource - the resource that is to be removed from the organizational unit
Throws:
CmsException - if something goes wrong
See Also:
CmsOrgUnitManager.addResourceToOrgUnit(CmsObject, String, String), CmsOrgUnitManager.addResourceToOrgUnit(CmsObject, String, String)

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,
                                boolean readRoles)
                         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
readRoles - if to read roles or groups
Throws:
CmsException - if operation was not successful
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
See Also:
addUserToGroup(CmsDbContext, String, String, boolean)

repairCategories

public void repairCategories(CmsDbContext dbc,
                             CmsUUID projectId,
                             CmsResource resource)
                      throws CmsException
Repairs broken categories.

Parameters:
dbc - the database context
projectId - the project id
resource - the resource to repair the categories for
Throws:
CmsException - if something goes wrong

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

restoreDeletedResource

public void restoreDeletedResource(CmsDbContext dbc,
                                   CmsUUID structureId)
                            throws CmsException
Restores a deleted resource identified by its structure id from the historical archive.

Parameters:
dbc - the current database context
structureId - the structure id of the resource to restore
Throws:
CmsException - if something goes wrong
See Also:
CmsObject.restoreDeletedResource(CmsUUID)

restoreResource

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

Parameters:
dbc - the current database context
resource - the resource to restore from the archive
version - the version number to restore from the archive
Throws:
CmsException - if something goes wrong
See Also:
CmsObject.restoreResourceVersion(CmsUUID, int), I_CmsResourceType.restoreResource(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)

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 successful
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 successful
CmsIllegalArgumentException - if the user with the username was not found

setUsersOrganizationalUnit

public void setUsersOrganizationalUnit(CmsDbContext dbc,
                                       CmsOrganizationalUnit orgUnit,
                                       CmsUser user)
                                throws CmsException
Moves an user to the given organizational unit.

Parameters:
dbc - the current db context
orgUnit - the organizational unit to move the user to
user - the user that is to be moved to the organizational unit
Throws:
CmsException - if something goes wrong
See Also:
CmsOrgUnitManager.setUsersOrganizationalUnit(CmsObject, String, String)

undelete

public void undelete(CmsDbContext dbc,
                     CmsResource resource)
              throws CmsException
Undelete the resource.

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.undeleteResource(String, boolean), I_CmsResourceType.undelete(CmsObject, CmsSecurityManager, CmsResource, boolean)

undoChanges

public void undoChanges(CmsDbContext dbc,
                        CmsResource resource,
                        CmsResource.CmsResourceUndoMode mode)
                 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
mode - the undo mode, one of the CmsResource.CmsResourceUndoMode#UNDO_XXX constants please note that the recursive flag is ignored at this level
Throws:
CmsException - if something goes wrong
See Also:
CmsObject.undoChanges(String, CmsResource.CmsResourceUndoMode), I_CmsResourceType.undoChanges(CmsObject, CmsSecurityManager, CmsResource, CmsResource.CmsResourceUndoMode)

unlockProject

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

Parameters:
project - the project to unlock the resources in

unlockResource

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

Parameters:
dbc - the current database context
resource - the resource to unlock
force - true, if a resource is forced to get unlocked, no matter by which user and in which project the resource is currently locked
removeSystemLock - true, if you also want to remove system locks
Throws:
CmsException - if something goes wrong
See Also:
CmsObject.unlockResource(String), I_CmsResourceType.unlockResource(CmsObject, CmsSecurityManager, CmsResource)

updateExportPoints

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

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

Parameters:
dbc - the current database context

updateRelationsForResource

public void updateRelationsForResource(CmsDbContext dbc,
                                       CmsResource resource,
                                       java.util.List links)
                                throws CmsException
Updates/Creates the given relations for the given resource.

Parameters:
dbc - the db context
resource - the resource to update the relations for
links - the links to consider for updating
Throws:
CmsException - if something goes wrong
See Also:
CmsSecurityManager.updateRelationsForResource(CmsRequestContext, CmsResource, List)

userInGroup

public boolean userInGroup(CmsDbContext dbc,
                           java.lang.String username,
                           java.lang.String groupname,
                           boolean readRoles)
                    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
readRoles - if to read roles or groups
Returns:
true, if the user is in the group, false otherwise
Throws:
CmsException - if something goes wrong

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

validateRelations

public java.util.Map validateRelations(CmsDbContext dbc,
                                       CmsPublishList publishList,
                                       I_CmsReport report)
                                throws java.lang.Exception
Validates the relations for the given resources.

Parameters:
dbc - the database context
publishList - the resources to validate during publishing
report - a report to write the messages to
Returns:
a map with lists of invalid links (CmsRelation} objects) keyed by root paths
Throws:
java.lang.Exception - if something goes wrong

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,
                              I_CmsReport report,
                              CmsUUID publishHistoryId)
Writes all export points into the file system for the publish task specified by trhe given publish history ID.

Parameters:
dbc - the current database context
report - an I_CmsReport instance to print output message, or null to write messages to the log file
publishHistoryId - ID to identify the 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 overridden by the given data.

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

writeHistoryProject

public void writeHistoryProject(CmsDbContext dbc,
                                int publishTag,
                                long publishDate)
                         throws CmsDataAccessException
Creates an historical entry of the current project.

Parameters:
dbc - the current database context
publishTag - the version
publishDate - the date of publishing
Throws:
CmsDataAccessException - if operation was not successful

writeLocks

public void writeLocks(CmsDbContext dbc)
                throws CmsException
Writes the locks that are currently stored in-memory to the database to allow restoring them in future server startups.

This overwrites the locks previously stored in the underlying database table.

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

writeOrganizationalUnit

public void writeOrganizationalUnit(CmsDbContext dbc,
                                    CmsOrganizationalUnit organizationalUnit)
                             throws CmsException
Writes an already existing organizational unit.

The organizational unit id has to be a valid OpenCms organizational unit id.
The organizational unit with the given id will be completely overridden by the given data.

Parameters:
dbc - the current db context
organizationalUnit - the organizational unit that should be written
Throws:
CmsException - if operation was not successful
See Also:
CmsOrgUnitManager.writeOrganizationalUnit(CmsObject, CmsOrganizationalUnit)

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 overridden 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,
                                 boolean updateState)
                          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
updateState - if true the state of the resource will be updated
Throws:
CmsException - if something goes wrong
See Also:
CmsObject.writePropertyObjects(String, List), I_CmsResourceType.writePropertyObjects(CmsObject, CmsSecurityManager, CmsResource, List)

writePublishJob

public void writePublishJob(CmsDbContext dbc,
                            CmsPublishJobInfoBean publishJob)
                     throws CmsException
Updates a publish job.

Parameters:
dbc - the current database context
publishJob - the publish job to update
Throws:
CmsException - if something goes wrong

writePublishReport

public void writePublishReport(CmsDbContext dbc,
                               CmsPublishJobInfoBean publishJob)
                        throws CmsException
Writes the publish report for a publish job.

Parameters:
dbc - the current database context
publishJob - the publish job
Throws:
CmsException - if something goes wrong

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-parameter, 1=parameter)
linkParameter - the parameters added to the resource
timestamp - a time stamp for writing the data into the db
Throws:
CmsException - if 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 overridden by the given data.

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

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

deleteRelationsWithSiblings

protected void deleteRelationsWithSiblings(CmsDbContext dbc,
                                           CmsResource resource)
                                    throws CmsException
Deletes all relations for the given resource and all its siblings.

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

getLockManager

protected CmsLockManager getLockManager()
Returns the lock manager instance.

Returns:
the lock manager instance