001: /* Copyright (c) 2001 - 2007 TOPP - www.openplans.org. All rights reserved.
002: * This code is licensed under the GPL 2.0 license, availible at the root
003: * application directory.
004: */
005: package org.vfny.geoserver.global;
006:
007: import org.vfny.geoserver.global.dto.ServiceDTO;
008: import org.vfny.geoserver.global.dto.WCSDTO;
009:
010: /**
011: * WCS
012: *
013: * <p>
014: * Represents the GeoServer information required to configure an instance of the
015: * WCS Server. This class holds the currently used configuration and is
016: * instantiated initially by the GeoServerPlugIn at start-up, but may be
017: * modified by the Configuration Interface during runtime. Such modifications
018: * come from the GeoServer Object in the SessionContext.
019: * </p>
020: *
021: * <p>
022: * WCS wcs = new WCS(dto); System.out.println(wcs.getName());
023: * System.out.println(wcs.getAbstract());
024: * </p>
025: *
026: * @author $Author: Alessio Fabiani (alessio.fabiani@gmail.com) $ (last
027: * modification)
028: * @author $Author: Simone Giannecchini (simboss1@gmail.com) $ (last
029: * modification)
030: * @version $Id: WCS.java 7731 2007-11-10 02:52:30Z groldan $
031: */
032: public final class WCS extends Service {
033: public static final String WEB_CONTAINER_KEY = "WCS";
034:
035: /** list of WMS Exception Formats */
036: private static final String[] EXCEPTION_FORMATS = {
037: "application/vnd.ogc.se_xml",
038: "application/vnd.ogc.se_inimage",
039: "application/vnd.ogc.se_blank" };
040:
041: /**
042: *
043: * @uml.property name="gmlPrefixing" multiplicity="(0 1)"
044: */
045: private boolean gmlPrefixing;
046:
047: /**
048: * WCS constructor.
049: *
050: * <p>
051: * Stores the data specified in the WCSDTO object in this WCS Object for
052: * GeoServer to use.
053: * </p>
054: *
055: * @param config
056: * The data intended for GeoServer to use.
057: */
058: public WCS(WCSDTO config) {
059: super (config.getService());
060: setId("wcs");
061: gmlPrefixing = config.isGmlPrefixing();
062: }
063:
064: /**
065: * Creates the WCS service by getting the WCSDTO object from the
066: * config and calling {@link #WCS(WCSDTO)}.
067: *
068: * @throws ConfigurationException
069: */
070: public WCS(Config config, Data data, GeoServer geoServer)
071: throws ConfigurationException {
072: this (config.getWcs());
073: setData(data);
074: setGeoServer(geoServer);
075: }
076:
077: /**
078: * WCS constructor.
079: *
080: * <p>
081: * Package constructor intended for default use by GeoServer
082: * </p>
083: *
084: * @see GeoServer#GeoServer()
085: */
086: WCS() {
087: super (new ServiceDTO());
088: setId("wcs");
089: }
090:
091: /**
092: * load purpose.
093: *
094: * <p>
095: * Loads a new data set into this object.
096: * </p>
097: *
098: * @param config
099: */
100: public void load(WCSDTO config) {
101: super .load(config.getService());
102: gmlPrefixing = config.isGmlPrefixing();
103: }
104:
105: /**
106: * Implement toDTO.
107: *
108: * <p>
109: * Package method used by GeoServer. This method may return references, and
110: * does not clone, so extreme caution sould be used when traversing the
111: * results.
112: * </p>
113: *
114: * @return WCSDTO An instance of the data this class represents. Please see
115: * Caution Above.
116: *
117: * @see org.vfny.geoserver.global.GlobalLayerSupertype#toDTO()
118: * @see WCSDTO
119: */
120: public Object toDTO() {
121: WCSDTO dto = new WCSDTO();
122: dto.setService((ServiceDTO) super .toDTO());
123: dto.setGmlPrefixing(gmlPrefixing);
124:
125: return dto;
126: }
127:
128: /**
129: * isGmlPrefixing purpose.
130: *
131: * <p>
132: * Description ...
133: * </p>
134: *
135: * @return
136: */
137: public boolean isGmlPrefixing() {
138: return gmlPrefixing;
139: }
140:
141: /**
142: * setGmlPrefixing purpose.
143: *
144: * <p>
145: * Description ...
146: * </p>
147: *
148: * @param b
149: *
150: * @uml.property name="gmlPrefixing"
151: */
152: public void setGmlPrefixing(boolean b) {
153: gmlPrefixing = b;
154: }
155:
156: /**
157: * getExceptionFormats purpose.
158: *
159: * <p>
160: * Returns a static list of Exception Formats in as Strings
161: * </p>
162: *
163: * @return String[] a static list of Exception Formats
164: */
165: public String[] getExceptionFormats() {
166: return EXCEPTION_FORMATS;
167: }
168: }
|