public abstract class AbstractPatch extends Object implements Patch, org.springframework.context.ApplicationEventPublisherAware
Modifier and Type | Field and Description |
---|---|
protected org.springframework.context.ApplicationEventPublisher |
applicationEventPublisher
Publishes batch event notifications for JMX viewing
|
protected AuthenticationContext |
authenticationContext |
static String |
ERR_PROPERTY_NOT_SET
I18N message when properties not set.
|
protected org.alfresco.service.namespace.NamespaceService |
namespaceService |
protected org.alfresco.service.cmr.repository.NodeService |
nodeService |
protected PatchService |
patchService
the service to register ourselves with
|
protected org.alfresco.service.cmr.search.SearchService |
searchService |
protected TenantAdminService |
tenantAdminService |
protected RetryingTransactionHelper |
transactionHelper
Use this helper to ensure that patches can execute even on a read-only system
|
protected TransactionService |
transactionService
used to ensure a unique transaction per execution
|
Constructor and Description |
---|
AbstractPatch() |
Modifier and Type | Method and Description |
---|---|
boolean |
applies(int version)
Check if the patch is applicable to a given schema version.
|
String |
apply()
Sets up the transaction and ensures thread-safety.
|
String |
applyAsync()
Apply the patch, regardless of the deferred flag.
|
protected abstract String |
applyInternal()
This method does the work.
|
protected void |
checkProperties()
Check that the schema version properties have been set appropriately.
|
protected void |
checkPropertyNotNull(Object value,
String name)
Performs a null check on the supplied value.
|
List<Patch> |
getAlternatives()
Get patches that could have done the work already
|
List<Patch> |
getDependsOn()
Get patches that this patch depends on
|
String |
getDescription() |
int |
getFixesFromSchema() |
int |
getFixesToSchema() |
String |
getId() |
int |
getTargetSchema() |
void |
init()
This ensures that this bean gets registered with the appropriate
service . |
boolean |
isDeferred()
Indicates whether the patch must be deferred (not to be executed in bootstrap) or not
|
boolean |
isForce() |
boolean |
isIgnored()
Is this patch just ignored - never considered for application
|
protected void |
reportProgress(long estimatedTotal,
long currentInteration)
Support to report patch completion and estimated completion time.
|
boolean |
requiresTransaction()
Does the patch need to be wrapped in a transaction?
|
void |
setAlternatives(List<Patch> alternatives)
Set all anti-dependencies.
|
void |
setApplicationEventPublisher(org.springframework.context.ApplicationEventPublisher applicationEventPublisher)
Set automatically
|
void |
setApplyToTenants(boolean applyToTenants) |
void |
setAuthenticationContext(AuthenticationContext authenticationContext) |
void |
setDeferred(boolean deferred)
Should the patch be deferred? And not run at bootstrap.
|
void |
setDependsOn(List<Patch> dependsOn)
Set all the dependencies for this patch.
|
void |
setDescription(String description) |
void |
setFixesFromSchema(int version)
Set the smallest schema number that this patch may be applied to.
|
void |
setFixesToSchema(int version)
Set the largest schema version number that this patch may be applied to.
|
void |
setForce(boolean force)
Set the flag that forces the patch to be forcefully applied.
|
void |
setId(String id) |
void |
setIgnored(boolean ignored) |
void |
setNamespaceService(org.alfresco.service.namespace.NamespaceService namespaceService) |
void |
setNodeService(org.alfresco.service.cmr.repository.NodeService nodeService) |
void |
setPatchService(PatchService patchService)
Set the service that this patch will register with for execution.
|
void |
setRequiresTransaction(boolean requiresTransaction) |
void |
setSearchService(org.alfresco.service.cmr.search.SearchService searchService) |
void |
setTargetSchema(int version)
Set the schema version that this patch attempts to take the existing schema to.
|
void |
setTenantAdminService(TenantAdminService tenantAdminService) |
void |
setTransactionService(TransactionService transactionService)
Set the transaction provider so that each execution can be performed within a transaction
|
String |
toString() |
public static final String ERR_PROPERTY_NOT_SET
protected PatchService patchService
protected TransactionService transactionService
protected RetryingTransactionHelper transactionHelper
protected org.alfresco.service.namespace.NamespaceService namespaceService
protected org.alfresco.service.cmr.repository.NodeService nodeService
protected org.alfresco.service.cmr.search.SearchService searchService
protected AuthenticationContext authenticationContext
protected TenantAdminService tenantAdminService
protected org.springframework.context.ApplicationEventPublisher applicationEventPublisher
public void setPatchService(PatchService patchService)
public void setTransactionService(TransactionService transactionService)
public void setNamespaceService(org.alfresco.service.namespace.NamespaceService namespaceService)
public void setNodeService(org.alfresco.service.cmr.repository.NodeService nodeService)
public void setSearchService(org.alfresco.service.cmr.search.SearchService searchService)
public void setAuthenticationContext(AuthenticationContext authenticationContext)
public void setTenantAdminService(TenantAdminService tenantAdminService)
public void setApplicationEventPublisher(org.springframework.context.ApplicationEventPublisher applicationEventPublisher)
setApplicationEventPublisher
in interface org.springframework.context.ApplicationEventPublisherAware
public void init()
service
.public void setId(String id)
id
- the unique ID of the patch. This dictates the order in which patches are applied.public int getFixesFromSchema()
getFixesFromSchema
in interface Patch
public void setRequiresTransaction(boolean requiresTransaction)
public boolean requiresTransaction()
Patch
requiresTransaction
in interface Patch
public void setFixesFromSchema(int version)
version
- a schema number not smaller than 0public int getFixesToSchema()
getFixesToSchema
in interface Patch
public void setFixesToSchema(int version)
version
- a schema version number not smaller than the from version
number.public int getTargetSchema()
getTargetSchema
in interface Patch
public void setTargetSchema(int version)
version
- a schema version number that must be greater than the max fix schema number
public boolean isForce()
public void setForce(boolean force)
force
- true to force the patch to be appliedpublic String getDescription()
getDescription
in interface Patch
public void setDescription(String description)
description
- a thorough description of the patchpublic boolean isIgnored()
Patch
public void setIgnored(boolean ignored)
ignored
- the ignored to setpublic List<Patch> getDependsOn()
Patch
getDependsOn
in interface Patch
public void setDependsOn(List<Patch> dependsOn)
dependsOn
- a list of dependenciespublic List<Patch> getAlternatives()
Patch
getAlternatives
in interface Patch
public void setAlternatives(List<Patch> alternatives)
alternatives
- a list of alternative patchespublic boolean applies(int version)
Patch
protected final void checkPropertyNotNull(Object value, String name)
value
- value to checkname
- name of the property to reportpublic void setApplyToTenants(boolean applyToTenants)
protected void checkProperties()
public String applyAsync() throws PatchException
applyAsync
in interface Patch
PatchException
- if the patch failed to be appliedpublic String apply() throws PatchException
apply
in interface Patch
PatchException
- if the patch failed to be appliedapplyInternal()
protected abstract String applyInternal() throws Exception
protected void reportProgress(long estimatedTotal, long currentInteration)
estimatedTotal
- longcurrentInteration
- longpublic void setDeferred(boolean deferred)
deferred
- booleanpublic boolean isDeferred()
Patch
isDeferred
in interface Patch
Copyright © 2005–2017 Alfresco Software. All rights reserved.