Updated Branches: refs/heads/master 307a86886 -> 0635e3bc5
calling artifact update extention after a modification happening from a pull Project: http://git-wip-us.apache.org/repos/asf/incubator-stratos/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-stratos/commit/093b2117 Tree: http://git-wip-us.apache.org/repos/asf/incubator-stratos/tree/093b2117 Diff: http://git-wip-us.apache.org/repos/asf/incubator-stratos/diff/093b2117 Branch: refs/heads/master Commit: 093b2117f979c78397868cd0297a9c0d048cb450 Parents: daa06a0 Author: Isuru <[email protected]> Authored: Fri Jan 17 17:24:19 2014 +0530 Committer: Isuru <[email protected]> Committed: Fri Jan 17 17:24:19 2014 +0530 ---------------------------------------------------------------------- .../git/impl/GitBasedArtifactRepository.java | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/093b2117/components/org.apache.stratos.cartridge.agent/src/main/java/org/apache/stratos/cartridge/agent/artifact/deployment/synchronizer/git/impl/GitBasedArtifactRepository.java ---------------------------------------------------------------------- diff --git a/components/org.apache.stratos.cartridge.agent/src/main/java/org/apache/stratos/cartridge/agent/artifact/deployment/synchronizer/git/impl/GitBasedArtifactRepository.java b/components/org.apache.stratos.cartridge.agent/src/main/java/org/apache/stratos/cartridge/agent/artifact/deployment/synchronizer/git/impl/GitBasedArtifactRepository.java index e8fe5c6..3500b02 100644 --- a/components/org.apache.stratos.cartridge.agent/src/main/java/org/apache/stratos/cartridge/agent/artifact/deployment/synchronizer/git/impl/GitBasedArtifactRepository.java +++ b/components/org.apache.stratos.cartridge.agent/src/main/java/org/apache/stratos/cartridge/agent/artifact/deployment/synchronizer/git/impl/GitBasedArtifactRepository.java @@ -26,6 +26,7 @@ import org.apache.stratos.cartridge.agent.artifact.deployment.synchronizer.git.i import org.apache.stratos.cartridge.agent.artifact.deployment.synchronizer.git.internal.GitDeploymentSynchronizerConstants; import org.apache.stratos.cartridge.agent.artifact.deployment.synchronizer.git.internal.RepositoryContext; import org.apache.stratos.cartridge.agent.artifact.deployment.synchronizer.git.util.Utilities; +import org.apache.stratos.cartridge.agent.util.ExtensionUtils; import org.eclipse.jgit.api.*; import org.eclipse.jgit.api.errors.*; import org.eclipse.jgit.lib.Ref; @@ -519,7 +520,17 @@ public class GitBasedArtifactRepository { } try { - pullCmd.call(); + PullResult pullResult = pullCmd.call(); + // check if we have received any updates + if (!pullResult.getFetchResult().getTrackingRefUpdates().isEmpty()) { + if (log.isDebugEnabled()) { + log.debug("Artifacts were updated as a result of the pull operation, thread: " + Thread.currentThread().getName() + " - " + + Thread.currentThread().getId()); + } + + // execute artifact update extension + ExtensionUtils.executeArtifactsUpdatedExtension(); + } } catch (InvalidConfigurationException e) { log.warn("Git pull unsuccessful for tenant " + gitRepoCtx.getTenantId() + ", " + e.getMessage()); @@ -527,6 +538,8 @@ public class GitBasedArtifactRepository { //return false; Utilities.deleteFolderStructure(new File(gitRepoCtx.getGitLocalRepoPath())); cloneRepository(gitRepoCtx); + // execute artifact update extension + ExtensionUtils.executeArtifactsUpdatedExtension(); return true; } catch (JGitInternalException e) { @@ -542,6 +555,8 @@ public class GitBasedArtifactRepository { log.warn("Git pull for the path " + e.getConflictingPaths().toString() + " failed due to conflicts"); Utilities.deleteFolderStructure(new File(gitRepoCtx.getGitLocalRepoPath())); cloneRepository(gitRepoCtx); + // execute artifact update extension + ExtensionUtils.executeArtifactsUpdatedExtension(); return true; } catch (GitAPIException e) {
