Changeset 3443 for trunk


Ignore:
Timestamp:
2002-10-04T13:21:34+12:00 (22 years ago)
Author:
kjdon
Message:

library names are now done dynamically, not specified in the applet info at the service end. the info is added by the applet action if needed

Location:
trunk/gsdl3/src/java/org/greenstone/gsdl3
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/gsdl3/src/java/org/greenstone/gsdl3/action/AppletAction.java

    r3441 r3443  
    55// XML classes
    66import org.w3c.dom.Node;
     7import org.w3c.dom.NodeList;
    78import org.w3c.dom.Document;
    89import org.w3c.dom.Element;
     
    7879       
    7980        page.appendChild(doc_.importNode(request, true));
     81
    8082        // add in the applet info
    81        
    82         //page.appendChild(doc_.importNode(GSXML.getNodeByPath(mr_response, "response/service/applet"), true));
    83         page.appendChild(doc_.importNode(GSXML.getNodeByPath(mr_response, "response/service/applet"), true));
     83        Element app_desc = (Element)doc_.importNode(GSXML.getNodeByPath(mr_response, "response/service/applet"), true);
     84        // must look through the applet description and see if there is a param called library. if so, add the value to be the current library name
     85
     86        addLibraryName(app_desc, config_.library_name_);
     87        page.appendChild(app_desc);
    8488        return transformer_.transform(stylesheet, page);
    8589    }
     
    111115    }
    112116    }
     117
     118    /** this method looks through the PARAMs of the applet description for
     119     * one with the name 'library'. If its found, it sets the value to be
     120     * library_name
     121     */
     122    protected void addLibraryName(Element description, String library_name) {
     123
     124    Node child = description.getFirstChild();
     125    while (child != null) {
     126        if (child.getNodeType() == Node.ELEMENT_NODE) {
     127        String param = child.getNodeName();
     128        if (param.equals("PARAM")||param.equals("param")) {
     129            String name = ((Element)child).getAttribute("NAME");
     130            if (name == null || name.equals("")) {
     131            // somethings wrong!!
     132            } else if (name.equals("library")) {
     133            ((Element)child).setAttribute("VALUE", library_name);
     134            break;
     135            }
     136           
     137        }
     138        }
     139        child = child.getNextSibling();
     140    }
     141    }
     142   
    113143}
  • trunk/gsdl3/src/java/org/greenstone/gsdl3/service/PhindService.java

    r3434 r3443  
    7272    // add in the applet info for the phind applet
    7373    // need to make this dynamic - library names etc
    74     String app_info = "<applet CODEBASE='/gsdl3/lib/java' CODE='org.greenstone.applet.phind.Phind.class' ARCHIVE='phind.jar, xercesImpl.jar, gsdl3.jar, jaxp.jar, xml-apis.jar' WIDTH='500' HEIGHT='400'><PARAM NAME='library' VALUE='/gsdl3/library'/> <PARAM NAME='phindcgi' VALUE='/gsdl3/library?a=a&amp;sa=r&amp;sn=Phind'/>";
     74    // change the applet params - have a single param with the library name
     75    // this is left blank at this end, and must be filled in by applet action - if the library name is not needed, this param is left out
     76    // phindcgi param now is not complete - library must be prepended to it.
     77    String app_info = "<applet CODEBASE='lib/java' CODE='org.greenstone.applet.phind.Phind.class' ARCHIVE='phind.jar, xercesImpl.jar, gsdl3.jar, jaxp.jar, xml-apis.jar' WIDTH='500' HEIGHT='400'><PARAM NAME='library' VALUE=''/> <PARAM NAME='phindcgi' VALUE='?a=a&amp;sa=r&amp;sn=Phind'/>";
    7578    app_info +="<PARAM NAME='collection'   VALUE='";
    7679    app_info += collection_name_;
    77     app_info += "'/> <PARAM NAME='classifier' VALUE='1'/>  <PARAM NAME='orientation'  VALUE='vertical'/> <PARAM NAME='depth' VALUE='2'/> <PARAM NAME='resultorder' VALUE='L,l,E,e,D,d'/> <PARAM NAME='backdrop' VALUE='/gsdl3/interfaces/default/images/phindbg1.jpg'/><PARAM NAME='fontsize' VALUE='10'/> <PARAM NAME='blocksize'    VALUE='10'/>The Phind java applet.</applet>";
     80    app_info += "'/> <PARAM NAME='classifier' VALUE='1'/>  <PARAM NAME='orientation'  VALUE='vertical'/> <PARAM NAME='depth' VALUE='2'/> <PARAM NAME='resultorder' VALUE='L,l,E,e,D,d'/> <PARAM NAME='backdrop' VALUE='interfaces/default/images/phindbg1.jpg'/><PARAM NAME='fontsize' VALUE='10'/> <PARAM NAME='blocksize'    VALUE='10'/>The Phind java applet.</applet>";
    7881   
    7982    Document dom = converter_.getDOM(app_info);
     
    112115    String phind_index = (String)params.get("pc");
    113116    // the location of the mgpp database files
    114     basepath_ = GSFile.phindBasePath(site_home_, collection_name_, phind_index);
     117    basepath_ = GSFile.phindBaseDir(site_home_, collection_name_, phind_index);
    115118
    116119    // the result element
Note: See TracChangeset for help on using the changeset viewer.