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

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

public class SchemaUpgradeScriptPatch
extends AbstractPatch

This patch ensures that an upgrade scriptUrl has been executed. Upgrade scripts should create an entry for the patch with the required ID and execution status so that the code in this class is never called. If called, an exception message is always generated.


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
SchemaUpgradeScriptPatch()
           
 
Method Summary
protected  java.lang.String applyInternal()
          This method does the work.
protected  void checkProperties()
          Check that the schema version properties have been set appropriately.
 java.lang.String getScriptUrl()
           
 void setScriptUrl(java.lang.String script)
          Set the URL of the upgrade scriptUrl to execute.
 
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

SchemaUpgradeScriptPatch

public SchemaUpgradeScriptPatch()
Method Detail

getScriptUrl

public java.lang.String getScriptUrl()
Returns:
Returns the URL of the scriptUrl that has to have been run

setScriptUrl

public void setScriptUrl(java.lang.String script)
Set the URL of the upgrade scriptUrl to execute. This is the full URL of the file, e.g. classpath:alfresco/patch/scripts/upgrade-1.4/${hibernate.dialect.class}/patchAlfrescoSchemaUpdate-1.4-2.sql where the ${hibernate.dialect.class} placeholder will be substituted with the Hibernate Dialect as configured for the system.

Parameters:
scriptUrl - the scriptUrl filename

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
Description copied from class: AbstractPatch
This method does the work. All transactions and thread-safety will be taken care of by this class. Any exception will result in the transaction being rolled back. Integrity checks are downgraded for the duration of the transaction.

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:
SchemaUpgradeScriptPatch.MSG_NOT_EXECUTED


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