Changeset 13124
- Timestamp:
- 2006-10-17T15:52:42+13:00 (18 years ago)
- Location:
- trunk/gsdl3/src/java/org/greenstone/gsdl3
- Files:
-
- 50 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/gsdl3/src/java/org/greenstone/gsdl3/action/Action.java
r9874 r13124 16 16 import java.util.Iterator; 17 17 18 import org.apache.log4j.*; 19 18 20 /** base class for Actions */ 19 21 abstract public class Action { … … 29 31 doesn't care about that */ 30 32 protected ModuleInterface mr=null; 33 34 static Category logger = Category.getInstance(org.greenstone.gsdl3.action.Action.class.getName()); 31 35 32 36 public Action() { … … 54 58 Document message_doc = this.converter.getDOM(xml_in); 55 59 if (message_doc == null) { 56 System.err.println("Action.process(String) Error:Couldn't parse request");57 System.err.println(xml_in);60 logger.error("Couldn't parse request"); 61 logger.error(xml_in); 58 62 return null; 59 63 } -
trunk/gsdl3/src/java/org/greenstone/gsdl3/action/AppletAction.java
r6300 r13124 12 12 import java.io.File; 13 13 14 import org.apache.log4j.*; 15 14 16 /** action class for handling applets */ 15 17 public class AppletAction extends Action { 16 18 19 static Category logger = Category.getInstance(org.greenstone.gsdl3.action.AppletAction.class.getName()); 17 20 18 21 public Element process (Element message) { … … 30 33 String request_type = (String)params.get(GSParams.REQUEST_TYPE); 31 34 if (!request_type.equals("d")&&!request_type.equals("r")) { 32 System.err.println("AppletAction Error: the rt arg should be either d or r, instead it was "+request_type+"!");35 logger.error("AppletAction Error: the rt arg should be either d or r, instead it was "+request_type+"!"); 33 36 return result; 34 37 } -
trunk/gsdl3/src/java/org/greenstone/gsdl3/action/BrowseAction.java
r6695 r13124 14 14 import java.io.File; 15 15 16 import org.apache.log4j.*; 17 16 18 //NOTE: this class not used at present!!!!! 17 19 /** action for classifier browsing */ 18 20 public class BrowseAction extends Action { 19 21 22 static Category logger = Category.getInstance(org.greenstone.gsdl3.action.BrowseAction.class.getName()); 23 20 24 public static final String CLASSIFIER_ARG = "cl"; 21 25 public static final String SIBLING_ARG = "sib"; … … 46 50 String collection = (String)params.get(GSParams.COLLECTION); 47 51 if (collection == null || collection.equals("")) { 48 System.err.println("BrowseAction Error:classifierBrowse, need to specify a collection!");52 logger.error("classifierBrowse, need to specify a collection!"); 49 53 return page_response; 50 54 … … 123 127 } 124 128 125 System.out.println("extracted meta names, "+metadata_names.toString());129 logger.info("extracted meta names, "+metadata_names.toString()); 126 130 // get the browse structure for the selected node 127 131 Element classify_message = this.doc.createElement(GSXML.MESSAGE_ELEM); … … 166 170 path); 167 171 if (cl_structure ==null) { 168 System.err.println("BrowseAction:classifier structure request returned no structure");172 logger.error("classifier structure request returned no structure"); 169 173 return page_response; 170 174 } … … 281 285 282 286 283 ///ystem.out.println("(BrowseAction) Page:\n" + this.converter.getPrettyString(page_response));287 logger.debug("(BrowseAction) Page:\n" + this.converter.getPrettyString(page_response)); 284 288 return page_response; 285 289 } 286 290 287 291 protected Element unknownBrowse(Element page, Element request, String browse_type) { 288 System.err.println("BrowseAction Error:unknown browse subtype: "+browse_type);292 logger.error("unknown browse subtype: "+browse_type); 289 293 return null; 290 294 } -
trunk/gsdl3/src/java/org/greenstone/gsdl3/action/DocumentAction.java
r11276 r13124 36 36 import java.io.File; 37 37 38 import org.apache.log4j.*; 38 39 39 40 /** Action class for retrieving Documents via the message router 40 41 */ 41 42 public class DocumentAction extends Action { 42 43 44 static Category logger = Category.getInstance(org.greenstone.gsdl3.action.DocumentAction.class.getName()); 45 43 46 // this is used to specify that the sibling nodes of a selected one should be obtained 44 47 public static final String SIBLING_ARG = "sib"; … … 86 89 String document_name = (String) params.get(GSParams.DOCUMENT); 87 90 if (document_name == null || document_name.equals("")) { 88 System.err.println("DocumentAction Error:no document specified!");91 logger.error("no document specified!"); 89 92 return result; 90 93 } … … 352 355 dc_request.appendChild(basic_doc_list); 353 356 } 354 ///ystem.err.println("request = "+converter.getString(dc_message));357 logger.debug("request = "+converter.getString(dc_message)); 355 358 Element dc_response_message = (Element) this.mr.process(dc_message); 356 359 if (processErrorElements(dc_response_message, page_response)) { … … 453 456 } 454 457 } 455 ///ystem.out.println("(DocumentAction) Page:\n" + this.converter.getPrettyString(result));458 logger.debug("(DocumentAction) Page:\n" + this.converter.getPrettyString(result)); 456 459 return result; 457 460 } … … 499 502 Element format_elem = (Element)GSXML.getChildByTagName(format_resp, GSXML.FORMAT_ELEM); 500 503 if (format_elem != null) { 501 ///ystem.out.println("doc action found a format statement");504 logger.debug("doc action found a format statement"); 502 505 // set teh format type 503 506 format_elem.setAttribute(GSXML.TYPE_ATT, "display"); … … 552 555 String service_name = (String)previous_params.get(GSParams.SERVICE); 553 556 if (service_name == null || !service_name.endsWith("Query")) { // hack for now - we only do highlighting if we were in a query last - ie not if we were in a browse thingy 554 System.err.println("DocumentAction:invalid service, not doing highlighting");557 logger.error("invalid service, not doing highlighting"); 555 558 return dc_response_doc_content; 556 559 } … … 578 581 if (query_term_list_element == null) { 579 582 // no term info 580 System.err.println("DocumentAction: Warning:No query term information.\n");583 logger.error("No query term information.\n"); 581 584 return dc_response_doc_content; 582 585 } -
trunk/gsdl3/src/java/org/greenstone/gsdl3/action/GS2BrowseAction.java
r9900 r13124 14 14 import java.io.File; 15 15 16 import org.apache.log4j.*; 17 16 18 /** action for GS2 style classifier browsing */ 17 19 public class GS2BrowseAction extends Action { 18 20 19 21 public static final String CLASSIFIER_ARG = "cl"; 20 22 23 static Category logger = Category.getInstance(org.greenstone.gsdl3.action.GS2BrowseAction.class.getName()); 24 21 25 /** process the request */ 22 26 public Element process (Element message) { … … 44 48 String collection = (String)params.get(GSParams.COLLECTION); 45 49 if (collection == null || collection.equals("")) { 46 System.err.println("GS2BrowseAction Error:classifierBrowse, need to specify a collection!");50 logger.error("classifierBrowse, need to specify a collection!"); 47 51 return page_response; 48 52 … … 175 179 path); 176 180 if (cl_structure ==null) { 177 System.err.println("GS2BrowseAction:classifier structure request returned no structure");181 logger.error("classifier structure request returned no structure"); 178 182 return page_response; 179 183 } … … 302 306 303 307 304 ///ystem.out.println("(GS2BrowseAction) Page:\n" + this.converter.getPrettyString(page_response));308 logger.debug("(GS2BrowseAction) Page:\n" + this.converter.getPrettyString(page_response)); 305 309 return page_response; 306 310 } -
trunk/gsdl3/src/java/org/greenstone/gsdl3/action/GeneralAction.java
r8800 r13124 13 13 import java.util.Iterator; 14 14 import java.io.File; 15 15 16 16 17 public class GeneralAction extends Action { -
trunk/gsdl3/src/java/org/greenstone/gsdl3/action/NoCollQueryAction.java
r8677 r13124 17 17 import java.io.File; 18 18 19 import org.apache.log4j.*; 20 19 21 /** action class for queries 20 22 * this is used when querying isn't collection specific, but it occurs across all collections in the site. The service description is assumed to be known by the xslt so we dont ask for it. we just pass all the service params to the TextQuery service of all the collections */ 21 23 public class NoCollQueryAction extends Action { 22 24 25 static Category logger = Category.getInstance(org.greenstone.gsdl3.action.NoCollQueryAction.class.getName()); 23 26 /** process - processes a request. 24 27 */ … … 70 73 71 74 if (query_coll_list == null || query_coll_list.equals("")) { 72 System.err.println("NoCollQueryAction Error:no collections were specified!");75 logger.error("no collections were specified!"); 73 76 Element coll_list = getCollectionList(lang, uid); 74 77 page_response.appendChild(this.doc.importNode(coll_list, true)); … … 167 170 Element coll_list_response = (Element)this.mr.process(coll_list_message); 168 171 if (coll_list_response==null) { 169 System.err.println("NoCollQueryAction Error:couldn't query the message router!");172 logger.error("couldn't query the message router!"); 170 173 return null; 171 174 } … … 193 196 // check that have same number of responses as collections 194 197 if (colls.getLength() != coll_responses.getLength()) { 195 System.err.println("NoCollQueryAction Error:didn't get a response for each collection - somethings gone wrong!");198 logger.error("didn't get a response for each collection - somethings gone wrong!"); 196 199 // for now, dont use the metadata 197 200 } else { … … 203 206 GSXML.mergeElements(c1, (Element)GSXML.getChildByTagName(c2, GSXML.COLLECTION_ELEM)); 204 207 } else { 205 System.err.println("NoCollQueryAction Error:response does not correspond to request!");208 logger.error("response does not correspond to request!"); 206 209 } 207 210 -
trunk/gsdl3/src/java/org/greenstone/gsdl3/action/PageAction.java
r11230 r13124 12 12 import java.io.File; 13 13 14 import org.apache.log4j.*; 15 14 16 public class PageAction extends Action { 17 18 static Category logger = Category.getInstance(org.greenstone.gsdl3.action.PageAction.class.getName()); 15 19 16 20 public static final String HOME_PAGE = "home"; … … 35 39 } else { // unknown page 36 40 37 System.err.println("PageAction Error:unknown page specified!");41 logger.error("unknown page specified!"); 38 42 response = unknownPage(request); 39 43 } 40 44 41 45 result.appendChild(this.doc.importNode(response, true)); 42 ///ystem.out.println("page action result: "+this.converter.getPrettyString(result));46 logger.debug("page action result: "+this.converter.getPrettyString(result)); 43 47 return result; 44 48 } … … 55 59 Element info_response_message = (Element)this.mr.process(info_message); 56 60 if (info_response_message==null) { 57 System.err.println("PageAction Error:couldn't query the message router!");61 logger.error(" couldn't query the message router!"); 58 62 return null; 59 63 } 60 64 Element info_response = (Element)GSXML.getChildByTagName(info_response_message, GSXML.RESPONSE_ELEM); 61 65 if (info_response==null) { 62 System.err.println("PageAction Error:couldn't query the message router!");66 logger.error("couldn't query the message router!"); 63 67 return null; 64 68 } … … 108 112 String coll_name = (String)params.get(GSParams.COLLECTION); 109 113 if (coll_name == null || coll_name.equals("")) { 110 System.err.println("PageAction Error:about page requested with no collection or cluster specified!");114 logger.error("about page requested with no collection or cluster specified!"); 111 115 // return an empty response 112 116 return this.doc.createElement(GSXML.RESPONSE_ELEM); … … 194 198 // check that have same number of responses as requests 195 199 if (items.getLength() != responses.getLength()) { 196 System.err.println("PageAction Error:didn't get a response for each request - somethings gone wrong!");200 logger.error("didn't get a response for each request - somethings gone wrong!"); 197 201 return false; 198 202 } … … 205 209 GSXML.mergeElements(c1, c2); 206 210 } else { 207 System.err.println("PageAction Error:response does not correspond to request!");211 logger.error(" response does not correspond to request!"); 208 212 } 209 213 -
trunk/gsdl3/src/java/org/greenstone/gsdl3/action/QueryAction.java
r11013 r13124 17 17 import java.io.File; 18 18 19 import org.apache.log4j.*; 20 19 21 /** action class for queries */ 20 22 public class QueryAction extends Action { 23 24 25 static Category logger = Category.getInstance(org.greenstone.gsdl3.action.QueryAction.class.getName()); 21 26 22 27 /** process - processes a request. … … 116 121 Element query_result_metadata_list = (Element) GSXML.getChildByTagName(query_response, GSXML.METADATA_ELEM+GSXML.LIST_MODIFIER); 117 122 if (query_result_metadata_list == null) { 118 System.err.println("QueryAction: Warning:No query result metadata.\n");123 logger.error("No query result metadata.\n"); 119 124 } else { // add it into the page response 120 125 page_response.appendChild(this.doc.importNode(query_result_metadata_list, true)); … … 123 128 Element query_term_info_list = (Element) GSXML.getChildByTagName(query_response, GSXML.TERM_ELEM+GSXML.LIST_MODIFIER); 124 129 if (query_term_info_list == null) { 125 System.err.println("QueryAction: Warning:No query term information.\n");130 logger.error("No query term information.\n"); 126 131 } else { // add it into the page response 127 132 page_response.appendChild(this.doc.importNode(query_term_info_list, true)); … … 140 145 NodeList doc_metadata = document_list.getElementsByTagName(GSXML.METADATA_ELEM+GSXML.LIST_MODIFIER); 141 146 if (doc_metadata.getLength()>0) { 142 System.err.println("have already found metadata!");147 logger.error("have already found metadata!"); 143 148 // append the doc list to the result 144 149 page_response.appendChild(this.doc.importNode(document_list, true)); … … 193 198 } 194 199 195 ///ystem.out.println("Query page:\n" + this.converter.getPrettyString(page_response));200 logger.debug("Query page:\n" + this.converter.getPrettyString(page_response)); 196 201 return page_response; 197 202 } -
trunk/gsdl3/src/java/org/greenstone/gsdl3/action/SystemAction.java
r6300 r13124 13 13 import java.util.HashMap; 14 14 15 import org.apache.log4j.*; 16 15 17 public class SystemAction extends Action { 16 18 19 static Category logger = Category.getInstance(org.greenstone.gsdl3.action.SystemAction.class.getName()); 20 17 21 /** process a request */ 18 22 public Element process (Element message) { … … 65 69 // create the default response 66 70 // for now just have an error 67 System.err.println("SystemAction error:bad subaction type");71 logger.error("bad subaction type"); 68 72 Element page_response = this.doc.createElement(GSXML.RESPONSE_ELEM); 69 73 result.appendChild(page_response); -
trunk/gsdl3/src/java/org/greenstone/gsdl3/core/DefaultReceptionist.java
r9874 r13124 14 14 import java.util.Enumeration; 15 15 16 import org.apache.log4j.*; 17 16 18 /** The default greenstone receptionist - needs some extra info for each page 17 19 */ 18 20 public class DefaultReceptionist extends TransformingReceptionist { 21 22 static Category logger = Category.getInstance(org.greenstone.gsdl3.core.DefaultReceptionist.class.getName()); 19 23 20 24 protected void addExtraInfo(Element page) { … … 27 31 String action = page_request.getAttribute(GSXML.ACTION_ATT); 28 32 if (action.equals("s")) { 29 System.err.println("HACK: don't ask for coll info if system action");33 logger.error("HACK: don't ask for coll info if system action"); 30 34 return; 31 35 } 32 ///ystem.out.println("add extra info, page request="+this.converter.getString(page_request));36 logger.debug("add extra info, page request="+this.converter.getString(page_request)); 33 37 // is a collection defined? 34 38 Element param_list = (Element)GSXML.getChildByTagName(page_request, GSXML.PARAM_ELEM+GSXML.LIST_MODIFIER); 35 39 if (param_list==null) { // must be the original home page 36 ///ystem.out.println("DefaultReceptionist:no param list, assuming home page");40 logger.debug(" no param list, assuming home page"); 37 41 return; 38 42 } 39 43 Element coll_param = GSXML.getNamedElement(param_list, GSXML.PARAM_ELEM, GSXML.NAME_ATT, GSParams.COLLECTION); 40 44 if (coll_param == null) { 41 ///ystem.out.println("DefaultReceptionist:coll param is null, returning");45 logger.debug(" coll param is null, returning"); 42 46 return; 43 47 } … … 75 79 76 80 if (coll_description == null) { 77 System.err.println("DefaultReceptionist:no collection description, returning");81 logger.error(" no collection description, returning"); 78 82 return; 79 83 } … … 89 93 Element service_list = (Element)GSXML.getChildByTagName(coll_description, GSXML.SERVICE_ELEM+GSXML.LIST_MODIFIER); 90 94 if (service_list == null) { 91 System.err.println("DefaultReceptionist:no service list, returning");95 logger.error(" no service list, returning"); 92 96 // something weird has gone wrong 93 97 return; … … 96 100 NodeList services = service_list.getElementsByTagName(GSXML.SERVICE_ELEM); 97 101 if (services.getLength()==0) { 98 System.err.println("DefaultReceoptionist: no services found for colllection/cluster "+ coll_name);102 logger.error("DefaultReceoptionist: no services found for colllection/cluster "+ coll_name); 99 103 return; 100 104 } … … 118 122 119 123 // if get here, we need to get the service descriptions 120 ///ystem.out.println("getting services description");124 logger.debug("getting services description"); 121 125 122 126 // we will send all the requests in a single message … … 139 143 // check that have same number of responses as collections 140 144 if (services.getLength() != service_responses.getLength()) { 141 System.err.println("DefaultReceptionist Error:didn't get a response for each service - somethings gone wrong!");145 logger.error(" didn't get a response for each service - somethings gone wrong!"); 142 146 // for now, dont use the metadata 143 147 } else { … … 149 153 GSXML.mergeElements(c1, c2); 150 154 } else { 151 System.err.println("DefaultReceptionist Error:response does not correspond to request!");155 logger.error(" response does not correspond to request!"); 152 156 } 153 157 -
trunk/gsdl3/src/java/org/greenstone/gsdl3/core/MessageRouter.java
r11269 r13124 42 42 import java.util.Properties; 43 43 44 import org.apache.log4j.*; 45 44 46 /** 45 47 * The hub of a Greenstone system. … … 62 64 public class MessageRouter implements ModuleInterface { 63 65 66 static Category logger = Category.getInstance(org.greenstone.gsdl3.core.MessageRouter.class.getName()); 67 64 68 /** the (directory) name of the site */ 65 69 protected String site_name = null; … … 127 131 public boolean configure() { 128 132 129 System.out.println("MessageRouter:configuring site");133 logger.info("configuring site"); 130 134 131 135 if (this.site_name==null) { 132 System.err.println("MessageRouter:You must set site_name before calling configure");136 logger.error(" You must set site_name before calling configure"); 133 137 return false; 134 138 } … … 158 162 159 163 } catch (Exception e) { 160 System.err.println("MessageRouter Error: couldn't set up an authenticator the proxy");164 logger.error("MessageRouter Error: couldn't set up an authenticator the proxy"); 161 165 162 166 } … … 168 172 169 173 if (!configFile.exists() ) { 170 System.err.println("MessageRouter:site config file: "+configFile.getPath()+" not found!");174 logger.error(" site config file: "+configFile.getPath()+" not found!"); 171 175 return false; 172 176 } … … 174 178 Document config_doc = this.converter.getDOM(configFile); 175 179 if (config_doc == null) { 176 System.err.println("MessageRouter:couldn't parse site config file: "+configFile.getPath());180 logger.error(" couldn't parse site config file: "+configFile.getPath()); 177 181 return false; 178 182 } … … 226 230 */ 227 231 public Element process(Element message) { 228 229 ///ystem.out.println("MR received request");230 ///ystem.out.println(this.converter.getString(message));232 233 logger.debug("MR received request"); 234 logger.debug(this.converter.getString(message)); 231 235 // check that its a correct message tag 232 236 if (!message.getTagName().equals(GSXML.MESSAGE_ELEM)) { 233 System.err.println("MessageRouter:Invalid message. GSDL message should start with <"+GSXML.MESSAGE_ELEM+">, instead it starts with:"+message.getTagName()+".");237 logger.error(" Invalid message. GSDL message should start with <"+GSXML.MESSAGE_ELEM+">, instead it starts with:"+message.getTagName()+"."); 234 238 return null; 235 239 } … … 254 258 Element req = (Element)requests.item(i); 255 259 if (req == null) { 256 System.err.println("request "+i+" is null");260 logger.error("request "+i+" is null"); 257 261 continue; 258 262 } … … 294 298 response.setAttribute(GSXML.FROM_ATT, this_mod); 295 299 mainResult.appendChild(response); 296 System.err.println("MessageRouter Error: request had null result!");300 logger.error("MessageRouter Error: request had null result!"); 297 301 } 298 302 299 303 } else { 300 System.err.println("MessageRouter Error: request has illegal module name in:\n"+this.converter.getString(req));304 logger.error("MessageRouter Error: request has illegal module name in:\n"+this.converter.getString(req)); 301 305 } 302 306 } … … 305 309 } // for each request 306 310 307 ///ystem.out.println("MR returned response");308 ///ystem.out.println(this.converter.getString(mainResult));311 logger.debug("MR returned response"); 312 logger.debug(this.converter.getString(mainResult)); 309 313 310 314 return mainResult; … … 322 326 323 327 // load up the individual services 324 System.out.println("loading service modules...");328 logger.info("loading service modules..."); 325 329 326 330 if (service_rack_list == null) { 327 System.out.println("... none to be loaded");331 logger.info("... none to be loaded"); 328 332 return true; 329 333 } … … 331 335 NodeList service_racks = service_rack_list.getElementsByTagName(GSXML.SERVICE_CLASS_ELEM); 332 336 if (service_racks.getLength()==0) { 333 System.out.println("... none to be loaded");337 logger.info("... none to be loaded"); 334 338 return true; 335 339 } … … 342 346 Element n = (Element)service_racks.item(i); 343 347 String service_name = n.getAttribute(GSXML.NAME_ATT); 344 System.out.println("..."+service_name);348 logger.info("..."+service_name); 345 349 try { 346 350 ServiceRack s = (ServiceRack)Class.forName("org.greenstone.gsdl3.service."+service_name).newInstance(); … … 355 359 NodeList services = service_response.getElementsByTagName(GSXML.SERVICE_ELEM); 356 360 if (services.getLength()==0) { 357 System.err.println("MessageRouter configure error: serviceRack "+service_name+" has no services!");361 logger.error("MessageRouter configure error: serviceRack "+service_name+" has no services!"); 358 362 } else { 359 363 for (int j=0; j<services.getLength();j++) { … … 366 370 } 367 371 } catch (Exception e ) { 368 System.err.println("MessageRouter configure exception: in ServiceRack class specification: "+ e.getMessage());372 logger.error("MessageRouter configure exception: in ServiceRack class specification: "+ e.getMessage()); 369 373 e.printStackTrace(); 370 374 } … … 377 381 this.cluster_list = this.doc.createElement(GSXML.CLUSTER_ELEM+GSXML.LIST_MODIFIER); 378 382 // load up the service clusters 379 System.out.println("loading service clusters ...");383 logger.info("loading service clusters ..."); 380 384 if (config_cluster_list == null) { 381 System.out.println("... none to be loaded");385 logger.info("... none to be loaded"); 382 386 return true; 383 387 } 384 388 NodeList service_clusters = config_cluster_list.getElementsByTagName(GSXML.CLUSTER_ELEM); 385 389 if (service_clusters.getLength()==0) { 386 System.out.println("... none to be loaded");390 logger.info("... none to be loaded"); 387 391 return true; 388 392 } … … 391 395 Element cluster = (Element)service_clusters.item(i); 392 396 String name = cluster.getAttribute(GSXML.NAME_ATT); 393 System.out.println("..."+name);397 logger.info("..."+name); 394 398 ServiceCluster sc = new ServiceCluster(); 395 399 sc.setSiteHome(this.site_home); … … 415 419 File collectDir = new File(GSFile.collectDir(this.site_home)); 416 420 if (collectDir.exists()) { 417 System.out.println("Reading thru directory "+collectDir.getPath()+" to find collections.");421 logger.info("Reading thru directory "+collectDir.getPath()+" to find collections."); 418 422 File[] contents = collectDir.listFiles(); 419 423 for (int i=0; i<contents.length;i++) { … … 434 438 this.site_list = this.doc.createElement(GSXML.SITE_ELEM+GSXML.LIST_MODIFIER); 435 439 // load up the sites 436 System.out.println("loading external sites...");440 logger.info("loading external sites..."); 437 441 if (config_site_list ==null ) { 438 System.out.println("...none found");442 logger.info("...none found"); 439 443 return true; 440 444 } … … 442 446 NodeList sites = config_site_list.getElementsByTagName(GSXML.SITE_ELEM); 443 447 if (sites.getLength()==0) { 444 System.out.println("...none found");448 logger.info("...none found"); 445 449 return true; 446 450 } … … 475 479 // have to be added later 476 480 if (!getRemoteSiteInfo(comm, name)) { 477 System.err.println("MessageRouter:couldn't get info from site "+name);481 logger.error(" couldn't get info from site "+name); 478 482 } 479 483 } else { 480 System.err.println("MessageRouter:couldn't configure soap site:"+name);484 logger.error(" couldn't configure soap site:"+name); 481 485 return false; 482 486 } 483 487 484 488 } else { 485 System.err.print(" MessageRouter:cant talk to server of type:"+type + ", so not making a connection to "+name);489 System.err.print(" cant talk to server of type:"+type + ", so not making a connection to "+name); 486 490 return false; 487 491 } … … 497 501 protected boolean getRemoteSiteInfo(Communicator comm, String site_name) { 498 502 499 System.out.println("MessageRouter:getting info from site:"+site_name);503 logger.info(" getting info from site:"+site_name); 500 504 501 505 Element info_request = this.doc.createElement(GSXML.MESSAGE_ELEM); … … 630 634 File configFile = new File(GSFile.siteConfigFile(this.site_home)); 631 635 if (!configFile.exists() ) { 632 System.err.println("MessageRouter:site config file: "+configFile.getPath()+" not found!");636 logger.error(" site config file: "+configFile.getPath()+" not found!"); 633 637 continue; 634 638 } 635 639 Document site_config_doc = this.converter.getDOM(configFile); 636 640 if (site_config_doc == null) { 637 System.err.println("MessageRouter:couldn't parse site config file: "+configFile.getPath());641 logger.error(" couldn't parse site config file: "+configFile.getPath()); 638 642 continue; 639 643 } … … 696 700 697 701 // if get here something has gone wrong 698 System.err.println("MessageRouter:cant process request:");699 System.err.println(this.converter.getString(req));702 logger.error(" cant process request:"); 703 logger.error(this.converter.getString(req)); 700 704 return null; 701 705 … … 708 712 NodeList commands = request.getElementsByTagName("command"); 709 713 if (commands == null) { 710 System.err.println("no commands, "+converter.getPrettyString(request));714 logger.error("no commands, "+converter.getPrettyString(request)); 711 715 return response; 712 716 } … … 769 773 protected boolean activateCollectionByName(String col_name) { 770 774 771 System.out.println("MessageRouter:Activating collection: "+col_name+".");775 logger.info("Activating collection: "+col_name+"."); 772 776 773 777 // now we need to look for the etc/collectionInit.xml file, and see what sort of Collection to load … … 784 788 c = (Collection)Class.forName("org.greenstone.gsdl3.collection."+coll_class_name).newInstance(); 785 789 } catch (Exception e) { 786 System.out.println("MessageRouter:couldn't create a new collection, type "+coll_class_name+", defaulting to class Collection");790 logger.info(" couldn't create a new collection, type "+coll_class_name+", defaulting to class Collection"); 787 791 } 788 792 } … … 809 813 return true; 810 814 } else { 811 System.err.println("MessageRouter:Couldn't configure collection: "+815 logger.error("Couldn't configure collection: "+ 812 816 col_name+"."); 813 817 return false; … … 817 821 818 822 protected boolean activateSiteByName(String site_name) { 819 System.out.println("MessageRouter:Activating site: "+site_name+".");823 logger.info("Activating site: "+site_name+"."); 820 824 821 825 // just in case this is a reactivation, deactivate this site first … … 824 828 825 829 if (!configFile.exists() ) { 826 System.err.println("MessageRouter:site config file: "+configFile.getPath()+" not found!");830 logger.error(" site config file: "+configFile.getPath()+" not found!"); 827 831 return false; 828 832 } 829 833 Document config_doc = this.converter.getDOM(configFile); 830 834 if (config_doc == null) { 831 System.err.println("MessageRouter:couldn't parse site config file: "+configFile.getPath());835 logger.error(" couldn't parse site config file: "+configFile.getPath()); 832 836 return false; 833 837 } … … 836 840 Element config_site_list = (Element)GSXML.getChildByTagName(config_elem, GSXML.SITE_ELEM+GSXML.LIST_MODIFIER); 837 841 if (config_site_list ==null ) { 838 System.err.println("MessageRouter:activateSite, no sites found");842 logger.error("activateSite, no sites found"); 839 843 return false; 840 844 } … … 847 851 Element this_site_elem = GSXML.getNamedElement(config_site_list, GSXML.SITE_ELEM, GSXML.NAME_ATT, site_name); 848 852 if (this_site_elem == null) { 849 System.err.println("MessageRouter:activateSite, site "+site_name+" not found");853 logger.error("activateSite, site "+site_name+" not found"); 850 854 return false; 851 855 } … … 867 871 if (this.module_map.containsKey(name)) { 868 872 869 System.out.println("MessageRouter:deactivating "+name);873 logger.info(" deactivating "+name); 870 874 ModuleInterface m = (ModuleInterface)this.module_map.remove(name); 871 875 m.cleanUp(); // clean up any open files/connections etc - can cause trouble on windows … … 900 904 } 901 905 } else { 902 System.err.println("MessageRouter:couldn't deactivate coll");906 logger.error(" couldn't deactivate coll"); 903 907 // couldn't do it 904 908 return false; -
trunk/gsdl3/src/java/org/greenstone/gsdl3/core/NZDLReceptionist.java
r6677 r13124 14 14 import java.util.Enumeration; 15 15 16 import org.apache.log4j.*; 17 16 18 /** 17 19 * This is a new version of the Receptionist for the NZDL interface … … 20 22 */ 21 23 public class NZDLReceptionist extends DefaultReceptionist { 22 24 25 static Category logger = Category.getInstance(org.greenstone.gsdl3.core. NZDLReceptionist.class.getName()); 26 23 27 protected void addExtraInfo(Element page) { 24 ///ystem.out.println("the page before adding extra info is");25 ///ystem.out.println(this.converter.getPrettyString(page));28 logger.debug("the page before adding extra info is"); 29 logger.debug(this.converter.getPrettyString(page)); 26 30 27 31 super.addExtraInfo(page); … … 87 91 } 88 92 } 89 ///ystem.out.println("the final page before transforming is");90 ///ystem.out.println(this.converter.getPrettyString(page));93 logger.debug("the final page before transforming is"); 94 logger.debug(this.converter.getPrettyString(page)); 91 95 return; 92 96 } -
trunk/gsdl3/src/java/org/greenstone/gsdl3/core/Receptionist.java
r10293 r13124 15 15 import java.util.ArrayList; 16 16 17 import org.apache.log4j.*; 18 17 19 /** the most basic Receptionist, used for interface generation. 18 20 * Receives requests consisting … … 23 25 public class Receptionist implements ModuleInterface { 24 26 27 static Category logger = Category.getInstance(org.greenstone.gsdl3.core.Receptionist.class.getName()); 28 25 29 /** the set up variables */ 26 30 protected HashMap config_params = null; … … 67 71 68 72 if (this.config_params==null) { 69 System.err.println("Receptionist Error:config variables must be set before calling configure");73 logger.error(" config variables must be set before calling configure"); 70 74 return false; 71 75 } 72 76 if (this.mr==null) { 73 System.err.println("Receptionist Error:message router must be set before calling configure");77 logger.error(" message router must be set before calling configure"); 74 78 return false; 75 79 } … … 78 82 File interface_config_file = new File(GSFile.interfaceConfigFile(GSFile.interfaceHome(GlobalProperties.getGSDL3Home(), (String)this.config_params.get(GSConstants.INTERFACE_NAME)))); 79 83 if (!interface_config_file.exists()) { 80 System.err.println("Receptionist:interface config file: "+interface_config_file.getPath()+" not found!");84 logger.error(" interface config file: "+interface_config_file.getPath()+" not found!"); 81 85 return false; 82 86 } … … 84 88 Document config_doc = this.converter.getDOM(interface_config_file); 85 89 if (config_doc == null) { 86 System.err.println("Receptionist:could not parse interface config file: "+interface_config_file.getPath());90 logger.error(" could not parse interface config file: "+interface_config_file.getPath()); 87 91 return false; 88 92 } … … 104 108 ac = (Action)Class.forName("org.greenstone.gsdl3.action."+class_name).newInstance(); 105 109 } catch (Exception e) { 106 System.err.println("Receptionist:couldn't load in action "+class_name);110 logger.error(" couldn't load in action "+class_name); 107 111 e.printStackTrace(); 108 112 continue; … … 117 121 this.language_list = (Element)GSXML.getChildByTagName(config_elem, "languageList"); 118 122 if (language_list == null) { 119 System.err.println("Receptionist:didn't find a language list in the config file!!");123 logger.error(" didn't find a language list in the config file!!"); 120 124 } 121 125 … … 138 142 Element request = (Element)GSXML.getChildByTagName(message, GSXML.REQUEST_ELEM); 139 143 if (request == null) { 140 System.err.println("Receptionist Error:message had no request!");144 logger.error(" message had no request!"); 141 145 return null; 142 146 } … … 145 149 if (!type.equals(GSXML.REQUEST_TYPE_PAGE)) { 146 150 // now Receptionist forwards non-page requests straight to the MR, and returns the responses 147 System.err.println("Receptionist:request type is not '"+GSXML.REQUEST_TYPE_PAGE+"', but it is '"+type+"', so forwarding the message to the MR!");151 logger.error(" request type is not '"+GSXML.REQUEST_TYPE_PAGE+"', but it is '"+type+"', so forwarding the message to the MR!"); 148 152 // process the whole message - mr needs <message> tags, and 149 153 // in this case, there may be more than one request in the message … … 153 157 String action = request.getAttribute(GSXML.ACTION_ATT); 154 158 if (action.equals("")) { 155 System.err.println("Receptionist Error:no action specified in the request!");159 logger.error(" no action specified in the request!"); 156 160 return null; 157 161 } … … 173 177 } catch (Exception e) { 174 178 175 System.err.println("Receptionist Error:a new action ("+action_name+") was specified and it couldn't be created. Error message:"+e.getMessage());179 logger.error(" a new action ("+action_name+") was specified and it couldn't be created. Error message:"+e.getMessage()); 176 180 return null; 177 181 } … … 209 213 page.appendChild(page_response); 210 214 211 ///ystem.out.println("Receptionist:raw page="+this.converter.getString(page));215 logger.debug(" raw page="+this.converter.getString(page)); 212 216 // transform the result in some way 213 217 Element resulting_page = postProcessPage(page); … … 226 230 File base_interface_config_file = new File(GSFile.interfaceConfigFile(GSFile.interfaceHome(GlobalProperties.getGSDL3Home(), base_interface))); 227 231 if (!base_interface_config_file.exists()) { 228 System.err.println("Receptionist:base interface config file: "+base_interface_config_file.getPath()+" not found!");232 logger.error(" base interface config file: "+base_interface_config_file.getPath()+" not found!"); 229 233 return false; 230 234 } … … 237 241 Document config_doc = this.converter.getDOM(base_interface_config_file); 238 242 if (config_doc == null) { 239 System.err.println("Receptionist:could not parse base interface config file: "+base_interface_config_file.getPath());243 logger.error(" could not parse base interface config file: "+base_interface_config_file.getPath()); 240 244 return false; 241 245 } … … 249 253 Element option_list = (Element)GSXML.getChildByTagName(config_elem, "optionList"); 250 254 if (option_list != null) { 251 System.err.println("found an option list");255 logger.error("found an option list"); 252 256 // we set any options in the config params 253 257 NodeList options = option_list.getElementsByTagName("option"); … … 256 260 String name = option.getAttribute(GSXML.NAME_ATT); 257 261 String value = option.getAttribute(GSXML.VALUE_ATT); 258 System.err.println("option: "+name+", "+value);262 logger.error("option: "+name+", "+value); 259 263 if (!name.equals("") && !value.equals("")) { 260 264 this.config_params.put(name, value); -
trunk/gsdl3/src/java/org/greenstone/gsdl3/core/TransformingReceptionist.java
r10293 r13124 14 14 import java.util.Enumeration; 15 15 16 import org.apache.log4j.*; 17 16 18 /** A receptionist that uses xslt to transform the page_data before returning it. . Receives requests consisting 17 19 * of an xml representation of cgi args, and returns the page of data - in … … 22 24 public class TransformingReceptionist extends Receptionist{ 23 25 26 static Category logger = Category.getInstance(org.greenstone.gsdl3.core.TransformingReceptionist.class.getName()); 27 24 28 /** the list of xslt to use for actions */ 25 29 protected HashMap xslt_map = null; … … 38 42 39 43 if (this.config_params==null) { 40 System.err.println("TransformingReceptionist Error:config variables must be set before calling configure");44 logger.error(" config variables must be set before calling configure"); 41 45 return false; 42 46 } 43 47 if (this.mr==null) { 44 System.err.println("TransformingReceptionist Error:message router must be set before calling configure");48 logger.error(" message router must be set before calling configure"); 45 49 return false; 46 50 } … … 49 53 File interface_config_file = new File(GSFile.interfaceConfigFile(GSFile.interfaceHome(GlobalProperties.getGSDL3Home(), (String)this.config_params.get(GSConstants.INTERFACE_NAME)))); 50 54 if (!interface_config_file.exists()) { 51 System.err.println("TransformingReceptionist:interface config file: "+interface_config_file.getPath()+" not found!");55 logger.error(" interface config file: "+interface_config_file.getPath()+" not found!"); 52 56 return false; 53 57 } 54 58 Document config_doc = this.converter.getDOM(interface_config_file, "utf-8"); 55 59 if (config_doc == null) { 56 System.err.println("TransformingReceptionist:could not parse interface config file: "+interface_config_file.getPath());60 logger.error(" could not parse interface config file: "+interface_config_file.getPath()); 57 61 return false; 58 62 } … … 73 77 ac = (Action)Class.forName("org.greenstone.gsdl3.action."+class_name).newInstance(); 74 78 } catch (Exception e) { 75 System.err.println("TransformingReceptionist Error:couldn't load in action "+class_name);79 logger.error(" couldn't load in action "+class_name); 76 80 e.printStackTrace(); 77 81 continue; … … 95 99 96 100 String map_key = action_name+":"+subname; 97 ///ystem.out.println("adding in to xslt map, "+map_key+"->"+subxslt);101 logger.debug("adding in to xslt map, "+map_key+"->"+subxslt); 98 102 this.xslt_map.put(map_key, subxslt); 99 103 } … … 103 107 Element lang_list = (Element)GSXML.getChildByTagName(config_elem, "languageList"); 104 108 if (lang_list == null) { 105 System.err.println("TransformingReceptionist:didn't find a language list in the config file!!");109 logger.error(" didn't find a language list in the config file!!"); 106 110 } else { 107 111 this.language_list = (Element) this.doc.importNode(lang_list, true); … … 130 134 protected Element transformPage(Element page) { 131 135 132 //ystem.out.println("page before transfomring:");133 //ystem.out.println(this.converter.getPrettyString(page));136 logger.debug("page before transfomring:"); 137 logger.debug(this.converter.getPrettyString(page)); 134 138 135 139 Element request = (Element)GSXML.getChildByTagName(page, GSXML.PAGE_REQUEST_ELEM); … … 157 161 if (xslt_file==null) { 158 162 // cant transform the page - return null or the original? 159 System.err.println("TransformingReceptionist:cant find the xslt file needed, so returning the original page!");163 logger.error(" cant find the xslt file needed, so returning the original page!"); 160 164 return page; 161 165 } 162 166 Document style_doc = this.converter.getDOM(new File(xslt_file), "UTF-8"); 163 167 if (style_doc == null) { 164 System.err.println("TransformingReceptionist:cant parse the xslt file needed, so returning the original page!");168 logger.error(" cant parse the xslt file needed, so returning the original page!"); 165 169 return page; 166 170 … … 172 176 if (format_elem != null) { 173 177 //page_response.removeChild(format_elem); 174 ///ystem.err.println("format elem="+this.converter.getPrettyString(format_elem));178 logger.debug("format elem="+this.converter.getPrettyString(format_elem)); 175 179 // need to transform the format info 176 180 String stylesheet_file = GSFile.stylesheetFile(GlobalProperties.getGSDL3Home(), (String)this.config_params.get(GSConstants.SITE_NAME), collection, (String)this.config_params.get(GSConstants.INTERFACE_NAME), base_interfaces, "config_format.xsl"); … … 180 184 format_doc.appendChild(format_doc.importNode(format_elem, true)); 181 185 Element new_format = (Element)this.transformer.transform(stylesheet_doc, format_doc); 182 ///ystem.err.println("new format elem="+this.converter.getPrettyString(new_format));186 logger.debug("new format elem="+this.converter.getPrettyString(new_format)); 183 187 184 188 // add it in to the main stylesheet 185 189 GSXSLT.mergeStylesheets(style_doc, new_format); 186 190 } else { 187 System.err.println("TransformingReceptionist:couldn't parse the config_format stylesheet, adding the format info as is");191 logger.error(" couldn't parse the config_format stylesheet, adding the format info as is"); 188 192 GSXSLT.mergeStylesheets(style_doc, format_elem); 189 193 } 190 ///ystem.out.println("the converted stylesheet is:");191 ///ystem.out.println(this.converter.getPrettyString(style_doc.getDocumentElement()));194 logger.debug("the converted stylesheet is:"); 195 logger.debug(this.converter.getPrettyString(style_doc.getDocumentElement())); 192 196 } 193 197 … … 215 219 String stylesheet = GSFile.stylesheetFile(GlobalProperties.getGSDL3Home(), (String)this.config_params.get(GSConstants.SITE_NAME), collection, (String)this.config_params.get(GSConstants.INTERFACE_NAME), base_interfaces, name); 216 220 if (stylesheet==null) { 217 System.out.println("TransformingReceptionist:cant find stylesheet for "+name);221 logger.info(" cant find stylesheet for "+name); 218 222 } 219 223 return stylesheet; -
trunk/gsdl3/src/java/org/greenstone/gsdl3/service/AbstractBrowse.java
r11280 r13124 34 34 import java.util.ArrayList; 35 35 36 import org.apache.log4j.*; 37 36 38 /** Partially implements a generic classifier service 37 39 * 38 40 * @author <a href="mailto:[email protected]">Katherine Don</a> 39 41 */ 40 41 42 public abstract class AbstractBrowse 42 43 extends ServiceRack { 44 45 static Category logger = Category.getInstance(org.greenstone.gsdl3.service.AbstractBrowse.class.getName()); 43 46 44 47 // the browsing services … … 80 83 } 81 84 82 System.out.println("Configuring AbstractBrowse...");85 logger.info("Configuring AbstractBrowse..."); 83 86 this.config_info = info; 84 87 … … 259 262 name); 260 263 if (node_extra == null) { 261 System.err.println("GS2REtrieve: haven't found extra info for classifier named "+name);264 logger.error("GS2REtrieve: haven't found extra info for classifier named "+name); 262 265 continue; 263 266 } … … 304 307 Element query_node_list = (Element) GSXML.getChildByTagName(request, GSXML.CLASS_NODE_ELEM+GSXML.LIST_MODIFIER); 305 308 if (query_node_list == null) { 306 System.err.println("AbstractBrowse Error:ClassifierBrowse request specified no doc nodes.\n");309 logger.error(" ClassifierBrowse request specified no doc nodes.\n"); 307 310 return result; 308 311 } … … 311 314 Element param_list = (Element) GSXML.getChildByTagName(request, GSXML.PARAM_ELEM+GSXML.LIST_MODIFIER); 312 315 if (param_list == null) { 313 System.err.println("AbstractBrowse Error:ClassifierBrowse request had no paramList.");316 logger.error(" ClassifierBrowse request had no paramList."); 314 317 return result; // Return the empty result 315 318 } … … 353 356 want_entire_structure = true; 354 357 else 355 System.err.println("AbstractDocumentRetrieve Warning: Unknown value \"" + p_value + "\".");358 logger.error("AbstractDocumentRetrieve Warning: Unknown value \"" + p_value + "\"."); 356 359 } else if (p_name.equals(INFO_PARAM)) { 357 360 want_info = true; … … 485 488 Element param_list = (Element) GSXML.getChildByTagName(request, GSXML.PARAM_ELEM+GSXML.LIST_MODIFIER); 486 489 if (param_list == null) { 487 System.err.println("AbstractBrowse, ClassifierBrowseMetadataRetrieve Error: missing paramList.\n");490 logger.error("AbstractBrowse, ClassifierBrowseMetadataRetrieve Error: missing paramList.\n"); 488 491 return result; // Return the empty result 489 492 } … … 513 516 Element request_node_list = (Element) GSXML.getChildByTagName(request, GSXML.CLASS_NODE_ELEM+GSXML.LIST_MODIFIER); 514 517 if (request_node_list == null) { 515 System.err.println("AbstractBrowse Error:ClassifierBrowseMetadataRetrieve request had no "+GSXML.CLASS_NODE_ELEM+GSXML.LIST_MODIFIER);518 logger.error(" ClassifierBrowseMetadataRetrieve request had no "+GSXML.CLASS_NODE_ELEM+GSXML.LIST_MODIFIER); 516 519 return result; 517 520 } … … 622 625 if (current_node == null) { 623 626 // create a sensible error message 624 System.err.println("AbstractBrowse Error:there should be a first child.");627 logger.error(" there should be a first child."); 625 628 return null; 626 629 } -
trunk/gsdl3/src/java/org/greenstone/gsdl3/service/AbstractDocumentRetrieve.java
r11279 r13124 41 41 import java.util.ArrayList; 42 42 43 44 import org.apache.log4j.*; 45 43 46 /** Abstract class for Document Retrieval Services 44 47 * … … 48 51 public abstract class AbstractDocumentRetrieve 49 52 extends ServiceRack { 53 54 static Category logger = Category.getInstance(org.greenstone.gsdl3.service.AbstractDocumentRetrieve.class.getName()); 50 55 51 56 // the services on offer … … 93 98 } 94 99 95 System.out.println("Configuring AbstractDocumentRetrieve...");100 logger.info("Configuring AbstractDocumentRetrieve..."); 96 101 this.config_info = info; 97 102 … … 345 350 want_entire_structure = true; 346 351 else 347 System.err.println("AbstractDocumentRetrieve Warning: Unknown value \"" + p_value + "\".");352 logger.error("AbstractDocumentRetrieve Warning: Unknown value \"" + p_value + "\"."); 348 353 } else if (p_name.equals(INFO_PARAM)) { 349 354 want_info = true; … … 483 488 Element query_doc_list = (Element) GSXML.getChildByTagName(request, GSXML.DOC_NODE_ELEM+GSXML.LIST_MODIFIER); 484 489 if (query_doc_list == null) { 485 System.err.println("Error: DocumentContentRetrieve request specified no doc nodes.\n");490 logger.error("Error: DocumentContentRetrieve request specified no doc nodes.\n"); 486 491 return result; 487 492 } … … 569 574 if (current_node == null) { 570 575 // create a sensible error message 571 System.err.println("AbstractDocumentRetrieve Error:there should be a first child.");576 logger.error(" there should be a first child."); 572 577 return null; 573 578 } -
trunk/gsdl3/src/java/org/greenstone/gsdl3/service/AbstractGS2DocumentRetrieve.java
r11265 r13124 42 42 import java.util.ArrayList; 43 43 44 import org.apache.log4j.*; 45 44 46 /** Implements the generic retrieval and classifier services for GS2 45 47 * collections. … … 52 54 extends AbstractDocumentRetrieve { 53 55 56 static Category logger = Category.getInstance(org.greenstone.gsdl3.service.AbstractGS2DocumentRetrieve.class.getName()); 57 54 58 // protected static final String EXTLINK_PARAM = "ext"; here or in base?? 55 59 protected String index_stem = null; … … 76 80 } 77 81 78 System.out.println("Configuring AbstractGS2DocumentRetrieve...");82 logger.info("Configuring AbstractGS2DocumentRetrieve..."); 79 83 //this.config_info = info; 80 84 … … 85 89 } 86 90 if (this.index_stem == null || this.index_stem.equals("")) { 87 System.err.println("AbstractGS2DocumentRetrieve.configure(): indexStem element not found, stem will default to collection name");91 logger.error("AbstractGS2DocumentRetrieve.configure(): indexStem element not found, stem will default to collection name"); 88 92 this.index_stem = this.cluster_name; 89 93 } … … 92 96 String gdbm_db_file = GSFile.GDBMDatabaseFile(this.site_home, this.cluster_name, this.index_stem); 93 97 if (!this.gdbm_src.openDatabase(gdbm_db_file, GDBMWrapper.READER)) { 94 System.err.println("AbstractGS2DocumentRetrieve Error:Could not open GDBM database!");98 logger.error("Could not open GDBM database!"); 95 99 return false; 96 100 } -
trunk/gsdl3/src/java/org/greenstone/gsdl3/service/AbstractMGPPSearch.java
r11011 r13124 38 38 import java.io.File; 39 39 40 import org.apache.log4j.*; 40 41 41 42 /** Partially implements a generic MGPP search service … … 47 48 extends AbstractSearch 48 49 { 50 51 static Category logger = Category.getInstance(org.greenstone.gsdl3.service.AbstractMGPPSearch.class.getName()); 49 52 50 53 // extra services offered by mgpp collections … … 123 126 124 127 // Do specific configuration 125 System.out.println("Configuring AbstractMGPPSearch...");128 logger.info("Configuring AbstractMGPPSearch..."); 126 129 127 130 // do we support any of the extended features? … … 139 142 } 140 143 if (this.index_stem == null || this.index_stem.equals("")) { 141 System.err.println("AbstractMGPPSearch.configure(): indexStem element not found, stem will default to collection name");144 logger.error("AbstractMGPPSearch.configure(): indexStem element not found, stem will default to collection name"); 142 145 this.index_stem = this.cluster_name; 143 146 } … … 186 189 } 187 190 if (this.default_level == null || this.default_level.equals("")) { 188 System.err.println("Error:default level not specified!");191 logger.error("default level not specified!"); 189 192 return false; 190 193 } … … 442 445 default: 443 446 // should never get here 444 System.err.println("AbstractMGPPSearch:wrong query type!!");447 logger.error("wrong query type!!"); 445 448 return null; 446 449 } … … 454 457 Element param_list = (Element) GSXML.getChildByTagName(request, GSXML.PARAM_ELEM+GSXML.LIST_MODIFIER); 455 458 if (param_list == null) { 456 System.err.println("Error:TextQuery request had no paramList.");459 logger.error("TextQuery request had no paramList."); 457 460 return result; // Return the empty result 458 461 } -
trunk/gsdl3/src/java/org/greenstone/gsdl3/service/AbstractMGSearch.java
r9966 r13124 37 37 import java.io.File; 38 38 39 import org.apache.log4j.*; 40 39 41 /** Partially implements a generic MG search service 40 42 * … … 45 47 extends AbstractSearch 46 48 { 49 50 static Category logger = Category.getInstance(org.greenstone.gsdl3.service.AbstractMGSearch.class.getName()); 47 51 protected static final String CASE_PARAM = "case"; 48 52 protected static final String STEM_PARAM = "stem"; … … 99 103 } 100 104 if (this.index_stem == null || this.index_stem.equals("")) { 101 System.err.println("AbstractMGSearch.configure(): indexStem element not found, stem will default to collection name");105 logger.error("AbstractMGSearch.configure(): indexStem element not found, stem will default to collection name"); 102 106 this.index_stem = this.cluster_name; 103 107 } … … 118 122 name); 119 123 if (node_extra == null) { 120 System.err.println("GS2Search:haven't found extra info for index named "+name);124 logger.error("haven't found extra info for index named "+name); 121 125 continue; 122 126 } … … 168 172 Element param_list = (Element) GSXML.getChildByTagName(request, GSXML.PARAM_ELEM+GSXML.LIST_MODIFIER); 169 173 if (param_list == null) { 170 System.err.println("Error:TextQuery request had no paramList.");174 logger.error("TextQuery request had no paramList."); 171 175 return result; // Return the empty result 172 176 } … … 207 211 Vector docs = mqr.getDocs(); 208 212 if (docs.size() == 0) { 209 System.err.println("GS2MGSearch: Warning:No results found...\n");213 logger.error("No results found...\n"); 210 214 } 211 215 -
trunk/gsdl3/src/java/org/greenstone/gsdl3/service/AbstractSearch.java
r10093 r13124 32 32 import java.util.HashMap; 33 33 34 import org.apache.log4j.*; 35 34 36 /** Partially implements a generic search service 35 37 * … … 40 42 extends ServiceRack 41 43 { 44 45 static Category logger = Category.getInstance(org.greenstone.gsdl3.service.AbstractSearch.class.getName()); 46 42 47 43 48 // the search service … … 91 96 } 92 97 93 System.out.println("Configuring AbstractSearch...");98 logger.info("Configuring AbstractSearch..."); 94 99 95 100 this.config_info = info; -
trunk/gsdl3/src/java/org/greenstone/gsdl3/service/BerryBasket.java
r12184 r13124 44 44 import javax.swing.Timer; 45 45 46 import org.apache.log4j.*; 47 46 48 public class BerryBasket 47 49 extends ServiceRack { 50 51 static Category logger = Category.getInstance(org.greenstone.gsdl3.service.BerryBasket.class.getName()); 48 52 49 53 // the services on offer … … 98 102 public boolean configure(Element info, Element extra_info) 99 103 { 100 System.out.println("Configuring BerryBasket...");104 logger.info("Configuring BerryBasket..."); 101 105 this.config_info = info; 102 106 … … 204 208 Element param_list = (Element) GSXML.getChildByTagName(request, GSXML.PARAM_ELEM+GSXML.LIST_MODIFIER); 205 209 if (param_list == null) { 206 System.err.println("BerryBasket Error: AddItem request had no paramList.");210 logger.error("BerryBasket Error: AddItem request had no paramList."); 207 211 return result; // Return the empty result 208 212 } … … 286 290 287 291 if (param_list == null) { 288 System.err.println("BerryBasket Error: DeleteItem request had no paramList.");292 logger.error("BerryBasket Error: DeleteItem request had no paramList."); 289 293 return result; // Return the empty result 290 294 } … … 335 339 336 340 if (param_list == null) { 337 System.err.println("BerryBasket Error: DeleteItem request had no paramList.");341 logger.error("BerryBasket Error: DeleteItem request had no paramList."); 338 342 return result; // Return the empty result 339 343 } … … 489 493 490 494 if (param_list == null) { 491 System.err.println("BerryBasket Error: SendMail request had no paramList.");495 logger.error("BerryBasket Error: SendMail request had no paramList."); 492 496 return result; // Return the empty result 493 497 } … … 551 555 Transport.send(msg); 552 556 553 System.out.println("\nMail was sent successfully.");557 logger.info("\nMail was sent successfully."); 554 558 result.appendChild(this.doc.createTextNode("Mail was sent successfully.")); 555 559 } catch (Exception e) { -
trunk/gsdl3/src/java/org/greenstone/gsdl3/service/CrossCollectionSearch.java
r11229 r13124 31 31 import java.util.HashMap; 32 32 33 import org.apache.log4j.*; 33 34 34 35 /** … … 40 41 extends ServiceRack { 41 42 43 static Category logger = Category.getInstance(org.greenstone.gsdl3.service.CrossCollectionSearch.class.getName()); 42 44 protected static final String QUERY_PARAM = "query"; 43 45 protected static final String COLLECTION_PARAM = "collection"; … … 60 62 { 61 63 // any parameters? colls to include?? 62 System.out.println("Configuring CrossCollectionSearch...");64 logger.info("Configuring CrossCollectionSearch..."); 63 65 // query service 64 66 Element ccs_service = this.doc.createElement(GSXML.SERVICE_ELEM); … … 118 120 } 119 121 120 ///ystem.err.println("service description="+this.converter.getPrettyString(ccs_service));122 logger.debug("service description="+this.converter.getPrettyString(ccs_service)); 121 123 return ccs_service; 122 124 } … … 141 143 Element param_list = (Element) GSXML.getChildByTagName(request, GSXML.PARAM_ELEM+GSXML.LIST_MODIFIER); 142 144 if (param_list == null) { 143 System.err.println("Error:TextQuery request had no paramList.");145 logger.error("TextQuery request had no paramList."); 144 146 return result; // Return the empty result 145 147 } … … 240 242 Element coll_list_request = GSXML.createBasicRequest(this.doc, GSXML.REQUEST_TYPE_DESCRIBE, "", lang, ""); // uid 241 243 coll_list_message.appendChild(coll_list_request); 242 ///ystem.err.println("coll list request = "+this.converter.getPrettyString(coll_list_request));244 logger.debug("coll list request = "+this.converter.getPrettyString(coll_list_request)); 243 245 Element coll_list_response = (Element)this.router.process(coll_list_message); 244 246 if (coll_list_response==null) { 245 System.err.println("PageAction Error:couldn't query the message router!");247 logger.error("couldn't query the message router!"); 246 248 return false; 247 249 } 248 ///ystem.err.println("coll list response = "+this.converter.getPrettyString(coll_list_response));250 logger.debug("coll list response = "+this.converter.getPrettyString(coll_list_response)); 249 251 // second, get some info from each collection. we want the coll name 250 252 // and whether its got a text query service … … 259 261 metadata_message.appendChild(metadata_request); 260 262 } 261 ///ystem.err.println("metadata request = "+this.converter.getPrettyString(metadata_message));263 logger.debug("metadata request = "+this.converter.getPrettyString(metadata_message)); 262 264 Element metadata_response = (Element)this.router.process(metadata_message); 263 ///ystem.err.println("metadata response = "+this.converter.getPrettyString(metadata_response));265 logger.debug("metadata response = "+this.converter.getPrettyString(metadata_response)); 264 266 265 267 NodeList coll_responses = metadata_response.getElementsByTagName(GSXML.COLLECTION_ELEM); … … 300 302 Element param_list = (Element) GSXML.getChildByTagName(request, GSXML.PARAM_ELEM+GSXML.LIST_MODIFIER); 301 303 if (param_list == null) { 302 System.err.println("Error:DocumentMetadataRetrieve request had no paramList.");304 logger.error("DocumentMetadataRetrieve request had no paramList."); 303 305 return result; // Return the empty result 304 306 } … … 306 308 NodeList query_doc_list = request.getElementsByTagName(GSXML.DOC_NODE_ELEM); 307 309 if (query_doc_list.getLength()==0) { 308 System.err.println("Error:DocumentMetadataRetrieve request had no documentNodes.");310 logger.error("DocumentMetadataRetrieve request had no documentNodes."); 309 311 return result; // Return the empty result 310 312 } -
trunk/gsdl3/src/java/org/greenstone/gsdl3/service/GS2Browse.java
r10651 r13124 38 38 import java.util.Iterator; 39 39 40 import org.apache.log4j.*; 41 40 42 /** Greenstone 2 collection classifier service 41 43 * … … 47 49 extends AbstractBrowse 48 50 { 49 51 52 static Category logger = Category.getInstance(org.greenstone.gsdl3.service.GS2Browse.class.getName()); 53 50 54 protected GDBMWrapper gdbm_src = null; 51 55 … … 67 71 } 68 72 69 System.err.println("Configuring GS2Browse...");73 logger.info("Configuring GS2Browse..."); 70 74 // the index stem is either specified in the config file or is the collection name 71 75 Element index_stem_elem = (Element) GSXML.getChildByTagName(info, GSXML.INDEX_STEM_ELEM); … … 81 85 String gdbm_db_file = GSFile.GDBMDatabaseFile(this.site_home, this.cluster_name, index_stem); 82 86 if (!this.gdbm_src.openDatabase(gdbm_db_file, GDBMWrapper.READER)) { 83 System.err.println("GS2Browse Error:Could not open GDBM database!");87 logger.error("Could not open GDBM database!"); 84 88 return false; 85 89 } -
trunk/gsdl3/src/java/org/greenstone/gsdl3/service/GS2Construct.java
r10093 r13124 36 36 import java.util.Locale; 37 37 38 import org.apache.log4j.*; 39 38 40 /** 39 41 * A Services class for building collections … … 46 48 extends ServiceRack { 47 49 50 static Category logger = Category.getInstance(org.greenstone.gsdl3.service.GS2Construct.class.getName()); 51 48 52 // services offered 49 53 private static final String NEW_SERVICE = "NewCollection"; … … 166 170 GS2PerlListener listener = (GS2PerlListener)this.listeners.get(id); 167 171 if (listener==null) { 168 System.err.println("somethings gone wrong, couldn't find the listener");172 logger.error("somethings gone wrong, couldn't find the listener"); 169 173 status.setAttribute(GSXML.STATUS_ERROR_CODE_ATT, Integer.toString(GSStatus.ERROR)); 170 174 return response; … … 217 221 if (get_status_only) { 218 222 // at the moment, delete is synchronous. but it may take ages so should do the command in another thread maybe? in which case we will want to ask for status 219 System.err.println("had a status request for delete - this shouldn't happen!!");223 logger.error("had a status request for delete - this shouldn't happen!!"); 220 224 //t = this.doc.createTextNode(""); 221 225 //status.appendChild(t); … … 267 271 if (get_status_only) { 268 272 // reload is synchronous - this makes no sense 269 System.err.println("had a status request for reload - this shouldn't happen!!");273 logger.error("had a status request for reload - this shouldn't happen!!"); 270 274 //t = this.doc.createTextNode(""); 271 275 //status.appendChild(t); … … 300 304 command.setAttribute(GSXML.TYPE_ATT, GSXML.SYSTEM_TYPE_ACTIVATE); 301 305 } else { 302 System.err.println("invalid action name passed to systemRequest:"+action_name);306 logger.error("invalid action name passed to systemRequest:"+action_name); 303 307 return; 304 308 } … … 330 334 } 331 335 332 System.out.println("configuring GS2Construct");336 logger.info("configuring GS2Construct"); 333 337 334 338 Element e = null; … … 427 431 coll_name = (String)params.get(COL_PARAM); 428 432 } 429 System.err.println("Coll name = "+coll_name);433 logger.error("Coll name = "+coll_name); 430 434 // makes a paramList of the relevant params 431 435 Element other_params = extractOtherParams(params, type); … … 471 475 File collectDir = new File(GSFile.collectDir(this.site_home)); 472 476 if (!collectDir.exists()) { 473 System.err.println("couldn't find collect dir: "+collectDir.toString());477 logger.error("couldn't find collect dir: "+collectDir.toString()); 474 478 return null; 475 479 } 476 System.out.println("GS2Construct: reading thru directory "+collectDir.getPath()+" to find collections.");480 logger.info("GS2Construct: reading thru directory "+collectDir.getPath()+" to find collections."); 477 481 File[] contents = collectDir.listFiles(); 478 482 int num_colls=0; -
trunk/gsdl3/src/java/org/greenstone/gsdl3/service/GS2MGPPRetrieve.java
r10651 r13124 32 32 import java.io.File; 33 33 34 import org.apache.log4j.*; 35 34 36 public class GS2MGPPRetrieve 35 37 extends AbstractGS2DocumentRetrieve 36 38 { 39 static Category logger = Category.getInstance(org.greenstone.gsdl3.service.GS2MGPPRetrieve.class.getName()); 40 37 41 // Parameters used 38 42 private static final String LEVEL_PARAM = "level"; … … 63 67 64 68 // Do specific configuration 65 System.out.println("Configuring GS2MGPPRetrieve...");69 logger.info("Configuring GS2MGPPRetrieve..."); 66 70 67 71 // Get the default level out of <defaultLevel> (buildConfig.xml) … … 71 75 } 72 76 if (this.default_level == null || this.default_level.equals("")) { 73 System.err.println("Error:default level not specified!");77 logger.error("default level not specified!"); 74 78 return false; 75 79 } 76 // System.out.println("Default level: " + default_level_);77 80 78 81 // The location of the MGPP text files … … 93 96 long doc_num = this.gdbm_src.OID2Docnum(doc_id); 94 97 if (doc_num == -1) { 95 System.err.println("OID "+doc_id +" couldn't be converted to mgpp num");98 logger.error("OID "+doc_id +" couldn't be converted to mgpp num"); 96 99 return null; 97 100 } … … 107 110 } 108 111 } catch (Exception e) { 109 System.out.println("exception happended with mgpp_src.getDocument()" + e);112 logger.info("exception happended with mgpp_src.getDocument()" + e); 110 113 doc_content = "this is the content for section hash id "+ doc_id+", mgpp doc num "+doc_num+"\n"; 111 114 -
trunk/gsdl3/src/java/org/greenstone/gsdl3/service/GS2MGPPSearch.java
r10652 r13124 27 27 import org.w3c.dom.NodeList; 28 28 29 import org.apache.log4j.*; 30 29 31 /** 30 32 * … … 37 39 { 38 40 protected GDBMWrapper gdbm_src = null; 41 static Category logger = Category.getInstance(org.greenstone.gsdl3.service.GS2MGPPSearch.class.getName()); 39 42 40 43 /** constructor */ … … 59 62 String gdbm_db_file = GSFile.GDBMDatabaseFile(this.site_home, this.cluster_name, this.index_stem); 60 63 if (!this.gdbm_src.openDatabase(gdbm_db_file, GDBMWrapper.READER)) { 61 System.err.println("Error:Could not open GDBM database!");64 logger.error("Could not open GDBM database!"); 62 65 return false; 63 66 } -
trunk/gsdl3/src/java/org/greenstone/gsdl3/service/GS2MGRetrieve.java
r10651 r13124 32 32 import java.io.File; 33 33 34 import org.apache.log4j.*; 35 34 36 public class GS2MGRetrieve 35 37 extends AbstractGS2DocumentRetrieve 36 38 { 39 static Category logger = Category.getInstance(org.greenstone.gsdl3.service.GS2MGRetrieve.class.getName()); 40 37 41 // Elements used in the config file that are specific to this class 38 42 private static final String DEFAULT_INDEX_ELEM = "defaultIndex"; … … 60 64 61 65 // Do specific configuration 62 System.out.println("Configuring GS2MGRetrieve..."); 63 // System.out.println("info:\n" + converter_.getString(info)); 64 // System.out.println("extra_info:\n" + converter_.getString(extra_info)); 65 66 logger.info("Configuring GS2MGRetrieve..."); 67 66 68 // Get the default index out of <defaultIndex> (buildConfig.xml) 67 69 Element def = (Element) GSXML.getChildByTagName(info, DEFAULT_INDEX_ELEM); … … 70 72 } 71 73 if (this.default_index == null || this.default_index.equals("")) { 72 System.err.println("Error:default index not specified!");74 logger.error("default index not specified!"); 73 75 return false; 74 76 } 75 // System.out.println("Default index: " + this.default_index);77 logger.debug("Default index: " + this.default_index); 76 78 77 79 // The location of the MG index and text files … … 93 95 long doc_num = this.gdbm_src.OID2Docnum(doc_id); 94 96 if (doc_num == -1) { 95 System.err.println("OID "+doc_id +" couldn't be converted to mg num");97 logger.error("OID "+doc_id +" couldn't be converted to mg num"); 96 98 return null; 97 99 } … … 108 110 //GSXML.addDocText(this.doc, doc, doc_content); 109 111 } else { 110 System.err.println("the doc content was null, not getting that section\n");112 logger.error("the doc content was null, not getting that section\n"); 111 113 doc_content = "couldn't retrieve content for this section\n"; 112 114 } -
trunk/gsdl3/src/java/org/greenstone/gsdl3/service/GS2MGSearch.java
r10651 r13124 27 27 import org.w3c.dom.NodeList; 28 28 29 import org.apache.log4j.*; 30 29 31 /** 30 32 * … … 37 39 { 38 40 protected GDBMWrapper gdbm_src = null; 41 static Category logger = Category.getInstance(org.greenstone.gsdl3.service.GS2MGSearch.class.getName()); 42 39 43 40 44 /** constructor */ … … 58 62 String gdbm_db_file = GSFile.GDBMDatabaseFile(this.site_home, this.cluster_name, this.index_stem); 59 63 if (!this.gdbm_src.openDatabase(gdbm_db_file, GDBMWrapper.READER)) { 60 System.err.println("Error:Could not open GDBM database!");64 logger.error(" Could not open GDBM database!"); 61 65 return false; 62 66 } -
trunk/gsdl3/src/java/org/greenstone/gsdl3/service/IViaProxy.java
r10093 r13124 21 21 import java.net.MalformedURLException; 22 22 23 import org.apache.log4j.*; 24 23 25 /** 24 26 * … … 29 31 public class IViaProxy 30 32 extends ServiceRack { 33 34 static Category logger = Category.getInstance(org.greenstone.gsdl3.service.IViaProxy.class.getName()); 31 35 32 36 // the services on offer … … 54 58 Element server_elem = (Element)GSXML.getChildByTagName(info, "iViaServer"); 55 59 if (server_elem == null) { 56 System.err.println("IViaProxy.configure error:no iViaServer element found");60 logger.error("no iViaServer element found"); 57 61 return false; 58 62 } 59 63 ivia_server_url = server_elem.getAttribute("url"); 60 64 if (ivia_server_url.equals("")) { 61 System.err.println("IViaProxy.configure error:no url for the iViaServer element");65 logger.error("no url for the iViaServer element"); 62 66 return false; 63 67 } … … 167 171 Element param_list = (Element) GSXML.getChildByTagName(request, GSXML.PARAM_ELEM+GSXML.LIST_MODIFIER); 168 172 if (param_list == null) { 169 System.err.println("IViaProxy Error::TextQuery request had no paramList.");173 logger.error("TextQuery request had no paramList."); 170 174 return result; // Return the empty result 171 175 } … … 203 207 String doc_ids = null; 204 208 try { 205 ///ystem.err.println("IViaProxy, sending "+url_string);209 logger.debug("IViaProxy, sending "+url_string); 206 210 BufferedReader reader = makeConnection(url_string); 207 211 results_num = reader.readLine(); … … 209 213 210 214 } catch (Exception e) { 211 System.err.println("IViaProxy.TextQuery Error:exception happened during query");215 logger.error("exception happened during query"); 212 216 e.printStackTrace(); 213 217 return result; … … 217 221 results_num = results_num.substring(11); 218 222 } else { 219 System.err.println("IViaProxy.TextQuery Error:badly formatted results line: "+results_num);223 logger.error("badly formatted results line: "+results_num); 220 224 return result; 221 225 } … … 223 227 doc_ids = doc_ids.substring(5).trim(); 224 228 } else { 225 System.err.println("IViaProxy.TextQuery Error:badly formatted docs line: "+doc_ids);229 logger.error("badly formatted docs line: "+doc_ids); 226 230 return result; 227 231 } … … 241 245 doc_node_list.appendChild(doc_node); 242 246 } 243 ///ystem.err.println("IViaProxy result:");244 ///ystem.err.println(this.converter.getString(result));247 logger.debug("IViaProxy result:"); 248 logger.debug(this.converter.getString(result)); 245 249 return result; 246 250 … … 255 259 Element param_list = (Element) GSXML.getChildByTagName(request, GSXML.PARAM_ELEM+GSXML.LIST_MODIFIER); 256 260 if (param_list == null) { 257 System.err.println("IViaProxy.DocumentMetadataRetrieve Error:missing paramList.\n");261 logger.error("missing paramList.\n"); 258 262 return result; // Return the empty result 259 263 } … … 275 279 276 280 if (field_list.length()==0) { 277 System.err.println("IViaProxy.DocumentMetadataRetrieve Error:no metadata specified.\n");281 logger.error("no metadata specified.\n"); 278 282 return result; 279 283 } … … 282 286 Element request_node_list = (Element) GSXML.getChildByTagName(request, GSXML.DOC_NODE_ELEM+GSXML.LIST_MODIFIER); 283 287 if (request_node_list == null) { 284 System.err.println("IViaProxy Error:DocumentMetadataRetrieve request had no "+GSXML.DOC_NODE_ELEM+"List.\n");288 logger.error("DocumentMetadataRetrieve request had no "+GSXML.DOC_NODE_ELEM+"List.\n"); 285 289 return result; 286 290 } … … 329 333 } 330 334 } catch (Exception e) { 331 System.err.println("IViaProxy Error:exception happened");335 logger.error("exception happened"); 332 336 e.printStackTrace(); 333 337 } 334 ///ystem.out.println("IViaProxy: returning result: ");335 ///ystem.out.println(this.converter.getPrettyString(result));338 logger.debug("IViaProxy: returning result: "); 339 logger.debug(this.converter.getPrettyString(result)); 336 340 return result; 337 341 … … 346 350 Element query_doc_list = (Element) GSXML.getChildByTagName(request, GSXML.DOC_NODE_ELEM+GSXML.LIST_MODIFIER); 347 351 if (query_doc_list == null) { 348 System.err.println("IViaProxy Error:DocumentContentRetrieve request specified no doc nodes.\n");352 logger.error("DocumentContentRetrieve request specified no doc nodes.\n"); 349 353 return result; 350 354 } … … 381 385 382 386 } catch (Exception e) { 383 System.err.println("IViaProxy Error:exception happened");387 logger.error("exception happened"); 384 388 e.printStackTrace(); 385 389 } … … 414 418 doc_node.appendChild(this.doc.importNode(content_element, true)); 415 419 } else { 416 System.err.println("IViaProxy.getDocument Error:Couldn't parse the node content");420 logger.error("Couldn't parse the node content"); 417 421 } 418 422 return doc_node; … … 495 499 } catch (java.net.MalformedURLException e) { 496 500 497 System.err.println("IViaProxy Error:Malformed URL: "+url_string);501 logger.error("Malformed URL: "+url_string); 498 502 } catch (java.io.IOException e) { 499 System.err.println("IViaProxy Error:An error occurred during IO to url "+url_string);503 logger.error("An error occurred during IO to url "+url_string); 500 504 } 501 505 return reader; -
trunk/gsdl3/src/java/org/greenstone/gsdl3/service/IViaRetrieve.java
r9874 r13124 23 23 import java.net.MalformedURLException; 24 24 25 import org.apache.log4j.*; 26 25 27 /** 26 28 * … … 32 34 public class IViaRetrieve 33 35 extends AbstractDocumentRetrieve { 34 36 37 static Category logger = Category.getInstance(org.greenstone.gsdl3.service.IViaRetrieve.class.getName()); 38 39 35 40 protected String ivia_server_url = null; 36 41 … … 48 53 Element server_elem = (Element)GSXML.getChildByTagName(info, "iViaServer"); 49 54 if (server_elem == null) { 50 System.err.println("IViaRetrieve.configure error:no iViaServer element found");55 logger.error("no iViaServer element found"); 51 56 return false; 52 57 } 53 58 ivia_server_url = server_elem.getAttribute("url"); 54 59 if (ivia_server_url.equals("")) { 55 System.err.println("IViaRetrieve.configure error:no url for the iViaServer element");60 logger.error("no url for the iViaServer element"); 56 61 return false; 57 62 } … … 103 108 Document content_doc = this.converter.getDOM(processed_content.toString()); 104 109 if (content_doc == null) { 105 System.err.println("IViaRetrieve.getNodeContent Error:Couldn't parse node content");106 System.err.println(processed_content.toString());110 logger.error("Couldn't parse node content"); 111 logger.error(processed_content.toString()); 107 112 return null; 108 113 } … … 181 186 int p = oid.lastIndexOf('.'); 182 187 if (p != oid.length()-3) { 183 System.out.println("translateoid error: '.' is not the third to last char!!");188 logger.info("translateoid error: '.' is not the third to last char!!"); 184 189 return oid; 185 190 } -
trunk/gsdl3/src/java/org/greenstone/gsdl3/service/IViaSearch.java
r10194 r13124 16 16 import java.net.Authenticator; 17 17 18 import org.apache.log4j.*; 19 18 20 /** 19 21 * … … 25 27 extends AbstractSearch { 26 28 29 30 static Category logger = Category.getInstance(org.greenstone.gsdl3.service.IViaSearch.class.getName()); 31 27 32 // have standard gs param names for hits per page, and start page 28 33 // these need to be mapped to iVia params … … 45 50 Element server_elem = (Element)GSXML.getChildByTagName(info, "iViaServer"); 46 51 if (server_elem == null) { 47 System.err.println("IViaSearch.configure error:no iViaServer element found");52 logger.error("no iViaServer element found"); 48 53 return false; 49 54 } 50 55 ivia_server_url = server_elem.getAttribute("url"); 51 56 if (ivia_server_url.equals("")) { 52 System.err.println("IViaSearch.configure error:no url for the iViaServer element");57 logger.error("no url for the iViaServer element"); 53 58 return false; 54 59 } … … 77 82 Element param_list = (Element) GSXML.getChildByTagName(request, GSXML.PARAM_ELEM+GSXML.LIST_MODIFIER); 78 83 if (param_list == null) { 79 System.err.println("IViaSearch Error::TextQuery request had no paramList.");84 logger.error("TextQuery request had no paramList."); 80 85 return result; // Return the empty result 81 86 } … … 115 120 BufferedReader reader = null; 116 121 try { 117 ///system.err.println("IViaSearch,sending "+url_string);122 logger.debug("sending "+url_string); 118 123 reader = Misc.makeHttpConnection(url_string); 119 124 results_num = reader.readLine(); … … 132 137 133 138 } else { 134 System.err.println("IViaSearch.TextQuery Error:badly formatted results:");139 logger.error("badly formatted results:"); 135 140 StringBuffer result_string = new StringBuffer(); 136 141 result_string.append("Error: badly formatted result from IVia server:\n "); -
trunk/gsdl3/src/java/org/greenstone/gsdl3/service/LuceneSearch.java
r9874 r13124 24 24 25 25 import java.io.File; 26 27 import org.apache.log4j.*; 28 26 29 /** 27 30 * … … 32 35 public class LuceneSearch 33 36 extends AbstractSearch { 37 38 static Category logger = Category.getInstance(org.greenstone.gsdl3.service.LuceneSearch.class.getName()); 34 39 35 40 protected static final String INDEX_ELEM = "index"; … … 71 76 Element param_list = (Element) GSXML.getChildByTagName(request, GSXML.PARAM_ELEM+GSXML.LIST_MODIFIER); 72 77 if (param_list == null) { 73 System.err.println("LuceneSearch Error:TextQuery request had no paramList.");78 logger.error("TextQuery request had no paramList."); 74 79 GSXML.addMetadata(this.doc, metadata_list, "numDocsMatched", "0"); 75 80 return result; // Return the empty result … … 82 87 String query_string = (String) params.get(QUERY_PARAM); 83 88 if (query_string == null || query_string.equals("")) { 84 System.err.println("LuceneSearch Error:TextQuery request had no query string.");89 logger.error("TextQuery request had no query string."); 85 90 GSXML.addMetadata(this.doc, metadata_list, "numDocsMatched", "0"); 86 91 return result; // Return the empty result -
trunk/gsdl3/src/java/org/greenstone/gsdl3/service/MapRetrieve.java
r10093 r13124 22 22 import javax.swing.tree.DefaultMutableTreeNode; 23 23 24 /** 25 */ 24 import org.apache.log4j.*; 26 25 27 26 public class MapRetrieve 28 27 extends ServiceRack { 28 29 static Category logger = Category.getInstance(org.greenstone.gsdl3.service.MapRetrieve.class.getName()); 29 30 30 31 // the services on offer … … 59 60 } 60 61 61 System.out.println("Configuring MapRetrieve...");62 logger.info("Configuring MapRetrieve..."); 62 63 this.config_info = info; 63 64 … … 186 187 String uid = request.getAttribute(GSXML.USER_ID_ATT); 187 188 if (uid.equals("")) { 188 System.out.println("in metadata retrieve, uid = ''\n"+converter.getPrettyString(request));189 logger.info("in metadata retrieve, uid = ''\n"+converter.getPrettyString(request)); 189 190 } 190 191 result.setAttribute(GSXML.FROM_ATT, DOCUMENT_METADATA_RETRIEVE_SERVICE); … … 194 195 Element param_list = (Element) GSXML.getChildByTagName(request, GSXML.PARAM_ELEM+GSXML.LIST_MODIFIER); 195 196 if (param_list == null) { 196 System.err.println("MapRetrieve Error:missing paramList.\n");197 logger.error("missing paramList.\n"); 197 198 return result; // Return the empty result 198 199 } … … 223 224 Element request_node_list = (Element) GSXML.getChildByTagName(request, GSXML.DOC_NODE_ELEM+GSXML.LIST_MODIFIER); 224 225 if (request_node_list == null) { 225 System.err.println("Error:DocumentMetadataRetrieve request had no "+GSXML.DOC_NODE_ELEM+GSXML.LIST_MODIFIER);226 logger.error(" DocumentMetadataRetrieve request had no "+GSXML.DOC_NODE_ELEM+GSXML.LIST_MODIFIER); 226 227 return result; 227 228 } … … 365 366 Element query_doc_list = (Element) GSXML.getChildByTagName(request, GSXML.DOC_NODE_ELEM+GSXML.LIST_MODIFIER); 366 367 if (query_doc_list == null) { 367 System.err.println("Error:DocumentContentRetrieve request specified no doc nodes.\n");368 logger.error("DocumentContentRetrieve request specified no doc nodes.\n"); 368 369 return result; 369 370 } -
trunk/gsdl3/src/java/org/greenstone/gsdl3/service/MapSearch.java
r9874 r13124 43 43 import java.lang.ClassNotFoundException; 44 44 45 import org.apache.log4j.*; 46 45 47 /** 46 48 * … … 49 51 public class MapSearch 50 52 extends AbstractSearch { 53 54 55 static Category logger = Category.getInstance(org.greenstone.gsdl3.service.MapSearch.class.getName()); 51 56 52 57 protected String files_home_dir = null; … … 71 76 return false; 72 77 } 73 System.out.println("Configuring MapSearch...");78 logger.info("Configuring MapSearch..."); 74 79 75 80 // set the files_home_dir variable for this collection … … 164 169 Element param_list = (Element) GSXML.getChildByTagName(request, GSXML.PARAM_ELEM+GSXML.LIST_MODIFIER); 165 170 if (param_list == null) { 166 System.err.println("Error:TextQuery request had no paramList.");171 logger.error("TextQuery request had no paramList."); 167 172 return result; // Return the empty result 168 173 } … … 249 254 250 255 if((nameArray = (Object[])hashNames.get(terms[k].toLowerCase())) != null){ 251 //System.out.println(hashNames.get(terms[k].toLowerCase()));256 logger.debug(hashNames.get(terms[k].toLowerCase())); 252 257 253 258 nameArraySize = Arrays.asList(nameArray).size(); -
trunk/gsdl3/src/java/org/greenstone/gsdl3/service/ModuleWrapper.java
r10066 r13124 41 41 import java.security.SecureRandom; 42 42 43 import org.apache.log4j.*; 44 43 45 /** 44 46 * A classes for logging and checking all traffic to and from a ModuleInterface … … 57 59 implements ModuleInterface 58 60 { 61 62 static Category logger = Category.getInstance(org.greenstone.gsdl3.service. ModuleWrapper.class.getName()); 63 59 64 /** the module we're wrapping */ 60 65 protected ModuleInterface inner = null; … … 138 143 writer.write(xmlIn); 139 144 } catch (IOException e) { 140 System.err.println("ModuleWrapper:caught exception: " +e );145 logger.error("caught exception: " +e ); 141 146 } 142 147 } … … 149 154 writer.write(xmlOut); 150 155 } catch (IOException e) { 151 System.err.println("ModuleWrapper:caught exception: " +e );156 logger.error("caught exception: " +e ); 152 157 } 153 158 return xmlOut; … … 179 184 parser.setFeature("http://apache.org/xml/features/warn-on-duplicate-entitydef", true); 180 185 } catch (Exception a) { 181 System.err.println("unable to set feature:" +a);186 logger.error("unable to set feature:" +a); 182 187 a.printStackTrace(); 183 188 } … … 188 193 parser.parse(xml_source); 189 194 } catch (Exception e){ 190 System.err.println("parsing error:" +e);195 logger.error("parsing error:" +e); 191 196 e.printStackTrace(); 192 197 return "<response> <error class=\"ModuleWrapper\" code=1> Error: supplied string contained the parse error: " + e + " </error> </response>"; … … 200 205 parser.parse(xmlResult); 201 206 } catch (Exception e){ 202 System.err.println("parsing error:" +e);207 logger.error("parsing error:" +e); 203 208 e.printStackTrace(); 204 209 return "<response> <error class=\"ModuleWrapper\" code=2> Error: returned string contained the parse error: " + e + "</error></response>"; … … 208 213 209 214 } catch (Exception e){ 210 System.err.println("other error:" +e);215 logger.error("other error:" +e); 211 216 e.printStackTrace(); 212 217 return "<response> <error class=\"ModuleWrapper\" code=3>Error: Unknown error or warning: " + e + " </error></response>"; -
trunk/gsdl3/src/java/org/greenstone/gsdl3/service/PhindPhraseBrowse.java
r10093 r13124 30 30 import java.util.HashMap; 31 31 import java.io.File; 32 33 import org.apache.log4j.*; 34 32 35 /** 33 36 * PhindServices - the phind phrase browsing service … … 39 42 extends ServiceRack { 40 43 44 static Category logger = Category.getInstance(org.greenstone.gsdl3.service.PhindPhraseBrowse.class.getName()); 45 41 46 // the services on offer 42 47 private static final String PHIND_SERVICE = "PhindApplet"; … … 73 78 } 74 79 75 System.out.println("configuring PhindPhraseBrowse");80 logger.info("configuring PhindPhraseBrowse"); 76 81 77 82 // set up short_service_info_ - for now just has name and type … … 100 105 Document dom = this.converter.getDOM(app_info); 101 106 if (dom==null) { 102 System.err.println("PhindPhraseBrowse.configure Error:Couldn't parse applet info");107 logger.error("Couldn't parse applet info"); 103 108 return false; 104 109 } -
trunk/gsdl3/src/java/org/greenstone/gsdl3/service/ServiceRack.java
r11266 r13124 41 41 import java.lang.reflect.Method; 42 42 43 import org.apache.log4j.*; 44 43 45 /** 44 46 * ServiceRack - abstract base class for services … … 58 60 { 59 61 62 static Category logger = Category.getInstance(org.greenstone.gsdl3.service.ServiceRack.class.getName()); 63 60 64 /** the absolute address of the site home */ 61 65 protected String site_home =null; … … 155 159 Document doc = this.converter.getDOM(xml_in); 156 160 if (doc == null) { 157 System.err.println("ServiceRack.process(String) Error:Couldn't parse request");158 System.err.println(xml_in);161 logger.error("Couldn't parse request"); 162 logger.error(xml_in); 159 163 return null; 160 164 } … … 217 221 c = c.getSuperclass(); 218 222 } catch (SecurityException e) { 219 System.err.println("ServiceRack.process:security exception for finding method "+method_name);223 logger.error("security exception for finding method "+method_name); 220 224 error_string.append("ServiceRack.process: security exception for finding method "+method_name); 221 225 } … … 227 231 228 232 } catch (Exception e) { 229 System.err.println("ServiceRack.process:Trying to call a processService type method (process"+to+") on a subclass("+this.getClass().getName()+"), but an exception happened:"+e.toString());230 error_string.append(" ServiceRack.process:Trying to call a processService type method (process"+to+") on a subclass("+this.getClass().getName()+"), but an exception happened:"+e.toString());233 logger.error("Trying to call a processService type method (process"+to+") on a subclass("+this.getClass().getName()+"), but an exception happened:"+e.toString()); 234 error_string.append("Trying to call a processService type method (process"+to+") on a subclass("+this.getClass().getName()+"), but an exception happened:"+e.toString()); 231 235 } 232 236 } else { 233 System.err.println("ServiceRack.process:method "+method_name+" not found for class "+this.getClass().getName());237 logger.error("method "+method_name+" not found for class "+this.getClass().getName()); 234 238 error_string.append("ServiceRack.process: method "+method_name+" not found for class "+this.getClass().getName()); 235 239 } 236 240 237 241 } catch (ClassNotFoundException e) { 238 System.err.println("ServiceRack error:Element class not found");239 error_string.append(" ServiceRack error:Element class not found");242 logger.error("Element class not found"); 243 error_string.append("Element class not found"); 240 244 } 241 245 if (response !=null) { … … 243 247 } else { 244 248 // add in a dummy response 245 System.err.println("adding in an error element\n");249 logger.error("adding in an error element\n"); 246 250 response = this.doc.createElement(GSXML.RESPONSE_ELEM); 247 251 GSXML.addError(this.doc, response, error_string.toString()); … … 321 325 } 322 326 // else no format info 323 System.err.println("ServiceRack describe request: no format info for "+to+".");327 logger.error("ServiceRack describe request: no format info for "+to+"."); 324 328 return response; 325 329 } -
trunk/gsdl3/src/java/org/greenstone/gsdl3/service/XMLRetrieve.java
r10093 r13124 19 19 import java.util.HashMap; 20 20 21 import org.apache.log4j.*; 21 22 22 23 public class XMLRetrieve extends ServiceRack { 23 24 25 static Category logger = Category.getInstance(org.greenstone.gsdl3.service.XMLRetrieve.class.getName()); 24 26 protected static final String CONTENT_SERVICE = "DocumentContentRetrieve"; 25 27 protected static final String METADATA_SERVICE = "DocumentMetadataRetrieve"; … … 41 43 return false; 42 44 } 43 System.out.println("configuring XMLRetrieve...");45 logger.info("configuring XMLRetrieve..."); 44 46 // look for the parameters 45 47 Element param_list = (Element)GSXML.getChildByTagName(info, GSXML.PARAM_ELEM+GSXML.LIST_MODIFIER); … … 167 169 Element doc_list = (Element)GSXML.getChildByTagName(request, GSXML.DOC_NODE_ELEM+GSXML.LIST_MODIFIER); 168 170 if (doc_list == null) { 169 System.err.println("XMLRetrieve.DocumentStructureRetrieve:no documents specified in the request. ");171 logger.error("no documents specified in the request. "); 170 172 return result; 171 173 } … … 180 182 } 181 183 if (!stylesheet.exists()) { 182 System.err.println("XMLRetrieve.DocumentStructureRetrieve:couldn't find the stylesheet file to produce the table of contents:"+stylesheet.getPath());184 logger.error("couldn't find the stylesheet file to produce the table of contents:"+stylesheet.getPath()); 183 185 return result; 184 186 } … … 202 204 203 205 if (!doc_file.exists()) { 204 System.err.println("XMLRetrieve.DocumentStructureRetrieve:couldn't find file in coll "+this.cluster_name +", file "+doc_name+".xml");206 logger.error("couldn't find file in coll "+this.cluster_name +", file "+doc_name+".xml"); 205 207 } else { 206 208 try { … … 208 210 structure.appendChild(this.doc.importNode(toc, true)); 209 211 } catch (Exception e) { 210 System.err.println("XMLRetrieve.DocumentStructureRetrieve:couldn't transform the document to get the toc");212 logger.error("couldn't transform the document to get the toc"); 211 213 } 212 214 } … … 227 229 Element doc_list = (Element)GSXML.getChildByTagName(request, GSXML.DOC_NODE_ELEM+GSXML.LIST_MODIFIER); 228 230 if (doc_list == null) { 229 System.err.println("XMLRetrieve.DocumentMetadataRetrieve:no documents in the request");231 logger.error("no documents in the request"); 230 232 return result; 231 233 } … … 236 238 Element param_list = (Element) GSXML.getChildByTagName(request, GSXML.PARAM_ELEM+GSXML.LIST_MODIFIER); 237 239 if (param_list == null) { 238 System.err.println("XMLRetrieve.DocumentMetadataRetrieve:no metadata in the request");240 logger.error("no metadata in the request"); 239 241 return result; 240 242 } … … 275 277 276 278 if (!doc_file.exists()) { 277 System.out.println("XMLRetrieve.loadDocument:couldn't find file in coll "+this.cluster_name +", file "+doc_name+".xml");279 logger.info("couldn't find file in coll "+this.cluster_name +", file "+doc_name+".xml"); 278 280 return null; 279 281 } … … 283 285 the_doc = this.converter.getDOM(doc_file, this.document_encoding); 284 286 } catch (Exception e) { 285 System.err.println("XMLRetrieve.loadDocument:couldn't create a DOM from file "+doc_file.getPath());287 logger.error("couldn't create a DOM from file "+doc_file.getPath()); 286 288 return null; 287 289 } … … 295 297 String [] bits = node_id.split("\\."); 296 298 if (bits.length > 4) { 297 System.err.println("XMLRetrieve.getSection:badly formatted node id ("+node_id +"), cant retrieve the section");299 logger.error("badly formatted node id ("+node_id +"), cant retrieve the section"); 298 300 return null; 299 301 } -
trunk/gsdl3/src/java/org/greenstone/gsdl3/service/XSLTServices.java
r10093 r13124 46 46 import java.net.URLDecoder; 47 47 48 import org.apache.log4j.*; 49 48 50 /** 49 51 * A ServiceRack class for XSLT query. … … 62 64 extends ServiceRack { 63 65 66 static Category logger = Category.getInstance(org.greenstone.gsdl3.service.XSLTServices.class.getName()); 67 64 68 // these strings must match what is found in the properties file 65 69 // the services on offer … … 106 110 } 107 111 108 System.out.println("configuring XSLTServices");112 logger.info("configuring XSLTServices"); 109 113 this.config_info = info; 110 114 try { 111 System.out.println("XSLTService::configure()called with:");115 logger.info("called with:"); 112 116 TransformerFactory transformerFactory = TransformerFactory.newInstance(); 113 117 Element doc = (Element)info.getFirstChild(); … … 117 121 transformer.transform(source,result); 118 122 } catch (Throwable t) { 119 System.err.println("Error printing XML in XSLTService::configure()");123 logger.error("Error printing XML in XSLTService::configure()"); 120 124 } 121 125 return true; … … 145 149 response.setAttribute(GSXML.TYPE_ATT, GSXML.REQUEST_TYPE_PROCESS); 146 150 147 System.err.println("XSLTServices:should never get here. service type wrong:"+service);151 logger.error("should never get here. service type wrong:"+service); 148 152 GSXML.addError(this.doc, response,"XSLTServices:should never get here. service type wrong:"+service); 149 153 return response; … … 172 176 173 177 if (param_elem==null) { 174 System.err.println("bad query request");178 logger.error("bad query request"); 175 179 GSXML.addError(this.doc, response,"bad query request in XSLTServices"); 176 180 return response; … … 228 232 Character.MAX_VALUE); 229 233 } else { 230 System.err.println("XSLTServices:bad alphabet name : "+ alphabet);234 logger.error("bad alphabet name : "+ alphabet); 231 235 GSXML.addError(this.doc, response,"XSLTServices: bad alphabet name : "+ alphabet); 232 236 stream = new GeneratedDocumentStream(); -
trunk/gsdl3/src/java/org/greenstone/gsdl3/util/Dictionary.java
r10941 r13124 23 23 import java.util.Enumeration; 24 24 25 import org.apache.log4j.*; 26 25 27 public class Dictionary { 28 29 static Category logger = Category.getInstance(org.greenstone.gsdl3.util.Dictionary.class.getName()); 26 30 27 31 /** The locale of this dictionary. */ … … 47 51 this.raw = ResourceBundle.getBundle(this.resource, this.locale); 48 52 } catch (Exception e) { 49 //System.err.println("Dictionary: couldn't locate a resource bundle for "+resource);53 logger.debug("Dictionary: couldn't locate a resource bundle for "+resource); 50 54 } 51 55 } … … 57 61 this.raw = ResourceBundle.getBundle(this.resource, this.locale); 58 62 } catch (Exception e) { 59 //System.err.println("Dictionary: couldn't locate a resource bundle for "+resource);63 logger.debug("Dictionary: couldn't locate a resource bundle for "+resource); 60 64 } 61 65 } … … 80 84 this.raw = ResourceBundle.getBundle(this.resource, this.locale); 81 85 } catch (Exception ex) { 82 //System.err.println("Dictionary: couldn't locate a resource bundle for "+resource);86 logger.debug("Dictionary: couldn't locate a resource bundle for "+resource); 83 87 } 84 88 … … 139 143 } 140 144 catch (Exception e) { 141 //System.err.println("Dictionary Error: couldn't find string for key:" + key +" in resource "+this.resource);145 logger.debug("Dictionary Error: couldn't find string for key:" + key +" in resource "+this.resource); 142 146 return null; 143 147 } -
trunk/gsdl3/src/java/org/greenstone/gsdl3/util/GDBMWrapper.java
r11278 r13124 5 5 import au.com.pharos.gdbm.GdbmException; 6 6 7 import org.apache.log4j.*; 8 7 9 /** java wrapper class for gdbm - uses Java-GDBM written by Martin Pool 8 10 * replaces gdbmclass in the old version … … 10 12 11 13 public class GDBMWrapper { 14 15 static Category logger = Category.getInstance(org.greenstone.gsdl3.util.GDBMWrapper.class.getName()); 16 12 17 13 18 // Values must match those from gdbm.h - uses the definitions from GdbmFile ! … … 39 44 db_ = new GdbmFile(filename, mode); 40 45 } catch ( GdbmException e) { // the database wasn't opened or created 41 System.err.println("GDBMWrapper:couldn't open database "+filename);46 logger.error("couldn't open database "+filename); 42 47 return false; 43 48 } … … 56 61 } catch (GdbmException e) { 57 62 // should never get here - close never actually throws an exception 58 System.err.println("GDBMWrapper:error on close()");63 logger.error("error on close()"); 59 64 } 60 65 } … … 72 77 s_info = (String)db_.fetch(main_key); 73 78 } catch (GdbmException e) { 74 System.err.println("GDBMWrapper:couldn't get record");79 logger.error("couldn't get record"); 75 80 return null; 76 81 } 77 82 if (s_info==null) { 78 83 // record not present 79 System.err.println("GDBMWrapper:key "+main_key+" not present in db");84 logger.error("key "+main_key+" not present in db"); 80 85 return null; 81 86 } … … 86 91 String value; 87 92 for (int i=0; i<lines.length; i++) { 88 //System.out.println("line:"+lines[i]);93 logger.debug("line:"+lines[i]); 89 94 int a = lines[i].indexOf('<'); 90 95 int b= lines[i].indexOf('>'); 91 96 if (a==-1 || b==-1) { 92 System.err.println("error:bad format in db");97 logger.error("bad format in db"); 93 98 } 94 99 else { 95 100 key=lines[i].substring(a+1, b); 96 101 value=lines[i].substring(b+1); 97 //System.out.println("key="+key+", val="+value);102 logger.debug("key="+key+", val="+value); 98 103 info.addInfo(key, value); 99 104 … … 165 170 int p = oid.lastIndexOf('.'); 166 171 if (p != oid.length()-3) { 167 System.out.println("translateoid error: '.' is not the third to last char!!");172 logger.info("translateoid error: '.' is not the third to last char!!"); 168 173 return oid; 169 174 } … … 240 245 DBInfo info = getInfo(doc_id); 241 246 if (info==null) { 242 System.out.println("info is null!!");247 logger.info("info is null!!"); 243 248 return top; 244 249 } -
trunk/gsdl3/src/java/org/greenstone/gsdl3/util/GSEntityResolver.java
r10087 r13124 7 7 import java.net.URL; 8 8 9 import org.apache.log4j.*; 10 9 11 // uses a class loader to find entities 10 12 // The class loader to use can be set by setClassLoader(), otherwise it will use the class loader that loaded itself. For the Tomcat webapp, this will be the webapp class loader, not the system class loader. the webapp classloader knows about the classes in the WEB-INF/classes dir, the system classloader knows about the ones on the classpath. The system class loader is a parent to web app classloader, so this will be used as well. … … 14 16 ClassLoader class_loader = null; 15 17 18 static Category logger = Category.getInstance(org.greenstone.gsdl3.util.GSEntityResolver.class.getName()); 19 16 20 public void setClassLoader(ClassLoader loader) { 17 21 this.class_loader = loader; … … 20 24 public InputSource resolveEntity (String public_id, String system_id) { 21 25 22 //System.out.println("entity resolver for "+system_id);26 logger.debug("entity resolver for "+system_id); 23 27 String temp_id = system_id; 24 28 if (temp_id.startsWith("file://")) { -
trunk/gsdl3/src/java/org/greenstone/gsdl3/util/GSFile.java
r10899 r13124 32 32 import java.util.ArrayList; 33 33 34 import org.apache.log4j.*; 35 34 36 /** 35 37 * GSFile - utility class for Greenstone. … … 44 46 45 47 public class GSFile { 48 49 static Category logger = Category.getInstance(org.greenstone.gsdl3.util.GSFile.class.getName()); 46 50 47 51 /** site config file path */ … … 312 316 data = readFile(in_filename); 313 317 } catch (Exception e) { 314 System.err.println("GSFile.base64EncodeFromFile:couldn't read the file");318 logger.error("couldn't read the file"); 315 319 } 316 320 String encodedString = Base64.encode(data); … … 326 330 327 331 } catch (Exception e) { 328 System.err.println("GSFile.base64DecodeToFile:file opening/closing errors"+e.getMessage());332 logger.error("file opening/closing errors"+e.getMessage()); 329 333 return false; 330 334 } … … 369 373 public static boolean copyFile(File source, File destination) { 370 374 if (!source.isFile()) { 371 System.err.println("GSFile.copyFile(): "+source.getPath()+" is not a file!");375 logger.error(source.getPath()+" is not a file!"); 372 376 return false; 373 377 } … … 383 387 out.close(); 384 388 } catch (Exception e) { 385 System.err.println("GSFile.copyFile():something went wrong copying "+source.getPath()+" to "+destination.getPath());386 System.err.println("Exception: "+e.getMessage());389 logger.error("something went wrong copying "+source.getPath()+" to "+destination.getPath()); 390 logger.error("Exception: "+e.getMessage()); 387 391 return false; 388 392 } … … 428 432 input[i].delete(); 429 433 } catch (Exception e) { 430 System.err.println("GSFile.moveDirectory:exception: "+e.getMessage());434 logger.error("exception: "+e.getMessage()); 431 435 return false; 432 436 } -
trunk/gsdl3/src/java/org/greenstone/gsdl3/util/GSXML.java
r11009 r13124 17 17 //import java.util.Locale; 18 18 19 import org.apache.log4j.*; 20 19 21 /** various functions for extracting info out of GS XML */ 20 22 public class GSXML { 23 24 static Category logger = Category.getInstance(org.greenstone.gsdl3.util.GSXML.class.getName()); 21 25 22 26 // greenstone xml elements … … 210 214 211 215 if (!xml.getNodeName().equals(PARAM_ELEM+LIST_MODIFIER)) { 212 System.err.println("GSXML:paramList element should have been passed to extractParams, instead it was "+xml.getNodeName());216 logger.error("paramList element should have been passed to extractParams, instead it was "+xml.getNodeName()); 213 217 return null; 214 218 } … … 649 653 for (int i=0; i<children.getLength(); i++) { 650 654 Node child = children.item(i); 651 ///ystem.out.println("getnamed elem, node nmae="+child.getNodeName());655 logger.debug("getnamed elem, node nmae="+child.getNodeName()); 652 656 if (child.getNodeName().equals(node_name)) { 653 657 if (((Element)child).getAttribute(attribute_name).equals(attribute_value)) … … 799 803 if (e.getNodeType() == Node.TEXT_NODE){ 800 804 System.out.println("text") ; 801 //System.out.println(e.getNodeValue()) ;805 logger.debug(e.getNodeValue()) ; 802 806 return ; 803 807 } -
trunk/gsdl3/src/java/org/greenstone/gsdl3/util/GlobalProperties.java
r10677 r13124 5 5 import java.io.InputStream; 6 6 7 import org.apache.log4j.*; 8 7 9 /** holds some global properties for the application. Read from a properties file */ 8 10 public class GlobalProperties { 9 11 12 13 static Category logger = Category.getInstance(org.greenstone.gsdl3.util.GlobalProperties.class.getName()); 10 14 private static Properties properties = null; 11 15 private static String properties_filename = "global.properties"; … … 44 48 InputStream in = Class.forName("org.greenstone.gsdl3.util.GlobalProperties").getClassLoader().getResourceAsStream(properties_filename); 45 49 if (in != null) { 46 System.err.println("loading global properties");50 logger.error("loading global properties"); 47 51 properties.load(in); 48 52 in.close(); 49 53 } else { 50 System.err.println("couldn't load gloabl properties!");54 logger.error("couldn't load gloabl properties!"); 51 55 } 52 56 gsdl3_home = properties.getProperty("gsdl3.home"); … … 56 60 gsdl3_web_address = "http://"+ properties.getProperty("tomcat.server")+":"+ properties.getProperty("tomcat.port")+"/"+properties.getProperty("tomcat.context"); 57 61 } catch (Exception e) { 58 System.err.println("Exception trying to reload global.properties: "+e);62 logger.error("Exception trying to reload global.properties: "+e); 59 63 } 60 64 -
trunk/gsdl3/src/java/org/greenstone/gsdl3/util/Processing.java
r8437 r13124 3 3 import java.io.InputStreamReader; 4 4 5 import org.apache.log4j.*; 6 5 7 public class Processing { 6 8 9 static Category logger = Category.getInstance(org.greenstone.gsdl3.util.Processing.class.getName()); 10 7 11 /** Determine if the given process is still executing. It does this by attempting to throw an exception - not the most efficient way, but the only one as far as I know 8 12 * @param process the Process to test … … 26 30 static public int runProcess(String command) { 27 31 28 System.err.println("executing command "+command);32 logger.error("executing command "+command); 29 33 int exit_value = -1; 30 34 try { … … 74 78 75 79 // do something with the messages 76 System.err.println("err>"+error_buffer.toString());77 System.err.println("out>"+output_buffer.toString());80 logger.error("err>"+error_buffer.toString()); 81 logger.error("out>"+output_buffer.toString()); 78 82 // Ensure that any messages still remaining in the string buffers are fired off. 79 83 // Now display final message based on exit value … … 87 91 exit_value = prcs.exitValue(); 88 92 } catch (Exception e) { 89 System.err.println("runProcess ERROR: "+e);93 logger.error(e); 90 94 return 1; 91 95 } -
trunk/gsdl3/src/java/org/greenstone/gsdl3/util/XMLConverter.java
r10202 r13124 37 37 import java.io.FileReader; 38 38 39 import org.apache.log4j.*; 40 39 41 /** XMLConverter - utility class for greenstone 40 42 * … … 48 50 */ 49 51 public class XMLConverter { 52 53 static Category logger = Category.getInstance(org.greenstone.gsdl3.util.XMLConverter.class.getName()); 50 54 51 55 /** xerces parser */ … … 67 71 this.parser.setFeature("http://apache.org/xml/features/dom/defer-node-expansion", false); 68 72 } catch (Exception e) { 69 System.err.println("XMLConverter:exception "+e.getMessage());73 logger.error("exception "+e.getMessage()); 70 74 } 71 75 } … … 89 93 90 94 } catch (Exception e) { 91 System.err.println("XMLConverter.getDOM(String):exception "+e.getMessage());95 logger.error("exception "+e.getMessage()); 92 96 } 93 97 return null; … … 107 111 108 112 } catch (Exception e) { 109 System.err.println("XMLConverter.getDOM(File):exception "+e.getMessage());113 logger.error("exception "+e.getMessage()); 110 114 e.printStackTrace(); 111 115 } … … 126 130 127 131 } catch (Exception e) { 128 System.err.println("XMLConverter.getDOM(File):exception "+e.getMessage());132 logger.error("exception "+e.getMessage()); 129 133 } 130 134 return null; … … 268 272 } 269 273 else { 270 System.err.println("XMLConverter.getString(): Warning:Unhandled processing instruction " + nodeName);274 logger.error("Unhandled processing instruction " + nodeName); 271 275 } 272 276 } … … 283 287 // A type of node that is not handled yet 284 288 else { 285 System.err.println("XMLConverter.getString():Warning: Unknown node type: " + nodeType+" "+getNodeTypeString(nodeType));289 logger.error("Warning: Unknown node type: " + nodeType+" "+getNodeTypeString(nodeType)); 286 290 } 287 291 -
trunk/gsdl3/src/java/org/greenstone/gsdl3/util/XMLTransformer.java
r5663 r13124 42 42 import java.util.Map; 43 43 import java.util.Iterator; 44 45 import org.apache.log4j.*; 46 44 47 /** XMLTransformer - utility class for greenstone 45 48 * … … 50 53 */ 51 54 public class XMLTransformer { 55 56 static Category logger = Category.getInstance(org.greenstone.gsdl3.util.XMLTransformer.class.getName()); 52 57 53 58 /** The transformer factory we're using */ … … 69 74 70 75 } catch (Exception e) { 71 System.err.println("XMLTransformer()exception "+e.getMessage());76 logger.error("exception "+e.getMessage()); 72 77 } 73 78 } … … 94 99 return output.toString(); 95 100 } catch (TransformerConfigurationException e) { 96 System.err.println("XMLTransformer:couldn't create transformer object: "+e.getMessageAndLocation());97 System.err.println(e.getLocationAsString());101 logger.error("couldn't create transformer object: "+e.getMessageAndLocation()); 102 logger.error(e.getLocationAsString()); 98 103 return ""; 99 104 } catch (TransformerException e) { 100 System.err.println("XMLTransformer:couldn't transform the source: " + e.getMessage());105 logger.error("couldn't transform the source: " + e.getMessage()); 101 106 return ""; 102 107 } … … 129 134 return output.toString(); 130 135 } catch (TransformerConfigurationException e) { 131 System.err.println("XMLTransformer:couldn't create transformer object: "+e.getMessageAndLocation());132 System.err.println(e.getLocationAsString());136 logger.error("couldn't create transformer object: "+e.getMessageAndLocation()); 137 logger.error(e.getLocationAsString()); 133 138 return ""; 134 139 } catch (TransformerException e) { 135 System.err.println("XMLTransformer:couldn't transform the source: " + e.getMessage());140 logger.error("couldn't transform the source: " + e.getMessage()); 136 141 return ""; 137 142 } … … 160 165 return result.getNode().getFirstChild(); 161 166 } catch (TransformerConfigurationException e) { 162 System.err.println("XMLTransformer:couldn't create transformer object: "+e.getMessageAndLocation());163 System.err.println(e.getLocationAsString());167 logger.error("couldn't create transformer object: "+e.getMessageAndLocation()); 168 logger.error(e.getLocationAsString()); 164 169 return null; 165 170 } catch (TransformerException e) { 166 System.err.println("XMLTransformer:couldn't transform the source: " + e.getMessage());171 logger.error("couldn't transform the source: " + e.getMessage()); 167 172 return null; 168 173 } … … 180 185 return result.getNode().getFirstChild(); 181 186 } catch (TransformerConfigurationException e) { 182 System.err.println("XMLTransformer:couldn't create transformer object: "+e.getMessageAndLocation());183 System.err.println(e.getLocationAsString());187 logger.error("couldn't create transformer object: "+e.getMessageAndLocation()); 188 logger.error(e.getLocationAsString()); 184 189 return null; 185 190 } catch (TransformerException e) { 186 System.err.println("XMLTransformer:couldn't transform the source: " + e.getMessage());191 logger.error("couldn't transform the source: " + e.getMessage()); 187 192 return null; 188 193 } -
trunk/gsdl3/src/java/org/greenstone/gsdl3/util/XSLTUtil.java
r10783 r13124 5 5 import java.text.SimpleDateFormat; 6 6 7 import org.apache.log4j.*; 8 7 9 /** a class to contain various static methods that are used by the xslt 8 10 * stylesheets 9 11 */ 10 12 public class XSLTUtil { 13 14 static Category logger = Category.getInstance(org.greenstone.gsdl3.util.XSLTUtil.class.getName()); 11 15 12 16 /* some tests */ … … 57 61 } 58 62 catch (Exception e){ 59 System.err.println("XSLTUtil.toUTF8:unsupported encoding");63 logger.error("unsupported encoding"); 60 64 return orig.getBytes(); 61 65 }
Note:
See TracChangeset
for help on using the changeset viewer.