|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.alfresco.repo.admin.patch.AbstractPatch
public abstract class AbstractPatch
Base implementation of the patch. This class ensures that the patch is thread- and transaction-safe.
Field Summary | |
---|---|
protected org.springframework.context.ApplicationEventPublisher |
applicationEventPublisher
Publishes batch event notifications for JMX viewing |
protected AuthenticationContext |
authenticationContext
|
static java.lang.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 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 Summary | |
---|---|
AbstractPatch()
|
Method Summary | |
---|---|
boolean |
applies(int version)
Check if the patch is applicable to a given schema version. |
java.lang.String |
apply()
Sets up the transaction and ensures thread-safety. |
protected abstract java.lang.String |
applyInternal()
This method does the work. |
protected void |
checkProperties()
Check that the schema version properties have been set appropriately. |
protected void |
checkPropertyNotNull(java.lang.Object value,
java.lang.String name)
Performs a null check on the supplied value. |
java.util.List |
getAlternatives()
Get patches that could have done the work already |
java.util.List |
getDependsOn()
Get patches that this patch depends on |
java.lang.String |
getDescription()
|
int |
getFixesFromSchema()
|
int |
getFixesToSchema()
|
java.lang.String |
getId()
|
int |
getTargetSchema()
|
void |
init()
This ensures that this bean gets registered with the appropriate service . |
boolean |
isForce()
|
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(java.util.List alternatives)
Set all anti-dependencies. |
void |
setApplicationEventPublisher(org.springframework.context.ApplicationEventPublisher applicationEventPublisher)
Set automatically |
void |
setApplyToTenants(boolean applyToTenants)
|
void |
setAuthenticationContext(AuthenticationContext authenticationContext)
|
void |
setDependsOn(java.util.List dependsOn)
Set all the dependencies for this patch. |
void |
setDescription(java.lang.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(java.lang.String id)
|
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 |
java.lang.String |
toString()
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final java.lang.String ERR_PROPERTY_NOT_SET
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
Constructor Detail |
---|
public AbstractPatch()
Method Detail |
---|
public java.lang.String toString()
toString
in class java.lang.Object
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 java.lang.String getId()
getId
in interface Patch
public void setId(java.lang.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()
isForce
in interface Patch
public void setForce(boolean force)
force
- true to force the patch to be appliedpublic java.lang.String getDescription()
getDescription
in interface Patch
public void setDescription(java.lang.String description)
description
- a thorough description of the patchpublic java.util.List getDependsOn()
Patch
getDependsOn
in interface Patch
public void setDependsOn(java.util.List dependsOn)
dependsOn
- a list of dependenciespublic java.util.List getAlternatives()
Patch
getAlternatives
in interface Patch
public void setAlternatives(java.util.List alternatives)
alternatives
- a list of alternative patchespublic boolean applies(int version)
Patch
applies
in interface Patch
version
- a schema version number
(fixesFromVersion <= version <= fixesToVersion)
protected final void checkPropertyNotNull(java.lang.Object value, java.lang.String name)
value
- value to checkname
- name of the property to reportpublic void setApplyToTenants(boolean applyToTenants)
protected void checkProperties()
public java.lang.String apply() throws PatchException
apply
in interface Patch
PatchException
- if the patch failed to be appliedAbstractPatch.applyInternal()
protected abstract java.lang.String applyInternal() throws java.lang.Exception
java.lang.Exception
- anything can be thrown. This must be used for all failures.AbstractPatch.apply()
protected void reportProgress(long estimatedTotal, long currentInteration)
estimatedTotal
- currentInteration
-
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |