org.alfresco.repo.admin.patch.impl
Class ContentUrlConverterPatch

java.lang.Object
  extended by org.alfresco.repo.admin.patch.AbstractPatch
      extended by org.alfresco.repo.admin.patch.impl.ContentUrlConverterPatch
All Implemented Interfaces:
Patch, org.springframework.context.ApplicationEventPublisherAware

public class ContentUrlConverterPatch
extends AbstractPatch

Component to migrate old-style content URL storage (contentUrl=store://...|mimetype=...) to the newer alf_content_url storage.

The ServiceRegistry is used to record progress. The component picks up ranges of node IDs (DM and AVM) and records the progress. Since new nodes will not need converting, the converter will stop once it hits the largest node ID that it found upon first initiation. Once completed, the content store reader will start to pick up orphaned content and schedule it for deletion.

A cluster-wide lock is set so that a single instance of this job will be running per Alfresco installation.

Since:
3.2.1

Nested Class Summary
static class ContentUrlConverterPatch.ContentUrlConverterJob
          Job to initiate the ContentUrlConverterPatch
 
Field Summary
 
Fields inherited from class org.alfresco.repo.admin.patch.AbstractPatch
applicationEventPublisher, authenticationContext, ERR_PROPERTY_NOT_SET, namespaceService, nodeService, searchService, tenantAdminService, transactionHelper, transactionService
 
Constructor Summary
ContentUrlConverterPatch()
          Default constructor
 
Method Summary
protected  java.lang.String applyInternal()
          Gets a set of work to do and executes it within this transaction.
protected  void checkProperties()
          Check that the schema version properties have been set appropriately.
 void setBatchSize(int batchSize)
          Set the number of URLs that are processed per job pass; this property is ignored when this component is run as a patch.
 void setContentDataDAO(ContentDataDAO contentDataDAO)
          Set the component that will write URLs coming from the content store.
 void setContentStore(ContentStore contentStore)
          Set the store containing the content URLs to lift for potential cleaning.
 void setControlDAO(ControlDAO controlDAO)
          Component that provides low-level database-specific control to support the patch
 void setJobLockService(JobLockService jobLockService)
          Service to prevent concurrent execution
 void setPatchDAO(PatchDAO patchDAO)
          Component that provides low-level queries and updates to support this patch
 void setRegistryService(RegistryService registryService)
          Service to record progress for later pick-up
 void setRunAsScheduledJob(boolean runAsScheduledJob)
          Set whether the patch execution should just bypass any actual work i.e.
 void setThreadCount(int threadCount)
          Set the number of threads that will be used process the required work.
 
Methods inherited from class org.alfresco.repo.admin.patch.AbstractPatch
applies, apply, checkPropertyNotNull, getAlternatives, getDependsOn, getDescription, getFixesFromSchema, getFixesToSchema, getId, getTargetSchema, init, isForce, reportProgress, requiresTransaction, setAlternatives, setApplicationEventPublisher, setApplyToTenants, setAuthenticationContext, setDependsOn, setDescription, setFixesFromSchema, setFixesToSchema, setForce, setId, setNamespaceService, setNodeService, setPatchService, setRequiresTransaction, setSearchService, setTargetSchema, setTenantAdminService, setTransactionService, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ContentUrlConverterPatch

public ContentUrlConverterPatch()
Default constructor

Method Detail

setRegistryService

public void setRegistryService(RegistryService registryService)
Service to record progress for later pick-up


setJobLockService

public void setJobLockService(JobLockService jobLockService)
Service to prevent concurrent execution


setPatchDAO

public void setPatchDAO(PatchDAO patchDAO)
Component that provides low-level queries and updates to support this patch


setControlDAO

public void setControlDAO(ControlDAO controlDAO)
Component that provides low-level database-specific control to support the patch


setContentStore

public void setContentStore(ContentStore contentStore)
Set the store containing the content URLs to lift for potential cleaning.

Parameters:
contentStore - the store containing the system's content URLs

setContentDataDAO

public void setContentDataDAO(ContentDataDAO contentDataDAO)
Set the component that will write URLs coming from the content store.

Parameters:
contentDataDAO - the DAO to write the URLs

setThreadCount

public void setThreadCount(int threadCount)
Set the number of threads that will be used process the required work.

Parameters:
threadCount - the number of threads

setBatchSize

public void setBatchSize(int batchSize)
Set the number of URLs that are processed per job pass; this property is ignored when this component is run as a patch. Keep the number low (500) when running at short intervals on a on a live machine.

Parameters:
batchSize - the number of nodes to process per batch when running on a schedule

setRunAsScheduledJob

public void setRunAsScheduledJob(boolean runAsScheduledJob)
Set whether the patch execution should just bypass any actual work i.e. the admin has chosen to manually trigger the work.

Parameters:
runAsScheduledJob - true to leave all work up to the scheduled job

checkProperties

protected void checkProperties()
Description copied from class: AbstractPatch
Check that the schema version properties have been set appropriately. Derived classes can override this method to perform their own validation provided that this method is called by the derived class.

Overrides:
checkProperties in class AbstractPatch

applyInternal

protected java.lang.String applyInternal()
                                  throws java.lang.Exception
Gets a set of work to do and executes it within this transaction. If kicked off via a job, the task will exit before completion, on the assumption that it will be kicked off at regular intervals. When called as a patch, it will run to completion with full progress logging.

Specified by:
applyInternal in class AbstractPatch
Returns:
Returns the report (only success messages).
Throws:
java.lang.Exception - anything can be thrown. This must be used for all failures.
See Also:
AbstractPatch.apply()


Copyright © 2005 - 2010 Alfresco Software, Inc. All Rights Reserved.