001: /*
002: * GeoTools - OpenSource mapping toolkit
003: * http://geotools.org
004: * (C) 2004-2006, GeoTools Project Managment Committee (PMC)
005: * (C) 2004, Institut de Recherche pour le Développement
006: *
007: * This library is free software; you can redistribute it and/or
008: * modify it under the terms of the GNU Lesser General Public
009: * License as published by the Free Software Foundation;
010: * version 2.1 of the License.
011: *
012: * This library is distributed in the hope that it will be useful,
013: * but WITHOUT ANY WARRANTY; without even the implied warranty of
014: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
015: * Lesser General Public License for more details.
016: *
017: * This package contains documentation from OpenGIS specifications.
018: * OpenGIS consortium's work is fully acknowledged here.
019: */
020: package org.geotools.metadata.iso.distribution;
021:
022: // J2SE direct dependencies and extensions
023: import java.util.Collection;
024: import javax.units.Unit;
025:
026: // OpenGIS dependencies
027: import org.opengis.metadata.distribution.Medium;
028: import org.opengis.metadata.distribution.MediumFormat;
029: import org.opengis.metadata.distribution.MediumName;
030: import org.opengis.util.InternationalString;
031:
032: // Geotools dependencies
033: import org.geotools.metadata.iso.MetadataEntity;
034:
035: /**
036: * Information about the media on which the resource can be distributed.
037: *
038: * @source $URL: http://svn.geotools.org/geotools/tags/2.4.1/modules/library/metadata/src/main/java/org/geotools/metadata/iso/distribution/MediumImpl.java $
039: * @version $Id: MediumImpl.java 25193 2007-04-18 13:37:38Z desruisseaux $
040: * @author Martin Desruisseaux
041: * @author Touraïvane
042: *
043: * @since 2.1
044: */
045: public class MediumImpl extends MetadataEntity implements Medium {
046: /**
047: * Serial number for interoperability with different versions.
048: */
049: private static final long serialVersionUID = -2838122926367921673L;
050:
051: /**
052: * Name of the medium on which the resource can be received.
053: */
054: private MediumName name;
055:
056: /**
057: * Density at which the data is recorded.
058: * Returns {@code null} if unknown.
059: * If non-null, then the number should be greater than zero.
060: */
061: private Collection densities;
062:
063: /**
064: * Units of measure for the recording density.
065: */
066: private Unit densityUnits;
067:
068: /**
069: * Number of items in the media identified.
070: * Returns {@code null} if unknown.
071: */
072: private Integer volumes;
073:
074: /**
075: * Methods used to write to the medium.
076: */
077: private Collection/*<MediumFormat>*/mediumFormats;
078:
079: /**
080: * Description of other limitations or requirements for using the medium.
081: */
082: private InternationalString mediumNote;
083:
084: /**
085: * Constructs an initially empty medium.
086: */
087: public MediumImpl() {
088: }
089:
090: /**
091: * Constructs a metadata entity initialized with the values from the specified metadata.
092: *
093: * @since 2.4
094: */
095: public MediumImpl(final Medium source) {
096: super (source);
097: }
098:
099: /**
100: * Returns the name of the medium on which the resource can be received.
101: */
102: public MediumName getName() {
103: return name;
104: }
105:
106: /**
107: * Set the name of the medium on which the resource can be received.
108: */
109: public synchronized void setName(final MediumName newValue) {
110: checkWritePermission();
111: name = newValue;
112: }
113:
114: /**
115: * Returns the units of measure for the recording density.
116: */
117: public Unit getDensityUnits() {
118: return densityUnits;
119: }
120:
121: /**
122: * Set the units of measure for the recording density.
123: */
124: public synchronized void setDensityUnits(final Unit newValue) {
125: checkWritePermission();
126: densityUnits = newValue;
127: }
128:
129: /**
130: * Returns the number of items in the media identified.
131: * Returns {@code null} if unknown.
132: */
133: public Integer getVolumes() {
134: return volumes;
135: }
136:
137: /**
138: * Set the number of items in the media identified.
139: * Returns {@code null} if unknown.
140: */
141: public synchronized void setVolumes(final Integer newValue) {
142: checkWritePermission();
143: volumes = newValue;
144: }
145:
146: /**
147: * Returns the method used to write to the medium.
148: */
149: public synchronized Collection/*<MediumFormat>*/getMediumFormats() {
150: return mediumFormats = nonNullCollection(mediumFormats,
151: MediumFormat.class);
152: }
153:
154: /**
155: * Set the method used to write to the medium.
156: */
157: public synchronized void setMediumFormats(
158: final Collection/*<MediumFormat>*/newValues) {
159: mediumFormats = copyCollection(newValues, mediumFormats,
160: MediumFormat.class);
161: }
162:
163: /**
164: * Returns a description of other limitations or requirements for using the medium.
165: */
166: public InternationalString getMediumNote() {
167: return mediumNote;
168: }
169:
170: /**
171: * Set a description of other limitations or requirements for using the medium.
172: */
173: public synchronized void setMediumNote(
174: final InternationalString newValue) {
175: checkWritePermission();
176: mediumNote = newValue;
177: }
178:
179: /**
180: * Returns the density at which the data is recorded.
181: * The numbers should be greater than zero.
182: */
183: public synchronized Collection getDensities() {
184: return densities = nonNullCollection(densities, Number.class);
185: }
186:
187: /**
188: * Set density at which the data is recorded.
189: * The numbers should be greater than zero.
190: */
191: public synchronized void setDensities(final Collection newValues) {
192: densities = copyCollection(newValues, densities, Number.class);
193: }
194: }
|