use of io.fabric8.kubernetes.api.model.Context in project fabric8 by jboss-fuse.
the class DummyBatchingProgressMonitor method getVersionIds.
@Override
public List<String> getVersionIds(GitContext context) {
LockHandle readLock = aquireReadLock();
try {
assertValid();
GitOperation<List<String>> gitop = new GitOperation<List<String>>() {
public List<String> call(Git git, GitContext context) throws Exception {
List<String> result = new ArrayList<>(versions);
// we do not want to expose master branch as a version
if (result.contains(GitHelpers.MASTER_BRANCH)) {
result.remove(GitHelpers.MASTER_BRANCH);
}
Collections.sort(result, VersionSequence.getComparator());
return Collections.unmodifiableList(result);
}
};
return executeInternal(context, null, gitop);
} finally {
readLock.unlock();
}
}
use of io.fabric8.kubernetes.api.model.Context in project fabric8 by jboss-fuse.
the class FabricGitFacade method write.
@Override
public CommitInfo write(final String branch, final String path, final String commitMessage, final String authorName, final String authorEmail, final String contents) {
assertValid();
final PersonIdent personIdent = new PersonIdent(authorName, authorEmail);
return gitWriteOperation(personIdent, new GitOperation<CommitInfo>() {
public CommitInfo call(Git git, GitContext context) throws Exception {
checkoutBranch(git, branch);
File rootDir = getRootGitDirectory(git);
byte[] data = contents.getBytes();
CommitInfo answer = doWrite(git, rootDir, branch, path, data, personIdent, commitMessage);
context.commitMessage(commitMessage);
return answer;
}
});
}
use of io.fabric8.kubernetes.api.model.Context in project fabric8 by jboss-fuse.
the class FabricGitFacade method revertTo.
@Override
public void revertTo(final String branch, final String objectId, final String blobPath, final String commitMessage, final String authorName, final String authorEmail) {
assertValid();
final PersonIdent personIdent = new PersonIdent(authorName, authorEmail);
gitWriteOperation(personIdent, new GitOperation<Void>() {
public Void call(Git git, GitContext context) throws Exception {
checkoutBranch(git, branch);
File rootDir = getRootGitDirectory(git);
Void answer = doRevert(git, rootDir, branch, objectId, blobPath, commitMessage, personIdent);
context.commitMessage(commitMessage);
return answer;
}
});
}
use of io.fabric8.kubernetes.api.model.Context in project fabric8 by jboss-fuse.
the class FabricGitFacade method writeBase64.
@Override
public CommitInfo writeBase64(final String branch, final String path, final String commitMessage, final String authorName, final String authorEmail, final String contents) {
assertValid();
final PersonIdent personIdent = new PersonIdent(authorName, authorEmail);
return gitWriteOperation(personIdent, new GitOperation<CommitInfo>() {
public CommitInfo call(Git git, GitContext context) throws Exception {
checkoutBranch(git, branch);
File rootDir = getRootGitDirectory(git);
byte[] data = Base64.decode(contents);
CommitInfo answer = doWrite(git, rootDir, branch, path, data, personIdent, commitMessage);
context.commitMessage(commitMessage);
return answer;
}
});
}
use of io.fabric8.kubernetes.api.model.Context in project fabric8 by jboss-fuse.
the class FeatureConfigInstaller method restoreConfigAdminIfNeeded.
public void restoreConfigAdminIfNeeded() {
// we'll be doing confiadmin checks, so configadmin bundle has to be started and has its services registered
Bundle b = null;
try {
b = new BundleUtils(context).findBundle("org.apache.felix.configadmin");
if (b.getState() != Bundle.ACTIVE) {
b.start();
ServiceReference<ConfigurationAdmin> ref = context.getServiceReference(ConfigurationAdmin.class);
if (ref != null) {
configAdmin = context.getService(ref);
}
}
} catch (BundleException e) {
configAdmin = null;
LOGGER.warn(e.getMessage());
}
}
Aggregations