From: Alexander Sherstnev Date: Wed, 6 Aug 2014 08:32:14 +0000 (+0100) Subject: Add mode comments to the classes X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=refs%2Fheads%2Fmaster;p=proteocache.git Add mode comments to the classes --- diff --git a/datadb/compbio/cassandra/CassandraNativeConnector.java b/datadb/compbio/cassandra/CassandraNativeConnector.java index 6deed99..6b63a57 100644 --- a/datadb/compbio/cassandra/CassandraNativeConnector.java +++ b/datadb/compbio/cassandra/CassandraNativeConnector.java @@ -37,7 +37,7 @@ public class CassandraNativeConnector { return session; } - /* + /** * connect to the cluster and look whether all tables exist */ public void Connect() { diff --git a/datadb/compbio/cassandra/readers/CassandraReader.java b/datadb/compbio/cassandra/readers/CassandraReader.java index f970659..a4561be 100644 --- a/datadb/compbio/cassandra/readers/CassandraReader.java +++ b/datadb/compbio/cassandra/readers/CassandraReader.java @@ -9,11 +9,22 @@ import com.datastax.driver.core.exceptions.QueryValidationException; import compbio.cassandra.CassandraNativeConnector; +/** + * basic reader of the ProteoCache database. It depends on open + * CassandraNativeConnector, which should provide an open session to the + * ProteoCache DB (in the default constructor) + * + * @author as373024 + * + */ public class CassandraReader { protected static long earlestDate = 0; protected Session session; protected static Logger log = Logger.getLogger(CassandraNativeConnector.class); + /** + * default constructor. + */ public CassandraReader() { Session inis = CassandraNativeConnector.getSession(); setSession(inis); @@ -24,6 +35,13 @@ public class CassandraReader { session = s; } + /** + * Basic query to the DB. The method throws exception if the input command + * is not valid or if there is a problem with execution of the command + * + * @param command - reading CQL command + * @return resulting outout of the command + */ protected ResultSet CassandraQuery(String command) { try { ResultSet results = session.execute(command); @@ -44,14 +62,16 @@ public class CassandraReader { } - /* - * find the earliest date in the database + /** + * finds the earliest date in the database + * + * @return the earliest date (long) */ public static long earliestDate() { earlestDate = CassandraNativeConnector.getEarliestDateInDB(); return earlestDate; } - + /** * prepares an example of either job id or IP for the DB * diff --git a/server/compbio/controllers/DatabaseController.java b/server/compbio/controllers/DatabaseController.java index c7d6155..f49572d 100644 --- a/server/compbio/controllers/DatabaseController.java +++ b/server/compbio/controllers/DatabaseController.java @@ -13,6 +13,8 @@ import compbio.cassandra.DateFormatter; /** * MVC controller for direct interaction with the internal DB + * A really dangerous controller since it can change data in the DB + * Should be available to administrators only * * @author Alexander Sherstnev * @author Natasha Sherstneva diff --git a/server/compbio/controllers/IPDataController.java b/server/compbio/controllers/IPDataController.java index 2b06e39..a9d25b9 100644 --- a/server/compbio/controllers/IPDataController.java +++ b/server/compbio/controllers/IPDataController.java @@ -15,19 +15,36 @@ import compbio.cassandra.readers.IpReader; import compbio.cassandra.readers.ReaderByCounter; /** + * The controller + * * @author Alexander Sherstnev * @author Natasha Sherstneva + * @version 1.0 */ @Controller public class IPDataController extends BasicController { - + /** + * default minimal jobs to consider a user "heavy user" + */ + private int minimalJobsFromIP = 5; + + /** + * for initial page for request "heavy users" + * + */ @RequestMapping(value = "/admin/ip/counts/query", method = RequestMethod.GET) public String initStatisticsForm(Map model) { model.put("username", getPrincipalName()); - model.put("value", 5); + model.put("value", minimalJobsFromIP); return "query/IPStatistics"; } + /** + * form query page for requesting a single IP + * + * @param model - MVC abstract model + * @return + */ @RequestMapping(value = "/admin/ip/query", method = RequestMethod.GET) public String initOneIPForm(Map model) { model.put("username", getPrincipalName()); @@ -36,6 +53,12 @@ public class IPDataController extends BasicController { return "query/IP"; } + /** + * Form output model with statistics on "heavy users" + * @param counter - the number of jobs for requested "heavy users" + * @param model - abstract MVC model + * @return + */ @RequestMapping(value = "/admin/ip/counts/results", method = RequestMethod.GET) public String findIPwithCounter(@RequestParam("JobCounter") String counter, Map model) { model.put("username", getPrincipalName());