public class PurgingService extends SchedulableService implements atg.epub.purge.PurgeEventSender, atg.service.lockmanager.LockOwnershipListener, atg.deployment.common.event.TopologyChangeEventListener
maxAgeDays to
 configure the expiration time for versions. Note that the time is considered
 inclusive eg. assets which were checked in *on* or before the maxAgeDays will
 be purged.| Modifier and Type | Field and Description | 
|---|---|
static java.lang.String | 
CLASS_VERSION  | 
static java.lang.String | 
ERR_CURRENT_DEPLOYMENT_FOUND  | 
static java.lang.String | 
ERR_CURRENT_SNAPSHOT_NULL  | 
static java.lang.String | 
ERR_NO_DEPLOYMENT_SERVER  | 
static java.lang.String | 
ERR_NO_VERSION_MANAGER
resource keys * 
 | 
static java.lang.String | 
ERR_SNAPSHOT_IN_PURGE_RANGE  | 
static java.lang.String | 
ERR_SOLID_NOT_SUPPORTED  | 
static java.lang.Object | 
sSummaryGenerationMutex
Mutex used for request thread and summary generation threads to synchronize. 
 | 
mJobIdSERVICE_INFO_KEYDEFAULT_LOG_TRACE_STATUSDEFAULT_LOG_DEBUG_STATUS, DEFAULT_LOG_ERROR_STATUS, DEFAULT_LOG_INFO_STATUS, DEFAULT_LOG_WARNING_STATUS| Constructor and Description | 
|---|
PurgingService()
Empty constructor 
 | 
| Modifier and Type | Method and Description | 
|---|---|
protected boolean | 
acquireLock(long pLockTimeout,
           java.io.Serializable pLockKey,
           boolean pWriteLock)
The method will attempt to acqure an exclusive write lock. 
 | 
void | 
addPurgeEventListener(PurgeEventListener pListener)
Adds the listener. 
 | 
protected javax.servlet.Servlet | 
createAdminServlet()
Creates and returns a new Servlet that will administer this service. 
 | 
void | 
doStartService()
The default implementation is to just start our scheduled
 job. 
 | 
atg.epub.purge.PurgeResultSummary | 
execute(long pDays,
       boolean pDryRun)  | 
protected atg.epub.purge.ProjectPurgeResultSummary | 
executeProcessPurge(java.sql.Timestamp pCutOffTime,
                   boolean pDryRun)  | 
protected atg.epub.purge.VersionPurgeResultSummary | 
executeWorkspacePurge(java.sql.Timestamp pCutOff,
                     boolean pDryRun)  | 
void | 
firePurgeEvent(PurgeEvent pEvent)
Fire purge events to listeners. 
 | 
static java.lang.String | 
formatMsg(java.lang.String pMsgKey,
         java.lang.Object[] pArgs)
get message resource 
 | 
java.lang.String | 
getAssetEditLockName()
Get the name of the global asset edit lock 
 | 
long | 
getAssetEditLockTimeOut()
Get the maximum time we wait for a lock, in milliseconds. 
 | 
int | 
getCachedReportDisplayCount()  | 
ClientLockManager | 
getClientLockManager()
Get the ClientLockManager used to ensure that only one instance of the
 service is running at any given time. 
 | 
PublishingConfiguration | 
getConfiguration()  | 
atg.epub.purge.Prevalidation[] | 
getDefaultPrevalidations()  | 
java.lang.String | 
getDeploymentQueueLockName()
Get the name of the deployment queue lock 
 | 
long | 
getDeploymentQueueLockTimeOut()
Get the maximum time we wait for a lock, in milliseconds. 
 | 
int | 
getMaxAgeDays()
Get property  
maxAgeDays. | 
int | 
getMaxAgeDaysDecrement()
Get property  
maxAgeDaysDecrement. | 
atg.epub.purge.Prevalidation[] | 
getNonDefaultPrevalidations()  | 
PurgeEventListener[] | 
getPurgeEventListeners()
Returns an array of the list of PurgeEventListener. 
 | 
java.lang.String | 
getPurgingServiceLockName()
Get the name of the lock for this service. 
 | 
long | 
getPurgingServiceLockTimeOut()
Get the maximum time we wait for a lock, in milliseconds. 
 | 
java.lang.String | 
getServiceInfo()
Returns the a descriptive string about this service 
 | 
Cache | 
getSummaryReportCache()  | 
javax.transaction.TransactionManager | 
getTransactionManager()
Get TransactionManager used by this service 
 | 
protected void | 
giveUpLockOwnership(java.io.Serializable pLockKey)
This method will release the lock, using the  
ClientLockManager | 
protected boolean | 
isBranchInUse(Branch pBranch)
Check to see if the given branch is on use by a target. 
 | 
boolean | 
isPreciseSummaryReports()  | 
boolean | 
isRoundPurgeCutoffToPreviousMidnight()  | 
protected boolean | 
isSkipBranchPurge(Branch pBranch)
Check to see if the branch should be left alone 
 | 
protected boolean | 
isSkipBranchRemove(Branch pBranch)
Extend this method if you'd like some branches to be spared from removal. 
 | 
void | 
logDebug(java.lang.String pMessage)
Logs an debug event with the specified message 
 | 
void | 
logDebug(java.lang.String pMessage,
        java.lang.Throwable pThrowable)
Logs an debug event with the specified message and Throwable 
 | 
void | 
logDebug(java.lang.Throwable pThrowable)
Logs an debug event with the specified Throwable 
 | 
void | 
performScheduledTask(Scheduler pScheduler,
                    ScheduledJob pJob)
The method will be called by the scheduler according to its schedule. 
 | 
void | 
readOwnershipReleased(java.lang.Object pKey)  | 
protected void | 
releaseLock(java.io.Serializable pLockKey,
           boolean pWriteLock,
           boolean pKeepProcessOwnership)
This method will release the lock, using the  
ClientLockManager | 
protected void | 
removeProcess(Process pProcess,
             ProcessHome pProcessHome,
             ProjectHome pProjectHome)
Removes the project and its associate process 
 | 
void | 
removePurgeEventListener(PurgeEventListener pListener)
Removes the listener. 
 | 
java.util.Map | 
removeUnusedDeploymentBranches(boolean pDryRun)
Remove branches no longer used by any target in deployment topology 
 | 
protected atg.epub.purge.PrevalidationResult[] | 
runPrePurgeValidation(java.sql.Timestamp pCutOff)  | 
void | 
setAssetEditLockName(java.lang.String pAssetEditLockName)
Set the name of the global asset edit lock 
 | 
void | 
setAssetEditLockTimeOut(long pAssetEditLockTimeOut)
Set the maximum time we wait for a lock, in milliseconds. 
 | 
void | 
setCachedReportDisplayCount(int pCachedReportDisplayCount)  | 
void | 
setClientLockManager(ClientLockManager pClientLockManager)
Set the ClientLockManager used to ensure that only one instance of the
 service is running at any given time. 
 | 
void | 
setConfiguration(PublishingConfiguration pConfiguration)
Set the publishing configuration object 
 | 
void | 
setDeploymentQueueLockName(java.lang.String pDeploymentQueueLockName)
Set the name of the deployment queue lock 
 | 
void | 
setDeploymentQueueLockTimeOut(long pDeploymentQueueLockTimeOut)
Set the maximum time we wait for a lock, in milliseconds. 
 | 
void | 
setMaxAgeDays(int pMaxAgeDays)
Set property  
maxBranchAgeDays | 
void | 
setMaxAgeDaysDecrement(int pMaxAgeDaysDecrement)
Set property  
Decrement | 
void | 
setNonDefaultPrevalidations(atg.epub.purge.Prevalidation[] pNonDefaultPrevalidations)  | 
void | 
setPreciseSummaryReports(boolean pPreciseSummaryReports)  | 
void | 
setPurgingServiceLockName(java.lang.String pPurgingServiceLockName)
Get the name of the lock for this service. 
 | 
void | 
setPurgingServiceLockTimeOut(long pPurgingServiceLockTimeOut)
Set the maximum time we wait for a lock, in milliseconds. 
 | 
void | 
setRoundPurgeCutoffToPreviousMidnight(boolean pRoundPurgeCutoffToPreviousMidnight)  | 
void | 
setSummaryReportCache(Cache pSummaryReportCache)  | 
void | 
topologyChanged()
When a topology changes we may have deletes a target which becomes 
 a candidate for branch removal and our cache is invalid. 
 | 
void | 
writeOwnershipReleased(java.lang.Object pKey)
Flush cache when a purge happens on remote server. 
 | 
doStopService, getJobDescription, getJobId, getJobName, getSchedule, getScheduler, getThreadMethod, getThreadMethodString, isTransactional, setJobDescription, setJobName, setSchedule, setScheduler, setThreadMethod, setThreadMethodString, setTransactional, startScheduledJob, stopScheduledJobaddLogListener, getAbsoluteName, getAdminServlet, getAdminServletOutputStreamEncoding, getLoggingForVlogging, getLogListenerCount, getLogListeners, getName, getNameContext, getNucleus, getRoot, getServiceConfiguration, isAdminServletUseServletOutputStream, isLoggingDebug, isLoggingError, isLoggingInfo, isLoggingTrace, isLoggingWarning, isRunning, logError, logError, logError, logInfo, logInfo, logInfo, logTrace, logTrace, logTrace, logWarning, logWarning, logWarning, nameContextElementBound, nameContextElementUnbound, removeLogListener, reResolveThis, resolveName, resolveName, resolveName, resolveName, sendLogEvent, setAdminServletOutputStreamEncoding, setAdminServletUseServletOutputStream, setLoggingDebug, setLoggingError, setLoggingInfo, setLoggingTrace, setLoggingWarning, setNucleus, setServiceInfo, startService, stopServicevlogDebug, vlogDebug, vlogDebug, vlogDebug, vlogDebugTrace, vlogError, vlogError, vlogError, vlogError, vlogInfo, vlogInfo, vlogInfo, vlogInfo, vlogTrace, vlogTrace, vlogTrace, vlogTrace, vlogWarning, vlogWarning, vlogWarning, vlogWarningpublic static java.lang.String CLASS_VERSION
public static java.lang.Object sSummaryGenerationMutex
public static final java.lang.String ERR_NO_VERSION_MANAGER
public static final java.lang.String ERR_CURRENT_DEPLOYMENT_FOUND
public static final java.lang.String ERR_CURRENT_SNAPSHOT_NULL
public static final java.lang.String ERR_NO_DEPLOYMENT_SERVER
public static final java.lang.String ERR_SNAPSHOT_IN_PURGE_RANGE
public static final java.lang.String ERR_SOLID_NOT_SUPPORTED
public void setMaxAgeDays(int pMaxAgeDays)
maxBranchAgeDayspMaxBranchAgeDays - new value to setpublic int getMaxAgeDays()
maxAgeDays.maxAgeDayspublic void setMaxAgeDaysDecrement(int pMaxAgeDaysDecrement)
DecrementpMaxAgeDaysDecrement - new value to setpublic int getMaxAgeDaysDecrement()
maxAgeDaysDecrement.maxAgeDayspublic boolean isPreciseSummaryReports()
public void setPreciseSummaryReports(boolean pPreciseSummaryReports)
public Cache getSummaryReportCache()
public void setSummaryReportCache(Cache pSummaryReportCache)
public int getCachedReportDisplayCount()
public void setCachedReportDisplayCount(int pCachedReportDisplayCount)
public atg.epub.purge.Prevalidation[] getDefaultPrevalidations()
public atg.epub.purge.Prevalidation[] getNonDefaultPrevalidations()
public void setNonDefaultPrevalidations(atg.epub.purge.Prevalidation[] pNonDefaultPrevalidations)
public PublishingConfiguration getConfiguration()
public void setRoundPurgeCutoffToPreviousMidnight(boolean pRoundPurgeCutoffToPreviousMidnight)
public boolean isRoundPurgeCutoffToPreviousMidnight()
public void setConfiguration(PublishingConfiguration pConfiguration)
the - publishing configuration objectpublic void setClientLockManager(ClientLockManager pClientLockManager)
public ClientLockManager getClientLockManager()
public void setPurgingServiceLockName(java.lang.String pPurgingServiceLockName)
public java.lang.String getPurgingServiceLockName()
public void setPurgingServiceLockTimeOut(long pPurgingServiceLockTimeOut)
public long getPurgingServiceLockTimeOut()
public void setAssetEditLockName(java.lang.String pAssetEditLockName)
public java.lang.String getAssetEditLockName()
public void setAssetEditLockTimeOut(long pAssetEditLockTimeOut)
public long getAssetEditLockTimeOut()
public void setDeploymentQueueLockName(java.lang.String pDeploymentQueueLockName)
public java.lang.String getDeploymentQueueLockName()
public void setDeploymentQueueLockTimeOut(long pDeploymentQueueLockTimeOut)
public long getDeploymentQueueLockTimeOut()
public PurgeEventListener[] getPurgeEventListeners()
getPurgeEventListeners in interface atg.epub.purge.PurgeEventSenderpublic void addPurgeEventListener(PurgeEventListener pListener)
addPurgeEventListener in interface atg.epub.purge.PurgeEventSenderpListener - the listener wanting to know of purge eventsPurgeEventListenerpublic void removePurgeEventListener(PurgeEventListener pListener)
removePurgeEventListener in interface atg.epub.purge.PurgeEventSenderpListener - the listener wanting to know of purge eventsPurgeEventListenerpublic void doStartService()
                    throws ServiceException
SchedulableServicedoStartService in class SchedulableServiceServiceException - if an error occurred during the operationGenericService.doStartService()protected boolean acquireLock(long pLockTimeout,
                  java.io.Serializable pLockKey,
                  boolean pWriteLock)
                       throws DeadlockException,
                              TimeExceededException
lockName from the client lock manager
 specified by ClientLockManager.
 If the lock is obtained this method return true; If the lock is not obtained, or is not a global lock, the method returns false.
 Note: If the client lock manager is configured with its
 useLockServer property set to false it means that global
 locking is not enabled for that lock manager. In that case,
 acquireLock will accept a local lock instead.
pString - pLockTimeout - TimeExceededExceptionDeadlockExceptionprotected void releaseLock(java.io.Serializable pLockKey,
               boolean pWriteLock,
               boolean pKeepProcessOwnership)
ClientLockManagerpKeepProcessOwnership - protected void giveUpLockOwnership(java.io.Serializable pLockKey)
ClientLockManagerpKeepProcessOwnership - public void performScheduledTask(Scheduler pScheduler, ScheduledJob pJob)
acquireLock
 
 If the lock is obtained this method will call doScheduledTask.
 If the lock is not obtained the call to doScheduledTask will
 be skipped. In either case, the lock will be released before this method
 returns by calling releaseLock
performScheduledTask in interface SchedulableperformScheduledTask in class SchedulableServicepScheduler - the scheduler managing this jobpJob - the scheduled job associated with this servicepublic atg.epub.purge.PurgeResultSummary execute(long pDays,
                                        boolean pDryRun)
                                          throws java.lang.Exception
java.lang.Exceptionprotected atg.epub.purge.PrevalidationResult[] runPrePurgeValidation(java.sql.Timestamp pCutOff)
pMaxAge - ValidationExceptionprotected atg.epub.purge.VersionPurgeResultSummary executeWorkspacePurge(java.sql.Timestamp pCutOff,
                                                             boolean pDryRun)
                                                                  throws VersionException
VersionExceptionprotected atg.epub.purge.ProjectPurgeResultSummary executeProcessPurge(java.sql.Timestamp pCutOffTime,
                                                           boolean pDryRun)
                                                                throws javax.transaction.SystemException,
                                                                       java.lang.IllegalStateException,
                                                                       javax.transaction.RollbackException,
                                                                       javax.ejb.EJBException,
                                                                       javax.ejb.FinderException
javax.transaction.SystemExceptionjavax.transaction.RollbackExceptionjava.lang.IllegalStateExceptionjavax.ejb.FinderExceptionjavax.ejb.EJBExceptionprotected void removeProcess(Process pProcess, ProcessHome pProcessHome, ProjectHome pProjectHome)
public java.util.Map removeUnusedDeploymentBranches(boolean pDryRun)
                                             throws VersionException
VersionExceptionprotected boolean isBranchInUse(Branch pBranch) throws atg.deployment.common.DeploymentException
pBranch - atg.deployment.common.DeploymentExceptionpublic javax.transaction.TransactionManager getTransactionManager()
protected boolean isSkipBranchPurge(Branch pBranch)
pBranch - protected boolean isSkipBranchRemove(Branch pBranch)
pBranch - public static java.lang.String formatMsg(java.lang.String pMsgKey,
                         java.lang.Object[] pArgs)
protected javax.servlet.Servlet createAdminServlet()
createAdminServlet in class GenericServicepublic void logDebug(java.lang.String pMessage,
            java.lang.Throwable pThrowable)
GenericServicelogDebug in interface atg.core.logging.LogginglogDebug in interface ApplicationLogginglogDebug in class GenericServicepublic void logDebug(java.lang.String pMessage)
GenericServicelogDebug in interface atg.core.logging.LogginglogDebug in interface ApplicationLogginglogDebug in class GenericServicepublic void logDebug(java.lang.Throwable pThrowable)
GenericServicelogDebug in interface atg.core.logging.LogginglogDebug in interface ApplicationLogginglogDebug in class GenericServicepublic void firePurgeEvent(PurgeEvent pEvent)
firePurgeEvent in interface atg.epub.purge.PurgeEventSenderpublic java.lang.String getServiceInfo()
GenericServicegetServiceInfo in class GenericServicepublic void readOwnershipReleased(java.lang.Object pKey)
readOwnershipReleased in interface atg.service.lockmanager.LockOwnershipListenerpublic void writeOwnershipReleased(java.lang.Object pKey)
writeOwnershipReleased in interface atg.service.lockmanager.LockOwnershipListenerpublic void topologyChanged()
topologyChanged in interface atg.deployment.common.event.TopologyChangeEventListener