Add still-not-working code for archiving jobs
[proteocache.git] / engine / compbio / engine / archive / ArchivedJob.java
diff --git a/engine/compbio/engine/archive/ArchivedJob.java b/engine/compbio/engine/archive/ArchivedJob.java
new file mode 100644 (file)
index 0000000..3f0f7d5
--- /dev/null
@@ -0,0 +1,44 @@
+package compbio.engine.archive;
+
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.nio.channels.Channels;
+import java.nio.channels.ReadableByteChannel;
+import java.util.List;
+
+public class ArchivedJob {
+       String path;
+       int filesize;
+       List<String> files;
+
+       ArchivedJob (String path) {
+               this.path = path;
+       }
+       
+       public boolean getArchiveFromWS() {
+               return false;
+       }
+       
+       
+       public boolean getArchiveFromWeb (String webpath) throws IOException, MalformedURLException {
+               URL website = new URL(webpath);
+               ReadableByteChannel rbc = Channels.newChannel(website.openStream());
+               FileOutputStream fos = new FileOutputStream(path);
+               fos.getChannel().transferFrom(rbc, 0, Long.MAX_VALUE);
+               return true;
+       }
+       
+       
+       public int getSize() {
+               return filesize;
+       }
+       
+       public List<String> unpack() {
+               if (null != files) {
+                       
+               }
+               return files;
+       }
+}