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.dto;
006:
007: /**
008: * Data Transfer Object for communication GeoServer Web Coverage Server information.
009: *
010: * <p>
011: * Information required for GeoServer to set up a Web Coverage Service.
012: * </p>
013: *
014: * <p>
015: * Data Transfer object are used to communicate between the GeoServer
016: * application and its configuration and persistent layers. As such the class
017: * is final - to allow for its future use as an on-the-wire message.
018: * </p>
019: *
020: * @author $Author: Alessio Fabiani (alessio.fabiani@gmail.com) $ (last modification)
021: * @author $Author: Simone Giannecchini (simboss1@gmail.com) $ (last modification)
022: * @version $Id: WCSDTO.java 6326 2007-03-15 18:36:40Z jdeolive $
023: */
024: public class WCSDTO implements DataTransferObject {
025: /**
026: * For the writer!
027: *
028: * @uml.property name="gmlPrefixing" multiplicity="(0 1)"
029: */
030: private boolean gmlPrefixing;
031:
032: /**
033: * The service parameters for this instance.
034: *
035: * @uml.property name="service"
036: * @uml.associationEnd multiplicity="(0 1)"
037: */
038: private ServiceDTO service;
039:
040: /**
041: * WCS constructor. does nothing
042: */
043: public WCSDTO() {
044: }
045:
046: /**
047: * WCS constructor.
048: *
049: * <p>
050: * Creates a copy of the WCS provided. If the WCS provided is null then
051: * default values are used. All the data structures are cloned.
052: * </p>
053: *
054: * @param other The WCS to copy.
055: *
056: * @throws NullPointerException DOCUMENT ME!
057: */
058: public WCSDTO(WCSDTO other) {
059: if (other == null) {
060: throw new NullPointerException(
061: "Data Transfer Object required");
062: }
063:
064: service = (ServiceDTO) other.getService().clone();
065: gmlPrefixing = other.isGmlPrefixing();
066: }
067:
068: /**
069: * Implement clone as a DeepCopy.
070: *
071: * @return A Deep Copy of this WCSDTO
072: *
073: * @see java.lang.Object#clone()
074: */
075: public Object clone() {
076: return new WCSDTO(this );
077: }
078:
079: /**
080: * Implement equals.
081: *
082: * <p>
083: * recursively tests to determine if the object passed in is a copy of this
084: * object.
085: * </p>
086: *
087: * @param other The WCS object to test.
088: *
089: * @return true when the object passed is the same as this object.
090: *
091: * @see java.lang.Object#equals(java.lang.Object)
092: */
093: public boolean equals(Object other) {
094: if ((other == null) || !(other instanceof WCSDTO)) {
095: return false;
096: }
097:
098: WCSDTO dto = (WCSDTO) other;
099:
100: return ((gmlPrefixing == dto.gmlPrefixing) && (service == null)) ? (dto
101: .getService() == null)
102: : service.equals(dto.getService());
103: }
104:
105: /**
106: * Implement hashCode.
107: *
108: * @return Service hashcode or 0
109: *
110: * @see java.lang.Object#hashCode()
111: */
112: public int hashCode() {
113: return (gmlPrefixing ? 1 : 0)
114: | ((service == null) ? 0 : service.hashCode());
115: }
116:
117: /**
118: * getService purpose.
119: *
120: * <p>
121: * Description ...
122: * </p>
123: *
124: * @return
125: *
126: * @uml.property name="service"
127: */
128: public ServiceDTO getService() {
129: return service;
130: }
131:
132: /**
133: * setService purpose.
134: *
135: * <p>
136: * Description ...
137: * </p>
138: *
139: * @param service
140: *
141: * @throws NullPointerException DOCUMENT ME!
142: *
143: * @uml.property name="service"
144: */
145: public void setService(ServiceDTO service) {
146: if (service == null) {
147: throw new NullPointerException("ServiceDTO required");
148: }
149:
150: this .service = service;
151: }
152:
153: /**
154: * isGmlPrefixing purpose.
155: *
156: * <p>
157: * Description ...
158: * </p>
159: *
160: * @return
161: */
162: public boolean isGmlPrefixing() {
163: return gmlPrefixing;
164: }
165:
166: /**
167: * setGmlPrefixing purpose.
168: *
169: * <p>
170: * Description ...
171: * </p>
172: *
173: * @param b
174: *
175: * @uml.property name="gmlPrefixing"
176: */
177: public void setGmlPrefixing(boolean b) {
178: gmlPrefixing = b;
179: }
180: }
|