You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sis.apache.org by de...@apache.org on 2013/12/26 07:04:00 UTC
svn commit: r1553457 [1/4] - in /sis/trunk: ./
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/test/java/org/apache/sis/metadata/iso/
core/sis-metadata/src/test...
Author: desruisseaux
Date: Thu Dec 26 06:03:57 2013
New Revision: 1553457
URL: http://svn.apache.org/r1553457
Log:
Merge from the JDK6 branch.
Added:
sis/trunk/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/DefaultIdentifierTest.java
- copied unchanged from r1553456, sis/branches/JDK6/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/DefaultIdentifierTest.java
sis/trunk/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/constraint/
- copied from r1553456, sis/branches/JDK6/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/constraint/
sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/internal/jaxb/referencing/CodeTest.java
- copied unchanged from r1553456, sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/internal/jaxb/referencing/CodeTest.java
sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/internal/referencing/ReferencingUtilitiesTest.java
- copied unchanged from r1553456, sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/internal/referencing/ReferencingUtilitiesTest.java
sis/trunk/core/sis-referencing/src/test/resources/org/apache/sis/referencing/datum/Clarke 1880.xml
- copied unchanged from r1553456, sis/branches/JDK6/core/sis-referencing/src/test/resources/org/apache/sis/referencing/datum/Clarke 1880.xml
sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/util/DefinitionURI.java
- copied unchanged from r1553456, sis/branches/JDK6/core/sis-utility/src/main/java/org/apache/sis/internal/util/DefinitionURI.java
sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/util/XPaths.java
- copied unchanged from r1553456, sis/branches/JDK6/core/sis-utility/src/main/java/org/apache/sis/internal/util/XPaths.java
sis/trunk/core/sis-utility/src/test/java/org/apache/sis/internal/util/DefinitionURITest.java
- copied unchanged from r1553456, sis/branches/JDK6/core/sis-utility/src/test/java/org/apache/sis/internal/util/DefinitionURITest.java
sis/trunk/core/sis-utility/src/test/java/org/apache/sis/internal/util/XPathsTest.java
- copied unchanged from r1553456, sis/branches/JDK6/core/sis-utility/src/test/java/org/apache/sis/internal/util/XPathsTest.java
Removed:
sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/internal/jaxb/referencing/RS_IdentifierSingleton.java
sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/internal/jaxb/referencing/RS_IdentifierTest.java
sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/util/URIParser.java
sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/Decorator.java
sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/Immutable.java
sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/ThreadSafe.java
sis/trunk/core/sis-utility/src/test/java/org/apache/sis/internal/util/URIParserTest.java
Modified:
sis/trunk/ (props changed)
sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/metadata/AbstractMetadata.java
sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/metadata/MetadataStandard.java
sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/metadata/ModifiableMetadata.java
sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/metadata/PropertyAccessor.java
sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/metadata/PropertyInformation.java
sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/DefaultIdentifier.java
sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/ISOMetadata.java
sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/ImmutableIdentifier.java
sis/trunk/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/DefaultMetadataTest.java
sis/trunk/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/ImmutableIdentifierTest.java
sis/trunk/core/sis-metadata/src/test/java/org/apache/sis/test/suite/MetadataTestSuite.java
sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/geometry/ImmutableEnvelope.java
sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/internal/jaxb/referencing/Code.java
sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/ReferencingUtilities.java
sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/AbstractIdentifiedObject.java
sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/AbstractReferenceSystem.java
sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/NamedIdentifier.java
sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/AbstractCS.java
sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/DefaultAffineCS.java
sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/DefaultCartesianCS.java
sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/DefaultCompoundCS.java
sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/DefaultCoordinateSystemAxis.java
sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/DefaultCylindricalCS.java
sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/DefaultEllipsoidalCS.java
sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/DefaultLinearCS.java
sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/DefaultPolarCS.java
sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/DefaultSphericalCS.java
sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/DefaultTimeCS.java
sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/DefaultUserDefinedCS.java
sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/DefaultVerticalCS.java
sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/DirectionAlongMeridian.java
sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/AbstractDatum.java
sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/DefaultEllipsoid.java
sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/DefaultEngineeringDatum.java
sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/DefaultGeodeticDatum.java
sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/DefaultImageDatum.java
sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/DefaultPrimeMeridian.java
sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/DefaultTemporalDatum.java
sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/DefaultVerticalDatum.java
sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/Sphere.java
sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/referencing/AbstractIdentifiedObjectTest.java
sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/referencing/datum/DatumTestCase.java
sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/referencing/datum/DefaultEllipsoidTest.java
sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/referencing/datum/DefaultPrimeMeridianTest.java
sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/test/suite/ReferencingTestSuite.java
sis/trunk/core/sis-referencing/src/test/resources/org/apache/sis/referencing/datum/Greenwich.xml
sis/trunk/core/sis-referencing/src/test/resources/org/apache/sis/referencing/datum/Paris.xml
sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/converter/AngleConverter.java
sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/converter/ArrayConverter.java
sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/converter/CharSequenceConverter.java
sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/converter/ClassPair.java
sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/converter/CollectionConverter.java
sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/converter/ConverterRegistry.java
sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/converter/DateConverter.java
sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/converter/FallbackConverter.java
sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/converter/IdentityConverter.java
sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/converter/NumberConverter.java
sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/converter/ObjectToString.java
sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/converter/PathConverter.java
sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/converter/StringConverter.java
sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/converter/SystemConverter.java
sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/converter/SystemRegistry.java
sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/simple/SimpleCharacterIterator.java
sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/simple/SimpleReferenceIdentifier.java
sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/util/CheckedArrayList.java
sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/util/CheckedHashSet.java
sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/util/Utilities.java
sis/trunk/core/sis-utility/src/main/java/org/apache/sis/io/Appender.java
sis/trunk/core/sis-utility/src/main/java/org/apache/sis/io/ClassFormat.java
sis/trunk/core/sis-utility/src/main/java/org/apache/sis/io/DefaultFormat.java
sis/trunk/core/sis-utility/src/main/java/org/apache/sis/io/LineAppender.java
sis/trunk/core/sis-utility/src/main/java/org/apache/sis/io/TableAppender.java
sis/trunk/core/sis-utility/src/main/java/org/apache/sis/measure/Angle.java
sis/trunk/core/sis-utility/src/main/java/org/apache/sis/measure/Latitude.java
sis/trunk/core/sis-utility/src/main/java/org/apache/sis/measure/Longitude.java
sis/trunk/core/sis-utility/src/main/java/org/apache/sis/measure/MeasurementRange.java
sis/trunk/core/sis-utility/src/main/java/org/apache/sis/measure/NumberRange.java
sis/trunk/core/sis-utility/src/main/java/org/apache/sis/measure/Range.java
sis/trunk/core/sis-utility/src/main/java/org/apache/sis/measure/SexagesimalConverter.java
sis/trunk/core/sis-utility/src/main/java/org/apache/sis/measure/Units.java
sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/CharSequences.java
sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/Version.java
sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/collection/Cache.java
sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/collection/CacheEntries.java
sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/collection/CodeListSet.java
sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/collection/DerivedIterator.java
sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/collection/DerivedMap.java
sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/collection/DerivedSet.java
sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/collection/WeakHashSet.java
sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/collection/WeakValueHashMap.java
sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/iso/AbstractName.java
sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/iso/DefaultInternationalString.java
sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/iso/DefaultLocalName.java
sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/iso/DefaultMemberName.java
sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/iso/DefaultNameFactory.java
sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/iso/DefaultNameSpace.java
sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/iso/DefaultRecordType.java
sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/iso/DefaultScopedName.java
sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/iso/DefaultTypeName.java
sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/iso/GlobalNameSpace.java
sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/iso/ResourceInternationalString.java
sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/iso/SimpleInternationalString.java
sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/logging/LoggerFactory.java
sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/logging/MonolineFormatter.java
sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/logging/WarningListeners.java
sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/resources/Errors.java
sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/resources/Errors.properties
sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/resources/Errors_fr.properties
sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/resources/IndexedResourceBundle.java
sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/resources/ResourceInternationalString.java
sis/trunk/core/sis-utility/src/main/java/org/apache/sis/xml/MarshallerPool.java
sis/trunk/core/sis-utility/src/main/java/org/apache/sis/xml/Namespaces.java
sis/trunk/core/sis-utility/src/main/java/org/apache/sis/xml/NilReason.java
sis/trunk/core/sis-utility/src/main/java/org/apache/sis/xml/OGCNamespacePrefixMapper.java
sis/trunk/core/sis-utility/src/main/java/org/apache/sis/xml/OGCNamespacePrefixMapper_Endorsed.java
sis/trunk/core/sis-utility/src/main/java/org/apache/sis/xml/PooledMarshaller.java
sis/trunk/core/sis-utility/src/main/java/org/apache/sis/xml/PooledUnmarshaller.java
sis/trunk/core/sis-utility/src/main/java/org/apache/sis/xml/XLink.java
sis/trunk/core/sis-utility/src/test/java/org/apache/sis/internal/util/CheckedArrayListTest.java
sis/trunk/core/sis-utility/src/test/java/org/apache/sis/io/EchoAppendable.java
sis/trunk/core/sis-utility/src/test/java/org/apache/sis/measure/UnitsTest.java
sis/trunk/core/sis-utility/src/test/java/org/apache/sis/test/XMLComparator.java
sis/trunk/core/sis-utility/src/test/java/org/apache/sis/test/suite/UtilityTestSuite.java
sis/trunk/storage/sis-netcdf/src/main/java/org/apache/sis/storage/netcdf/NetcdfStore.java
sis/trunk/storage/sis-netcdf/src/main/java/org/apache/sis/storage/netcdf/NetcdfStoreProvider.java
sis/trunk/storage/sis-storage/src/main/java/org/apache/sis/storage/DataStoreProvider.java
sis/trunk/storage/sis-storage/src/main/java/org/apache/sis/storage/DataStoreRegistry.java
Propchange: sis/trunk/
------------------------------------------------------------------------------
Merged /sis/branches/JDK7:r1552064-1553455
Merged /sis/branches/JDK6:r1552067-1553456
Modified: sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/metadata/AbstractMetadata.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/metadata/AbstractMetadata.java?rev=1553457&r1=1553456&r2=1553457&view=diff
==============================================================================
--- sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/metadata/AbstractMetadata.java [UTF-8] (original)
+++ sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/metadata/AbstractMetadata.java [UTF-8] Thu Dec 26 06:03:57 2013
@@ -63,6 +63,7 @@ import org.apache.sis.util.logging.Loggi
* </tr>
* </table>
*
+ * {@section Thread safety}
* Instances of this class are <strong>not</strong> synchronized for multi-threading.
* Synchronization, if needed, is caller's responsibility. Note that synchronization locks
* are not necessarily the metadata instances. For example an other common approach is to
Modified: sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/metadata/MetadataStandard.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/metadata/MetadataStandard.java?rev=1553457&r1=1553456&r2=1553457&view=diff
==============================================================================
--- sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/metadata/MetadataStandard.java [UTF-8] (original)
+++ sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/metadata/MetadataStandard.java [UTF-8] Thu Dec 26 06:03:57 2013
@@ -31,7 +31,6 @@ import org.opengis.metadata.ExtendedElem
import org.opengis.referencing.ReferenceIdentifier;
import org.apache.sis.util.Debug;
import org.apache.sis.util.Classes;
-import org.apache.sis.util.ThreadSafe;
import org.apache.sis.util.ComparisonMode;
import org.apache.sis.util.resources.Errors;
import org.apache.sis.util.collection.TreeTable;
@@ -81,6 +80,12 @@ import static org.apache.sis.util.Argume
* method must be overridden in a {@code MetadataStandard} subclass.</li>
* </ul>
*
+ * {@section Thread safety}
+ * The same {@code MetadataStandard} instance can be safely used by many threads without synchronization
+ * on the part of the caller. Subclasses shall make sure that any overridden methods remain safe to call
+ * from multiple threads, because the same {@code MetadataStandard} instances are typically referenced
+ * by a large amount of {@link ModifiableMetadata}.
+ *
* @author Martin Desruisseaux (Geomatys)
* @since 0.3 (derived from geotk-2.4)
* @version 0.3
@@ -88,7 +93,6 @@ import static org.apache.sis.util.Argume
*
* @see AbstractMetadata
*/
-@ThreadSafe
public class MetadataStandard implements Serializable {
/**
* For cross-version compatibility.
Modified: sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/metadata/ModifiableMetadata.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/metadata/ModifiableMetadata.java?rev=1553457&r1=1553456&r2=1553457&view=diff
==============================================================================
--- sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/metadata/ModifiableMetadata.java [UTF-8] (original)
+++ sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/metadata/ModifiableMetadata.java [UTF-8] Thu Dec 26 06:03:57 2013
@@ -25,7 +25,6 @@ import java.util.NoSuchElementException;
import java.lang.reflect.Modifier;
import javax.xml.bind.annotation.XmlTransient;
import org.opengis.util.CodeList;
-import org.apache.sis.util.ThreadSafe;
import org.apache.sis.util.logging.Logging;
import org.apache.sis.util.resources.Errors;
import org.apache.sis.util.collection.CodeListSet;
@@ -84,7 +83,6 @@ import static org.apache.sis.internal.ja
* @version 0.3
* @module
*/
-@ThreadSafe
@XmlTransient
public abstract class ModifiableMetadata extends AbstractMetadata implements Cloneable {
/**
Modified: sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/metadata/PropertyAccessor.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/metadata/PropertyAccessor.java?rev=1553457&r1=1553456&r2=1553457&view=diff
==============================================================================
--- sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/metadata/PropertyAccessor.java [UTF-8] (original)
+++ sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/metadata/PropertyAccessor.java [UTF-8] Thu Dec 26 06:03:57 2013
@@ -36,7 +36,6 @@ import org.apache.sis.util.Classes;
import org.apache.sis.util.Numbers;
import org.apache.sis.util.ArraysExt;
import org.apache.sis.util.Utilities;
-import org.apache.sis.util.ThreadSafe;
import org.apache.sis.util.Workaround;
import org.apache.sis.util.CharSequences;
import org.apache.sis.util.ComparisonMode;
@@ -76,12 +75,17 @@ import static org.apache.sis.util.collec
* XML marshalling.</li>
* </ul>
*
+ * {@section Thread safety}
+ * The same {@code PropertyAccessor} instance can be safely used by many threads without synchronization
+ * on the part of the caller. Subclasses shall make sure that any overridden methods remain safe to call
+ * from multiple threads, because the same {@code PropertyAccessor} instances are typically used by many
+ * {@link ModifiableMetadata} instances.
+ *
* @author Martin Desruisseaux (Geomatys)
* @since 0.3 (derived from geotk-2.4)
* @version 0.3
* @module
*/
-@ThreadSafe
class PropertyAccessor {
/**
* Getters shared between many instances of this class. Two different implementations
Modified: sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/metadata/PropertyInformation.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/metadata/PropertyInformation.java?rev=1553457&r1=1553456&r2=1553457&view=diff
==============================================================================
--- sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/metadata/PropertyInformation.java [UTF-8] (original)
+++ sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/metadata/PropertyInformation.java [UTF-8] Thu Dec 26 06:03:57 2013
@@ -32,7 +32,6 @@ import org.apache.sis.internal.simple.Si
import org.apache.sis.measure.ValueRange;
import org.apache.sis.util.iso.Types;
import org.apache.sis.util.Numbers;
-import org.apache.sis.util.Immutable;
import org.apache.sis.util.collection.CheckedContainer;
import org.apache.sis.util.logging.Logging;
@@ -48,6 +47,9 @@ import org.apache.sis.util.logging.Loggi
* for the property. If the information had a <code>contains(E)</code> method, it would
* return <code>true</code> if the given value is valid for that property.}
*
+ * {@section Immutability and thread safety}
+ * This final class is immutable and thus thread-safe.
+ *
* @param <E> The value type, either the method return type if not a collection,
* or the type of elements in the collection otherwise.
*
@@ -60,7 +62,6 @@ import org.apache.sis.util.logging.Loggi
* @see MetadataStandard#asInformationMap(Class, KeyNamePolicy)
* @see <a href="https://issues.apache.org/jira/browse/SIS-80">SIS-80</a>
*/
-@Immutable
final class PropertyInformation<E> extends SimpleReferenceIdentifier
implements ExtendedElementInformation, CheckedContainer<E>
{
@@ -113,8 +114,7 @@ final class PropertyInformation<E> exten
private Object domainValue;
/**
- * Creates a new {@code PropertyInformation} instance from the annotations on the given
- * getter method.
+ * Creates a new {@code PropertyInformation} instance from the annotations on the given getter method.
*
* @param standard The international standard that define the property, or {@code null} if none.
* @param property The property name as defined by the international {@code standard}.
Modified: sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/DefaultIdentifier.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/DefaultIdentifier.java?rev=1553457&r1=1553456&r2=1553457&view=diff
==============================================================================
--- sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/DefaultIdentifier.java [UTF-8] (original)
+++ sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/DefaultIdentifier.java [UTF-8] Thu Dec 26 06:03:57 2013
@@ -25,6 +25,43 @@ import org.opengis.metadata.citation.Cit
/**
* Value uniquely identifying an object within a namespace.
+ * One or more {@code Identifier} instances can be associated to some metadata objects like
+ * {@linkplain org.apache.sis.metadata.iso.acquisition.DefaultOperation operation},
+ * {@linkplain org.apache.sis.metadata.iso.acquisition.DefaultPlatform platform},
+ * {@linkplain org.apache.sis.metadata.iso.acquisition.DefaultInstrument instrument},
+ * {@linkplain org.apache.sis.metadata.iso.acquisition.DefaultEvent event},
+ * {@linkplain org.apache.sis.metadata.iso.lineage.DefaultProcessing processing},
+ * {@linkplain org.apache.sis.metadata.iso.lineage.DefaultSource source},
+ * {@linkplain org.apache.sis.metadata.iso.content.DefaultImageDescription image description},
+ * {@linkplain org.apache.sis.metadata.iso.extent.DefaultGeographicDescription geographic description}
+ * and more.
+ *
+ * <p>Referencing objects like
+ * {@linkplain org.apache.sis.referencing.cs.DefaultCoordinateSystemAxis coordinate system axis},
+ * {@linkplain org.apache.sis.referencing.datum.DefaultGeodeticDatum geodetic datum},
+ * {@linkplain org.apache.sis.referencing.crs.DefaultGeographicCRS geographic CRS} and more
+ * rather use an {@code Identifier} sub-interface, namely {@link org.opengis.referencing.ReferenceIdentifier}.
+ * The later is implemented in SIS by {@link ImmutableIdentifier}, which is a class unrelated to the usual
+ * {@code org.apache.metadata} hierarchy because of the immutable nature of referencing objects.</p>
+ *
+ * {@section Text, URN and XML representations}
+ * The XML representation of {@link DefaultIdentifier} is similar to the {@link ImmutableIdentifier}
+ * one except for the {@code "MD_"} prefix. Example:
+ *
+ * {@preformat xml
+ * <gmd:MD_Identifier>
+ * <gmd:code>
+ * <gco:CharacterString>4326</gco:CharacterString>
+ * </gmd:code>
+ * <gmd:authority>
+ * <gmd:CI_Citation>
+ * <gmd:title>
+ * <gco:CharacterString>EPSG</gco:CharacterString>
+ * </gmd:title>
+ * </gmd:CI_Citation>
+ * </gmd:authority>
+ * </gmd:MD_Identifier>
+ * }
*
* @author Martin Desruisseaux (IRD, Geomatys)
* @author Touraïvane (IRD)
Modified: sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/ISOMetadata.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/ISOMetadata.java?rev=1553457&r1=1553456&r2=1553457&view=diff
==============================================================================
--- sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/ISOMetadata.java [UTF-8] (original)
+++ sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/ISOMetadata.java [UTF-8] Thu Dec 26 06:03:57 2013
@@ -33,7 +33,6 @@ import org.apache.sis.metadata.Modifiabl
import org.apache.sis.internal.jaxb.IdentifierMapWithSpecialCases;
import org.apache.sis.util.logging.Logging;
import org.apache.sis.util.CharSequences;
-import org.apache.sis.util.ThreadSafe;
import static org.apache.sis.util.collection.Containers.isNullOrEmpty;
@@ -47,7 +46,6 @@ import static org.apache.sis.util.collec
* @version 0.3
* @module
*/
-@ThreadSafe
@XmlTransient
public class ISOMetadata extends ModifiableMetadata implements IdentifiedObject, Serializable {
/**
Modified: sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/ImmutableIdentifier.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/ImmutableIdentifier.java?rev=1553457&r1=1553456&r2=1553457&view=diff
==============================================================================
--- sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/ImmutableIdentifier.java [UTF-8] (original)
+++ sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/ImmutableIdentifier.java [UTF-8] Thu Dec 26 06:03:57 2013
@@ -26,7 +26,7 @@ import org.opengis.metadata.citation.Cit
import org.opengis.parameter.InvalidParameterValueException;
import org.opengis.referencing.ReferenceIdentifier;
import org.opengis.util.InternationalString;
-import org.apache.sis.util.Immutable;
+import org.apache.sis.util.Debug;
import org.apache.sis.util.Deprecable;
import org.apache.sis.util.resources.Errors;
import org.apache.sis.util.iso.Types;
@@ -47,19 +47,83 @@ import org.apache.sis.internal.jdk7.Obje
* This kind of identifier is primarily used for identification of
* {@link org.opengis.referencing.crs.CoordinateReferenceSystem} objects.
*
- * {@note While <code>ImmutableIdentifier</code> objects are immutable, they may contain references to
- * <code>Citation</code> and <code>InternationalString</code> objects which are not guaranteed
- * to be immutable. For better safety, factory codes are encouraged to pass only immutable
- * citations and immutable international strings to the constructors.}
*
- * @author Martin Desruisseaux (Geomatys)
+ * {@section Immutability and thread safety}
+ * This class is immutable and thus inherently thread-safe if the {@link Citation} and {@link InternationalString}
+ * arguments given to the constructor are also immutable. It is caller's responsibility to ensure that those
+ * conditions hold, for example by invoking {@link org.apache.sis.metadata.iso.citation.DefaultCitation#freeze()
+ * DefaultCitation.freeze()} before passing the arguments to the constructor.
+ * Subclasses shall make sure that any overridden methods remain safe to call from multiple threads and do not change
+ * any public {@code ImmutableIdentifier} state.
+ *
+ *
+ * {@section Text, URN and XML representations}
+ * Identifiers are represented in various ways depending on the context. In particular identifiers are
+ * marshalled differently depending on whether they appear in a metadata object or a referencing object.
+ * The following examples show an identifier for a Geographic Coordinate Reference System (CRS)
+ * identified by code 4326 in the "EPSG" code space:
+ *
+ * <ul><li><p><b><cite>Well Known Text</cite> (WKT) version 1</b></p>
+ * The WKT 1 format contains only the {@linkplain #getCodeSpace() code space} and the {@linkplain #getCode() code}.
+ * If there is no code space, then the {@linkplain #getAuthority() authority} abbreviation is used as a fallback.
+ * Example:
+ *
+ * {@preformat wkt
+ * AUTHORITY["EPSG", "4326"]
+ * }
+ *
+ * </li><li><p><b><cite>Well Known Text</cite> (WKT) version 2</b></p>
+ * The WKT 2 format contains the {@linkplain #getCodeSpace() code space}, the {@linkplain #getCode() code} and
+ * the {@linkplain #getVersion() version} if available. The WKT can optionally provides a {@code URI} element,
+ * which expresses the same information in a different way (the URN syntax is described in the next item below).
+ * Example:
+ *
+ * {@preformat wkt
+ * ID["EPSG", 4326, URI["urn:ogc:def:crs:EPSG::4326"]]
+ * }
+ *
+ * </li><li><p><b>XML in referencing objects</b></p>
+ * The <cite>Definition identifier URNs in OGC namespace</cite> paper defines a syntax for identifiers commonly
+ * found in Geographic Markup Language (GML) documents. Example:
+ *
+ * {@preformat xml
+ * <gml:identifier codeSpace="OGP">urn:ogc:def:crs:EPSG::4326</gml:identifier>
+ * }
+ *
+ * In Apache SIS, the GML {@code codeSpace} attribute - despite its name - is mapped to the identifier
+ * {@linkplain #getAuthority() authority}. The components of the URN value are mapped as below:
+ *
+ * <blockquote><code>
+ * urn:ogc:def:<type>:<{@linkplain #getCodeSpace() codespace}>:<{@linkplain #getVersion() version}>:<{@linkplain #getCode() code}>
+ * </code></blockquote>
+ *
+ * </li><li><p><b>XML in metadata objects</b></p>
+ * The XML representation of {@link ImmutableIdentifier} in a metadata is similar to the {@link DefaultIdentifier}
+ * one except for the {@code "RS_"} prefix:
+ *
+ * {@preformat xml
+ * <gmd:RS_Identifier>
+ * <gmd:code>
+ * <gco:CharacterString>4326</gco:CharacterString>
+ * </gmd:code>
+ * <gmd:authority>
+ * <gmd:CI_Citation>
+ * <gmd:title>
+ * <gco:CharacterString>EPSG</gco:CharacterString>
+ * </gmd:title>
+ * </gmd:CI_Citation>
+ * </gmd:authority>
+ * </gmd:RS_Identifier>
+ * }
+ * </li></ul>
+ *
+ * @author Martin Desruisseaux (Geomatys)
* @since 0.3 (derived from geotk-3.03)
* @version 0.4
* @module
*
* @see DefaultIdentifier
*/
-@Immutable
@XmlRootElement(name = "RS_Identifier")
public class ImmutableIdentifier implements ReferenceIdentifier, Deprecable, Serializable {
/**
@@ -461,6 +525,7 @@ public class ImmutableIdentifier impleme
/**
* Returns a string representation of this identifier.
+ * The string representation is mostly for debugging purpose and may change in any future SIS version.
* The default implementation returns a pseudo-WKT format.
*
* {@note The <code>NamedIdentifier</code> subclass overrides this method with a different behavior,
@@ -469,6 +534,7 @@ public class ImmutableIdentifier impleme
* @see org.apache.sis.referencing.IdentifiedObjects#toString(Identifier)
* @see org.apache.sis.referencing.NamedIdentifier#toString()
*/
+ @Debug
@Override
public String toString() {
return SimpleIdentifiedObject.toString("IDENTIFIER", authority, codeSpace, code, isDeprecated());
Modified: sis/trunk/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/DefaultMetadataTest.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/DefaultMetadataTest.java?rev=1553457&r1=1553456&r2=1553457&view=diff
==============================================================================
--- sis/trunk/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/DefaultMetadataTest.java [UTF-8] (original)
+++ sis/trunk/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/DefaultMetadataTest.java [UTF-8] Thu Dec 26 06:03:57 2013
@@ -16,10 +16,14 @@
*/
package org.apache.sis.metadata.iso;
+import java.util.logging.LogRecord;
+import javax.xml.bind.Unmarshaller;
import javax.xml.bind.JAXBException;
-import org.apache.sis.test.XMLTestCase;
-import org.apache.sis.xml.Namespaces;
import org.apache.sis.xml.XML;
+import org.apache.sis.xml.Namespaces;
+import org.apache.sis.xml.MarshallerPool;
+import org.apache.sis.util.logging.WarningListener;
+import org.apache.sis.test.XMLTestCase;
import org.junit.Test;
import static org.apache.sis.test.Assert.*;
@@ -36,7 +40,56 @@ import static org.apache.sis.test.Assert
* @version 0.4
* @module
*/
-public final strictfp class DefaultMetadataTest extends XMLTestCase {
+public final strictfp class DefaultMetadataTest extends XMLTestCase implements WarningListener<Object> {
+ /**
+ * The resource key for the message of the warning that occurred while unmarshalling a XML fragment,
+ * or {@code null} if none.
+ */
+ private Object resourceKey;
+
+ /**
+ * The parameter of the warning that occurred while unmarshalling a XML fragment, or {@code null} if none.
+ */
+ private Object[] parameters;
+
+ /**
+ * For internal {@code DefaultLegalConstraints} usage.
+ *
+ * @return {@code Object.class}.
+ */
+ @Override
+ public Class<Object> getSourceClass() {
+ return Object.class;
+ }
+
+ /**
+ * Invoked when a warning occurred while unmarshalling a test XML fragment. This method ensures that no other
+ * warning occurred before this method call (i.e. each test is allowed to cause at most one warning), then
+ * remember the warning parameters for verification by the test method.
+ *
+ * @param source Ignored.
+ * @param warning The warning.
+ */
+ @Override
+ public void warningOccured(final Object source, final LogRecord warning) {
+ assertNull(resourceKey);
+ assertNull(parameters);
+ assertNotNull(resourceKey = warning.getMessage());
+ assertNotNull(parameters = warning.getParameters());
+ }
+
+ /**
+ * Unmarshalls the given XML fragment.
+ */
+ private DefaultMetadata unmarshal(final String xml) throws JAXBException {
+ final MarshallerPool pool = getMarshallerPool();
+ final Unmarshaller unmarshaller = pool.acquireUnmarshaller();
+ unmarshaller.setProperty(XML.WARNING_LISTENER, this);
+ final Object c = unmarshal(unmarshaller, xml);
+ pool.recycle(unmarshaller);
+ return (DefaultMetadata) c;
+ }
+
/**
* Tests unmarshalling of a metadata having a collection that contains no element.
* This was used to cause a {@code NullPointerException} prior SIS-139 fix.
@@ -47,11 +100,18 @@ public final strictfp class DefaultMetad
*/
@Test
public void testEmptyCollection() throws JAXBException {
- final String xml =
+ final DefaultMetadata metadata = unmarshal(
"<gmd:MD_Metadata xmlns:gmd=\"" + Namespaces.GMD + "\">\n" +
" <gmd:contact/>\n" +
- "</gmd:MD_Metadata>";
- final DefaultMetadata metadata = (DefaultMetadata) XML.unmarshal(xml);
+ "</gmd:MD_Metadata>");
+ /*
+ * Verify metadata property.
+ */
assertTrue(metadata.getContacts().isEmpty());
+ /*
+ * Verify warning message emitted during unmarshalling.
+ */
+ assertEquals("warning", "NullCollectionElement_1", resourceKey);
+ assertArrayEquals("warning", new String[] {"CheckedArrayList<ResponsibleParty>"}, parameters);
}
}
Modified: sis/trunk/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/ImmutableIdentifierTest.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/ImmutableIdentifierTest.java?rev=1553457&r1=1553456&r2=1553457&view=diff
==============================================================================
--- sis/trunk/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/ImmutableIdentifierTest.java [UTF-8] (original)
+++ sis/trunk/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/ImmutableIdentifierTest.java [UTF-8] Thu Dec 26 06:03:57 2013
@@ -19,12 +19,14 @@ package org.apache.sis.metadata.iso;
import java.util.Map;
import java.util.HashMap;
import java.util.Locale;
+import javax.xml.bind.JAXBException;
import org.apache.sis.metadata.iso.citation.Citations;
import org.apache.sis.metadata.iso.citation.DefaultCitation;
import org.apache.sis.util.iso.SimpleInternationalString;
import org.apache.sis.test.DependsOnMethod;
import org.apache.sis.test.TestCase;
import org.opengis.test.Validators;
+import org.apache.sis.test.DependsOn;
import org.junit.Test;
import static org.junit.Assert.*;
@@ -36,9 +38,10 @@ import static org.opengis.referencing.Re
*
* @author Martin Desruisseaux (Geomatys)
* @since 0.3 (derived from geotk-2.2)
- * @version 0.3
+ * @version 0.4
* @module
*/
+@DependsOn(DefaultIdentifierTest.class)
public final strictfp class ImmutableIdentifierTest extends TestCase {
/**
* Returns the properties map to be used in argument to test methods.
@@ -153,4 +156,15 @@ public final strictfp class ImmutableIde
assertTrue(message, message.contains(AUTHORITY_KEY));
}
}
+
+ /**
+ * Test XML marshalling.
+ *
+ * @throws JAXBException Should never happen.
+ */
+ @Test
+ public void testMarshal() throws JAXBException {
+ final ImmutableIdentifier identifier = new ImmutableIdentifier(new DefaultCitation("EPSG"), null, "4326");
+ new DefaultIdentifierTest().testMarshal("RS_Identifier", identifier);
+ }
}
Modified: sis/trunk/core/sis-metadata/src/test/java/org/apache/sis/test/suite/MetadataTestSuite.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-metadata/src/test/java/org/apache/sis/test/suite/MetadataTestSuite.java?rev=1553457&r1=1553456&r2=1553457&view=diff
==============================================================================
--- sis/trunk/core/sis-metadata/src/test/java/org/apache/sis/test/suite/MetadataTestSuite.java [UTF-8] (original)
+++ sis/trunk/core/sis-metadata/src/test/java/org/apache/sis/test/suite/MetadataTestSuite.java [UTF-8] Thu Dec 26 06:03:57 2013
@@ -76,6 +76,8 @@ import org.junit.BeforeClass;
org.apache.sis.metadata.iso.quality.AbstractPositionalAccuracyTest.class,
org.apache.sis.metadata.iso.lineage.DefaultLineageTest.class,
org.apache.sis.metadata.iso.lineage.DefaultProcessStepTest.class,
+ org.apache.sis.metadata.iso.constraint.DefaultLegalConstraintsTest.class,
+ org.apache.sis.metadata.iso.DefaultIdentifierTest.class,
org.apache.sis.metadata.iso.ImmutableIdentifierTest.class,
org.apache.sis.metadata.iso.DefaultMetadataTest.class,
org.apache.sis.metadata.iso.CustomMetadataTest.class,
Modified: sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/geometry/ImmutableEnvelope.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/geometry/ImmutableEnvelope.java?rev=1553457&r1=1553456&r2=1553457&view=diff
==============================================================================
--- sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/geometry/ImmutableEnvelope.java [UTF-8] (original)
+++ sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/geometry/ImmutableEnvelope.java [UTF-8] Thu Dec 26 06:03:57 2013
@@ -27,7 +27,6 @@ import org.opengis.geometry.DirectPositi
import org.opengis.geometry.MismatchedDimensionException;
import org.opengis.referencing.crs.CoordinateReferenceSystem;
import org.opengis.metadata.extent.GeographicBoundingBox;
-import org.apache.sis.util.Immutable;
import static org.apache.sis.util.ArgumentChecks.ensureDimensionMatches;
@@ -37,10 +36,9 @@ import static org.apache.sis.util.Argume
* This class is final in order to ensure that the immutability contract can not be broken
* (assuming not using <cite>Java Native Interface</cite> or reflections).
*
- * {@note While <code>ImmutableEnvelope</code> objects are immutable, they contain references to
- * <code>CoordinateReferenceSystem</code> objects which are not guaranteed to be immutable.
- * For better safety, factory codes are encouraged to pass only immutable instances of
- * coordinate reference systems to the constructors.}
+ * {@section Immutability and thread safety}
+ * This final class is immutable and thus inherently thread-safe if the {@link CoordinateReferenceSystem}
+ * instance given to the constructor is immutable. This is usually the case in Apache SIS.
*
* @author Cédric Briançon (Geomatys)
* @author Martin Desruisseaux (IRD, Geomatys)
@@ -48,7 +46,6 @@ import static org.apache.sis.util.Argume
* @version 0.3
* @module
*/
-@Immutable
public final class ImmutableEnvelope extends ArrayEnvelope implements Serializable {
/**
* For cross-version compatibility.
Modified: sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/internal/jaxb/referencing/Code.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/internal/jaxb/referencing/Code.java?rev=1553457&r1=1553456&r2=1553457&view=diff
==============================================================================
--- sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/internal/jaxb/referencing/Code.java [UTF-8] (original)
+++ sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/internal/jaxb/referencing/Code.java [UTF-8] Thu Dec 26 06:03:57 2013
@@ -16,15 +16,17 @@
*/
package org.apache.sis.internal.jaxb.referencing;
+import javax.xml.bind.annotation.XmlType;
import javax.xml.bind.annotation.XmlValue;
import javax.xml.bind.annotation.XmlAttribute;
import org.opengis.metadata.citation.Citation;
import org.opengis.referencing.ReferenceIdentifier;
-import javax.xml.bind.annotation.XmlType;
-import org.apache.sis.internal.util.URIParser;
+import org.apache.sis.internal.util.DefinitionURI;
import org.apache.sis.metadata.iso.ImmutableIdentifier;
import org.apache.sis.metadata.iso.citation.Citations;
+import static org.apache.sis.internal.referencing.ReferencingUtilities.toURNType;
+
/**
* The {@code gml:CodeType}, which is made of a code space and a code value.
@@ -57,9 +59,9 @@ public final class Code {
String codeSpace;
/**
- * Empty constructor for JAXB only.
+ * Empty constructor for JAXB.
*/
- public Code() {
+ Code() {
}
/**
@@ -79,7 +81,7 @@ public final class Code {
if (codeSpace != null) {
buffer.append(codeSpace);
}
- codeSpace = buffer.append(URIParser.SEPARATOR).append(version).toString();
+ codeSpace = buffer.append(DefinitionURI.SEPARATOR).append(version).toString();
}
}
@@ -88,22 +90,24 @@ public final class Code {
* If the {@link #codeSpace} contains a semicolon, then the part after the last semicolon
* will be taken as the authority version number. This is for consistency with what the
* constructor does.
+ *
+ * @return The identifier, or {@code null} if none.
*/
- ReferenceIdentifier getIdentifier() {
+ public ReferenceIdentifier getIdentifier() {
String c = code;
if (c == null) {
return null;
}
Citation authority = null;
String version = null, cs = codeSpace;
- final URIParser parsed = URIParser.parse(c);
+ final DefinitionURI parsed = DefinitionURI.parse(c);
if (parsed != null) {
authority = Citations.fromName(cs); // May be null.
cs = parsed.authority;
version = parsed.version;
c = parsed.code;
} else if (cs != null) {
- final int s = cs.lastIndexOf(URIParser.SEPARATOR);
+ final int s = cs.lastIndexOf(DefinitionURI.SEPARATOR);
if (s >= 0) {
version = cs.substring(s+1);
cs = cs.substring(0, s);
@@ -112,4 +116,55 @@ public final class Code {
}
return new ImmutableIdentifier(authority, cs, c, version, null);
}
+
+ /**
+ * Returns a {@code <gml:identifier>} for the given identified object, or {@code null} if none.
+ * This method searches for the following identifiers, in preference order:
+ * <ul>
+ * <li>The first identifier having a code that begin with {@code "urn:"}.</li>
+ * <li>The first identifier having a code that begin with {@code "http:"}.</li>
+ * <li>The first identifier, converted to the {@code "urn:} syntax if possible.</li>
+ * </ul>
+ *
+ * @param type The type of the identified object.
+ * @param identifiers The object identifiers, or {@code null} if none.
+ * @return The {@code <gml:identifier>} as a {@code Code} instance, or {@code null} if none.
+ */
+ public static Code forIdentifiedObject(final Class<?> type, final Iterable<? extends ReferenceIdentifier> identifiers) {
+ if (identifiers != null) {
+ boolean isHTTP = false;
+ ReferenceIdentifier fallback = null;
+ for (final ReferenceIdentifier identifier : identifiers) {
+ final String code = identifier.getCode();
+ if (code == null) continue; // Paranoiac check.
+ if (code.regionMatches(true, 0, "urn:", 0, 4)) {
+ return new Code(identifier);
+ }
+ if (!isHTTP) {
+ isHTTP = code.regionMatches(true, 0, "http:", 0, 5);
+ if (isHTTP || fallback == null) {
+ fallback = identifier;
+ }
+ }
+ }
+ /*
+ * If no "urn:" or "http:" form has been found, try to create a "urn:" form from the first identifier.
+ * For example "EPSG:4326" may be converted to "urn:ogc:def:crs:EPSG:8.2:4326". If the first identifier
+ * can not be converted to a "urn:" form, then it will be returned as-is.
+ */
+ if (fallback != null) {
+ if (!isHTTP) {
+ final String urn = DefinitionURI.format(toURNType(type), fallback);
+ if (urn != null) {
+ final Code code = new Code();
+ code.codeSpace = Citations.getIdentifier(fallback.getAuthority());
+ code.code = urn;
+ return code;
+ }
+ }
+ return new Code(fallback);
+ }
+ }
+ return null;
+ }
}
Modified: sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/ReferencingUtilities.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/ReferencingUtilities.java?rev=1553457&r1=1553456&r2=1553457&view=diff
==============================================================================
--- sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/ReferencingUtilities.java [UTF-8] (original)
+++ sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/ReferencingUtilities.java [UTF-8] Thu Dec 26 06:03:57 2013
@@ -16,7 +16,12 @@
*/
package org.apache.sis.internal.referencing;
-import org.opengis.referencing.operation.Matrix;
+import org.opengis.parameter.*;
+import org.opengis.referencing.*;
+import org.opengis.referencing.cs.*;
+import org.opengis.referencing.crs.*;
+import org.opengis.referencing.datum.*;
+import org.opengis.referencing.operation.*;
import org.apache.sis.referencing.operation.matrix.MatrixSIS;
import org.apache.sis.util.Static;
@@ -35,6 +40,42 @@ import org.apache.sis.util.Static;
*/
public final class ReferencingUtilities extends Static {
/**
+ * Subtypes of {@link IdentifiedObject} for which a URN type is defined.
+ * For each interface at index <var>i</var>, the URN type is {@code URN_TYPES[i]}.
+ *
+ * <p>For performance reasons, most frequently used types should be first.</p>
+ */
+ private static final Class<?>[] TYPES = {
+ CoordinateReferenceSystem.class,
+ Datum.class,
+ Ellipsoid.class,
+ PrimeMeridian.class,
+ CoordinateSystem.class,
+ CoordinateSystemAxis.class,
+ CoordinateOperation.class,
+ OperationMethod.class,
+ ParameterDescriptor.class,
+ ReferenceSystem.class
+ };
+
+ /**
+ * The URN types for instances of {@link #TYPES}.
+ * See {@link org.apache.sis.internal.util.DefinitionURI} javadoc for a list of URN types.
+ */
+ private static final String[] URN_TYPES = {
+ "crs",
+ "datum",
+ "ellipsoid",
+ "meridian",
+ "cs",
+ "axis",
+ "coordinateOperation",
+ "method",
+ "parameter",
+ "referenceSystem"
+ };
+
+ /**
* Do not allow instantiation of this class.
*/
private ReferencingUtilities() {
@@ -56,4 +97,22 @@ public final class ReferencingUtilities
return matrix.getElement(row, column);
}
}
+
+ /**
+ * Returns the URN type for the given class, or {@code null} if unknown.
+ * See {@link org.apache.sis.internal.util.DefinitionURI} javadoc for a list of URN types.
+ *
+ * @param type The class for which to get the URN type.
+ * @return The URN type, or {@code null} if unknown.
+ *
+ * @see org.apache.sis.internal.util.DefinitionURI
+ */
+ public static String toURNType(final Class<?> type) {
+ for (int i=0; i<TYPES.length; i++) {
+ if (TYPES[i].isAssignableFrom(type)) {
+ return URN_TYPES[i];
+ }
+ }
+ return null;
+ }
}
Modified: sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/AbstractIdentifiedObject.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/AbstractIdentifiedObject.java?rev=1553457&r1=1553456&r2=1553457&view=diff
==============================================================================
--- sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/AbstractIdentifiedObject.java [UTF-8] (original)
+++ sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/AbstractIdentifiedObject.java [UTF-8] Thu Dec 26 06:03:57 2013
@@ -38,11 +38,10 @@ import org.opengis.referencing.ObjectFac
import org.opengis.referencing.AuthorityFactory;
import org.opengis.referencing.IdentifiedObject;
import org.opengis.referencing.ReferenceIdentifier;
-import org.apache.sis.internal.jaxb.referencing.RS_IdentifierSingleton;
+import org.apache.sis.internal.referencing.ReferencingUtilities;
+import org.apache.sis.internal.jaxb.referencing.Code;
import org.apache.sis.io.wkt.FormattableObject;
import org.apache.sis.xml.Namespaces;
-import org.apache.sis.util.Immutable;
-import org.apache.sis.util.ThreadSafe;
import org.apache.sis.util.Deprecable;
import org.apache.sis.util.ComparisonMode;
import org.apache.sis.util.LenientComparable;
@@ -54,6 +53,7 @@ import static org.apache.sis.util.Utilit
import static org.apache.sis.internal.util.CollectionsExt.nonNull;
import static org.apache.sis.internal.util.CollectionsExt.nonEmpty;
import static org.apache.sis.internal.util.CollectionsExt.immutableSet;
+import static org.apache.sis.internal.util.Utilities.appendUnicodeIdentifier;
// Related to JDK7
import org.apache.sis.internal.jdk7.Objects;
@@ -98,15 +98,20 @@ import org.apache.sis.internal.jdk7.Obje
* All other information are fetched from the database.</li>
* </ul>
*
+ * {@section Immutability and thread safety}
+ * This base class is immutable if the {@link Citation}, {@link ReferenceIdentifier}, {@link GenericName} and
+ * {@link InternationalString} instances given to the constructor are also immutable. Most SIS subclasses and
+ * related classes are immutable under similar conditions. This means that unless otherwise noted in the javadoc,
+ * {@code IdentifiedObject} instances created using only SIS factories and static constants can be shared by many
+ * objects and passed between threads without synchronization.
+ *
* @author Martin Desruisseaux (IRD, Geomatys)
* @since 0.4 (derived from geotk-1.2)
* @version 0.4
* @module
*/
-@Immutable
-@ThreadSafe
@XmlType(name="IdentifiedObjectType", propOrder={
- "identifiers",
+ "identifier",
"name", // This is 'names' on the JDK7 branch.
"remarks"
})
@@ -151,19 +156,18 @@ public class AbstractIdentifiedObject ex
* An identifier which references elsewhere the object's defining information.
* Alternatively an identifier by which this object can be referenced.
*
- * <p>We must be prepared to handle either null or an empty set for
- * "no identifiers" because we may get both on unmarshalling.</p>
+ * <p><b>Consider this field as final!</b>
+ * This field is modified only at unmarshalling time by {@link #setIdentifier(ReferenceIdentifier)}</p>
*
* @see #getIdentifiers()
+ * @see #getIdentifier()
*/
- @XmlElement(name = "identifier")
- @XmlJavaTypeAdapter(RS_IdentifierSingleton.class)
- private final Set<ReferenceIdentifier> identifiers;
+ private Set<ReferenceIdentifier> identifiers;
/**
* Comments on or information about this object, or {@code null} if none.
*/
- @XmlElement(name = "remarks")
+ @XmlElement
private final InternationalString remarks;
/**
@@ -353,8 +357,15 @@ public class AbstractIdentifiedObject ex
* regardless its authority. If no identifier is found, then the name is used.
* If no name is found (which should not occur for valid objects), then this method returns {@code null}.
*
- * <p>When an identifier has been found, this method returns the concatenation of its code space with its code,
- * <em>without separator</em>. For example this method may return {@code "EPSG4326"}, not {@code "EPSG:4326"}.</p>
+ * <p>If an identifier has been found, this method returns the concatenation of the following elements
+ * separated by hyphens:</p>
+ * <ul>
+ * <li>The code space in lower case, retaining only characters that are valid for Unicode identifiers.</li>
+ * <li>The object type as defined in OGC's URN (see {@link org.apache.sis.internal.util.DefinitionURI})</li>
+ * <li>The object code, retaining only characters that are valid for Unicode identifiers.</li>
+ * </ul>
+ *
+ * Example: {@code "epsg-crs-4326"}.
*
* <p>The returned ID needs to be unique only in the XML document being marshalled.
* Consecutive invocations of this method do not need to return the same value,
@@ -371,9 +382,10 @@ public class AbstractIdentifiedObject ex
*/
if (identifiers != null) {
for (final ReferenceIdentifier identifier : identifiers) {
- appendID(id, identifier.getCodeSpace());
- appendID(id, identifier.getCode());
- if (id.length() != 0) {
+ if (appendUnicodeIdentifier(id, '-', identifier.getCodeSpace(), ":", true) | // Really |, not ||
+ appendUnicodeIdentifier(id, '-', ReferencingUtilities.toURNType(getClass()), ":", false) |
+ appendUnicodeIdentifier(id, '-', identifier.getCode(), ":", true))
+ {
/*
* TODO: If we want to check for ID uniqueness or any other condition before to accept the ID,
* we would do that here. If the ID is rejected, then we just need to clear the buffer and let
@@ -381,43 +393,40 @@ public class AbstractIdentifiedObject ex
*/
return id.toString();
}
+ id.setLength(0); // Clear the buffer for an other try.
}
}
// In last ressort, append code without codespace since the name are often verbose.
- appendID(id, name.getCode());
- if (id.length() == 0) {
- return null;
- }
- return id.toString();
+ return appendUnicodeIdentifier(id, '-', name.getCode(), ":", false) ? id.toString() : null;
}
/**
- * Appends only the characters that are valid for a Unicode identifier.
+ * Returns a single element from the {@code Set<ReferenceIdentifier>} collection, or {@code null} if none.
+ * We have to define this method because ISO 19111 defines the {@code identifiers} property as a collection
+ * while GML 3.2 defines it as a singleton.
+ *
+ * <p>This method searches for the following identifiers, in preference order:</p>
+ * <ul>
+ * <li>The first identifier having a code that begin with {@code "urn:"}.</li>
+ * <li>The first identifier having a code that begin with {@code "http:"}.</li>
+ * <li>The first identifier, converted to the {@code "urn:} syntax if possible.</li>
+ * </ul>
*/
- private static void appendID(final StringBuilder buffer, final String text) {
- if (text != null) {
- for (int i=0; i<text.length();) {
- final int c = text.codePointAt(i);
- if (buffer.length() == 0 ? Character.isUnicodeIdentifierStart(c)
- : Character.isUnicodeIdentifierPart(c))
- {
- buffer.appendCodePoint(c);
- }
- i += Character.charCount(c);
- }
- }
+ @XmlElement(name = "identifier")
+ final Code getIdentifier() {
+ return Code.forIdentifiedObject(getClass(), identifiers);
}
/**
- * Returns the primary name by which this object is identified.
- *
- * @return The primary name.
- *
- * @see IdentifiedObjects#getName(IdentifiedObject, Citation)
+ * Invoked by JAXB at unmarshalling time for setting the identifier.
*/
- @Override
- public ReferenceIdentifier getName() {
- return name;
+ private void setIdentifier(final Code identifier) {
+ if (identifier != null) {
+ final ReferenceIdentifier id = identifier.getIdentifier();
+ if (id != null) {
+ identifiers = Collections.singleton(id);
+ }
+ }
}
/* -----------------------------------------------------------------------
@@ -438,6 +447,18 @@ public class AbstractIdentifiedObject ex
*/
/**
+ * Returns the primary name by which this object is identified.
+ *
+ * @return The primary name.
+ *
+ * @see IdentifiedObjects#getName(IdentifiedObject, Citation)
+ */
+ @Override
+ public ReferenceIdentifier getName() {
+ return name;
+ }
+
+ /**
* Returns alternative names by which this object is identified.
*
* @return The aliases, or an empty collection if there is none.
Modified: sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/AbstractReferenceSystem.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/AbstractReferenceSystem.java?rev=1553457&r1=1553456&r2=1553457&view=diff
==============================================================================
--- sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/AbstractReferenceSystem.java [UTF-8] (original)
+++ sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/AbstractReferenceSystem.java [UTF-8] Thu Dec 26 06:03:57 2013
@@ -24,7 +24,6 @@ import org.opengis.referencing.Reference
import org.opengis.referencing.ReferenceIdentifier;
import org.opengis.metadata.extent.Extent;
import org.apache.sis.util.ComparisonMode;
-import org.apache.sis.util.Immutable;
import org.apache.sis.util.iso.Types;
import static org.apache.sis.util.Utilities.deepEquals;
@@ -49,12 +48,18 @@ import org.apache.sis.internal.jdk7.Obje
* This class is conceptually <cite>abstract</cite>, even if it is technically possible to instantiate it.
* Typical applications should create instances of the most specific subclass prefixed by {@code Default} instead.
*
+ * {@section Immutability and thread safety}
+ * This base class is immutable and thus thread-safe if the property <em>values</em> (not necessarily the map itself)
+ * given to the constructor are also immutable. Most SIS subclasses and related classes are immutable under similar
+ * conditions. This means that unless otherwise noted in the javadoc, {@code ReferenceSystem} instances created using
+ * only SIS factories and static constants can be shared by many objects and passed between threads without
+ * synchronization.
+ *
* @author Martin Desruisseaux (IRD, Geomatys)
* @since 0.4 (derived from geotk-2.1)
* @version 0.4
* @module
*/
-@Immutable
public class AbstractReferenceSystem extends AbstractIdentifiedObject implements ReferenceSystem {
/**
* Serial number for inter-operability with different versions.
Modified: sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/NamedIdentifier.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/NamedIdentifier.java?rev=1553457&r1=1553456&r2=1553457&view=diff
==============================================================================
--- sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/NamedIdentifier.java [UTF-8] (original)
+++ sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/NamedIdentifier.java [UTF-8] Thu Dec 26 06:03:57 2013
@@ -33,7 +33,6 @@ import org.apache.sis.internal.system.De
import org.apache.sis.metadata.iso.citation.Citations;
import org.apache.sis.metadata.iso.ImmutableIdentifier;
import org.apache.sis.util.collection.WeakValueHashMap;
-import org.apache.sis.util.Immutable;
// Related to JDK7
import org.apache.sis.internal.jdk7.Objects;
@@ -64,12 +63,20 @@ import org.apache.sis.internal.jdk7.Obje
* as the name {@linkplain ScopedName#tip() tip}. Note that according ISO 19115, citation alternate titles often
* contains abbreviation (for example "DCW" as an alternative title for "<cite>Digital Chart of the World</cite>").
*
+ *
+ * {@section Immutability and thread safety}
+ * This class is immutable and thus inherently thread-safe if the {@link Citation} and {@link InternationalString}
+ * arguments given to the constructor are also immutable. It is caller's responsibility to ensure that those
+ * conditions hold, for example by invoking {@link org.apache.sis.metadata.iso.citation.DefaultCitation#freeze()
+ * DefaultCitation.freeze()} before passing the arguments to the constructor.
+ * Subclasses shall make sure that any overridden methods remain safe to call from multiple threads and do not change
+ * any public {@code NamedIdentifier} state.
+ *
* @author Martin Desruisseaux (IRD, Geomatys)
* @since 0.4 (derived from geotk-2.0)
* @version 0.4
* @module
*/
-@Immutable
public class NamedIdentifier extends ImmutableIdentifier implements GenericName {
/**
* Serial number for inter-operability with different versions.
Modified: sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/AbstractCS.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/AbstractCS.java?rev=1553457&r1=1553456&r2=1553457&view=diff
==============================================================================
--- sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/AbstractCS.java [UTF-8] (original)
+++ sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/AbstractCS.java [UTF-8] Thu Dec 26 06:03:57 2013
@@ -31,7 +31,6 @@ import org.opengis.referencing.cs.Coordi
import org.apache.sis.referencing.AbstractIdentifiedObject;
import org.apache.sis.internal.referencing.AxisDirections;
import org.apache.sis.io.wkt.Formatter;
-import org.apache.sis.util.Immutable;
import org.apache.sis.util.ComparisonMode;
import org.apache.sis.util.resources.Errors;
@@ -51,6 +50,13 @@ import static org.apache.sis.util.Utilit
* (e.g. in a {@code LOCAL_CS} element). In such exceptional situation, a plain {@code AbstractCS} object may be
* instantiated.</p>
*
+ * {@section Immutability and thread safety}
+ * This base class is immutable and thus thread-safe if the property <em>values</em> (not necessarily the map itself)
+ * and the {@link CoordinateSystemAxis} instances given to the constructor are also immutable. Most SIS subclasses and
+ * related classes are immutable under similar conditions. This means that unless otherwise noted in the javadoc,
+ * {@code CoordinateSystem} instances created using only SIS factories and static constants can be shared by many
+ * objects and passed between threads without synchronization.
+ *
* @author Martin Desruisseaux (IRD, Geomatys)
* @since 0.4 (derived from geotk-2.0)
* @version 0.4
@@ -59,7 +65,6 @@ import static org.apache.sis.util.Utilit
* @see DefaultCoordinateSystemAxis
* @see org.apache.sis.referencing.crs.AbstractCRS
*/
-@Immutable
public class AbstractCS extends AbstractIdentifiedObject implements CoordinateSystem {
/**
* Serial number for inter-operability with different versions.
Modified: sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/DefaultAffineCS.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/DefaultAffineCS.java?rev=1553457&r1=1553456&r2=1553457&view=diff
==============================================================================
--- sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/DefaultAffineCS.java [UTF-8] (original)
+++ sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/DefaultAffineCS.java [UTF-8] Thu Dec 26 06:03:57 2013
@@ -24,7 +24,6 @@ import org.opengis.referencing.cs.AxisDi
import org.opengis.referencing.cs.CoordinateSystemAxis;
import org.apache.sis.internal.referencing.AxisDirections;
import org.apache.sis.measure.Units;
-import org.apache.sis.util.Immutable;
import org.apache.sis.util.ComparisonMode;
@@ -42,12 +41,17 @@ import org.apache.sis.util.ComparisonMod
* <td>unspecified</td>
* </tr></table>
*
+ * {@section Immutability and thread safety}
+ * This class is immutable and thus thread-safe if the property <em>values</em> (not necessarily the map itself)
+ * and the {@link CoordinateSystemAxis} instances given to the constructor are also immutable. Unless otherwise
+ * noted in the javadoc, this condition holds if all components were created using only SIS factories and static
+ * constants.
+ *
* @author Martin Desruisseaux (IRD, Geomatys)
* @since 0.4 (derived from geotk-2.0)
* @version 0.4
* @module
*/
-@Immutable
public class DefaultAffineCS extends AbstractCS implements AffineCS {
/**
* Serial number for inter-operability with different versions.
Modified: sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/DefaultCartesianCS.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/DefaultCartesianCS.java?rev=1553457&r1=1553456&r2=1553457&view=diff
==============================================================================
--- sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/DefaultCartesianCS.java [UTF-8] (original)
+++ sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/DefaultCartesianCS.java [UTF-8] Thu Dec 26 06:03:57 2013
@@ -23,7 +23,6 @@ import org.opengis.referencing.cs.Coordi
import org.apache.sis.internal.referencing.Formulas;
import org.apache.sis.util.resources.Errors;
import org.apache.sis.util.ComparisonMode;
-import org.apache.sis.util.Immutable;
/**
@@ -47,12 +46,17 @@ import org.apache.sis.util.Immutable;
* <td>unspecified</td>
* </tr></table>
*
+ * {@section Immutability and thread safety}
+ * This class is immutable and thus thread-safe if the property <em>values</em> (not necessarily the map itself)
+ * and the {@link CoordinateSystemAxis} instances given to the constructor are also immutable. Unless otherwise
+ * noted in the javadoc, this condition holds if all components were created using only SIS factories and static
+ * constants.
+ *
* @author Martin Desruisseaux (IRD, Geomatys)
* @since 0.4 (derived from geotk-2.0)
* @version 0.4
* @module
*/
-@Immutable
public class DefaultCartesianCS extends DefaultAffineCS implements CartesianCS {
/**
* Serial number for inter-operability with different versions.
Modified: sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/DefaultCompoundCS.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/DefaultCompoundCS.java?rev=1553457&r1=1553456&r2=1553457&view=diff
==============================================================================
--- sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/DefaultCompoundCS.java [UTF-8] (original)
+++ sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/DefaultCompoundCS.java [UTF-8] Thu Dec 26 06:03:57 2013
@@ -23,7 +23,6 @@ import org.opengis.referencing.cs.Coordi
import org.apache.sis.internal.util.UnmodifiableArrayList;
import org.apache.sis.util.ComparisonMode;
import org.apache.sis.util.Workaround;
-import org.apache.sis.util.Immutable;
import static java.util.Collections.singletonMap;
import static org.apache.sis.util.ArgumentChecks.*;
@@ -41,12 +40,17 @@ import static org.apache.sis.util.Utilit
* <td>(not applicable)</td>
* </tr></table>
*
+ * {@section Immutability and thread safety}
+ * This class is immutable and thus thread-safe if the property <em>values</em> (not necessarily the map itself)
+ * and the {@link CoordinateSystemAxis} instances given to the constructor are also immutable. Unless otherwise
+ * noted in the javadoc, this condition holds if all components were created using only SIS factories and static
+ * constants.
+ *
* @author Martin Desruisseaux (IRD, Geomatys)
* @since 0.4 (derived from geotk-2.0)
* @version 0.4
* @module
*/
-@Immutable
public class DefaultCompoundCS extends AbstractCS {
/**
* Serial number for inter-operability with different versions.
Modified: sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/DefaultCoordinateSystemAxis.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/DefaultCoordinateSystemAxis.java?rev=1553457&r1=1553456&r2=1553457&view=diff
==============================================================================
--- sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/DefaultCoordinateSystemAxis.java [UTF-8] (original)
+++ sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/DefaultCoordinateSystemAxis.java [UTF-8] Thu Dec 26 06:03:57 2013
@@ -37,7 +37,6 @@ import org.apache.sis.referencing.Identi
import org.apache.sis.measure.Longitude;
import org.apache.sis.measure.Latitude;
import org.apache.sis.measure.Units;
-import org.apache.sis.util.Immutable;
import org.apache.sis.util.ComparisonMode;
import org.apache.sis.util.resources.Errors;
import org.apache.sis.internal.util.Numerics;
@@ -61,6 +60,11 @@ import org.apache.sis.internal.jdk7.Obje
* with a {@link org.opengis.referencing.crs.GeographicCRS}. Conversely, these names shall not be used
* in any other context. See the GeoAPI {@link CoordinateSystemAxis} javadoc for more information.
*
+ * {@section Immutability and thread safety}
+ * This class is immutable and thus thread-safe if the property <em>values</em> (not necessarily the map itself)
+ * given to the constructor are also immutable. Unless otherwise noted in the javadoc, this condition holds if all
+ * components were created using only SIS factories and static constants.
+ *
* @author Martin Desruisseaux (IRD, Geomatys)
* @since 0.4 (derived from geotk-2.0)
* @version 0.4
@@ -69,7 +73,6 @@ import org.apache.sis.internal.jdk7.Obje
* @see AbstractCS
* @see Unit
*/
-@Immutable
public class DefaultCoordinateSystemAxis extends AbstractIdentifiedObject implements CoordinateSystemAxis {
/**
* Serial number for inter-operability with different versions.
Modified: sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/DefaultCylindricalCS.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/DefaultCylindricalCS.java?rev=1553457&r1=1553456&r2=1553457&view=diff
==============================================================================
--- sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/DefaultCylindricalCS.java [UTF-8] (original)
+++ sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/DefaultCylindricalCS.java [UTF-8] Thu Dec 26 06:03:57 2013
@@ -23,7 +23,6 @@ import org.opengis.referencing.cs.AxisDi
import org.opengis.referencing.cs.CoordinateSystemAxis;
import org.apache.sis.internal.referencing.AxisDirections;
import org.apache.sis.util.ComparisonMode;
-import org.apache.sis.util.Immutable;
import org.apache.sis.measure.Units;
@@ -39,6 +38,12 @@ import org.apache.sis.measure.Units;
* <td>unspecified</td>
* </tr></table>
*
+ * {@section Immutability and thread safety}
+ * This class is immutable and thus thread-safe if the property <em>values</em> (not necessarily the map itself)
+ * and the {@link CoordinateSystemAxis} instances given to the constructor are also immutable. Unless otherwise
+ * noted in the javadoc, this condition holds if all components were created using only SIS factories and static
+ * constants.
+ *
* @author Martin Desruisseaux (IRD, Geomatys)
* @since 0.4 (derived from geotk-2.0)
* @version 0.4
@@ -46,7 +51,6 @@ import org.apache.sis.measure.Units;
*
* @see DefaultPolarCS
*/
-@Immutable
public class DefaultCylindricalCS extends AbstractCS implements CylindricalCS {
/**
* Serial number for inter-operability with different versions.
Modified: sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/DefaultEllipsoidalCS.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/DefaultEllipsoidalCS.java?rev=1553457&r1=1553456&r2=1553457&view=diff
==============================================================================
--- sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/DefaultEllipsoidalCS.java [UTF-8] (original)
+++ sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/DefaultEllipsoidalCS.java [UTF-8] Thu Dec 26 06:03:57 2013
@@ -23,7 +23,6 @@ import org.opengis.referencing.cs.AxisDi
import org.opengis.referencing.cs.CoordinateSystemAxis;
import org.apache.sis.internal.referencing.AxisDirections;
import org.apache.sis.util.ComparisonMode;
-import org.apache.sis.util.Immutable;
import org.apache.sis.measure.Units;
@@ -41,12 +40,17 @@ import org.apache.sis.measure.Units;
* <td>unspecified</td>
* </tr></table>
*
+ * {@section Immutability and thread safety}
+ * This class is immutable and thus thread-safe if the property <em>values</em> (not necessarily the map itself)
+ * and the {@link CoordinateSystemAxis} instances given to the constructor are also immutable. Unless otherwise
+ * noted in the javadoc, this condition holds if all components were created using only SIS factories and static
+ * constants.
+ *
* @author Martin Desruisseaux (IRD, Geomatys)
* @since 0.4 (derived from geotk-2.0)
* @version 0.4
* @module
*/
-@Immutable
public class DefaultEllipsoidalCS extends AbstractCS implements EllipsoidalCS {
/**
* Serial number for inter-operability with different versions.
Modified: sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/DefaultLinearCS.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/DefaultLinearCS.java?rev=1553457&r1=1553456&r2=1553457&view=diff
==============================================================================
--- sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/DefaultLinearCS.java [UTF-8] (original)
+++ sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/DefaultLinearCS.java [UTF-8] Thu Dec 26 06:03:57 2013
@@ -24,7 +24,6 @@ import org.opengis.referencing.cs.Coordi
import org.apache.sis.internal.referencing.AxisDirections;
import org.apache.sis.measure.Units;
import org.apache.sis.util.ComparisonMode;
-import org.apache.sis.util.Immutable;
/**
@@ -40,12 +39,17 @@ import org.apache.sis.util.Immutable;
* <td>unspecified</td>
* </tr></table>
*
+ * {@section Immutability and thread safety}
+ * This class is immutable and thus thread-safe if the property <em>values</em> (not necessarily the map itself)
+ * and the {@link CoordinateSystemAxis} instances given to the constructor are also immutable. Unless otherwise
+ * noted in the javadoc, this condition holds if all components were created using only SIS factories and static
+ * constants.
+ *
* @author Martin Desruisseaux (IRD, Geomatys)
* @since 0.4 (derived from geotk-2.0)
* @version 0.4
* @module
*/
-@Immutable
public class DefaultLinearCS extends AbstractCS implements LinearCS {
/**
* Serial number for inter-operability with different versions.
Modified: sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/DefaultPolarCS.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/DefaultPolarCS.java?rev=1553457&r1=1553456&r2=1553457&view=diff
==============================================================================
--- sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/DefaultPolarCS.java [UTF-8] (original)
+++ sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/DefaultPolarCS.java [UTF-8] Thu Dec 26 06:03:57 2013
@@ -24,7 +24,6 @@ import org.opengis.referencing.cs.Coordi
import org.apache.sis.internal.referencing.AxisDirections;
import org.apache.sis.measure.Units;
import org.apache.sis.util.ComparisonMode;
-import org.apache.sis.util.Immutable;
/**
@@ -39,12 +38,17 @@ import org.apache.sis.util.Immutable;
* <td>unspecified</td>
* </tr></table>
*
+ * {@section Immutability and thread safety}
+ * This class is immutable and thus thread-safe if the property <em>values</em> (not necessarily the map itself)
+ * and the {@link CoordinateSystemAxis} instances given to the constructor are also immutable. Unless otherwise
+ * noted in the javadoc, this condition holds if all components were created using only SIS factories and static
+ * constants.
+ *
* @author Martin Desruisseaux (IRD, Geomatys)
* @since 0.4 (derived from geotk-2.0)
* @version 0.4
* @module
*/
-@Immutable
public class DefaultPolarCS extends AbstractCS implements PolarCS {
/**
* Serial number for inter-operability with different versions.
Modified: sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/DefaultSphericalCS.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/DefaultSphericalCS.java?rev=1553457&r1=1553456&r2=1553457&view=diff
==============================================================================
--- sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/DefaultSphericalCS.java [UTF-8] (original)
+++ sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/DefaultSphericalCS.java [UTF-8] Thu Dec 26 06:03:57 2013
@@ -23,7 +23,6 @@ import org.opengis.referencing.cs.AxisDi
import org.opengis.referencing.cs.CoordinateSystemAxis;
import org.apache.sis.internal.referencing.AxisDirections;
import org.apache.sis.util.ComparisonMode;
-import org.apache.sis.util.Immutable;
import org.apache.sis.measure.Units;
@@ -43,12 +42,17 @@ import org.apache.sis.measure.Units;
* <td>unspecified</td>
* </tr></table>
*
+ * {@section Immutability and thread safety}
+ * This class is immutable and thus thread-safe if the property <em>values</em> (not necessarily the map itself)
+ * and the {@link CoordinateSystemAxis} instances given to the constructor are also immutable. Unless otherwise
+ * noted in the javadoc, this condition holds if all components were created using only SIS factories and static
+ * constants.
+ *
* @author Martin Desruisseaux (IRD, Geomatys)
* @since 0.4 (derived from geotk-2.0)
* @version 0.4
* @module
*/
-@Immutable
public class DefaultSphericalCS extends AbstractCS implements SphericalCS {
/**
* Serial number for inter-operability with different versions.
Modified: sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/DefaultTimeCS.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/DefaultTimeCS.java?rev=1553457&r1=1553456&r2=1553457&view=diff
==============================================================================
--- sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/DefaultTimeCS.java [UTF-8] (original)
+++ sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/DefaultTimeCS.java [UTF-8] Thu Dec 26 06:03:57 2013
@@ -24,7 +24,6 @@ import org.opengis.referencing.cs.AxisDi
import org.opengis.referencing.cs.CoordinateSystemAxis;
import org.apache.sis.internal.referencing.AxisDirections;
import org.apache.sis.util.ComparisonMode;
-import org.apache.sis.util.Immutable;
import org.apache.sis.measure.Units;
@@ -39,12 +38,17 @@ import org.apache.sis.measure.Units;
* <td>unspecified</td>
* </tr></table>
*
+ * {@section Immutability and thread safety}
+ * This class is immutable and thus thread-safe if the property <em>values</em> (not necessarily the map itself)
+ * and the {@link CoordinateSystemAxis} instances given to the constructor are also immutable. Unless otherwise
+ * noted in the javadoc, this condition holds if all components were created using only SIS factories and static
+ * constants.
+ *
* @author Martin Desruisseaux (IRD, Geomatys)
* @since 0.4 (derived from geotk-2.0)
* @version 0.4
* @module
*/
-@Immutable
public class DefaultTimeCS extends AbstractCS implements TimeCS {
/**
* Serial number for inter-operability with different versions.
Modified: sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/DefaultUserDefinedCS.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/DefaultUserDefinedCS.java?rev=1553457&r1=1553456&r2=1553457&view=diff
==============================================================================
--- sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/DefaultUserDefinedCS.java [UTF-8] (original)
+++ sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/DefaultUserDefinedCS.java [UTF-8] Thu Dec 26 06:03:57 2013
@@ -20,18 +20,22 @@ import java.util.Map;
import org.opengis.referencing.cs.UserDefinedCS;
import org.opengis.referencing.cs.CoordinateSystemAxis;
import org.apache.sis.util.ComparisonMode;
-import org.apache.sis.util.Immutable;
/**
* A 2- or 3-dimensional coordinate system for any combination of coordinate axes not covered by other CS types.
*
+ * {@section Immutability and thread safety}
+ * This class is immutable and thus thread-safe if the property <em>values</em> (not necessarily the map itself)
+ * and the {@link CoordinateSystemAxis} instances given to the constructor are also immutable. Unless otherwise
+ * noted in the javadoc, this condition holds if all components were created using only SIS factories and static
+ * constants.
+ *
* @author Martin Desruisseaux (IRD, Geomatys)
* @since 0.4 (derived from geotk-2.0)
* @version 0.4
* @module
*/
-@Immutable
public class DefaultUserDefinedCS extends AbstractCS implements UserDefinedCS {
/**
* Serial number for inter-operability with different versions.
Modified: sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/DefaultVerticalCS.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/DefaultVerticalCS.java?rev=1553457&r1=1553456&r2=1553457&view=diff
==============================================================================
--- sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/DefaultVerticalCS.java [UTF-8] (original)
+++ sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/DefaultVerticalCS.java [UTF-8] Thu Dec 26 06:03:57 2013
@@ -23,7 +23,6 @@ import org.opengis.referencing.cs.AxisDi
import org.opengis.referencing.cs.CoordinateSystemAxis;
import org.apache.sis.internal.referencing.AxisDirections;
import org.apache.sis.util.ComparisonMode;
-import org.apache.sis.util.Immutable;
/**
@@ -51,12 +50,17 @@ import org.apache.sis.util.Immutable;
* <td>unspecified</td>
* </tr></table>
*
+ * {@section Immutability and thread safety}
+ * This class is immutable and thus thread-safe if the property <em>values</em> (not necessarily the map itself)
+ * and the {@link CoordinateSystemAxis} instances given to the constructor are also immutable. Unless otherwise
+ * noted in the javadoc, this condition holds if all components were created using only SIS factories and static
+ * constants.
+ *
* @author Martin Desruisseaux (IRD, Geomatys)
* @since 0.4 (derived from geotk-2.0)
* @version 0.4
* @module
*/
-@Immutable
public class DefaultVerticalCS extends AbstractCS implements VerticalCS {
/**
* Serial number for inter-operability with different versions.