X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=engine%2Fcompbio%2Fengine%2Farchive%2FArchive.java;fp=engine%2Fcompbio%2Fengine%2Farchive%2FArchive.java;h=a5d3ddd5b437987e8813ed068bc7c453eddc1ef8;hb=43a2a57fb10f89d0130960f43d136cff1fd56c59;hp=2a1f4101fc446e33f94383bb93ff89dcf3475f92;hpb=ecbf46c1d769d120b2dc5ba57325f1d9e9d3c6b9;p=proteocache.git diff --git a/engine/compbio/engine/archive/Archive.java b/engine/compbio/engine/archive/Archive.java index 2a1f410..a5d3ddd 100644 --- a/engine/compbio/engine/archive/Archive.java +++ b/engine/compbio/engine/archive/Archive.java @@ -1,5 +1,56 @@ package compbio.engine.archive; +import java.io.File; +import java.io.IOException; + +import org.apache.log4j.Logger; + +import compbio.cassandra.CassandraNativeConnector; +import compbio.engine.ProteoCachePropertyHelperManager; +import compbio.util.PropertyHelper; + public class Archive { + private static final PropertyHelper ph = ProteoCachePropertyHelperManager.getPropertyHelper(); + private static Logger log = Logger.getLogger(CassandraNativeConnector.class); + + private String archivepath; + private File archive; + private boolean archiveexist; + + /* + * connect to the cluster and look whether all tables exist + */ + public Archive() throws IOException { + String path = ph.getProperty("archive.path"); + assert (null != path); + + if (isAbsolutePath (path)) { + archivepath = path; + } else { + String abspath = ProteoCachePropertyHelperManager.getLocalPath(); + archivepath = abspath + "/" + path; + } + if (!isDirExists(archivepath)) { + archiveexist = (new File(archivepath).mkdirs()); + } + } + + private boolean isAbsolutePath (String path) { + return (new File(path).isAbsolute()); + } + + private boolean isDirExists (String path) throws IOException { + archive = new File(path); + return archive.getCanonicalFile().isDirectory(); + } + + + public boolean addArchivedJob (ArchivedJob job) { + return true; + } + + public String createJob(String jobid) { + return archivepath + "/" + jobid + ".tar.gz"; + } }