[MOBY-guts] biomoby commit
Eddie Kawas
kawas at pub.open-bio.org
Thu Aug 4 12:58:41 UTC 2005
kawas
Thu Aug 4 08:58:41 EDT 2005
Update of /home/repository/moby/moby-live/Java/src/main/org/biomoby/registry/rdfagent/verifier
In directory pub.open-bio.org:/tmp/cvs-serv8093/org/biomoby/registry/rdfagent/verifier
Modified Files:
Main.java Communicator.java
Log Message:
The Agent, as far as i can tell, now works as expected. I will be changing the way that email is sent next.
moby-live/Java/src/main/org/biomoby/registry/rdfagent/verifier Main.java,1.4,1.5 Communicator.java,1.6,1.7
===================================================================
RCS file: /home/repository/moby/moby-live/Java/src/main/org/biomoby/registry/rdfagent/verifier/Main.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- /home/repository/moby/moby-live/Java/src/main/org/biomoby/registry/rdfagent/verifier/Main.java 2005/04/16 14:32:12 1.4
+++ /home/repository/moby/moby-live/Java/src/main/org/biomoby/registry/rdfagent/verifier/Main.java 2005/08/04 12:58:41 1.5
@@ -12,99 +12,118 @@
import com.hp.hpl.jena.rdf.model.Model;
-
/**
* @author Nina Opushneva
- *
*
+ *
*/
public class Main {
- public static void main(String[] args) {
+ public static void main(String[] args) {
+ StringBuffer failedServices = new StringBuffer();
+ Log.start();
+
+ String report = Constants.RDFagentHome + Constants.SV_REPORT_PATH;
+ Report.createFile(report);
+
+ Date now = new Date();
+
+ Report
+ .doWrite("****************************************************************************************");
+ Report.doWrite(" START MOBY RDFAGENT REPORT "
+ + now.toString());
+ Report
+ .doWrite("****************************************************************************************");
+
+ Report.add(" RDFAGENT REPORT " + now.toString());
+ Report
+ .add("****************************************************************************************");
+
+ Hashtable serviceList = new Hashtable();
+ String signURL = "";
+ Calendar c = Calendar.getInstance();
+
+ if (args.length == 0) {
+
+ String delfile = Constants.RDFagentHome + Constants.SV_DELFILE_PATH;
+ Report.createFile(delfile);
+
+ // DataMngr.delServiceSetByURL(signURL);
+
+ String url_path = Constants.RDFagentHome
+ + Constants.SV_SIGN_URL_PATH;
+
+ String filename = url_path + "_" + c.get(Calendar.DAY_OF_MONTH)
+ + "_" + c.get(Calendar.MONTH);
+ Report.createFile(filename);
+ serviceList = DataMngr.getServices(filename);
+ /*
+ * }else if (args[0].equals("list")){ serviceList =
+ * Communicator.readFromFile(args[1]);
+ *
+ * }else if (args[0].equals("sign")){
+ */
+ } else {
-
- Log.start();
-
- String report = Constants.RDFagentHome+Constants.SV_REPORT_PATH;
- Report.createFile(report);
-
-
- Date now = new Date();
-
- Report.doWrite("****************************************************************************************");
- Report.doWrite(" START MOBY RDFAGENT REPORT "+now.toString());
- Report.doWrite("****************************************************************************************");
-
- Report.add(" RDFAGENT REPORT "+now.toString());
- Report.add("****************************************************************************************");
-
- Hashtable serviceList = new Hashtable();
- String signURL = "";
- Calendar c = Calendar.getInstance();
-
- if (args.length == 0){
-
- String delfile = Constants.RDFagentHome+Constants.SV_DELFILE_PATH;
- Report.createFile(delfile);
-
-// DataMngr.delServiceSetByURL(signURL);
-
-
- String url_path = Constants.RDFagentHome+Constants.SV_SIGN_URL_PATH;
-
- String filename = url_path+"_"+c.get(Calendar.DAY_OF_MONTH)+"_"+c.get(Calendar.MONTH);
- Report.createFile(filename);
- serviceList = DataMngr.getServices(filename);
-/* }else if (args[0].equals("list")){
- serviceList = Communicator.readFromFile(args[1]);
-
- }else if (args[0].equals("sign")){ */
- }else{
-
- signURL = args[0];
- serviceList = DataMngr.getServicesByURL(signURL);
+ signURL = args[0];
+ serviceList = DataMngr.getServicesByURL(signURL);
}
- Enumeration list = serviceList.keys();
- while (list.hasMoreElements()){
- String ob = list.nextElement().toString();
- String val = serviceList.get(ob).toString();
- signURL = ob;
- String servNames = val;
-
- Model model = Communicator.getServiceRDF(servNames,signURL);
-
- if (model.isEmpty()){
- Log.info("Model " +signURL+" is empty");
-
-
- }else{
- Report.add(" ");
- Report.add("List of the processed services:");
- ServiceDescrParser sdParser = new ServiceDescrParser(model);
- sdParser.getValidRDF(servNames,signURL);
-
- }
- }
-// }
- if (args.length != 0){
-
-// Report.send(signURL);
- }
- exit(signURL);
- }
+ Enumeration list = serviceList.keys();
+ while (list.hasMoreElements()) {
+ String ob = list.nextElement().toString();
+ String val = serviceList.get(ob).toString();
+ signURL = ob;
+ String servNames = val;
+
+ Model model = Communicator.getServiceRDF(servNames, signURL);
+
+ if (model.isEmpty()) {
+ Log.info("Model " + signURL + " is empty");
+ failedServices.append("__PATTERN__" + signURL); // something unique
+ // that urls shouldnt
+ // have
+ } else {
+ Report.add(" ");
+ Report.add("List of the processed services:");
+ ServiceDescrParser sdParser = new ServiceDescrParser(model);
+ sdParser.getValidRDF(servNames, signURL);
+
+ }
+ exit(failedServices.toString());
+ failedServices = new StringBuffer();
+ }
+ // }
+ if (args.length != 0) {
+ // TODO this line sends email
+ //Report.send(signURL);
+ }
+ //exit(failedServices.toString());
+ }
- public static void exit(String signURL){
+ public static void exit(String signURL) {
DBConnector.closeConnection();
-
+
Log.stop();
- Date now = new Date();
- Report.doWrite(" STOP MOBY RDFAGENT REPORT "+now.toString());
- Report.add(" STOP MOBY RDFAGENT REPORT "+now.toString());
-
- Report.doWrite("****************************************************************************************");
+ Date now = new Date();
+ Report.doWrite(" STOP MOBY RDFAGENT REPORT "
+ + now.toString());
+ Report.add(" STOP MOBY RDFAGENT REPORT "
+ + now.toString());
+
+ Report
+ .doWrite("****************************************************************************************");
+
+ String[] failedURLs = signURL.split("__PATTERN__");
+ for (int i = 0; i < failedURLs.length; i++) {
+ if (!failedURLs[i].equals("")) {
+ Log
+ .info("Sending an email to the individual identified by the following signature URL: "
+ + failedURLs[i]);
+ Report.send(failedURLs[i]);
+ }
+ }
- Report.send(signURL);
- System.exit(0);
+ //System.exit(0);
}
-}
+}
\ No newline at end of file
===================================================================
RCS file: /home/repository/moby/moby-live/Java/src/main/org/biomoby/registry/rdfagent/verifier/Communicator.java,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- /home/repository/moby/moby-live/Java/src/main/org/biomoby/registry/rdfagent/verifier/Communicator.java 2005/07/28 15:22:00 1.6
+++ /home/repository/moby/moby-live/Java/src/main/org/biomoby/registry/rdfagent/verifier/Communicator.java 2005/08/04 12:58:41 1.7
@@ -103,13 +103,13 @@
mes1 = "The request is for something forbidden.";
} else if (code == 404) {
Report
- .doWrite("The server has not found anything matching the URI given");
+ .doWrite("The server has not found anything matching the URL given");
Report
.add("The server has not found anything matching the URI given");
mes1 = "The RDF file was not found on the server";
} else if (code == 417) {
Report
- .add(" RDF Parsing error. Possible reason being that multiple <rdf:RDF> tags found in the same file.");
+ .add("RDF Parsing error. Possible reason being that multiple <rdf:RDF> tags found in the same file.");
mes1 = "RDF Parsing error. Possible reason being that multiple <rdf:RDF> tags found in the same file.";
} else if (code == 500) {
Report.add(" Internal Error");
@@ -203,7 +203,6 @@
String from) {
try {
-
Properties prop = new Properties();
prop.put("mail.smtp.host", Constants.MB_MAIL_SERVER);
Session ses = Session.getDefaultInstance(prop, null);
More information about the MOBY-guts
mailing list