org.opencms.db
Interface I_CmsProjectDriver

All Known Implementing Classes:
CmsProjectDriver

public interface I_CmsProjectDriver

Definitions of all required project driver methods.

Since:
6.0.0
Version:
$Revision: 1.76 $
Author:
Thomas Weckert, Michael Emmerich

Field Summary
static int DRIVER_TYPE_ID
          The type ID to identify project driver implementations.
static java.lang.String TEMP_FILE_PROJECT_NAME
          The name of the temp file project.
 
Method Summary
 CmsProject createProject(CmsDbContext dbc, CmsUser owner, CmsGroup group, CmsGroup managergroup, CmsTask task, java.lang.String name, java.lang.String description, int flags, int type, java.lang.Object reservedParam)
          Creates a new project.
 void createProjectResource(CmsDbContext dbc, int projectId, java.lang.String resourceName, java.lang.Object reservedParam)
          Creates a new projectResource from a given CmsResource object.
 void deleteAllStaticExportPublishedResources(CmsDbContext dbc, CmsProject currentProject, int linkType)
          Deletes all entries in the published resource table.
 void deleteProject(CmsDbContext dbc, CmsProject project)
          Deletes a project from the cms.
 void deleteProjectResource(CmsDbContext dbc, int projectId, java.lang.String resourceName)
          Delete a projectResource from an given CmsResource object.
 void deleteProjectResources(CmsDbContext dbc, CmsProject project)
          Deletes a specified project.
 void deletePublishHistory(CmsDbContext dbc, int projectId, int maxBackupTagId)
          Deletes all publish history entries with backup tag IDs >=0 and < the specified max. backup tag ID.
 void deletePublishHistoryEntry(CmsDbContext dbc, int projectId, CmsUUID publishHistoryId, CmsPublishedResource publishResource)
          Deletes a publish history entry with backup tag IDs >=0 and < the specified max. backup tag ID.
 void deleteStaticExportPublishedResource(CmsDbContext dbc, CmsProject currentProject, java.lang.String resourceName, int linkType, java.lang.String linkParameter)
          Deletes an entry in the published resource table.
 void destroy()
          Destroys this driver.
 void fillDefaults(CmsDbContext dbc)
          Fills the OpenCms database tables with default values.
 CmsSqlManager getSqlManager()
          Returns the SqlManager of this driver.
 CmsSqlManager initSqlManager(java.lang.String classname)
          Initializes the SQL manager for this driver.
 void publishDeletedFolder(CmsDbContext dbc, I_CmsReport report, int m, int n, CmsProject onlineProject, CmsFolder offlineFolder, boolean backupEnabled, long publishDate, CmsUUID publishHistoryId, int backupTagId, int maxVersions)
          Publishes a deleted folder.
 void publishFile(CmsDbContext dbc, I_CmsReport report, int m, int n, CmsProject onlineProject, CmsResource offlineResource, java.util.Set publishedContentIds, boolean backupEnabled, long publishDate, CmsUUID publishHistoryId, int backupTagId, int maxVersions)
          Publishes a new, changed or deleted file.
 CmsFile publishFileContent(CmsDbContext dbc, CmsProject offlineProject, CmsProject onlineProject, CmsResource offlineFileHeader, java.util.Set publishedResourceIds)
          Publishes the content record of a file.
 void publishFolder(CmsDbContext dbc, I_CmsReport report, int m, int n, CmsProject onlineProject, CmsFolder currentFolder, boolean backupEnabled, long publishDate, CmsUUID publishHistoryId, int backupTagId, int maxVersions)
          Publishes a new or changed folder.
 void publishProject(CmsDbContext dbc, I_CmsReport report, CmsProject onlineProject, CmsPublishList publishList, boolean backupEnabled, int backupTagId, int maxVersions)
          Publishes a specified project to the online project.
 CmsProject readProject(CmsDbContext dbc, int id)
          Reads a project given the projects id.
 CmsProject readProject(CmsDbContext dbc, java.lang.String name)
          Reads a project.
 java.lang.String readProjectResource(CmsDbContext dbc, int projectId, java.lang.String resourcename, java.lang.Object reservedParam)
          Reads the project resource path for a given project and resource path, to validate if a resource path for a given project already exists.
 java.util.List readProjectResources(CmsDbContext dbc, CmsProject project)
          Reads the project resources for a specified project.
 java.util.List readProjects(CmsDbContext dbc, int state)
          Returns all projects with the given state.
 java.util.List readProjectsForGroup(CmsDbContext dbc, CmsGroup group)
          Returns all projects, which are accessible by a group.
 java.util.List readProjectsForManagerGroup(CmsDbContext dbc, CmsGroup group)
          Returns all projects, which are manageable by a group.
 java.util.List readProjectsForUser(CmsDbContext dbc, CmsUser user)
          Reads all projects which are owned by a specified user.
 java.util.List readProjectView(CmsDbContext dbc, int project, java.lang.String filter)
          Reads all resources that build the "view" of a project.
 java.util.List readPublishedResources(CmsDbContext dbc, int projectId, CmsUUID publishHistoryId)
          Reads the resources that were published during a publish process for a given publish history ID.
 java.lang.String readStaticExportPublishedResourceParameters(CmsDbContext dbc, CmsProject currentProject, java.lang.String rfsName)
          Returns the parameters of a resource in the table of all published template resources.
 java.util.List readStaticExportResources(CmsDbContext dbc, CmsProject currentProject, int parameterResources, long timestamp)
          Returns a list of all template resources which must be processed during a static export.
 void unmarkProjectResources(CmsDbContext dbc, CmsProject project)
          Removes the project id from all resources within a project.
 void writeProject(CmsDbContext dbc, CmsProject project)
          Writes an already existing project.
 void writePublishHistory(CmsDbContext dbc, CmsProject currentProject, CmsUUID publishId, CmsPublishedResource resource)
          Inserts an entry in the publish history for a published VFS resource.
 void writeStaticExportPublishedResource(CmsDbContext dbc, CmsProject currentProject, java.lang.String resourceName, int linkType, java.lang.String linkParameter, long timestamp)
          Inserts an entry in the published resource table.
 

Field Detail

DRIVER_TYPE_ID

public static final int DRIVER_TYPE_ID
The type ID to identify project driver implementations.

See Also:
Constant Field Values

TEMP_FILE_PROJECT_NAME

public static final java.lang.String TEMP_FILE_PROJECT_NAME
The name of the temp file project.

See Also:
Constant Field Values
Method Detail

createProject

public CmsProject createProject(CmsDbContext dbc,
                                CmsUser owner,
                                CmsGroup group,
                                CmsGroup managergroup,
                                CmsTask task,
                                java.lang.String name,
                                java.lang.String description,
                                int flags,
                                int type,
                                java.lang.Object reservedParam)
                         throws CmsDataAccessException
Creates a new project.

Parameters:
dbc - the current database context
owner - the owner of the project
group - the group for the project
managergroup - the managergroup for the project
task - the base workflow task for the project
name - the name of the project to create
description - the description for the project
flags - the flags for the project
type - the type for the project
reservedParam - reserved optional parameter, should be null on standard OpenCms installations
Returns:
the created CmsProject instance
Throws:
CmsDataAccessException - if something goes wrong

createProjectResource

public void createProjectResource(CmsDbContext dbc,
                                  int projectId,
                                  java.lang.String resourceName,
                                  java.lang.Object reservedParam)
                           throws CmsDataAccessException
Creates a new projectResource from a given CmsResource object.

Parameters:
dbc - the current database context
projectId - The project in which the resource will be used
resourceName - The resource to be written to the Cms
reservedParam - reserved optional parameter, should be null on standard OpenCms installations
Throws:
CmsDataAccessException - if something goes wrong

deleteAllStaticExportPublishedResources

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

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

deleteProject

public void deleteProject(CmsDbContext dbc,
                          CmsProject project)
                   throws CmsDataAccessException
Deletes a project from the cms.

Therefore it deletes all files, resources and properties.

Parameters:
dbc - the current database context
project - the project to delete
Throws:
CmsDataAccessException - if something goes wrong

deleteProjectResource

public void deleteProjectResource(CmsDbContext dbc,
                                  int projectId,
                                  java.lang.String resourceName)
                           throws CmsDataAccessException
Delete a projectResource from an given CmsResource object.

Parameters:
dbc - the current database context
projectId - id of the project in which the resource is used
resourceName - name of the resource to be deleted from the Cms
Throws:
CmsDataAccessException - if something goes wrong

deleteProjectResources

public void deleteProjectResources(CmsDbContext dbc,
                                   CmsProject project)
                            throws CmsDataAccessException
Deletes a specified project.

Parameters:
dbc - the current database context
project - the project to be deleted
Throws:
CmsDataAccessException - if operation was not succesful

deletePublishHistory

public void deletePublishHistory(CmsDbContext dbc,
                                 int projectId,
                                 int maxBackupTagId)
                          throws CmsDataAccessException
Deletes all publish history entries with backup tag IDs >=0 and < the specified max. backup tag ID.

Parameters:
dbc - the current database context
projectId - the ID of the current project
maxBackupTagId - entries with backup tag IDs >=0 and < this max. backup tag ID get deleted
Throws:
CmsDataAccessException - if something goes wrong

deletePublishHistoryEntry

public void deletePublishHistoryEntry(CmsDbContext dbc,
                                      int projectId,
                                      CmsUUID publishHistoryId,
                                      CmsPublishedResource publishResource)
                               throws CmsDataAccessException
Deletes a publish history entry with backup tag IDs >=0 and < the specified max. backup tag ID.

Parameters:
dbc - the current database context
projectId - the ID of the current project
publishHistoryId - the id of the history to delete the entry from
publishResource - the entry to delete
Throws:
CmsDataAccessException - if something goes wrong

deleteStaticExportPublishedResource

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

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

destroy

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

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

fillDefaults

public void fillDefaults(CmsDbContext dbc)
                  throws CmsDataAccessException
Fills the OpenCms database tables with default values.

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

getSqlManager

public CmsSqlManager getSqlManager()
Returns the SqlManager of this driver.

Returns:
the SqlManager of this driver

initSqlManager

public CmsSqlManager initSqlManager(java.lang.String classname)
Initializes the SQL manager for this driver.

To obtain JDBC connections from different pools, further {online|offline|backup} pool Urls have to be specified.

Parameters:
classname - the classname of the SQL manager
Returns:
the SQL manager for this driver

publishDeletedFolder

public void publishDeletedFolder(CmsDbContext dbc,
                                 I_CmsReport report,
                                 int m,
                                 int n,
                                 CmsProject onlineProject,
                                 CmsFolder offlineFolder,
                                 boolean backupEnabled,
                                 long publishDate,
                                 CmsUUID publishHistoryId,
                                 int backupTagId,
                                 int maxVersions)
                          throws CmsDataAccessException
Publishes a deleted folder.

Parameters:
dbc - the current database context
report - the report to log the output to
m - the number of the folder to publish
n - the number of all folders to publish
onlineProject - the online project
offlineFolder - the offline folder to publish
backupEnabled - flag if backup is enabled
publishDate - the publishing date
publishHistoryId - the publish history id
backupTagId - the backup tag id
maxVersions - the maxmum number of backup versions for each resource
Throws:
CmsDataAccessException - if something goes wrong

publishFile

public void publishFile(CmsDbContext dbc,
                        I_CmsReport report,
                        int m,
                        int n,
                        CmsProject onlineProject,
                        CmsResource offlineResource,
                        java.util.Set publishedContentIds,
                        boolean backupEnabled,
                        long publishDate,
                        CmsUUID publishHistoryId,
                        int backupTagId,
                        int maxVersions)
                 throws CmsDataAccessException
Publishes a new, changed or deleted file.

Parameters:
dbc - the current database context
report - the report to log the output to
m - the number of the file to publish
n - the number of all files to publish
onlineProject - the online project
offlineResource - the offline file to publish
publishedContentIds - contains the UUIDs of already published content records
backupEnabled - flag if backup is enabled
publishDate - the publishing date
publishHistoryId - the publish history id
backupTagId - the backup tag id
maxVersions - the maxmum number of backup versions for each resource
Throws:
CmsDataAccessException - if something goes wrong

publishFileContent

public CmsFile publishFileContent(CmsDbContext dbc,
                                  CmsProject offlineProject,
                                  CmsProject onlineProject,
                                  CmsResource offlineFileHeader,
                                  java.util.Set publishedResourceIds)
                           throws CmsDataAccessException
Publishes the content record of a file.

The content record is only published unless it's UUID is not contained in publishedContentIds. The calling method has to take care about whether an existing content record has to be deleted before or not.

The intention of this method is to get overloaded in a project driver for a specific DB server to shift the binary content from the offline into the online table in a more sophisticated way than in the generic ANSI-SQL implementation of this interface.

Parameters:
dbc - the current database context
offlineProject - the offline project to read data
onlineProject - the online project to write data
offlineFileHeader - the offline header of the file of which the content gets published
publishedResourceIds - a Set with the UUIDs of the already published content records
Returns:
the published file (online)
Throws:
CmsDataAccessException - if something goes wrong

publishFolder

public void publishFolder(CmsDbContext dbc,
                          I_CmsReport report,
                          int m,
                          int n,
                          CmsProject onlineProject,
                          CmsFolder currentFolder,
                          boolean backupEnabled,
                          long publishDate,
                          CmsUUID publishHistoryId,
                          int backupTagId,
                          int maxVersions)
                   throws CmsDataAccessException
Publishes a new or changed folder.

Parameters:
dbc - the current database context
report - the report to log the output to
m - the number of the folder to publish
n - the number of all folders to publish
onlineProject - the online project
currentFolder - the offline folder to publish
backupEnabled - flag if backup is enabled
publishDate - the publishing date
publishHistoryId - the publish history id
backupTagId - the backup tag id
maxVersions - the maxmum number of backup versions for each resource
Throws:
CmsDataAccessException - if something goes wrong

publishProject

public void publishProject(CmsDbContext dbc,
                           I_CmsReport report,
                           CmsProject onlineProject,
                           CmsPublishList publishList,
                           boolean backupEnabled,
                           int backupTagId,
                           int maxVersions)
                    throws CmsException
Publishes a specified project to the online project.

Parameters:
dbc - the current database context
report - an I_CmsReport instance to print output messages
onlineProject - the online project
publishList - a Cms publish list
backupEnabled - true if published resources should be written to the Cms backup
backupTagId - the backup tag ID
maxVersions - maximum number of backup versions
Throws:
CmsException - if something goes wrong

readProject

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

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

readProject

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

Parameters:
dbc - the current database context
name - the name of the project
Returns:
the project with the given name
Throws:
CmsDataAccessException - if something goes wrong

readProjectResource

public java.lang.String readProjectResource(CmsDbContext dbc,
                                            int projectId,
                                            java.lang.String resourcename,
                                            java.lang.Object reservedParam)
                                     throws CmsDataAccessException
Reads the project resource path for a given project and resource path, to validate if a resource path for a given project already exists.

Parameters:
dbc - the current database context
projectId - the ID of the project for which the resource path is read
resourcename - the project's resource path
reservedParam - reserved optional parameter, should be null on standard OpenCms installations
Returns:
String the project's resource path
Throws:
CmsDataAccessException - if something goes wrong

readProjectResources

public java.util.List readProjectResources(CmsDbContext dbc,
                                           CmsProject project)
                                    throws CmsDataAccessException
Reads the project resources for a specified project.

Parameters:
dbc - the current database context
project - the project for which the resource path is read
Returns:
a list of all project resource paths
Throws:
CmsDataAccessException - if something goes wrong

readProjects

public java.util.List readProjects(CmsDbContext dbc,
                                   int state)
                            throws CmsDataAccessException
Returns all projects with the given state.

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

readProjectsForGroup

public java.util.List readProjectsForGroup(CmsDbContext dbc,
                                           CmsGroup group)
                                    throws CmsDataAccessException
Returns all projects, which are accessible by a group.

Parameters:
dbc - the current database context
group - the requesting group
Returns:
a Vector of projects
Throws:
CmsDataAccessException - if something goes wrong

readProjectsForManagerGroup

public java.util.List readProjectsForManagerGroup(CmsDbContext dbc,
                                                  CmsGroup group)
                                           throws CmsDataAccessException
Returns all projects, which are manageable by a group.

Parameters:
dbc - the current database context
group - The requesting group
Returns:
a Vector of projects
Throws:
CmsDataAccessException - if something goes wrong

readProjectsForUser

public java.util.List readProjectsForUser(CmsDbContext dbc,
                                          CmsUser user)
                                   throws CmsDataAccessException
Reads all projects which are owned by a specified user.

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

readProjectView

public java.util.List readProjectView(CmsDbContext dbc,
                                      int project,
                                      java.lang.String filter)
                               throws CmsDataAccessException
Reads all resources that build the "view" of a project.

Parameters:
dbc - the current database context
project - the id of the project in which the resource will be used
filter - the filter for the resources to read
Returns:
a List of resources
Throws:
CmsDataAccessException - if something goes wrong

readPublishedResources

public java.util.List readPublishedResources(CmsDbContext dbc,
                                             int projectId,
                                             CmsUUID publishHistoryId)
                                      throws CmsDataAccessException
Reads the resources that were published during a publish process for a given publish history ID.

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

readStaticExportPublishedResourceParameters

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

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

readStaticExportResources

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

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

unmarkProjectResources

public void unmarkProjectResources(CmsDbContext dbc,
                                   CmsProject project)
                            throws CmsDataAccessException
Removes the project id from all resources within a project.

This must be done when a project will deleted

Parameters:
dbc - the current database context
project - the project to delete
Throws:
CmsDataAccessException - if something goes wrong

writeProject

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

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

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

writePublishHistory

public void writePublishHistory(CmsDbContext dbc,
                                CmsProject currentProject,
                                CmsUUID publishId,
                                CmsPublishedResource resource)
                         throws CmsDataAccessException
Inserts an entry in the publish history for a published VFS resource.

Parameters:
dbc - the current database context
currentProject - the current project
publishId - the ID of the current publishing process
resource - the state of the resource *before* it was published
Throws:
CmsDataAccessException - if something goes wrong

writeStaticExportPublishedResource

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

This is done during static export.

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