/** * Performs the given operations on a clean git repository */ protected <T> T gitOperation(PersonIdent personIdent, Callable<T> callable) { synchronized (lock) { try { T answer = callable.call(); return answer; } catch (Exception e) { throw new RuntimeIOException(e); } } } }
/** * Performs the given operations on a clean git repository */ protected <T> T gitOperation(PersonIdent personIdent, Callable<T> callable) { synchronized (lock) { try { T answer = callable.call(); return answer; } catch (Exception e) { throw new RuntimeIOException(e); } } } }
public static String getRelativePath(File rootDir, File file) { try { String rootPath = rootDir.getCanonicalPath(); String fullPath = file.getCanonicalPath(); if (fullPath.startsWith(rootPath)) { return fullPath.substring(rootPath.length()); } else { return fullPath; } } catch (IOException e) { throw new RuntimeIOException(e); } }
@Override public List<CommitInfo> history(String branch, String objectId, String path, int limit) { try { return doHistory(git, branch, objectId, path, limit); } catch (Exception e) { throw new RuntimeIOException(e); } }
public Status status() { try { return git.status().call(); } catch (GitAPIException e) { throw new RuntimeIOException(e); } }
public File getRootGitDirectory() { if (configDirectory == null) { try { String name = getConfigDirName(); if (Strings.isNotBlank(name)) { configDirectory = new File(name); } else { ConfigFacade singleton = ConfigFacade.getSingleton(); if (singleton != null) { File hawtioConfigDir = singleton.getConfigDirectory(); if (hawtioConfigDir.exists()) { configDirectory = new File(hawtioConfigDir, "config"); } } if (configDirectory == null) { File file = File.createTempFile("hawtio-", ""); file.delete(); configDirectory = new File(file, "config"); configDirectory.mkdirs(); } } LOG.info("hawtio using config directory: " + configDirectory); } catch (IOException e) { throw new RuntimeIOException(e); } } return configDirectory; }
throw new RuntimeIOException(e);
return buffer.toString(); } catch (IOException e) { throw new RuntimeIOException(e);