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.citation;
021:
022: // OpenGIS dependencies
023: import java.net.URI;
024: import java.net.URISyntaxException;
025:
026: // OpenGIS dependencies
027: import org.opengis.metadata.citation.Contact;
028: import org.opengis.metadata.citation.OnLineFunction;
029: import org.opengis.metadata.citation.OnLineResource;
030: import org.opengis.metadata.citation.ResponsibleParty;
031: import org.opengis.metadata.citation.Role;
032: import org.opengis.util.InternationalString;
033:
034: // Geotools dependencies
035: import org.geotools.metadata.iso.MetadataEntity;
036: import org.geotools.util.logging.Logging;
037: import org.geotools.util.SimpleInternationalString;
038:
039: /**
040: * Identification of, and means of communication with, person(s) and
041: * organizations associated with the dataset.
042: *
043: * @since 2.1
044: * @source $URL: http://svn.geotools.org/geotools/tags/2.4.1/modules/library/metadata/src/main/java/org/geotools/metadata/iso/citation/ResponsiblePartyImpl.java $
045: * @version $Id: ResponsiblePartyImpl.java 27848 2007-11-12 13:10:32Z desruisseaux $
046: * @author Martin Desruisseaux
047: * @author Touraïvane
048: */
049: public class ResponsiblePartyImpl extends MetadataEntity implements
050: ResponsibleParty {
051: /**
052: * Serial number for interoperability with different versions.
053: */
054: private static final long serialVersionUID = -2477962229031486552L;
055:
056: /**
057: * The name of Open Geospatial Consortium as an international string.
058: *
059: * @todo Localize.
060: */
061: static final InternationalString OGC_NAME = new SimpleInternationalString(
062: "Open Geospatial Consortium");
063:
064: /**
065: * Creates a responsible party metadata entry for OGC involvement.
066: * The organisation name is automatically set to "Open Geospatial Consortium".
067: *
068: * @param role The OGC role (point of contact, owner, etc.) for a resource.
069: * @param resource The URI to the resource.
070: * @return Responsible party describing OGC involvement.
071: *
072: * @since 2.2
073: */
074: public static ResponsibleParty OGC(final Role role,
075: final OnLineResource resource) {
076: final ContactImpl contact = new ContactImpl(resource);
077: contact.freeze();
078:
079: final ResponsiblePartyImpl ogc = new ResponsiblePartyImpl(role);
080: ogc.setOrganisationName(OGC_NAME);
081: ogc.setContactInfo(contact);
082: ogc.freeze();
083:
084: return ogc;
085: }
086:
087: /**
088: * Creates a responsible party metadata entry for OGC involvement.
089: * The organisation name is automatically set to "Open Geospatial Consortium".
090: *
091: * @param role The OGC role (point of contact, owner, etc.) for a resource.
092: * @param function The OGC function (information, download, etc.) for a resource.
093: * @param onlineResource The URI to the resource.
094: * @return Responsible party describing OGC involvement.
095: */
096: public static ResponsibleParty OGC(final Role role,
097: final OnLineFunction function, final URI onlineResource) {
098: final OnLineResourceImpl resource = new OnLineResourceImpl(
099: onlineResource);
100: resource.setFunction(function);
101: resource.freeze();
102: return OGC(role, resource);
103: }
104:
105: /**
106: * Creates a responsible party metadata entry for OGC involvement.
107: * The organisation name is automatically set to "Open Geospatial Consortium".
108: *
109: * @param role The OGC role (point of contact, owner, etc.) for a resource.
110: * @param function The OGC function (information, download, etc.) for a resource.
111: * @param onlineResource The URI on the resource.
112: * @return Responsible party describing OGC involvement.
113: */
114: static ResponsibleParty OGC(final Role role,
115: final OnLineFunction function, final String onlineResource) {
116: try {
117: return OGC(role, function, new URI(onlineResource));
118: } catch (URISyntaxException badContact) {
119: Logging.unexpectedException("org.geotools.metadata.iso",
120: ResponsibleParty.class, "OGC", badContact);
121: return OGC;
122: }
123: }
124:
125: /**
126: * The <A HREF="http://www.opengeospatial.org">Open Geospatial consortium</A> responsible party.
127: * "Open Geospatial consortium" is the new name for "OpenGIS consortium".
128: *
129: * @see ContactImpl#OGC
130: */
131: public static ResponsibleParty OGC;
132: static {
133: final ResponsiblePartyImpl r = new ResponsiblePartyImpl(
134: Role.RESOURCE_PROVIDER);
135: r.setOrganisationName(OGC_NAME);
136: r.setContactInfo(ContactImpl.OGC);
137: r.freeze();
138: OGC = r;
139: }
140:
141: /**
142: * The <A HREF="http://www.opengis.org">OpenGIS consortium</A> responsible party.
143: * "OpenGIS consortium" is the old name for "Open Geospatial consortium".
144: *
145: * @see ContactImpl#OPEN_GIS
146: */
147: public static ResponsibleParty OPEN_GIS;
148: static {
149: final ResponsiblePartyImpl r = new ResponsiblePartyImpl(
150: Role.RESOURCE_PROVIDER);
151: r.setOrganisationName(new SimpleInternationalString(
152: "OpenGIS consortium"));
153: r.setContactInfo(ContactImpl.OPEN_GIS);
154: r.freeze();
155: OPEN_GIS = r;
156: }
157:
158: /**
159: * The <A HREF="http://www.epsg.org">European Petroleum Survey Group</A> responsible party.
160: *
161: * @see ContactImpl#EPSG
162: */
163: public static ResponsibleParty EPSG;
164: static {
165: final ResponsiblePartyImpl r = new ResponsiblePartyImpl(
166: Role.PRINCIPAL_INVESTIGATOR);
167: r.setOrganisationName(new SimpleInternationalString(
168: "European Petroleum Survey Group"));
169: r.setContactInfo(ContactImpl.EPSG);
170: r.freeze();
171: EPSG = r;
172: }
173:
174: /**
175: * The <A HREF="http://www.remotesensing.org/geotiff/geotiff.html">GeoTIFF</A> responsible
176: * party.
177: *
178: * @see ContactImpl#GEOTIFF
179: */
180: public static ResponsibleParty GEOTIFF;
181: static {
182: final ResponsiblePartyImpl r = new ResponsiblePartyImpl(
183: Role.PRINCIPAL_INVESTIGATOR);
184: r.setOrganisationName(new SimpleInternationalString("GeoTIFF"));
185: r.setContactInfo(ContactImpl.GEOTIFF);
186: r.freeze();
187: GEOTIFF = r;
188: }
189:
190: /**
191: * The <A HREF="http://www.esri.com">ESRI</A> responsible party.
192: *
193: * @see ContactImpl#ESRI
194: */
195: public static ResponsibleParty ESRI;
196: static {
197: final ResponsiblePartyImpl r = new ResponsiblePartyImpl(
198: Role.OWNER);
199: r.setOrganisationName(new SimpleInternationalString("ESRI"));
200: r.setContactInfo(ContactImpl.ESRI);
201: r.freeze();
202: ESRI = r;
203: }
204:
205: /**
206: * The <A HREF="http://www.oracle.com">Oracle</A> responsible party.
207: *
208: * @see ContactImpl#ORACLE
209: */
210: public static ResponsibleParty ORACLE;
211: static {
212: final ResponsiblePartyImpl r = new ResponsiblePartyImpl(
213: Role.OWNER);
214: r.setOrganisationName(new SimpleInternationalString("Oracle"));
215: r.setContactInfo(ContactImpl.ORACLE);
216: r.freeze();
217: ORACLE = r;
218: }
219:
220: /**
221: * The <A HREF="http://postgis.refractions.net">PostGIS</A> responsible party.
222: *
223: * @see ContactImpl#POSTGIS
224: *
225: * @since 2.4
226: */
227: public static ResponsibleParty POSTGIS;
228: static {
229: final ResponsiblePartyImpl r = new ResponsiblePartyImpl(
230: Role.PRINCIPAL_INVESTIGATOR);
231: r.setOrganisationName(new SimpleInternationalString("PostGIS"));
232: r.setContactInfo(ContactImpl.POSTGIS);
233: r.freeze();
234: POSTGIS = r;
235: }
236:
237: /**
238: * The <A HREF="http://www.sun.com/">Sun Microsystems</A> party.
239: *
240: * @see ContactImpl#SUN_MICROSYSTEMS
241: *
242: * @since 2.2
243: */
244: public static ResponsibleParty SUN_MICROSYSTEMS;
245: static {
246: final ResponsiblePartyImpl r = new ResponsiblePartyImpl(
247: Role.PRINCIPAL_INVESTIGATOR);
248: r.setOrganisationName(new SimpleInternationalString(
249: "Sun Microsystems"));
250: r.setContactInfo(ContactImpl.SUN_MICROSYSTEMS);
251: r.freeze();
252: SUN_MICROSYSTEMS = r;
253: }
254:
255: /**
256: * The <A HREF="http://www.geotools.org">Geotools</A> project.
257: *
258: * @see ContactImpl#GEOTOOLS
259: */
260: public static ResponsibleParty GEOTOOLS;
261: static {
262: final ResponsiblePartyImpl r = new ResponsiblePartyImpl(
263: Role.PRINCIPAL_INVESTIGATOR);
264: r
265: .setOrganisationName(new SimpleInternationalString(
266: "Geotools"));
267: r.setContactInfo(ContactImpl.GEOTOOLS);
268: r.freeze();
269: GEOTOOLS = r;
270: }
271:
272: /**
273: * Name of the responsible person- surname, given name, title separated by a delimiter.
274: */
275: private String individualName;
276:
277: /**
278: * Name of the responsible organization.
279: */
280: private InternationalString organisationName;
281:
282: /**
283: * Role or position of the responsible person
284: */
285: private InternationalString positionName;
286:
287: /**
288: * Address of the responsible party.
289: */
290: private Contact contactInfo;
291:
292: /**
293: * Function performed by the responsible party.
294: */
295: private Role role;
296:
297: /**
298: * Constructs an initially empty responsible party.
299: */
300: public ResponsiblePartyImpl() {
301: }
302:
303: /**
304: * Constructs a new responsible party initialized to the values specified by the given object.
305: * This constructor performs a shallow copy (i.e. each source attributes are reused without
306: * copying them).
307: *
308: * @since 2.2
309: */
310: public ResponsiblePartyImpl(final ResponsibleParty source) {
311: super (source);
312: }
313:
314: /**
315: * Constructs a responsability party with the given role.
316: */
317: public ResponsiblePartyImpl(final Role role) {
318: setRole(role);
319: }
320:
321: /**
322: * Returns the name of the responsible person- surname, given name, title separated by a delimiter.
323: * Only one of {@code individualName}, {@link #getOrganisationName organisationName}
324: * and {@link #getPositionName positionName} should be provided.
325: */
326: public String getIndividualName() {
327: return individualName;
328: }
329:
330: /**
331: * Set the name of the responsible person- surname, given name, title separated by a delimiter.
332: * Only one of {@code individualName}, {@link #getOrganisationName organisationName}
333: * and {@link #getPositionName positionName} should be provided.
334: */
335: public synchronized void setIndividualName(final String newValue) {
336: checkWritePermission();
337: individualName = newValue;
338: }
339:
340: /**
341: * Returns the name of the responsible organization.
342: * Only one of {@link #getIndividualName individualName}, </code>organisationName</code>
343: * and {@link #getPositionName positionName} should be provided.
344: */
345: public InternationalString getOrganisationName() {
346: return organisationName;
347: }
348:
349: /**
350: * Set the name of the responsible organization.
351: * Only one of {@link #getIndividualName individualName}, </code>organisationName</code>
352: * and {@link #getPositionName positionName} should be provided.
353: */
354: public synchronized void setOrganisationName(
355: final InternationalString newValue) {
356: checkWritePermission();
357: organisationName = newValue;
358: }
359:
360: /**
361: * Returns the role or position of the responsible person
362: * Only one of {@link #getIndividualName individualName},
363: * {@link #getOrganisationName organisationName} and {@code positionName}
364: * should be provided.
365: */
366: public InternationalString getPositionName() {
367: return positionName;
368: }
369:
370: /**
371: * set the role or position of the responsible person
372: * Only one of {@link #getIndividualName individualName},
373: * {@link #getOrganisationName organisationName} and {@code positionName}
374: * should be provided.
375: */
376: public synchronized void setPositionName(
377: final InternationalString newValue) {
378: checkWritePermission();
379: positionName = newValue;
380: }
381:
382: /**
383: * Returns the address of the responsible party.
384: */
385: public Contact getContactInfo() {
386: return contactInfo;
387: }
388:
389: /**
390: * Set the address of the responsible party.
391: */
392: public synchronized void setContactInfo(final Contact newValue) {
393: checkWritePermission();
394: contactInfo = newValue;
395: }
396:
397: /**
398: * Returns the function performed by the responsible party.
399: */
400: public Role getRole() {
401: return role;
402: }
403:
404: /**
405: * Set the function performed by the responsible party.
406: */
407: public synchronized void setRole(final Role newValue) {
408: checkWritePermission();
409: role = newValue;
410: }
411: }
|