001: //=============================================================================
002: //=== Copyright (C) 2001-2007 Food and Agriculture Organization of the
003: //=== United Nations (FAO-UN), United Nations World Food Programme (WFP)
004: //=== and United Nations Environment Programme (UNEP)
005: //===
006: //=== This program is free software; you can redistribute it and/or modify
007: //=== it under the terms of the GNU General Public License as published by
008: //=== the Free Software Foundation; either version 2 of the License, or (at
009: //=== your option) any later version.
010: //===
011: //=== This program is distributed in the hope that it will be useful, but
012: //=== WITHOUT ANY WARRANTY; without even the implied warranty of
013: //=== MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
014: //=== General Public License for more details.
015: //===
016: //=== You should have received a copy of the GNU General Public License
017: //=== along with this program; if not, write to the Free Software
018: //=== Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
019: //===
020: //=== Contact: Jeroen Ticheler - FAO - Viale delle Terme di Caracalla 2,
021: //=== Rome - Italy. email: geonetwork@osgeo.org
022: //==============================================================================
023:
024: package org.wfp.vam.intermap.kernel.map.mapServices.wms.schema.impl;
025:
026: import org.jdom.Element;
027: import org.wfp.vam.intermap.kernel.map.mapServices.wms.schema.type.WMSOnlineResource;
028: import org.wfp.vam.intermap.kernel.map.mapServices.wms.schema.type.WMSService;
029:
030: /**
031: * @author ETj
032: */
033: public class WMSServiceImpl implements WMSService {
034: public final static String NAME_WMS = "OGC:WMS";
035:
036: private String _name = "WMS";
037: private String _title = null; // 1..1
038: private String _abstract;
039: private WMSOnlineResource _onlineResource = null;
040:
041: // TODO keywordlist, contactInformation, fees, accessconstraints, Layerlimit, maxwidth, maxheight
042:
043: private WMSServiceImpl() {
044: }
045:
046: static public WMSService newInstance() {
047: return new WMSServiceImpl();
048: }
049:
050: public static WMSService parse(Element eService) {
051: WMSServiceImpl service = new WMSServiceImpl();
052:
053: service.setName(eService.getChildText("Name"));
054: service.setTitle(eService.getChildText("Title"));
055: service.setAbstract(eService.getChildText("Abstract"));
056: service.setOnlineResource(eService.getChild("OnlineResource"));
057:
058: return service;
059: }
060:
061: public void setName(String name) {
062: if (!NAME_WMS.equals(name))
063: System.out.println("*** Expected value '" + NAME_WMS
064: + "' for element 'Name'. Found '" + name + "'");
065: // throw new IllegalArgumentException("Name element must be '"+NAME_WMS+"'");
066:
067: _name = name;
068: }
069:
070: /**
071: * Returns Name
072: */
073: public String getName() {
074: return _name;
075: }
076:
077: /**
078: * Sets Title
079: */
080: public void setTitle(String title) {
081: _title = title;
082: }
083:
084: /**
085: * Returns Title
086: */
087: public String getTitle() {
088: return _title;
089: }
090:
091: /**
092: * Sets Abstract
093: */
094: public void setAbstract(String abs) {
095: _abstract = abs;
096: }
097:
098: /**
099: * Returns Abstract
100: */
101: public String getAbstract() {
102: return _abstract;
103: }
104:
105: private void setOnlineResource(Element onlineResource) {
106: WMSOnlineResource wor = WMSFactory
107: .parseOnlineResource(onlineResource);
108: setOnlineResource(wor);
109: }
110:
111: /**
112: * Sets GetOnlineResource
113: */
114: public void setOnlineResource(WMSOnlineResource onlineResource) {
115: _onlineResource = onlineResource;
116: }
117:
118: /**
119: * Returns GetOnlineResource
120: */
121: public WMSOnlineResource getOnlineResource() {
122: return _onlineResource;
123: }
124:
125: }
|