- Timestamp:
- 2003-08-06T12:02:10+12:00 (21 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/gsdl3/src/java/org/greenstone/gsdl3/service/ServiceRack.java
r4903 r5098 59 59 60 60 /** the absolute address of the site home */ 61 protected String site_home _=null;61 protected String site_home =null; 62 62 /** the http address of the site home */ 63 protected String site_http_address _=null;63 protected String site_http_address =null; 64 64 65 65 /** the name of the cluster (or collection) that this service 66 66 belongs to - if any */ 67 protected String cluster_name _= null;67 protected String cluster_name = null; 68 68 69 69 /** some services can talk back to the message router */ 70 protected ModuleInterface router _= null;70 protected ModuleInterface router = null; 71 71 72 72 /** a converter class to create Documents etc */ 73 protected XMLConverter converter _= null;73 protected XMLConverter converter = null; 74 74 75 75 /** the original config info - if need to store it */ 76 protected Element config_info _= null;76 protected Element config_info = null; 77 77 78 78 /** XML element for describe requests - the container doc */ 79 protected Document doc _= null;79 protected Document doc = null; 80 80 81 81 /** XML element for describe requests - list of supported services 82 82 - this is static */ 83 protected Element short_service_info _= null;83 protected Element short_service_info = null; 84 84 85 85 /** XML element for stylesheet requests - map of service name to format 86 86 elem */ 87 protected HashMap format_info_map _= null;87 protected HashMap format_info_map = null; 88 88 89 89 /** sets the cluster name */ 90 90 public void setClusterName(String cluster_name) { 91 cluster_name_= cluster_name;91 this.cluster_name = cluster_name; 92 92 } 93 93 /** sets the collect name */ … … 98 98 /** sets the site home */ 99 99 public void setSiteHome(String site_home) { 100 site_home_= site_home;100 this.site_home = site_home; 101 101 } 102 102 /** sets the site http address */ 103 103 public void setSiteAddress(String site_address) { 104 site_http_address_= site_address;104 this.site_http_address = site_address; 105 105 } 106 106 107 107 /** sets the message router */ 108 108 public void setMessageRouter(ModuleInterface m) { 109 router_= m;109 this.router = m; 110 110 } 111 111 112 112 /** the no-args constructor */ 113 113 public ServiceRack() { 114 converter_= new XMLConverter();115 doc_ = converter_.newDOM();116 short_service_info_ = doc_.createElement(GSXML.SERVICE_ELEM+GSXML.LIST_MODIFIER);117 format_info_map_= new HashMap();114 this.converter = new XMLConverter(); 115 this.doc = this.converter.newDOM(); 116 this.short_service_info = this.doc.createElement(GSXML.SERVICE_ELEM+GSXML.LIST_MODIFIER); 117 this.format_info_map = new HashMap(); 118 118 } 119 119 … … 143 143 public String process(String xml_in) { 144 144 145 Document doc = converter_.getDOM(xml_in);145 Document doc = this.converter.getDOM(xml_in); 146 146 147 147 Element res = process(doc.getDocumentElement()); 148 return converter_.getString(res);148 return this.converter.getString(res); 149 149 150 150 } … … 161 161 NodeList requests = message.getElementsByTagName(GSXML.REQUEST_ELEM); 162 162 Document mess_doc = message.getOwnerDocument(); 163 Element mainResult = doc_.createElement(GSXML.MESSAGE_ELEM);163 Element mainResult = this.doc.createElement(GSXML.MESSAGE_ELEM); 164 164 if (requests.getLength()==0) { 165 165 // no requests … … 174 174 Element response = processDescribe(request); 175 175 if (response !=null) { 176 mainResult.appendChild( doc_.importNode(response, true));176 mainResult.appendChild(this.doc.importNode(response, true)); 177 177 } 178 178 179 179 } else if (type.equals(GSXML.REQUEST_TYPE_FORMAT)) { 180 180 Element response = processFormat(request); 181 mainResult.appendChild( doc_.importNode(response, true));181 mainResult.appendChild(this.doc.importNode(response, true)); 182 182 183 183 … … 220 220 } 221 221 if (response !=null) { 222 mainResult.appendChild( doc_.importNode(response, true));222 mainResult.appendChild(this.doc.importNode(response, true)); 223 223 } 224 224 … … 240 240 protected Element processDescribe(Element request) { 241 241 242 Element response = doc_.createElement(GSXML.RESPONSE_ELEM);242 Element response = this.doc.createElement(GSXML.RESPONSE_ELEM); 243 243 response.setAttribute(GSXML.TYPE_ATT, GSXML.REQUEST_TYPE_DESCRIBE); 244 244 … … 264 264 */ 265 265 protected Element processFormat(Element request) { 266 Element response = doc_.createElement(GSXML.RESPONSE_ELEM);266 Element response = this.doc.createElement(GSXML.RESPONSE_ELEM); 267 267 response.setAttribute(GSXML.TYPE_ATT, GSXML.REQUEST_TYPE_FORMAT); 268 268 … … 275 275 276 276 // describe a particular service 277 if ( format_info_map_.containsKey(to)) {277 if (this.format_info_map.containsKey(to)) { 278 278 response.appendChild(getServiceFormat(to)); 279 279 response.setAttribute(GSXML.FROM_ATT, to); … … 288 288 protected Element getServiceList(String lang) { 289 289 // for now, it is static and has no language stuff 290 return (Element) short_service_info_.cloneNode(true);290 return (Element) this.short_service_info.cloneNode(true); 291 291 } 292 292 … … 295 295 296 296 protected Element getServiceFormat(String service) { 297 Element format = (Element)((Element) format_info_map_.get(service)).cloneNode(true);297 Element format = (Element)((Element)this.format_info_map.get(service)).cloneNode(true); 298 298 return format; 299 299 }
Note:
See TracChangeset
for help on using the changeset viewer.