Changeset 8869
- Timestamp:
- 2004-12-21T15:38:56+13:00 (19 years ago)
- Location:
- trunk/gsdl3/src/java/org/greenstone/gsdl3
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/gsdl3/src/java/org/greenstone/gsdl3/gs3build/BuildManager.java
r8860 r8869 3 3 import org.greenstone.gsdl3.gs3build.doctypes.*; 4 4 import org.greenstone.gsdl3.gs3build.indexers.*; 5 import org.greenstone.gsdl3.gs3build.notifier.NotifierManager; 5 6 import org.greenstone.gsdl3.gs3build.extractor.*; 6 7 import org.greenstone.gsdl3.gs3build.classifier.*; … … 17 18 ClassifierManager classifierManager; 18 19 ExtractorManager extractorManager; 20 NotifierManager notifierManager; 19 21 DocumentList docList; 20 22 List inputRoots; … … 56 58 this.classifierManager = new ClassifierManager(this.docList, collectionManager.getDatabase()); 57 59 this.indexerManager = new IndexerManager(this.docList); 60 this.notifierManager = new NotifierManager(); 58 61 59 62 // configure the collection - this will add classifiers, indexers, recognisers to the various managers. … … 129 132 130 133 // TODO: validation phase 134 this.notifierManager.detectEvents(this.collectionManager); 131 135 132 136 if (this.archiveDir != null) { -
trunk/gsdl3/src/java/org/greenstone/gsdl3/gs3build/CollectionManager.java
r8859 r8869 66 66 String collectionName; 67 67 String qualifiedCollectionName; // used as the database name 68 String notifyHost; 68 69 69 70 BuildManager buildManager; … … 375 376 { this.configureBrowsers(children.item(c), collectionConfig); 376 377 } 378 else if (name.equals(GSXML.NOTIFY_ELEM)) 379 { 380 this.notifyHost = ((Element) children.item(c)).getAttribute(GSXML.NOTIFY_HOST_ATT); 381 } 377 382 // TODO: other elements - make a factory-method approach here... 378 383 else … … 573 578 return collectionName; 574 579 } 580 581 /** 582 * @return 583 */ 584 public String getNotifyHost() { 585 return notifyHost; 575 586 } 576 587 } 588 -
trunk/gsdl3/src/java/org/greenstone/gsdl3/gs3build/notifier/NotifierManager.java
r8868 r8869 16 16 17 17 public void detectEvents(CollectionManager collManager) { 18 String notifyHost = collManager.getNotifyHost(); 19 if (notifyHost == null) 20 return; 18 21 19 22 System.out.println("detecting events"); … … 29 32 // AccessionDate >= CollectionLastRebuiltDate 30 33 ResultSet results = statement.executeQuery("SELECT DocID FROM document WHERE DocType != 'GSMETADATA' AND AccessionDate >= " + lastBuild); 31 notify(collectionName, host, results, collManager.getDatabase(), collManager.getBuildDate(), "new_document");34 notify(collectionName, host, notifyHost, results, collManager.getDatabase(), collManager.getBuildDate(), "new_document"); 32 35 33 36 // detect modified documents. A document is modified if and only if … … 35 38 // IndexedDate >= CollectionLastRebuiltDate 36 39 results = statement.executeQuery("SELECT DocID FROM document WHERE DocType != 'GSMETADATA' AND AccessionDate < " + lastBuild + " AND IndexedDate >= " + lastBuild); 37 notify(collectionName, host, results, collManager.getDatabase(), collManager.getBuildDate(), "document_modified");40 notify(collectionName, host, notifyHost, results, collManager.getDatabase(), collManager.getBuildDate(), "document_modified"); 38 41 39 42 // TODO deleted docs? … … 55 58 * @throws SQLException 56 59 */ 57 private void notify(String collName, String hostURL, ResultSet results, GS3SQLConnection database, Date date, String eventType) {60 private void notify(String collName, String hostURL, String notifyHost, ResultSet results, GS3SQLConnection database, Date date, String eventType) { 58 61 try { 59 URL url = new URL("http://localhost:8080/alerting/service"); 62 System.out.println("notifyHost is " + notifyHost); 63 URL url = new URL("http://" + notifyHost + "/alerting/service"); 60 64 System.out.println("trying to send to " + url); 61 65 … … 82 86 writer.write("&collectionID="); 83 87 writer.write(URLEncoder.encode(collName, "UTF-8")); 84 // TODO add collection name to event85 88 writer.write("&hostID="); 86 89 writer.write(URLEncoder.encode(hostURL, "UTF-8")); … … 109 112 e1.printStackTrace(); 110 113 } 111 //112 // Call call = new Call();113 // call.setTargetObjectURI("alerting");114 // call.setMethodName("receiveEvent");115 // call.setEncodingStyleURI(Constants.NS_URI_SOAP_ENC);116 // Vector params = new Vector();117 // params.addElement(new Parameter("event", Map.class, event, null));118 // call.setParams(params);119 // try {120 // Response resp = call.invoke(url, "");121 // if (!resp.generatedFault()) {122 // System.out.println("successfully posted event");123 // return;124 // }125 // System.err.println("Posting event was unsuccessful:");126 // System.err.println(resp.getFault().getFaultString());127 //128 // Vector entries = resp.getFault().getDetailEntries();129 // for (Iterator i = entries.iterator(); i.hasNext(); ) {130 // org.w3c.dom.Element entry = (org.w3c.dom.Element)i.next( );131 // System.err.println(entry.getFirstChild().getNodeValue( ));132 // }133 // } catch (SOAPException e1) {134 // System.err.println("Exception while posting event: ");135 // e1.printStackTrace();136 // }137 114 } 138 115 } catch (SQLException e) { -
trunk/gsdl3/src/java/org/greenstone/gsdl3/util/GSXML.java
r8726 r8869 58 58 public static final String LEVEL_ELEM = "level"; 59 59 public static final String SHORTNAME_ATT = "shortname"; 60 public static final String NOTIFY_ELEM = "notify"; 61 public static final String NOTIFY_HOST_ATT = "host"; 60 62 61 63 // elems for the pages to be processed by xslt
Note:
See TracChangeset
for help on using the changeset viewer.