@Override public Future<BuildResult> enqueueBuild( UserIdentity committer, Repository repository, String sha1, String command, boolean force) throws Exception { if (!shouldBuild(repository, sha1, force)) { return null; } Pair<Repository, String> target = new Pair<Repository, String>(findBuildPlace(repository), sha1); Task<BuildResult> task = builder.get(committer, repository, target, command); Key k = pipeline.submit(task); tracker.put(k, target); return pipeline.getFuture(k); }
@Override public void removeCallback(BuildLifeCycleListener callback) { DelegateListener listener = callbackDelegates.remove(callback); if (listener != null) { pipeline.removeListener(listener); } }
private Collection<Pair<Repository, String>> get(Filter filter) { List<Key> keys = pipeline.list(filter); Collection<Pair<Repository, String>> pairs = new ArrayList<Pair<Repository, String>>(); for (Key k : keys) { Pair<Repository, String> pair = tracker.get(k); if (pair != null) { pairs.add(pair); } } return pairs; }
@Override public void addCallback(BuildLifeCycleListener callback) { DelegateListener delegate = new DelegateListener(callback); callbackDelegates.put(callback, delegate); pipeline.addListener(delegate); }