Removed tabs found during investigation

git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/BRANCHES/DEV/5.2.N/root@130811 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Derek Hulley
2016-09-20 01:24:21 +00:00
parent 10298b7dad
commit f593629a86
2 changed files with 198 additions and 198 deletions

View File

@@ -323,15 +323,15 @@ public class PatchServiceImpl implements PatchService
private AppliedPatch applyPatch(Patch patch) private AppliedPatch applyPatch(Patch patch)
{ {
PatchWork work = new PatchWork(patch); PatchWork work = new PatchWork(patch);
work.setAppliedPatchDAO(appliedPatchDAO); work.setAppliedPatchDAO(appliedPatchDAO);
work.setTransactionService(transactionService); work.setTransactionService(transactionService);
work.setAppliedPatchDAO(appliedPatchDAO); work.setAppliedPatchDAO(appliedPatchDAO);
work.setDescriptorService(descriptorService); work.setDescriptorService(descriptorService);
work.setLogger(logger); work.setLogger(logger);
work.execute(); work.execute();
return work.getAppliedPatch(); return work.getAppliedPatch();
} }
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
@@ -361,48 +361,48 @@ public class PatchServiceImpl implements PatchService
{ {
private enum STATE private enum STATE
{ {
START, PRECEEDED, ALREADY_APPLIED, DOES_NOT_APPLY, APPLYING, NOT_APPLIED, APPLIED, FAILED; START, PRECEEDED, ALREADY_APPLIED, DOES_NOT_APPLY, APPLYING, NOT_APPLIED, APPLIED, FAILED;
}; };
private Log logger; private Log logger;
private AppliedPatchDAO appliedPatchDAO; private AppliedPatchDAO appliedPatchDAO;
private DescriptorService descriptorService; private DescriptorService descriptorService;
private TransactionService transactionService; private TransactionService transactionService;
private STATE state = STATE.START; private STATE state = STATE.START;
private Patch patch; private Patch patch;
private AppliedPatch appliedPatch; private AppliedPatch appliedPatch;
private Descriptor repoDescriptor; private Descriptor repoDescriptor;
private String preceededByAlternative; private String preceededByAlternative;
private boolean applies = false; private boolean applies = false;
private String report = null; private String report = null;
public PatchWork(Patch patch) { public PatchWork(Patch patch) {
super(); super();
this.patch = patch; this.patch = patch;
} }
public void setLogger(Log logger) public void setLogger(Log logger)
{ {
this.logger = logger; this.logger = logger;
} }
public void setAppliedPatchDAO(AppliedPatchDAO appliedPatchDAO) public void setAppliedPatchDAO(AppliedPatchDAO appliedPatchDAO)
{ {
this.appliedPatchDAO = appliedPatchDAO; this.appliedPatchDAO = appliedPatchDAO;
} }
public void setDescriptorService(DescriptorService descriptorService) public void setDescriptorService(DescriptorService descriptorService)
{ {
this.descriptorService = descriptorService; this.descriptorService = descriptorService;
} }
public void setTransactionService(TransactionService transactionService) public void setTransactionService(TransactionService transactionService)
{ {
this.transactionService = transactionService; this.transactionService = transactionService;
} }
/** /**
* Identifies if one of the alternative patches has already been executed. * Identifies if one of the alternative patches has already been executed.
@@ -449,107 +449,107 @@ public class PatchServiceImpl implements PatchService
return apply; return apply;
} }
private boolean patchSucceeded() private boolean patchSucceeded()
{ {
return state == STATE.ALREADY_APPLIED || state == STATE.DOES_NOT_APPLY || state == STATE.APPLIED || state == STATE.PRECEEDED; return state == STATE.ALREADY_APPLIED || state == STATE.DOES_NOT_APPLY || state == STATE.APPLIED || state == STATE.PRECEEDED;
} }
private boolean savePatch() private boolean savePatch()
{ {
return state == STATE.DOES_NOT_APPLY || state == STATE.APPLIED || state == STATE.PRECEEDED || state == STATE.FAILED; return state == STATE.DOES_NOT_APPLY || state == STATE.APPLIED || state == STATE.PRECEEDED || state == STATE.FAILED;
} }
public void execute() public void execute()
{ {
if(state != STATE.START) if(state != STATE.START)
{ {
throw new IllegalStateException("Patch is already being applied"); throw new IllegalStateException("Patch is already being applied");
} }
if(!patch.requiresTransaction() && AlfrescoTransactionSupport.isActualTransactionActive()) if(!patch.requiresTransaction() && AlfrescoTransactionSupport.isActualTransactionActive())
{ {
throw new AlfrescoRuntimeException("Patch " + throw new AlfrescoRuntimeException("Patch " +
patch.getId() + patch.getId() +
" has been configured with requiresTransaction set to false but is being called in a transaction"); " has been configured with requiresTransaction set to false but is being called in a transaction");
} }
setup(); setup();
applyPatch(); applyPatch();
save(); save();
} }
/** /**
* Perform some setup before applying the patch e.g. check whether the patch needs to be applied. * Perform some setup before applying the patch e.g. check whether the patch needs to be applied.
*/ */
private void setup() private void setup()
{ {
transactionService.getRetryingTransactionHelper().doInTransaction(new RetryingTransactionCallback<Object>() transactionService.getRetryingTransactionHelper().doInTransaction(new RetryingTransactionCallback<Object>()
{ {
@Override @Override
public Object execute() throws Throwable public Object execute() throws Throwable
{ {
final boolean forcePatch = patch.isForce(); final boolean forcePatch = patch.isForce();
if (forcePatch) if (forcePatch)
{ {
logger.warn( logger.warn(
"Patch will be forcefully executed: \n" + "Patch will be forcefully executed: \n" +
" Patch: " + patch); " Patch: " + patch);
} }
// Check whether patch has been applied already // Check whether patch has been applied already
// get the patch from the DAO // get the patch from the DAO
appliedPatch = appliedPatchDAO.getAppliedPatch(patch.getId()); appliedPatch = appliedPatchDAO.getAppliedPatch(patch.getId());
// We bypass the patch if it was executed successfully // We bypass the patch if it was executed successfully
if (appliedPatch != null && !forcePatch) if (appliedPatch != null && !forcePatch)
{ {
if (appliedPatch.getSucceeded()) if (appliedPatch.getSucceeded())
{ {
// It has already been successfully applied // It has already been successfully applied
if (logger.isDebugEnabled()) if (logger.isDebugEnabled())
{ {
logger.debug( logger.debug(
"Patch was already successfully applied: \n" + "Patch was already successfully applied: \n" +
" Patch: " + appliedPatch); " Patch: " + appliedPatch);
} }
state = STATE.ALREADY_APPLIED; state = STATE.ALREADY_APPLIED;
return null; return null;
} }
} }
// first check whether the patch is relevant to the repo // first check whether the patch is relevant to the repo
repoDescriptor = descriptorService.getInstalledRepositoryDescriptor(); repoDescriptor = descriptorService.getInstalledRepositoryDescriptor();
applies = forcePatch || applies(repoDescriptor, patch); applies = forcePatch || applies(repoDescriptor, patch);
preceededByAlternative = forcePatch ? null : preceededByAlternative(patch); preceededByAlternative = forcePatch ? null : preceededByAlternative(patch);
if (preceededByAlternative != null) if (preceededByAlternative != null)
{ {
report = I18NUtil.getMessage(MSG_PRECEEDED_BY_ALTERNATIVE, preceededByAlternative); report = I18NUtil.getMessage(MSG_PRECEEDED_BY_ALTERNATIVE, preceededByAlternative);
state = STATE.PRECEEDED; state = STATE.PRECEEDED;
} }
else else
{ {
if(applies) if(applies)
{ {
state = STATE.APPLYING; state = STATE.APPLYING;
} }
else else
{ {
report = I18NUtil.getMessage(MSG_NOT_RELEVANT, repoDescriptor.getSchema()); report = I18NUtil.getMessage(MSG_NOT_RELEVANT, repoDescriptor.getSchema());
state = STATE.DOES_NOT_APPLY; state = STATE.DOES_NOT_APPLY;
} }
} }
return null; return null;
} }
}, false, true); }, false, true);
} }
private void applyPatch() private void applyPatch()
{ {
if (state != STATE.APPLYING) if (state != STATE.APPLYING)
{ {
// nothing to do // nothing to do
return; return;
} }
// perform actual execution // perform actual execution
@@ -572,83 +572,83 @@ public class PatchServiceImpl implements PatchService
// dump the report to log // dump the report to log
logger.error(report); logger.error(report);
} }
} }
private void save() private void save()
{ {
if(!savePatch()) if(!savePatch())
{ {
return; return;
} }
transactionService.getRetryingTransactionHelper().doInTransaction(new RetryingTransactionCallback<Object>() transactionService.getRetryingTransactionHelper().doInTransaction(new RetryingTransactionCallback<Object>()
{ {
@Override @Override
public Object execute() throws Throwable { public Object execute() throws Throwable {
Descriptor serverDescriptor = descriptorService.getServerDescriptor(); Descriptor serverDescriptor = descriptorService.getServerDescriptor();
String server = (serverDescriptor.getVersion() + " - " + serverDescriptor.getEdition()); String server = (serverDescriptor.getVersion() + " - " + serverDescriptor.getEdition());
if (server.length() > 64) if (server.length() > 64)
{ {
logger.error("Server version '" + server + "' is too long for the 'applied_to_server' column therefore patch '" + logger.error("Server version '" + server + "' is too long for the 'applied_to_server' column therefore patch '" +
patch.getId() + "' will not be registered."); patch.getId() + "' will not be registered.");
} }
// create or update the record of execution // create or update the record of execution
boolean create = true; boolean create = true;
if (appliedPatch == null) if (appliedPatch == null)
{ {
appliedPatch = new AppliedPatch(); appliedPatch = new AppliedPatch();
appliedPatch.setId(patch.getId()); appliedPatch.setId(patch.getId());
create = true; create = true;
} }
else else
{ {
// Update it // Update it
create = false; create = false;
} }
// fill in the record's details // fill in the record's details
String patchDescription = I18NUtil.getMessage(patch.getDescription()); String patchDescription = I18NUtil.getMessage(patch.getDescription());
if (patchDescription == null) if (patchDescription == null)
{ {
logger.warn("Patch description is not available: " + patch); logger.warn("Patch description is not available: " + patch);
patchDescription = "No patch description available"; patchDescription = "No patch description available";
} }
appliedPatch.setDescription(patchDescription); appliedPatch.setDescription(patchDescription);
appliedPatch.setFixesFromSchema(patch.getFixesFromSchema()); appliedPatch.setFixesFromSchema(patch.getFixesFromSchema());
appliedPatch.setFixesToSchema(patch.getFixesToSchema()); appliedPatch.setFixesToSchema(patch.getFixesToSchema());
appliedPatch.setTargetSchema(patch.getTargetSchema()); // the schema the server is expecting appliedPatch.setTargetSchema(patch.getTargetSchema()); // the schema the server is expecting
appliedPatch.setAppliedToSchema(repoDescriptor.getSchema()); // the old schema of the repo appliedPatch.setAppliedToSchema(repoDescriptor.getSchema()); // the old schema of the repo
appliedPatch.setAppliedToServer(server); // the current version and label of the server appliedPatch.setAppliedToServer(server); // the current version and label of the server
appliedPatch.setAppliedOnDate(new Date()); // the date applied appliedPatch.setAppliedOnDate(new Date()); // the date applied
appliedPatch.setSucceeded(patchSucceeded()); // whether or not the patch succeeded appliedPatch.setSucceeded(patchSucceeded()); // whether or not the patch succeeded
appliedPatch.setWasExecuted(applies); // whether or not the patch was executed appliedPatch.setWasExecuted(applies); // whether or not the patch was executed
appliedPatch.setReport(report); // additional, human-readable, status appliedPatch.setReport(report); // additional, human-readable, status
// Update or create the entry // Update or create the entry
if (create) if (create)
{ {
appliedPatchDAO.createAppliedPatch(appliedPatch); appliedPatchDAO.createAppliedPatch(appliedPatch);
} }
else else
{ {
appliedPatchDAO.updateAppliedPatch(appliedPatch); appliedPatchDAO.updateAppliedPatch(appliedPatch);
} }
// done // done
if (logger.isDebugEnabled()) if (logger.isDebugEnabled())
{ {
logger.debug("Applied patch: \n" + appliedPatch); logger.debug("Applied patch: \n" + appliedPatch);
} }
return null; return null;
} }
}, false, true); }, false, true);
} }
public AppliedPatch getAppliedPatch() public AppliedPatch getAppliedPatch()
{ {
return appliedPatch; return appliedPatch;
} }
} }
/** /**

View File

@@ -1492,9 +1492,9 @@ public class SchemaBootstrap extends AbstractLifecycleBean
{ {
// note: enable bootstrap on MySQL Cluster NDB // note: enable bootstrap on MySQL Cluster NDB
/* /*
* WARNING: Experimental/unsupported - see AlfrescoMySQLClusterNDBDialect ! * WARNING: Experimental/unsupported - see AlfrescoMySQLClusterNDBDialect !
*/ */
sql = sql.replaceAll("(?i)TYPE=InnoDB", "ENGINE=NDB"); // belts-and-braces sql = sql.replaceAll("(?i)TYPE=InnoDB", "ENGINE=NDB"); // belts-and-braces
sql = sql.replaceAll("(?i)ENGINE=InnoDB", "ENGINE=NDB"); sql = sql.replaceAll("(?i)ENGINE=InnoDB", "ENGINE=NDB");
sql = sql.replaceAll("(?i) BIT ", " BOOLEAN "); sql = sql.replaceAll("(?i) BIT ", " BOOLEAN ");