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/14 01:15:39 UTC
svn commit: r1550857 [2/3] - in /sis/trunk: ./
application/sis-console/src/test/java/org/apache/sis/console/
core/sis-build-helper/src/main/java/org/apache/sis/internal/taglet/
core/sis-build-helper/src/site/apt/
core/sis-metadata/src/main/java/org/apa...
Modified: sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/metadata/MD_RepresentativeFraction.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/metadata/MD_RepresentativeFraction.java?rev=1550857&r1=1550856&r2=1550857&view=diff
==============================================================================
--- sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/metadata/MD_RepresentativeFraction.java [UTF-8] (original)
+++ sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/metadata/MD_RepresentativeFraction.java [UTF-8] Sat Dec 14 00:15:36 2013
@@ -45,6 +45,8 @@ public final class MD_RepresentativeFrac
* Returns the GeoAPI interface which is bound by this adapter.
* This method is indirectly invoked by the private constructor
* below, so it shall not depend on the state of this object.
+ *
+ * @return {@code RepresentativeFraction.class}
*/
@Override
protected Class<RepresentativeFraction> getBoundType() {
@@ -79,7 +81,7 @@ public final class MD_RepresentativeFrac
*/
@XmlElementRef
public DefaultRepresentativeFraction getElement() {
- return skip() ? null : DefaultRepresentativeFraction.castOrCopy(metadata);
+ return DefaultRepresentativeFraction.castOrCopy(metadata);
}
/**
Modified: sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/metadata/MD_Resolution.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/metadata/MD_Resolution.java?rev=1550857&r1=1550856&r2=1550857&view=diff
==============================================================================
--- sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/metadata/MD_Resolution.java [UTF-8] (original)
+++ sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/metadata/MD_Resolution.java [UTF-8] Sat Dec 14 00:15:36 2013
@@ -43,6 +43,8 @@ public final class MD_Resolution extends
* Returns the GeoAPI interface which is bound by this adapter.
* This method is indirectly invoked by the private constructor
* below, so it shall not depend on the state of this object.
+ *
+ * @return {@code Resolution.class}
*/
@Override
protected Class<Resolution> getBoundType() {
@@ -77,7 +79,7 @@ public final class MD_Resolution extends
*/
@XmlElementRef
public DefaultResolution getElement() {
- return skip() ? null : DefaultResolution.castOrCopy(metadata);
+ return DefaultResolution.castOrCopy(metadata);
}
/**
Modified: sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/metadata/MD_ScopeDescription.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/metadata/MD_ScopeDescription.java?rev=1550857&r1=1550856&r2=1550857&view=diff
==============================================================================
--- sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/metadata/MD_ScopeDescription.java [UTF-8] (original)
+++ sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/metadata/MD_ScopeDescription.java [UTF-8] Sat Dec 14 00:15:36 2013
@@ -43,6 +43,8 @@ public final class MD_ScopeDescription e
* Returns the GeoAPI interface which is bound by this adapter.
* This method is indirectly invoked by the private constructor
* below, so it shall not depend on the state of this object.
+ *
+ * @return {@code ScopeDescription.class}
*/
@Override
protected Class<ScopeDescription> getBoundType() {
@@ -77,7 +79,7 @@ public final class MD_ScopeDescription e
*/
@XmlElementRef
public DefaultScopeDescription getElement() {
- return skip() ? null : DefaultScopeDescription.castOrCopy(metadata);
+ return DefaultScopeDescription.castOrCopy(metadata);
}
/**
Modified: sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/metadata/MD_SpatialRepresentation.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/metadata/MD_SpatialRepresentation.java?rev=1550857&r1=1550856&r2=1550857&view=diff
==============================================================================
--- sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/metadata/MD_SpatialRepresentation.java [UTF-8] (original)
+++ sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/metadata/MD_SpatialRepresentation.java [UTF-8] Sat Dec 14 00:15:36 2013
@@ -49,6 +49,8 @@ public final class MD_SpatialRepresentat
* Returns the GeoAPI interface which is bound by this adapter.
* This method is indirectly invoked by the private constructor
* below, so it shall not depend on the state of this object.
+ *
+ * @return {@code SpatialRepresentation.class}
*/
@Override
protected Class<SpatialRepresentation> getBoundType() {
@@ -83,7 +85,6 @@ public final class MD_SpatialRepresentat
*/
@XmlElementRef
public AbstractSpatialRepresentation getElement() {
- if (skip()) return null;
final SpatialRepresentation metadata = this.metadata;
if (metadata instanceof Georectified) {
return MI_Georectified.castOrCopy((Georectified) metadata);
Modified: sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/metadata/MD_StandardOrderProcess.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/metadata/MD_StandardOrderProcess.java?rev=1550857&r1=1550856&r2=1550857&view=diff
==============================================================================
--- sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/metadata/MD_StandardOrderProcess.java [UTF-8] (original)
+++ sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/metadata/MD_StandardOrderProcess.java [UTF-8] Sat Dec 14 00:15:36 2013
@@ -45,6 +45,8 @@ public final class MD_StandardOrderProce
* Returns the GeoAPI interface which is bound by this adapter.
* This method is indirectly invoked by the private constructor
* below, so it shall not depend on the state of this object.
+ *
+ * @return {@code StandardOrderProcess.class}
*/
@Override
protected Class<StandardOrderProcess> getBoundType() {
@@ -79,7 +81,7 @@ public final class MD_StandardOrderProce
*/
@XmlElementRef
public DefaultStandardOrderProcess getElement() {
- return skip() ? null : DefaultStandardOrderProcess.castOrCopy(metadata);
+ return DefaultStandardOrderProcess.castOrCopy(metadata);
}
/**
Modified: sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/metadata/MD_Usage.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/metadata/MD_Usage.java?rev=1550857&r1=1550856&r2=1550857&view=diff
==============================================================================
--- sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/metadata/MD_Usage.java [UTF-8] (original)
+++ sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/metadata/MD_Usage.java [UTF-8] Sat Dec 14 00:15:36 2013
@@ -43,6 +43,8 @@ public final class MD_Usage extends Prop
* Returns the GeoAPI interface which is bound by this adapter.
* This method is indirectly invoked by the private constructor
* below, so it shall not depend on the state of this object.
+ *
+ * @return {@code Usage.class}
*/
@Override
protected Class<Usage> getBoundType() {
@@ -77,7 +79,7 @@ public final class MD_Usage extends Prop
*/
@XmlElementRef
public DefaultUsage getElement() {
- return skip() ? null : DefaultUsage.castOrCopy(metadata);
+ return DefaultUsage.castOrCopy(metadata);
}
/**
Modified: sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/metadata/MI_AcquisitionInformation.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/metadata/MI_AcquisitionInformation.java?rev=1550857&r1=1550856&r2=1550857&view=diff
==============================================================================
--- sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/metadata/MI_AcquisitionInformation.java [UTF-8] (original)
+++ sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/metadata/MI_AcquisitionInformation.java [UTF-8] Sat Dec 14 00:15:36 2013
@@ -45,6 +45,8 @@ public final class MI_AcquisitionInforma
* Returns the GeoAPI interface which is bound by this adapter.
* This method is indirectly invoked by the private constructor
* below, so it shall not depend on the state of this object.
+ *
+ * @return {@code AcquisitionInformation.class}
*/
@Override
protected Class<AcquisitionInformation> getBoundType() {
@@ -79,7 +81,7 @@ public final class MI_AcquisitionInforma
*/
@XmlElementRef
public DefaultAcquisitionInformation getElement() {
- return skip() ? null : DefaultAcquisitionInformation.castOrCopy(metadata);
+ return DefaultAcquisitionInformation.castOrCopy(metadata);
}
/**
Modified: sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/metadata/MI_EnvironmentalRecord.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/metadata/MI_EnvironmentalRecord.java?rev=1550857&r1=1550856&r2=1550857&view=diff
==============================================================================
--- sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/metadata/MI_EnvironmentalRecord.java [UTF-8] (original)
+++ sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/metadata/MI_EnvironmentalRecord.java [UTF-8] Sat Dec 14 00:15:36 2013
@@ -45,6 +45,8 @@ public final class MI_EnvironmentalRecor
* Returns the GeoAPI interface which is bound by this adapter.
* This method is indirectly invoked by the private constructor
* below, so it shall not depend on the state of this object.
+ *
+ * @return {@code EnvironmentalRecord.class}
*/
@Override
protected Class<EnvironmentalRecord> getBoundType() {
@@ -79,7 +81,7 @@ public final class MI_EnvironmentalRecor
*/
@XmlElementRef
public DefaultEnvironmentalRecord getElement() {
- return skip() ? null : DefaultEnvironmentalRecord.castOrCopy(metadata);
+ return DefaultEnvironmentalRecord.castOrCopy(metadata);
}
/**
Modified: sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/metadata/MI_Event.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/metadata/MI_Event.java?rev=1550857&r1=1550856&r2=1550857&view=diff
==============================================================================
--- sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/metadata/MI_Event.java [UTF-8] (original)
+++ sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/metadata/MI_Event.java [UTF-8] Sat Dec 14 00:15:36 2013
@@ -43,6 +43,8 @@ public final class MI_Event extends Prop
* Returns the GeoAPI interface which is bound by this adapter.
* This method is indirectly invoked by the private constructor
* below, so it shall not depend on the state of this object.
+ *
+ * @return {@code Event.class}
*/
@Override
protected Class<Event> getBoundType() {
@@ -77,7 +79,7 @@ public final class MI_Event extends Prop
*/
@XmlElementRef
public DefaultEvent getElement() {
- return skip() ? null : DefaultEvent.castOrCopy(metadata);
+ return DefaultEvent.castOrCopy(metadata);
}
/**
Modified: sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/metadata/MI_GCP.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/metadata/MI_GCP.java?rev=1550857&r1=1550856&r2=1550857&view=diff
==============================================================================
--- sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/metadata/MI_GCP.java [UTF-8] (original)
+++ sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/metadata/MI_GCP.java [UTF-8] Sat Dec 14 00:15:36 2013
@@ -43,6 +43,8 @@ public final class MI_GCP extends Proper
* Returns the GeoAPI interface which is bound by this adapter.
* This method is indirectly invoked by the private constructor
* below, so it shall not depend on the state of this object.
+ *
+ * @return {@code GCP.class}
*/
@Override
protected Class<GCP> getBoundType() {
@@ -77,7 +79,7 @@ public final class MI_GCP extends Proper
*/
@XmlElementRef
public DefaultGCP getElement() {
- return skip() ? null : DefaultGCP.castOrCopy(metadata);
+ return DefaultGCP.castOrCopy(metadata);
}
/**
Modified: sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/metadata/MI_GeolocationInformation.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/metadata/MI_GeolocationInformation.java?rev=1550857&r1=1550856&r2=1550857&view=diff
==============================================================================
--- sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/metadata/MI_GeolocationInformation.java [UTF-8] (original)
+++ sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/metadata/MI_GeolocationInformation.java [UTF-8] Sat Dec 14 00:15:36 2013
@@ -45,6 +45,8 @@ public final class MI_GeolocationInforma
* Returns the GeoAPI interface which is bound by this adapter.
* This method is indirectly invoked by the private constructor
* below, so it shall not depend on the state of this object.
+ *
+ * @return {@code GeolocationInformation.class}
*/
@Override
protected Class<GeolocationInformation> getBoundType() {
@@ -79,7 +81,7 @@ public final class MI_GeolocationInforma
*/
@XmlElementRef
public AbstractGeolocationInformation getElement() {
- return skip() ? null : AbstractGeolocationInformation.castOrCopy(metadata);
+ return AbstractGeolocationInformation.castOrCopy(metadata);
}
/**
Modified: sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/metadata/MI_Instrument.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/metadata/MI_Instrument.java?rev=1550857&r1=1550856&r2=1550857&view=diff
==============================================================================
--- sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/metadata/MI_Instrument.java [UTF-8] (original)
+++ sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/metadata/MI_Instrument.java [UTF-8] Sat Dec 14 00:15:36 2013
@@ -43,6 +43,8 @@ public final class MI_Instrument extends
* Returns the GeoAPI interface which is bound by this adapter.
* This method is indirectly invoked by the private constructor
* below, so it shall not depend on the state of this object.
+ *
+ * @return {@code Instrument.class}
*/
@Override
protected Class<Instrument> getBoundType() {
@@ -77,7 +79,7 @@ public final class MI_Instrument extends
*/
@XmlElementRef
public DefaultInstrument getElement() {
- return skip() ? null : DefaultInstrument.castOrCopy(metadata);
+ return DefaultInstrument.castOrCopy(metadata);
}
/**
Modified: sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/metadata/MI_Objective.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/metadata/MI_Objective.java?rev=1550857&r1=1550856&r2=1550857&view=diff
==============================================================================
--- sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/metadata/MI_Objective.java [UTF-8] (original)
+++ sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/metadata/MI_Objective.java [UTF-8] Sat Dec 14 00:15:36 2013
@@ -43,6 +43,8 @@ public final class MI_Objective extends
* Returns the GeoAPI interface which is bound by this adapter.
* This method is indirectly invoked by the private constructor
* below, so it shall not depend on the state of this object.
+ *
+ * @return {@code Objective.class}
*/
@Override
protected Class<Objective> getBoundType() {
@@ -77,7 +79,7 @@ public final class MI_Objective extends
*/
@XmlElementRef
public DefaultObjective getElement() {
- return skip() ? null : DefaultObjective.castOrCopy(metadata);
+ return DefaultObjective.castOrCopy(metadata);
}
/**
Modified: sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/metadata/MI_Operation.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/metadata/MI_Operation.java?rev=1550857&r1=1550856&r2=1550857&view=diff
==============================================================================
--- sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/metadata/MI_Operation.java [UTF-8] (original)
+++ sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/metadata/MI_Operation.java [UTF-8] Sat Dec 14 00:15:36 2013
@@ -43,6 +43,8 @@ public final class MI_Operation extends
* Returns the GeoAPI interface which is bound by this adapter.
* This method is indirectly invoked by the private constructor
* below, so it shall not depend on the state of this object.
+ *
+ * @return {@code Operation.class}
*/
@Override
protected Class<Operation> getBoundType() {
@@ -77,7 +79,7 @@ public final class MI_Operation extends
*/
@XmlElementRef
public DefaultOperation getElement() {
- return skip() ? null : DefaultOperation.castOrCopy(metadata);
+ return DefaultOperation.castOrCopy(metadata);
}
/**
Modified: sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/metadata/MI_Plan.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/metadata/MI_Plan.java?rev=1550857&r1=1550856&r2=1550857&view=diff
==============================================================================
--- sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/metadata/MI_Plan.java [UTF-8] (original)
+++ sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/metadata/MI_Plan.java [UTF-8] Sat Dec 14 00:15:36 2013
@@ -43,6 +43,8 @@ public final class MI_Plan extends Prope
* Returns the GeoAPI interface which is bound by this adapter.
* This method is indirectly invoked by the private constructor
* below, so it shall not depend on the state of this object.
+ *
+ * @return {@code Plan.class}
*/
@Override
protected Class<Plan> getBoundType() {
@@ -77,7 +79,7 @@ public final class MI_Plan extends Prope
*/
@XmlElementRef
public DefaultPlan getElement() {
- return skip() ? null : DefaultPlan.castOrCopy(metadata);
+ return DefaultPlan.castOrCopy(metadata);
}
/**
Modified: sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/metadata/MI_Platform.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/metadata/MI_Platform.java?rev=1550857&r1=1550856&r2=1550857&view=diff
==============================================================================
--- sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/metadata/MI_Platform.java [UTF-8] (original)
+++ sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/metadata/MI_Platform.java [UTF-8] Sat Dec 14 00:15:36 2013
@@ -43,6 +43,8 @@ public final class MI_Platform extends P
* Returns the GeoAPI interface which is bound by this adapter.
* This method is indirectly invoked by the private constructor
* below, so it shall not depend on the state of this object.
+ *
+ * @return {@code Platform.class}
*/
@Override
protected Class<Platform> getBoundType() {
@@ -77,7 +79,7 @@ public final class MI_Platform extends P
*/
@XmlElementRef
public DefaultPlatform getElement() {
- return skip() ? null : DefaultPlatform.castOrCopy(metadata);
+ return DefaultPlatform.castOrCopy(metadata);
}
/**
Modified: sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/metadata/MI_PlatformPass.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/metadata/MI_PlatformPass.java?rev=1550857&r1=1550856&r2=1550857&view=diff
==============================================================================
--- sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/metadata/MI_PlatformPass.java [UTF-8] (original)
+++ sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/metadata/MI_PlatformPass.java [UTF-8] Sat Dec 14 00:15:36 2013
@@ -43,6 +43,8 @@ public final class MI_PlatformPass exten
* Returns the GeoAPI interface which is bound by this adapter.
* This method is indirectly invoked by the private constructor
* below, so it shall not depend on the state of this object.
+ *
+ * @return {@code PlatformPass.class}
*/
@Override
protected Class<PlatformPass> getBoundType() {
@@ -77,7 +79,7 @@ public final class MI_PlatformPass exten
*/
@XmlElementRef
public DefaultPlatformPass getElement() {
- return skip() ? null : DefaultPlatformPass.castOrCopy(metadata);
+ return DefaultPlatformPass.castOrCopy(metadata);
}
/**
Modified: sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/metadata/MI_RangeElementDescription.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/metadata/MI_RangeElementDescription.java?rev=1550857&r1=1550856&r2=1550857&view=diff
==============================================================================
--- sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/metadata/MI_RangeElementDescription.java [UTF-8] (original)
+++ sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/metadata/MI_RangeElementDescription.java [UTF-8] Sat Dec 14 00:15:36 2013
@@ -45,6 +45,8 @@ public final class MI_RangeElementDescri
* Returns the GeoAPI interface which is bound by this adapter.
* This method is indirectly invoked by the private constructor
* below, so it shall not depend on the state of this object.
+ *
+ * @return {@code RangeElementDescription.class}
*/
@Override
protected Class<RangeElementDescription> getBoundType() {
@@ -79,7 +81,7 @@ public final class MI_RangeElementDescri
*/
@XmlElementRef
public DefaultRangeElementDescription getElement() {
- return skip() ? null : DefaultRangeElementDescription.castOrCopy(metadata);
+ return DefaultRangeElementDescription.castOrCopy(metadata);
}
/**
Modified: sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/metadata/MI_RequestedDate.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/metadata/MI_RequestedDate.java?rev=1550857&r1=1550856&r2=1550857&view=diff
==============================================================================
--- sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/metadata/MI_RequestedDate.java [UTF-8] (original)
+++ sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/metadata/MI_RequestedDate.java [UTF-8] Sat Dec 14 00:15:36 2013
@@ -43,6 +43,8 @@ public final class MI_RequestedDate exte
* Returns the GeoAPI interface which is bound by this adapter.
* This method is indirectly invoked by the private constructor
* below, so it shall not depend on the state of this object.
+ *
+ * @return {@code RequestedDate.class}
*/
@Override
protected Class<RequestedDate> getBoundType() {
@@ -77,7 +79,7 @@ public final class MI_RequestedDate exte
*/
@XmlElementRef
public DefaultRequestedDate getElement() {
- return skip() ? null : DefaultRequestedDate.castOrCopy(metadata);
+ return DefaultRequestedDate.castOrCopy(metadata);
}
/**
Modified: sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/metadata/MI_Requirement.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/metadata/MI_Requirement.java?rev=1550857&r1=1550856&r2=1550857&view=diff
==============================================================================
--- sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/metadata/MI_Requirement.java [UTF-8] (original)
+++ sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/metadata/MI_Requirement.java [UTF-8] Sat Dec 14 00:15:36 2013
@@ -43,6 +43,8 @@ public final class MI_Requirement extend
* Returns the GeoAPI interface which is bound by this adapter.
* This method is indirectly invoked by the private constructor
* below, so it shall not depend on the state of this object.
+ *
+ * @return {@code Requirement.class}
*/
@Override
protected Class<Requirement> getBoundType() {
@@ -77,7 +79,7 @@ public final class MI_Requirement extend
*/
@XmlElementRef
public DefaultRequirement getElement() {
- return skip() ? null : DefaultRequirement.castOrCopy(metadata);
+ return DefaultRequirement.castOrCopy(metadata);
}
/**
Modified: sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/metadata/MX_DataFile.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/metadata/MX_DataFile.java?rev=1550857&r1=1550856&r2=1550857&view=diff
==============================================================================
--- sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/metadata/MX_DataFile.java [UTF-8] (original)
+++ sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/metadata/MX_DataFile.java [UTF-8] Sat Dec 14 00:15:36 2013
@@ -43,6 +43,8 @@ public final class MX_DataFile extends P
* Returns the GeoAPI interface which is bound by this adapter.
* This method is indirectly invoked by the private constructor
* below, so it shall not depend on the state of this object.
+ *
+ * @return {@code DataFile.class}
*/
@Override
protected Class<DataFile> getBoundType() {
@@ -77,7 +79,7 @@ public final class MX_DataFile extends P
*/
@XmlElementRef
public DefaultDataFile getElement() {
- return skip() ? null : DefaultDataFile.castOrCopy(metadata);
+ return DefaultDataFile.castOrCopy(metadata);
}
/**
Modified: sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/metadata/RS_Identifier.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/metadata/RS_Identifier.java?rev=1550857&r1=1550856&r2=1550857&view=diff
==============================================================================
--- sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/metadata/RS_Identifier.java [UTF-8] (original)
+++ sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/metadata/RS_Identifier.java [UTF-8] Sat Dec 14 00:15:36 2013
@@ -48,6 +48,8 @@ public final class RS_Identifier extends
* Returns the GeoAPI interface which is bound by this adapter.
* This method is indirectly invoked by the private constructor
* below, so it shall not depend on the state of this object.
+ *
+ * @return {@code ReferenceIdentifier.class}
*/
@Override
protected Class<ReferenceIdentifier> getBoundType() {
@@ -82,9 +84,10 @@ public final class RS_Identifier extends
*/
@XmlElementRef
public ImmutableIdentifier getElement() {
- if (skip()) return null;
final ReferenceIdentifier metadata = this.metadata;
- if (metadata instanceof ImmutableIdentifier) {
+ if (metadata == null) {
+ return null;
+ } else if (metadata instanceof ImmutableIdentifier) {
return (ImmutableIdentifier) metadata;
} else {
return new ImmutableIdentifier(metadata);
Modified: sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/metadata/RS_ReferenceSystem.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/metadata/RS_ReferenceSystem.java?rev=1550857&r1=1550856&r2=1550857&view=diff
==============================================================================
--- sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/metadata/RS_ReferenceSystem.java [UTF-8] (original)
+++ sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/metadata/RS_ReferenceSystem.java [UTF-8] Sat Dec 14 00:15:36 2013
@@ -41,6 +41,8 @@ public final class RS_ReferenceSystem ex
* Returns the GeoAPI interface which is bound by this adapter.
* This method is indirectly invoked by the private constructor
* below, so it shall not depend on the state of this object.
+ *
+ * @return {@code ReferenceSystem.class}
*/
@Override
protected Class<ReferenceSystem> getBoundType() {
@@ -77,9 +79,10 @@ public final class RS_ReferenceSystem ex
*/
@XmlElementRef
public ReferenceSystemMetadata getElement() {
- if (skip()) return null;
final ReferenceSystem metadata = this.metadata;
- if (metadata instanceof ReferenceSystemMetadata) {
+ if (metadata == null) {
+ return null;
+ } else if (metadata instanceof ReferenceSystemMetadata) {
return (ReferenceSystemMetadata) metadata;
} else {
return new ReferenceSystemMetadata(metadata);
Modified: sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/internal/metadata/ExcludedSet.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/internal/metadata/ExcludedSet.java?rev=1550857&r1=1550856&r2=1550857&view=diff
==============================================================================
--- sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/internal/metadata/ExcludedSet.java [UTF-8] (original)
+++ sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/internal/metadata/ExcludedSet.java [UTF-8] Sat Dec 14 00:15:36 2013
@@ -61,6 +61,8 @@ public final class ExcludedSet<E> extend
/**
* Returns {@code true} since this set is always empty.
+ *
+ * @return {@code true}
*/
@Override
public boolean isEmpty() {
@@ -69,6 +71,8 @@ public final class ExcludedSet<E> extend
/**
* Returns {@code 0} since this set is always empty.
+ *
+ * @return 0
*/
@Override
public int size() {
@@ -77,6 +81,8 @@ public final class ExcludedSet<E> extend
/**
* Returns the empty iterator.
+ *
+ * @return Empty iterator.
*/
@Override
public Iterator<E> iterator() {
@@ -86,6 +92,9 @@ public final class ExcludedSet<E> extend
/**
* Unconditionally throws a {@link UnsupportedOperationException} with a message
* saying which properties are mutually exclusive.
+ *
+ * @param e Ignored.
+ * @return Never return.
*/
@Override
public boolean add(final E e) {
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=1550857&r1=1550856&r2=1550857&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] Sat Dec 14 00:15:36 2013
@@ -19,6 +19,7 @@ package org.apache.sis.metadata;
import java.util.Map;
import java.util.logging.Logger;
import javax.xml.bind.annotation.XmlTransient;
+import org.apache.sis.util.Emptiable;
import org.apache.sis.util.ComparisonMode;
import org.apache.sis.util.LenientComparable;
import org.apache.sis.util.collection.TreeTable;
@@ -75,7 +76,7 @@ import org.apache.sis.util.logging.Loggi
* @see MetadataStandard
*/
@XmlTransient
-public abstract class AbstractMetadata implements LenientComparable {
+public abstract class AbstractMetadata implements LenientComparable, Emptiable {
/**
* The logger for messages related to metadata implementations.
*/
@@ -125,8 +126,7 @@ public abstract class AbstractMetadata i
* <li>An other metadata object containing only {@code null}, nil or empty properties.</li>
* </ul>
*
- * Note that empty properties can be removed by calling the {@link ModifiableMetadata#prune()}
- * method.
+ * Note that empty properties can be removed by calling the {@link ModifiableMetadata#prune()} method.
*
* {@section Note for implementors}
* The default implementation uses Java reflection indirectly, by iterating over all entries
@@ -139,6 +139,7 @@ public abstract class AbstractMetadata i
*
* @see org.apache.sis.metadata.iso.extent.DefaultGeographicBoundingBox#isEmpty()
*/
+ @Override
public boolean isEmpty() {
return Pruner.isEmpty(this, false);
}
Modified: sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/metadata/Pruner.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/metadata/Pruner.java?rev=1550857&r1=1550856&r2=1550857&view=diff
==============================================================================
--- sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/metadata/Pruner.java [UTF-8] (original)
+++ sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/metadata/Pruner.java [UTF-8] Sat Dec 14 00:15:36 2013
@@ -20,6 +20,7 @@ import java.util.Map;
import java.util.Iterator;
import java.util.Collection;
import org.opengis.util.CodeList;
+import org.apache.sis.util.Emptiable;
import org.apache.sis.internal.util.CollectionsExt;
import static org.apache.sis.metadata.ValueExistencePolicy.*;
@@ -132,47 +133,58 @@ final class Pruner {
tested.put(value, Boolean.TRUE);
} else {
isEmpty = false;
+ if (!prune) break; // No need to continue if we are not pruning the metadata.
}
} else {
- boolean allEmpty = true;
+ /*
+ * At this point, 'value' is a new instance not yet processed by Pruner. The value may
+ * be a data object or a collection. For convenience we will proceed as if we had only
+ * collections, wrapping data object in a singleton collection if necessary.
+ */
+ boolean allElementsAreEmpty = true;
final Collection<?> values = CollectionsExt.toCollection(value);
for (final Iterator<?> it = values.iterator(); it.hasNext();) {
final Object element = it.next();
if (!isNullOrEmpty(element)) {
/*
- * If the value is not an empty "simple" property (null value, or empty
- * string, or an empty collection or array), check if it is an other
- * metadata element. If so, invoke the isEmpty() method recursively.
+ * At this point, 'element' is not an empty CharSequence, Collection or array.
+ * It may be an other metadata, a Java primitive type or user-defined object.
+ *
+ * - For AbstractMetadata, delegate to the public API in case it has been overriden.
+ * - For user-defined Emptiable, delegate to the user's isEmpty() method. Note that
+ * we test at different times depending if 'prune' is true of false.
*/
- final boolean e;
- if (element instanceof Enum<?> || element instanceof CodeList<?>) {
- e = false;
- } else if (element instanceof AbstractMetadata) {
+ boolean isEmptyElement = false;
+ if (element instanceof AbstractMetadata) {
final AbstractMetadata md = (AbstractMetadata) element;
if (prune) md.prune();
- e = md.isEmpty();
- } else {
+ isEmptyElement = md.isEmpty();
+ } else if (!prune && element instanceof Emptiable) {
+ isEmptyElement = ((Emptiable) element).isEmpty();
+ // If 'prune' is true, we will rather test for Emptiable after our pruning attempt.
+ } else if (!(element instanceof Enum<?>) && !(element instanceof CodeList<?>)) {
final MetadataStandard standard = MetadataStandard.forClass(element.getClass());
if (standard != null) {
- e = isEmpty(asMap(standard, element, prune), tested, prune);
+ isEmptyElement = isEmpty(asMap(standard, element, prune), tested, prune);
+ if (!isEmptyElement && element instanceof Emptiable) {
+ isEmptyElement = ((Emptiable) element).isEmpty();
+ }
} else if (isPrimitive(entry)) {
if (value instanceof Number) {
- e = Double.isNaN(((Number) value).doubleValue());
+ isEmptyElement = Double.isNaN(((Number) value).doubleValue());
} else {
// Typically methods of the kind 'isFooAvailable()'.
- e = Boolean.FALSE.equals(value);
+ isEmptyElement = Boolean.FALSE.equals(value);
}
- } else {
- e = false; // Element is a String, Number (not primitive), etc.
}
}
- if (!e) {
+ if (!isEmptyElement) {
// At this point, we have determined that the property is not empty.
// If we are not removing empty nodes, there is no need to continue.
if (!prune) {
return false;
}
- allEmpty = false;
+ allElementsAreEmpty = false;
continue;
}
}
@@ -183,15 +195,14 @@ final class Pruner {
}
}
// If all elements were empty, set the whole property to 'null'.
- if (allEmpty) {
+ isEmpty &= allElementsAreEmpty;
+ if (allElementsAreEmpty) {
tested.put(value, Boolean.TRUE);
if (prune) try {
entry.setValue(null);
} catch (UnsupportedOperationException e) {
// Entry is read only - ignore.
}
- } else {
- isEmpty = false;
}
}
}
Modified: sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/metadata/ValueExistencePolicy.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/metadata/ValueExistencePolicy.java?rev=1550857&r1=1550856&r2=1550857&view=diff
==============================================================================
--- sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/metadata/ValueExistencePolicy.java [UTF-8] (original)
+++ sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/metadata/ValueExistencePolicy.java [UTF-8] Sat Dec 14 00:15:36 2013
@@ -150,6 +150,11 @@ public enum ValueExistencePolicy {
* <p>This method intentionally does not inspect array or collection elements, since this method
* is invoked from methods doing shallow copy or comparison. If we were inspecting elements,
* we would need to add a check against infinite recursivity.</p>
+ *
+ * <p>This method does not check for the {@link org.apache.sis.util.Emptiable} interface because
+ * the {@code isEmpty()} method may be costly (for example {@link AbstractMetadata#isEmpty()}
+ * iterates over all the metadata tree). Instead, the check for {@code Emptiable} will be done
+ * explicitely by the caller when appropriate.</p>
*/
static boolean isNullOrEmpty(final Object value) {
if (value == null) return true;
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=1550857&r1=1550856&r2=1550857&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] Sat Dec 14 00:15:36 2013
@@ -21,7 +21,6 @@ import java.util.Locale;
import java.io.Serializable;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
-import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
import org.opengis.metadata.Identifier;
import org.opengis.metadata.citation.Citation;
import org.opengis.parameter.InvalidParameterValueException;
@@ -32,8 +31,6 @@ import org.apache.sis.util.Deprecable;
import org.apache.sis.util.resources.Errors;
import org.apache.sis.util.iso.Types;
import org.apache.sis.metadata.iso.citation.Citations;
-import org.apache.sis.internal.jaxb.metadata.CI_Citation;
-import org.apache.sis.internal.jaxb.gco.StringAdapter;
import org.apache.sis.internal.simple.SimpleIdentifiedObject;
import static org.apache.sis.util.ArgumentChecks.ensureNonNull;
@@ -76,7 +73,6 @@ public class ImmutableIdentifier impleme
* @see #getCode()
*/
@XmlElement(required = true)
- @XmlJavaTypeAdapter(StringAdapter.class)
private final String code;
/**
@@ -86,7 +82,6 @@ public class ImmutableIdentifier impleme
* @see #getCodeSpace()
*/
@XmlElement(required = true)
- @XmlJavaTypeAdapter(StringAdapter.class)
private final String codeSpace;
/**
@@ -96,7 +91,6 @@ public class ImmutableIdentifier impleme
* @see #getAuthority()
*/
@XmlElement(required = true)
- @XmlJavaTypeAdapter(CI_Citation.class)
private final Citation authority;
/**
Modified: sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/citation/Citations.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/citation/Citations.java?rev=1550857&r1=1550856&r2=1550857&view=diff
==============================================================================
--- sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/citation/Citations.java [UTF-8] (original)
+++ sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/citation/Citations.java [UTF-8] Sat Dec 14 00:15:36 2013
@@ -58,6 +58,17 @@ public final class Citations extends Sta
public static final Citation OGC = new SimpleCitation("OGC");
/**
+ * The <a href="http://www.ogp.org.uk">International Association of Oil & Gas Producers</a> organization.
+ * This organization is responsible for maintainance of {@link #EPSG} database.
+ *
+ * @see #EPSG
+ * @category Organization
+ *
+ * @since 0.4
+ */
+ public static final Citation OGP = new SimpleCitation("OGP");
+
+ /**
* The <a href="http://sis.apache.org">Apache SIS</a> project.
*
* @since 0.4
@@ -121,6 +132,7 @@ public final class Citations extends Sta
* {@linkplain org.opengis.referencing.crs.CoordinateReferenceSystem coordinate reference system}
* identifiers.
*
+ * @see #OGP
* @see #AUTO
* @see #AUTO2
* @see #CRS
@@ -157,7 +169,7 @@ public final class Citations extends Sta
* List of citations declared in this class.
*/
private static final Citation[] AUTHORITIES = {
- ISO, OGC, SIS, ESRI, ORACLE, NETCDF, GEOTIFF, PROJ4, EPSG, ISBN, ISSN
+ ISO, OGC, OGP, SIS, ESRI, ORACLE, NETCDF, GEOTIFF, PROJ4, EPSG, ISBN, ISSN
};
/**
Modified: sis/trunk/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/AllMetadataTest.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/AllMetadataTest.java?rev=1550857&r1=1550856&r2=1550857&view=diff
==============================================================================
--- sis/trunk/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/AllMetadataTest.java [UTF-8] (original)
+++ sis/trunk/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/AllMetadataTest.java [UTF-8] Sat Dec 14 00:15:36 2013
@@ -39,12 +39,7 @@ import static org.junit.Assert.*;
* @version 0.3
* @module
*/
-@DependsOn({
- org.apache.sis.metadata.PropertyAccessorTest.class,
- org.apache.sis.metadata.iso.citation.DefaultCitationTest.class,
- org.apache.sis.metadata.iso.citation.DefaultCitationDateTest.class,
- org.apache.sis.metadata.iso.quality.AbstractElementTest.class
-})
+@DependsOn(org.apache.sis.metadata.PropertyAccessorTest.class)
public final strictfp class AllMetadataTest extends MetadataTestCase {
/**
* A JUnit {@linkplain Rule rule} for listening to log events. This field is public
Modified: sis/trunk/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/citation/HardCodedCitations.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/citation/HardCodedCitations.java?rev=1550857&r1=1550856&r2=1550857&view=diff
==============================================================================
--- sis/trunk/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/citation/HardCodedCitations.java [UTF-8] (original)
+++ sis/trunk/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/citation/HardCodedCitations.java [UTF-8] Sat Dec 14 00:15:36 2013
@@ -87,6 +87,21 @@ public final strictfp class HardCodedCit
}
/**
+ * The <a href="http://www.ogp.org.uk">International Association of Oil & Gas Producers</a> organization.
+ * This organization is responsible for maintainance of {@link #EPSG} database.
+ * An {@linkplain Citation#getAlternateTitles() alternate title} for this citation is "OGP"
+ * (according ISO 19115, alternate titles often contain abbreviations).
+ */
+ public static final DefaultCitation OGP;
+ static {
+ final DefaultCitation c = new DefaultCitation("International Association of Oil & Gas Producers");
+ c.setAlternateTitles(singleton(new SimpleInternationalString("OGP")));
+ c.getIdentifiers().add(new DefaultIdentifier("OGP"));
+ c.freeze();
+ OGP = c;
+ }
+
+ /**
* The <a href="http://www.epsg.org">European Petroleum Survey Group</a> authority.
* An {@linkplain Citation#getAlternateTitles() alternate title} for this citation is
* "EPSG" (according ISO 19115, alternate titles often contain abbreviations). In
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=1550857&r1=1550856&r2=1550857&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] Sat Dec 14 00:15:36 2013
@@ -55,13 +55,15 @@ import org.junit.BeforeClass;
org.apache.sis.xml.FreeTextMarshallingTest.class,
org.apache.sis.xml.NilReasonMarshallingTest.class,
org.apache.sis.xml.AnchorMarshallingTest.class,
- org.apache.sis.xml.ObjectReferenceMarshallingTest.class,
+ org.apache.sis.xml.UUIDMarshallingTest.class,
+ org.apache.sis.xml.XLinkMarshallingTest.class,
// ISO implementations.
org.apache.sis.metadata.iso.citation.DefaultCitationDateTest.class,
org.apache.sis.metadata.iso.citation.DefaultCitationTest.class,
org.apache.sis.metadata.iso.maintenance.DefaultScopeDescriptionTest.class,
org.apache.sis.metadata.iso.extent.DefaultGeographicBoundingBoxTest.class,
+ org.apache.sis.metadata.iso.extent.DefaultExtentTest.class,
org.apache.sis.metadata.iso.extent.ExtentsTest.class,
org.apache.sis.metadata.iso.spatial.DefaultGeorectifiedTest.class,
org.apache.sis.metadata.iso.identification.DefaultKeywordsTest.class,
@@ -70,13 +72,13 @@ import org.junit.BeforeClass;
org.apache.sis.metadata.iso.identification.DefaultBrowseGraphicTest.class,
org.apache.sis.metadata.iso.identification.DefaultDataIdentificationTest.class,
org.apache.sis.metadata.iso.quality.AbstractElementTest.class,
+ 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.ImmutableIdentifierTest.class,
- org.apache.sis.metadata.iso.AllMetadataTest.class,
-
- // XML marshalling (integration tests).
- org.apache.sis.xml.CustomMetadataTest.class,
- org.apache.sis.xml.ImageryMarshallingTest.class,
- org.apache.sis.xml.MetadataMarshallingTest.class
+ org.apache.sis.metadata.iso.DefaultMetadataTest.class,
+ org.apache.sis.metadata.iso.CustomMetadataTest.class,
+ org.apache.sis.metadata.iso.AllMetadataTest.class
})
public final strictfp class MetadataTestSuite extends TestSuite {
/**
Modified: sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/geometry/AbstractDirectPosition.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/geometry/AbstractDirectPosition.java?rev=1550857&r1=1550856&r2=1550857&view=diff
==============================================================================
--- sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/geometry/AbstractDirectPosition.java [UTF-8] (original)
+++ sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/geometry/AbstractDirectPosition.java [UTF-8] Sat Dec 14 00:15:36 2013
@@ -65,6 +65,8 @@ public abstract class AbstractDirectPosi
/**
* Returns always {@code this}, the direct position for this
* {@linkplain org.opengis.geometry.coordinate.Position position}.
+ *
+ * @return {@code this}.
*/
@Override
public final DirectPosition getDirectPosition() {
Modified: sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/geometry/AbstractEnvelope.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/geometry/AbstractEnvelope.java?rev=1550857&r1=1550856&r2=1550857&view=diff
==============================================================================
--- sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/geometry/AbstractEnvelope.java [UTF-8] (original)
+++ sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/geometry/AbstractEnvelope.java [UTF-8] Sat Dec 14 00:15:36 2013
@@ -31,6 +31,7 @@ import org.opengis.referencing.crs.Coord
import org.opengis.referencing.cs.CoordinateSystemAxis;
import org.opengis.referencing.cs.CoordinateSystem;
import org.opengis.referencing.cs.RangeMeaning;
+import org.apache.sis.util.Emptiable;
import org.apache.sis.util.Utilities;
import org.apache.sis.util.ComparisonMode;
import org.apache.sis.util.resources.Errors;
@@ -109,7 +110,7 @@ import org.apache.sis.internal.jdk7.Obje
* @version 0.3
* @module
*/
-public abstract class AbstractEnvelope implements Envelope {
+public abstract class AbstractEnvelope implements Envelope, Emptiable {
/**
* An empty array of envelopes, to be returned by {@link #toSimpleEnvelopes()}
* when en envelope is empty.
@@ -622,6 +623,7 @@ public abstract class AbstractEnvelope i
* @see org.apache.sis.metadata.iso.extent.DefaultGeographicBoundingBox#isEmpty()
* @see java.awt.geom.Rectangle2D#isEmpty()
*/
+ @Override
public boolean isEmpty() {
final int dimension = getDimension();
if (dimension == 0) {
Modified: sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/geometry/Envelope2D.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/geometry/Envelope2D.java?rev=1550857&r1=1550856&r2=1550857&view=diff
==============================================================================
--- sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/geometry/Envelope2D.java [UTF-8] (original)
+++ sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/geometry/Envelope2D.java [UTF-8] Sat Dec 14 00:15:36 2013
@@ -26,6 +26,7 @@ import org.opengis.referencing.cs.Coordi
import org.opengis.referencing.cs.AxisDirection;
import org.opengis.util.FactoryException;
import org.apache.sis.util.resources.Errors;
+import org.apache.sis.util.Emptiable;
import org.apache.sis.referencing.CRS;
import static java.lang.Double.NaN;
@@ -105,7 +106,7 @@ import org.apache.sis.internal.jdk7.Obje
* @see GeneralEnvelope
* @see org.apache.sis.metadata.iso.extent.DefaultGeographicBoundingBox
*/
-public class Envelope2D extends Rectangle2D.Double implements Envelope, Cloneable {
+public class Envelope2D extends Rectangle2D.Double implements Envelope, Emptiable, Cloneable {
/**
* Serial number for inter-operability with different versions.
*/
Modified: sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/geometry/GeneralDirectPosition.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/geometry/GeneralDirectPosition.java?rev=1550857&r1=1550856&r2=1550857&view=diff
==============================================================================
--- sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/geometry/GeneralDirectPosition.java [UTF-8] (original)
+++ sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/geometry/GeneralDirectPosition.java [UTF-8] Sat Dec 14 00:15:36 2013
@@ -274,6 +274,8 @@ public class GeneralDirectPosition exten
/**
* Returns a deep copy of this position.
+ *
+ * @return A copy of this direct position.
*/
@Override
public GeneralDirectPosition clone() {
Modified: sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/internal/jaxb/referencing/CD_Ellipsoid.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/internal/jaxb/referencing/CD_Ellipsoid.java?rev=1550857&r1=1550856&r2=1550857&view=diff
==============================================================================
--- sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/internal/jaxb/referencing/CD_Ellipsoid.java [UTF-8] (original)
+++ sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/internal/jaxb/referencing/CD_Ellipsoid.java [UTF-8] Sat Dec 14 00:15:36 2013
@@ -79,7 +79,7 @@ public final class CD_Ellipsoid extends
*/
@XmlElement(name = "Ellipsoid")
public DefaultEllipsoid getElement() {
- return skip() ? null : DefaultEllipsoid.castOrCopy(metadata);
+ return DefaultEllipsoid.castOrCopy(metadata);
}
/**
Modified: sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/internal/jaxb/referencing/CD_GeodeticDatum.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/internal/jaxb/referencing/CD_GeodeticDatum.java?rev=1550857&r1=1550856&r2=1550857&view=diff
==============================================================================
--- sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/internal/jaxb/referencing/CD_GeodeticDatum.java [UTF-8] (original)
+++ sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/internal/jaxb/referencing/CD_GeodeticDatum.java [UTF-8] Sat Dec 14 00:15:36 2013
@@ -79,7 +79,7 @@ public final class CD_GeodeticDatum exte
*/
@XmlElement(name = "GeodeticDatum")
public DefaultGeodeticDatum getElement() {
- return skip() ? null : DefaultGeodeticDatum.castOrCopy(metadata);
+ return DefaultGeodeticDatum.castOrCopy(metadata);
}
/**
Modified: sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/internal/jaxb/referencing/CD_ImageDatum.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/internal/jaxb/referencing/CD_ImageDatum.java?rev=1550857&r1=1550856&r2=1550857&view=diff
==============================================================================
--- sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/internal/jaxb/referencing/CD_ImageDatum.java [UTF-8] (original)
+++ sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/internal/jaxb/referencing/CD_ImageDatum.java [UTF-8] Sat Dec 14 00:15:36 2013
@@ -79,7 +79,7 @@ public final class CD_ImageDatum extends
*/
@XmlElement(name = "ImageDatum")
public DefaultImageDatum getElement() {
- return skip() ? null : DefaultImageDatum.castOrCopy(metadata);
+ return DefaultImageDatum.castOrCopy(metadata);
}
/**
Modified: sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/internal/jaxb/referencing/CD_PrimeMeridian.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/internal/jaxb/referencing/CD_PrimeMeridian.java?rev=1550857&r1=1550856&r2=1550857&view=diff
==============================================================================
--- sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/internal/jaxb/referencing/CD_PrimeMeridian.java [UTF-8] (original)
+++ sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/internal/jaxb/referencing/CD_PrimeMeridian.java [UTF-8] Sat Dec 14 00:15:36 2013
@@ -79,7 +79,7 @@ public final class CD_PrimeMeridian exte
*/
@XmlElement(name = "Ellipsoid")
public DefaultPrimeMeridian getElement() {
- return skip() ? null : DefaultPrimeMeridian.castOrCopy(metadata);
+ return DefaultPrimeMeridian.castOrCopy(metadata);
}
/**
Modified: sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/internal/jaxb/referencing/CD_TemporalDatum.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/internal/jaxb/referencing/CD_TemporalDatum.java?rev=1550857&r1=1550856&r2=1550857&view=diff
==============================================================================
--- sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/internal/jaxb/referencing/CD_TemporalDatum.java [UTF-8] (original)
+++ sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/internal/jaxb/referencing/CD_TemporalDatum.java [UTF-8] Sat Dec 14 00:15:36 2013
@@ -79,7 +79,7 @@ public final class CD_TemporalDatum exte
*/
@XmlElement(name = "TemporalDatum")
public DefaultTemporalDatum getElement() {
- return skip() ? null : DefaultTemporalDatum.castOrCopy(metadata);
+ return DefaultTemporalDatum.castOrCopy(metadata);
}
/**
Modified: sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/internal/jaxb/referencing/CD_VerticalDatum.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/internal/jaxb/referencing/CD_VerticalDatum.java?rev=1550857&r1=1550856&r2=1550857&view=diff
==============================================================================
--- sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/internal/jaxb/referencing/CD_VerticalDatum.java [UTF-8] (original)
+++ sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/internal/jaxb/referencing/CD_VerticalDatum.java [UTF-8] Sat Dec 14 00:15:36 2013
@@ -79,7 +79,7 @@ public final class CD_VerticalDatum exte
*/
@XmlElement(name = "VerticalDatum")
public DefaultVerticalDatum getElement() {
- return skip() ? null : DefaultVerticalDatum.castOrCopy(metadata);
+ return DefaultVerticalDatum.castOrCopy(metadata);
}
/**
Modified: sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/internal/jaxb/referencing/RS_Identifier.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/internal/jaxb/referencing/RS_Identifier.java?rev=1550857&r1=1550856&r2=1550857&view=diff
==============================================================================
--- sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/internal/jaxb/referencing/RS_Identifier.java [UTF-8] (original)
+++ sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/internal/jaxb/referencing/RS_Identifier.java [UTF-8] Sat Dec 14 00:15:36 2013
@@ -16,28 +16,44 @@
*/
package org.apache.sis.internal.jaxb.referencing;
-import javax.xml.bind.annotation.XmlValue;
-import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.adapters.XmlAdapter;
-import org.opengis.metadata.citation.Citation;
import org.opengis.referencing.ReferenceIdentifier;
-import org.apache.sis.metadata.iso.citation.Citations;
-import org.apache.sis.metadata.iso.ImmutableIdentifier;
-import org.apache.sis.util.StringBuilders;
/**
* JAXB adapter mapping the GeoAPI {@link ReferenceIdentifier} to an implementation class that can
* be marshalled. See the package documentation for more information about JAXB and interfaces.
*
- * <p>The XML produced by this adapter uses the GML syntax. The {@link RS_IdentifierCode} class
- * performs a similar mapping, but in which only the code (without codespace) is marshalled.</p>
- *
* <p>Note that a class of the same name is defined in the {@link org.apache.sis.internal.jaxb.metadata}
* package, which serve the same purpose (wrapping exactly the same interface) but using the ISO 19139
* syntax instead. The ISO 19139 syntax represents the code and codespace as XML elements, while in this
* GML representation the code is a XML value and the codespace is a XML attribute.</p>
*
+ * {@section Marshalling}
+ * Identifiers are typically marshalled as below:
+ *
+ * {@preformat xml
+ * <gml:identifier codeSpace="EPSG">4326</gml:identifier>
+ * }
+ *
+ * If the {@code ReferenceIdentifier} to marshal contains a {@linkplain ReferenceIdentifier#getVersion() version},
+ * then this adapter concatenates the version to the codespace in a "URI-like" way like below:
+ *
+ * {@preformat xml
+ * <gml:identifier codeSpace="EPSG:8.3">4326</gml:identifier>
+ * }
+ *
+ * {@section Unmarshalling}
+ * Some data producers put a URN instead than a simple code value, as in the example below:
+ *
+ * {@preformat xml
+ * <gml:identifier codeSpace="OGP">urn:ogc:def:crs:EPSG::4326</gml:identifier>
+ * }
+ *
+ * In such case this class takes the codespace as the {@linkplain ReferenceIdentifier#getAuthority() authority}
+ * ("OGP" in above example), and the 3 last URI elements are parsed as the codespace, version (optional) and
+ * code values respectively.
+ *
* @author Guilhem Legal (Geomatys)
* @author Cédric Briançon (Geomatys)
* @author Martin Desruisseaux (Geomatys)
@@ -45,65 +61,7 @@ import org.apache.sis.util.StringBuilder
* @version 0.4
* @module
*/
-public final class RS_Identifier extends XmlAdapter<RS_Identifier.Value, ReferenceIdentifier> {
- /**
- * The wrapper for GML identifier marshalled as a code value with a codespace attribute.
- * Defined in a separated class because JAXB does not allow usage of {@code XmlValue} in
- * a class that inherit an other class.
- */
- public static final class Value {
- /**
- * The identifier code.
- *
- * <p><b>Note:</b> GML (the target of this class) represents that code as an XML value, while
- * {@link org.apache.sis.metadata.iso.ImmutableIdentifier} represents it as an XML element.</p>
- */
- @XmlValue
- private String code;
-
- /**
- * The code space, which is often {@code "EPSG"} with the version in use.
- *
- * <p><b>Note:</b> GML (the target of this class) represents that code as an XML attribute, while
- * {@link org.apache.sis.metadata.iso.ImmutableIdentifier} represents it as an XML element.</p>
- */
- @XmlAttribute
- private String codeSpace;
-
- /**
- * Empty constructor for JAXB only.
- */
- public Value() {
- }
-
- /**
- * Creates a wrapper initialized to the values of the given identifier.
- *
- * @param identifier The identifier from which to get the values.
- */
- Value(final ReferenceIdentifier identifier) {
- code = identifier.getCode();
- codeSpace = identifier.getCodeSpace();
- String version = identifier.getVersion();
- if (version != null) {
- final StringBuilder buffer = new StringBuilder(codeSpace);
- if (buffer.length() != 0) {
- buffer.append('_');
- }
- StringBuilders.remove(buffer.append('v').append(version), ".");
- codeSpace = buffer.toString();
- }
- }
-
- /**
- * Returns the identifier for this value. This method is the converse of the constructor.
- */
- ReferenceIdentifier getIdentifier() {
- final Citation authority = Citations.fromName(codeSpace); // May be null.
- return new ImmutableIdentifier(authority, Citations.getIdentifier(authority), code);
- }
- }
-
+public final class RS_Identifier extends XmlAdapter<Code, ReferenceIdentifier> {
/**
* Substitutes the wrapper value read from an XML stream by the object which will
* represents the identifier. JAXB calls automatically this method at unmarshalling time.
@@ -112,7 +70,7 @@ public final class RS_Identifier extends
* @return An identifier which represents the value.
*/
@Override
- public ReferenceIdentifier unmarshal(final Value value) {
+ public ReferenceIdentifier unmarshal(final Code value) {
return (value != null) ? value.getIdentifier() : null;
}
@@ -124,7 +82,7 @@ public final class RS_Identifier extends
* @return The adapter for the given metadata.
*/
@Override
- public Value marshal(final ReferenceIdentifier value) {
- return (value != null) ? new Value(value) : null;
+ public Code marshal(final ReferenceIdentifier value) {
+ return (value != null) ? new Code(value) : null;
}
}
Modified: sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/internal/jaxb/referencing/RS_IdentifierSingleton.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/internal/jaxb/referencing/RS_IdentifierSingleton.java?rev=1550857&r1=1550856&r2=1550857&view=diff
==============================================================================
--- sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/internal/jaxb/referencing/RS_IdentifierSingleton.java [UTF-8] (original)
+++ sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/internal/jaxb/referencing/RS_IdentifierSingleton.java [UTF-8] Sat Dec 14 00:15:36 2013
@@ -34,7 +34,7 @@ import static java.util.Collections.sing
* @version 0.4
* @module
*/
-public final class RS_IdentifierSingleton extends XmlAdapter<RS_Identifier.Value, Set<ReferenceIdentifier>> {
+public final class RS_IdentifierSingleton extends XmlAdapter<Code, Set<ReferenceIdentifier>> {
/**
* Substitutes the wrapper value read from an XML stream by the object which will
* represents the identifier. JAXB calls automatically this method at unmarshalling time.
@@ -43,7 +43,7 @@ public final class RS_IdentifierSingleto
* @return An identifier which represents the value.
*/
@Override
- public Set<ReferenceIdentifier> unmarshal(final RS_Identifier.Value value) {
+ public Set<ReferenceIdentifier> unmarshal(final Code value) {
return (value != null) ? singleton(value.getIdentifier()) : null;
}
@@ -55,11 +55,11 @@ public final class RS_IdentifierSingleto
* @return The adapter for the given metadata.
*/
@Override
- public RS_Identifier.Value marshal(final Set<ReferenceIdentifier> value) {
+ public Code marshal(final Set<ReferenceIdentifier> value) {
if (value != null) {
final Iterator<ReferenceIdentifier> it = value.iterator();
if (it.hasNext()) {
- return new RS_Identifier.Value(it.next());
+ return new Code(it.next());
}
}
return null;
Modified: sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/io/wkt/Formatter.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/io/wkt/Formatter.java?rev=1550857&r1=1550856&r2=1550857&view=diff
==============================================================================
--- sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/io/wkt/Formatter.java [UTF-8] (original)
+++ sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/io/wkt/Formatter.java [UTF-8] Sat Dec 14 00:15:36 2013
@@ -34,6 +34,7 @@ import org.opengis.parameter.ParameterDe
import org.opengis.parameter.ParameterValue;
import org.opengis.parameter.ParameterValueGroup;
import org.opengis.referencing.IdentifiedObject;
+import org.opengis.referencing.ReferenceIdentifier;
import org.opengis.referencing.cs.CoordinateSystemAxis;
import org.opengis.referencing.operation.MathTransform;
import org.opengis.util.CodeList;
@@ -466,20 +467,26 @@ public class Formatter {
*/
final Identifier identifier = getIdentifier(info);
if (identifier != null && !AUTHORITY_EXCLUDE.isInstance(info)) {
- final Citation authority = identifier.getAuthority();
- if (authority != null) {
- final String title = Citations.getIdentifier(authority);
- if (title != null) {
- appendSeparator(requestNewLine);
- buffer.append("AUTHORITY").appendCodePoint(open);
- quote(title);
- final String code = identifier.getCode();
- if (code != null) {
- buffer.append(symbols.getSeparator());
- quote(code);
- }
- buffer.appendCodePoint(close);
+ String codeSpace = null;
+ if (identifier instanceof ReferenceIdentifier) {
+ codeSpace = ((ReferenceIdentifier) identifier).getCodeSpace();
+ }
+ if (codeSpace == null) {
+ final Citation authority = identifier.getAuthority();
+ if (authority != null) {
+ codeSpace = Citations.getIdentifier(authority);
+ }
+ }
+ if (codeSpace != null) {
+ appendSeparator(requestNewLine);
+ buffer.append("AUTHORITY").appendCodePoint(open);
+ quote(codeSpace);
+ final String code = identifier.getCode();
+ if (code != null) {
+ buffer.append(symbols.getSeparator());
+ quote(code);
}
+ buffer.appendCodePoint(close);
}
}
buffer.appendCodePoint(close);
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=1550857&r1=1550856&r2=1550857&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] Sat Dec 14 00:15:36 2013
@@ -18,6 +18,7 @@ package org.apache.sis.referencing;
import java.util.Map;
import java.util.Set;
+import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.Iterator;
@@ -50,7 +51,6 @@ import org.apache.sis.util.resources.Err
import static org.apache.sis.util.ArgumentChecks.*;
import static org.apache.sis.util.Utilities.deepEquals;
-import static org.apache.sis.internal.util.Citations.iterator;
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;
@@ -107,7 +107,7 @@ import org.apache.sis.internal.jdk7.Obje
@ThreadSafe
@XmlType(name="IdentifiedObjectType", propOrder={
"identifiers",
- "name",
+ "name", // This is 'names' on the JDK7 branch.
"remarks"
})
@XmlSeeAlso({
@@ -125,17 +125,25 @@ public class AbstractIdentifiedObject ex
private static final long serialVersionUID = -5173281694258483264L;
/**
- * The name for this object or code. Should never be {@code null}.
+ * The name for this object or code. Shall never be {@code null}.
+ *
+ * <p><b>Difference between JDK6 and JDK7 branches:</b> in the JDK6 branch, this field is annotated directly.
+ * In the JDK7 branch, a {@code getNames()} method is annotated instead in order to marshal name and aliases
+ * in a single list, because GML does that way. We couldn't keep the getter/setter methods pair in the JDK6
+ * branch because JAXB 2.1.10 does not invoke the setter, while JAXB 2.2.4-2 does as expected. The price is
+ * that aliases are lost on the JDK6 branch, while they are present on the JDK7 branch.</p>
*
* @see #getName()
*/
- @XmlElement
+ @XmlElement(name = "name")
private final ReferenceIdentifier name;
/**
* An alternative name by which this object is identified, or {@code null} if none.
* We must be prepared to handle either null or an empty set for "no alias" because
* we may get both on unmarshalling.
+ *
+ * <p><b>Difference between JDK6 and JDK7 branches:</b> See comment for {@link #name}.</p>
*/
private final Collection<GenericName> alias;
@@ -361,35 +369,10 @@ public class AbstractIdentifiedObject ex
* We will iterate over the identifiers first. Only after the iteration is over,
* if we found no suitable ID, then we will use the primary name as a last resort.
*/
- Iterator<ReferenceIdentifier> it = iterator(identifiers);
- do {
- final ReferenceIdentifier identifier;
- if (it != null && it.hasNext()) {
- identifier = it.next();
- } else {
- it = null;
- identifier = name;
- }
- if (identifier != null) {
- boolean codeSpace = true;
- do { // Executed exactly twice: once for codespace, then once for code.
- final String part = codeSpace ? identifier.getCodeSpace() : identifier.getCode();
- if (part != null) {
- /*
- * Found a codespace (in the first iteration) or a code (in the second iteration).
- * Append to the buffer only the characters that are valid for a Unicode identifier.
- */
- for (int i=0; i<part.length();) {
- final int c = part.codePointAt(i);
- if (id.length() == 0 ? Character.isUnicodeIdentifierStart(c)
- : Character.isUnicodeIdentifierPart(c))
- {
- id.appendCodePoint(c);
- }
- i += Character.charCount(c);
- }
- }
- } while ((codeSpace = !codeSpace) == false);
+ if (identifiers != null) {
+ for (final ReferenceIdentifier identifier : identifiers) {
+ appendID(id, identifier.getCodeSpace());
+ appendID(id, identifier.getCode());
if (id.length() != 0) {
/*
* TODO: If we want to check for ID uniqueness or any other condition before to accept the ID,
@@ -399,8 +382,30 @@ public class AbstractIdentifiedObject ex
return id.toString();
}
}
- } while (it != null);
- return null;
+ }
+ // 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();
+ }
+
+ /**
+ * Appends only the characters that are valid for a Unicode identifier.
+ */
+ 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);
+ }
+ }
}
/**
@@ -415,6 +420,23 @@ public class AbstractIdentifiedObject ex
return name;
}
+ /* -----------------------------------------------------------------------
+ * DIFFERENCE BETWEEN THE JDK6 AND JDK7 BRANCHES
+ * -----------------------------------------------------------------------
+ * The JDK7 branch provides two private methods here:
+ *
+ * - Collection<ReferenceIdentifier> getNames();
+ * - void setNames(Collection<ReferenceIdentifier> names);
+ *
+ * The getter is annotated with @XmlElement(name = "name"), which replace
+ * the annotation on this.name field. The intend is to merge the primary
+ * name and aliases in a single list, because GML is specified that way.
+ * However JAXB 2.1.10 in JDK 1.6.0_65 does not invoke the setter method
+ * while JAXB 2.2.4-2 in 1.7.0_25 does. Because of this bug, we annotate
+ * the field instead in the JDK6 branch. The consequence is that aliases
+ * are lost.
+ */
+
/**
* Returns alternative names by which this object is identified.
*
@@ -618,17 +640,17 @@ public class AbstractIdentifiedObject ex
switch (mode) {
case STRICT: {
final AbstractIdentifiedObject that = (AbstractIdentifiedObject) object;
- return Objects.equals( name, that.name) &&
- Objects.equals(nonNull(alias), nonNull(that.alias)) &&
- Objects.equals(nonNull(identifiers), nonNull(that.identifiers)) &&
- Objects.equals( remarks, that.remarks);
+ return Objects.equals(name, that.name) &&
+ nonNull(alias).equals(nonNull(that.alias)) &&
+ nonNull(identifiers).equals(nonNull(that.identifiers)) &&
+ Objects.equals(remarks, that.remarks);
}
case BY_CONTRACT: {
final IdentifiedObject that = (IdentifiedObject) object;
- return deepEquals( getName(), that.getName(), mode) &&
- deepEquals(nonNull(getAlias()), nonNull(that.getAlias()), mode) &&
- deepEquals(nonNull(getIdentifiers()), nonNull(that.getIdentifiers()), mode) &&
- deepEquals( getRemarks(), that.getRemarks(), mode);
+ return deepEquals(getName(), that.getName(), mode) &&
+ deepEquals(getAlias(), that.getAlias(), mode) &&
+ deepEquals(getIdentifiers(), that.getIdentifiers(), mode) &&
+ deepEquals(getRemarks(), that.getRemarks(), mode);
}
case IGNORE_METADATA:
case APPROXIMATIVE:
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=1550857&r1=1550856&r2=1550857&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] Sat Dec 14 00:15:36 2013
@@ -40,12 +40,21 @@ import org.apache.sis.internal.jdk7.Obje
/**
- * An identification of a CRS object which is both an {@link Identifier} and a {@link GenericName}.
- * The main interface implemented by this class is {@link ReferenceIdentifier}.
- * However, this class also implements {@link GenericName} in order to make it possible to reuse
- * the same identifiers in the list of {@linkplain AbstractIdentifiedObject#getAlias() aliases}.
- * Casting an alias from {@code GenericName} to a {@code ReferenceIdentifier} gives access to more informations,
- * like the authority URL.
+ * An identification of a CRS object which is both a {@link ReferenceIdentifier} and a {@link GenericName}.
+ * This class implements both interfaces in order to allow usage of the same instance either as an object
+ * {@linkplain AbstractIdentifiedObject#getName() name} or {@linkplain AbstractIdentifiedObject#getAlias() alias}.
+ * This flexibility make easier to uses object's names in two different models:
+ *
+ * <ul>
+ * <li>In the ISO 19111 model, objects have a single name of type {@code RS_Identifier} and an arbitrary amount
+ * of aliases of type {@code GenericName}.</li>
+ * <li>In the GML model, objects have an arbitrary amount of names of type {@code gml:CodeType},
+ * but do not have any alias.</li>
+ * </ul>
+ *
+ * By using this {@code NamedIdentifier} class, users can declare supplemental object's names as
+ * {@linkplain AbstractIdentifiedObject#getAlias() aliases} and have those names used in contexts
+ * where {@code ReferenceIdentifier} instances are required, like GML marshalling time.
*
* {@section Name inference}
* The generic name will be inferred from {@code ReferenceIdentifier} attributes.