sis-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From desruisse...@apache.org
Subject svn commit: r1617582 - in /sis/branches/JDK7: ./ core/sis-metadata/src/main/java/org/apache/sis/metadata/ core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/ core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/extent/ core/sis-metadata...
Date Tue, 12 Aug 2014 20:34:01 GMT
Author: desruisseaux
Date: Tue Aug 12 20:34:00 2014
New Revision: 1617582

URL: http://svn.apache.org/r1617582
Log:
Merge from the JDK8 branch.

Modified:
    sis/branches/JDK7/   (props changed)
    sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/metadata/MetadataStandard.java
    sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/metadata/PropertyInformation.java
    sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/metadata/StandardImplementation.java
    sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/DefaultApplicationSchemaInformation.java
    sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/DefaultExtendedElementInformation.java
    sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/DefaultMetadataExtensionInformation.java
    sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/extent/DefaultBoundingPolygon.java
    sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/service/DefaultCoupledResource.java
    sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/service/DefaultOperationChainMetadata.java
    sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/service/DefaultOperationMetadata.java
    sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/service/OperationName.java
    sis/branches/JDK7/core/sis-metadata/src/test/java/org/apache/sis/metadata/MetadataTestCase.java
    sis/branches/JDK7/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/service/DefaultCoupledResourceTest.java
    sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/util/Characters.java
    sis/branches/JDK7/core/sis-utility/src/test/java/org/apache/sis/util/CharactersTest.java

Propchange: sis/branches/JDK7/
------------------------------------------------------------------------------
  Merged /sis/branches/JDK8:r1616821-1617580

Modified: sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/metadata/MetadataStandard.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/metadata/MetadataStandard.java?rev=1617582&r1=1617581&r2=1617582&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/metadata/MetadataStandard.java
[UTF-8] (original)
+++ sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/metadata/MetadataStandard.java
[UTF-8] Tue Aug 12 20:34:00 2014
@@ -88,7 +88,7 @@ import static org.apache.sis.util.Argume
  *
  * @author  Martin Desruisseaux (Geomatys)
  * @since   0.3 (derived from geotk-2.4)
- * @version 0.3
+ * @version 0.5
  * @module
  *
  * @see AbstractMetadata
@@ -412,6 +412,7 @@ public class MetadataStandard implements
      * The standard package is usually made of interfaces and code lists only, but this is
      * not verified by this method.</div>
      *
+     * @param  <T>  The compile-time {@code type}.
      * @param  type The implementation class.
      * @return The interface implemented by the given implementation class.
      * @throws ClassCastException if the specified implementation class does
@@ -419,23 +420,28 @@ public class MetadataStandard implements
      *
      * @see AbstractMetadata#getInterface()
      */
-    public Class<?> getInterface(final Class<?> type) throws ClassCastException
{
+    @SuppressWarnings("unchecked")
+    public <T> Class<? super T> getInterface(final Class<T> type) throws
ClassCastException {
         ensureNonNull("type", type);
+        final Class<?> standard;
         synchronized (accessors) {
             final Object value = accessors.get(type);
             if (value != null) {
                 if (value instanceof PropertyAccessor) {
-                    return ((PropertyAccessor) value).type;
+                    standard = ((PropertyAccessor) value).type;
+                } else {
+                    standard = (Class<?>) value;
                 }
-                return (Class<?>) value;
-            }
-            final Class<?> standard = findInterface(type);
-            if (standard == null) {
-                throw new ClassCastException(Errors.format(Errors.Keys.UnknownType_1, type));
+            } else {
+                standard = findInterface(type);
+                if (standard == null) {
+                    throw new ClassCastException(Errors.format(Errors.Keys.UnknownType_1,
type));
+                }
+                accessors.put(type, standard);
             }
-            accessors.put(type, standard);
-            return standard;
         }
+        assert standard.isAssignableFrom(type) : type;
+        return (Class<? super T>) standard;
     }
 
     /**
@@ -443,10 +449,11 @@ public class MetadataStandard implements
      * The default implementation returns {@code null} if every cases. Subclasses shall
      * override this method in order to map GeoAPI interfaces to their implementation.
      *
+     * @param  <T>  The compile-time {@code type}.
      * @param  type The interface, typically from the {@code org.opengis.metadata} package.
      * @return The implementation class, or {@code null} if none.
      */
-    public Class<?> getImplementation(final Class<?> type) {
+    public <T> Class<? extends T> getImplementation(final Class<T> type)
{
         return null;
     }
 

Modified: sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/metadata/PropertyInformation.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/metadata/PropertyInformation.java?rev=1617582&r1=1617581&r2=1617582&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/metadata/PropertyInformation.java
[UTF-8] (original)
+++ sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/metadata/PropertyInformation.java
[UTF-8] Tue Aug 12 20:34:00 2014
@@ -55,7 +55,7 @@ import org.apache.sis.util.logging.Loggi
  *
  * @author  Martin Desruisseaux (Geomatys)
  * @since   0.3 (derived from geotk-3.05)
- * @version 0.3
+ * @version 0.5
  * @module
  *
  * @see InformationMap
@@ -319,9 +319,18 @@ final class PropertyInformation<E> exten
     }
 
     /**
+     * Unconditionally returns {@code null}.
+     */
+    @Override
+    public InternationalString getRationale() {
+        return null;
+    }
+
+    /**
      * Unconditionally returns an empty list.
      */
     @Override
+    @Deprecated
     public Collection<InternationalString> getRationales() {
         return Collections.emptyList();
     }

Modified: sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/metadata/StandardImplementation.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/metadata/StandardImplementation.java?rev=1617582&r1=1617581&r2=1617582&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/metadata/StandardImplementation.java
[UTF-8] (original)
+++ sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/metadata/StandardImplementation.java
[UTF-8] Tue Aug 12 20:34:00 2014
@@ -98,11 +98,12 @@ final class StandardImplementation exten
      * Returns the implementation class for the given interface, or {@code null} if none.
      * This class uses heuristic rules based on naming conventions.
      *
+     * @param  <T>  The compile-time {@code type}.
      * @param  type The interface, typically from the {@code org.opengis.metadata} package.
      * @return The implementation class, or {@code null} if none.
      */
     @Override
-    public Class<?> getImplementation(final Class<?> type) {
+    public <T> Class<? extends T> getImplementation(final Class<T> type)
{
         /*
          * We require the type to be an interface in order to exclude
          * CodeLists, Enums and Exceptions.
@@ -113,7 +114,7 @@ final class StandardImplementation exten
                 synchronized (implementations) {
                     Class<?> candidate = implementations.get(type);
                     if (candidate != null) {
-                        return (candidate != Void.TYPE) ? candidate : null;
+                        return (candidate != Void.TYPE) ? candidate.asSubclass(type) : null;
                     }
                     /*
                      * Prepares a buffer with a copy of the class name in which the interface
@@ -141,7 +142,7 @@ final class StandardImplementation exten
                     try {
                         candidate = Class.forName(name);
                         implementations.put(type, candidate);
-                        return candidate;
+                        return candidate.asSubclass(type);
                     } catch (ClassNotFoundException e) {
                         Logging.recoverableException(MetadataStandard.class, "getImplementation",
e);
                     }

Modified: sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/DefaultApplicationSchemaInformation.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/DefaultApplicationSchemaInformation.java?rev=1617582&r1=1617581&r2=1617582&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/DefaultApplicationSchemaInformation.java
[UTF-8] (original)
+++ sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/DefaultApplicationSchemaInformation.java
[UTF-8] Tue Aug 12 20:34:00 2014
@@ -16,12 +16,12 @@
  */
 package org.apache.sis.metadata.iso;
 
-import java.net.URI;
 import javax.xml.bind.annotation.XmlType;
 import javax.xml.bind.annotation.XmlElement;
 import javax.xml.bind.annotation.XmlRootElement;
 import org.opengis.metadata.ApplicationSchemaInformation;
 import org.opengis.metadata.citation.Citation;
+import org.opengis.metadata.citation.OnlineResource;
 
 
 /**
@@ -40,16 +40,16 @@ import org.opengis.metadata.citation.Cit
  * @author  Touraïvane (IRD)
  * @author  Cédric Briançon (Geomatys)
  * @since   0.3 (derived from geotk-2.1)
- * @version 0.3
+ * @version 0.5
  * @module
  */
 @XmlType(name = "MD_ApplicationSchemaInformation_Type", propOrder = {
     "name",
     "schemaLanguage",
     "constraintLanguage",
-    "schemaAscii",
-    "graphicsFile",
-    "softwareDevelopmentFile",
+/// "schemaAscii",
+/// "graphicsFile",
+/// "softwareDevelopmentFile",
     "softwareDevelopmentFileFormat"
 })
 @XmlRootElement(name = "MD_ApplicationSchemaInformation")
@@ -59,7 +59,7 @@ public class DefaultApplicationSchemaInf
     /**
      * Serial number for inter-operability with different versions.
      */
-    private static final long serialVersionUID = -884081423040392985L;
+    private static final long serialVersionUID = 5667352094985433121L;
 
     /**
      * Name of the application schema used.
@@ -79,17 +79,17 @@ public class DefaultApplicationSchemaInf
     /**
      * Full application schema given as an ASCII file.
      */
-    private URI schemaAscii;
+    private CharSequence schemaAscii;
 
     /**
      * Full application schema given as a graphics file.
      */
-    private URI graphicsFile;
+    private OnlineResource graphicsFile;
 
     /**
      * Full application schema given as a software development file.
      */
-    private URI softwareDevelopmentFile;
+    private OnlineResource softwareDevelopmentFile;
 
     /**
      * Software dependent format used for the application schema software dependent file.
@@ -234,8 +234,8 @@ public class DefaultApplicationSchemaInf
      * @return Application schema as an ASCII file, or {@code null}.
      */
     @Override
-    @XmlElement(name = "schemaAscii")
-    public URI getSchemaAscii()  {
+/// @XmlElement(name = "schemaAscii")
+    public CharSequence getSchemaAscii()  {
         return schemaAscii;
     }
 
@@ -244,7 +244,7 @@ public class DefaultApplicationSchemaInf
      *
      * @param newValue The new ASCII file.
      */
-    public void setSchemaAscii(final URI newValue) {
+    public void setSchemaAscii(final CharSequence newValue) {
         checkWritePermission();
         schemaAscii = newValue;
     }
@@ -255,8 +255,8 @@ public class DefaultApplicationSchemaInf
      * @return Application schema as a graphics file, or {@code null}.
      */
     @Override
-    @XmlElement(name = "graphicsFile")
-    public URI getGraphicsFile()  {
+/// @XmlElement(name = "graphicsFile")
+    public OnlineResource getGraphicsFile()  {
         return graphicsFile;
     }
 
@@ -265,7 +265,7 @@ public class DefaultApplicationSchemaInf
      *
      * @param newValue The new graphics file.
      */
-    public void setGraphicsFile(final URI newValue) {
+    public void setGraphicsFile(final OnlineResource newValue) {
         checkWritePermission();
         graphicsFile = newValue;
     }
@@ -276,8 +276,8 @@ public class DefaultApplicationSchemaInf
      * @return Application schema as a software development file, or {@code null}.
      */
     @Override
-    @XmlElement(name = "softwareDevelopmentFile")
-    public URI getSoftwareDevelopmentFile()  {
+/// @XmlElement(name = "softwareDevelopmentFile")
+    public OnlineResource getSoftwareDevelopmentFile()  {
         return softwareDevelopmentFile;
     }
 
@@ -286,7 +286,7 @@ public class DefaultApplicationSchemaInf
      *
      * @param newValue The new software development file.
      */
-    public void setSoftwareDevelopmentFile(final URI newValue) {
+    public void setSoftwareDevelopmentFile(final OnlineResource newValue) {
         checkWritePermission();
         softwareDevelopmentFile = newValue;
     }

Modified: sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/DefaultExtendedElementInformation.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/DefaultExtendedElementInformation.java?rev=1617582&r1=1617581&r2=1617582&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/DefaultExtendedElementInformation.java
[UTF-8] (original)
+++ sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/DefaultExtendedElementInformation.java
[UTF-8] Tue Aug 12 20:34:00 2014
@@ -16,7 +16,9 @@
  */
 package org.apache.sis.metadata.iso;
 
+import java.util.AbstractSet;
 import java.util.Collection;
+import java.util.Iterator;
 import javax.xml.bind.annotation.XmlType;
 import javax.xml.bind.annotation.XmlElement;
 import javax.xml.bind.annotation.XmlRootElement;
@@ -28,10 +30,12 @@ import org.opengis.util.InternationalStr
 import org.apache.sis.measure.ValueRange;
 import org.apache.sis.util.ArgumentChecks;
 import org.apache.sis.util.iso.Types;
+import org.apache.sis.internal.metadata.LegacyPropertyAdapter;
 
 
 /**
  * New metadata element, not found in ISO 19115, which is required to describe geographic
data.
+ * Metadata elements are contained in a {@linkplain DefaultMetadataExtensionInformation metadata
extension information}.
  *
  * <p><b>Limitations:</b></p>
  * <ul>
@@ -71,7 +75,7 @@ public class DefaultExtendedElementInfor
     /**
      * Serial number for inter-operability with different versions.
      */
-    private static final long serialVersionUID = 5892811836634834434L;
+    private static final long serialVersionUID = 489138542195499530L;
 
     /**
      * Name of the extended metadata element.
@@ -144,7 +148,7 @@ public class DefaultExtendedElementInfor
     /**
      * Reason for creating the extended element.
      */
-    private Collection<InternationalString> rationales;
+    private InternationalString rationale;
 
     /**
      * Name of the person or organization creating the extended element.
@@ -194,6 +198,7 @@ public class DefaultExtendedElementInfor
      *
      * @see #castOrCopy(ExtendedElementInformation)
      */
+    @SuppressWarnings("deprecation")
     public DefaultExtendedElementInformation(final ExtendedElementInformation object) {
         super(object);
         if (object != null) {
@@ -208,7 +213,7 @@ public class DefaultExtendedElementInfor
             domainValue       = object.getDomainValue();
             parentEntity      = copyCollection(object.getParentEntity(), String.class);
             rule              = object.getRule();
-            rationales        = copyCollection(object.getRationales(), InternationalString.class);
+            rationale         = object.getRationale();
             sources           = copyCollection(object.getSources(), Responsibility.class);
         }
     }
@@ -263,8 +268,11 @@ public class DefaultExtendedElementInfor
      * Short form suitable for use in an implementation method such as XML or SGML.
      *
      * @return Short form suitable for use in an implementation method such as XML or SGML,
or {@code null}.
+     *
+     * @deprecated Removed as of ISO 19115:2014.
      */
     @Override
+    @Deprecated
     @XmlElement(name = "shortName")
     public String getShortName()  {
         return shortName;
@@ -274,7 +282,10 @@ public class DefaultExtendedElementInfor
      * Sets a short form suitable for use in an implementation method such as XML or SGML.
      *
      * @param newValue The new short name.
+     *
+     * @deprecated Removed as of ISO 19115:2014.
      */
+    @Deprecated
     public void setShortName(final String newValue)  {
         checkWritePermission();
         shortName = newValue;
@@ -286,8 +297,11 @@ public class DefaultExtendedElementInfor
      * is {@linkplain Datatype#CODE_LIST_ELEMENT code list element}.
      *
      * @return Three digit code assigned to the extended element, or {@code null}.
+     *
+     * @deprecated Removed as of ISO 19115:2014.
      */
     @Override
+    @Deprecated
     @XmlElement(name = "domainCode")
     public Integer getDomainCode() {
         return domainCode;
@@ -297,7 +311,10 @@ public class DefaultExtendedElementInfor
      * Sets a three digit code assigned to the extended element.
      *
      * @param newValue The new domain code.
+     *
+     * @deprecated Removed as of ISO 19115:2014.
      */
+    @Deprecated
     public void setDomainCode(final Integer newValue) {
         checkWritePermission();
         domainCode = newValue;
@@ -490,20 +507,69 @@ public class DefaultExtendedElementInfor
      * Reason for creating the extended element.
      *
      * @return Reason for creating the extended element.
+     *
+     * @since 0.5
      */
     @Override
+    public InternationalString getRationale() {
+        return rationale;
+    }
+
+    /**
+     * Sets the reason for creating the extended element.
+     *
+     * @param newValue The new rationale.
+     *
+     * @since 0.5
+     */
+    public void setRationale(final InternationalString newValue) {
+        checkWritePermission();
+        rationale = newValue;
+    }
+
+    /**
+     * @deprecated As of ISO 19115:2014, replaced by {@link #getRationale()}.
+     *
+     * @return Reason for creating the extended element.
+     */
+    @Override
+    @Deprecated
     @XmlElement(name = "rationale")
     public Collection<InternationalString> getRationales() {
-        return rationales = nonNullCollection(rationales, InternationalString.class);
+        return new AbstractSet<InternationalString>() {
+            /** Returns 0 if empty, or 1 if a density has been specified. */
+            @Override public int size() {
+                return getRationale() != null ? 1 : 0;
+            }
+
+            /** Returns an iterator over 0 or 1 element. Current iterator implementation
is unmodifiable. */
+            @Override public Iterator<InternationalString> iterator() {
+                return LegacyPropertyAdapter.asCollection(getRationale()).iterator();
+            }
+
+            /** Adds an element only if the set is empty. This method is invoked by JAXB
at unmarshalling time. */
+            @Override public boolean add(final InternationalString newValue) {
+                if (isEmpty()) {
+                    setRationale(newValue);
+                    return true;
+                } else {
+                    LegacyPropertyAdapter.warnIgnoredExtraneous(InternationalString.class,
+                            DefaultExtendedElementInformation.class, "setRationales");
+                    return false;
+                }
+            }
+        };
     }
 
     /**
-     * Sets the reason for creating the extended element.
+     * @deprecated As of ISO 19115:2014, replaced by {@link #setRationale(InternationalString)}.
      *
      * @param newValues The new rationales.
      */
+    @Deprecated
     public void setRationales(final Collection<? extends InternationalString> newValues)
{
-        rationales = writeCollection(newValues, rationales, InternationalString.class);
+        setRationale(LegacyPropertyAdapter.getSingleton(newValues, InternationalString.class,
+                null, DefaultExtendedElementInformation.class, "setRationales"));
     }
 
     /**

Modified: sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/DefaultMetadataExtensionInformation.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/DefaultMetadataExtensionInformation.java?rev=1617582&r1=1617581&r2=1617582&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/DefaultMetadataExtensionInformation.java
[UTF-8] (original)
+++ sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/DefaultMetadataExtensionInformation.java
[UTF-8] Tue Aug 12 20:34:00 2014
@@ -119,7 +119,7 @@ public class DefaultMetadataExtensionInf
 
     /**
      * Information about on-line sources containing the community profile name and
-     * the extended metadata elements. Information for all new metadata elements.
+     * the extended metadata elements and information for all new metadata elements.
      *
      * @return Online sources to community profile name and extended metadata elements, or
{@code null}.
      */
@@ -140,8 +140,8 @@ public class DefaultMetadataExtensionInf
     }
 
     /**
-     * Provides information about a new metadata element, not found in ISO 19115, which is
-     * required to describe geographic data.
+     * Provides information about a new metadata element, not found in ISO 19115,
+     * which is required to describe resource.
      *
      * @return New metadata elements not found in ISO 19115.
      */

Modified: sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/extent/DefaultBoundingPolygon.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/extent/DefaultBoundingPolygon.java?rev=1617582&r1=1617581&r2=1617582&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/extent/DefaultBoundingPolygon.java
[UTF-8] (original)
+++ sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/extent/DefaultBoundingPolygon.java
[UTF-8] Tue Aug 12 20:34:00 2014
@@ -116,9 +116,9 @@ public class DefaultBoundingPolygon exte
     }
 
     /**
-     * Returns the sets of points defining the bounding polygon.
+     * Returns the sets of points defining the bounding polygon or other geometry.
      *
-     * @return The sets of points defining the bounding polygon.
+     * @return The sets of points defining the resource boundary.
      */
     @Override
     @XmlElement(name = "polygon", required = true)
@@ -127,9 +127,9 @@ public class DefaultBoundingPolygon exte
     }
 
     /**
-     * Sets the sets of points defining the bounding polygon.
+     * Sets the sets of points defining the resource boundary.
      *
-     * @param newValues The new polygons.
+     * @param newValues The new boundaries.
      */
     public void setPolygons(final Collection<? extends Geometry> newValues) {
         polygons = writeCollection(newValues, polygons, Geometry.class);

Modified: sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/service/DefaultCoupledResource.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/service/DefaultCoupledResource.java?rev=1617582&r1=1617581&r2=1617582&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/service/DefaultCoupledResource.java
[UTF-8] (original)
+++ sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/service/DefaultCoupledResource.java
[UTF-8] Tue Aug 12 20:34:00 2014
@@ -23,7 +23,6 @@ import javax.xml.bind.annotation.XmlElem
 import javax.xml.bind.annotation.XmlRootElement;
 import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
 import org.opengis.util.ScopedName;
-import org.opengis.util.InternationalString;
 import org.opengis.metadata.citation.Citation;
 import org.opengis.metadata.identification.DataIdentification;
 import org.opengis.metadata.service.CoupledResource;
@@ -247,7 +246,7 @@ public class DefaultCoupledResource exte
      * For JAXB marhalling of ISO 19119 document only.
      */
     @XmlElement(name = "operationName")
-    final InternationalString getOperationName() {
+    final String getOperationName() {
         if (LEGACY_XML) {
             final OperationMetadata operation = getOperation();
             if (operation != null) {
@@ -262,7 +261,7 @@ public class DefaultCoupledResource exte
      * {@link OperationName} placeholder. That temporary instance will be replaced by the
real
      * one when the enclosing {@link DefaultServiceIdentification} is unmarshalled.
      */
-    final void setOperationName(final InternationalString name) {
+    final void setOperationName(final String name) {
         if (operation == null) {
             operation = new OperationName(name);
         }

Modified: sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/service/DefaultOperationChainMetadata.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/service/DefaultOperationChainMetadata.java?rev=1617582&r1=1617581&r2=1617582&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/service/DefaultOperationChainMetadata.java
[UTF-8] (original)
+++ sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/service/DefaultOperationChainMetadata.java
[UTF-8] Tue Aug 12 20:34:00 2014
@@ -16,7 +16,7 @@
  */
 package org.apache.sis.metadata.iso.service;
 
-import java.util.Collection;
+import java.util.List;
 import javax.xml.bind.annotation.XmlType;
 import javax.xml.bind.annotation.XmlElement;
 import javax.xml.bind.annotation.XmlRootElement;
@@ -70,7 +70,7 @@ public class DefaultOperationChainMetada
     /**
      * Information about the operations applied by the chain.
      */
-    private Collection<OperationMetadata> operations;
+    private List<OperationMetadata> operations;
 
     /**
      * Constructs an initially empty operation chain metadata.
@@ -79,16 +79,12 @@ public class DefaultOperationChainMetada
     }
 
     /**
-     * Constructs a new operation chain metadata initialized to the specified values.
+     * Constructs a new operation chain metadata initialized to the specified name.
      *
-     * @param name      The name as used by the service for this chain.
-     * @param operation Information about the operations applied by the chain.
+     * @param name The name as used by the service for this chain.
      */
-    public DefaultOperationChainMetadata(final CharSequence name,
-                                         final OperationMetadata operation)
-    {
-        this.name       = Types.toInternationalString(name);
-        this.operations = singleton(operation, OperationMetadata.class);
+    public DefaultOperationChainMetadata(final CharSequence name) {
+        this.name = Types.toInternationalString(name);
     }
 
     /**
@@ -105,7 +101,7 @@ public class DefaultOperationChainMetada
         if (object != null) {
             this.name        = object.getName();
             this.description = object.getDescription();
-            this.operations  = copyCollection(object.getOperations(), OperationMetadata.class);
+            this.operations  = copyList(object.getOperations(), OperationMetadata.class);
         }
     }
 
@@ -183,8 +179,8 @@ public class DefaultOperationChainMetada
      */
     @Override
     @XmlElement(name = "operation", required = true)
-    public Collection<OperationMetadata> getOperations() {
-        return operations = nonNullCollection(operations, OperationMetadata.class);
+    public List<OperationMetadata> getOperations() {
+        return operations = nonNullList(operations, OperationMetadata.class);
     }
 
     /**
@@ -192,7 +188,7 @@ public class DefaultOperationChainMetada
      *
      * @param newValues The new information about the operations applied by the chain.
      */
-    public void setOperations(final Collection<? extends OperationMetadata> newValues)
{
-        operations = writeCollection(newValues, operations, OperationMetadata.class);
+    public void setOperations(final List<? extends OperationMetadata> newValues) {
+        operations = writeList(newValues, operations, OperationMetadata.class);
     }
 }

Modified: sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/service/DefaultOperationMetadata.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/service/DefaultOperationMetadata.java?rev=1617582&r1=1617581&r2=1617582&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/service/DefaultOperationMetadata.java
[UTF-8] (original)
+++ sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/service/DefaultOperationMetadata.java
[UTF-8] Tue Aug 12 20:34:00 2014
@@ -27,7 +27,6 @@ import org.opengis.metadata.citation.Onl
 import org.opengis.metadata.service.DistributedComputingPlatform;
 import org.opengis.metadata.service.OperationMetadata;
 import org.opengis.metadata.service.Parameter;
-import org.apache.sis.util.iso.Types;
 
 
 /**
@@ -67,7 +66,7 @@ public class DefaultOperationMetadata ex
     /**
      * An unique identifier for this interface.
      */
-    private InternationalString operationName;
+    private String operationName;
 
     /**
      * Distributed computing platforms on which the operation has been implemented.
@@ -112,11 +111,11 @@ public class DefaultOperationMetadata ex
      * @param platform      Distributed computing platforms on which the operation has been
implemented.
      * @param connectPoint  Handle for accessing the service interface.
      */
-    public DefaultOperationMetadata(final CharSequence operationName,
+    public DefaultOperationMetadata(final String operationName,
                                     final DistributedComputingPlatform platform,
                                     final OnlineResource connectPoint)
     {
-        this.operationName                 = Types.toInternationalString(operationName);
+        this.operationName                 = operationName;
         this.distributedComputingPlatforms = singleton(platform, DistributedComputingPlatform.class);
         this.connectPoints                 = singleton(connectPoint, OnlineResource.class);
     }
@@ -175,8 +174,8 @@ public class DefaultOperationMetadata ex
      */
     @Override
     @XmlElement(name = "operationName", required = true)
-    public InternationalString getOperationName() {
-        return this.operationName;
+    public String getOperationName() {
+        return operationName;
     }
 
     /**
@@ -184,9 +183,9 @@ public class DefaultOperationMetadata ex
      *
      * @param newValue The new unique identifier for this interface.
      */
-    public void setOperationName(final InternationalString newValue) {
+    public void setOperationName(final String newValue) {
         checkWritePermission();
-        this.operationName = newValue;
+        operationName = newValue;
     }
 
     /**

Modified: sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/service/OperationName.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/service/OperationName.java?rev=1617582&r1=1617581&r2=1617582&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/service/OperationName.java
[UTF-8] (original)
+++ sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/service/OperationName.java
[UTF-8] Tue Aug 12 20:34:00 2014
@@ -21,7 +21,6 @@ import java.util.Map;
 import java.util.HashMap;
 import java.util.Collection;
 import java.util.Collections;
-import java.util.Locale;
 import java.io.Serializable;
 import org.opengis.metadata.citation.OnlineResource;
 import org.opengis.metadata.service.CoupledResource;
@@ -49,19 +48,19 @@ final class OperationName implements Ope
     /**
      * The operation name.
      */
-    private final InternationalString operationName;
+    private final String operationName;
 
     /**
      * Creates a new placeholder for the operation of the given name.
      */
-    OperationName(final InternationalString operationName) {
+    OperationName(final String operationName) {
         this.operationName = operationName;
     }
 
     /**
      * Returns the operation name.
      */
-    @Override public InternationalString                      getOperationName()        
        {return operationName;}
+    @Override public String                                   getOperationName()        
        {return operationName;}
     @Override public InternationalString                      getInvocationName()       
        {return null;}
     @Override public InternationalString                      getOperationDescription() 
        {return null;}
     @Override public Collection<DistributedComputingPlatform> getDistributedComputingPlatforms()
{return Collections.emptySet();}
@@ -90,18 +89,16 @@ final class OperationName implements Ope
     static void resolve(final Collection<OperationMetadata> containsOperations, final
Collection<CoupledResource> coupledResources) {
         final Map<String,OperationMetadata> byName = new HashMap<>();
         for (final OperationMetadata operation : containsOperations) {
-            final InternationalString name = operation.getOperationName();
-            add(byName, name.toString(Locale.ROOT), operation);
-            add(byName, name.toString(/*default*/), operation);
+            add(byName, operation.getOperationName(), operation);
         }
         for (final CoupledResource resource : coupledResources) {
             if (resource instanceof DefaultCoupledResource) {
                 OperationMetadata operation = resource.getOperation();
                 if (operation instanceof OperationName) {
-                    final InternationalString name = operation.getOperationName();
-                    operation = byName.get(name.toString(Locale.ROOT));
+                    final String name = operation.getOperationName();
+                    operation = byName.get(name);
                     if (operation == null) {
-                        operation = byName.get(name.toString());
+                        operation = byName.get(name);
                         if (operation == null) {
                             continue;
                         }

Modified: sis/branches/JDK7/core/sis-metadata/src/test/java/org/apache/sis/metadata/MetadataTestCase.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-metadata/src/test/java/org/apache/sis/metadata/MetadataTestCase.java?rev=1617582&r1=1617581&r2=1617582&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-metadata/src/test/java/org/apache/sis/metadata/MetadataTestCase.java
[UTF-8] (original)
+++ sis/branches/JDK7/core/sis-metadata/src/test/java/org/apache/sis/metadata/MetadataTestCase.java
[UTF-8] Tue Aug 12 20:34:00 2014
@@ -79,9 +79,9 @@ public abstract strictfp class MetadataT
     @Override
     protected <T> Class<? extends T> getImplementation(final Class<T> type)
{
         assertTrue(standard.isMetadata(type));
-        final Class<?> impl = standard.getImplementation(type);
+        final Class<? extends T> impl = standard.getImplementation(type);
         assertNotNull(type.getName(), impl);
-        return impl.asSubclass(type);
+        return impl;
     }
 
     /**

Modified: sis/branches/JDK7/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/service/DefaultCoupledResourceTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/service/DefaultCoupledResourceTest.java?rev=1617582&r1=1617581&r2=1617582&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/service/DefaultCoupledResourceTest.java
[UTF-8] (original)
+++ sis/branches/JDK7/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/service/DefaultCoupledResourceTest.java
[UTF-8] Tue Aug 12 20:34:00 2014
@@ -21,7 +21,6 @@ import org.opengis.metadata.citation.Onl
 import org.opengis.metadata.service.CoupledResource;
 import org.opengis.metadata.service.DistributedComputingPlatform;
 import org.opengis.metadata.service.OperationMetadata;
-import org.apache.sis.util.iso.SimpleInternationalString;
 import org.apache.sis.xml.NilReason;
 import org.apache.sis.test.DependsOn;
 import org.apache.sis.test.TestCase;
@@ -74,7 +73,7 @@ public final strictfp class DefaultCoupl
         /*
          * If the name doesn't match, no replacement shall be done.
          */
-        final OperationName other = new OperationName(new SimpleInternationalString("Other"));
+        final OperationName other = new OperationName("Other");
         resource.setOperation(other);
         assertSame("Before resolve", other, resource.getOperation());
         OperationName.resolve(singleton(operation), singleton((CoupledResource) resource));

Modified: sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/util/Characters.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/util/Characters.java?rev=1617582&r1=1617581&r2=1617582&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/util/Characters.java [UTF-8]
(original)
+++ sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/util/Characters.java [UTF-8]
Tue Aug 12 20:34:00 2014
@@ -27,7 +27,7 @@ import org.apache.sis.util.resources.Err
  *
  * @author  Martin Desruisseaux (Geomatys)
  * @since   0.3 (derived from geotk-2.1)
- * @version 0.3
+ * @version 0.5
  * @module
  */
 public final class Characters extends Static {
@@ -97,6 +97,25 @@ public final class Characters extends St
     }
 
     /**
+     * Returns {@code true} if the given character is an hexadecimal digit.
+     * This method returns {@code true} if {@code c} is between {@code '0'} and {@code '9'}
inclusive,
+     * or between {@code 'A'} and {@code 'F'} inclusive, or between {@code 'a'} and {@code
'f'} inclusive.
+     *
+     * @param  c The character to test.
+     * @return {@code true} if the given character is an hexadecimal digit.
+     *
+     * @since 0.5
+     */
+    public static boolean isHexadecimal(int c) {
+        /*
+         * The &= ~32 is a cheap conversion of lower-case letters to upper-case letters.
+         * It is not a rigorous conversion since it does not check if 'c' is a letter,
+         * but for the purpose of this method it is okay.
+         */
+        return (c >= '0' && c <= '9') || ((c &= ~32) >= 'A' &&
c <= 'F');
+    }
+
+    /**
      * Determines whether the given character is a superscript. Most (but not all) superscripts
      * have a Unicode value in the [2070 … 207F] range. Superscripts are the following
symbols:
      *
@@ -115,7 +134,7 @@ public final class Characters extends St
             case '\u2071': // Would be the '¹', '²' and '³' values if they were declared
in the
             case '\u2072': // normal range. Since they are not, those values are unassigned.
             case '\u2073': return false;
-            default:       return (c>='⁰' && c<='ⁿ');
+            default:       return (c >= '⁰' && c <= 'ⁿ');
         }
     }
 
@@ -131,7 +150,7 @@ public final class Characters extends St
      * @return {@code true} if the given character is a subscript.
      */
     public static boolean isSubScript(final int c) {
-        return (c>='₀' && c<='₎');
+        return (c >= '₀' && c <= '₎');
     }
 
     /**

Modified: sis/branches/JDK7/core/sis-utility/src/test/java/org/apache/sis/util/CharactersTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-utility/src/test/java/org/apache/sis/util/CharactersTest.java?rev=1617582&r1=1617581&r2=1617582&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-utility/src/test/java/org/apache/sis/util/CharactersTest.java
[UTF-8] (original)
+++ sis/branches/JDK7/core/sis-utility/src/test/java/org/apache/sis/util/CharactersTest.java
[UTF-8] Tue Aug 12 20:34:00 2014
@@ -29,7 +29,7 @@ import static org.apache.sis.util.Charac
  *
  * @author  Martin Desruisseaux (Geomatys)
  * @since   0.3 (derived from geotk-3.00)
- * @version 0.3
+ * @version 0.5
  * @module
  */
 public final strictfp class CharactersTest extends TestCase {
@@ -58,6 +58,36 @@ public final strictfp class CharactersTe
     }
 
     /**
+     * Tests the {@link Characters#isHexadecimal()} method.
+     *
+     * @since 0.5
+     */
+    @Test
+    public void testIsHexadecimal() {
+        assertTrue(isHexadecimal('0'));
+        assertTrue(isHexadecimal('5'));
+        assertTrue(isHexadecimal('9'));
+        assertTrue(isHexadecimal('A'));
+        assertTrue(isHexadecimal('C'));
+        assertTrue(isHexadecimal('F'));
+        assertTrue(isHexadecimal('a'));
+        assertTrue(isHexadecimal('c'));
+        assertTrue(isHexadecimal('f'));
+
+        assertFalse(isHexadecimal(' '));
+        assertFalse(isHexadecimal('_'));
+        assertFalse(isHexadecimal(':'));
+        assertFalse(isHexadecimal('/'));
+        assertFalse(isHexadecimal('>'));
+        assertFalse(isHexadecimal('@'));
+        assertFalse(isHexadecimal('`'));
+        assertFalse(isHexadecimal('G'));
+        assertFalse(isHexadecimal('Q'));
+        assertFalse(isHexadecimal('g'));
+        assertFalse(isHexadecimal('q'));
+    }
+
+    /**
      * Tests {@link Characters#toSuperScript(char)}.
      */
     @Test



Mime
View raw message