Statistics
| Revision:

svn-gvsig-desktop / branches / v10 / extensions / extPublishMapserver / src / org / gvsig / publish / mapserver / model / wcs / MapserverWCS.java @ 16281

History | View | Annotate | Download (2.1 KB)

1
package org.gvsig.publish.mapserver.model.wcs;
2

    
3
import org.gvsig.publish.mapserver.conf.MapFile.ConfigFile;
4
import org.gvsig.publish.mapserver.model.Mapserver;
5
import org.gvsig.publish.ogcmetadata.CommonOGCMetadata;
6
import org.gvsig.publish.serversmodel.PublishException;
7
import org.gvsig.publish.serversmodel.Service;
8

    
9
import com.iver.utiles.XMLEntity;
10

    
11
public class MapserverWCS extends Service {
12
        public static String MAPSERVER_WCS="WCS 1.0.0";
13
        /*
14
         * Properties
15
         */
16
        private CommonOGCMetadata ogcMetadata= null;
17
        /**
18
         * Constructor
19
         * @param server
20
         */
21
        public MapserverWCS(Mapserver server) {
22
                super(server);
23
                ogcMetadata = new CommonOGCMetadata();
24
                //the service always is OGC:WCS
25
                ogcMetadata.setName("OGC:WCS");        
26
                //initializes de title with the server name and the service type
27
                ogcMetadata.setTitle(getServer().getType() + " " +  getType());
28
        }
29

    
30
        /**
31
         * @return label which represents the service implemented 
32
         */
33
        public String getType() {                
34
                return MapserverWCS.MAPSERVER_WCS;
35
        }
36

    
37
        
38
        public XMLEntity getXMLEntity() {
39
                XMLEntity xml=super.getXMLEntity();
40
                //put ogcmetadata
41
                ogcMetadata.addXMLEntity(xml);                
42
                return xml;
43
        }
44

    
45
        
46
        public void publish() throws PublishException {
47
                //publish all the remote resources
48
                super.publish();
49
                
50
                //gets the mapfile from the server
51
                ConfigFile mapfile = getMapServer().getConfigFile();
52

    
53
                //generates the code into the MAP->WEB->METADATA
54
                mapfile.web.metadata.wcs_label = getOgcMetadata().getTitle();
55
                mapfile.web.metadata.wcs_description = getOgcMetadata().getAbstract();
56
                //mapfile.web.metadata.wms_onlineresource
57
                mapfile.web.metadata.wcs_encoding ="utf8";                
58
                //TODO: Quit this!! only for jornadas
59
                mapfile.web.imagepath = "/var/tmp";
60
        }
61

    
62
        
63
        public void setXMLEntity(XMLEntity xml) {
64
                super.setXMLEntity(xml);
65
                //set ogcmetadata                
66
                ogcMetadata.setXMLEntity(xml);
67
        
68
        }
69
        private Mapserver getMapServer(){
70
                //Cast to Mapserver
71
                Mapserver mapserver = (Mapserver)getServer();
72
                return mapserver;
73
        }
74

    
75
        public CommonOGCMetadata getOgcMetadata() {
76
                return ogcMetadata;
77
        }
78

    
79
        public void setOgcMetadata(CommonOGCMetadata ogcMetadata) {
80
                this.ogcMetadata = ogcMetadata;
81
        }
82

    
83
}