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/04/03 18:00:30 UTC
svn commit: r1464085 [1/2] - in /sis/trunk: ./
sis-metadata/src/main/java/org/apache/sis/internal/geoapi/
sis-metadata/src/main/java/org/apache/sis/internal/geoapi/temporal/
sis-metadata/src/main/java/org/apache/sis/internal/jaxb/geometry/
sis-metadata...
Author: desruisseaux
Date: Wed Apr 3 16:00:28 2013
New Revision: 1464085
URL: http://svn.apache.org/r1464085
Log:
Merge from the JDK6 branch.
Added:
sis/trunk/sis-metadata/src/main/java/org/apache/sis/internal/geoapi/
sis/trunk/sis-metadata/src/main/java/org/apache/sis/internal/geoapi/temporal/
sis/trunk/sis-metadata/src/main/java/org/apache/sis/internal/geoapi/temporal/Instant.java (with props)
sis/trunk/sis-metadata/src/main/java/org/apache/sis/internal/geoapi/temporal/Period.java (with props)
sis/trunk/sis-metadata/src/main/java/org/apache/sis/internal/geoapi/temporal/Position.java (with props)
sis/trunk/sis-metadata/src/main/java/org/apache/sis/internal/geoapi/temporal/package-info.java (with props)
sis/trunk/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/geometry/
- copied from r1463928, sis/branches/JDK6/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/geometry/
sis/trunk/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/gmi/
- copied from r1463928, sis/branches/JDK6/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/gmi/
sis/trunk/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/gts/
- copied from r1463928, sis/branches/JDK6/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/gts/
sis/trunk/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/metadata/
- copied from r1463928, sis/branches/JDK6/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/metadata/
sis/trunk/sis-metadata/src/main/java/org/apache/sis/internal/metadata/ExcludedSet.java
- copied unchanged from r1463928, sis/branches/JDK6/sis-metadata/src/main/java/org/apache/sis/internal/metadata/ExcludedSet.java
sis/trunk/sis-metadata/src/main/java/org/apache/sis/internal/metadata/MetadataUtilities.java
- copied unchanged from r1463928, sis/branches/JDK6/sis-metadata/src/main/java/org/apache/sis/internal/metadata/MetadataUtilities.java
sis/trunk/sis-metadata/src/main/java/org/apache/sis/internal/metadata/ReferencingServices.java
- copied unchanged from r1463928, sis/branches/JDK6/sis-metadata/src/main/java/org/apache/sis/internal/metadata/ReferencingServices.java
sis/trunk/sis-metadata/src/main/java/org/apache/sis/metadata/iso/DefaultApplicationSchemaInformation.java
- copied unchanged from r1463928, sis/branches/JDK6/sis-metadata/src/main/java/org/apache/sis/metadata/iso/DefaultApplicationSchemaInformation.java
sis/trunk/sis-metadata/src/main/java/org/apache/sis/metadata/iso/DefaultExtendedElementInformation.java
- copied unchanged from r1463928, sis/branches/JDK6/sis-metadata/src/main/java/org/apache/sis/metadata/iso/DefaultExtendedElementInformation.java
sis/trunk/sis-metadata/src/main/java/org/apache/sis/metadata/iso/DefaultFeatureTypeList.java
- copied unchanged from r1463928, sis/branches/JDK6/sis-metadata/src/main/java/org/apache/sis/metadata/iso/DefaultFeatureTypeList.java
sis/trunk/sis-metadata/src/main/java/org/apache/sis/metadata/iso/DefaultIdentifier.java
- copied unchanged from r1463928, sis/branches/JDK6/sis-metadata/src/main/java/org/apache/sis/metadata/iso/DefaultIdentifier.java
sis/trunk/sis-metadata/src/main/java/org/apache/sis/metadata/iso/DefaultMetadata.java
- copied unchanged from r1463928, sis/branches/JDK6/sis-metadata/src/main/java/org/apache/sis/metadata/iso/DefaultMetadata.java
sis/trunk/sis-metadata/src/main/java/org/apache/sis/metadata/iso/DefaultMetadataExtensionInformation.java
- copied unchanged from r1463928, sis/branches/JDK6/sis-metadata/src/main/java/org/apache/sis/metadata/iso/DefaultMetadataExtensionInformation.java
sis/trunk/sis-metadata/src/main/java/org/apache/sis/metadata/iso/DefaultPortrayalCatalogueReference.java
- copied unchanged from r1463928, sis/branches/JDK6/sis-metadata/src/main/java/org/apache/sis/metadata/iso/DefaultPortrayalCatalogueReference.java
sis/trunk/sis-metadata/src/main/java/org/apache/sis/metadata/iso/acquisition/
- copied from r1463928, sis/branches/JDK6/sis-metadata/src/main/java/org/apache/sis/metadata/iso/acquisition/
sis/trunk/sis-metadata/src/main/java/org/apache/sis/metadata/iso/citation/DefaultAddress.java
- copied unchanged from r1463928, sis/branches/JDK6/sis-metadata/src/main/java/org/apache/sis/metadata/iso/citation/DefaultAddress.java
sis/trunk/sis-metadata/src/main/java/org/apache/sis/metadata/iso/citation/DefaultCitationDate.java
- copied unchanged from r1463928, sis/branches/JDK6/sis-metadata/src/main/java/org/apache/sis/metadata/iso/citation/DefaultCitationDate.java
sis/trunk/sis-metadata/src/main/java/org/apache/sis/metadata/iso/citation/DefaultContact.java
- copied unchanged from r1463928, sis/branches/JDK6/sis-metadata/src/main/java/org/apache/sis/metadata/iso/citation/DefaultContact.java
sis/trunk/sis-metadata/src/main/java/org/apache/sis/metadata/iso/citation/DefaultOnlineResource.java
- copied unchanged from r1463928, sis/branches/JDK6/sis-metadata/src/main/java/org/apache/sis/metadata/iso/citation/DefaultOnlineResource.java
sis/trunk/sis-metadata/src/main/java/org/apache/sis/metadata/iso/citation/DefaultResponsibleParty.java
- copied unchanged from r1463928, sis/branches/JDK6/sis-metadata/src/main/java/org/apache/sis/metadata/iso/citation/DefaultResponsibleParty.java
sis/trunk/sis-metadata/src/main/java/org/apache/sis/metadata/iso/citation/DefaultSeries.java
- copied unchanged from r1463928, sis/branches/JDK6/sis-metadata/src/main/java/org/apache/sis/metadata/iso/citation/DefaultSeries.java
sis/trunk/sis-metadata/src/main/java/org/apache/sis/metadata/iso/citation/DefaultTelephone.java
- copied unchanged from r1463928, sis/branches/JDK6/sis-metadata/src/main/java/org/apache/sis/metadata/iso/citation/DefaultTelephone.java
sis/trunk/sis-metadata/src/main/java/org/apache/sis/metadata/iso/citation/package-info.java
- copied unchanged from r1463928, sis/branches/JDK6/sis-metadata/src/main/java/org/apache/sis/metadata/iso/citation/package-info.java
sis/trunk/sis-metadata/src/main/java/org/apache/sis/metadata/iso/constraint/
- copied from r1463928, sis/branches/JDK6/sis-metadata/src/main/java/org/apache/sis/metadata/iso/constraint/
sis/trunk/sis-metadata/src/main/java/org/apache/sis/metadata/iso/content/
- copied from r1463928, sis/branches/JDK6/sis-metadata/src/main/java/org/apache/sis/metadata/iso/content/
sis/trunk/sis-metadata/src/main/java/org/apache/sis/metadata/iso/distribution/
- copied from r1463928, sis/branches/JDK6/sis-metadata/src/main/java/org/apache/sis/metadata/iso/distribution/
sis/trunk/sis-metadata/src/main/java/org/apache/sis/metadata/iso/extent/
- copied from r1463928, sis/branches/JDK6/sis-metadata/src/main/java/org/apache/sis/metadata/iso/extent/
sis/trunk/sis-metadata/src/main/java/org/apache/sis/metadata/iso/identification/
- copied from r1463928, sis/branches/JDK6/sis-metadata/src/main/java/org/apache/sis/metadata/iso/identification/
sis/trunk/sis-metadata/src/main/java/org/apache/sis/metadata/iso/lineage/
- copied from r1463928, sis/branches/JDK6/sis-metadata/src/main/java/org/apache/sis/metadata/iso/lineage/
sis/trunk/sis-metadata/src/main/java/org/apache/sis/metadata/iso/maintenance/
- copied from r1463928, sis/branches/JDK6/sis-metadata/src/main/java/org/apache/sis/metadata/iso/maintenance/
sis/trunk/sis-metadata/src/main/java/org/apache/sis/metadata/iso/package-info.java
- copied unchanged from r1463928, sis/branches/JDK6/sis-metadata/src/main/java/org/apache/sis/metadata/iso/package-info.java
sis/trunk/sis-metadata/src/main/java/org/apache/sis/metadata/iso/quality/
- copied from r1463928, sis/branches/JDK6/sis-metadata/src/main/java/org/apache/sis/metadata/iso/quality/
sis/trunk/sis-metadata/src/main/java/org/apache/sis/metadata/iso/spatial/
- copied from r1463928, sis/branches/JDK6/sis-metadata/src/main/java/org/apache/sis/metadata/iso/spatial/
sis/trunk/sis-metadata/src/main/java/org/apache/sis/referencing/
- copied from r1463928, sis/branches/JDK6/sis-metadata/src/main/java/org/apache/sis/referencing/
sis/trunk/sis-metadata/src/site/apt/
- copied from r1463928, sis/branches/JDK6/sis-metadata/src/site/apt/
sis/trunk/sis-metadata/src/site/fml/
- copied from r1463928, sis/branches/JDK6/sis-metadata/src/site/fml/
sis/trunk/sis-metadata/src/test/java/org/apache/sis/internal/
- copied from r1463928, sis/branches/JDK6/sis-metadata/src/test/java/org/apache/sis/internal/
sis/trunk/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gco/ObjectReference.java
- copied unchanged from r1463928, sis/branches/JDK6/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gco/ObjectReference.java
sis/trunk/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gco/PropertyType.java
- copied unchanged from r1463928, sis/branches/JDK6/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gco/PropertyType.java
sis/trunk/sis-utility/src/main/java/org/apache/sis/util/Deprecable.java
- copied unchanged from r1463928, sis/branches/JDK6/sis-utility/src/main/java/org/apache/sis/util/Deprecable.java
Modified:
sis/trunk/ (props changed)
sis/trunk/NOTICE
sis/trunk/sis-metadata/src/main/java/org/apache/sis/metadata/AbstractMetadata.java
sis/trunk/sis-metadata/src/main/java/org/apache/sis/metadata/MetadataStandard.java
sis/trunk/sis-metadata/src/main/java/org/apache/sis/metadata/ModifiableMetadata.java
sis/trunk/sis-metadata/src/main/java/org/apache/sis/metadata/PropertyAccessor.java
sis/trunk/sis-metadata/src/main/java/org/apache/sis/metadata/PropertyComparator.java
sis/trunk/sis-metadata/src/main/java/org/apache/sis/metadata/iso/ISOMetadata.java
sis/trunk/sis-metadata/src/main/java/org/apache/sis/metadata/iso/citation/DefaultCitation.java
sis/trunk/sis-metadata/src/main/java/org/apache/sis/metadata/iso/extent/DefaultTemporalExtent.java
sis/trunk/sis-metadata/src/main/java/org/apache/sis/referencing/DefaultReferenceIdentifier.java
sis/trunk/sis-metadata/src/site/site.xml
sis/trunk/sis-metadata/src/test/java/org/apache/sis/metadata/PropertyAccessorTest.java
sis/trunk/sis-metadata/src/test/java/org/apache/sis/test/suite/MetadataTestSuite.java
sis/trunk/sis-utility/src/main/java/org/apache/sis/internal/converter/ConverterRegistry.java
sis/trunk/sis-utility/src/main/java/org/apache/sis/internal/jaxb/MarshalContext.java
sis/trunk/sis-utility/src/main/java/org/apache/sis/internal/jaxb/NonMarshalledAuthority.java
sis/trunk/sis-utility/src/main/java/org/apache/sis/util/Static.java
sis/trunk/sis-utility/src/main/java/org/apache/sis/util/collection/DefaultTreeTable.java
sis/trunk/sis-utility/src/main/java/org/apache/sis/util/resources/Errors.java
sis/trunk/sis-utility/src/main/java/org/apache/sis/util/resources/Errors.properties
sis/trunk/sis-utility/src/main/java/org/apache/sis/util/resources/Errors_fr.properties
sis/trunk/sis-utility/src/main/java/org/apache/sis/util/resources/Messages.java
sis/trunk/sis-utility/src/main/java/org/apache/sis/util/resources/Messages.properties
sis/trunk/sis-utility/src/main/java/org/apache/sis/util/resources/Messages_fr.properties
sis/trunk/sis-utility/src/main/java/org/apache/sis/util/resources/Vocabulary.java
sis/trunk/sis-utility/src/main/java/org/apache/sis/util/resources/Vocabulary.properties
sis/trunk/sis-utility/src/main/java/org/apache/sis/util/resources/Vocabulary_fr.properties
sis/trunk/sis-utility/src/test/java/org/apache/sis/util/ClassesTest.java
Propchange: sis/trunk/
------------------------------------------------------------------------------
Merged /sis/branches/JDK7:r1457832-1463922
Merged /sis/branches/JDK6:r1457836-1463928
Modified: sis/trunk/NOTICE
URL: http://svn.apache.org/viewvc/sis/trunk/NOTICE?rev=1464085&r1=1464084&r2=1464085&view=diff
==============================================================================
--- sis/trunk/NOTICE (original)
+++ sis/trunk/NOTICE Wed Apr 3 16:00:28 2013
@@ -1,8 +1,12 @@
Apache Spatial Information System (SIS)
-Copyright 2010-2012 The Apache Software Foundation
+Copyright 2010-2013 The Apache Software Foundation
This product includes software developed at
The Apache Software Foundation (http://www.apache.org/).
+The Javadoc contains documentation from the Open Geospatial Consortium
+(OGC®) specifications (http://www.opengeospatial.org/standards/), also
+known as OpenGIS.
+
The test suite includes software developed by
the JUnit community (http://github.com/junit-team/junit.contrib/)
Added: sis/trunk/sis-metadata/src/main/java/org/apache/sis/internal/geoapi/temporal/Instant.java
URL: http://svn.apache.org/viewvc/sis/trunk/sis-metadata/src/main/java/org/apache/sis/internal/geoapi/temporal/Instant.java?rev=1464085&view=auto
==============================================================================
--- sis/trunk/sis-metadata/src/main/java/org/apache/sis/internal/geoapi/temporal/Instant.java (added)
+++ sis/trunk/sis-metadata/src/main/java/org/apache/sis/internal/geoapi/temporal/Instant.java [UTF-8] Wed Apr 3 16:00:28 2013
@@ -0,0 +1,35 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.sis.internal.geoapi.temporal;
+
+
+/**
+ * Placeholder for a GeoAPI interfaces not present in GeoAPI 3.0.0.
+ *
+ * @author Martin Desruisseaux (Geomatys)
+ * @since 0.3
+ * @version 0.3
+ * @module
+ */
+public interface Instant {
+ /**
+ * Gets the date of this instant.
+ *
+ * @return The date as a {@code Position} object.
+ */
+ Position getPosition();
+}
Propchange: sis/trunk/sis-metadata/src/main/java/org/apache/sis/internal/geoapi/temporal/Instant.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: sis/trunk/sis-metadata/src/main/java/org/apache/sis/internal/geoapi/temporal/Instant.java
------------------------------------------------------------------------------
svn:mime-type = text/plain;charset=UTF-8
Added: sis/trunk/sis-metadata/src/main/java/org/apache/sis/internal/geoapi/temporal/Period.java
URL: http://svn.apache.org/viewvc/sis/trunk/sis-metadata/src/main/java/org/apache/sis/internal/geoapi/temporal/Period.java?rev=1464085&view=auto
==============================================================================
--- sis/trunk/sis-metadata/src/main/java/org/apache/sis/internal/geoapi/temporal/Period.java (added)
+++ sis/trunk/sis-metadata/src/main/java/org/apache/sis/internal/geoapi/temporal/Period.java [UTF-8] Wed Apr 3 16:00:28 2013
@@ -0,0 +1,42 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.sis.internal.geoapi.temporal;
+
+
+/**
+ * Placeholder for a GeoAPI interfaces not present in GeoAPI 3.0.0.
+ *
+ * @author Martin Desruisseaux (Geomatys)
+ * @since 0.3
+ * @version 0.3
+ * @module
+ */
+public interface Period {
+ /**
+ * Links this period to the instant at which it ends.
+ *
+ * @return The beginning instant.
+ */
+ Instant getBeginning();
+
+ /**
+ * Links this period to the instant at which it ends.
+ *
+ * @return The end instant.
+ */
+ Instant getEnding();
+}
Propchange: sis/trunk/sis-metadata/src/main/java/org/apache/sis/internal/geoapi/temporal/Period.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: sis/trunk/sis-metadata/src/main/java/org/apache/sis/internal/geoapi/temporal/Period.java
------------------------------------------------------------------------------
svn:mime-type = text/plain;charset=UTF-8
Added: sis/trunk/sis-metadata/src/main/java/org/apache/sis/internal/geoapi/temporal/Position.java
URL: http://svn.apache.org/viewvc/sis/trunk/sis-metadata/src/main/java/org/apache/sis/internal/geoapi/temporal/Position.java?rev=1464085&view=auto
==============================================================================
--- sis/trunk/sis-metadata/src/main/java/org/apache/sis/internal/geoapi/temporal/Position.java (added)
+++ sis/trunk/sis-metadata/src/main/java/org/apache/sis/internal/geoapi/temporal/Position.java [UTF-8] Wed Apr 3 16:00:28 2013
@@ -0,0 +1,37 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.sis.internal.geoapi.temporal;
+
+import java.util.Date;
+
+
+/**
+ * Placeholder for a GeoAPI interfaces not present in GeoAPI 3.0.0.
+ *
+ * @author Martin Desruisseaux (Geomatys)
+ * @since 0.3
+ * @version 0.3
+ * @module
+ */
+public interface Position {
+ /**
+ * Returns the time value as a {@code Date} object.
+ *
+ * @return The temporal value.
+ */
+ Date getDate();
+}
Propchange: sis/trunk/sis-metadata/src/main/java/org/apache/sis/internal/geoapi/temporal/Position.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: sis/trunk/sis-metadata/src/main/java/org/apache/sis/internal/geoapi/temporal/Position.java
------------------------------------------------------------------------------
svn:mime-type = text/plain;charset=UTF-8
Added: sis/trunk/sis-metadata/src/main/java/org/apache/sis/internal/geoapi/temporal/package-info.java
URL: http://svn.apache.org/viewvc/sis/trunk/sis-metadata/src/main/java/org/apache/sis/internal/geoapi/temporal/package-info.java?rev=1464085&view=auto
==============================================================================
--- sis/trunk/sis-metadata/src/main/java/org/apache/sis/internal/geoapi/temporal/package-info.java (added)
+++ sis/trunk/sis-metadata/src/main/java/org/apache/sis/internal/geoapi/temporal/package-info.java [UTF-8] Wed Apr 3 16:00:28 2013
@@ -0,0 +1,31 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * Placeholder for GeoAPI interfaces not present in GeoAPI 3.0.0.
+ *
+ * <STRONG>Do not use!</STRONG>
+ *
+ * This package is for internal use by SIS only. Classes in this package
+ * may change in incompatible ways in any future version without notice.
+ *
+ * @author Martin Desruisseaux (Geomatys)
+ * @since 0.3
+ * @version 0.3
+ * @module
+ */
+package org.apache.sis.internal.geoapi.temporal;
Propchange: sis/trunk/sis-metadata/src/main/java/org/apache/sis/internal/geoapi/temporal/package-info.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: sis/trunk/sis-metadata/src/main/java/org/apache/sis/internal/geoapi/temporal/package-info.java
------------------------------------------------------------------------------
svn:mime-type = text/plain;charset=UTF-8
Modified: sis/trunk/sis-metadata/src/main/java/org/apache/sis/metadata/AbstractMetadata.java
URL: http://svn.apache.org/viewvc/sis/trunk/sis-metadata/src/main/java/org/apache/sis/metadata/AbstractMetadata.java?rev=1464085&r1=1464084&r2=1464085&view=diff
==============================================================================
--- sis/trunk/sis-metadata/src/main/java/org/apache/sis/metadata/AbstractMetadata.java [UTF-8] (original)
+++ sis/trunk/sis-metadata/src/main/java/org/apache/sis/metadata/AbstractMetadata.java [UTF-8] Wed Apr 3 16:00:28 2013
@@ -92,6 +92,9 @@ public abstract class AbstractMetadata i
* Subclasses will typically return a hard-coded constant such as
* {@link MetadataStandard#ISO_19115}.
*
+ * {@note Implementation of this method shall not depend on the object state,
+ * since this method may be indirectly invoked by copy constructors.}
+ *
* @return The metadata standard implemented.
*/
public abstract MetadataStandard getStandard();
Modified: sis/trunk/sis-metadata/src/main/java/org/apache/sis/metadata/MetadataStandard.java
URL: http://svn.apache.org/viewvc/sis/trunk/sis-metadata/src/main/java/org/apache/sis/metadata/MetadataStandard.java?rev=1464085&r1=1464084&r2=1464085&view=diff
==============================================================================
--- sis/trunk/sis-metadata/src/main/java/org/apache/sis/metadata/MetadataStandard.java [UTF-8] (original)
+++ sis/trunk/sis-metadata/src/main/java/org/apache/sis/metadata/MetadataStandard.java [UTF-8] Wed Apr 3 16:00:28 2013
@@ -269,7 +269,7 @@ public class MetadataStandard {
type = findInterface(implementation);
if (type == null) {
if (mandatory) {
- throw new ClassCastException(Errors.format(Errors.Keys.UnknownType_1, type));
+ throw new ClassCastException(Errors.format(Errors.Keys.UnknownType_1, implementation));
}
return null;
}
Modified: sis/trunk/sis-metadata/src/main/java/org/apache/sis/metadata/ModifiableMetadata.java
URL: http://svn.apache.org/viewvc/sis/trunk/sis-metadata/src/main/java/org/apache/sis/metadata/ModifiableMetadata.java?rev=1464085&r1=1464084&r2=1464085&view=diff
==============================================================================
--- sis/trunk/sis-metadata/src/main/java/org/apache/sis/metadata/ModifiableMetadata.java [UTF-8] (original)
+++ sis/trunk/sis-metadata/src/main/java/org/apache/sis/metadata/ModifiableMetadata.java [UTF-8] Wed Apr 3 16:00:28 2013
@@ -27,11 +27,11 @@ import org.apache.sis.util.logging.Loggi
import org.apache.sis.util.resources.Errors;
import org.apache.sis.util.collection.CheckedHashSet;
import org.apache.sis.util.collection.CheckedArrayList;
-import org.apache.sis.internal.jaxb.MarshalContext;
import static org.apache.sis.util.ArgumentChecks.ensureNonNull;
import static org.apache.sis.util.collection.CollectionsExt.isNullOrEmpty;
import static org.apache.sis.util.collection.CollectionsExt.hashMapCapacity;
+import static org.apache.sis.internal.jaxb.MarshalContext.isMarshaling;
/**
@@ -68,7 +68,7 @@ import static org.apache.sis.util.collec
* }
*
* public synchronized void setProperties(Collection<Foo> newValues) {
- * properties = copyCollection(newValues, properties, Foo.class);
+ * properties = writeCollection(newValues, properties, Foo.class);
* }
* }
* }
@@ -112,7 +112,6 @@ public abstract class ModifiableMetadata
* Constructs an initially empty metadata.
*/
protected ModifiableMetadata() {
- super();
}
/**
@@ -229,8 +228,8 @@ public abstract class ModifiableMetadata
}
/**
- * Copies the content of one list ({@code source}) into an other ({@code target}).
- * This method performs the following steps:
+ * Writes the content of the {@code source} collection into the {@code target} list,
+ * creating it if needed. This method performs the following steps:
*
* <ul>
* <li>Invokes {@link #checkWritePermission()} in order to ensure that this metadata is
@@ -241,7 +240,7 @@ public abstract class ModifiableMetadata
* <li>Copies the content of the given {@code source} into the target.</li>
* </ul>
*
- * @param <E> The type of elements in the list.
+ * @param <E> The type represented by the {@code Class} argument.
* @param source The source list, or {@code null}.
* @param target The target list, or {@code null} if not yet created.
* @param elementType The base type of elements to put in the list.
@@ -252,11 +251,11 @@ public abstract class ModifiableMetadata
* @see #nonNullList(List, Class)
*/
@SuppressWarnings("unchecked")
- protected final <E> List<E> copyList(final Collection<? extends E> source,
+ protected final <E> List<E> writeList(final Collection<? extends E> source,
List<E> target, final Class<E> elementType)
throws UnmodifiableMetadataException
{
- // See the comments in copyCollection(...) for implementation notes.
+ // See the comments in writeCollection(...) for implementation notes.
if (source != target) {
if (unmodifiable == FREEZING) {
return (List<E>) source;
@@ -277,8 +276,8 @@ public abstract class ModifiableMetadata
}
/**
- * Copies the content of one Set ({@code source}) into an other ({@code target}).
- * This method performs the following steps:
+ * Writes the content of the {@code source} collection into the {@code target} set,
+ * creating it if needed. This method performs the following steps:
*
* <ul>
* <li>Invokes {@link #checkWritePermission()} in order to ensure that this metadata is
@@ -289,7 +288,7 @@ public abstract class ModifiableMetadata
* <li>Copies the content of the given {@code source} into the target.</li>
* </ul>
*
- * @param <E> The type of elements in the set.
+ * @param <E> The type represented by the {@code Class} argument.
* @param source The source set, or {@code null}.
* @param target The target set, or {@code null} if not yet created.
* @param elementType The base type of elements to put in the set.
@@ -300,11 +299,11 @@ public abstract class ModifiableMetadata
* @see #nonNullSet(Set, Class)
*/
@SuppressWarnings("unchecked")
- protected final <E> Set<E> copySet(final Collection<? extends E> source,
+ protected final <E> Set<E> writeSet(final Collection<? extends E> source,
Set<E> target, final Class<E> elementType)
throws UnmodifiableMetadataException
{
- // See the comments in copyCollection(...) for implementation notes.
+ // See the comments in writeCollection(...) for implementation notes.
if (source != target) {
if (unmodifiable == FREEZING) {
return (Set<E>) source;
@@ -325,8 +324,8 @@ public abstract class ModifiableMetadata
}
/**
- * Copies the content of one collection ({@code source}) into an other ({@code target}).
- * This method performs the following steps:
+ * Writes the content of the {@code source} collection into the {@code target} list or set,
+ * creating it if needed. This method performs the following steps:
*
* <ul>
* <li>Invokes {@link #checkWritePermission()} in order to ensure that this metadata is
@@ -339,13 +338,13 @@ public abstract class ModifiableMetadata
* </ul>
*
* {@section Choosing a collection type}
- * Implementations shall invoke {@link #copyList copyList} or {@link #copySet copySet} methods
+ * Implementations shall invoke {@link #writeList writeList} or {@link #writeSet writeSet} methods
* instead than this method when the collection type is enforced by ISO specification.
* When the type is not enforced by the specification, some freedom are allowed at
* implementor choice. The default implementation invokes {@link #collectionType(Class)}
* in order to get a hint about whether a {@link List} or a {@link Set} should be used.
*
- * @param <E> The type of elements in the collection.
+ * @param <E> The type represented by the {@code Class} argument.
* @param source The source collection, or {@code null}.
* @param target The target collection, or {@code null} if not yet created.
* @param elementType The base type of elements to put in the collection.
@@ -354,7 +353,7 @@ public abstract class ModifiableMetadata
* @throws UnmodifiableMetadataException if this metadata is unmodifiable.
*/
@SuppressWarnings("unchecked")
- protected final <E> Collection<E> copyCollection(final Collection<? extends E> source,
+ protected final <E> Collection<E> writeCollection(final Collection<? extends E> source,
Collection<E> target, final Class<E> elementType)
throws UnmodifiableMetadataException
{
@@ -369,7 +368,7 @@ public abstract class ModifiableMetadata
* freeze() method is under progress. The source collection is already
* an unmodifiable instance created by unmodifiable(Object).
*/
- assert collectionType(elementType).isAssignableFrom(source.getClass());
+ assert collectionType(elementType).isInstance(source);
return (Collection<E>) source;
}
checkWritePermission();
@@ -393,25 +392,110 @@ public abstract class ModifiableMetadata
}
/**
- * Returns {@code true} if the caller {@code nonNullCollection} method (or list, or set)
- * is allowed to returns {@code null} instead than an empty list. This happen mostly at
- * XML marshalling time.
+ * Creates a list with the content of the {@code source} collection,
+ * or returns {@code null} if the source is {@code null} or empty.
+ * This is a convenience method for copying fields in subclass copy constructors.
+ *
+ * @param <E> The type represented by the {@code Class} argument.
+ * @param source The source collection, or {@code null}.
+ * @param elementType The base type of elements to put in the list.
+ * @return A list containing the {@code source} elements,
+ * or {@code null} if the source was null or empty.
*/
- private static boolean isMarshaling() {
- return MarshalContext.isFlagSet(MarshalContext.current(), MarshalContext.MARSHALING);
+ protected final <E> List<E> copyList(final Collection<? extends E> source, final Class<E> elementType) {
+ if (isNullOrEmpty(source)) {
+ return null;
+ }
+ final List<E> target = new MutableList<E>(elementType, source.size());
+ target.addAll(source);
+ return target;
+ }
+
+ /**
+ * Creates a set with the content of the {@code source} collection,
+ * or returns {@code null} if the source is {@code null} or empty.
+ * This is a convenience method for copying fields in subclass copy constructors.
+ *
+ * @param <E> The type represented by the {@code Class} argument.
+ * @param source The source collection, or {@code null}.
+ * @param elementType The base type of elements to put in the set.
+ * @return A set containing the {@code source} elements,
+ * or {@code null} if the source was null or empty.
+ */
+ protected final <E> Set<E> copySet(final Collection<? extends E> source, final Class<E> elementType) {
+ if (isNullOrEmpty(source)) {
+ return null;
+ }
+ final Set<E> target = new MutableSet<E>(elementType, source.size());
+ target.addAll(source);
+ return target;
+ }
+
+ /**
+ * Creates a list or set with the content of the {@code source} collection,
+ * or returns {@code null} if the source is {@code null} or empty.
+ * This is a convenience method for copying fields in subclass copy constructors.
+ *
+ * <p>The collection type is selected as described in the
+ * {@link #nonNullCollection(Collection, Class)}.</p>
+ *
+ * @param <E> The type represented by the {@code Class} argument.
+ * @param source The source collection, or {@code null}.
+ * @param elementType The base type of elements to put in the collection.
+ * @return A collection containing the {@code source} elements,
+ * or {@code null} if the source was null or empty.
+ */
+ protected final <E> Collection<E> copyCollection(final Collection<? extends E> source, final Class<E> elementType) {
+ if (isNullOrEmpty(source)) {
+ return null;
+ }
+ final Collection<E> target;
+ final int capacity = source.size();
+ if (useSet(elementType)) {
+ target = new MutableSet<E>(elementType, capacity);
+ } else {
+ target = new MutableList<E>(elementType, capacity);
+ }
+ target.addAll(source);
+ return target;
+ }
+
+ /**
+ * Creates a singleton list or set containing only the given value, if non-null.
+ * This is a convenience method for initializing fields in subclass constructors.
+ *
+ * <p>The collection type is selected as described in the
+ * {@link #nonNullCollection(Collection, Class)}.</p>
+ *
+ * @param <E> The type represented by the {@code Class} argument.
+ * @param value The singleton value to put in the returned collection, or {@code null}.
+ * @param elementType The element type (used only if {@code value} is non-null).
+ * @return A new modifiable collection containing the given value,
+ * or {@code null} if the given value was null.
+ */
+ protected final <E> Collection<E> singleton(final E value, final Class<E> elementType) {
+ if (value == null) {
+ return null;
+ }
+ final Collection<E> collection;
+ if (useSet(elementType)) {
+ collection = new MutableSet<E>(elementType);
+ } else {
+ collection = new MutableList<E>(elementType);
+ }
+ collection.add(value);
+ return collection;
}
/**
* Returns the specified list, or a new one if {@code c} is null.
- * This is a convenience method for implementation of {@code getFoo()}
- * methods.
+ * This is a convenience method for implementation of {@code getFoo()} methods.
*
- * @param <E> The type of elements in the list.
- * @param c The list to checks.
+ * @param <E> The type represented by the {@code Class} argument.
+ * @param c The existing list, or {@code null} if the list has not yet been created.
* @param elementType The element type (used only if {@code c} is null).
* @return {@code c}, or a new list if {@code c} is null.
*/
- // See the comments in nonNullCollection(...) for implementation notes.
protected final <E> List<E> nonNullList(final List<E> c, final Class<E> elementType) {
assert Thread.holdsLock(this);
if (c != null) {
@@ -428,15 +512,13 @@ public abstract class ModifiableMetadata
/**
* Returns the specified set, or a new one if {@code c} is null.
- * This is a convenience method for implementation of {@code getFoo()}
- * methods.
+ * This is a convenience method for implementation of {@code getFoo()} methods.
*
- * @param <E> The type of elements in the set.
- * @param c The set to checks.
+ * @param <E> The type represented by the {@code Class} argument.
+ * @param c The existing set, or {@code null} if the set has not yet been created.
* @param elementType The element type (used only if {@code c} is null).
* @return {@code c}, or a new set if {@code c} is null.
*/
- // See the comments in nonNullCollection(...) for implementation notes.
protected final <E> Set<E> nonNullSet(final Set<E> c, final Class<E> elementType) {
assert Thread.holdsLock(this);
if (c != null) {
@@ -453,28 +535,25 @@ public abstract class ModifiableMetadata
/**
* Returns the specified collection, or a new one if {@code c} is null.
- * This is a convenience method for implementation of {@code getFoo()}
- * methods.
+ * This is a convenience method for implementation of {@code getFoo()} methods.
*
* {@section Choosing a collection type}
- * Implementations shall invoke {@link #nonNullList nonNullList} or {@link #nonNullSet
- * nonNullSet} instead than this method when the collection type is enforced by ISO
+ * Implementations shall invoke {@link #nonNullList nonNullList(…)} or {@link #nonNullSet
+ * nonNullSet(…)} instead than this method when the collection type is enforced by ISO
* specification. When the type is not enforced by the specification, some freedom are
* allowed at implementor choice. The default implementation invokes
* {@link #collectionType(Class)} in order to get a hint about whether a {@link List}
* or a {@link Set} should be used.
*
- * @param <E> The type of elements in the collection.
- * @param c The collection to checks.
+ * @param <E> The type represented by the {@code Class} argument.
+ * @param c The existing collection, or {@code null} if the collection has not yet been created.
* @param elementType The element type (used only if {@code c} is null).
* @return {@code c}, or a new collection if {@code c} is null.
*/
- // Despite the javadoc claims, we do not yet return null during copy operations.
- // However a future version may do so if it appears worth on a performance point of view.
protected final <E> Collection<E> nonNullCollection(final Collection<E> c, final Class<E> elementType) {
assert Thread.holdsLock(this);
if (c != null) {
- assert collectionType(elementType).isAssignableFrom(c.getClass());
+ assert collectionType(elementType).isInstance(c);
return c.isEmpty() && isMarshaling() ? null : c;
}
if (isMarshaling()) {
Modified: sis/trunk/sis-metadata/src/main/java/org/apache/sis/metadata/PropertyAccessor.java
URL: http://svn.apache.org/viewvc/sis/trunk/sis-metadata/src/main/java/org/apache/sis/metadata/PropertyAccessor.java?rev=1464085&r1=1464084&r2=1464085&view=diff
==============================================================================
--- sis/trunk/sis-metadata/src/main/java/org/apache/sis/metadata/PropertyAccessor.java [UTF-8] (original)
+++ sis/trunk/sis-metadata/src/main/java/org/apache/sis/metadata/PropertyAccessor.java [UTF-8] Wed Apr 3 16:00:28 2013
@@ -49,6 +49,7 @@ import org.apache.sis.xml.IdentifiedObje
import static org.apache.sis.util.collection.CollectionsExt.modifiableCopy;
import static org.apache.sis.util.collection.CollectionsExt.hashMapCapacity;
import static org.apache.sis.internal.util.Utilities.floatEpsilonEqual;
+import static org.apache.sis.metadata.PropertyComparator.*;
/**
@@ -79,21 +80,6 @@ import static org.apache.sis.internal.ut
@ThreadSafe
final class PropertyAccessor {
/**
- * The prefix for getters on boolean values.
- */
- private static final String IS = "is";
-
- /**
- * The prefix for getters (general case).
- */
- private static final String GET = "get";
-
- /**
- * The prefix for setters.
- */
- private static final String SET = "set";
-
- /**
* Getters shared between many instances of this class. Two different implementations
* may share the same getters but different setters.
*
@@ -236,7 +222,7 @@ final class PropertyAccessor {
this.standard = standard;
this.type = type;
this.implementation = implementation;
- this.getters = getGetters(type);
+ this.getters = getGetters(type, implementation);
int allCount = getters.length;
int standardCount = allCount;
if (allCount != 0 && getters[allCount-1] == EXTRA_GETTER) {
@@ -375,9 +361,10 @@ final class PropertyAccessor {
* since it may be shared among many instances of {@code PropertyAccessor}.
*
* @param type The metadata interface.
+ * @param implementation The class of metadata implementations.
* @return The getters declared in the given interface (never {@code null}).
*/
- private static Method[] getGetters(final Class<?> type) {
+ private static Method[] getGetters(final Class<?> type, final Class<?> implementation) {
synchronized (SHARED_GETTERS) {
Method[] getters = SHARED_GETTERS.get(type);
if (getters == null) {
@@ -425,7 +412,7 @@ final class PropertyAccessor {
* keep the extra methods last. The code checking for the extra methods require
* them to be last.
*/
- Arrays.sort(getters, 0, count, PropertyComparator.INSTANCE);
+ Arrays.sort(getters, 0, count, new PropertyComparator(implementation));
if (!hasExtraGetter) {
if (getters.length == count) {
getters = Arrays.copyOf(getters, count+1);
@@ -440,70 +427,6 @@ final class PropertyAccessor {
}
/**
- * Returns the prefix of the specified method name. If the method name doesn't starts with
- * a prefix (for example {@link org.opengis.metadata.quality.ConformanceResult#pass()}),
- * then this method returns an empty string.
- */
- private static String prefix(final String name) {
- if (name.startsWith(GET)) {
- return GET;
- }
- if (name.startsWith(IS)) {
- return IS;
- }
- if (name.startsWith(SET)) {
- return SET;
- }
- return "";
- }
-
- /**
- * Returns {@code true} if the specified string starting at the specified index contains
- * no lower case characters. The characters don't have to be in upper case however (e.g.
- * non-alphabetic characters)
- */
- private static boolean isAcronym(final String name, int offset) {
- final int length = name.length();
- while (offset < length) {
- final int c = name.codePointAt(offset);
- if (Character.isLowerCase(c)) {
- return false;
- }
- offset += Character.charCount(c);
- }
- return true;
- }
-
- /**
- * Removes the {@code "get"} or {@code "is"} prefix and turn the first character after the
- * prefix into lower case. For example the method name {@code "getTitle"} will be replaced
- * by the property name {@code "title"}. We will perform this operation only if there is
- * at least 1 character after the prefix.
- *
- * @param name The method name (can not be {@code null}).
- * @param base Must be the result of {@code prefix(name).length()}.
- * @return The property name (never {@code null}).
- */
- private static String toPropertyName(String name, final int base) {
- final int length = name.length();
- if (length > base) {
- if (isAcronym(name, base)) {
- name = name.substring(base);
- } else {
- final int up = name.codePointAt(base);
- final int lo = Character.toLowerCase(up);
- if (up != lo) {
- name = new StringBuilder(length - base).appendCodePoint(lo)
- .append(name, base + Character.charCount(up), length).toString();
- } else {
- name = name.substring(base);
- }
- }
- }
- return name.intern();
- }
-
- /**
* Returns the number of properties that can be read.
*/
final int count() {
@@ -885,7 +808,7 @@ final class PropertyAccessor {
/*
* We now have objects of the appropriate type. If we have a singleton to be added
* in an existing collection, add it now. In that case the 'newValue' should refer
- * to the 'addTo' collection. We rely on ModifiableMetadata.copyCollection(...)
+ * to the 'addTo' collection. We rely on the ModifiableMetadata.writeCollection(…)
* optimization for detecting that the new collection is the same instance than
* the old one so there is nothing to do. We could exit from the method, but let
* it continues in case the user override the 'setFoo(...)' method.
Modified: sis/trunk/sis-metadata/src/main/java/org/apache/sis/metadata/PropertyComparator.java
URL: http://svn.apache.org/viewvc/sis/trunk/sis-metadata/src/main/java/org/apache/sis/metadata/PropertyComparator.java?rev=1464085&r1=1464084&r2=1464085&view=diff
==============================================================================
--- sis/trunk/sis-metadata/src/main/java/org/apache/sis/metadata/PropertyComparator.java [UTF-8] (original)
+++ sis/trunk/sis-metadata/src/main/java/org/apache/sis/metadata/PropertyComparator.java [UTF-8] Wed Apr 3 16:00:28 2013
@@ -17,33 +17,78 @@
package org.apache.sis.metadata;
import java.util.Comparator;
+import java.util.Map;
+import java.util.IdentityHashMap;
import java.lang.reflect.Method;
-import net.jcip.annotations.Immutable;
+import javax.xml.bind.annotation.XmlType;
import org.opengis.annotation.UML;
import org.opengis.annotation.Obligation;
/**
- * The comparator for sorting method order. This comparator puts mandatory methods first,
- * which is necessary for reducing the risk of ambiguity in {@link MetadataTreeFormat#parse}.
+ * The comparator for sorting the properties in a metadata object.
+ * Since the comparator uses (among other criterion) the property names, this class
+ * incidentally defines static methods for inferring those names from the methods.
+ *
+ * <p>This comparator uses the following criterion, in priority order:</p>
+ * <ol>
+ * <li>If the property order is specified by a {@link XmlType} annotation,
+ * then this comparator complies to that order.</li>
+ * <li>Otherwise this comparator sorts mandatory methods first, followed by
+ * conditional methods, then optional ones.</li>
+ * <li>If the order can not be inferred from the above, then the comparator
+ * fallbacks on alphabetical order.</li>
+ * </ol>
+ *
+ * The first criterion (mandatory methods first) is necessary for reducing the risk
+ * of ambiguity in the {@link MetadataTreeTable#parse} method.
*
* @author Martin Desruisseaux (Geomatys)
* @since 0.3 (derived from geotk-2.4)
* @version 0.3
* @module
*/
-@Immutable
final class PropertyComparator implements Comparator<Method> {
/**
- * The singleton instance.
+ * The prefix for getters on boolean values.
+ */
+ private static final String IS = "is";
+
+ /**
+ * The prefix for getters (general case).
+ */
+ private static final String GET = "get";
+
+ /**
+ * The prefix for setters.
+ */
+ static final String SET = "set";
+
+ /**
+ * Methods specified in the {@link XmlType} annotation, or {@code null} if none.
*/
- static final Comparator<Method> INSTANCE = new PropertyComparator();
+ private final String[] order;
/**
- * Do not allow instantiation of this class, except for the singleton.
+ * Indices of methods in the {@link #order} array, created when first needed.
*/
- private PropertyComparator() {
+ private Map<Method,Integer> indices;
+
+ /**
+ * Creates a new comparator for the given implementation class.
+ *
+ * @param implementation The implementation class, or {@code null} if unknown.
+ */
+ PropertyComparator(final Class<?> implementation) {
+ if (implementation != null) {
+ final XmlType xml = implementation.getAnnotation(XmlType.class);
+ if (xml != null) {
+ order = xml.propOrder();
+ return;
+ }
+ }
+ order = null;
}
/**
@@ -51,27 +96,31 @@ final class PropertyComparator implement
*/
@Override
public int compare(final Method m1, final Method m2) {
- final UML a1 = m1.getAnnotation(UML.class);
- final UML a2 = m2.getAnnotation(UML.class);
- if (a1 != null) {
- if (a2 == null) return +1; // Sort annotated elements first.
- int c = order(a1) - order(a2); // Mandatory elements must be first.
- if (c == 0) {
- // Fallback on alphabetical order.
- c = a1.identifier().compareToIgnoreCase(a2.identifier());
- }
- return c;
- } else if (a2 != null) {
- return -1; // Sort annotated elements first.
+ int c = indexOf(m1) - indexOf(m2);
+ if (c == 0) {
+ final UML a1 = m1.getAnnotation(UML.class);
+ final UML a2 = m2.getAnnotation(UML.class);
+ if (a1 != null) {
+ if (a2 == null) return +1; // Sort annotated elements first.
+ c = order(a1) - order(a2); // Mandatory elements must be first.
+ if (c == 0) {
+ // Fallback on alphabetical order.
+ c = a1.identifier().compareToIgnoreCase(a2.identifier());
+ }
+ return c;
+ } else if (a2 != null) {
+ return -1; // Sort annotated elements first.
+ }
+ // Fallback on alphabetical order.
+ c = m1.getName().compareToIgnoreCase(m2.getName());
}
- // Fallback on alphabetical order.
- return m1.getName().compareToIgnoreCase(m2.getName());
+ return c;
}
/**
* Returns a higher number for obligation which should be first.
*/
- private int order(final UML uml) {
+ private static int order(final UML uml) {
final Obligation obligation = uml.obligation();
if (obligation != null) {
switch (obligation) {
@@ -83,4 +132,95 @@ final class PropertyComparator implement
}
return 5;
}
+
+ /**
+ * Returns the index of the given method, or {@code order.length} if the method is not found.
+ */
+ private int indexOf(final Method method) {
+ int i = 0;
+ if (order != null) {
+ if (indices == null) {
+ indices = new IdentityHashMap<Method,Integer>();
+ } else {
+ Integer index = indices.get(method);
+ if (index != null) {
+ return index;
+ }
+ }
+ String name = method.getName();
+ name = toPropertyName(name, prefix(name).length());
+ while (i < order.length) {
+ if (name.equals(order[i])) {
+ break;
+ }
+ i++;
+ }
+ indices.put(method, i);
+ }
+ return i;
+ }
+
+ /**
+ * Returns the prefix of the specified method name. If the method name doesn't starts with
+ * a prefix (for example {@link org.opengis.metadata.quality.ConformanceResult#pass()}),
+ * then this method returns an empty string.
+ */
+ static String prefix(final String name) {
+ if (name.startsWith(GET)) {
+ return GET;
+ }
+ if (name.startsWith(IS)) {
+ return IS;
+ }
+ if (name.startsWith(SET)) {
+ return SET;
+ }
+ return "";
+ }
+
+ /**
+ * Returns {@code true} if the specified string starting at the specified index contains
+ * no lower case characters. The characters don't have to be in upper case however (e.g.
+ * non-alphabetic characters)
+ */
+ private static boolean isAcronym(final String name, int offset) {
+ final int length = name.length();
+ while (offset < length) {
+ final int c = name.codePointAt(offset);
+ if (Character.isLowerCase(c)) {
+ return false;
+ }
+ offset += Character.charCount(c);
+ }
+ return true;
+ }
+
+ /**
+ * Removes the {@code "get"} or {@code "is"} prefix and turn the first character after the
+ * prefix into lower case. For example the method name {@code "getTitle"} will be replaced
+ * by the property name {@code "title"}. We will perform this operation only if there is
+ * at least 1 character after the prefix.
+ *
+ * @param name The method name (can not be {@code null}).
+ * @param base Must be the result of {@code prefix(name).length()}.
+ * @return The property name (never {@code null}).
+ */
+ static String toPropertyName(String name, final int base) {
+ final int length = name.length();
+ if (length > base) {
+ if (isAcronym(name, base)) {
+ name = name.substring(base);
+ } else {
+ final int up = name.codePointAt(base);
+ final int lo = Character.toLowerCase(up);
+ if (up != lo) {
+ name = new StringBuilder(length - base).appendCodePoint(lo)
+ .append(name, base + Character.charCount(up), length).toString();
+ } else {
+ name = name.substring(base);
+ }
+ }
+ }
+ return name.intern();
+ }
}
Modified: sis/trunk/sis-metadata/src/main/java/org/apache/sis/metadata/iso/ISOMetadata.java
URL: http://svn.apache.org/viewvc/sis/trunk/sis-metadata/src/main/java/org/apache/sis/metadata/iso/ISOMetadata.java?rev=1464085&r1=1464084&r2=1464085&view=diff
==============================================================================
--- sis/trunk/sis-metadata/src/main/java/org/apache/sis/metadata/iso/ISOMetadata.java [UTF-8] (original)
+++ sis/trunk/sis-metadata/src/main/java/org/apache/sis/metadata/iso/ISOMetadata.java [UTF-8] Wed Apr 3 16:00:28 2013
@@ -16,10 +16,16 @@
*/
package org.apache.sis.metadata.iso;
+import java.util.Collection;
import java.io.Serializable;
import net.jcip.annotations.ThreadSafe;
+import org.opengis.metadata.Identifier;
+import org.apache.sis.xml.IdentifierMap;
+import org.apache.sis.xml.IdentifiedObject;
import org.apache.sis.metadata.MetadataStandard;
import org.apache.sis.metadata.ModifiableMetadata;
+import org.apache.sis.internal.jaxb.IdentifierMapWithSpecialCases;
+import org.apache.sis.util.ArgumentChecks;
/**
@@ -32,25 +38,83 @@ import org.apache.sis.metadata.Modifiabl
* @module
*/
@ThreadSafe
-public class ISOMetadata extends ModifiableMetadata implements Serializable {
+public class ISOMetadata extends ModifiableMetadata implements IdentifiedObject, Serializable {
/**
* Serial number for inter-operability with different versions.
*/
private static final long serialVersionUID = 5730550742604669102L;
/**
+ * All identifiers associated with this metadata, or {@code null} if none.
+ * This field is initialized to a non-null value when first needed.
+ */
+ protected Collection<Identifier> identifiers;
+
+ /**
+ * The {@linkplain #getIdentifierMap() identifier map} as a wrapper around the
+ * {@linkplain #identifiers} collection. This map is created only when first needed.
+ *
+ * @see #getIdentifierMap()
+ */
+ private transient IdentifierMap identifierMap;
+
+ /**
* Constructs an initially empty metadata.
*/
protected ISOMetadata() {
- super();
+ }
+
+ /**
+ * Constructs a new metadata initialized with the values from the specified object.
+ * If the given object is an instance of {@link IdentifiedObject}, then this constructor
+ * copies the {@linkplain #identifiers collection of identifiers}.
+ *
+ * @param object The metadata to copy values from.
+ */
+ protected ISOMetadata(final Object object) {
+ ArgumentChecks.ensureNonNull("object", object);
+ if (object instanceof IdentifiedObject) {
+ identifiers = copyCollection(((IdentifiedObject) object).getIdentifiers(), Identifier.class);
+ }
}
/**
* Returns the metadata standard implemented by subclasses,
* which is {@linkplain MetadataStandard#ISO_19115 ISO 19115}.
+ *
+ * {@note Subclasses shall not override this method in a way that depends on the object state,
+ * since this method may be indirectly invoked by copy constructors (i.e. is may be
+ * invoked before this metadata object is fully constructed).}
*/
@Override
public MetadataStandard getStandard() {
return MetadataStandard.ISO_19115;
}
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public synchronized Collection<Identifier> getIdentifiers() {
+ return identifiers = nonNullCollection(identifiers, Identifier.class);
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * <p>The default implementation returns a wrapper around the {@linkplain #identifiers} list.
+ * That map is <cite>live</cite>: changes in the identifiers list will be reflected in the map,
+ * and conversely.</p>
+ */
+ @Override
+ public synchronized IdentifierMap getIdentifierMap() {
+ if (identifierMap == null) {
+ final Collection<Identifier> identifiers = getIdentifiers();
+ if (identifiers == null) {
+ return IdentifierMapWithSpecialCases.EMPTY;
+ }
+ identifierMap = new IdentifierMapWithSpecialCases(identifiers);
+ }
+ return identifierMap;
+ }
}
Modified: sis/trunk/sis-metadata/src/main/java/org/apache/sis/metadata/iso/citation/DefaultCitation.java
URL: http://svn.apache.org/viewvc/sis/trunk/sis-metadata/src/main/java/org/apache/sis/metadata/iso/citation/DefaultCitation.java?rev=1464085&r1=1464084&r2=1464085&view=diff
==============================================================================
--- sis/trunk/sis-metadata/src/main/java/org/apache/sis/metadata/iso/citation/DefaultCitation.java [UTF-8] (original)
+++ sis/trunk/sis-metadata/src/main/java/org/apache/sis/metadata/iso/citation/DefaultCitation.java [UTF-8] Wed Apr 3 16:00:28 2013
@@ -18,6 +18,9 @@ package org.apache.sis.metadata.iso.cita
import java.util.Date;
import java.util.Collection;
+import javax.xml.bind.annotation.XmlType;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlRootElement;
import org.opengis.metadata.Identifier;
import org.opengis.metadata.citation.Citation;
import org.opengis.metadata.citation.CitationDate;
@@ -25,18 +28,49 @@ import org.opengis.metadata.citation.Pre
import org.opengis.metadata.citation.ResponsibleParty;
import org.opengis.metadata.citation.Series;
import org.opengis.util.InternationalString;
+import org.apache.sis.util.iso.Types;
+import org.apache.sis.util.iso.SimpleInternationalString;
+import org.apache.sis.util.collection.CollectionsExt;
+import org.apache.sis.internal.jaxb.NonMarshalledAuthority;
import org.apache.sis.metadata.iso.ISOMetadata;
+import org.apache.sis.xml.IdentifierSpace;
+
+import static org.apache.sis.internal.jaxb.MarshalContext.filterIdentifiers;
+import static org.apache.sis.internal.metadata.MetadataUtilities.toDate;
+import static org.apache.sis.internal.metadata.MetadataUtilities.toMilliseconds;
/**
* Standardized resource reference.
*
+ * {@section Unified identifiers view}
+ * The ISO 19115 model provides specific attributes for the {@linkplain #getISBN() ISBN} and
+ * {@linkplain #getISSN() ISSN} codes. However the SIS library handles those codes like any
+ * other identifiers. Consequently the ISBN and ISSN codes are included in the collection
+ * returned by {@link #getIdentifiers()}, except at XML marshalling time (for ISO 19139 compliance).
+ *
* @author Martin Desruisseaux (IRD, Geomatys)
* @author Cédric Briançon (Geomatys)
* @since 0.3 (derived from geotk-2.1)
* @version 0.3
* @module
*/
+@XmlType(name = "CI_Citation_Type", propOrder = {
+ "title",
+ "alternateTitles",
+ "dates",
+ "edition",
+ "editionDate",
+ "identifiers",
+ "citedResponsibleParties",
+ "presentationForms",
+ "series",
+ "otherCitationDetails",
+ "collectiveTitle",
+ "ISBN",
+ "ISSN"
+})
+@XmlRootElement(name = "CI_Citation")
public class DefaultCitation extends ISOMetadata implements Citation {
/**
* Serial number for inter-operability with different versions.
@@ -44,6 +78,26 @@ public class DefaultCitation extends ISO
private static final long serialVersionUID = 2595269795652984755L;
/**
+ * The authority for International Standard Book Number.
+ *
+ * <p><b>Implementation note:</b> This field is read by reflection in
+ * {@link org.apache.sis.internal.jaxb.NonMarshalledAuthority}. IF this
+ * field is renamed or moved, then {@code NonMarshalledAuthority} needs
+ * to be updated.</p>
+ */
+ static final IdentifierSpace<String> ISBN = new NonMarshalledAuthority<String>("ISBN", NonMarshalledAuthority.ISBN);
+
+ /**
+ * The authority for International Standard Serial Number.
+ *
+ * <p><b>Implementation note:</b> This field is read by reflection in
+ * {@link org.apache.sis.internal.jaxb.NonMarshalledAuthority}. IF this
+ * field is renamed or moved, then {@code NonMarshalledAuthority} needs
+ * to be updated.</p>
+ */
+ static final IdentifierSpace<String> ISSN = new NonMarshalledAuthority<String>("ISSN", NonMarshalledAuthority.ISSN);
+
+ /**
* Name by which the cited resource is known.
*/
private InternationalString title;
@@ -72,12 +126,12 @@ public class DefaultCitation extends ISO
/**
* Name and position information for an individual or organization that is responsible
- * for the resource. Returns an empty string if there is none.
+ * for the resource. Returns an empty collection if there is none.
*/
private Collection<ResponsibleParty> citedResponsibleParties;
/**
- * Mode in which the resource is represented, or an empty string if none.
+ * Mode in which the resource is represented, or an empty collection if none.
*/
private Collection<PresentationForm> presentationForms;
@@ -108,9 +162,100 @@ public class DefaultCitation extends ISO
}
/**
+ * Constructs a citation with the specified title.
+ *
+ * @param title The title as a {@link String} or an {@link InternationalString} object,
+ * or {@code null} if none.
+ */
+ public DefaultCitation(final CharSequence title) {
+ this(); // Initialize the date field.
+ this.title = Types.toInternationalString(title);
+ }
+
+ /**
+ * Constructs a citation with the specified responsible party.
+ * This convenience constructor initializes the citation title
+ * to the first non-null of the following properties:
+ * {@linkplain DefaultResponsibleParty#getOrganisationName() organisation name},
+ * {@linkplain DefaultResponsibleParty#getPositionName() position name} or
+ * {@linkplain DefaultResponsibleParty#getIndividualName() individual name}.
+ *
+ * @param party The name and position information for an individual or organization that is
+ * responsible for the resource, or {@code null} if none.
+ */
+ public DefaultCitation(final ResponsibleParty party) {
+ this(); // Initialize the date field.
+ if (party != null) {
+ citedResponsibleParties = singleton(party, ResponsibleParty.class);
+ title = party.getOrganisationName();
+ if (title == null) {
+ title = party.getPositionName();
+ if (title == null) {
+ String name = party.getIndividualName();
+ if (name != null) {
+ title = new SimpleInternationalString(name);
+ }
+ }
+ }
+ }
+ }
+
+ /**
+ * Constructs a new instance initialized with the values from the specified metadata object.
+ * This is a <cite>shallow</cite> copy constructor, since the other metadata contained in the
+ * given object are not recursively copied.
+ *
+ * @param object The metadata to copy values from.
+ *
+ * @see #castOrCopy(Citation)
+ */
+ public DefaultCitation(final Citation object) {
+ super(object);
+ title = object.getTitle();
+ alternateTitles = copyCollection(object.getAlternateTitles(), InternationalString.class);
+ dates = copyCollection(object.getDates(), CitationDate.class);
+ edition = object.getEdition();
+ editionDate = toMilliseconds(object.getEditionDate());
+ identifiers = copyCollection(object.getIdentifiers(), Identifier.class);
+ citedResponsibleParties = copyCollection(object.getCitedResponsibleParties(), ResponsibleParty.class);
+ presentationForms = copyCollection(object.getPresentationForms(), PresentationForm.class);
+ series = object.getSeries();
+ otherCitationDetails = object.getOtherCitationDetails();
+ collectiveTitle = object.getCollectiveTitle();
+// TODO ISBN = object.getISBN();
+// TODO ISSN = object.getISSN();
+ }
+
+ /**
+ * Returns a SIS metadata implementation with the values of the given arbitrary implementation.
+ * This method performs the first applicable actions in the following choices:
+ *
+ * <ul>
+ * <li>If the given object is {@code null}, then this method returns {@code null}.</li>
+ * <li>Otherwise if the given object is already an instance of
+ * {@code DefaultCitation}, then it is returned unchanged.</li>
+ * <li>Otherwise a new {@code DefaultCitation} instance is created using the
+ * {@linkplain #DefaultCitation(Citation) copy constructor}
+ * and returned. Note that this is a <cite>shallow</cite> copy operation, since the other
+ * metadata contained in the given object are not recursively copied.</li>
+ * </ul>
+ *
+ * @param object The object to get as a SIS implementation, or {@code null} if none.
+ * @return A SIS implementation containing the values of the given object (may be the
+ * given object itself), or {@code null} if the argument was null.
+ */
+ public static DefaultCitation castOrCopy(final Citation object) {
+ if (object == null || object instanceof DefaultCitation) {
+ return (DefaultCitation) object;
+ }
+ return new DefaultCitation(object);
+ }
+
+ /**
* Returns the name by which the cited resource is known.
*/
@Override
+ @XmlElement(name = "title", required = true)
public synchronized InternationalString getTitle() {
return title;
}
@@ -118,7 +263,7 @@ public class DefaultCitation extends ISO
/**
* Sets the name by which the cited resource is known.
*
- * @param newValue The new title.
+ * @param newValue The new title, or {@code null} if none.
*/
public synchronized void setTitle(final InternationalString newValue) {
checkWritePermission();
@@ -127,9 +272,10 @@ public class DefaultCitation extends ISO
/**
* Returns the short name or other language name by which the cited information is known.
- * Example: "DCW" as an alternative title for "Digital Chart of the World".
+ * Example: "DCW" as an alternative title for "<cite>Digital Chart of the World</cite>".
*/
@Override
+ @XmlElement(name = "alternateTitle")
public synchronized Collection<InternationalString> getAlternateTitles() {
return alternateTitles = nonNullCollection(alternateTitles, InternationalString.class);
}
@@ -137,16 +283,17 @@ public class DefaultCitation extends ISO
/**
* Sets the short name or other language name by which the cited information is known.
*
- * @param newValues The new alternate titles.
+ * @param newValues The new alternate titles, or {@code null} if none.
*/
public synchronized void setAlternateTitles(final Collection<? extends InternationalString> newValues) {
- alternateTitles = copyCollection(newValues, alternateTitles, InternationalString.class);
+ alternateTitles = writeCollection(newValues, alternateTitles, InternationalString.class);
}
/**
* Returns the reference date for the cited resource.
*/
@Override
+ @XmlElement(name = "date", required = true)
public synchronized Collection<CitationDate> getDates() {
return dates = nonNullCollection(dates, CitationDate.class);
}
@@ -154,16 +301,17 @@ public class DefaultCitation extends ISO
/**
* Sets the reference date for the cited resource.
*
- * @param newValues The new dates.
+ * @param newValues The new dates, or {@code null} if none.
*/
public synchronized void setDates(final Collection<? extends CitationDate> newValues) {
- dates = copyCollection(newValues, dates, CitationDate.class);
+ dates = writeCollection(newValues, dates, CitationDate.class);
}
/**
* Returns the version of the cited resource.
*/
@Override
+ @XmlElement(name = "edition")
public synchronized InternationalString getEdition() {
return edition;
}
@@ -171,7 +319,7 @@ public class DefaultCitation extends ISO
/**
* Sets the version of the cited resource.
*
- * @param newValue The new edition.
+ * @param newValue The new edition, or {@code null} if none.
*/
public synchronized void setEdition(final InternationalString newValue) {
checkWritePermission();
@@ -179,80 +327,111 @@ public class DefaultCitation extends ISO
}
/**
- * Returns the date of the edition, or {@code null} if none.
+ * Returns the date of the edition.
*/
@Override
+ @XmlElement(name = "editionDate")
public synchronized Date getEditionDate() {
- return (editionDate != Long.MIN_VALUE) ? new Date(editionDate) : null;
+ return toDate(editionDate);
}
/**
- * Sets the date of the edition, or {@code null} if none.
+ * Sets the date of the edition.
*
- * @param newValue The new edition date.
+ * @param newValue The new edition date, or {@code null} if none.
*/
public synchronized void setEditionDate(final Date newValue) {
checkWritePermission();
- editionDate = (newValue != null) ? newValue.getTime() : Long.MIN_VALUE;
+ editionDate = toMilliseconds(newValue);
}
/**
- * Returns the unique identifier for the resource. Example: Universal Product Code (UPC),
- * National Stock Number (NSN).
+ * Returns the unique identifier for the resource.
+ * Example: Universal Product Code (UPC), National Stock Number (NSN).
+ *
+ * {@section Unified identifiers view}
+ * In this SIS implementation, the collection returned by this method includes the
+ * {@linkplain #getISBN() ISBN} and {@linkplain #getISSN() ISSN} codes
+ * (except at XML marshalling time for ISO 19139 compliance).
*/
@Override
- public Collection<Identifier> getIdentifiers() {
- return java.util.Collections.emptyList(); // TODO: Not yet implemented on intend.
+ @XmlElement(name = "identifier")
+ public synchronized Collection<Identifier> getIdentifiers() {
+ identifiers = nonNullCollection(identifiers, Identifier.class);
+ return filterIdentifiers(identifiers);
+ }
+
+ /**
+ * Sets the unique identifier for the resource.
+ * Example: Universal Product Code (UPC), National Stock Number (NSN).
+ *
+ * <p>The following exceptions apply:</p>
+ * <ul>
+ * <li>This method does not set the {@linkplain #getISBN() ISBN} and {@linkplain #getISSN() ISSN}
+ * codes, even if they are included in the given collection. The ISBN/ISSN codes shall be set
+ * by the {@link #setISBN(String)} or {@link #setISSN(String)} methods, for compliance with
+ * the ISO 19115 model.</li>
+ * <li>The {@linkplain IdentifierSpace XML identifiers} ({@linkplain IdentifierSpace#ID ID},
+ * {@linkplain IdentifierSpace#UUID UUID}, <i>etc.</i>) are ignored because.</li>
+ * </ul>
+ *
+ * @param newValues The new identifiers, or {@code null} if none.
+ */
+ public synchronized void setIdentifiers(final Collection<? extends Identifier> newValues) {
+ final Collection<Identifier> oldIds = NonMarshalledAuthority.getIdentifiers(identifiers);
+ identifiers = writeCollection(newValues, identifiers, Identifier.class);
+ NonMarshalledAuthority.setIdentifiers(identifiers, oldIds);
}
/**
* Returns the name and position information for an individual or organization that is
- * responsible for the resource. Returns an empty string if there is none.
+ * responsible for the resource.
*/
@Override
+ @XmlElement(name = "citedResponsibleParty")
public synchronized Collection<ResponsibleParty> getCitedResponsibleParties() {
return citedResponsibleParties = nonNullCollection(citedResponsibleParties, ResponsibleParty.class);
}
/**
* Sets the name and position information for an individual or organization that is responsible
- * for the resource. Returns an empty string if there is none.
+ * for the resource.
*
- * @param newValues The new cited responsible parties.
+ * @param newValues The new cited responsible parties, or {@code null} if none.
*/
public synchronized void setCitedResponsibleParties(final Collection<? extends ResponsibleParty> newValues) {
- citedResponsibleParties = copyCollection(newValues, citedResponsibleParties, ResponsibleParty.class);
+ citedResponsibleParties = writeCollection(newValues, citedResponsibleParties, ResponsibleParty.class);
}
/**
- * Returns the mode in which the resource is represented, or an empty string if none.
+ * Returns the mode in which the resource is represented.
*/
@Override
+ @XmlElement(name = "presentationForm")
public synchronized Collection<PresentationForm> getPresentationForms() {
return presentationForms = nonNullCollection(presentationForms, PresentationForm.class);
}
/**
- * Sets the mode in which the resource is represented, or an empty string if none.
+ * Sets the mode in which the resource is represented.
*
- * @param newValues The new presentation form.
+ * @param newValues The new presentation form, or {@code null} if none.
*/
public synchronized void setPresentationForms(final Collection<? extends PresentationForm> newValues) {
- presentationForms = copyCollection(newValues, presentationForms, PresentationForm.class);
+ presentationForms = writeCollection(newValues, presentationForms, PresentationForm.class);
}
/**
- * Returns the information about the series, or aggregate dataset, of which the dataset is
- * a part. Returns {@code null} if none.
+ * Returns the information about the series, or aggregate dataset, of which the dataset is a part.
*/
@Override
+ @XmlElement(name = "series")
public synchronized Series getSeries() {
return series;
}
/**
- * Sets the information about the series, or aggregate dataset, of which the dataset is
- * a part. Set to {@code null} if none.
+ * Sets the information about the series, or aggregate dataset, of which the dataset is a part.
*
* @param newValue The new series.
*/
@@ -263,18 +442,17 @@ public class DefaultCitation extends ISO
/**
* Returns other information required to complete the citation that is not recorded elsewhere.
- * Returns {@code null} if none.
*/
@Override
+ @XmlElement(name = "otherCitationDetails")
public synchronized InternationalString getOtherCitationDetails() {
return otherCitationDetails;
}
/**
* Sets other information required to complete the citation that is not recorded elsewhere.
- * Sets to {@code null} if none.
*
- * @param newValue Other citations details.
+ * @param newValue Other citations details, or {@code null} if none.
*/
public synchronized void setOtherCitationDetails(final InternationalString newValue) {
checkWritePermission();
@@ -284,19 +462,19 @@ public class DefaultCitation extends ISO
/**
* Returns the common title with holdings note. Note: title identifies elements of a series
* collectively, combined with information about what volumes are available at the
- * source cited. Returns {@code null} if there is no title.
+ * source cited.
*/
@Override
+ @XmlElement(name = "collectiveTitle")
public synchronized InternationalString getCollectiveTitle() {
return collectiveTitle;
}
/**
- * Sets the common title with holdings note. Note: title identifies elements of a series
- * collectively, combined with information about what volumes are available at the
- * source cited. Set to {@code null} if there is no title.
+ * Sets the common title with holdings note. This title identifies elements of a series
+ * collectively, combined with information about what volumes are available at the source cited.
*
- * @param newValue The new collective title.
+ * @param newValue The new collective title, or {@code null} if none.
*/
public synchronized void setCollectiveTitle(final InternationalString newValue) {
checkWritePermission();
@@ -304,18 +482,68 @@ public class DefaultCitation extends ISO
}
/**
- * Returns the International Standard Book Number, or {@code null} if none.
+ * Returns the International Standard Book Number.
+ * In this SIS implementation, invoking this method is equivalent to:
+ *
+ * {@preformat java
+ * return getIdentifierMap().getSpecialized(Citations.ISBN);
+ * }
+ *
+ * @see Citations#ISBN
*/
@Override
+ @XmlElement(name = "ISBN")
public synchronized String getISBN() {
- return null; // Not yet implemented on intend.
+ return CollectionsExt.isNullOrEmpty(identifiers) ? null : getIdentifierMap().getSpecialized(ISBN);
+ }
+
+ /**
+ * Sets the International Standard Book Number.
+ * In this SIS implementation, invoking this method is equivalent to:
+ *
+ * {@preformat java
+ * getIdentifierMap().putSpecialized(Citations.ISBN, newValue);
+ * }
+ *
+ * @param newValue The new ISBN, or {@code null} if none.
+ */
+ public synchronized void setISBN(final String newValue) {
+ checkWritePermission();
+ if (newValue != null || !CollectionsExt.isNullOrEmpty(identifiers)) {
+ getIdentifierMap().putSpecialized(ISBN, newValue);
+ }
}
/**
- * Returns the International Standard Serial Number, or {@code null} if none.
+ * Returns the International Standard Serial Number.
+ * In this SIS implementation, invoking this method is equivalent to:
+ *
+ * {@preformat java
+ * return getIdentifierMap().getSpecialized(Citations.ISSN);
+ * }
+ *
+ * @see Citations#ISSN
*/
@Override
+ @XmlElement(name = "ISSN")
public synchronized String getISSN() {
- return null; // Not yet implemented on intend.
+ return CollectionsExt.isNullOrEmpty(identifiers) ? null : getIdentifierMap().getSpecialized(ISSN);
+ }
+
+ /**
+ * Sets the International Standard Serial Number.
+ * In this SIS implementation, invoking this method is equivalent to:
+ *
+ * {@preformat java
+ * getIdentifierMap().putSpecialized(Citations.ISSN, newValue);
+ * }
+ *
+ * @param newValue The new ISSN.
+ */
+ public synchronized void setISSN(final String newValue) {
+ checkWritePermission();
+ if (newValue != null || !CollectionsExt.isNullOrEmpty(identifiers)) {
+ getIdentifierMap().putSpecialized(ISSN, newValue);
+ }
}
}
Modified: sis/trunk/sis-metadata/src/main/java/org/apache/sis/metadata/iso/extent/DefaultTemporalExtent.java
URL: http://svn.apache.org/viewvc/sis/trunk/sis-metadata/src/main/java/org/apache/sis/metadata/iso/extent/DefaultTemporalExtent.java?rev=1464085&r1=1463928&r2=1464085&view=diff
==============================================================================
--- sis/trunk/sis-metadata/src/main/java/org/apache/sis/metadata/iso/extent/DefaultTemporalExtent.java [UTF-8] (original)
+++ sis/trunk/sis-metadata/src/main/java/org/apache/sis/metadata/iso/extent/DefaultTemporalExtent.java [UTF-8] Wed Apr 3 16:00:28 2013
@@ -22,8 +22,8 @@ import javax.xml.bind.annotation.XmlSeeA
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import org.opengis.geometry.Envelope;
-import org.opengis.temporal.Period;
-import org.opengis.temporal.Instant;
+import org.apache.sis.internal.geoapi.temporal.Period;
+import org.apache.sis.internal.geoapi.temporal.Instant;
import org.opengis.temporal.TemporalPrimitive;
import org.opengis.metadata.extent.TemporalExtent;
import org.opengis.metadata.extent.SpatialTemporalExtent;
@@ -120,6 +120,8 @@ public class DefaultTemporalExtent exten
* If no extent has been {@linkplain #setExtent(TemporalPrimitive) explicitely set},
* then this method will build an extent from the {@linkplain #getStartTime() start
* time} and {@linkplain #getEndTime() end time} if any.
+ *
+ * @return The content date.
*/
@Override
@XmlElement(name = "extent", required = true)
@@ -130,7 +132,7 @@ public class DefaultTemporalExtent exten
/**
* Sets the date and time for the content of the dataset.
*
- * @param newValue The new extent.
+ * @param newValue The new content date.
*/
public synchronized void setExtent(final TemporalPrimitive newValue) {
checkWritePermission();
Modified: sis/trunk/sis-metadata/src/main/java/org/apache/sis/referencing/DefaultReferenceIdentifier.java
URL: http://svn.apache.org/viewvc/sis/trunk/sis-metadata/src/main/java/org/apache/sis/referencing/DefaultReferenceIdentifier.java?rev=1464085&r1=1463928&r2=1464085&view=diff
==============================================================================
--- sis/trunk/sis-metadata/src/main/java/org/apache/sis/referencing/DefaultReferenceIdentifier.java [UTF-8] (original)
+++ sis/trunk/sis-metadata/src/main/java/org/apache/sis/referencing/DefaultReferenceIdentifier.java [UTF-8] Wed Apr 3 16:00:28 2013
@@ -359,8 +359,10 @@ public class DefaultReferenceIdentifier
key= AUTHORITY_KEY; this.authority = (Citation) (value = authority);
key= REMARKS_KEY; this.remarks = (InternationalString) (value = remarks);
} catch (ClassCastException exception) {
- throw new InvalidParameterValueException(
- Errors.format(Errors.Keys.IllegalArgumentValue_2, key, value), exception, key, value);
+ final InvalidParameterValueException e = new InvalidParameterValueException(
+ Errors.format(Errors.Keys.IllegalArgumentValue_2, key, value), key, value);
+ e.initCause(exception);
+ throw e;
}
ensureNonNull(CODE_KEY, code);
}
Modified: sis/trunk/sis-metadata/src/site/site.xml
URL: http://svn.apache.org/viewvc/sis/trunk/sis-metadata/src/site/site.xml?rev=1464085&r1=1464084&r2=1464085&view=diff
==============================================================================
--- sis/trunk/sis-metadata/src/site/site.xml (original)
+++ sis/trunk/sis-metadata/src/site/site.xml Wed Apr 3 16:00:28 2013
@@ -26,8 +26,8 @@
<body>
<menu name="Quick links">
<item name="Module Javadoc" href="apidocs/index.html"/>
+ <item name="FAQ" href="faq.html"/>
<item name="Apache SIS home" href="../index.html"/>
</menu>
-
</body>
</project>