Changeset 13123 for trunk/gsdl3/src/java/org/greenstone
- Timestamp:
- 2006-10-17T15:44:38+13:00 (18 years ago)
- Location:
- trunk/gsdl3/src/java/org/greenstone/gsdl3
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/gsdl3/src/java/org/greenstone/gsdl3/collection/Collection.java
r9874 r13123 33 33 import java.util.HashMap; 34 34 35 import org.apache.log4j.*; 36 35 37 /** 36 38 * Represents a collection in Greenstone. A collection is an extension of … … 43 45 public class Collection 44 46 extends ServiceCluster { 47 48 static Category logger = Category.getInstance(org.greenstone.gsdl3.collection.Collection.class.getName()); 45 49 46 50 protected XMLTransformer transformer = null; … … 69 73 70 74 if (this.site_home == null || this.cluster_name== null) { 71 System.err.println("Collection: site_home and collection_name must be set before configure called!");75 logger.error("Collection: site_home and collection_name must be set before configure called!"); 72 76 return false; 73 77 } … … 97 101 98 102 if (!coll_config_file.exists()) { 99 System.err.println("Collection: couldn't configure collection: "+this.cluster_name+", "+coll_config_file+" does not exist");103 logger.error("Collection: couldn't configure collection: "+this.cluster_name+", "+coll_config_file+" does not exist"); 100 104 return null; 101 105 } … … 117 121 File build_config_file = new File(GSFile.collectionBuildConfigFile(this.site_home, this.cluster_name)); 118 122 if (!build_config_file.exists()) { 119 System.err.println("Collection: couldn't configure collection: "+this.cluster_name+", "+build_config_file+" does not exist");123 logger.error("Collection: couldn't configure collection: "+this.cluster_name+", "+build_config_file+" does not exist"); 120 124 return null; 121 125 } … … 176 180 } 177 181 178 System.err.println("Collection: cant process system request, configure "+subset);182 logger.error("Collection: cant process system request, configure "+subset); 179 183 return false; 180 184 } -
trunk/gsdl3/src/java/org/greenstone/gsdl3/collection/ServiceCluster.java
r9874 r13123 36 36 import java.util.Iterator; 37 37 38 import org.apache.log4j.*; 39 38 40 /* ServiceCluster - a groups of services that are related in some way 39 41 * Implements ModuleInterface. Contains a list of services provided by the cluster, along with metadata about the cluster itself. … … 45 47 public class ServiceCluster 46 48 implements ModuleInterface { 49 50 static Category logger = Category.getInstance(org.greenstone.gsdl3.collection.ServiceCluster.class.getName()); 47 51 48 52 protected static final String CONFIG_ENCODING = "utf-8"; … … 134 138 135 139 if (this.site_home == null || this.cluster_name== null) { 136 System.err.println("ServiceCluster:site_home and cluster_name must be set before configure called!");137 return false; 138 } 139 System.out.println("configuring service cluster");140 logger.error("site_home and cluster_name must be set before configure called!"); 141 return false; 142 } 143 logger.info("configuring service cluster"); 140 144 // read the site configuration file 141 145 File config_file = new File(GSFile.siteConfigFile(this.site_home)); 142 146 143 147 if (!config_file.exists()) { 144 System.err.println("ServiceCluster:couldn't configure cluster: "+this.cluster_name +", "+config_file+" does not exist");148 logger.error("couldn't configure cluster: "+this.cluster_name +", "+config_file+" does not exist"); 145 149 return false; 146 150 } … … 148 152 Document doc = this.converter.getDOM(config_file, CONFIG_ENCODING); 149 153 if (doc == null) { 150 System.err.println("ServiceCluster:couldn't parse config file "+config_file.getPath());154 logger.error("couldn't parse config file "+config_file.getPath()); 151 155 return false; 152 156 } … … 168 172 if (!addMetadata(meta_list)) { 169 173 170 System.err.println("ServiceCluster:couldn't configure the metadata");174 logger.error(" couldn't configure the metadata"); 171 175 } 172 176 } … … 177 181 if (!addDisplayItems(display_list)) { 178 182 179 System.err.println("ServiceCluster:couldn't configure the display items");183 logger.error("couldn't configure the display items"); 180 184 } 181 185 } … … 187 191 // is this an error? could you ever have a service cluster 188 192 // without service racks??? 189 System.err.println("ServiceCluster:cluster has no service racks!!");193 logger.error("cluster has no service racks!!"); 190 194 } else { 191 195 192 196 if (!configureServiceRack(service_rack_list, null)) { 193 System.err.println("ServiceCluster:couldn't configure the service racks!!");197 logger.error("couldn't configure the service racks!!"); 194 198 return false; 195 199 } … … 255 259 NodeList nodes = service_rack_list.getElementsByTagName(GSXML.SERVICE_CLASS_ELEM); 256 260 if (nodes.getLength()==0) { 257 System.err.println("ServiceCluster configuration error: cluster "+this.cluster_name+" has no service modules!");261 logger.error("ServiceCluster configuration error: cluster "+this.cluster_name+" has no service modules!"); 258 262 return false; 259 263 } … … 304 308 } 305 309 } catch (Exception e) { 306 System.err.println("ServiceCluster Error:configure exception: couldn't create service module:org.greenstone.gsdl3.service."+servicetype+"\n"+e.getMessage() + e.getClass() );310 logger.error("configure exception: couldn't create service module:org.greenstone.gsdl3.service."+servicetype+"\n"+e.getMessage() + e.getClass() ); 307 311 e.printStackTrace(); 308 312 //return false; … … 343 347 Element mainResult = this.doc.createElement(GSXML.MESSAGE_ELEM); 344 348 if (requests.getLength()==0) { 345 System.err.println("ServiceCluster.process:no requests for cluster:"+this.cluster_name);349 logger.error("no requests for cluster:"+this.cluster_name); 346 350 // no requests 347 351 return mainResult; // for now … … 354 358 String clustername = GSPath.getFirstLink(to); 355 359 if (!clustername.equals(this.cluster_name)){ 356 System.err.println("ServiceCluster Error:cluster name wrong! was "+clustername+" should have been "+this.cluster_name);360 logger.error("cluster name wrong! was "+clustername+" should have been "+this.cluster_name); 357 361 continue; // ignore this request 358 362 } … … 368 372 369 373 if (!this.service_map.containsKey(service)) { 370 System.err.println("ServiceCluster Error:non-existant service, "+service+", specified!");374 logger.error("non-existant service, "+service+", specified!"); 371 375 continue; 372 376 } … … 459 463 response = processSystemRequest(request); 460 464 } else { // unknown type 461 System.err.println("ServiceCluster Error:cant handle request of type "+ type);465 logger.error("cant handle request of type "+ type); 462 466 463 467 } … … 520 524 response.appendChild(s); 521 525 } else { 522 System.err.println("ServiceCluster:cant process system request, action "+action);526 logger.error("cant process system request, action "+action); 523 527 continue; 524 528 } … … 534 538 File configFile = new File(GSFile.siteConfigFile(this.site_home)); 535 539 if (!configFile.exists() ) { 536 System.err.println("ServiceCluster:site config file: "+configFile.getPath()+" not found!");540 logger.error("site config file: "+configFile.getPath()+" not found!"); 537 541 // wont be able to do any of the requests 538 542 return false; … … 542 546 Document site_config_doc = this.converter.getDOM(configFile); 543 547 if (site_config_doc == null) { 544 System.err.println("ServiceCluster:could not read in site config file: "+configFile.getPath());548 logger.error("could not read in site config file: "+configFile.getPath()); 545 549 return false; 546 550 } … … 549 553 Element cluster_config_elem = GSXML.getNamedElement((Element)GSXML.getChildByTagName(site_config_elem, GSXML.CLUSTER_ELEM+GSXML.LIST_MODIFIER), GSXML.CLUSTER_ELEM, GSXML.NAME_ATT, this.cluster_name); 550 554 if (cluster_config_elem == null) { 551 System.err.println("ServiceCluster:site config file: "+configFile.getPath()+" has no element for cluster "+this.cluster_name);555 logger.error("site config file: "+configFile.getPath()+" has no element for cluster "+this.cluster_name); 552 556 // wont be able to do any of teh requests 553 557 return false; … … 563 567 return addMetadata(metadata_list); 564 568 } else { 565 System.err.println("ServiceCluster: cant process system request, configure "+subset);569 logger.error("cannot process system request, configure "+subset); 566 570 return false; 567 571 } -
trunk/gsdl3/src/java/org/greenstone/gsdl3/collection/XMLCollection.java
r5266 r13123 15 15 import java.util.HashMap; 16 16 17 import org.apache.log4j.*; 18 17 19 /* for a collection that hasn't been built with greenstone build stuff. expects a documentList in the collectionConfig file, and it stores this. this is where doc level metadata comes from */ 18 20 public class XMLCollection 19 21 extends Collection { 22 23 static Category logger = Category.getInstance(org.greenstone.gsdl3.collection.XMLCollection.class.getName()); 20 24 21 25 protected Element document_list = null; … … 106 110 response = processSystemRequest(request); 107 111 } else { // unknown type 108 System.err.println("ServiceCluster Error:cant handle request of type "+ type);112 logger.error("cant handle request of type "+ type); 109 113 110 114 } -
trunk/gsdl3/src/java/org/greenstone/gsdl3/comms/SOAPCommunicator.java
r11022 r13123 36 36 import org.w3c.dom.Element; 37 37 38 import org.apache.log4j.*; 39 38 40 /* 39 41 * The Client side of a SOAP Connection … … 45 47 public class SOAPCommunicator 46 48 extends Communicator { 49 50 static Category logger = Category.getInstance(org.greenstone.gsdl3.comms.SOAPCommunicator.class.getName()); 47 51 48 52 /** address of site to connect to */ … … 61 65 String type = site_elem.getAttribute(GSXML.TYPE_ATT); 62 66 if (!type.equals(GSXML.COMM_TYPE_SOAP_JAVA)) { 63 System.err.println("SOAPCommunicator:wrong type of site");67 logger.error("wrong type of site"); 64 68 return false; 65 69 } 66 70 remote_site_name_ = site_elem.getAttribute(GSXML.NAME_ATT); 67 71 if (remote_site_name_.equals("")) { 68 System.err.println("SOAPCommunicator:must have name attribute in site element");72 logger.error("must have name attribute in site element"); 69 73 return false; 70 74 } … … 72 76 String local_site_name = site_elem.getAttribute(GSXML.LOCAL_SITE_ATT); 73 77 if (remote_site_address_.equals("") && local_site_name.equals("")) { 74 System.err.println("SOAPCommunicator:must have address or localSite attributes in site element");78 logger.error("must have address or localSite attributes in site element"); 75 79 return false; 76 80 } … … 84 88 call_.setTargetEndpointAddress( new java.net.URL(remote_site_address_) ); 85 89 } catch (Exception e) { 86 System.err.println("SOAPCommunicator.configure() Error: Exception occurred "+e);90 logger.error("SOAPCommunicator.configure() Error: Exception occurred "+e); 87 91 return false; 88 92 } … … 118 122 if (message.getNamespaceURI() == null) { 119 123 message_to_send = GSXML.duplicateWithNewNameNS(message.getOwnerDocument(), message, "gs3:"+message.getTagName(), "urn:foo", true); 120 //System.err.println("**"+new XMLConverter().getPrettyString(new_message));121 124 } 122 125 … … 158 161 Element response = comm.process(request_elem); 159 162 160 System.err.println("response was "+converter.getPrettyString(response));163 logger.error("response was "+converter.getPrettyString(response)); 161 164 } 162 165 }
Note:
See TracChangeset
for help on using the changeset viewer.