Changeset 3645
- Timestamp:
- 2003-01-06T15:23:47+13:00 (21 years ago)
- Location:
- trunk/gsdl3/src/java/org/greenstone/gsdl3/action
- Files:
-
- 2 added
- 2 deleted
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/gsdl3/src/java/org/greenstone/gsdl3/action/Action.java
r3568 r3645 18 18 protected XMLConverter converter_=null; 19 19 /** cgi args converter */ 20 protected CGIArgConverter cgi_=null;20 protected GSCGI cgi_ = null; 21 21 /** a transformer class to transform xml using xslt */ 22 22 protected XMLTransformer transformer_=null; 23 24 23 /** a reference to the message router that it must talk to to 25 24 * get info. it may be a communicator acting as a proxy, but it 26 25 doesn't care about that */ 27 26 protected ModuleInterface mr_=null; 28 29 27 30 28 public Action() { … … 41 39 mr_ = m; 42 40 } 43 44 public void setCGIConverter(CGIArgConverter cgi) { 41 /** sets the GSCGI object - used to convert between short and long names 42 * of params */ 43 public void setCGI(GSCGI cgi) { 45 44 cgi_ = cgi; 45 // add in any action specific params 46 addCGIParams(); 46 47 } 47 48 public void configure() { 48 49 // does nothing yet 49 50 } 50 51 /** any action specific cgi params should be added to the GSCGI object- 52 * overwrite this if a new action has its own params 53 * using cgi_.addStaticParam(param-name) */ 54 protected void addCGIParams() { 55 56 } 51 57 /** process takes an xml representation of cgi args 52 58 * and returns the page of results - may be in html/xml/other … … 60 66 } 61 67 68 /** the main process method - must be implemented in subclass */ 62 69 abstract public Element process(Element xml_in); 63 70 64 71 65 72 } 66 73 -
trunk/gsdl3/src/java/org/greenstone/gsdl3/action/AppletAction.java
r3568 r3645 40 40 HashMap params = GSXML.extractParams(cgi_param_list); 41 41 42 String collection = (String)params.get( "collection");43 String service_name=(String)params.get( "serviceName");42 String collection = (String)params.get(GSCGI.COLLECTION_ARG); 43 String service_name=(String)params.get(GSCGI.SERVICE_ARG); 44 44 service_name+= "Applet"; 45 45 -
trunk/gsdl3/src/java/org/greenstone/gsdl3/action/BrowseAction.java
r3604 r3645 51 51 52 52 // extract the params from the cgi-request, and check that we have a coll specified 53 // first convert short to long names54 53 Element cgi_paramList = (Element)GSXML.getChildByTagName(request, GSXML.PARAM_ELEM+GSXML.LIST_MODIFIER); 55 cgi_.toLong(cgi_paramList);56 54 HashMap params = GSXML.extractParams(cgi_paramList); 57 55 58 String collection = (String)params.get( "collection");56 String collection = (String)params.get(GSCGI.COLLECTION_ARG); 59 57 if (collection == null || collection.equals("")) { 60 58 System.err.println("BrowseAction Error:classifierbrowse, need to specify a collection!"); … … 90 88 91 89 // if there is a cl field in the cgi params, get the classifier info 92 String node = (String)params.get("cl assifier");90 String node = (String)params.get("cl"); 93 91 94 92 if (node!=null && !node.equals("")) { … … 110 108 111 109 // content - contains the classifier node, may be more than one 112 // call this resourcelist for now110 // call this document list for now 113 111 Element query_content = doc_.createElement(GSXML.CONTENT_ELEM); 114 112 mr_query_request.appendChild(query_content); 115 113 116 Element resource_list = doc_.createElement(GSXML.RESOURCE_ELEM+GSXML.LIST_MODIFIER);117 Element resource = doc_.createElement(GSXML.RESOURCE_ELEM);118 resource.setAttribute(GSXML.NAME_ATT, node);119 resource_list.appendChild(resource);120 query_content.appendChild( resource_list);114 Element document_list = doc_.createElement(GSXML.DOCUMENT_ELEM+GSXML.LIST_MODIFIER); 115 Element document = doc_.createElement(GSXML.DOCUMENT_ELEM); 116 document.setAttribute(GSXML.NAME_ATT, node); 117 document_list.appendChild(document); 118 query_content.appendChild(document_list); 121 119 122 120 Element mr_query_response = (Element)mr_.process(mr_query_message); -
trunk/gsdl3/src/java/org/greenstone/gsdl3/action/PageAction.java
r3568 r3645 14 14 public class PageAction extends Action { 15 15 16 public static final String SHORT_ACTION_NAME = "p"; 17 public static final String HOME_PAGE = "home"; 18 public static final String ABOUT_PAGE = "about"; 19 20 public String getActionShortName() { 21 return SHORT_ACTION_NAME; 22 } 16 23 public Element process (Element message) { 17 24 … … 20 27 String page_name = request.getAttribute(GSXML.SUBACTION_ATT); 21 28 if (page_name.equals("")) { // if no page specified, assume home page 22 page_name = "home";29 page_name = HOME_PAGE; 23 30 } 24 31 … … 30 37 // add the system stuff from message 31 38 page.appendChild(doc_.importNode(GSXML.getChildByTagName(message, GSXML.CONFIGURATION_ELEM), true)); 32 33 if (page_name.equals("home")) { 39 // add the cgi args request 40 Element cgi_request = (Element)doc_.importNode(request, true); 41 page.appendChild(cgi_request); 42 43 if (page_name.equals(HOME_PAGE)) { 34 44 return homePage(page, request); 35 } else if (page_name.equals( "about")) {45 } else if (page_name.equals(ABOUT_PAGE)) { 36 46 return aboutPage(page, request); 37 47 } else { … … 111 121 HashMap params = GSXML.extractParams(cgi_paramList); 112 122 113 String coll_name = (String)params.get("collection"); 114 if (coll_name == null || coll_name.equals("")) { 115 coll_name = (String)params.get("serviceCluster"); // cluster name 116 } 123 String coll_name = (String)params.get(GSCGI.COLLECTION_ARG); 117 124 if (coll_name == null || coll_name.equals("")) { 118 125 System.err.println("PageAction Error: about page requested with no collection or cluster specified!"); -
trunk/gsdl3/src/java/org/greenstone/gsdl3/action/QueryAction.java
r3603 r3645 59 59 HashMap params = GSXML.extractParams(cgi_param_list); 60 60 61 String collection = (String)params.get( "collection");61 String collection = (String)params.get(GSCGI.COLLECTION_ARG); 62 62 if (collection == null || collection.equals("")) { 63 63 System.err.println("QueryAction Error: no collection was specified!"); … … 77 77 78 78 Element mr_info_response = (Element) mr_.process(mr_info_message); 79 System.out.println("describe response from query=");80 System.out.println(converter_.getString(mr_info_response));81 79 String path = GSXML.RESPONSE_ELEM; 82 80 path = GSPath.appendLink(path, GSXML.SERVICE_ELEM); … … 87 85 System.out.println("adding shortnames"); 88 86 // add short names to the params in the param list 89 cgi_. addShortNames(pl);87 cgi_.paramListAddShortNames(pl); 90 88 // for each param in the description, overwrite teh default value with the currently set value if present 91 89 Element param = (Element)pl.getFirstChild(); … … 116 114 } 117 115 } 118 System.out.println(converter_.getString(pl));119 116 120 117 // part of the data for the description is the cgi-params … … 148 145 // for now, just create a whole new request 149 146 150 // check that there are some resources - for now check the list, but later should use a numdocs metadata elem147 // check that there are some documents - for now check the list, but later should use a numdocs metadata elem 151 148 path = GSXML.RESPONSE_ELEM; 152 149 path = GSPath.appendLink(path, GSXML.CONTENT_ELEM); 153 path = GSPath.appendLink(path, GSXML. RESOURCE_ELEM+GSXML.LIST_MODIFIER);154 155 Element resource_list = (Element)GSXML.getNodeByPath(mr_query_response,156 path); // resourceList not present if no docs found157 if ( resource_list == null) {150 path = GSPath.appendLink(path, GSXML.DOCUMENT_ELEM+GSXML.LIST_MODIFIER); 151 152 Element document_list = (Element)GSXML.getNodeByPath(mr_query_response, 153 path); // documentList not present if no docs found 154 if (document_list == null) { 158 155 159 156 Element result_response = (Element)GSXML.getChildByTagName(mr_query_response, GSXML.RESPONSE_ELEM); … … 182 179 183 180 // the first part of the content is the doc list 184 meta_content.appendChild(doc_.importNode( resource_list, true));181 meta_content.appendChild(doc_.importNode(document_list, true)); 185 182 186 183 // the second part of the content is the metadata list
Note:
See TracChangeset
for help on using the changeset viewer.