Author: desruisseaux
Date: Thu Mar 21 16:05:04 2013
New Revision: 1459377

URL: http://svn.apache.org/r1459377
Log:
Added metadata maintenance package.

Added:
    
sis/branches/JDK7/sis-metadata/src/main/java/org/apache/sis/metadata/iso/maintenance/package-info.java
   (with props)
Modified:
    
sis/branches/JDK7/sis-metadata/src/main/java/org/apache/sis/metadata/iso/maintenance/DefaultMaintenanceInformation.java
    
sis/branches/JDK7/sis-metadata/src/main/java/org/apache/sis/metadata/iso/maintenance/DefaultScopeDescription.java

Modified: 
sis/branches/JDK7/sis-metadata/src/main/java/org/apache/sis/metadata/iso/maintenance/DefaultMaintenanceInformation.java
URL: 
http://svn.apache.org/viewvc/sis/branches/JDK7/sis-metadata/src/main/java/org/apache/sis/metadata/iso/maintenance/DefaultMaintenanceInformation.java?rev=1459377&r1=1459376&r2=1459377&view=diff
==============================================================================
--- 
sis/branches/JDK7/sis-metadata/src/main/java/org/apache/sis/metadata/iso/maintenance/DefaultMaintenanceInformation.java
 [UTF-8] (original)
+++ 
sis/branches/JDK7/sis-metadata/src/main/java/org/apache/sis/metadata/iso/maintenance/DefaultMaintenanceInformation.java
 [UTF-8] Thu Mar 21 16:05:04 2013
@@ -16,8 +16,11 @@
  */
 package org.apache.sis.metadata.iso.maintenance;
 
-import java.util.Collection;
 import java.util.Date;
+import java.util.Collection;
+import javax.xml.bind.annotation.XmlType;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlRootElement;
 import org.opengis.metadata.citation.ResponsibleParty;
 import org.opengis.metadata.maintenance.MaintenanceFrequency;
 import org.opengis.metadata.maintenance.MaintenanceInformation;
@@ -27,54 +30,245 @@ import org.opengis.temporal.PeriodDurati
 import org.opengis.util.InternationalString;
 import org.apache.sis.metadata.iso.ISOMetadata;
 
-public class DefaultMaintenanceInformation extends ISOMetadata implements 
MaintenanceInformation {
 
+/**
+ * Information about the scope and frequency of updating.
+ *
+ * @author  Martin Desruisseaux (IRD, Geomatys)
+ * @author  Touraïvane (IRD)
+ * @author  Cédric Briançon (Geomatys)
+ * @author  Guilhem Legal (Geomatys)
+ * @since   0.3 (derived from geotk-2.1)
+ * @version 0.3
+ * @module
+ */
+@XmlType(name = "MD_MaintenanceInformation_Type", propOrder = {
+    "maintenanceAndUpdateFrequency",
+    "dateOfNextUpdate",
+    "userDefinedMaintenanceFrequency",
+    "updateScopes",
+    "updateScopeDescriptions",
+    "maintenanceNotes",
+    "contacts"
+})
+@XmlRootElement(name = "MD_MaintenanceInformation")
+public class DefaultMaintenanceInformation extends ISOMetadata implements 
MaintenanceInformation {
+    /**
+     * Serial number for inter-operability with different versions.
+     */
+    private static final long serialVersionUID = 8523463344581266776L;
+
+    /**
+     * Frequency with which changes and additions are made to the resource 
after the
+     * initial resource is completed.
+     */
     private MaintenanceFrequency maintenanceAndUpdateFrequency;
 
-    private long dateOfNextUpdate = Long.MIN_VALUE;
-
+    /**
+     * Scheduled revision date for resource, in milliseconds elapsed
+     * since January 1st, 1970. If there is no such date, then this field
+     * is set to the special value {@link Long#MIN_VALUE}.
+     */
+    private long dateOfNextUpdate;
+
+    /**
+     * Maintenance period other than those defined, in milliseconds.
+     */
     private PeriodDuration userDefinedMaintenanceFrequency;
 
+    /**
+     * Scope of data to which maintenance is applied.
+     */
     private Collection<ScopeCode> updateScopes;
 
+    /**
+     * Additional information about the range or extent of the resource.
+     */
     private Collection<ScopeDescription> updateScopeDescriptions;
 
+    /**
+     * Information regarding specific requirements for maintaining the 
resource.
+     */
     private Collection<InternationalString> maintenanceNotes;
 
+    /**
+     * Identification of, and means of communicating with,
+     * person(s) and organization(s) with responsibility for maintaining the 
metadata
+     */
     private Collection<ResponsibleParty> contacts;
 
+    /**
+     * Creates a an initially empty maintenance information.
+     */
+    public DefaultMaintenanceInformation() {
+        dateOfNextUpdate = Long.MIN_VALUE;
+    }
+
+    /**
+     * Creates a maintenance information.
+     *
+     * @param maintenanceAndUpdateFrequency The frequency with which changes 
and additions are
+     *        made to the resource after the initial resource is completed, or 
{@code null} if none.
+     */
+    public DefaultMaintenanceInformation(final MaintenanceFrequency 
maintenanceAndUpdateFrequency) {
+        this(); // Initialize the date field.
+        this.maintenanceAndUpdateFrequency = maintenanceAndUpdateFrequency;
+    }
+
+    /**
+     * Returns a SIS metadata implementation with the same values than the 
given arbitrary
+     * implementation. If the given object is {@code null}, then this method 
returns {@code null}.
+     * Otherwise if the given object is already a SIS implementation, then the 
given object is
+     * returned unchanged. Otherwise a new SIS implementation is created and 
initialized to the
+     * property values of the given object, using a <cite>shallow</cite> copy 
operation
+     * (i.e. properties are not cloned).
+     *
+     * @param  object The object to get as a SIS implementation, or {@code 
null} if none.
+     * @return A SIS implementation containing the values of the given object 
(may be the
+     *         given object itself), or {@code null} if the argument was null.
+     */
+    public static DefaultMaintenanceInformation castOrCopy(final 
MaintenanceInformation object) {
+        if (object == null || object instanceof DefaultMaintenanceInformation) 
{
+            return (DefaultMaintenanceInformation) object;
+        }
+        final DefaultMaintenanceInformation copy = new 
DefaultMaintenanceInformation();
+        copy.shallowCopy(object);
+        return copy;
+    }
+
+    /**
+     * Returns the frequency with which changes and additions are made to the 
resource
+     * after the initial resource is completed.
+     */
     @Override
+    @XmlElement(name = "maintenanceAndUpdateFrequency", required = true)
     public synchronized MaintenanceFrequency 
getMaintenanceAndUpdateFrequency() {
         return maintenanceAndUpdateFrequency;
     }
 
+    /**
+     * Sets the frequency with which changes and additions are made to the 
resource
+     * after the initial resource is completed.
+     *
+     * @param newValue The new maintenance frequency.
+     */
+    public synchronized void setMaintenanceAndUpdateFrequency(final 
MaintenanceFrequency newValue) {
+        checkWritePermission();
+        maintenanceAndUpdateFrequency = newValue;
+    }
+
+    /**
+     * Returns the scheduled revision date for resource.
+     */
     @Override
+    @XmlElement(name = "dateOfNextUpdate")
     public synchronized Date getDateOfNextUpdate() {
-        return (dateOfNextUpdate != Long.MIN_VALUE) ? new 
Date(dateOfNextUpdate) : null;
+        final long date = dateOfNextUpdate;
+        return (date != Long.MIN_VALUE) ? new Date(date) : null;
+    }
+
+    /**
+     * Sets the scheduled revision date for resource.
+     *
+     * @param newValue The new date of next update.
+     */
+    public synchronized void setDateOfNextUpdate(final Date newValue) {
+        checkWritePermission();
+        dateOfNextUpdate = (newValue!=null) ? newValue.getTime() : 
Long.MIN_VALUE;
     }
 
+    /**
+     * Returns the maintenance period other than those defined.
+     *
+     * @todo needs an implementation of org.opengis.temporal modules to 
anntote this parameter.
+     */
     @Override
+    @XmlElement(name = "userDefinedMaintenanceFrequency")
     public synchronized PeriodDuration getUserDefinedMaintenanceFrequency() {
         return userDefinedMaintenanceFrequency;
     }
 
+    /**
+     * Sets the maintenance period other than those defined.
+     *
+     * @param newValue The new user defined maintenance frequency.
+     */
+    public synchronized void setUserDefinedMaintenanceFrequency(final 
PeriodDuration newValue) {
+        checkWritePermission();
+        userDefinedMaintenanceFrequency = newValue;
+    }
+
+    /**
+     * Returns the scope of data to which maintenance is applied.
+     */
     @Override
+    @XmlElement(name = "updateScope")
     public synchronized Collection<ScopeCode> getUpdateScopes() {
-        return updateScopes;
+        return updateScopes = nonNullCollection(updateScopes, ScopeCode.class);
+    }
+
+    /**
+     * Sets the scope of data to which maintenance is applied.
+     *
+     * @param newValues The new update scopes.
+     */
+    public synchronized void setUpdateScopes(final Collection<? extends 
ScopeCode> newValues) {
+        updateScopes = copyCollection(newValues, updateScopes, 
ScopeCode.class);
     }
 
+    /**
+     * Returns additional information about the range or extent of the 
resource.
+     */
     @Override
+    @XmlElement(name = "updateScopeDescription")
     public synchronized Collection<ScopeDescription> 
getUpdateScopeDescriptions() {
-        return updateScopeDescriptions;
+        return updateScopeDescriptions = 
nonNullCollection(updateScopeDescriptions, ScopeDescription.class);
     }
 
+    /**
+     * Sets additional information about the range or extent of the resource.
+     *
+     * @param newValues The new update scope descriptions.
+     */
+    public synchronized void setUpdateScopeDescriptions(final Collection<? 
extends ScopeDescription> newValues) {
+        updateScopeDescriptions = copyCollection(newValues, 
updateScopeDescriptions, ScopeDescription.class);
+    }
+
+    /**
+     * Returns information regarding specific requirements for maintaining the 
resource.
+     */
     @Override
+    @XmlElement(name = "maintenanceNote")
     public synchronized Collection<InternationalString> getMaintenanceNotes() {
-        return maintenanceNotes;
+        return maintenanceNotes = nonNullCollection(maintenanceNotes, 
InternationalString.class);
+    }
+
+    /**
+     * Sets information regarding specific requirements for maintaining the 
resource.
+     *
+     * @param newValues The new maintenance notes.
+     */
+    public synchronized void setMaintenanceNotes(final Collection<? extends 
InternationalString> newValues) {
+        maintenanceNotes = copyCollection(newValues, maintenanceNotes, 
InternationalString.class);
     }
 
+    /**
+     * Returns identification of, and means of communicating with,
+     * person(s) and organization(s) with responsibility for maintaining the 
metadata.
+     */
     @Override
+    @XmlElement(name = "contact")
     public synchronized Collection<ResponsibleParty> getContacts() {
-        return contacts;
+        return contacts = nonNullCollection(contacts, ResponsibleParty.class);
+    }
+
+    /**
+     * Sets identification of, and means of communicating with,
+     * person(s) and organization(s) with responsibility for maintaining the 
metadata.
+     *
+     * @param newValues The new contacts
+     */
+    public synchronized void setContacts(final Collection<? extends 
ResponsibleParty> newValues) {
+        contacts = copyCollection(newValues, contacts, ResponsibleParty.class);
     }
 }

Modified: 
sis/branches/JDK7/sis-metadata/src/main/java/org/apache/sis/metadata/iso/maintenance/DefaultScopeDescription.java
URL: 
http://svn.apache.org/viewvc/sis/branches/JDK7/sis-metadata/src/main/java/org/apache/sis/metadata/iso/maintenance/DefaultScopeDescription.java?rev=1459377&r1=1459376&r2=1459377&view=diff
==============================================================================
--- 
sis/branches/JDK7/sis-metadata/src/main/java/org/apache/sis/metadata/iso/maintenance/DefaultScopeDescription.java
 [UTF-8] (original)
+++ 
sis/branches/JDK7/sis-metadata/src/main/java/org/apache/sis/metadata/iso/maintenance/DefaultScopeDescription.java
 [UTF-8] Thu Mar 21 16:05:04 2013
@@ -17,52 +17,199 @@
 package org.apache.sis.metadata.iso.maintenance;
 
 import java.util.Set;
+import javax.xml.bind.annotation.XmlType;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlRootElement;
 import org.opengis.feature.type.AttributeType;
 import org.opengis.feature.type.FeatureType;
 import org.opengis.metadata.maintenance.ScopeDescription;
 import org.apache.sis.metadata.iso.ISOMetadata;
 
-public class DefaultScopeDescription extends ISOMetadata implements 
ScopeDescription {
 
+/**
+ * Description of the class of information covered by the information.
+ *
+ * @author  Martin Desruisseaux (IRD, Geomatys)
+ * @author  Touraïvane (IRD)
+ * @author  Cédric Briançon (Geomatys)
+ * @since   0.3 (derived from geotk-2.1)
+ * @version 0.3
+ * @module
+ */
+@XmlType(name = "MD_ScopeDescription_Type", propOrder = {
+    "dataset",
+    "other"
+})
+@XmlRootElement(name = "MD_ScopeDescription")
+public class DefaultScopeDescription extends ISOMetadata implements 
ScopeDescription {
+    /**
+     * Serial number for inter-operability with different versions.
+     */
+    private static final long serialVersionUID = -5671299759930976286L;
+
+    /**
+     * The attributes to which the information applies.
+     */
     private Set<AttributeType> attributes;
 
+    /**
+     * The features to which the information applies.
+     */
     private Set<FeatureType> features;
 
+    /**
+     * The feature instances to which the information applies.
+     */
     private Set<FeatureType> featureInstances;
 
+    /**
+     * The attribute instances to which the information applies.
+     */
     private Set<AttributeType> attributeInstances;
 
+    /**
+     * Dataset to which the information applies.
+     */
     private String dataset;
 
+    /**
+     * Class of information that does not fall into the other categories to
+     * which the information applies.
+     */
     private String other;
 
+    /**
+     * Creates an initially empty scope description.
+     */
+    public DefaultScopeDescription() {
+    }
+
+    /**
+     * Returns a SIS metadata implementation with the same values than the 
given arbitrary
+     * implementation. If the given object is {@code null}, then this method 
returns {@code null}.
+     * Otherwise if the given object is already a SIS implementation, then the 
given object is
+     * returned unchanged. Otherwise a new SIS implementation is created and 
initialized to the
+     * property values of the given object, using a <cite>shallow</cite> copy 
operation
+     * (i.e. properties are not cloned).
+     *
+     * @param  object The object to get as a SIS implementation, or {@code 
null} if none.
+     * @return A SIS implementation containing the values of the given object 
(may be the
+     *         given object itself), or {@code null} if the argument was null.
+     */
+    public static DefaultScopeDescription castOrCopy(final ScopeDescription 
object) {
+        if (object == null || object instanceof DefaultScopeDescription) {
+            return (DefaultScopeDescription) object;
+        }
+        final DefaultScopeDescription copy = new DefaultScopeDescription();
+        copy.shallowCopy(object);
+        return copy;
+    }
+
+    /**
+     * Returns the attributes to which the information applies.
+     */
     @Override
     public synchronized Set<AttributeType> getAttributes() {
-        return attributes;
+        return attributes = nonNullSet(attributes, AttributeType.class);
+    }
+
+    /**
+     * Sets the attributes to which the information applies.
+     *
+     * @param newValues The new attributes.
+     */
+    public synchronized void setAttributes(final Set<? extends AttributeType> 
newValues) {
+        attributes = copySet(newValues, attributes, AttributeType.class);
     }
 
+    /**
+     * Returns the features to which the information applies.
+     */
     @Override
     public synchronized Set<FeatureType> getFeatures() {
-        return features;
+        return features = nonNullSet(features, FeatureType.class);
+    }
+
+    /**
+     * Sets the features to which the information applies.
+     *
+     * @param newValues The new features.
+     */
+    public synchronized void setFeatures(final Set<? extends FeatureType> 
newValues) {
+        features = copySet(newValues, features, FeatureType.class);
     }
 
+    /**
+     * Returns the feature instances to which the information applies.
+     */
     @Override
     public synchronized Set<FeatureType> getFeatureInstances() {
-        return featureInstances;
+        return featureInstances = nonNullSet(featureInstances, 
FeatureType.class);
     }
 
+    /**
+     * Sets the feature instances to which the information applies.
+     *
+     * @param newValues The new feature instances.
+     */
+    public synchronized void setFeatureInstances(final Set<? extends 
FeatureType> newValues) {
+        featureInstances = copySet(newValues, featureInstances, 
FeatureType.class);
+    }
+
+    /**
+     * Returns the attribute instances to which the information applies.
+     */
     @Override
     public synchronized Set<AttributeType> getAttributeInstances() {
-        return attributeInstances;
+        return attributeInstances = nonNullSet(attributeInstances, 
AttributeType.class);
+    }
+
+    /**
+     * Sets the attribute instances to which the information applies.
+     *
+     * @param newValues The new attribute instances.
+     */
+    public synchronized void setAttributeInstances(final Set<? extends 
AttributeType> newValues) {
+        attributeInstances = copySet(newValues, attributeInstances, 
AttributeType.class);
     }
 
+    /**
+     * Returns the dataset to which the information applies.
+     */
     @Override
+    @XmlElement(name = "dataset")
     public synchronized String getDataset() {
         return dataset;
     }
 
+    /**
+     * Sets the dataset to which the information applies.
+     *
+     * @param newValue The new dataset.
+     */
+    public synchronized void setDataset(final String newValue) {
+        checkWritePermission();
+        dataset = newValue;
+    }
+
+    /**
+     * Returns the class of information that does not fall into the other 
categories to
+     * which the information applies.
+     */
     @Override
+    @XmlElement(name = "other")
     public synchronized String getOther() {
         return other;
     }
+
+    /**
+     * Sets the class of information that does not fall into the other 
categories to
+     * which the information applies.
+     *
+     * @param newValue Other class of information.
+     */
+    public synchronized void setOther(final String newValue) {
+        checkWritePermission();
+        other = newValue;
+    }
 }

Added: 
sis/branches/JDK7/sis-metadata/src/main/java/org/apache/sis/metadata/iso/maintenance/package-info.java
URL: 
http://svn.apache.org/viewvc/sis/branches/JDK7/sis-metadata/src/main/java/org/apache/sis/metadata/iso/maintenance/package-info.java?rev=1459377&view=auto
==============================================================================
--- 
sis/branches/JDK7/sis-metadata/src/main/java/org/apache/sis/metadata/iso/maintenance/package-info.java
 (added)
+++ 
sis/branches/JDK7/sis-metadata/src/main/java/org/apache/sis/metadata/iso/maintenance/package-info.java
 [UTF-8] Thu Mar 21 16:05:04 2013
@@ -0,0 +1,67 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * {@linkplain 
org.apache.sis.metadata.iso.maintenance.DefaultMaintenanceInformation 
Maintenance information} implementation.
+ * An explanation for this package is provided in the {@linkplain 
org.opengis.metadata.content OpenGIS® javadoc}.
+ * The remaining discussion on this page is specific to the SIS implementation.
+ *
+ * {@section Overview}
+ * For a global overview of metadata in SIS, see the
+ * <a href="{@docRoot}/../sis-metadata/index.html">Metadata page on the 
project web site</a>.
+ *
+ * @author  Martin Desruisseaux (IRD, Geomatys)
+ * @author  Touraïvane (IRD)
+ * @author  Cédric Briançon (Geomatys)
+ * @since   0.3 (derived from geotk-2.1)
+ * @version 0.3
+ * @module
+ */
+@XmlSchema(elementFormDefault = XmlNsForm.QUALIFIED, namespace = 
Namespaces.GMD, xmlns = {
+    @XmlNs(prefix = "gmd", namespaceURI = Namespaces.GMD),
+    @XmlNs(prefix = "gco", namespaceURI = Namespaces.GCO),
+    @XmlNs(prefix = "xsi", namespaceURI = Namespaces.XSI)
+})
+@XmlAccessorType(XmlAccessType.NONE)
+@XmlJavaTypeAdapters({
+    @XmlJavaTypeAdapter(CI_ResponsibleParty.class),
+    @XmlJavaTypeAdapter(MD_MaintenanceFrequencyCode.class),
+    @XmlJavaTypeAdapter(MD_MaintenanceInformation.class),
+    @XmlJavaTypeAdapter(MD_ScopeCode.class),
+    @XmlJavaTypeAdapter(MD_ScopeDescription.class),
+//    @XmlJavaTypeAdapter(TM_PeriodDuration.class), // TODO
+
+    // Java types, primitive types and basic OGC types handling
+//    @XmlJavaTypeAdapter(GO_DateTime.class), // TODO
+    @XmlJavaTypeAdapter(StringAdapter.class),
+    @XmlJavaTypeAdapter(InternationalStringAdapter.class)
+})
+package org.apache.sis.metadata.iso.maintenance;
+
+import javax.xml.bind.annotation.XmlNs;
+import javax.xml.bind.annotation.XmlNsForm;
+import javax.xml.bind.annotation.XmlSchema;
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
+import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapters;
+
+import org.apache.sis.xml.Namespaces;
+import org.apache.sis.internal.jaxb.gco.*;
+import org.apache.sis.internal.jaxb.code.*;
+//import org.apache.sis.internal.jaxb.gts.TM_PeriodDuration; // TODO
+import org.apache.sis.internal.jaxb.metadata.*;

Propchange: 
sis/branches/JDK7/sis-metadata/src/main/java/org/apache/sis/metadata/iso/maintenance/package-info.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: 
sis/branches/JDK7/sis-metadata/src/main/java/org/apache/sis/metadata/iso/maintenance/package-info.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain;charset=UTF-8


Reply via email to