Author: desruisseaux
Date: Thu Jun 26 19:13:04 2014
New Revision: 1605880
URL: http://svn.apache.org/r1605880
Log:
Added DefaultMetadataScope (SIS-94).
Added:
sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/metadata/MD_MetadataScope.java
- copied, changed from r1605796,
sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/metadata/MD_MaintenanceInformation.java
sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/maintenance/DefaultMetadataScope.java
(with props)
Modified:
sis/branches/JDK8/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/AllMetadataTest.java
Copied:
sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/metadata/MD_MetadataScope.java
(from r1605796,
sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/metadata/MD_MaintenanceInformation.java)
URL:
http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/metadata/MD_MetadataScope.java?p2=sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/metadata/MD_MetadataScope.java&p1=sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/metadata/MD_MaintenanceInformation.java&r1=1605796&r2=1605880&rev=1605880&view=diff
==============================================================================
---
sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/metadata/MD_MaintenanceInformation.java
[UTF-8] (original)
+++
sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/metadata/MD_MetadataScope.java
[UTF-8] Thu Jun 26 19:13:04 2014
@@ -17,8 +17,8 @@
package org.apache.sis.internal.jaxb.metadata;
import javax.xml.bind.annotation.XmlElementRef;
-import org.opengis.metadata.maintenance.MaintenanceInformation;
-import org.apache.sis.metadata.iso.maintenance.DefaultMaintenanceInformation;
+import org.opengis.metadata.maintenance.MetadataScope;
+import org.apache.sis.metadata.iso.maintenance.DefaultMetadataScope;
import org.apache.sis.internal.jaxb.gco.PropertyType;
@@ -26,19 +26,16 @@ import org.apache.sis.internal.jaxb.gco.
* JAXB adapter mapping implementing class to the GeoAPI interface. See
* package documentation for more information about JAXB and interface.
*
- * @author Cédric Briançon (Geomatys)
* @author Martin Desruisseaux (Geomatys)
- * @since 0.3 (derived from geotk-2.5)
- * @version 0.3
+ * @since 0.5
+ * @version 0.5
* @module
*/
-public final class MD_MaintenanceInformation extends
- PropertyType<MD_MaintenanceInformation, MaintenanceInformation>
-{
+public final class MD_MetadataScope extends PropertyType<MD_MetadataScope,
MetadataScope> {
/**
* Empty constructor for JAXB only.
*/
- public MD_MaintenanceInformation() {
+ public MD_MetadataScope() {
}
/**
@@ -46,42 +43,42 @@ public final class MD_MaintenanceInforma
* This method is indirectly invoked by the private constructor
* below, so it shall not depend on the state of this object.
*
- * @return {@code MaintenanceInformation.class}
+ * @return {@code MetadataScope.class}
*/
@Override
- protected Class<MaintenanceInformation> getBoundType() {
- return MaintenanceInformation.class;
+ protected Class<MetadataScope> getBoundType() {
+ return MetadataScope.class;
}
/**
* Constructor for the {@link #wrap} method only.
*/
- private MD_MaintenanceInformation(final MaintenanceInformation metadata) {
+ private MD_MetadataScope(final MetadataScope metadata) {
super(metadata);
}
/**
* Invoked by {@link PropertyType} at marshalling time for wrapping the
given metadata value
- * in a {@code <gmd:MD_MaintenanceInformation>} XML element.
+ * in a {@code <gmd:MD_MetadataScope>} XML element.
*
* @param metadata The metadata element to marshall.
* @return A {@code PropertyType} wrapping the given the metadata element.
*/
@Override
- protected MD_MaintenanceInformation wrap(final MaintenanceInformation
metadata) {
- return new MD_MaintenanceInformation(metadata);
+ protected MD_MetadataScope wrap(final MetadataScope metadata) {
+ return new MD_MetadataScope(metadata);
}
/**
* Invoked by JAXB at marshalling time for getting the actual metadata to
write
- * inside the {@code <gmd:MD_MaintenanceInformation>} XML element.
+ * inside the {@code <gmd:MD_MetadataScope>} XML element.
* This is the value or a copy of the value given in argument to the
{@code wrap} method.
*
* @return The metadata to be marshalled.
*/
@XmlElementRef
- public DefaultMaintenanceInformation getElement() {
- return DefaultMaintenanceInformation.castOrCopy(metadata);
+ public DefaultMetadataScope getElement() {
+ return DefaultMetadataScope.castOrCopy(metadata);
}
/**
@@ -89,7 +86,7 @@ public final class MD_MaintenanceInforma
*
* @param metadata The unmarshalled metadata.
*/
- public void setElement(final DefaultMaintenanceInformation metadata) {
+ public void setElement(final DefaultMetadataScope metadata) {
this.metadata = metadata;
}
}
Added:
sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/maintenance/DefaultMetadataScope.java
URL:
http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/maintenance/DefaultMetadataScope.java?rev=1605880&view=auto
==============================================================================
---
sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/maintenance/DefaultMetadataScope.java
(added)
+++
sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/maintenance/DefaultMetadataScope.java
[UTF-8] Thu Jun 26 19:13:04 2014
@@ -0,0 +1,156 @@
+/*
+ * 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.
+ */
+package org.apache.sis.metadata.iso.maintenance;
+
+import javax.xml.bind.annotation.XmlType;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlRootElement;
+import org.opengis.util.InternationalString;
+import org.opengis.metadata.maintenance.MetadataScope;
+import org.opengis.metadata.maintenance.ScopeCode;
+import org.apache.sis.metadata.iso.ISOMetadata;
+
+
+/**
+ * Information about the scope of the resource.
+ *
+ * @author Rémi Maréchal (Geomatys)
+ * @author Martin Desruisseaux (Geomatys)
+ * @since 0.5
+ * @version 0.5
+ * @module
+ */
+@XmlType(name = "MD_MetadataScope_Type", propOrder = {
+ "resourceScope",
+ "name"
+})
+@XmlRootElement(name = "MD_MetadataScope")
+public class DefaultMetadataScope extends ISOMetadata implements MetadataScope
{
+ /**
+ * Serial number for inter-operability with different versions.
+ */
+ private static final long serialVersionUID = -7186722085106176683L;
+
+ /**
+ * Code for the scope.
+ */
+ private ScopeCode resourceScope;
+
+ /**
+ * Description of the scope.
+ */
+ private InternationalString name;
+
+ /**
+ * Constructs an initially empty metadata scope.
+ */
+ public DefaultMetadataScope() {
+ }
+
+ /**
+ * Constructs a metadata scope initialized to the given value.
+ *
+ * @param resourceScope code for the scope.
+ */
+ public DefaultMetadataScope(final ScopeCode resourceScope) {
+ this.resourceScope = resourceScope;
+ }
+
+ /**
+ * Constructs a new instance initialized with the values from the
specified metadata object.
+ * This is a <cite>shallow</cite> copy constructor, since the other
metadata contained in the
+ * given object are not recursively copied.
+ *
+ * @param object The metadata to copy values from, or {@code null} if none.
+ *
+ * @see #castOrCopy(MetadataScope)
+ */
+ public DefaultMetadataScope(final MetadataScope object) {
+ super(object);
+ if (object != null) {
+ resourceScope = object.getResourceScope();
+ name = object.getName();
+ }
+ }
+
+ /**
+ * Returns a SIS metadata implementation with the values of the given
arbitrary implementation.
+ * This method performs the first applicable action in the following
choices:
+ *
+ * <ul>
+ * <li>If the given object is {@code null}, then this method returns
{@code null}.</li>
+ * <li>Otherwise if the given object is already an instance of
+ * {@code DefaultMetadataScope}, then it is returned unchanged.</li>
+ * <li>Otherwise a new {@code DefaultMetadataScope} instance is created
using the
+ * {@linkplain #DefaultMetadataScope(MetadataScope) copy
constructor} and returned.
+ * Note that this is a <cite>shallow</cite> copy operation, since
the other
+ * metadata contained in the given object are not recursively
copied.</li>
+ * </ul>
+ *
+ * @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 DefaultMetadataScope castOrCopy(final MetadataScope object) {
+ if (object == null || object instanceof DefaultMetadataScope) {
+ return (DefaultMetadataScope) object;
+ }
+ return new DefaultMetadataScope(object);
+ }
+
+ /**
+ * Return the code for the scope.
+ *
+ * @return The ode for the scope.
+ */
+ @Override
+ @XmlElement(name = "resourceScope", required = true)
+ public ScopeCode getResourceScope() {
+ return resourceScope;
+ }
+
+ /**
+ * Sets the code for the scope.
+ *
+ * @param newValue The new code for the scope.
+ */
+ public void setResourceScope(final ScopeCode newValue) {
+ checkWritePermission();
+ resourceScope = newValue;
+ }
+
+ /**
+ * Return a description of the scope, or {@code null} if none.
+ *
+ * @return Description of the scope, or {@code null} if none.
+ */
+ @Override
+ @XmlElement(name = "name")
+ public InternationalString getName() {
+ return name;
+ }
+
+ /**
+ * Sets the description of the scope.
+ *
+ * @param newValue The new description of the scope.
+ */
+ public void setName(final InternationalString newValue) {
+ checkWritePermission();
+ name = newValue;
+ }
+}
Propchange:
sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/maintenance/DefaultMetadataScope.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange:
sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/maintenance/DefaultMetadataScope.java
------------------------------------------------------------------------------
svn:mime-type = text/plain;charset=UTF-8
Modified:
sis/branches/JDK8/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/AllMetadataTest.java
URL:
http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/AllMetadataTest.java?rev=1605880&r1=1605879&r2=1605880&view=diff
==============================================================================
---
sis/branches/JDK8/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/AllMetadataTest.java
[UTF-8] (original)
+++
sis/branches/JDK8/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/AllMetadataTest.java
[UTF-8] Thu Jun 26 19:13:04 2014
@@ -155,6 +155,7 @@ public final strictfp class AllMetadataT
org.opengis.metadata.lineage.Source.class,
org.opengis.metadata.maintenance.MaintenanceFrequency.class,
org.opengis.metadata.maintenance.MaintenanceInformation.class,
+ org.opengis.metadata.maintenance.MetadataScope.class,
org.opengis.metadata.maintenance.ScopeCode.class,
// org.opengis.metadata.maintenance.ScopeDescription.class, //
Excluded because this is an union.
org.opengis.metadata.quality.AbsoluteExternalPositionalAccuracy.class,