Changeset 3505
- Timestamp:
- 2002-10-29T16:21:14+13:00 (22 years ago)
- Location:
- trunk/gsdl3/src/java/org/greenstone/gsdl3
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/gsdl3/src/java/org/greenstone/gsdl3/comms/Communicator.java
r3502 r3505 33 33 implements ModuleInterface { 34 34 35 /** home directory of local site */36 protected String site_home_=null;37 35 /** name of local site */ 38 36 protected String local_site_name_ = null; 37 39 38 /** name of site to connect to */ 40 protected String connection_name_=null; 41 /** address of site to connect to */ 42 protected String connection_address_=null; 39 protected String remote_site_name_=null; 40 43 41 /** converter for String to DOM and vice versa */ 44 42 protected XMLConverter converter_= null; … … 47 45 converter_ = new XMLConverter(); 48 46 } 49 public void setSiteHome(String home) { 50 site_home_ = home; 51 } 52 public void setSiteName(String name) { 47 48 public void setLocalSiteName(String name) { 53 49 local_site_name_ = name; 54 50 } 55 56 public void set ConnectionName(String name) {57 connection_name_=name;51 /** this should be done as part of configure */ 52 public void setRemoteSiteName(String name) { 53 remote_site_name_ = name; 58 54 } 59 60 // format of address depends on connection type 61 public void setConnectionAddress(String address){ 62 connection_address_ = address; 63 } 64 65 abstract public boolean configure(); 55 /** configures the Communicator using the <site> element */ 56 abstract public boolean configure(Element site_elem); 66 57 67 58 abstract public String process(String xml_in); -
trunk/gsdl3/src/java/org/greenstone/gsdl3/comms/SOAPCommunicator.java
r3504 r3505 48 48 extends Communicator { 49 49 50 /** address of site to connect to */ 51 protected String remote_site_address_=null; 52 50 53 /** the call object that does the SOAP talking */ 51 54 private Call call_ = null; … … 60 63 call_.setEncodingStyleURI(Constants.NS_URI_LITERAL_XML); 61 64 } 62 63 public void setConnectionName(String name) { 64 System.out.println("name="+name); 65 connection_name_ = name; 66 // Set Object URI and Method Name 67 call_.setTargetObjectURI (name); 68 call_.setMethodName ("process"); // everything uses process 69 } 70 71 public boolean configure() { 65 66 public boolean configure(Element site_elem) { 67 68 String type = site_elem.getAttribute("type"); 69 if (!type.equals("soap")) { 70 System.err.println("SOAPCommunicator: wrong type of site"); 71 return false; 72 } 73 remote_site_name_ = site_elem.getAttribute("name"); 74 remote_site_address_ = site_elem.getAttribute("address"); 75 if (remote_site_name_==null || remote_site_name_.equals("")) { 76 System.err.println("SOAPCommunicator: must have name attribute in site element"); 77 return false; 78 } 79 if (remote_site_address_==null || remote_site_address_.equals("")) { 80 System.err.println("SOAPCommunicator: must have address attribute in site element"); 81 return false; 82 } 83 call_.setTargetObjectURI(remote_site_name_); 84 call_.setMethodName("process"); 85 72 86 return true; 73 87 } … … 119 133 120 134 // Set the URL for the Web Service 121 URL url = new URL( connection_address_);135 URL url = new URL(remote_site_address_); 122 136 123 137 // Invoke the Service … … 138 152 Element e = (Element)responses.item(i); 139 153 String from = e.getAttribute("from"); 140 from = GSPath.prependLink(from, connection_name_);154 from = GSPath.prependLink(from, remote_site_name_); 141 155 e.setAttribute("from", from); 142 156 } -
trunk/gsdl3/src/java/org/greenstone/gsdl3/core/MessageRouter.java
r3502 r3505 365 365 String type = s.getAttribute("type"); 366 366 String name = s.getAttribute("name"); 367 System.out.println("..."+name+", type="+type);368 367 if (type.equals("soap")) { 369 368 comm = new SOAPCommunicator(); 370 comm.setSiteHome(site_home_); 371 comm.setConnectionName(name); 372 comm.setConnectionAddress(s.getAttribute("address")); 373 comm.setSiteName(site_name_); 369 if (comm.configure(s)) { 370 comm.setLocalSiteName(site_name_); 374 371 375 // add to map of modules 376 module_map_.put(name, comm); 377 site_list_.appendChild(doc_.importNode(s, true)); 378 // need to get collection list and service list from here 379 // this may introduce a configure problem - leave as 380 // is for now, but fix up later - kjdon 381 getRemoteCollectionInfo(comm, name); 382 getRemoteServiceInfo(comm, name); 372 // add to map of modules 373 module_map_.put(name, comm); 374 site_list_.appendChild(doc_.importNode(s, true)); 375 // need to get collection list and service 376 // list from here- this may introduce a 377 // configure problem - leave as is for now, 378 // but fix up later - kjdon 379 getRemoteCollectionInfo(comm, name); 380 getRemoteServiceInfo(comm, name); 381 } else { 382 System.err.println("couldn't configure soap site:"+name); 383 } 383 384 384 385 } else {
Note:
See TracChangeset
for help on using the changeset viewer.