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.
|
mJobId
SERVICE_INFO_KEY
DEFAULT_LOG_TRACE_STATUS
DEFAULT_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,
boolean pUnconstrained) |
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,
boolean pUnconstrained) |
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, stopScheduledJob
addLogListener, 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, stopService, toString
vlogDebug, vlogDebug, vlogDebug, vlogDebug, vlogDebugTrace, vlogError, vlogError, vlogError, vlogError, vlogInfo, vlogInfo, vlogInfo, vlogInfo, vlogTrace, vlogTrace, vlogTrace, vlogTrace, vlogWarning, vlogWarning, vlogWarning, vlogWarning
public 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)
maxBranchAgeDays
pMaxBranchAgeDays
- new value to setpublic int getMaxAgeDays()
maxAgeDays
.maxAgeDays
public void setMaxAgeDaysDecrement(int pMaxAgeDaysDecrement)
Decrement
pMaxAgeDaysDecrement
- new value to setpublic int getMaxAgeDaysDecrement()
maxAgeDaysDecrement
.maxAgeDays
public 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.PurgeEventSender
public void addPurgeEventListener(PurgeEventListener pListener)
addPurgeEventListener
in interface atg.epub.purge.PurgeEventSender
pListener
- the listener wanting to know of purge eventsPurgeEventListener
public void removePurgeEventListener(PurgeEventListener pListener)
removePurgeEventListener
in interface atg.epub.purge.PurgeEventSender
pListener
- the listener wanting to know of purge eventsPurgeEventListener
public void doStartService() throws ServiceException
SchedulableService
doStartService
in class SchedulableService
ServiceException
- 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
- TimeExceededException
DeadlockException
protected void releaseLock(java.io.Serializable pLockKey, boolean pWriteLock, boolean pKeepProcessOwnership)
ClientLockManager
pKeepProcessOwnership
- protected void giveUpLockOwnership(java.io.Serializable pLockKey)
ClientLockManager
pKeepProcessOwnership
- 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 Schedulable
performScheduledTask
in class SchedulableService
pScheduler
- 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.Exception
protected atg.epub.purge.PrevalidationResult[] runPrePurgeValidation(java.sql.Timestamp pCutOff, boolean pUnconstrained)
pUnconstrained
- pMaxAge
- ValidationException
protected atg.epub.purge.VersionPurgeResultSummary executeWorkspacePurge(java.sql.Timestamp pCutOff, boolean pDryRun, boolean pUnconstrained) throws VersionException
VersionException
protected 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.SystemException
javax.transaction.RollbackException
java.lang.IllegalStateException
javax.ejb.FinderException
javax.ejb.EJBException
protected void removeProcess(Process pProcess, ProcessHome pProcessHome, ProjectHome pProjectHome)
public java.util.Map removeUnusedDeploymentBranches(boolean pDryRun) throws VersionException
VersionException
protected boolean isBranchInUse(Branch pBranch) throws atg.deployment.common.DeploymentException
pBranch
- atg.deployment.common.DeploymentException
public 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 GenericService
public void logDebug(java.lang.String pMessage, java.lang.Throwable pThrowable)
GenericService
logDebug
in interface atg.core.logging.Logging
logDebug
in interface ApplicationLogging
logDebug
in class GenericService
public void logDebug(java.lang.String pMessage)
GenericService
logDebug
in interface atg.core.logging.Logging
logDebug
in interface ApplicationLogging
logDebug
in class GenericService
public void logDebug(java.lang.Throwable pThrowable)
GenericService
logDebug
in interface atg.core.logging.Logging
logDebug
in interface ApplicationLogging
logDebug
in class GenericService
public void firePurgeEvent(PurgeEvent pEvent)
firePurgeEvent
in interface atg.epub.purge.PurgeEventSender
public java.lang.String getServiceInfo()
GenericService
getServiceInfo
in class GenericService
public void readOwnershipReleased(java.lang.Object pKey)
readOwnershipReleased
in interface atg.service.lockmanager.LockOwnershipListener
public void writeOwnershipReleased(java.lang.Object pKey)
writeOwnershipReleased
in interface atg.service.lockmanager.LockOwnershipListener
public void topologyChanged()
topologyChanged
in interface atg.deployment.common.event.TopologyChangeEventListener