Changeset 18152


Ignore:
Timestamp:
2008-12-08T17:13:33+13:00 (15 years ago)
Author:
cc108
Message:

remove Jave 1.5 method

File:
1 edited

Legend:

Unmodified
Added
Removed
  • other-projects/trunk/greenstone3-extension/mat/src/org/greenstone/gsdl3_extension/mat/servlet/MatServlet.java

    r18107 r18152  
    256256        for (int i=0; i < identifyChildList.getLength(); i++) {
    257257            if (identifyChildList.item(i).getNodeName() == "repositoryName" ) {
    258             out.println("<tr><td><strong>Repository Name:</strong></td><td> " + identifyChildList.item(i).getTextContent() + "</td></tr>");
     258            out.println("<tr><td><strong>Repository Name:</strong></td><td> " + identifyChildList.item(i).getNodeValue() + "</td></tr>");
    259259            }
    260260            if (identifyChildList.item(i).getNodeName() == "baseURL" ) {
    261                 String baseURL = identifyChildList.item(i).getTextContent();
     261               
     262                Node n = identifyChildList.item(i);
     263                String baseURL = getTextContent(n);
     264
     265
    262266               
    263267            if(baseURL.startsWith("http://")){
     268
    264269                out.println("<tr><td><strong>Base URL:</strong></td><td><code><a href=\"" + baseURL + "\">" + baseURL + "</a></code></td></tr>");
    265270                }
    266271                else{
     272
    267273                out.println("<tr><td><strong>Base URL:</strong></td><td><code><a href=\"" + oaiURLString + "\">" + oaiURLString + "</a></code></td></tr>");
    268274            }
     
    316322            out.println("<tr><td>");
    317323            String id = "radioID" + i;
    318             String prefix = prefixList.item(i).getTextContent();
     324           
     325            Node n = prefixList.item(i);
     326            String prefix = getTextContent(n);
     327           
     328            //String prefix = prefixList.item(i).getNodeValue();
    319329           
    320330            if (prefix.equals("oai_dc")) {
     
    410420    } // end doPost
    411421   
     422   
     423    private static String getTextContent(Node node) {
     424        Node child;
     425        String sContent = node.getNodeValue() != null ? node.getNodeValue() : "";
     426
     427        NodeList nodes = node.getChildNodes();
     428        for(int i = 0; i < nodes.getLength(); i++) {
     429            child = nodes.item(i);
     430            sContent += child.getNodeValue() != null ? child.getNodeValue() : "";
     431            if(nodes.item(i).getChildNodes().getLength() > 0) {
     432                sContent += getTextContent(nodes.item(i));
     433            }
     434        }
     435
     436        return sContent;
     437   
     438    }
    412439    protected void buildCollection( PrintWriter out, String matShell2, String collName, String oaiURLString, String oaiPrefix)  throws ServletException, IOException{
    413440   
     
    429456   
    430457    String os = "linux";
    431     if(System.getProperty("os.name").toLowerCase().contains("windows")){
    432         gsdl3Home = gsdl3Home.replace("\\", "/");
     458    if(System.getProperty("os.name").toLowerCase().indexOf("windows")!=-1){
     459        gsdl3Home = gsdl3Home.replaceAll("\\", "/");
    433460        os = "windows";
    434461    }
     
    436463   
    437464    if(os.equals("windows")){
    438         gsdl3Root = gsdl3Root.replace("/","\\");
    439         gsdl3Home = gsdl3Home.replace("/", "\\");
     465        gsdl3Root = gsdl3Root.replaceAll("/","\\");
     466        gsdl3Home = gsdl3Home.replaceAll("/", "\\");
    440467    }
    441468
     
    447474    String cacheDir = gsdl3Root +fileSeparator+"ext"+fileSeparator+"mat"+fileSeparator+"tmp"+fileSeparator + collName;
    448475       
    449     if(System.getProperty("os.name").toLowerCase().contains("windows")){
     476    if(System.getProperty("os.name").toLowerCase().indexOf("windows")!=-1){
    450477        File wd = new File(gsdl3Root + fileSeparator + "ext" + fileSeparator + "mat" + fileSeparator + "bin" + fileSeparator +"script");
    451478
     
    501528
    502529    String os = "linux";
    503     if(System.getProperty("os.name").toLowerCase().contains("windows")){
    504         gsdl3Home = gsdl3Home.replace("\\", "/");
     530    if(System.getProperty("os.name").toLowerCase().indexOf("windows")!=-1){
     531        gsdl3Home = gsdl3Home.replaceAll("\\", "/");
    505532        os = "windows";
    506533    }
     
    508535   
    509536    if(os.equals("windows")){
    510         gsdl3Root = gsdl3Root.replace("/","\\");
    511         gsdl3Home = gsdl3Home.replace("/", "\\");
     537        gsdl3Root = gsdl3Root.replaceAll("/","\\");
     538        gsdl3Home = gsdl3Home.replaceAll("/", "\\");
    512539    }
    513540    String maxRecords = Records;
     
    524551    String matShell  = "";
    525552   
    526     if(System.getProperty("os.name").toLowerCase().contains("windows")){
     553    if(System.getProperty("os.name").toLowerCase().indexOf("windows")!=-1){
    527554       
    528555        File wd = new File(gsdl3Root + fileSeparator + "ext" + fileSeparator + "mat" + fileSeparator + "bin" + fileSeparator +"script");
     
    653680            while ((s = stdInput.readLine()) != null) {
    654681                stdInputBuffer.append(s+"\n");
    655                 if(s.contains("-->")){
    656                 s = s.replace("-->", "");
     682                if(s.indexOf("-->")!=-1){
     683                s = s.replaceAll("-->", "");
    657684                out.println("<!-- " + s + " -->");
    658685                }
     
    668695        stdErrorBuffer.append(s+"\n");
    669696       
    670         if(s.contains("-->")){
    671         s = s.replace("-->", "");
     697        if(s.indexOf("-->")!=-1){
     698        s = s.replaceAll("-->", "");
    672699        out.println("<!-- " + s + " -->");
    673700        }
     
    724751        while ((s = stdInput.readLine()) != null) {
    725752            stdInputBuffer.append(s+"\n");
    726             if(s.contains("-->")){
    727             s = s.replace("-->", "");
     753            if(s.indexOf("-->")!=-1){
     754            s = s.replaceAll("-->", "");
    728755            out.println("<!-- " + s + " -->");
    729756            }
     
    739766            stdErrorBuffer.append(s+"\n");
    740767           
    741             if(s.contains("-->")){
    742             s = s.replace("-->", "");
     768            if(s.indexOf("-->")!=-1){
     769            s = s.replaceAll("-->", "");
    743770            out.println("<!-- " + s + " -->");
    744771            }
     
    825852   
    826853    String os = "linux";
    827     if(System.getProperty("os.name").toLowerCase().contains("windows")){
    828         gsdl3Home = gsdl3Home.replace("\\", "/");
     854    if(System.getProperty("os.name").toLowerCase().indexOf("windows")!=-1){
     855        gsdl3Home = gsdl3Home.replaceAll("\\", "/");
    829856        os = "windows";
    830857    }
     
    832859   
    833860    if(os.equals("windows")){
    834         gsdl3Root = gsdl3Root.replace("/","\\");
    835         gsdl3Home = gsdl3Home.replace("/", "\\");
     861        gsdl3Root = gsdl3Root.replaceAll("/","\\");
     862        gsdl3Home = gsdl3Home.replaceAll("/", "\\");
    836863    }
    837864       
Note: See TracChangeset for help on using the changeset viewer.