org.opencms.db.generic
Class CmsProjectDriver

java.lang.Object
  extended by org.opencms.db.generic.CmsProjectDriver
All Implemented Interfaces:
I_CmsDriver, I_CmsProjectDriver
Direct Known Subclasses:
CmsProjectDriver, CmsProjectDriver, CmsProjectDriver, CmsProjectDriver, CmsProjectDriver, CmsProjectDriver, CmsProjectDriver

public class CmsProjectDriver
extends java.lang.Object
implements I_CmsDriver, I_CmsProjectDriver

Generic (ANSI-SQL) implementation of the project driver methods.

Since:
6.0.0
Version:
$Revision: 1.261 $
Author:
Thomas Weckert, Carsten Weinholz, Michael Moossen

Field Summary
static java.lang.String DBC_ATTR_READ_PROJECT_FOR_RESOURCE
          Attribute name for reading the project of a resource.
protected  CmsDriverManager m_driverManager
          The driver manager.
protected  CmsSqlManager m_sqlManager
          The SQL manager.
 
Fields inherited from interface org.opencms.db.I_CmsDriver
AND_CONDITION, BEGIN_CONDITION, BEGIN_EXCLUDE_CONDITION, BEGIN_INCLUDE_CONDITION, END_CONDITION, OR_CONDITION
 
Fields inherited from interface org.opencms.db.I_CmsProjectDriver
DRIVER_TYPE_ID, SETUP_PROJECT_NAME, TEMP_FILE_PROJECT_NAME
 
Constructor Summary
CmsProjectDriver()
           
 
Method Summary
 CmsProject createProject(CmsDbContext dbc, CmsUUID id, CmsUser owner, CmsGroup group, CmsGroup managergroup, java.lang.String projectFqn, java.lang.String description, int flags, CmsProject.CmsProjectType type)
          Creates a new project.
 void createProjectResource(CmsDbContext dbc, CmsUUID projectId, java.lang.String resourcePath)
          Creates a new projectResource from a given CmsResource object.
 void createPublishJob(CmsDbContext dbc, CmsPublishJobInfoBean publishJob)
          Inserts an entry for a publish job .
protected  CmsPublishJobInfoBean createPublishJobInfoBean(java.sql.ResultSet res)
          Creates a CmsPublishJobInfoBean from a result set.
 void deleteAllStaticExportPublishedResources(CmsDbContext dbc, 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, CmsUUID 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, CmsUUID projectId, int maxpublishTag)
          Deletes all publish history entries with publish tags >=0 and < the specified max. publish tag.
 void deletePublishHistoryEntry(CmsDbContext dbc, CmsUUID publishHistoryId, CmsPublishedResource publishedResource)
          Deletes a publish history entry with publish tags >=0 and < the specified max. publish tag.
 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 deleteStaticExportPublishedResource(CmsDbContext dbc, 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.
protected  CmsResourceState fixMovedResource(CmsDbContext dbc, CmsProject onlineProject, CmsResource offlineResource, CmsUUID publishHistoryId, int publishTag)
          Checks if the given resource (by id) is available in the online project, if there exists a resource with a different path (a moved file), then the online entry is moved to the right (new) location before publishing.
 CmsSqlManager getSqlManager()
          Returns the SqlManager of this driver.
 void init(CmsDbContext dbc, CmsConfigurationManager configurationManager, java.util.List successiveDrivers, CmsDriverManager driverManager)
          Initializes the driver.
 CmsSqlManager initSqlManager(java.lang.String classname)
          Initializes the SQL manager for this driver.
protected  CmsProject internalCreateProject(java.sql.ResultSet res)
          Creates a new project from the current row of the given result set.
protected  CmsPublishList internalDeserializePublishList(byte[] bytes)
          Builds a publish list from serialized data.
protected  void internalResetResourceState(CmsDbContext dbc, CmsResource resource)
          Resets the state to UNCHANGED for a specified resource.
protected  byte[] internalSerializePublishList(CmsPublishList publishList)
          Serialize publish list to write it as byte array to the database.
protected  void internalWriteHistory(CmsDbContext dbc, CmsResource resource, CmsResourceState state, java.util.List properties, CmsUUID publishHistoryId, int publishTag)
          Writes the needed history entries.
protected  void publishChangedFile(CmsDbContext dbc, CmsProject onlineProject, CmsResource offlineResource, java.util.Set publishedResourceIds, CmsUUID publishHistoryId, int publishTag)
          Publishes a changed file.
protected  void publishDeletedFile(CmsDbContext dbc, CmsProject onlineProject, CmsResource offlineResource, CmsUUID publishHistoryId, int publishTag)
          Publishes a deleted file.
 void publishDeletedFolder(CmsDbContext dbc, I_CmsReport report, int m, int n, CmsProject onlineProject, CmsFolder currentFolder, CmsUUID publishHistoryId, int publishTag)
          Publishes a deleted folder.
 void publishFile(CmsDbContext dbc, I_CmsReport report, int m, int n, CmsProject onlineProject, CmsResource offlineResource, java.util.Set publishedContentIds, CmsUUID publishHistoryId, int publishTag)
          Publishes a new, changed or deleted file.
 CmsFile publishFileContent(CmsDbContext dbc, CmsProject offlineProject, CmsProject onlineProject, CmsResource offlineResource, java.util.Set publishedResourceIds, boolean needToUpdateContent, int publishTag)
          Publishes the content record of a file.
 void publishFolder(CmsDbContext dbc, I_CmsReport report, int m, int n, CmsProject onlineProject, CmsFolder offlineFolder, CmsUUID publishHistoryId, int publishTag)
          Publishes a new or changed folder.
protected  void publishNewFile(CmsDbContext dbc, CmsProject onlineProject, CmsResource offlineResource, java.util.Set publishedContentIds, CmsUUID publishHistoryId, int publishTag)
          Publishes a new file.
 void publishProject(CmsDbContext dbc, I_CmsReport report, CmsProject onlineProject, CmsPublishList publishList, int publishTag)
          Publishes a specified project to the online project.
 java.util.List readLocks(CmsDbContext dbc)
          Reads the List<CmsLock;> that were saved to the database in the previous run of OpenCms.
 CmsProject readProject(CmsDbContext dbc, CmsUUID id)
          Reads a project given the projects id.
 CmsProject readProject(CmsDbContext dbc, java.lang.String projectFqn)
          Reads a project.
 java.lang.String readProjectResource(CmsDbContext dbc, CmsUUID projectId, java.lang.String resourcePath)
          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, java.lang.String ouFqn)
          Returns all projects in the given organizational unit.
 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 readProjectsForResource(CmsDbContext dbc, java.lang.String rootPath)
          Returns the projects of a given resource.
 java.util.List readProjectsForUser(CmsDbContext dbc, CmsUser user)
          Reads all projects which are owned by a specified user.
 java.util.List readPublishedResources(CmsDbContext dbc, CmsUUID publishHistoryId)
          Reads the resources that were published during a publish process 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 publish jobs finished in the given time range.
 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.
 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.
 void setDriverManager(CmsDriverManager driverManager)
          Sets the driver manager for this driver.
 void setSqlManager(CmsSqlManager manager)
          Sets the SQL manager of this driver.
 void unmarkProjectResources(CmsDbContext dbc, CmsProject project)
          Removes the project id from all resources within a project.
 void writeLocks(CmsDbContext dbc, java.util.List locks)
          Writes the List<CmsLock;> to the database for reuse in the next run of OpenCms.
 void writeProject(CmsDbContext dbc, CmsProject project)
          Writes an already existing project.
 void writePublishHistory(CmsDbContext dbc, CmsUUID publishId, CmsPublishedResource resource)
          Inserts an entry in the publish history for a published VFS resource.
 void writePublishJob(CmsDbContext dbc, CmsPublishJobInfoBean publishJob)
          Writes a publish job.
 void writePublishReport(CmsDbContext dbc, CmsUUID publishId, byte[] content)
          Writes a publish report for a publish job.
 void writeStaticExportPublishedResource(CmsDbContext dbc, java.lang.String resourceName, int linkType, java.lang.String linkParameter, long timestamp)
          Inserts an entry in the published resource table.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.opencms.db.I_CmsDriver
toString
 

Field Detail

DBC_ATTR_READ_PROJECT_FOR_RESOURCE

public static final java.lang.String DBC_ATTR_READ_PROJECT_FOR_RESOURCE
Attribute name for reading the project of a resource.

See Also:
Constant Field Values

m_driverManager

protected CmsDriverManager m_driverManager
The driver manager.


m_sqlManager

protected CmsSqlManager m_sqlManager
The SQL manager.

Constructor Detail

CmsProjectDriver

public CmsProjectDriver()
Method Detail

createProject

public CmsProject createProject(CmsDbContext dbc,
                                CmsUUID id,
                                CmsUser owner,
                                CmsGroup group,
                                CmsGroup managergroup,
                                java.lang.String projectFqn,
                                java.lang.String description,
                                int flags,
                                CmsProject.CmsProjectType type)
                         throws CmsDataAccessException
Description copied from interface: I_CmsProjectDriver
Creates a new project.

Specified by:
createProject in interface I_CmsProjectDriver
Parameters:
dbc - the current database context
id - the project id
owner - the owner of the project
group - the group for the project
managergroup - the manager group for the project
projectFqn - 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
Returns:
the created CmsProject instance
Throws:
CmsDataAccessException - if something goes wrong
See Also:
I_CmsProjectDriver.createProject(org.opencms.db.CmsDbContext, CmsUUID, org.opencms.file.CmsUser, org.opencms.file.CmsGroup, org.opencms.file.CmsGroup, java.lang.String, java.lang.String, int, CmsProject.CmsProjectType)

createProjectResource

public void createProjectResource(CmsDbContext dbc,
                                  CmsUUID projectId,
                                  java.lang.String resourcePath)
                           throws CmsDataAccessException
Description copied from interface: I_CmsProjectDriver
Creates a new projectResource from a given CmsResource object.

Specified by:
createProjectResource in interface I_CmsProjectDriver
Parameters:
dbc - the current database context
projectId - The project in which the resource will be used
resourcePath - The resource to be written to the Cms
Throws:
CmsDataAccessException - if something goes wrong
See Also:
I_CmsProjectDriver.createProjectResource(org.opencms.db.CmsDbContext, CmsUUID, java.lang.String)

createPublishJob

public void createPublishJob(CmsDbContext dbc,
                             CmsPublishJobInfoBean publishJob)
                      throws CmsDataAccessException
Description copied from interface: I_CmsProjectDriver
Inserts an entry for a publish job .

Specified by:
createPublishJob in interface I_CmsProjectDriver
Parameters:
dbc - the current database context
publishJob - the publish job data
Throws:
CmsDataAccessException - if something goes wrong
See Also:
I_CmsProjectDriver.createPublishJob(org.opencms.db.CmsDbContext, org.opencms.publish.CmsPublishJobInfoBean)

deleteAllStaticExportPublishedResources

public void deleteAllStaticExportPublishedResources(CmsDbContext dbc,
                                                    int linkType)
                                             throws CmsDataAccessException
Description copied from interface: I_CmsProjectDriver
Deletes all entries in the published resource table.

Specified by:
deleteAllStaticExportPublishedResources in interface I_CmsProjectDriver
Parameters:
dbc - the current database context
linkType - the type of resource deleted (0= non-paramter, 1=parameter)
Throws:
CmsDataAccessException - if something goes wrong
See Also:
I_CmsProjectDriver.deleteAllStaticExportPublishedResources(org.opencms.db.CmsDbContext, int)

deleteProject

public void deleteProject(CmsDbContext dbc,
                          CmsProject project)
                   throws CmsDataAccessException
Description copied from interface: I_CmsProjectDriver
Deletes a project from the cms.

Therefore it deletes all files, resources and properties.

Specified by:
deleteProject in interface I_CmsProjectDriver
Parameters:
dbc - the current database context
project - the project to delete
Throws:
CmsDataAccessException - if something goes wrong
See Also:
I_CmsProjectDriver.deleteProject(org.opencms.db.CmsDbContext, org.opencms.file.CmsProject)

deleteProjectResource

public void deleteProjectResource(CmsDbContext dbc,
                                  CmsUUID projectId,
                                  java.lang.String resourceName)
                           throws CmsDataAccessException
Description copied from interface: I_CmsProjectDriver
Delete a projectResource from an given CmsResource object.

Specified by:
deleteProjectResource in interface I_CmsProjectDriver
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
See Also:
I_CmsProjectDriver.deleteProjectResource(org.opencms.db.CmsDbContext, CmsUUID, java.lang.String)

deleteProjectResources

public void deleteProjectResources(CmsDbContext dbc,
                                   CmsProject project)
                            throws CmsDataAccessException
Description copied from interface: I_CmsProjectDriver
Deletes a specified project.

Specified by:
deleteProjectResources in interface I_CmsProjectDriver
Parameters:
dbc - the current database context
project - the project to be deleted
Throws:
CmsDataAccessException - if operation was not succesful
See Also:
I_CmsProjectDriver.deleteProjectResources(org.opencms.db.CmsDbContext, org.opencms.file.CmsProject)

deletePublishHistory

public void deletePublishHistory(CmsDbContext dbc,
                                 CmsUUID projectId,
                                 int maxpublishTag)
                          throws CmsDataAccessException
Description copied from interface: I_CmsProjectDriver
Deletes all publish history entries with publish tags >=0 and < the specified max. publish tag.

Specified by:
deletePublishHistory in interface I_CmsProjectDriver
Parameters:
dbc - the current database context
projectId - the ID of the current project
maxpublishTag - entries with publish tags >=0 and < this max. publish tag get deleted
Throws:
CmsDataAccessException - if something goes wrong
See Also:
I_CmsProjectDriver.deletePublishHistory(org.opencms.db.CmsDbContext, CmsUUID, int)

deletePublishHistoryEntry

public void deletePublishHistoryEntry(CmsDbContext dbc,
                                      CmsUUID publishHistoryId,
                                      CmsPublishedResource publishedResource)
                               throws CmsDataAccessException
Description copied from interface: I_CmsProjectDriver
Deletes a publish history entry with publish tags >=0 and < the specified max. publish tag.

Specified by:
deletePublishHistoryEntry in interface I_CmsProjectDriver
Parameters:
dbc - the current database context
publishHistoryId - the id of the history to delete the entry from
publishedResource - the entry to delete
Throws:
CmsDataAccessException - if something goes wrong
See Also:
I_CmsProjectDriver.deletePublishHistoryEntry(org.opencms.db.CmsDbContext, org.opencms.util.CmsUUID, org.opencms.db.CmsPublishedResource)

deletePublishJob

public void deletePublishJob(CmsDbContext dbc,
                             CmsUUID publishHistoryId)
                      throws CmsDataAccessException
Description copied from interface: I_CmsProjectDriver
Deletes a publish job identified by its history id.

Specified by:
deletePublishJob in interface I_CmsProjectDriver
Parameters:
dbc - the current database context
publishHistoryId - the history id identifying the publish job
Throws:
CmsDataAccessException - if something goes wrong
See Also:
I_CmsProjectDriver.deletePublishJob(org.opencms.db.CmsDbContext, org.opencms.util.CmsUUID)

deletePublishList

public void deletePublishList(CmsDbContext dbc,
                              CmsUUID publishHistoryId)
                       throws CmsDataAccessException
Description copied from interface: I_CmsProjectDriver
Deletes the publish list assigned to a publish job.

Specified by:
deletePublishList in interface I_CmsProjectDriver
Parameters:
dbc - the current database context
publishHistoryId - the history id identifying the publish job
Throws:
CmsDataAccessException - if something goes wrong
See Also:
I_CmsProjectDriver.deletePublishList(org.opencms.db.CmsDbContext, org.opencms.util.CmsUUID)

deleteStaticExportPublishedResource

public void deleteStaticExportPublishedResource(CmsDbContext dbc,
                                                java.lang.String resourceName,
                                                int linkType,
                                                java.lang.String linkParameter)
                                         throws CmsDataAccessException
Description copied from interface: I_CmsProjectDriver
Deletes an entry in the published resource table.

Specified by:
deleteStaticExportPublishedResource in interface I_CmsProjectDriver
Parameters:
dbc - the current database context
resourceName - The name of the resource to be deleted in the static export
linkType - the type of resource deleted (0= non-paramter, 1=parameter)
linkParameter - the parameters of the resource
Throws:
CmsDataAccessException - if something goes wrong
See Also:
I_CmsProjectDriver.deleteStaticExportPublishedResource(org.opencms.db.CmsDbContext, java.lang.String, int, java.lang.String)

destroy

public void destroy()
             throws java.lang.Throwable
Description copied from interface: I_CmsProjectDriver
Destroys this driver.

Specified by:
destroy in interface I_CmsProjectDriver
Throws:
java.lang.Throwable - if something goes wrong
See Also:
I_CmsProjectDriver.destroy()

fillDefaults

public void fillDefaults(CmsDbContext dbc)
                  throws CmsDataAccessException
Description copied from interface: I_CmsProjectDriver
Fills the OpenCms database tables with default values.

Specified by:
fillDefaults in interface I_CmsProjectDriver
Parameters:
dbc - the current database context
Throws:
CmsDataAccessException - if something goes wrong
See Also:
I_CmsProjectDriver.fillDefaults(org.opencms.db.CmsDbContext)

getSqlManager

public CmsSqlManager getSqlManager()
Description copied from interface: I_CmsProjectDriver
Returns the SqlManager of this driver.

Specified by:
getSqlManager in interface I_CmsProjectDriver
Returns:
the SqlManager of this driver
See Also:
I_CmsProjectDriver.getSqlManager()

init

public void init(CmsDbContext dbc,
                 CmsConfigurationManager configurationManager,
                 java.util.List successiveDrivers,
                 CmsDriverManager driverManager)
Description copied from interface: I_CmsDriver
Initializes the driver.

Specified by:
init in interface I_CmsDriver
Parameters:
dbc - the current database context
configurationManager - the configuration manager
successiveDrivers - a list of successive drivers to be initialized
driverManager - the initialized OpenCms driver manager
See Also:
I_CmsDriver.init(org.opencms.db.CmsDbContext, org.opencms.configuration.CmsConfigurationManager, java.util.List, org.opencms.db.CmsDriverManager)

initSqlManager

public CmsSqlManager initSqlManager(java.lang.String classname)
Description copied from interface: I_CmsProjectDriver
Initializes the SQL manager for this driver.

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

Specified by:
initSqlManager in interface I_CmsProjectDriver
Parameters:
classname - the classname of the SQL manager
Returns:
the SQL manager for this driver
See Also:
I_CmsProjectDriver.initSqlManager(String)

publishDeletedFolder

public void publishDeletedFolder(CmsDbContext dbc,
                                 I_CmsReport report,
                                 int m,
                                 int n,
                                 CmsProject onlineProject,
                                 CmsFolder currentFolder,
                                 CmsUUID publishHistoryId,
                                 int publishTag)
                          throws CmsDataAccessException
Description copied from interface: I_CmsProjectDriver
Publishes a deleted folder.

Specified by:
publishDeletedFolder in interface I_CmsProjectDriver
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
publishHistoryId - the publish history id
publishTag - the publish tag
Throws:
CmsDataAccessException - if something goes wrong
See Also:
I_CmsProjectDriver.publishDeletedFolder(org.opencms.db.CmsDbContext, org.opencms.report.I_CmsReport, int, int, org.opencms.file.CmsProject, org.opencms.file.CmsFolder, org.opencms.util.CmsUUID, int)

publishFile

public void publishFile(CmsDbContext dbc,
                        I_CmsReport report,
                        int m,
                        int n,
                        CmsProject onlineProject,
                        CmsResource offlineResource,
                        java.util.Set publishedContentIds,
                        CmsUUID publishHistoryId,
                        int publishTag)
                 throws CmsDataAccessException
Description copied from interface: I_CmsProjectDriver
Publishes a new, changed or deleted file.

Specified by:
publishFile in interface I_CmsProjectDriver
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
publishHistoryId - the publish history id
publishTag - the publish tag
Throws:
CmsDataAccessException - if something goes wrong
See Also:
I_CmsProjectDriver.publishFile(org.opencms.db.CmsDbContext, org.opencms.report.I_CmsReport, int, int, org.opencms.file.CmsProject, org.opencms.file.CmsResource, java.util.Set, org.opencms.util.CmsUUID, int)

publishFileContent

public CmsFile publishFileContent(CmsDbContext dbc,
                                  CmsProject offlineProject,
                                  CmsProject onlineProject,
                                  CmsResource offlineResource,
                                  java.util.Set publishedResourceIds,
                                  boolean needToUpdateContent,
                                  int publishTag)
                           throws CmsDataAccessException
Description copied from interface: I_CmsProjectDriver
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.

Specified by:
publishFileContent in interface I_CmsProjectDriver
Parameters:
dbc - the current database context
offlineProject - the offline project to read data
onlineProject - the online project to write data
offlineResource - the offline header of the file of which the content gets published
publishedResourceIds - a Set with the UUIDs of the already published content records
needToUpdateContent - true if the content record has to be updated
publishTag - the publish tag
Returns:
the published file (online)
Throws:
CmsDataAccessException - if something goes wrong
See Also:
I_CmsProjectDriver.publishFileContent(CmsDbContext, CmsProject, CmsProject, CmsResource, Set, boolean, int)

publishFolder

public void publishFolder(CmsDbContext dbc,
                          I_CmsReport report,
                          int m,
                          int n,
                          CmsProject onlineProject,
                          CmsFolder offlineFolder,
                          CmsUUID publishHistoryId,
                          int publishTag)
                   throws CmsDataAccessException
Description copied from interface: I_CmsProjectDriver
Publishes a new or changed folder.

Specified by:
publishFolder in interface I_CmsProjectDriver
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
publishHistoryId - the publish history id
publishTag - the publish tag
Throws:
CmsDataAccessException - if something goes wrong
See Also:
I_CmsProjectDriver.publishFolder(org.opencms.db.CmsDbContext, org.opencms.report.I_CmsReport, int, int, org.opencms.file.CmsProject, org.opencms.file.CmsFolder, org.opencms.util.CmsUUID, int)

publishProject

public void publishProject(CmsDbContext dbc,
                           I_CmsReport report,
                           CmsProject onlineProject,
                           CmsPublishList publishList,
                           int publishTag)
                    throws CmsException
Description copied from interface: I_CmsProjectDriver
Publishes a specified project to the online project.

Specified by:
publishProject in interface I_CmsProjectDriver
Parameters:
dbc - the current database context
report - an I_CmsReport instance to print output messages
onlineProject - the online project
publishList - a Cms publish list
publishTag - the publish tag
Throws:
CmsException - if something goes wrong
See Also:
I_CmsProjectDriver.publishProject(org.opencms.db.CmsDbContext, org.opencms.report.I_CmsReport, org.opencms.file.CmsProject, org.opencms.db.CmsPublishList, int)

readLocks

public java.util.List readLocks(CmsDbContext dbc)
                         throws CmsDataAccessException
Description copied from interface: I_CmsProjectDriver
Reads the List<CmsLock;> that were saved to the database in the previous run of OpenCms.

Specified by:
readLocks in interface I_CmsProjectDriver
Parameters:
dbc - the current database context
Returns:
the List<CmsLock;> that were saved to the database in the previous run of OpenCms.
Throws:
CmsDataAccessException - if something goes wrong
See Also:
I_CmsProjectDriver.readLocks(org.opencms.db.CmsDbContext)

readProject

public CmsProject readProject(CmsDbContext dbc,
                              CmsUUID id)
                       throws CmsDataAccessException
Description copied from interface: I_CmsProjectDriver
Reads a project given the projects id.

Specified by:
readProject in interface I_CmsProjectDriver
Parameters:
dbc - the current database context
id - the id of the project
Returns:
the project read
Throws:
CmsDataAccessException - if something goes wrong
See Also:
I_CmsProjectDriver.readProject(org.opencms.db.CmsDbContext, CmsUUID)

readProject

public CmsProject readProject(CmsDbContext dbc,
                              java.lang.String projectFqn)
                       throws CmsDataAccessException
Description copied from interface: I_CmsProjectDriver
Reads a project.

Specified by:
readProject in interface I_CmsProjectDriver
Parameters:
dbc - the current database context
projectFqn - the name of the project
Returns:
the project with the given name
Throws:
CmsDataAccessException - if something goes wrong
See Also:
I_CmsProjectDriver.readProject(org.opencms.db.CmsDbContext, java.lang.String)

readProjectResource

public java.lang.String readProjectResource(CmsDbContext dbc,
                                            CmsUUID projectId,
                                            java.lang.String resourcePath)
                                     throws CmsDataAccessException
Description copied from interface: I_CmsProjectDriver
Reads the project resource path for a given project and resource path, to validate if a resource path for a given project already exists.

Specified by:
readProjectResource in interface I_CmsProjectDriver
Parameters:
dbc - the current database context
projectId - the ID of the project for which the resource path is read
resourcePath - the project's resource path
Returns:
String the project's resource path
Throws:
CmsDataAccessException - if something goes wrong
See Also:
I_CmsProjectDriver.readProjectResource(org.opencms.db.CmsDbContext, CmsUUID, java.lang.String)

readProjectResources

public java.util.List readProjectResources(CmsDbContext dbc,
                                           CmsProject project)
                                    throws CmsDataAccessException
Description copied from interface: I_CmsProjectDriver
Reads the project resources for a specified project.

Specified by:
readProjectResources in interface I_CmsProjectDriver
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
See Also:
I_CmsProjectDriver.readProjectResources(org.opencms.db.CmsDbContext, org.opencms.file.CmsProject)

readProjects

public java.util.List readProjects(CmsDbContext dbc,
                                   java.lang.String ouFqn)
                            throws CmsDataAccessException
Description copied from interface: I_CmsProjectDriver
Returns all projects in the given organizational unit.

Specified by:
readProjects in interface I_CmsProjectDriver
Parameters:
dbc - the current database context
ouFqn - the fully qualified name of the organizational unit to get the projects for
Returns:
a list of objects of type CmsProject
Throws:
CmsDataAccessException - if something goes wrong
See Also:
I_CmsProjectDriver.readProjects(org.opencms.db.CmsDbContext, String)

readProjectsForGroup

public java.util.List readProjectsForGroup(CmsDbContext dbc,
                                           CmsGroup group)
                                    throws CmsDataAccessException
Description copied from interface: I_CmsProjectDriver
Returns all projects, which are accessible by a group.

Specified by:
readProjectsForGroup in interface I_CmsProjectDriver
Parameters:
dbc - the current database context
group - the requesting group
Returns:
a Vector of projects
Throws:
CmsDataAccessException - if something goes wrong
See Also:
I_CmsProjectDriver.readProjectsForGroup(org.opencms.db.CmsDbContext, org.opencms.file.CmsGroup)

readProjectsForManagerGroup

public java.util.List readProjectsForManagerGroup(CmsDbContext dbc,
                                                  CmsGroup group)
                                           throws CmsDataAccessException
Description copied from interface: I_CmsProjectDriver
Returns all projects, which are manageable by a group.

Specified by:
readProjectsForManagerGroup in interface I_CmsProjectDriver
Parameters:
dbc - the current database context
group - The requesting group
Returns:
a Vector of projects
Throws:
CmsDataAccessException - if something goes wrong
See Also:
I_CmsProjectDriver.readProjectsForManagerGroup(org.opencms.db.CmsDbContext, org.opencms.file.CmsGroup)

readProjectsForResource

public java.util.List readProjectsForResource(CmsDbContext dbc,
                                              java.lang.String rootPath)
                                       throws CmsDataAccessException
Returns the projects of a given resource.

Parameters:
dbc - the database context
rootPath - the resource root path
Returns:
the projects of the resource, as a list of projects
Throws:
CmsDataAccessException - if something goes wrong

readProjectsForUser

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

Specified by:
readProjectsForUser in interface I_CmsProjectDriver
Parameters:
dbc - the current database context
user - the user
Returns:
a list of objects of type CmsProject
Throws:
CmsDataAccessException - if something goes wrong
See Also:
I_CmsProjectDriver.readProjectsForUser(org.opencms.db.CmsDbContext, org.opencms.file.CmsUser)

readPublishedResources

public java.util.List readPublishedResources(CmsDbContext dbc,
                                             CmsUUID publishHistoryId)
                                      throws CmsDataAccessException
Description copied from interface: I_CmsProjectDriver
Reads the resources that were published during a publish process for a given publish history ID.

Specified by:
readPublishedResources in interface I_CmsProjectDriver
Parameters:
dbc - the current database context
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
See Also:
I_CmsProjectDriver.readPublishedResources(org.opencms.db.CmsDbContext, org.opencms.util.CmsUUID)

readPublishJob

public CmsPublishJobInfoBean readPublishJob(CmsDbContext dbc,
                                            CmsUUID publishHistoryId)
                                     throws CmsDataAccessException
Description copied from interface: I_CmsProjectDriver
Reads a single publish job identified by its publish history id.

Specified by:
readPublishJob in interface I_CmsProjectDriver
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:
CmsDataAccessException - if something goes wrong
See Also:
I_CmsProjectDriver.readPublishJob(org.opencms.db.CmsDbContext, org.opencms.util.CmsUUID)

readPublishJobs

public java.util.List readPublishJobs(CmsDbContext dbc,
                                      long startTime,
                                      long endTime)
                               throws CmsDataAccessException
Description copied from interface: I_CmsProjectDriver
Reads all publish jobs finished in the given time range.

If (0L, 0L) is passed as time range, all pending jobs are returned.

Specified by:
readPublishJobs in interface I_CmsProjectDriver
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:
CmsDataAccessException - if something goes wrong
See Also:
I_CmsProjectDriver.readPublishJobs(org.opencms.db.CmsDbContext, long, long)

readPublishList

public CmsPublishList readPublishList(CmsDbContext dbc,
                                      CmsUUID publishHistoryId)
                               throws CmsDataAccessException
Description copied from interface: I_CmsProjectDriver
Reads the publish list assigned to a publish job.

Specified by:
readPublishList in interface I_CmsProjectDriver
Parameters:
dbc - the current database context
publishHistoryId - the history id identifying the publish job
Returns:
the assigned publish list
Throws:
CmsDataAccessException - if something goes wrong
See Also:
I_CmsProjectDriver.readPublishList(org.opencms.db.CmsDbContext, org.opencms.util.CmsUUID)

readPublishReportContents

public byte[] readPublishReportContents(CmsDbContext dbc,
                                        CmsUUID publishHistoryId)
                                 throws CmsDataAccessException
Description copied from interface: I_CmsProjectDriver
Reads the publish report assigned to a publish job.

Specified by:
readPublishReportContents in interface I_CmsProjectDriver
Parameters:
dbc - the current database context
publishHistoryId - the history id identifying the publish job
Returns:
the content of the assigned publish report
Throws:
CmsDataAccessException - if something goes wrong
See Also:
I_CmsProjectDriver.readPublishReportContents(org.opencms.db.CmsDbContext, org.opencms.util.CmsUUID)

readStaticExportPublishedResourceParameters

public java.lang.String readStaticExportPublishedResourceParameters(CmsDbContext dbc,
                                                                    java.lang.String rfsName)
                                                             throws CmsDataAccessException
Description copied from interface: I_CmsProjectDriver
Returns the parameters of a resource in the table of all published template resources.

Specified by:
readStaticExportPublishedResourceParameters in interface I_CmsProjectDriver
Parameters:
dbc - the current database context
rfsName - the rfs name of the resource
Returns:
the paramter string of the requested resource
Throws:
CmsDataAccessException - if something goes wrong
See Also:
I_CmsProjectDriver.readStaticExportPublishedResourceParameters(org.opencms.db.CmsDbContext, java.lang.String)

readStaticExportResources

public java.util.List readStaticExportResources(CmsDbContext dbc,
                                                int parameterResources,
                                                long timestamp)
                                         throws CmsDataAccessException
Description copied from interface: I_CmsProjectDriver
Returns a list of all template resources which must be processed during a static export.

Specified by:
readStaticExportResources in interface I_CmsProjectDriver
Parameters:
dbc - the current database context
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
See Also:
I_CmsProjectDriver.readStaticExportResources(org.opencms.db.CmsDbContext, int, long)

setDriverManager

public void setDriverManager(CmsDriverManager driverManager)
Sets the driver manager for this driver.

Parameters:
driverManager - the new driver manager

setSqlManager

public void setSqlManager(CmsSqlManager manager)
Sets the SQL manager of this driver.

Parameters:
manager - the new SQL manager

unmarkProjectResources

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

This must be done when a project will deleted

Specified by:
unmarkProjectResources in interface I_CmsProjectDriver
Parameters:
dbc - the current database context
project - the project to delete
Throws:
CmsDataAccessException - if something goes wrong
See Also:
I_CmsProjectDriver.unmarkProjectResources(org.opencms.db.CmsDbContext, org.opencms.file.CmsProject)

writeLocks

public void writeLocks(CmsDbContext dbc,
                       java.util.List locks)
                throws CmsDataAccessException
Description copied from interface: I_CmsProjectDriver
Writes the List<CmsLock;> to the database for reuse in the next run of OpenCms.

This method must only be called at startup or the in-memory locking will overwritten.

Specified by:
writeLocks in interface I_CmsProjectDriver
Parameters:
dbc - the current database context
locks - the List<CmsLock;> that currently exist in OpenCms (CmsLockManager)
Throws:
CmsDataAccessException - if something goes wrong
See Also:
I_CmsProjectDriver.writeLocks(org.opencms.db.CmsDbContext, java.util.List)

writeProject

public void writeProject(CmsDbContext dbc,
                         CmsProject project)
                  throws CmsDataAccessException
Description copied from interface: I_CmsProjectDriver
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.

Specified by:
writeProject in interface I_CmsProjectDriver
Parameters:
dbc - the current database context
project - the project that should be written
Throws:
CmsDataAccessException - if operation was not successful
See Also:
I_CmsProjectDriver.writeProject(org.opencms.db.CmsDbContext, org.opencms.file.CmsProject)

writePublishHistory

public void writePublishHistory(CmsDbContext dbc,
                                CmsUUID publishId,
                                CmsPublishedResource resource)
                         throws CmsDataAccessException
Description copied from interface: I_CmsProjectDriver
Inserts an entry in the publish history for a published VFS resource.

Specified by:
writePublishHistory in interface I_CmsProjectDriver
Parameters:
dbc - the current database context
publishId - the ID of the current publishing process
resource - the state of the resource *before* it was published
Throws:
CmsDataAccessException - if something goes wrong
See Also:
I_CmsProjectDriver.writePublishHistory(org.opencms.db.CmsDbContext, org.opencms.util.CmsUUID, org.opencms.db.CmsPublishedResource)

writePublishJob

public void writePublishJob(CmsDbContext dbc,
                            CmsPublishJobInfoBean publishJob)
                     throws CmsDataAccessException
Description copied from interface: I_CmsProjectDriver
Writes a publish job.

Specified by:
writePublishJob in interface I_CmsProjectDriver
Parameters:
dbc - the current database context
publishJob - the publish job to write
Throws:
CmsDataAccessException - if something goes wrong
See Also:
I_CmsProjectDriver.writePublishJob(org.opencms.db.CmsDbContext, org.opencms.publish.CmsPublishJobInfoBean)

writePublishReport

public void writePublishReport(CmsDbContext dbc,
                               CmsUUID publishId,
                               byte[] content)
                        throws CmsDataAccessException
Description copied from interface: I_CmsProjectDriver
Writes a publish report for a publish job.

Specified by:
writePublishReport in interface I_CmsProjectDriver
Parameters:
dbc - the current database context
publishId - the ID of the current publishing process
content - the report output
Throws:
CmsDataAccessException - if something goes wrong
See Also:
I_CmsProjectDriver.writePublishReport(org.opencms.db.CmsDbContext, org.opencms.util.CmsUUID, byte[])

writeStaticExportPublishedResource

public void writeStaticExportPublishedResource(CmsDbContext dbc,
                                               java.lang.String resourceName,
                                               int linkType,
                                               java.lang.String linkParameter,
                                               long timestamp)
                                        throws CmsDataAccessException
Description copied from interface: I_CmsProjectDriver
Inserts an entry in the published resource table.

This is done during static export.

Specified by:
writeStaticExportPublishedResource in interface I_CmsProjectDriver
Parameters:
dbc - the current database context
resourceName - The name of the resource to be added to the static export
linkType - the type of resource exported (0= non-paramter, 1=parameter)
linkParameter - the parameters added to the resource
timestamp - a timestamp for writing the data into the db
Throws:
CmsDataAccessException - if something goes wrong
See Also:
I_CmsProjectDriver.writeStaticExportPublishedResource(org.opencms.db.CmsDbContext, java.lang.String, int, java.lang.String, long)

createPublishJobInfoBean

protected CmsPublishJobInfoBean createPublishJobInfoBean(java.sql.ResultSet res)
                                                  throws java.sql.SQLException
Creates a CmsPublishJobInfoBean from a result set.

Parameters:
res - the result set
Returns:
an initialized CmsPublishJobInfoBean
Throws:
java.sql.SQLException - if something goes wrong

fixMovedResource

protected CmsResourceState fixMovedResource(CmsDbContext dbc,
                                            CmsProject onlineProject,
                                            CmsResource offlineResource,
                                            CmsUUID publishHistoryId,
                                            int publishTag)
                                     throws CmsDataAccessException
Checks if the given resource (by id) is available in the online project, if there exists a resource with a different path (a moved file), then the online entry is moved to the right (new) location before publishing.

Parameters:
dbc - the db context
onlineProject - the online project
offlineResource - the offline resource to check
publishHistoryId - the publish history id
publishTag - the publish tag
Returns:
true if the resource has actually been moved
Throws:
CmsDataAccessException - if something goes wrong

internalCreateProject

protected CmsProject internalCreateProject(java.sql.ResultSet res)
                                    throws java.sql.SQLException
Creates a new project from the current row of the given result set.

Parameters:
res - the result set
Returns:
the new project
Throws:
java.sql.SQLException - is something goes wrong

internalDeserializePublishList

protected CmsPublishList internalDeserializePublishList(byte[] bytes)
                                                 throws java.io.IOException,
                                                        java.lang.ClassNotFoundException
Builds a publish list from serialized data.

Parameters:
bytes - the byte array containing the serailized data for the publish list
Returns:
the initialized publish list
Throws:
java.io.IOException - if deserialization fails
java.lang.ClassNotFoundException - if deserialization fails

internalResetResourceState

protected void internalResetResourceState(CmsDbContext dbc,
                                          CmsResource resource)
                                   throws CmsDataAccessException
Resets the state to UNCHANGED for a specified resource.

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

internalSerializePublishList

protected byte[] internalSerializePublishList(CmsPublishList publishList)
                                       throws java.io.IOException
Serialize publish list to write it as byte array to the database.

Parameters:
publishList - the publish list
Returns:
byte array containing the publish list data
Throws:
java.io.IOException - if something goes wrong

internalWriteHistory

protected void internalWriteHistory(CmsDbContext dbc,
                                    CmsResource resource,
                                    CmsResourceState state,
                                    java.util.List properties,
                                    CmsUUID publishHistoryId,
                                    int publishTag)
                             throws CmsDataAccessException
Writes the needed history entries.

Parameters:
dbc - the current database context
resource - the offline resource
state - the state to store in the publish history entry
properties - the offline properties
publishHistoryId - the current publish process id
publishTag - the current publish process tag
Throws:
CmsDataAccessException - if something goes wrong

publishChangedFile

protected void publishChangedFile(CmsDbContext dbc,
                                  CmsProject onlineProject,
                                  CmsResource offlineResource,
                                  java.util.Set publishedResourceIds,
                                  CmsUUID publishHistoryId,
                                  int publishTag)
                           throws CmsDataAccessException
Publishes a changed file.

Parameters:
dbc - the current database context
onlineProject - the online project
offlineResource - the resource to publish
publishedResourceIds - contains the UUIDs of already published content records
publishHistoryId - the publish history id
publishTag - the publish tag
Throws:
CmsDataAccessException - is something goes wrong

publishDeletedFile

protected void publishDeletedFile(CmsDbContext dbc,
                                  CmsProject onlineProject,
                                  CmsResource offlineResource,
                                  CmsUUID publishHistoryId,
                                  int publishTag)
                           throws CmsDataAccessException
Publishes a deleted file.

Parameters:
dbc - the current database context
onlineProject - the online project
offlineResource - the resource to publish
publishHistoryId - the publish history id
publishTag - the publish tag
Throws:
CmsDataAccessException - is something goes wrong

publishNewFile

protected void publishNewFile(CmsDbContext dbc,
                              CmsProject onlineProject,
                              CmsResource offlineResource,
                              java.util.Set publishedContentIds,
                              CmsUUID publishHistoryId,
                              int publishTag)
                       throws CmsDataAccessException
Publishes a new file.

Parameters:
dbc - the current database context
onlineProject - the online project
offlineResource - the resource to publish
publishedContentIds - contains the UUIDs of already published content records
publishHistoryId - the publish history id
publishTag - the publish tag
Throws:
CmsDataAccessException - is something goes wrong