All Genetegrate code. The folders are as follows:

sks2142 [2007-06-26 11:02:59]
All Genetegrate code. The folders are as follows:
1.geneWKspace - the eclipse workspace for all the code
2.GRA - all my gra stuff - the theoretical analysis, etc.
3.netblast-install - various installers for netblast
4.report - the pdf and odt versions of the report
Filename
geneWKspace/Genetegrate/client/CPUTorrentRMIInterface.class
geneWKspace/Genetegrate/client/CPUTorrentRMIInterface.java
geneWKspace/Genetegrate/client/CPUTorrentRMIServer_Stub.class
geneWKspace/Genetegrate/client/SubmitJob.class
geneWKspace/Genetegrate/client/SubmitJob.java
geneWKspace/Genetegrate/client/TestRMIClient.class
geneWKspace/Genetegrate/client/TestRMIClient.java
geneWKspace/Genetegrate/gaia_versions/Servers.xml
geneWKspace/Genetegrate/gaia_versions/Simple.conf
geneWKspace/Genetegrate/middleware/CPUTorrentRMIServer.class
geneWKspace/Genetegrate/middleware/CPUTorrentRMIServer.java
geneWKspace/Genetegrate/middleware/CPUTorrentRMIServer_Stub.class
geneWKspace/Genetegrate/middleware/PolicyManager.class
geneWKspace/Genetegrate/middleware/PolicyManager.java
geneWKspace/Genetegrate/middleware/QueueManager.class
geneWKspace/Genetegrate/middleware/QueueManager.java
geneWKspace/Genetegrate/middleware/QueueProcessor.class
geneWKspace/Genetegrate/middleware/QueueProcessor.java
geneWKspace/Genetegrate/middleware/Simple.conf
geneWKspace/Genetegrate/services/ParamsFetch.class
geneWKspace/Genetegrate/services/ParamsFetch.java
geneWKspace/Genetegrate/services/ParamsObject.class
geneWKspace/Genetegrate/services/ParamsObject.java
geneWKspace/Genetegrate/services/ServerFetch.class
geneWKspace/Genetegrate/services/ServerFetch.java
geneWKspace/Genetegrate/services/ServerObject.class
geneWKspace/Genetegrate/services/ServerObject.java
geneWKspace/Genetegrate/services/Servers.xml
geneWKspace/Genetegrate/services/Services.xml
geneWKspace/Genetegrate/source/.InvokeSGEBlast.java.swp
geneWKspace/Genetegrate/source/InvokeNetBlast$killBlast.class
geneWKspace/Genetegrate/source/InvokeNetBlast.class
geneWKspace/Genetegrate/source/InvokeNetBlast.java
geneWKspace/Genetegrate/source/InvokeSGEBlast$killBlast.class
geneWKspace/Genetegrate/source/InvokeSGEBlast.class
geneWKspace/Genetegrate/source/InvokeSGEBlast.java
geneWKspace/Genetegrate/source/Invoker.class
geneWKspace/Genetegrate/source/Invoker.java
geneWKspace/Genetegrate/source/Job.class
geneWKspace/Genetegrate/source/Job.java
diff --git a/geneWKspace/Genetegrate/client/CPUTorrentRMIInterface.class b/geneWKspace/Genetegrate/client/CPUTorrentRMIInterface.class
new file mode 100644
index 0000000..7588f43
Binary files /dev/null and b/geneWKspace/Genetegrate/client/CPUTorrentRMIInterface.class differ
diff --git a/geneWKspace/Genetegrate/client/CPUTorrentRMIInterface.java b/geneWKspace/Genetegrate/client/CPUTorrentRMIInterface.java
new file mode 100644
index 0000000..ff20817
--- /dev/null
+++ b/geneWKspace/Genetegrate/client/CPUTorrentRMIInterface.java
@@ -0,0 +1,36 @@
+package client;
+
+import java.rmi.Remote;
+import java.rmi.RemoteException;
+
+/**
+ * RMI Interface for CPU Torrent
+ * This Interface provides the set of functions to be implemented by the RMI Server for providing the APIs to Genetegrate/PredictProtein
+ * @author swapneelsheth
+ */
+public interface CPUTorrentRMIInterface extends Remote {
+
+	/**
+	 * Submit a Job to CPU Torrent.
+	 * @param fastaFile The FASTA File to run the Blast Job on.
+	 * @return A string representing the id for the job
+	 * @throws RemoteException
+	 */
+	public String submit(byte[] fastaFile) throws RemoteException;
+
+	/**
+	 * Get the Status of a Job
+	 * @param jobId The Id of the Job to get the status for
+	 * @return Status Code
+	 * @throws RemoteException
+	 */
+	public int getStatus(String jobId) throws RemoteException;
+
+	/**
+	 * Gets the results of a blast operation
+	 * @param jobId The Id of the Job to get the results for
+	 * @return a byte array containing the results
+	 * @throws RemoteException
+	 */
+	public byte[] getResult(String jobId) throws RemoteException;
+}
diff --git a/geneWKspace/Genetegrate/client/CPUTorrentRMIServer_Stub.class b/geneWKspace/Genetegrate/client/CPUTorrentRMIServer_Stub.class
new file mode 100644
index 0000000..e4b1500
Binary files /dev/null and b/geneWKspace/Genetegrate/client/CPUTorrentRMIServer_Stub.class differ
diff --git a/geneWKspace/Genetegrate/client/SubmitJob.class b/geneWKspace/Genetegrate/client/SubmitJob.class
new file mode 100644
index 0000000..6ad29ea
Binary files /dev/null and b/geneWKspace/Genetegrate/client/SubmitJob.class differ
diff --git a/geneWKspace/Genetegrate/client/SubmitJob.java b/geneWKspace/Genetegrate/client/SubmitJob.java
new file mode 100644
index 0000000..325afae
--- /dev/null
+++ b/geneWKspace/Genetegrate/client/SubmitJob.java
@@ -0,0 +1,24 @@
+/**
+ *
+ */
+package client;
+
+/**
+ * Class that submits jobs to the RMI server.
+ * @author aaronfernandes
+ *
+ */
+public class SubmitJob {
+
+	/**
+	 * @param args
+	 */
+	public static void main(String[] args) {
+		for (int i=1;i<=5;i++) {	// submit individual jobs.
+			new TestRMIClient("fasta" + i + ".f").start();
+		}
+
+		// done submitting jobs.
+	}
+
+}
diff --git a/geneWKspace/Genetegrate/client/TestRMIClient.class b/geneWKspace/Genetegrate/client/TestRMIClient.class
new file mode 100644
index 0000000..d87204a
Binary files /dev/null and b/geneWKspace/Genetegrate/client/TestRMIClient.class differ
diff --git a/geneWKspace/Genetegrate/client/TestRMIClient.java b/geneWKspace/Genetegrate/client/TestRMIClient.java
new file mode 100644
index 0000000..95ab3ab
--- /dev/null
+++ b/geneWKspace/Genetegrate/client/TestRMIClient.java
@@ -0,0 +1,90 @@
+package client;
+
+import java.io.BufferedReader;
+import java.io.FileReader;
+import java.io.FileWriter;
+import java.rmi.*;
+
+/**
+ * Client to test the RMI Server for CPU Torrent
+ * @author swapneelsheth
+ */
+public class TestRMIClient extends Thread {
+
+	String fastaFile; 	// stores the filename in which the fasta sequence is stored.
+	/**
+	 * @param args
+	 */
+	TestRMIClient (String file) {
+		fastaFile = file;
+	}
+
+	// Do what is needed to submit the job to the client.
+
+	public void run() {
+		try {
+			CPUTorrentRMIInterface cpu = (CPUTorrentRMIInterface) Naming.lookup("rmi://localhost:1099/CPUTorrent");
+
+
+			/**
+			 * Submitting the fasta file for blasting.
+			 */
+
+			BufferedReader br = new BufferedReader(new FileReader(fastaFile));
+			String line;
+			StringBuffer sb = new StringBuffer();
+			while ((line = br.readLine()) != null) {
+				sb.append(line + "\n");
+			}
+			byte[] byteFastaFile = sb.toString().getBytes();
+			String jid = cpu.submit(byteFastaFile);
+			System.out.println("Submitted Job id:" + jid);
+
+
+			// Check whether the job has completed.
+
+			while (true) {
+				Thread.sleep(3*1000);
+				/**
+				 * checking status of jobs.
+				 */
+				int status;
+
+
+				status = cpu.getStatus(jid);
+
+				// If the job has completed, then break out of the loop.
+				if (status == source.Job.BLASTED || status == source.Job.FAILED) {
+					System.out.println("------------------------------");
+					System.out.println("job " + jid + " completed with status " + status);
+					break;
+				}
+				else
+					System.out.println("Status of job " + jid + " is: " + status);
+			}
+
+
+
+
+			// Get the results for the job.
+
+
+			byte[] result = cpu.getResult(jid);
+			String name = "ClientCopy" + jid + ".blastpgp";
+			FileWriter fw = null;
+			try {
+				fw = new FileWriter(name);
+				String stuff = new String(result);
+				fw.write(stuff);
+				fw.close();
+			} catch(java.io.IOException ie) {
+				System.out.println("Client: Error writing to file");
+				ie.printStackTrace();
+			}
+
+		} catch (Exception e) {
+			e.printStackTrace();
+		}
+	}
+
+}
diff --git a/geneWKspace/Genetegrate/gaia_versions/Servers.xml b/geneWKspace/Genetegrate/gaia_versions/Servers.xml
new file mode 100644
index 0000000..f9319d4
--- /dev/null
+++ b/geneWKspace/Genetegrate/gaia_versions/Servers.xml
@@ -0,0 +1,8 @@
+<servers>
+<server id="0" name="ncbi netblast"><parameters><parameter required="true" name="classname">InvokeNetBlast</parameter><parameter required="true" name="command">/nfs/home1/ssheth/netblast-2.2.16/bin/blastcl3</parameter><parameter required="false" name="program">blastp</parameter></parameters>
+</server>
+<server id="1" name="SGE Blast"><parameters><parameter required="true"
+name="classname">InvokeSGEBlast</parameter><parameter required="true"
+name="command">/usr/pub/molbio/perl/blastpgp.pl</parameter><parameter required="false" name="maxali">3000</parameter><parameter required="true" name="program">/opt/sge/bin/lx26-amd64/qsub</parameter><parameter required="false" name="priority">0.01</parameter></parameters>
+</server>
+</servers>
diff --git a/geneWKspace/Genetegrate/gaia_versions/Simple.conf b/geneWKspace/Genetegrate/gaia_versions/Simple.conf
new file mode 100644
index 0000000..85a570f
--- /dev/null
+++ b/geneWKspace/Genetegrate/gaia_versions/Simple.conf
@@ -0,0 +1,3 @@
+0:0.5
+1:0.5
+2:0
diff --git a/geneWKspace/Genetegrate/middleware/CPUTorrentRMIServer.class b/geneWKspace/Genetegrate/middleware/CPUTorrentRMIServer.class
new file mode 100644
index 0000000..49bae73
Binary files /dev/null and b/geneWKspace/Genetegrate/middleware/CPUTorrentRMIServer.class differ
diff --git a/geneWKspace/Genetegrate/middleware/CPUTorrentRMIServer.java b/geneWKspace/Genetegrate/middleware/CPUTorrentRMIServer.java
new file mode 100644
index 0000000..9f61d46
--- /dev/null
+++ b/geneWKspace/Genetegrate/middleware/CPUTorrentRMIServer.java
@@ -0,0 +1,45 @@
+package middleware;
+
+import java.rmi.*;
+import java.rmi.server.*;
+
+/**
+ * RMI Server for CPU Torrent
+ * @author swapneelsheth
+ */
+public class CPUTorrentRMIServer extends UnicastRemoteObject implements client.CPUTorrentRMIInterface {
+
+	QueueManager qm;
+
+	public CPUTorrentRMIServer() throws RemoteException {
+		qm = new QueueManager();
+	}
+
+	public String submit(byte[] fastaFile) throws RemoteException {
+		return(qm.addJob(fastaFile));
+	}
+
+	/**
+	 * @param args
+	 */
+	public static void main(String[] args) {
+		try {
+			CPUTorrentRMIServer cpu = new CPUTorrentRMIServer();
+
+			//Change the server binding details here if needed
+			Naming.rebind("rmi://localhost:1099/CPUTorrent", cpu);
+			System.out.println("RMI Server: Server Registered");
+		} catch (Exception e) {
+			e.printStackTrace();
+		}
+
+	}
+
+	public byte[] getResult(String jobId) throws RemoteException {
+		return(qm.getResult(jobId));
+	}
+
+	public int getStatus(String jobId) throws RemoteException {
+		return(qm.getStatus(jobId));
+	}
+}
diff --git a/geneWKspace/Genetegrate/middleware/CPUTorrentRMIServer_Stub.class b/geneWKspace/Genetegrate/middleware/CPUTorrentRMIServer_Stub.class
new file mode 100644
index 0000000..e4b1500
Binary files /dev/null and b/geneWKspace/Genetegrate/middleware/CPUTorrentRMIServer_Stub.class differ
diff --git a/geneWKspace/Genetegrate/middleware/PolicyManager.class b/geneWKspace/Genetegrate/middleware/PolicyManager.class
new file mode 100644
index 0000000..e0b2b3a
Binary files /dev/null and b/geneWKspace/Genetegrate/middleware/PolicyManager.class differ
diff --git a/geneWKspace/Genetegrate/middleware/PolicyManager.java b/geneWKspace/Genetegrate/middleware/PolicyManager.java
new file mode 100644
index 0000000..69f557b
--- /dev/null
+++ b/geneWKspace/Genetegrate/middleware/PolicyManager.java
@@ -0,0 +1,70 @@
+package middleware;
+
+import java.io.BufferedReader;
+import java.io.FileReader;
+
+/**
+ * Policy Manager for CPU Torrent
+ * @author swapneelsheth
+ */
+public class PolicyManager {
+
+	/**
+	 * 2-D Array of servers - id, ratio pairs (The ratio refers to what fraction of the computation should be sent to this particular server)
+	 */
+	private String[] serverName;
+	private float[] serverProb;
+	private String configFile;
+
+	/**
+	 * The Max No of Servers in the System
+	 */
+	private int MAX = 10;
+
+	/**
+	 * Constructor
+	 */
+	public PolicyManager(String configFile) {
+		serverName = new String[MAX];
+		serverProb = new float[MAX];
+		this.configFile = configFile;
+	}
+
+	/**
+	 * This method returns the Server to be chosen from a Random Distribution according to the Configuration File
+	 * @return The name of the Server chosen
+	 */
+	String getServer() {
+		double rand = Math.random();
+		float val = 0;
+		for (int i = 0; i < MAX; i++) {
+			val += serverProb[i];
+			if (rand < val) {
+				return serverName[i];
+			}
+		}
+		return null;
+	}
+
+	/**
+	 * Loads the Configuration File
+	 * @param fileName The Configuration File
+	 */
+	void loadFile() {
+		try {
+			FileReader fr = new FileReader(configFile);
+			BufferedReader br = new BufferedReader(fr);
+			String temp;
+			int count = 0;
+			while ((temp = br.readLine()) != null && count < MAX) {
+				String[] arr = temp.split(":");
+				serverName[count] = arr[0];
+				serverProb[count] = Float.parseFloat(arr[1]);
+				count++;
+			}
+		} catch (Exception e) {
+			e.printStackTrace();
+		}
+
+	}
+}
diff --git a/geneWKspace/Genetegrate/middleware/QueueManager.class b/geneWKspace/Genetegrate/middleware/QueueManager.class
new file mode 100644
index 0000000..a679c57
Binary files /dev/null and b/geneWKspace/Genetegrate/middleware/QueueManager.class differ
diff --git a/geneWKspace/Genetegrate/middleware/QueueManager.java b/geneWKspace/Genetegrate/middleware/QueueManager.java
new file mode 100644
index 0000000..8b0f142
--- /dev/null
+++ b/geneWKspace/Genetegrate/middleware/QueueManager.java
@@ -0,0 +1,182 @@
+/**
+ * @author swapneelsheth, aaron
+ * Queue Manager class which manages the Queuing
+ */
+
+package middleware;
+
+import java.io.BufferedReader;
+import java.io.FileReader;
+import java.util.Hashtable;
+
+import source.Job;
+
+public class QueueManager {
+	PolicyManager pm;
+	QueueProcessor qp;
+	static Hashtable<String, Job> queue;
+	private static byte MAX_RETRIES = 5;
+	private static int notifyCounter;
+
+	/**
+	 * Constructor
+	 */
+	public QueueManager() {
+		queue = new Hashtable<String, Job>();
+		pm = new PolicyManager("middleware/Simple.conf");
+		qp = new QueueProcessor(getQueue(), pm);
+		qp.start();
+	}
+
+	/**
+	 * @return the queue
+	 */
+	public Hashtable<String,Job> getQueue() {
+		return queue;
+	}
+
+	/**
+	 * Adds a job to the queue
+	 * @param fastaSequence the sequence
+	 * @return the id of the job in the queue
+	 */
+	String addJob(byte[] fastaSequence) {
+		String fastaString = new String(fastaSequence);
+		String jid;
+		/**
+		 * Create a new job and add it to the queue.
+		 */
+
+		synchronized(queue) {
+			int id = queue.size();
+			jid = new Integer(id).toString();
+			Job j = new Job(jid, fastaString);
+			queue.put(jid,j);
+			System.out.println("Q Manager: Job " + jid + " added");
+			System.out.println("Q Manager: size of queue:" + queue.size());
+			//queue.notify();
+			notifyQProcessor();
+		}
+
+		return(jid);
+	}
+
+	/**
+	 * Gets the results of a blast operation
+	 * @param jid the job to be queried for
+	 * @return The results of the blast operation
+	 */
+	byte[] getResult(String jid) {
+		if (jid == null) {
+			return(new String("Illegal Job").getBytes());
+		}
+		Job j;
+		String resultFileName = null;
+		synchronized(queue) {
+
+			j = (Job)queue.get(jid);
+			if (j==null) {
+				return(new String("Job not found").getBytes());
+			}
+			else if (j.getStatus() == source.Job.BLASTED) {
+				j = (Job)queue.remove(jid);
+				resultFileName = jid + ".blastpgp";
+			} else if (j.getStatus() == source.Job.FAILED) {
+				queue.remove(jid);
+				return (new String("Failed").getBytes());
+			} else return (new String("Processing").getBytes());
+		}
+
+
+		// read results from the file and return them.
+		if (resultFileName != null) {
+			StringBuffer sb = new StringBuffer();
+			String temp;
+
+			try {
+				FileReader fr = new FileReader(resultFileName);
+				BufferedReader br = new BufferedReader(fr);
+
+				while((temp = br.readLine()) != null) {
+					sb.append(temp + "\n");
+				}
+				//	 Deleting file with the results as the user has already read them.
+				br.close();
+				fr.close();
+				java.io.File f = new java.io.File(resultFileName);
+				if (f.exists()) {
+					f.delete();
+				}
+			} catch(java.io.IOException ie) {
+				ie.printStackTrace();
+			}
+			return(sb.toString().getBytes());
+		}
+		else {
+			return(new String("Error").getBytes());
+		}
+
+	}
+
+	/**
+	 * Get the job status
+	 * @param jid the job whose status is to be returned
+	 * @return the status code
+	 */
+	int getStatus(String jid) {
+		Job j;
+
+		synchronized(queue) {
+			j = queue.get(jid);
+		}
+		return(j.getStatus());
+	}
+
+	/**
+	 * Notifies the queuemanager of a job failure
+	 * @param j the failed job
+	 */
+
+	public static void notifyJobFailure(Job j) {
+		int retries = (int) j.getNumRetries();
+		retries++;
+
+		//No. of Retries have exceeded - dont try to execute the job anymore. Set status to failed.
+		if (retries >= MAX_RETRIES) {
+			// Set job status to failed.
+
+			j.setStatus(source.Job.FAILED);
+		} else {
+			j.setNumRetries((byte) retries);
+			j.setStatus(Job.NEW);
+			synchronized (queue) {
+				notifyQProcessor();
+			}
+		}
+	}
+
+	/**
+	 * Notifies the queue processor to process jobs in the queue
+	 *
+	 */
+	public static void notifyQProcessor() {
+		notifyCounter++;
+		synchronized(queue) {
+			queue.notify();
+		}
+	}
+
+	/**
+	 * Decrements the notify counter.
+	 *
+	 */
+
+	public static void decrementNotifyCounter() {
+		notifyCounter--;
+	}
+
+
+	public static int getNotifyCounter() {
+		return notifyCounter;
+	}
+}
diff --git a/geneWKspace/Genetegrate/middleware/QueueProcessor.class b/geneWKspace/Genetegrate/middleware/QueueProcessor.class
new file mode 100644
index 0000000..4341c6d
Binary files /dev/null and b/geneWKspace/Genetegrate/middleware/QueueProcessor.class differ
diff --git a/geneWKspace/Genetegrate/middleware/QueueProcessor.java b/geneWKspace/Genetegrate/middleware/QueueProcessor.java
new file mode 100644
index 0000000..2851644
--- /dev/null
+++ b/geneWKspace/Genetegrate/middleware/QueueProcessor.java
@@ -0,0 +1,109 @@
+/**
+ * @author swapneelsheth, aaron
+ * Queue Processor which processes the queue
+ */
+
+package middleware;
+
+import java.lang.reflect.Constructor;
+import java.util.Hashtable;
+import java.util.Iterator;
+
+import source.Job;
+
+public class QueueProcessor extends Thread {
+	Hashtable<String, Job> queue;
+	PolicyManager pm;
+
+	/**
+	 * Constructor
+	 * @param queue job queue
+	 * @param pm the policy manager
+	 */
+	public QueueProcessor(Hashtable<String, Job> queue, PolicyManager pm) {
+		this.queue = queue;
+		this.pm = pm;
+
+		// Move the loadfile part to a more suitable section.
+		pm.loadFile();
+	}
+
+	/**
+	 * Logic to run the blast jobs on NIH or GAiA
+	 */
+	public void run() {
+
+		while (true) {
+
+			synchronized(queue) {
+				int notifyCounter = QueueManager.getNotifyCounter();
+				if (notifyCounter <= 0) {		// We don't have any queued notifies - so wait on the monitor.
+					try {
+						queue.wait();
+					} catch (InterruptedException e) {
+						e.printStackTrace();
+					}
+				}
+				if (notifyCounter > 0) { 	// Decrement counter
+					QueueManager.decrementNotifyCounter();
+				}
+				if (queue.size() > 0) {
+
+					Iterator queueItr = queue.keySet().iterator();
+
+					while (queueItr.hasNext()) {
+						/**
+						 * 1. Go through the queue.
+						 * 2. If the job has been blasted, send it back to client.
+						 * 3. Else, if job is new, then blast it and update status to blasting.
+						 * 4.
+						 */
+
+						String key = (String)queueItr.next();
+
+						Job j = (Job)queue.get(key);
+						switch(j.getStatus()){
+						case Job.NEW:
+							//decide where to send. Send it. Update status to Blasting
+
+							String serverId = pm.getServer();
+							//System.out.println(serverId);
+
+
+							System.out.println("Queue processor: sending job to server: " + serverId);
+							j.setStatus(source.Job.BLASTING);
+							services.ParamsObject params = services.ParamsFetch.parms_lookup(serverId);
+							Hashtable<String, String> reqdParams = params.getAllRequiredParms();
+							Hashtable<String, String> optParams = params.getAllOptionalParms();
+
+							String className = reqdParams.get("classname");
+
+							try {
+									Class theClass = Class.forName("source." + className);
+									Constructor<source.Invoker>[] cons = theClass.getConstructors();
+									if (cons.length != 0) {
+										((source.Invoker)cons[0].newInstance(j, reqdParams, optParams)).start();
+									}
+
+								} catch (Exception e) {
+									e.printStackTrace();
+								}
+
+
+							break;
+
+						case Job.BLASTING:
+							// as of now, wait .. Do we need timeout here too?
+							break;
+						case Job.BLASTED:
+							// nothing. Wait to be pinged to return value
+							break;
+						case Job.FAILED:
+							break;
+						}
+					}
+				}
+			}
+		}
+	}
+}
diff --git a/geneWKspace/Genetegrate/middleware/Simple.conf b/geneWKspace/Genetegrate/middleware/Simple.conf
new file mode 100644
index 0000000..142748f
--- /dev/null
+++ b/geneWKspace/Genetegrate/middleware/Simple.conf
@@ -0,0 +1,3 @@
+0:1.0
+1:0
+2:0
diff --git a/geneWKspace/Genetegrate/services/ParamsFetch.class b/geneWKspace/Genetegrate/services/ParamsFetch.class
new file mode 100644
index 0000000..f4d4037
Binary files /dev/null and b/geneWKspace/Genetegrate/services/ParamsFetch.class differ
diff --git a/geneWKspace/Genetegrate/services/ParamsFetch.java b/geneWKspace/Genetegrate/services/ParamsFetch.java
new file mode 100644
index 0000000..8963815
--- /dev/null
+++ b/geneWKspace/Genetegrate/services/ParamsFetch.java
@@ -0,0 +1,88 @@
+/**
+ * Fetches the necessary parameters from Servers.xml file.
+ */
+package services;
+
+import java.io.FileInputStream;
+import java.io.IOException;
+
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.parsers.ParserConfigurationException;
+
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.NodeList;
+import org.xml.sax.SAXException;
+
+import com.sun.org.apache.xpath.internal.XPathAPI;
+
+
+public class ParamsFetch {
+	private static String fileName_by_Server = "services/Servers.xml";		// Contains the name of the xml database that specifies how THE service must be invoked on
+													// a server.
+	/**
+	 * Looks up a server for the various service execution parameters.
+	 * @param serverid the id of the service to be executed.
+	 * @return The required and optional parameters.
+	 */
+	public static ParamsObject parms_lookup(String serverid) {
+		ParamsObject po = new ParamsObject();
+		try {
+			DocumentBuilderFactory docBuilderFactory = DocumentBuilderFactory
+					.newInstance();
+
+			DocumentBuilder docBuilder;
+
+			docBuilder = docBuilderFactory.newDocumentBuilder();
+
+			Document doc = docBuilder.parse(new FileInputStream(fileName_by_Server));
+			Element documentRoot = doc.getDocumentElement();
+			NodeList matchedNodes = null;
+			String query = "";
+			try {
+				query = "//*/server";
+				matchedNodes = XPathAPI.selectNodeList(documentRoot, query);
+				if (matchedNodes != null) {
+
+					for (int j = 0; j < matchedNodes.getLength(); j++) {
+
+						if (matchedNodes.item(j) != null){
+
+							if(matchedNodes.item(j).getAttributes() != null){
+
+								if(matchedNodes.item(j).getAttributes().item(0).getNodeValue() != null && matchedNodes.item(j).getAttributes().item(0).getNodeValue().equals(serverid)){
+									// Found a match with the server id.
+								NodeList nl = matchedNodes.item(j).getFirstChild().getChildNodes();
+
+								for (int t = 0; t < nl.getLength(); t++) {
+									//System.out.println("id: " + nl.item(t).getAttributes().item(0).getNodeValue() + " "+nl.item(t).getFirstChild().getNodeValue());
+
+									if(nl.item(t).getAttributes().item(1).getNodeValue().equalsIgnoreCase("true")){
+										po.allRequiredParms.put(nl.item(t).getAttributes().item(0).getNodeValue(), nl.item(t).getFirstChild().getNodeValue());
+									}else{
+										po.allOptionalParms.put(nl.item(t).getAttributes().item(0).getNodeValue(), nl.item(t).getFirstChild().getNodeValue());
+									}
+
+								}
+							}
+
+							}
+						}
+					}
+				}
+			} catch (Exception e) {
+				System.out.println("ERROR" + e.getMessage());
+				e.printStackTrace();
+
+			}
+		} catch (ParserConfigurationException e1) {
+			e1.printStackTrace();
+		} catch (SAXException e) {
+			e.printStackTrace();
+		} catch (IOException e) {
+			e.printStackTrace();
+		}
+		return po;
+	}
+}
diff --git a/geneWKspace/Genetegrate/services/ParamsObject.class b/geneWKspace/Genetegrate/services/ParamsObject.class
new file mode 100644
index 0000000..6eefb17
Binary files /dev/null and b/geneWKspace/Genetegrate/services/ParamsObject.class differ
diff --git a/geneWKspace/Genetegrate/services/ParamsObject.java b/geneWKspace/Genetegrate/services/ParamsObject.java
new file mode 100644
index 0000000..abcaeec
--- /dev/null
+++ b/geneWKspace/Genetegrate/services/ParamsObject.java
@@ -0,0 +1,26 @@
+/*
+ * The object in which the required and optional parameters are stored for the services.
+ */
+package services;
+/*
+ *
+ * author Shruti Gandhi
+ */
+import java.util.Hashtable;
+
+public class ParamsObject {
+	Hashtable<String, String> allOptionalParms= new Hashtable<String, String>();
+	Hashtable<String, String> allRequiredParms= new Hashtable<String, String>();
+	/**
+	 * @return the allOptionalParms
+	 */
+	public Hashtable<String, String> getAllOptionalParms() {
+		return allOptionalParms;
+	}
+	/**
+	 * @return the allRequiredParms
+	 */
+	public Hashtable<String, String> getAllRequiredParms() {
+		return allRequiredParms;
+	}
+}
diff --git a/geneWKspace/Genetegrate/services/ServerFetch.class b/geneWKspace/Genetegrate/services/ServerFetch.class
new file mode 100644
index 0000000..48610c5
Binary files /dev/null and b/geneWKspace/Genetegrate/services/ServerFetch.class differ
diff --git a/geneWKspace/Genetegrate/services/ServerFetch.java b/geneWKspace/Genetegrate/services/ServerFetch.java
new file mode 100644
index 0000000..e75c659
--- /dev/null
+++ b/geneWKspace/Genetegrate/services/ServerFetch.java
@@ -0,0 +1,126 @@
+/*
+ * Object to fetch the servers serving a given service.
+ */
+package services;
+import java.io.FileInputStream;
+import java.io.IOException;
+
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.parsers.ParserConfigurationException;
+
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.NodeList;
+import org.xml.sax.SAXException;
+
+import com.sun.org.apache.xpath.internal.XPathAPI;
+
+
+public class ServerFetch {
+	static String fileName_by_Server = "services/Services.xml";			// This file contains the xml database of the various servers offering different services.
+														// Services.xml
+	public static void main(String[] args) throws Exception {
+		try {
+			fileName_by_Server = args[0];
+
+		} catch (Exception ex) {
+
+		}
+
+
+		server_lookup("xyz");
+
+	}
+
+	/**
+	 * Looks up a particular service, giving the servers that offer it
+	 * @param serviceName the name of the service
+	 * @return A collection of servers that offer the given service
+	 */
+	public static ServerObject server_lookup(String serviceName) {
+		ServerObject po = new ServerObject();
+		try {
+			// XML setup.
+			DocumentBuilderFactory docBuilderFactory = DocumentBuilderFactory
+			.newInstance();
+
+			DocumentBuilder docBuilder;
+
+			docBuilder = docBuilderFactory.newDocumentBuilder();
+
+			Document doc = docBuilder.parse(new FileInputStream(fileName_by_Server));
+			Element documentRoot = doc.getDocumentElement();
+			NodeList matchedNodes = null;
+			String query = "";
+			try {
+				query = "//*/service";
+
+				// Looking for the "service" tags.
+
+				matchedNodes = XPathAPI.selectNodeList(documentRoot, query);
+				if (matchedNodes != null) {
+
+					for (int j = 0; j < matchedNodes.getLength(); j++) {
+
+						if (matchedNodes.item(j) != null){
+
+							if(matchedNodes.item(j).getAttributes() != null){
+
+								// Matching the service name with the input service name
+								if(matchedNodes.item(j).getAttributes().item(0).getNodeValue() != null && matchedNodes.item(j).getAttributes().item(0).getNodeValue().equals(serviceName)){
+									// Found a match - Getting necessary data
+									NodeList nl = matchedNodes.item(j).getChildNodes();
+
+									for (int t = 0; t < nl.getLength(); t++) {
+										//	System.out.println("id: " + nl.item(t).getFirstChild().getFirstChild().getNodeValue() + " "+nl.item(t).getFirstChild().getNextSibling().getFirstChild().getNodeValue());
+
+
+										po.servers_by_servicename.put(nl.item(t).getFirstChild().getFirstChild().getNodeValue(), nl.item(t).getFirstChild().getNextSibling().getFirstChild().getNodeValue());
+
+
+									}
+								}
+
+							}
+						}
+					}
+				}
+
+			} catch (Exception e) {
+				System.out.println("ERROR" + e.getMessage());
+				e.printStackTrace();
+
+			}
+		} catch (ParserConfigurationException e1) {
+			// TODO Auto-generated catch block
+			e1.printStackTrace();
+		} catch (SAXException e) {
+			// TODO Auto-generated catch block
+			e.printStackTrace();
+		} catch (IOException e) {
+			// TODO Auto-generated catch block
+			e.printStackTrace();
+		}
+		return po;
+	}
+
+
+
+	/*private static String xmlToString(Node node) {
+		try {
+			Source source = new DOMSource(node);
+			StringWriter stringWriter = new StringWriter();
+			Result result = new StreamResult(stringWriter);
+			TransformerFactory factory = TransformerFactory.newInstance();
+			Transformer transformer = factory.newTransformer();
+			transformer.transform(source, result);
+			return stringWriter.getBuffer().toString();
+		} catch (TransformerConfigurationException e) {
+			e.printStackTrace();
+		} catch (TransformerException e) {
+			e.printStackTrace();
+		}
+		return null;
+	}*/
+}
diff --git a/geneWKspace/Genetegrate/services/ServerObject.class b/geneWKspace/Genetegrate/services/ServerObject.class
new file mode 100644
index 0000000..32193b2
Binary files /dev/null and b/geneWKspace/Genetegrate/services/ServerObject.class differ
diff --git a/geneWKspace/Genetegrate/services/ServerObject.java b/geneWKspace/Genetegrate/services/ServerObject.java
new file mode 100644
index 0000000..98e3344
--- /dev/null
+++ b/geneWKspace/Genetegrate/services/ServerObject.java
@@ -0,0 +1,21 @@
+/**
+ * Object to store the services to server mapping.
+ */
+package services;
+/*
+ *
+ * author Shruti Gandhi
+ */
+import java.util.Hashtable;
+
+public class ServerObject {
+	Hashtable<String, String> servers_by_servicename = new Hashtable<String, String>();
+
+	/**
+	 * @return the servers_by_servicename
+	 */
+	public Hashtable<String, String> getServers_by_servicename() {
+		return servers_by_servicename;
+	}
+
+}
diff --git a/geneWKspace/Genetegrate/services/Servers.xml b/geneWKspace/Genetegrate/services/Servers.xml
new file mode 100644
index 0000000..b8c8c99
--- /dev/null
+++ b/geneWKspace/Genetegrate/services/Servers.xml
@@ -0,0 +1,8 @@
+<servers>
+<server id="0" name="ncbi netblast"><parameters><parameter required="true" name="classname">InvokeNetBlast</parameter><parameter required="true" name="command">C:\\netblast\\blastcl3</parameter><parameter required="false" name="program">blastp</parameter></parameters>
+</server>
+<server id="1" name="SGE Blast"><parameters><parameter required="true"
+name="classname">InvokeSGEBlast</parameter><parameter required="true"
+name="command">/usr/pub/molbio/perl/blastpgp.pl</parameter><parameter required="false" name="maxali">3000</parameter><parameter required="true" name="program">/opt/sge/bin/lx26-amd64/qsub</parameter><parameter required="false" name="priority">0.01</parameter></parameters>
+</server>
+</servers>
diff --git a/geneWKspace/Genetegrate/services/Services.xml b/geneWKspace/Genetegrate/services/Services.xml
new file mode 100644
index 0000000..0fbc164
--- /dev/null
+++ b/geneWKspace/Genetegrate/services/Services.xml
@@ -0,0 +1,3 @@
+<services>
+<service name="xyz"><server><id> server_id </id><load> how_to_find_load </load></server><server><id>server_id</id><load> how_to_find_load </load></server></service>
+</services>
\ No newline at end of file
diff --git a/geneWKspace/Genetegrate/source/.InvokeSGEBlast.java.swp b/geneWKspace/Genetegrate/source/.InvokeSGEBlast.java.swp
new file mode 100644
index 0000000..a29f5a9
Binary files /dev/null and b/geneWKspace/Genetegrate/source/.InvokeSGEBlast.java.swp differ
diff --git a/geneWKspace/Genetegrate/source/InvokeNetBlast$killBlast.class b/geneWKspace/Genetegrate/source/InvokeNetBlast$killBlast.class
new file mode 100644
index 0000000..507ed2b
Binary files /dev/null and b/geneWKspace/Genetegrate/source/InvokeNetBlast$killBlast.class differ
diff --git a/geneWKspace/Genetegrate/source/InvokeNetBlast.class b/geneWKspace/Genetegrate/source/InvokeNetBlast.class
new file mode 100644
index 0000000..4c03c41
Binary files /dev/null and b/geneWKspace/Genetegrate/source/InvokeNetBlast.class differ
diff --git a/geneWKspace/Genetegrate/source/InvokeNetBlast.java b/geneWKspace/Genetegrate/source/InvokeNetBlast.java
new file mode 100644
index 0000000..f6d3d93
--- /dev/null
+++ b/geneWKspace/Genetegrate/source/InvokeNetBlast.java
@@ -0,0 +1,118 @@
+/**
+ * Wrapper to invoke netblast.
+ */
+
+package source;
+
+import java.io.BufferedReader;
+import java.io.BufferedWriter;
+import java.io.FileWriter;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.util.Timer;
+import java.util.TimerTask;
+import java.util.Hashtable;
+
+import middleware.QueueManager;
+
+
+public class InvokeNetBlast extends Thread implements Invoker {
+	private Process pro;
+	private Job j;
+	private Hashtable<String, String> requiredParams;
+	private Hashtable<String, String> optionalParams;
+	private static int timeOutInSeconds = 120;
+
+	class killBlast extends TimerTask {
+		public void run() {
+			System.out.println("Netblast: Timeout");
+			pro.destroy();
+			cancel();
+			//j.setStatus(Job.FAILED);
+			QueueManager.notifyJobFailure(j);
+		}
+	}
+
+	/**
+	 * constructor to initialize the job
+	 * @param j incoming job
+	 * @param requiredParams a hashtable of required parameters need to invoke netblast
+	 * @param optionalParams a hashtable of optinal parameters need to invoke netblast
+	 */
+	public InvokeNetBlast(Job j, Hashtable<String, String> requiredParams, Hashtable <String, String> optionalParams) {
+		this.j = j;
+		this.requiredParams = requiredParams;
+		this.optionalParams = optionalParams;
+		writeFastaToFile();
+	}
+
+	/**
+	 * Runs blast.
+	 */
+	public void run() {
+		Timer t = new Timer();
+		t.schedule(new killBlast(), timeOutInSeconds * 1000);
+		Runtime runner = Runtime.getRuntime();
+		try {
+			System.out.println("Netblast: about to call blast");
+			String command = requiredParams.get("command");
+			String inputFasta = j.getJobId() + ".f";
+			String program = null;
+			if ((optionalParams != null) && (program = optionalParams.get("program")) == null) {
+				program = "blastp";
+			}
+			String outputResult = j.getJobId() + ".blastpgp";
+			pro = runner
+					.exec(command + " -i " + inputFasta + " -p " + program + " -o " + outputResult);
+			if (pro.waitFor() != 0) {
+				System.out.println("Netblast: Error while executing");
+
+				// Displaying error that netblast returned.
+
+				InputStream is = pro.getErrorStream();
+				InputStreamReader isr = new InputStreamReader(is);
+				String line;
+				BufferedReader br = new BufferedReader(isr);
+				System.out.println("Netblast: Error message from netblast:");
+				while ((line = br.readLine()) != null) {
+					System.out.println(line);
+				}
+				//j.setStatus(Job.FAILED);
+				QueueManager.notifyJobFailure(j);
+			}
+			else {
+				j.setStatus(source.Job.BLASTED);
+			}
+
+		} catch (Exception e) {
+			//System.out.println(e.getMessage());
+			//j.setStatus(Job.FAILED);
+			QueueManager.notifyJobFailure(j);
+		} finally {
+			if (pro != null)
+				pro.destroy();
+			t.cancel();
+			java.io.File f = new java.io.File(j.getJobId() + ".f");
+			if (f.exists()) {		// Delete file on exiting.
+				f.delete();
+			}
+			System.out.println("+++++++++++++Netblast: I'm done+++++++++++++");
+		}
+	}
+
+	void writeFastaToFile() {
+		try {
+			String fastaName = j.getJobId();
+			System.out.println("Netblast: writing temp fasta input file: " + fastaName);
+			BufferedWriter out = new BufferedWriter(new FileWriter(fastaName
+					+ ".f"));
+			//out.write(">" + fastaName + " \n");
+			out.write(j.getFastaSequence());
+			out.close();
+		} catch (IOException e) {
+			e.printStackTrace();
+		}
+
+	}
+}
diff --git a/geneWKspace/Genetegrate/source/InvokeSGEBlast$killBlast.class b/geneWKspace/Genetegrate/source/InvokeSGEBlast$killBlast.class
new file mode 100644
index 0000000..b776294
Binary files /dev/null and b/geneWKspace/Genetegrate/source/InvokeSGEBlast$killBlast.class differ
diff --git a/geneWKspace/Genetegrate/source/InvokeSGEBlast.class b/geneWKspace/Genetegrate/source/InvokeSGEBlast.class
new file mode 100644
index 0000000..e1508bc
Binary files /dev/null and b/geneWKspace/Genetegrate/source/InvokeSGEBlast.class differ
diff --git a/geneWKspace/Genetegrate/source/InvokeSGEBlast.java b/geneWKspace/Genetegrate/source/InvokeSGEBlast.java
new file mode 100644
index 0000000..fee6374
--- /dev/null
+++ b/geneWKspace/Genetegrate/source/InvokeSGEBlast.java
@@ -0,0 +1,202 @@
+/**
+ * Wrapper to invoke SGE blast on GAIA.
+ */
+package source;
+
+import java.io.BufferedReader;
+import java.io.BufferedWriter;
+import java.io.FileReader;
+import java.io.FileWriter;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.util.Timer;
+import java.util.TimerTask;
+import java.util.Hashtable;
+
+import middleware.QueueManager;
+
+
+public class InvokeSGEBlast extends Thread implements Invoker{
+	Process pro;
+
+	Job j;
+
+	static final String blastResultExt = ".blastpgp";
+
+	static final String blastPrefix = "SGE";
+
+	static final long timeout = 2 * 60 * 1000;
+        private Hashtable<String, String> requiredParams;
+        private Hashtable<String, String> optionalParams;
+
+	int timeoutCounter = 0;
+
+	class killBlast extends TimerTask {
+		public void run() {
+			System.out.println("Checking SGEBlast");
+			int status = checkResults();
+			if (status == 1) {
+				if (pro != null)
+					pro.destroy();
+				cleanUp();
+			} else if (timeoutCounter > 8) {
+				// Problems while reading output file. Set job as failed.
+				System.out.println("Blast job timed out");
+				// May have to trigger killing the job here
+				//j.setStatus(Job.FAILED);
+				QueueManager.notifyJobFailure(j);
+
+				if (pro != null)
+					pro.destroy();
+				cleanUp();
+			}
+			timeoutCounter++;
+		}
+
+		/**
+		 * Cleans up the temporary files once Cancel needs to be called
+		 */
+		void cleanUp(){
+			String fastaName = blastPrefix + j.getJobId() ;
+			java.io.File f = new java.io.File(fastaName + ".f");
+			if (f.exists()) {		// Delete file on exiting.
+				f.delete();
+			}
+			f = new java.io.File(fastaName+ ".sh");
+			if (f.exists()) {		// Delete file on exiting.
+				f.delete();
+			}
+			cancel();
+
+		}
+		/**
+		 * Checks for results in the file system.
+		 * @return 0 if results are absent, 1 otherwise.
+		 */
+		public int checkResults() {
+			int status = 0;
+			try {
+				System.out.println("Looking for " + "./" + j.getJobId()
+						+ blastResultExt);
+				BufferedReader in = new BufferedReader(new FileReader("./"
+						+ j.getJobId() + blastResultExt));
+
+				in.close();
+				// j.setBlastResult(jobResult.toString());
+				j.setStatus(Job.BLASTED);
+				System.out.println("**********SGEBlst: I'm done***********");
+				status = 1;
+			} catch (IOException e) {
+				System.out.println("Blast not finished yet" + timeoutCounter);
+			} finally {
+				return status;
+			}
+		}
+	}
+
+	/**
+	 * Constructor to initialize the job
+         * @param j incoming job
+         * @param requiredParams a hashtable of required parameters need to invoke netblast
+         * @param optionalParams a hashtable of optinal parameters need to invoke netblast
+
+	 */
+	public InvokeSGEBlast(Job j,  Hashtable<String, String> requiredParams, Hashtable <String, String> optionalParams) {
+		this.j = j;
+                this.requiredParams = requiredParams;
+                this.optionalParams = optionalParams;
+		writeFastaToFile();
+	}
+
+	public void run() {
+		String fastaName = blastPrefix + j.getJobId();
+		Timer t = new Timer();
+		BufferedWriter out;
+
+		try {
+			String command = requiredParams.get("command");
+			String program = requiredParams.get("program");
+			String maxAli = optionalParams.get("maxali");
+			String priority = optionalParams.get("priority");
+			StringBuffer shellCommand = new StringBuffer();
+			StringBuffer sgeCommand = new StringBuffer();
+
+			shellCommand.append(command);
+			shellCommand.append(" ./Code/");
+			shellCommand.append(fastaName + ".f");
+			if(maxAli != null)
+				shellCommand.append(" maxAli=" + maxAli);
+			shellCommand.append(" fileOut=./Code/" +  j.getJobId() + blastResultExt);
+
+			sgeCommand.append(program);
+			if(priority != null)
+				sgeCommand.append(" -p " + priority);
+			sgeCommand.append (" ./" + fastaName + ".sh");
+			out = new BufferedWriter(new FileWriter(fastaName + ".sh"));
+			System.out.println("Executing " + shellCommand.toString());
+			out.write(shellCommand.toString());
+			// out.write("");
+			out.newLine();
+			out.close();
+
+			System.out.println("about to call blast");
+			Runtime runner = Runtime.getRuntime();
+			t.schedule(new killBlast(), timeout, timeout);
+			// Check every 2 minutes for a file. Check 8 times
+			// Hence we wait for 16 mins before giving up
+
+			System.out.println("Executing "
+					+ sgeCommand.toString());
+			pro = runner.exec(sgeCommand.toString());
+
+			if (pro.waitFor() != 0) {
+				System.out.println("SGEBlast: Error while executing");
+
+				// Displaying error that SGEBlast returned.
+
+				InputStream is = pro.getErrorStream();
+				InputStreamReader isr = new InputStreamReader(is);
+				String line;
+				BufferedReader br = new BufferedReader(isr);
+				System.out.println("Error message from SGEBlast:");
+				while ((line = br.readLine()) != null) {
+					System.out.println(line);
+				}
+				//j.setStatus(Job.FAILED);
+				QueueManager.notifyJobFailure(j);
+			} else {
+				// j.setStatus(source.Job.BLASTED);
+				System.out.println("SGEBlast: Job Submitted");
+			}
+
+		} catch (Exception e) {
+			//System.out.println(e.getMessage());
+			QueueManager.notifyJobFailure(j);
+		} finally {
+			// checkResults();
+			pro.destroy();
+
+		}
+	}
+
+	/**
+	 * Write the fasta sequence to file.
+	 *
+	 */
+	void writeFastaToFile() {
+		try {
+			String fastaName = blastPrefix + j.getJobId();
+			System.out.println("SGEBlast: writing temp fasta input file: "
+					+ fastaName);
+			BufferedWriter out = new BufferedWriter(new FileWriter(fastaName
+					+ ".f"));
+			// out.write(">" + fastaName + " \n");
+			out.write(j.getFastaSequence());
+			out.close();
+		} catch (IOException e) {
+			e.printStackTrace();
+		}
+
+	}
+}
diff --git a/geneWKspace/Genetegrate/source/Invoker.class b/geneWKspace/Genetegrate/source/Invoker.class
new file mode 100644
index 0000000..8ecf616
Binary files /dev/null and b/geneWKspace/Genetegrate/source/Invoker.class differ
diff --git a/geneWKspace/Genetegrate/source/Invoker.java b/geneWKspace/Genetegrate/source/Invoker.java
new file mode 100644
index 0000000..0417405
--- /dev/null
+++ b/geneWKspace/Genetegrate/source/Invoker.java
@@ -0,0 +1,8 @@
+/**
+ * Interface required by all wrappers.
+ */
+package source;
+
+public interface Invoker {
+	public void start();	// to register this thread with the jvm.
+}
diff --git a/geneWKspace/Genetegrate/source/Job.class b/geneWKspace/Genetegrate/source/Job.class
new file mode 100644
index 0000000..f1ea4e7
Binary files /dev/null and b/geneWKspace/Genetegrate/source/Job.class differ
diff --git a/geneWKspace/Genetegrate/source/Job.java b/geneWKspace/Genetegrate/source/Job.java
new file mode 100644
index 0000000..2b786cd
--- /dev/null
+++ b/geneWKspace/Genetegrate/source/Job.java
@@ -0,0 +1,89 @@
+/**
+ * @author swapneelsheth, aaron
+ * Job Class which stores information about a job
+ */
+
+package source;
+
+import java.io.Serializable;
+
+public class Job implements Serializable{
+	private String jobId;
+	private String fastaSequence;
+	private String blastResult;
+	private byte numRetries;
+	private String serviceType;
+	public static final int NEW = 0;
+	public static final int BLASTING = 1;
+	public static final int BLASTED = 2;
+	public static final int FAILED = 3;
+
+	/**
+	 * status stores the status of the job
+	 */
+	int status;
+
+	/**
+	 * Constructor
+	 * @param jobId jobId of the job submitted
+	 */
+	public Job(String jobId, String fastaSequence) {
+		this.jobId = jobId;
+		this.fastaSequence = fastaSequence;
+		this.status = NEW;
+		this.numRetries = (byte)0;
+	}
+
+	/**
+	 * @return the status
+	 */
+	public int getStatus() {
+		return status;
+	}
+
+	/**
+	 * @param status the status to set
+	 */
+	public void setStatus(int status) {
+		this.status = status;
+	}
+
+	/**
+	 * @return the jobId
+	 */
+	public String getJobId() {
+		return jobId;
+	}
+
+	public String getFastaSequence() {
+		return fastaSequence;
+	}
+
+	public void setFastaSequence(String fastaSequence) {
+		this.fastaSequence = fastaSequence;
+	}
+
+	public String getBlastResult() {
+		return blastResult;
+	}
+
+	public void setBlastResult(String blastResult) {
+		this.blastResult = blastResult;
+	}
+
+	public byte getNumRetries() {
+		return numRetries;
+	}
+
+	public void setNumRetries(byte numRetries) {
+		this.numRetries = numRetries;
+	}
+
+	public String getServiceType() {
+		return serviceType;
+	}
+
+	public void setServiceType(String serviceType) {
+		this.serviceType = serviceType;
+	}
+}