Changeset 3471 for trunk/gsdl3
- Timestamp:
- 2002-10-16T09:38:16+13:00 (22 years ago)
- Location:
- trunk/gsdl3/src/java/org/greenstone/gsdl3/service
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/gsdl3/src/java/org/greenstone/gsdl3/service/GSDL2ClassifierService.java
r3453 r3471 53 53 // the response element 54 54 Element result = doc_.createElement("response"); 55 String from = GSPath.appendLink(c ollection_name_, "ClassifierBrowse");55 String from = GSPath.appendLink(cluster_name_, "ClassifierBrowse"); 56 56 result.setAttribute("from", from); 57 57 result.setAttribute("type", "query"); … … 183 183 } 184 184 185 System.out.println("classifier result:");186 System.out.println(converter_.getString(result));187 185 return result; 188 186 … … 215 213 service_info_map_.put("ClassifierBrowse", e); 216 214 217 if (gdbm_src_.openDatabase(GSFile.GDBMDatabaseFile(site_home_, c ollection_name_), GDBMWrapper.READER)) {215 if (gdbm_src_.openDatabase(GSFile.GDBMDatabaseFile(site_home_, cluster_name_), GDBMWrapper.READER)) { 218 216 return true; 219 217 } -
trunk/gsdl3/src/java/org/greenstone/gsdl3/service/MGPPGDBMService.java
r3442 r3471 189 189 service_info_map_.put("MetadataRetrieve", e); 190 190 191 if (gdbm_src_.openDatabase(GSFile.GDBMDatabaseFile(site_home_, c ollection_name_), GDBMWrapper.READER)) {191 if (gdbm_src_.openDatabase(GSFile.GDBMDatabaseFile(site_home_, cluster_name_), GDBMWrapper.READER)) { 192 192 return true; 193 193 } … … 223 223 224 224 Element result = doc_.createElement("response"); 225 String from = GSPath.appendLink(c ollection_name_, "TextQuery");225 String from = GSPath.appendLink(cluster_name_, "TextQuery"); 226 226 result.setAttribute("from", from); 227 227 result.setAttribute("type", "query"); … … 261 261 // now set up the mgpp stuff 262 262 String basedir = GSFile.collectionBaseDir(site_home_, 263 c ollection_name_);264 String indexdir = GSFile.collectionIndexPath(c ollection_name_, index);263 cluster_name_); 264 String indexdir = GSFile.collectionIndexPath(cluster_name_, index); 265 265 266 266 mgpp_src_.loadIndexData(basedir, indexdir); … … 294 294 protected Element processFieldQuery(Element request) { 295 295 Element result = doc_.createElement("response"); 296 String from = GSPath.appendLink(c ollection_name_, "FieldQuery");296 String from = GSPath.appendLink(cluster_name_, "FieldQuery"); 297 297 result.setAttribute("from", from); 298 298 result.setAttribute("type", "query"); … … 311 311 // where the mgpp text files are 312 312 String basedir = GSFile.collectionBaseDir(site_home_, 313 c ollection_name_);314 String textdir = GSFile.collectionTextPath(c ollection_name_);313 cluster_name_); 314 String textdir = GSFile.collectionTextPath(cluster_name_); 315 315 316 316 // an empty result 317 317 Element result = doc_.createElement("response"); 318 String from = GSPath.appendLink(c ollection_name_, "ResourceRetrieve");318 String from = GSPath.appendLink(cluster_name_, "ResourceRetrieve"); 319 319 result.setAttribute("from", from); 320 320 result.setAttribute("type", "query"); … … 409 409 protected Element processMetadataRetrieve(Element request) { 410 410 Element result = doc_.createElement("response"); 411 String from = GSPath.appendLink(c ollection_name_, "MetadataRetrieve");411 String from = GSPath.appendLink(cluster_name_, "MetadataRetrieve"); 412 412 result.setAttribute("from", from); 413 413 result.setAttribute("type", "query"); -
trunk/gsdl3/src/java/org/greenstone/gsdl3/service/PhindService.java
r3443 r3471 77 77 String app_info = "<applet CODEBASE='lib/java' CODE='org.greenstone.applet.phind.Phind.class' ARCHIVE='phind.jar, xercesImpl.jar, gsdl3.jar, jaxp.jar, xml-apis.jar' WIDTH='500' HEIGHT='400'><PARAM NAME='library' VALUE=''/> <PARAM NAME='phindcgi' VALUE='?a=a&sa=r&sn=Phind'/>"; 78 78 app_info +="<PARAM NAME='collection' VALUE='"; 79 app_info += c ollection_name_;79 app_info += cluster_name_; 80 80 app_info += "'/> <PARAM NAME='classifier' VALUE='1'/> <PARAM NAME='orientation' VALUE='vertical'/> <PARAM NAME='depth' VALUE='2'/> <PARAM NAME='resultorder' VALUE='L,l,E,e,D,d'/> <PARAM NAME='backdrop' VALUE='interfaces/default/images/phindbg1.jpg'/><PARAM NAME='fontsize' VALUE='10'/> <PARAM NAME='blocksize' VALUE='10'/>The Phind java applet.</applet>"; 81 81 … … 115 115 String phind_index = (String)params.get("pc"); 116 116 // the location of the mgpp database files 117 basepath_ = GSFile.phindBaseDir(site_home_, c ollection_name_, phind_index);117 basepath_ = GSFile.phindBaseDir(site_home_, cluster_name_, phind_index); 118 118 119 119 // the result element 120 120 Element result = doc_.createElement("response"); 121 String from = GSPath.appendLink(c ollection_name_, "PhindApplet");121 String from = GSPath.appendLink(cluster_name_, "PhindApplet"); 122 122 result.setAttribute("from", from); 123 123 result.setAttribute("type", "query"); -
trunk/gsdl3/src/java/org/greenstone/gsdl3/service/ServiceModule.java
r3441 r3471 40 40 * ServiceModule - abstract base class 41 41 * 42 * A ServiceModule provides Services to a collection/ system.42 * A ServiceModule provides Services to a collection/cluster/site. 43 43 * It may provide more than one Service. for eg 44 44 * MGGDBMServiceModule may support "DocRetrieve", "TextQuery", "MetadataRetrieve" services … … 50 50 implements ModuleInterface 51 51 { 52 53 52 54 /** the absolute address of the site home */ 53 55 protected String site_home_ =null; 54 /** the name of the c ollection directorythat this service belongs to -56 /** the name of the cluster that this service belongs to - 55 57 if any */ 56 protected String c ollection_name_ = null;58 protected String cluster_name_ = null; 57 59 58 60 /** some services can talk back to the message router */ … … 72 74 protected HashMap service_info_map_ = null; 73 75 76 /** sets the cluster name */ 77 public void setClusterName(String cluster_name) { 78 cluster_name_ = cluster_name; 79 } 74 80 /** sets the collect name */ 75 81 public void setCollectionName(String coll_name) { 76 collection_name_ = coll_name;82 setClusterName(coll_name); 77 83 } 78 84 … … 95 101 } 96 102 97 /** 98 * Configure the object. - default method for service modules 99 * 100 * reads either collection (if a collection name has been set), or system 101 * configuration file, and configures itself 102 * this calls configure(Element) with the XML element node from the config 103 * file. 104 * configure(Element) should be used if the config file has already been 105 * parsed. This method will work with any subclass. 106 * 107 * @return true if configure successful, false otherwise. 108 */ 109 public boolean configure(){ 110 111 if (site_home_==null) { 112 System.err.println("setSiteHome() must be called before configure()"); 113 return false; 114 } 115 116 File config_file=null; 117 if (collection_name_ !=null) { 118 119 config_file = new File(GSFile.collectionBuildConfigFile(site_home_, collection_name_)); 120 } 121 else { 122 config_file = new File(GSFile.siteConfigFile(site_home_)); 123 } 124 125 if (config_file.exists() ) { 126 127 Document doc = converter_.getDOM(config_file); 128 129 try { 130 // get the service list and look for own service 131 // Note: XPathAPI is slow apparently 132 String xpath = "//ServiceModule[@name='"+this.getClass().getName()+"']"; 133 System.out.println("xpath="+xpath); 134 Node n = XPathAPI.selectSingleNode(doc, xpath); 135 if (n !=null) { 136 return this.configure((Element)n); 137 } 138 } catch (Exception e) { 139 System.err.println("ServiceModule configure exception: "+e.getMessage()); 140 return false; 141 } 142 } 143 System.err.println("ServiceModule error: unable to configure ServiceModule " + this.getClass().getName() ); 144 return false; 145 146 147 } 148 149 /** The configure method that does the real work 103 104 /** configure the service module 150 105 * 151 106 * @param info the XML node <serviceModule name="XXX"/> with name equal
Note:
See TracChangeset
for help on using the changeset viewer.