Enabling archiving by default
[proteocache.git] / datadb / compbio / cassandra / CassandraReader.java
index d2d2e1b..00f878a 100644 (file)
@@ -1,16 +1,39 @@
 package compbio.cassandra;
 
+import org.apache.log4j.Logger;
+
+import com.datastax.driver.core.ResultSet;
 import com.datastax.driver.core.Session;
 
-public interface CassandraReader {
+public class CassandraReader {
+       private static long earlestDate = 0;
+       private Session session;
+       private static Logger log = Logger.getLogger(CassandraNativeConnector.class);
 
-       /*
-        * Defines a source file with metainformation of Jpred Jobs
-        **/
-       void setSession (Session s);
+       public CassandraReader() {
+               Session inis = CassandraNativeConnector.getSession();
+               setSession(inis);
+       }
+
+       public void setSession(Session s) {
+               assert s != null;
+               session = s;
+       }
+       
+       public ResultSet CassandraQuery(String column, String table, String condition) {
+               String com = "SELECT " + column + " FROM " + table + ";";
+               System.out.println("Command: " + com);
+               ResultSet results = session.execute(com);
+               return results;
+       }
        
        /*
-        * Makes real parsing of the source file
-        **/
-       /*void getResults();*/
+        * find the earliest date in the database
+        */
+       public static long earliestDate() {
+               earlestDate = CassandraNativeConnector.getEarliestDateInDB();
+               return earlestDate;
+       }
+
+       
 }