1 package compbio.engine.archive;
4 import java.io.IOException;
6 import org.apache.log4j.Logger;
8 import compbio.cassandra.CassandraNativeConnector;
9 import compbio.engine.ProteoCachePropertyHelperManager;
10 import compbio.util.PropertyHelper;
12 public class Archive {
13 private static final PropertyHelper ph = ProteoCachePropertyHelperManager.getPropertyHelper();
14 private static Logger log = Logger.getLogger(CassandraNativeConnector.class);
16 private String archivepath;
18 private boolean archiveexist;
21 * connect to the cluster and look whether all tables exist
23 public Archive() throws IOException {
24 String path = ph.getProperty("archive.path");
25 assert (null != path);
27 if (isAbsolutePath (path)) {
30 String abspath = ProteoCachePropertyHelperManager.getLocalPath();
31 archivepath = abspath + "/" + path;
33 if (!isDirExists(archivepath)) {
34 archiveexist = (new File(archivepath).mkdirs());
38 private boolean isAbsolutePath (String path) {
39 return (new File(path).isAbsolute());
42 private boolean isDirExists (String path) throws IOException {
43 archive = new File(path);
44 return archive.getCanonicalFile().isDirectory();
48 public boolean addArchivedJob (ArchivedJob job) {
52 public String createJob(String jobid) {
53 return archivepath + "/" + jobid + ".tar.gz";