Statistics
| Revision:

root / trunk / extensions / extWCS / src / es / uji / lsi / wcs / XmlWcsParsing / DCPType.java @ 1877

History | View | Annotate | Download (2.09 KB)

1
package es.uji.lsi.wcs.XmlWcsParsing;
2
/*
3
 * DCPType.java
4
 *
5
 * Created on 26 de diciembre de 2004, 19:36
6
 */
7

    
8
/**
9
 * This file implements the DCPType class. For the moment, HTTP is the only DCP 
10
 * defined and for now, a server may list either a GET or POST access point, or
11
 * both, for each operation.
12
 * @author  jaume
13
 */
14

    
15

    
16
public class DCPType {
17
    private AccessPoint httpGetOperationAccessPoint;
18
    private AccessPoint httpPostOperationAccessPoint;
19
    /** Creates a new instance of DCPType */
20
    public DCPType(XMLNode node) {
21
        for (int i=0; i<node.getNumSubNodes(); i++){
22
            
23
            // This is the only DCP defined until this version was released. You are welcomed
24
            // to upgrade this file for further future DCPs, just add more attributes to the 
25
            // class and more cases to this loop.
26
            if (node.getSubNode(i).getName().equals("HTTP")){
27
                XMLNode subNode = node.getSubNode(i);
28
                for (int j=0; j<subNode.getNumSubNodes(); j++){
29
                    if (WCSToolkit.isWCSTab(subNode.getSubNode(j), "Get")) 
30
                        httpGetOperationAccessPoint = new AccessPoint(subNode.getSubNode(j));
31
                    if (WCSToolkit.isWCSTab(subNode.getSubNode(j), "Post")) 
32
                        httpGetOperationAccessPoint = new AccessPoint(subNode.getSubNode(j));
33
                }
34
            }
35
        }
36
    }
37
    
38
    public String toString(){
39
        return "\nGet access point: "+httpGetOperationAccessPoint+
40
               "\nPost access point: "+httpPostOperationAccessPoint;
41
    }
42
}
43

    
44
class AccessPoint {
45
    private String xlink_href;
46
    private String xlink_type;
47
    
48
    public AccessPoint(XMLNode node){
49
        for (int i=0; i<node.getNumSubNodes(); i++){
50
            if (WCSToolkit.isWCSTab(node.getSubNode(i), "OnlineResource")){
51
                xlink_href = node.getSubNode(i).getAttribute("xlink:href");
52
                xlink_type = node.getSubNode(i).getAttribute("xlink:type");
53
            }   
54
        }        
55
    }
56
    
57
    public String toString(){
58
        return "(href="+xlink_href+", "+xlink_type+")";
59
    }
60
}