|
||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.opencms.publish.CmsPublishEngine
public final class CmsPublishEngine
This class is responsible for the publish process.
Constructor Summary | |
---|---|
CmsPublishEngine(I_CmsDbContextFactory dbContextFactory)
Default constructor. |
Method Summary | |
---|---|
protected void |
abortPublishJob(CmsUUID userId,
CmsPublishJobEnqueued publishJob,
boolean removeJob)
Aborts the given publish job. |
protected void |
addPublishListener(I_CmsPublishEventListener listener)
Adds a publish listener to listen on publish events. |
protected void |
disableEngine()
Disables the publish engine, i.e. publish jobs are not accepted. |
protected void |
enableEngine()
Enables the publish engine, i.e. publish jobs are accepted. |
void |
enqueuePublishJob(CmsObject cms,
CmsPublishList publishList,
I_CmsReport report)
Enqueues a new publish job with the given information in publish queue. |
protected org.opencms.publish.CmsPublishThread |
getCurrentPublishJob()
Returns the current running publish job. |
protected I_CmsDbContextFactory |
getDbContextFactory()
Returns the db context factory object. |
protected CmsDriverManager |
getDriverManager()
Returns the driver manager instance. |
CmsPublishJobBase |
getJobByPublishHistoryId(CmsUUID publishHistoryId)
Returns a publish job based on its publish history id. |
protected CmsPublishHistory |
getPublishHistory()
Returns the publish history list with already publish job. |
protected CmsPublishQueue |
getPublishQueue()
Returns the queue with still waiting publish job. |
protected byte[] |
getReportContents(CmsPublishJobFinished publishJob)
Returns the content of the publish report assigned to the given publish job. |
protected CmsUser |
getUser(CmsUUID userId)
Returns the user identified by the given id. |
protected void |
initialize(CmsObject adminCms,
boolean publishQueuePersistance,
int publishQueueShutdowntime)
Initializes the publish engine. |
protected boolean |
isRunning()
Returns the working state, that is if no publish job is waiting to be processed and there is no current running publish job. |
protected void |
lockPublishList(CmsPublishJobInfoBean publishJob)
Sets publish locks of resources in a publish list. |
protected void |
publishJobFinished(CmsPublishJobInfoBean publishJob)
Signalizes that the publish thread finishes. |
protected void |
publishJobRemoved(CmsPublishJobInfoBean publishJob)
A publish job has been permanently removed from the history. |
protected void |
publishJobStarted(CmsPublishJobInfoBean publishJob)
Signalizes that the publish thread starts. |
protected void |
removePublishListener(I_CmsPublishEventListener listener)
Removes the given publish listener. |
void |
run()
Controls the publish process. |
protected void |
sendMessage(CmsUUID toUserId,
java.lang.String message,
boolean hasErrors)
Sends a message to the given user, if publish notification is enabled or an error is shown in the message. |
void |
setDriverManager(CmsDriverManager driverManager)
Sets the driver manager instance. |
void |
shutDown()
Shuts down all this static export manager. |
protected void |
startEngine()
Starts the publish engine, i.e. publish jobs are accepted and processed. |
protected void |
stopEngine()
Stops the publish engine, i.e. publish jobs are still accepted but not published. |
protected void |
unlockPublishList(CmsPublishJobInfoBean publishJob)
Removes all publish locks of resources in a publish list of a publish job. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public CmsPublishEngine(I_CmsDbContextFactory dbContextFactory) throws CmsInitException
dbContextFactory
- the initialized OpenCms runtime info factory
CmsInitException
- if the configured path to store the publish reports is not accessibleMethod Detail |
---|
public void enqueuePublishJob(CmsObject cms, CmsPublishList publishList, I_CmsReport report) throws CmsException
All resources should already be locked.
If possible, the publish job starts immediately.
cms
- the cms context to publish forpublishList
- the resources to publishreport
- the report to write to
CmsException
- if something goes wrong while cloning the cms contextpublic CmsPublishJobBase getJobByPublishHistoryId(CmsUUID publishHistoryId)
The returned publish job may be an enqueued, running or finished publish job.
publishHistoryId
- the publish history id to search for
null
public void run()
run
in interface java.lang.Runnable
public void setDriverManager(CmsDriverManager driverManager)
driverManager
- the driver manager instancepublic void shutDown()
NOTE: this method may or may NOT be called (i.e. kill -9 in the stop script), if a system is stopped.
This is required since there may still be a thread running when the system is being shut down.
protected void abortPublishJob(CmsUUID userId, CmsPublishJobEnqueued publishJob, boolean removeJob) throws CmsException, CmsPublishException
userId
- the id of user that wants to abort the given publish jobpublishJob
- the publish job to abortremoveJob
- indicates if the job will be removed or added to history
CmsException
- if there is some problem during unlocking the resources
CmsPublishException
- if the publish job can not be abortedprotected void addPublishListener(I_CmsPublishEventListener listener)
listener
- the publish listener to addprotected void disableEngine()
protected void enableEngine()
protected org.opencms.publish.CmsPublishThread getCurrentPublishJob()
protected I_CmsDbContextFactory getDbContextFactory()
protected CmsDriverManager getDriverManager()
protected CmsPublishHistory getPublishHistory()
protected CmsPublishQueue getPublishQueue()
protected byte[] getReportContents(CmsPublishJobFinished publishJob) throws CmsException
publishJob
- the published job
CmsException
- if something goes wrongprotected CmsUser getUser(CmsUUID userId)
userId
- the id of the user to retrieve
protected void initialize(CmsObject adminCms, boolean publishQueuePersistance, int publishQueueShutdowntime) throws CmsException
adminCms
- the admin cmspublishQueuePersistance
- flag if the queue is persistedpublishQueueShutdowntime
- amount of time to wait for a publish job during shutdown
CmsException
- if something goes wrongprotected boolean isRunning()
protected void lockPublishList(CmsPublishJobInfoBean publishJob) throws CmsException
publishJob
- the publish job
CmsException
- if something goes wrongprotected void publishJobFinished(CmsPublishJobInfoBean publishJob) throws CmsException
publishJob
- the finished publish job
CmsException
- if something goes wrongprotected void publishJobRemoved(CmsPublishJobInfoBean publishJob)
publishJob
- the removed publish jobprotected void publishJobStarted(CmsPublishJobInfoBean publishJob)
publishJob
- the started publish jobprotected void removePublishListener(I_CmsPublishEventListener listener)
listener
- the publish listener to removeprotected void sendMessage(CmsUUID toUserId, java.lang.String message, boolean hasErrors)
toUserId
- the id of the user to send the message tomessage
- the message to sendhasErrors
- flag to determine if the message to send shows an errorprotected void startEngine()
protected void stopEngine()
protected void unlockPublishList(CmsPublishJobInfoBean publishJob) throws CmsException
publishJob
- the publish job
CmsException
- if something goes wrong
|
||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |