Added:
sis/branches/JDK7/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/metadata/MI_Requirement.java
URL:
http://svn.apache.org/viewvc/sis/branches/JDK7/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/metadata/MI_Requirement.java?rev=1458538&view=auto
==============================================================================
---
sis/branches/JDK7/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/metadata/MI_Requirement.java
(added)
+++
sis/branches/JDK7/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/metadata/MI_Requirement.java
[UTF-8] Tue Mar 19 22:05:15 2013
@@ -0,0 +1,92 @@
+/*
+ * 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.jaxb.metadata;
+
+import javax.xml.bind.annotation.XmlElementRef;
+import org.opengis.metadata.acquisition.Requirement;
+import org.apache.sis.metadata.iso.acquisition.DefaultRequirement;
+import org.apache.sis.internal.jaxb.gco.PropertyType;
+
+
+/**
+ * JAXB adapter mapping implementing class to the GeoAPI interface. See
+ * package documentation for more information about JAXB and interface.
+ *
+ * @author Cédric Briançon (Geomatys)
+ * @author Martin Desruisseaux (Geomatys)
+ * @since 0.3 (derived from geotk-3.02)
+ * @version 0.3
+ * @module
+ */
+public final class MI_Requirement extends PropertyType<MI_Requirement,
Requirement> {
+ /**
+ * Empty constructor for JAXB only.
+ */
+ public MI_Requirement() {
+ }
+
+ /**
+ * 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.
+ */
+ @Override
+ protected Class<Requirement> getBoundType() {
+ return Requirement.class;
+ }
+
+ /**
+ * Constructor for the {@link #wrap} method only.
+ */
+ private MI_Requirement(final Requirement metadata) {
+ super(metadata);
+ }
+
+ /**
+ * Invoked by {@link PropertyType} at marshalling time for wrapping the
given metadata value
+ * in a {@code <gmi:MI_Requirement>} XML element.
+ *
+ * @param metadata The metadata element to marshall.
+ * @return A {@code PropertyType} wrapping the given the metadata element.
+ */
+ @Override
+ protected MI_Requirement wrap(final Requirement metadata) {
+ return new MI_Requirement(metadata);
+ }
+
+ /**
+ * Invoked by JAXB at marshalling time for getting the actual metadata to
write
+ * inside the {@code <gmi:MI_Requirement>} XML element.
+ * This is the value or a copy of the value given in argument to the
{@code wrap} method.
+ *
+ * @return The metadata to be marshalled.
+ */
+ @Override
+ @XmlElementRef
+ public DefaultRequirement getElement() {
+ return skip() ? null : DefaultRequirement.castOrCopy(metadata);
+ }
+
+ /**
+ * Invoked by JAXB at unmarshalling time for storing the result
temporarily.
+ *
+ * @param metadata The unmarshalled metadata.
+ */
+ public void setElement(final DefaultRequirement metadata) {
+ this.metadata = metadata;
+ }
+}
Propchange:
sis/branches/JDK7/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/metadata/MI_Requirement.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange:
sis/branches/JDK7/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/metadata/MI_Requirement.java
------------------------------------------------------------------------------
svn:mime-type = text/plain;charset=UTF-8
Added:
sis/branches/JDK7/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/metadata/MX_DataFile.java
URL:
http://svn.apache.org/viewvc/sis/branches/JDK7/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/metadata/MX_DataFile.java?rev=1458538&view=auto
==============================================================================
---
sis/branches/JDK7/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/metadata/MX_DataFile.java
(added)
+++
sis/branches/JDK7/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/metadata/MX_DataFile.java
[UTF-8] Tue Mar 19 22:05:15 2013
@@ -0,0 +1,92 @@
+/*
+ * 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.jaxb.metadata;
+
+import javax.xml.bind.annotation.XmlElementRef;
+import org.opengis.metadata.distribution.DataFile;
+import org.apache.sis.metadata.iso.distribution.DefaultDataFile;
+import org.apache.sis.internal.jaxb.gco.PropertyType;
+
+
+/**
+ * JAXB adapter mapping implementing class to the GeoAPI interface. See
+ * package documentation for more information about JAXB and interface.
+ *
+ * @author Guilhem Legal (Geomatys)
+ * @author Martin Desruisseaux (Geomatys)
+ * @since 0.3 (derived from geotk-3.17)
+ * @version 0.3
+ * @module
+ */
+public final class MX_DataFile extends PropertyType<MX_DataFile, DataFile> {
+ /**
+ * Empty constructor for JAXB only.
+ */
+ public MX_DataFile() {
+ }
+
+ /**
+ * 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.
+ */
+ @Override
+ protected Class<DataFile> getBoundType() {
+ return DataFile.class;
+ }
+
+ /**
+ * Constructor for the {@link #wrap} method only.
+ */
+ private MX_DataFile(final DataFile metadata) {
+ super(metadata);
+ }
+
+ /**
+ * Invoked by {@link PropertyType} at marshalling time for wrapping the
given metadata value
+ * in a {@code <gmx:MX_DataFile>} XML element.
+ *
+ * @param metadata The metadata element to marshall.
+ * @return A {@code PropertyType} wrapping the given the metadata element.
+ */
+ @Override
+ protected MX_DataFile wrap(final DataFile metadata) {
+ return new MX_DataFile(metadata);
+ }
+
+ /**
+ * Invoked by JAXB at marshalling time for getting the actual metadata to
write
+ * inside the {@code <gmx:MX_DataFile>} XML element.
+ * This is the value or a copy of the value given in argument to the
{@code wrap} method.
+ *
+ * @return The metadata to be marshalled.
+ */
+ @Override
+ @XmlElementRef
+ public DefaultDataFile getElement() {
+ return skip() ? null : DefaultDataFile.castOrCopy(metadata);
+ }
+
+ /**
+ * Invoked by JAXB at unmarshalling time for storing the result
temporarily.
+ *
+ * @param metadata The unmarshalled metadata.
+ */
+ public void setElement(final DefaultDataFile metadata) {
+ this.metadata = metadata;
+ }
+}
Propchange:
sis/branches/JDK7/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/metadata/MX_DataFile.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange:
sis/branches/JDK7/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/metadata/MX_DataFile.java
------------------------------------------------------------------------------
svn:mime-type = text/plain;charset=UTF-8
Added:
sis/branches/JDK7/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/metadata/RS_Identifier.java
URL:
http://svn.apache.org/viewvc/sis/branches/JDK7/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/metadata/RS_Identifier.java?rev=1458538&view=auto
==============================================================================
---
sis/branches/JDK7/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/metadata/RS_Identifier.java
(added)
+++
sis/branches/JDK7/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/metadata/RS_Identifier.java
[UTF-8] Tue Mar 19 22:05:15 2013
@@ -0,0 +1,103 @@
+/*
+ * 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.jaxb.metadata;
+
+import javax.xml.bind.annotation.XmlElementRef;
+import org.opengis.referencing.ReferenceIdentifier;
+import org.apache.sis.referencing.DefaultReferenceIdentifier;
+import org.apache.sis.internal.jaxb.gco.PropertyType;
+
+
+/**
+ * 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 shall be compliant to the ISO 19139
syntax.</p>
+ *
+ * Note that a class of the same name is defined in the {@link
org.apache.sis.internal.jaxb.referencing}
+ * package, which serves the same purpose (wrapping exactly the same
interface) but using the GML syntax
+ * instead.
+ *
+ * @author Guilhem Legal (Geomatys)
+ * @since 0.3 (derived from geotk-3.00)
+ * @version 0.3
+ * @module
+ */
+public final class RS_Identifier extends PropertyType<RS_Identifier,
ReferenceIdentifier> {
+ /**
+ * Empty constructor for JAXB only.
+ */
+ public RS_Identifier() {
+ }
+
+ /**
+ * 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.
+ */
+ @Override
+ protected Class<ReferenceIdentifier> getBoundType() {
+ return ReferenceIdentifier.class;
+ }
+
+ /**
+ * Constructor for the {@link #wrap} method only.
+ */
+ private RS_Identifier(final ReferenceIdentifier metadata) {
+ super(metadata);
+ }
+
+ /**
+ * Invoked by {@link PropertyType} at marshalling time for wrapping the
given metadata value
+ * in a {@code <gmd:RS_Identifier>} XML element.
+ *
+ * @param metadata The metadata element to marshall.
+ * @return A {@code PropertyType} wrapping the given the metadata element.
+ */
+ @Override
+ protected RS_Identifier wrap(ReferenceIdentifier metadata) {
+ return new RS_Identifier(metadata);
+ }
+
+ /**
+ * Invoked by JAXB at marshalling time for getting the actual metadata to
write
+ * inside the {@code <gmd:RS_Identifier>} XML element.
+ * This is the value or a copy of the value given in argument to the
{@code wrap} method.
+ *
+ * @return The metadata to be marshalled.
+ */
+ @Override
+ @XmlElementRef
+ public DefaultReferenceIdentifier getElement() {
+ if (skip()) return null;
+ final ReferenceIdentifier metadata = this.metadata;
+ if (metadata instanceof DefaultReferenceIdentifier) {
+ return (DefaultReferenceIdentifier) metadata;
+ } else {
+ return new DefaultReferenceIdentifier(metadata);
+ }
+ }
+
+ /**
+ * Invoked by JAXB at unmarshalling time for storing the result
temporarily.
+ *
+ * @param metadata The unmarshalled metadata.
+ */
+ public void setElement(final DefaultReferenceIdentifier metadata) {
+ this.metadata = metadata;
+ }
+}
Propchange:
sis/branches/JDK7/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/metadata/RS_Identifier.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange:
sis/branches/JDK7/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/metadata/RS_Identifier.java
------------------------------------------------------------------------------
svn:mime-type = text/plain;charset=UTF-8
Added:
sis/branches/JDK7/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/metadata/RS_ReferenceSystem.java
URL:
http://svn.apache.org/viewvc/sis/branches/JDK7/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/metadata/RS_ReferenceSystem.java?rev=1458538&view=auto
==============================================================================
---
sis/branches/JDK7/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/metadata/RS_ReferenceSystem.java
(added)
+++
sis/branches/JDK7/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/metadata/RS_ReferenceSystem.java
[UTF-8] Tue Mar 19 22:05:15 2013
@@ -0,0 +1,140 @@
+/*
+ * 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.jaxb.metadata;
+
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlElementRef;
+import org.opengis.referencing.ReferenceSystem;
+import org.apache.sis.xml.Namespaces;
+import org.apache.sis.internal.jaxb.gco.PropertyType;
+
+
+/**
+ * JAXB adapter mapping implementing class to the GeoAPI interface. See
+ * package documentation for more information about JAXB and interface.
+ *
+ * @author Guilhem Legal (Geomatys)
+ * @since 0.3 (derived from geotk-3.00)
+ * @version 0.3
+ * @module
+ */
+public class RS_ReferenceSystem extends PropertyType<RS_ReferenceSystem,
ReferenceSystem> {
+ /**
+ * Empty constructor for JAXB only.
+ */
+ public RS_ReferenceSystem() {
+ }
+
+ /**
+ * 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.
+ */
+ @Override
+ protected Class<ReferenceSystem> getBoundType() {
+ return ReferenceSystem.class;
+ }
+
+ /**
+ * Constructor for the {@link #wrap} method only.
+ */
+ RS_ReferenceSystem(final ReferenceSystem metadata) {
+ super(metadata);
+ }
+
+ /**
+ * Invoked by {@link PropertyType} at marshalling time for wrapping the
given metadata value
+ * in a {@code <gmd:RS_ReferenceSystem>} XML element.
+ *
+ * @param metadata The metadata element to marshall.
+ * @return A {@code PropertyType} wrapping the given the metadata element.
+ */
+ @Override
+ protected RS_ReferenceSystem wrap(ReferenceSystem metadata) {
+ return new RS_ReferenceSystem(metadata);
+ }
+
+ /**
+ * Invoked by JAXB at marshalling time for getting the actual metadata to
write
+ * inside the {@code <gmd:RS_ReferenceSystem>} XML element.
+ * This is the value or a copy of the value given in argument to the
{@code wrap} method.
+ *
+ * @return The metadata to be marshalled.
+ */
+ @Override
+ @XmlElementRef
+ public ReferenceSystemMetadata getElement() {
+ if (skip()) return null;
+ final ReferenceSystem metadata = this.metadata;
+ if (metadata instanceof ReferenceSystemMetadata) {
+ return (ReferenceSystemMetadata) metadata;
+ } else {
+ return new ReferenceSystemMetadata(metadata);
+ }
+ }
+
+ /**
+ * Invoked by JAXB at unmarshalling time for storing the result
temporarily.
+ *
+ * @param metadata The unmarshalled metadata.
+ */
+ public void setElement(final ReferenceSystemMetadata metadata) {
+ this.metadata = metadata;
+ }
+
+ /**
+ * A hook for the French profile.
+ *
+ * @return The metadata to be marshalled.
+ *
+ * @todo We need a better plugin mechanism.
+ */
+ @XmlElement(name = "FRA_DirectReferenceSystem", namespace = Namespaces.FRA)
+ public ReferenceSystemMetadata getDirectReferenceSystem() {
+ return null;
+ }
+
+ /**
+ * Setter method for the French profile hook.
+ *
+ * @param metadata The unmarshalled metadata.
+ */
+ public void setDirectReferenceSystem(final ReferenceSystemMetadata
metadata) {
+ this.metadata = metadata;
+ }
+
+ /**
+ * A hook for the French profile.
+ *
+ * @return The metadata to be marshalled.
+ *
+ * @todo We need a better plugin mechanism.
+ */
+ @XmlElement(name = "FRA_IndirectReferenceSystem", namespace =
Namespaces.FRA)
+ public ReferenceSystemMetadata getIndirectReferenceSystem() {
+ return null;
+ }
+
+ /**
+ * Setter method for the French profile hook.
+ *
+ * @param metadata The unmarshalled metadata.
+ */
+ public void setIndirectReferenceSystem(final ReferenceSystemMetadata
metadata) {
+ this.metadata = metadata;
+ }
+}
Propchange:
sis/branches/JDK7/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/metadata/RS_ReferenceSystem.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange:
sis/branches/JDK7/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/metadata/RS_ReferenceSystem.java
------------------------------------------------------------------------------
svn:mime-type = text/plain;charset=UTF-8
Added:
sis/branches/JDK7/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/metadata/ReferenceSystemMetadata.java
URL:
http://svn.apache.org/viewvc/sis/branches/JDK7/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/metadata/ReferenceSystemMetadata.java?rev=1458538&view=auto
==============================================================================
---
sis/branches/JDK7/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/metadata/ReferenceSystemMetadata.java
(added)
+++
sis/branches/JDK7/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/metadata/ReferenceSystemMetadata.java
[UTF-8] Tue Mar 19 22:05:15 2013
@@ -0,0 +1,228 @@
+/*
+ * 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.jaxb.metadata;
+
+import java.util.Set;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.Objects;
+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.util.GenericName;
+import org.opengis.util.InternationalString;
+import org.opengis.metadata.citation.Citation;
+import org.opengis.metadata.extent.Extent;
+import org.opengis.referencing.ReferenceSystem;
+import org.opengis.referencing.ReferenceIdentifier;
+import org.apache.sis.util.iso.DefaultNameSpace;
+
+
+/**
+ * An implementation of {@link ReferenceSystem} marshalled as specified in ISO
19115.
+ * This is different than the {@code ReferenceSystem} implementation provided
in the
+ * referencing module, since the later marshall the CRS as specified in GML
(close
+ * to ISO 19111 model).
+ *
+ * <p>Note that this implementation is very simple and serves no other purpose
than being
+ * a container for XML parsing or formatting. For real referencing service,
consider using
+ * {@link org.apache.sis.referencing.AbstractReferenceSystem} subclasses
instead.</p>
+ *
+ * @author Guilhem Legal (Geomatys)
+ * @author Martin Desruisseaux (Geomatys)
+ * @since 0.3 (derived from geotk-3.00)
+ * @version 0.3
+ * @module
+ *
+ * @see org.apache.sis.referencing.AbstractReferenceSystem
+ */
+@XmlRootElement(name = "MD_ReferenceSystem")
+public class ReferenceSystemMetadata implements ReferenceSystem, Serializable {
+ /**
+ * For cross-version compatibility.
+ */
+ private static final long serialVersionUID = 7008508657011563047L;
+
+ /**
+ * The primary name by which this object is identified.
+ */
+ @XmlElement
+ @XmlJavaTypeAdapter(RS_Identifier.class)
+ private ReferenceIdentifier referenceSystemIdentifier;
+
+ /**
+ * Creates a reference system without identifier.
+ * This constructor is mainly for JAXB.
+ */
+ public ReferenceSystemMetadata() {
+ }
+
+ /**
+ * Creates a new reference system from the given one.
+ *
+ * @param crs The reference system to partially copy.
+ */
+ public ReferenceSystemMetadata(final ReferenceSystem crs) {
+ referenceSystemIdentifier = crs.getName();
+ }
+
+ /**
+ * Creates a new reference system from the given identifier.
+ *
+ * @param name The primary name by which this object is identified.
+ */
+ public ReferenceSystemMetadata(final ReferenceIdentifier name) {
+ referenceSystemIdentifier = name;
+ }
+
+ /**
+ * Returns the primary name by which this object is identified.
+ */
+ @Override
+ public ReferenceIdentifier getName() {
+ return referenceSystemIdentifier;
+ }
+
+ /**
+ * Current implementation returns an empty set.
+ */
+ @Override
+ public Set<ReferenceIdentifier> getIdentifiers() {
+ return Collections.emptySet();
+ }
+
+ /**
+ * Current implementation returns an empty set.
+ */
+ @Override
+ public Collection<GenericName> getAlias() {
+ return Collections.emptySet();
+ }
+
+ /**
+ * Current implementation returns {@code null}.
+ */
+ @Override
+ public Extent getDomainOfValidity() {
+ return null;
+ }
+
+ /**
+ * Current implementation returns {@code null}.
+ */
+ @Override
+ public InternationalString getScope() {
+ return null;
+ }
+
+ /**
+ * Current implementation returns {@code null}.
+ */
+ @Override
+ public InternationalString getRemarks() {
+ return null;
+ }
+
+ /**
+ * Returns a hash code value for this object.
+ */
+ @Override
+ public int hashCode() {
+ int code = (int) serialVersionUID;
+ final ReferenceIdentifier id = referenceSystemIdentifier;
+ if (id != null) {
+ code ^= id.hashCode();
+ }
+ return code;
+ }
+
+ /**
+ * Compares this object with the given one for equality.
+ *
+ * @param object The object to compare with this reference system.
+ * @return {@code true} if both objects are equal.
+ */
+ @Override
+ public boolean equals(final Object object) {
+ if (object == this) {
+ return true;
+ }
+ if (object != null && object.getClass() == getClass()) {
+ final ReferenceSystemMetadata that = (ReferenceSystemMetadata)
object;
+ return Objects.equals(referenceSystemIdentifier,
that.referenceSystemIdentifier);
+ }
+ return false;
+ }
+
+ /**
+ * Throws an exception in all cases, since this object can't be formatted
in a valid WKT.
+ *
+ * @throws UnsupportedOperationException Always thrown.
+ */
+ @Override
+ public String toWKT() throws UnsupportedOperationException {
+ throw new UnsupportedOperationException();
+ }
+
+ /**
+ * Returns a pseudo-WKT representation.
+ */
+ @Override
+ public String toString() {
+ final String code, codespace;
+ final Citation authority;
+ final ReferenceIdentifier id = referenceSystemIdentifier;
+ if (id != null) {
+ code = id.getCode();
+ codespace = id.getCodeSpace();
+ authority = id.getAuthority();
+ } else {
+ code = null;
+ codespace = null;
+ authority = null;
+ }
+ return toString("RS", authority, codespace, code, false);
+ }
+
+ /**
+ * Returns a pseudo-WKT representation.
+ *
+ * @param type The WKT heading text.
+ * @param authority The authority to write in the {@code "AUTHORITY"}
element.
+ * @param codespace Usually an abbreviation of the authority name.
+ * @param code The code to write in the {@code "AUTHORITY"}
element, or {@code null} if none.
+ * @param deprecated {@code true} if the object to format is deprecated.
+ * @return The pseudo-WKT.
+ */
+ public static String toString(final String type, final Citation authority,
+ final String codespace, final String code, final boolean
deprecated)
+ {
+ final StringBuilder buffer = new StringBuilder(type).append("[\"");
+ if (codespace != null) {
+
buffer.append(codespace).append(DefaultNameSpace.DEFAULT_SEPARATOR);
+ }
+ buffer.append(code).append('"');
+ if (authority != null) {
+ buffer.append(",
AUTHORITY[\"").append(authority.getTitle()).append("\"]");
+ }
+ if (deprecated) {
+ buffer.append(", DEPRECATED");
+ }
+ return buffer.append(']').toString();
+ }
+}
Propchange:
sis/branches/JDK7/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/metadata/ReferenceSystemMetadata.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange:
sis/branches/JDK7/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/metadata/ReferenceSystemMetadata.java
------------------------------------------------------------------------------
svn:mime-type = text/plain;charset=UTF-8
Added:
sis/branches/JDK7/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/metadata/package-info.java
URL:
http://svn.apache.org/viewvc/sis/branches/JDK7/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/metadata/package-info.java?rev=1458538&view=auto
==============================================================================
---
sis/branches/JDK7/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/metadata/package-info.java
(added)
+++
sis/branches/JDK7/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/metadata/package-info.java
[UTF-8] Tue Mar 19 22:05:15 2013
@@ -0,0 +1,72 @@
+/*
+ * 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.
+ */
+
+/**
+ * JAXB adapters for metadata. The class defined in this package are both JAXB
adapters
+ * replacing GeoAPI interfaces by SIS implementation classes at marshalling
time (since
+ * JAXB can not marshall directly interfaces), and wrappers around the value
to be marshalled.
+ * ISO 19139 have the strange habit to wrap every properties in an extra
level, for example:
+ *
+ * {@preformat xml
+ * <CI_ResponsibleParty>
+ * <contactInfo>
+ * <CI_Contact>
+ * ...
+ * </CI_Contact>
+ * </contactInfo>
+ * </CI_ResponsibleParty>
+ * }
+ *
+ * The {@code </CI_Contact>} level is not really necessary, and JAXB is not
designed for inserting
+ * such level since it is not the usual way to write XML. In order to get this
output with JAXB, we
+ * have to wrap metadata object in an additional object. Those additional
objects are defined in
+ * this package.
+ *
+ * <p>So each class in this package is both a JAXB adapter and a wrapper. We
have merged those
+ * functionalities in order to avoid doubling the amount of classes, which is
already large.</p>
+ *
+ * <p>In ISO 19139 terminology:</p>
+ * <ul>
+ * <li>the public classes defined in the {@code org.apache.sis.metadata.iso}
packages are defined
+ * as {@code Foo_Type} in ISO 19139, where <var>Foo</var> is the ISO
name of a class.</li>
+ * <li>the internal classes defined in this package are defined as {@code
Foo_PropertyType} in
+ * ISO 19139 schemas.</li>
+ * </ul>
+ *
+ * @author Cédric Briançon (Geomatys)
+ * @author Martin Desruisseaux (Geomatys)
+ * @since 0.3 (derived from geotk-2.5)
+ * @version 0.3
+ * @module
+ *
+ * @see javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter
+ */
+@XmlSchema(elementFormDefault = XmlNsForm.QUALIFIED, namespace =
Namespaces.GMD, xmlns = {
+ @XmlNs(prefix = "gmd", namespaceURI = Namespaces.GMD),
+ @XmlNs(prefix = "gco", namespaceURI = Namespaces.GCO),
+ @XmlNs(prefix = "xsi", namespaceURI = Namespaces.XSI),
+ @XmlNs(prefix = "fra", namespaceURI = Namespaces.FRA)
+})
+@XmlAccessorType(XmlAccessType.NONE)
+package org.apache.sis.internal.jaxb.metadata;
+
+import javax.xml.bind.annotation.XmlNs;
+import javax.xml.bind.annotation.XmlNsForm;
+import javax.xml.bind.annotation.XmlSchema;
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import org.apache.sis.xml.Namespaces;
Propchange:
sis/branches/JDK7/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/metadata/package-info.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange:
sis/branches/JDK7/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/metadata/package-info.java
------------------------------------------------------------------------------
svn:mime-type = text/plain;charset=UTF-8
Added:
sis/branches/JDK7/sis-metadata/src/main/java/org/apache/sis/referencing/DefaultReferenceIdentifier.java
URL:
http://svn.apache.org/viewvc/sis/branches/JDK7/sis-metadata/src/main/java/org/apache/sis/referencing/DefaultReferenceIdentifier.java?rev=1458538&view=auto
==============================================================================
---
sis/branches/JDK7/sis-metadata/src/main/java/org/apache/sis/referencing/DefaultReferenceIdentifier.java
(added)
+++
sis/branches/JDK7/sis-metadata/src/main/java/org/apache/sis/referencing/DefaultReferenceIdentifier.java
[UTF-8] Tue Mar 19 22:05:15 2013
@@ -0,0 +1,544 @@
+/*
+ * 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.
+ *
+ * This package contains documentation from OpenGIS specifications.
+ * OpenGIS consortium's work is fully acknowledged here.
+ */
+package org.apache.sis.referencing;
+
+import java.util.Map;
+import java.util.Locale;
+import java.util.Collection;
+import java.util.Objects;
+import java.util.logging.Level;
+import java.io.Serializable;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
+import net.jcip.annotations.Immutable;
+
+import org.opengis.metadata.Identifier;
+import org.opengis.metadata.citation.Citation;
+import org.opengis.parameter.InvalidParameterValueException;
+import org.opengis.referencing.ReferenceIdentifier;
+import org.opengis.util.InternationalString;
+
+import org.apache.sis.xml.Namespaces;
+import org.apache.sis.util.Deprecable;
+import org.apache.sis.util.CharSequences;
+import org.apache.sis.util.logging.Logging;
+import org.apache.sis.util.resources.Errors;
+import org.apache.sis.util.resources.Messages;
+import org.apache.sis.util.iso.DefaultInternationalString;
+import org.apache.sis.internal.simple.SimpleCitation;
+import org.apache.sis.internal.jaxb.metadata.CI_Citation;
+import org.apache.sis.internal.jaxb.metadata.ReferenceSystemMetadata;
+import org.apache.sis.internal.jaxb.gco.StringAdapter;
+
+import static org.apache.sis.util.ArgumentChecks.ensureNonNull;
+import static org.opengis.referencing.IdentifiedObject.NAME_KEY;
+import static org.opengis.referencing.IdentifiedObject.REMARKS_KEY;
+
+
+/**
+ * An identification of a {@link
org.opengis.referencing.crs.CoordinateReferenceSystem} object.
+ *
+ * @author Martin Desruisseaux (Geomatys)
+ * @since 0.3 (derived from geotk-3.03)
+ * @version 0.3
+ * @module
+ */
+@Immutable
+@XmlRootElement(name = "RS_Identifier", namespace = Namespaces.GMD)
+public class DefaultReferenceIdentifier implements ReferenceIdentifier,
Deprecable, Serializable {
+ /**
+ * For cross-version compatibility.
+ */
+ private static final long serialVersionUID = 2004263079254434562L;
+
+ /**
+ * Identifier code or name, optionally from a controlled list or pattern
defined by a code space.
+ *
+ * @see #getCode()
+ */
+ @XmlElement(required = true, namespace = Namespaces.GMD)
+ @XmlJavaTypeAdapter(StringAdapter.class)
+ protected final String code;
+
+ /**
+ * Name or identifier of the person or organization responsible for
namespace, or
+ * {@code null} if not available. This is often an abbreviation of the
authority name.
+ *
+ * @see #getCodeSpace()
+ */
+ @XmlElement(required = true, namespace = Namespaces.GMD)
+ @XmlJavaTypeAdapter(StringAdapter.class)
+ protected final String codeSpace;
+
+ /**
+ * Organization or party responsible for definition and maintenance of the
code space or code,
+ * or {@code null} if not available.
+ *
+ * @see #getAuthority()
+ */
+ @XmlElement(required = true, namespace = Namespaces.GMD)
+ @XmlJavaTypeAdapter(CI_Citation.class)
+ protected final Citation authority;
+
+ /**
+ * Identifier of the version of the associated code space or code as
specified
+ * by the code space or code authority, or {@code null} if not available.
This
+ * version is included only when the {@linkplain #getCode() code} uses
versions.
+ * When appropriate, the edition is identified by the effective date,
coded using
+ * ISO 8601 date format.
+ *
+ * @see #getVersion()
+ */
+ @XmlElement(namespace = Namespaces.GMD)
+ private final String version;
+
+ /**
+ * Comments on or information about this identifier, or {@code null} if
none.
+ *
+ * @see #getRemarks
+ */
+ private final InternationalString remarks;
+
+ /**
+ * Empty constructor for JAXB.
+ */
+ private DefaultReferenceIdentifier() {
+ code = null;
+ codeSpace = null;
+ authority = null;
+ version = null;
+ remarks = null;
+ }
+
+ /**
+ * Creates a new identifier from the specified one. This is a copy
constructor
+ * which will get the code, codespace, authority, version and (if
available)
+ * the remarks from the given identifier.
+ *
+ * @param identifier The identifier to copy.
+ */
+ public DefaultReferenceIdentifier(final ReferenceIdentifier identifier) {
+ ensureNonNull("identifier", identifier);
+ code = identifier.getCode();
+ codeSpace = identifier.getCodeSpace();
+ authority = identifier.getAuthority();
+ version = identifier.getVersion();
+ if (identifier instanceof DefaultReferenceIdentifier) {
+ remarks = ((DefaultReferenceIdentifier) identifier).getRemarks();
+ } else {
+ remarks = null;
+ }
+ }
+
+ /**
+ * Creates a new identifier from the specified code and authority.
+ *
+ * @param authority
+ * Organization or party responsible for definition and
maintenance of the code
+ * space or code.
+ * @param codeSpace
+ * Name or identifier of the person or organization responsible
for namespace.
+ * This is often an abbreviation of the authority name.
+ * @param code
+ * Identifier code or name, optionally from a controlled list or
pattern defined by
+ * a code space. The code can not be null.
+ */
+ public DefaultReferenceIdentifier(final Citation authority, final String
codeSpace, final String code) {
+ this(authority, codeSpace, code, null, null);
+ }
+
+ /**
+ * Creates a new identifier from the specified code and authority,
+ * with an optional version number and remarks.
+ *
+ * @param authority
+ * Organization or party responsible for definition and
maintenance of the code
+ * space or code, or {@code null} if not available.
+ * @param codeSpace
+ * Name or identifier of the person or organization responsible
for namespace, or
+ * {@code null} if not available. This is often an abbreviation
of the authority name.
+ * @param code
+ * Identifier code or name, optionally from a controlled list or
pattern defined by
+ * a code space. The code can not be null.
+ * @param version
+ * The version of the associated code space or code as specified
by the code authority,
+ * or {@code null} if none.
+ * @param remarks
+ * Comments on or information about this identifier, or {@code
null} if none.
+ */
+ public DefaultReferenceIdentifier(final Citation authority, final String
codeSpace,
+ final String code, final String version, final InternationalString
remarks)
+ {
+ ensureNonNull("code", code);
+ this.code = code;
+ this.codeSpace = codeSpace;
+ this.authority = authority;
+ this.version = version;
+ this.remarks = remarks;
+ }
+
+ /**
+ * Constructs an identifier from a set of properties. Keys are strings
from the table below.
+ * Keys are case-insensitive, and leading and trailing spaces are ignored.
The map given in
+ * argument shall contains at least a {@code "code"} property. Other
properties listed in
+ * the table below are optional.
+ *
+ * <table class="sis">
+ * <tr>
+ * <th>Property name</th>
+ * <th>Value type</th>
+ * <th>Value given to</th>
+ * </tr>
+ * <tr>
+ * <td>{@value org.opengis.metadata.Identifier#CODE_KEY}</td>
+ * <td>{@link String}</td>
+ * <td>{@link #getCode()}</td>
+ * </tr>
+ * <tr>
+ * <td>{@value
org.opengis.referencing.ReferenceIdentifier#CODESPACE_KEY}</td>
+ * <td>{@link String}</td>
+ * <td>{@link #getCodeSpace()}</td>
+ * </tr>
+ * <tr>
+ * <td>{@value org.opengis.metadata.Identifier#AUTHORITY_KEY}</td>
+ * <td>{@link String} or {@link Citation}</td>
+ * <td>{@link #getAuthority()}</td>
+ * </tr>
+ * <tr>
+ * <td>{@value
org.opengis.referencing.ReferenceIdentifier#VERSION_KEY}</td>
+ * <td>{@link String}</td>
+ * <td>{@link #getVersion()}</td>
+ * </tr>
+ * <tr>
+ * <td>{@value
org.opengis.referencing.IdentifiedObject#REMARKS_KEY}</td>
+ * <td>{@link String} or {@link InternationalString}</td>
+ * <td>{@link #getRemarks()}</td>
+ * </tr>
+ * </table>
+ *
+ * {@code "remarks"} is a localizable attributes which may have a language
and country
+ * code suffix. For example the {@code "remarks_fr"} property stands for
remarks in
+ * {@linkplain Locale#FRENCH French} and the {@code "remarks_fr_CA"}
property stands
+ * for remarks in {@linkplain Locale#CANADA_FRENCH French Canadian}.
+ *
+ * @param properties The properties to be given to this identifier.
+ * @throws InvalidParameterValueException if a property has an invalid
value.
+ * @throws IllegalArgumentException if a property is invalid for some
other reason.
+ */
+ public DefaultReferenceIdentifier(final Map<String,?> properties) throws
IllegalArgumentException {
+ this(properties, true);
+ }
+
+ /**
+ * Implementation of the constructor. The remarks in the {@code
properties} map will be
+ * parsed only if the {@code standalone} argument is set to {@code true},
i.e. this
+ * identifier is being constructed as a standalone object. If {@code
false}, then this
+ * identifier is assumed to be constructed from inside the {@link
AbstractIdentifiedObject}
+ * constructor.
+ *
+ * @param properties The properties to parse, as described in the public
constructor.
+ * @param standalone {@code true} for parsing "remarks" as well.
+ * @throws InvalidParameterValueException if a property has an invalid
value.
+ * @throws IllegalArgumentException if a property is invalid for some
other reason.
+ */
+ DefaultReferenceIdentifier(final Map<String,?> properties, final boolean
standalone)
+ throws IllegalArgumentException
+ {
+ ensureNonNull("properties", properties);
+ Object code = null;
+ Object codeSpace = null;
+ Object version = null;
+ Object authority = null;
+ Object remarks = null;
+ DefaultInternationalString localized = null;
+ /*
+ * Iterates through each map entry. This have two purposes:
+ *
+ * 1) Ignore case (a call to properties.get("foo") can't do that)
+ * 2) Find localized remarks.
+ *
+ * This algorithm is sub-optimal if the map contains a lot of entries
of no interest to
+ * this identifier. Hopefully, most users will fill a map with only
useful entries.
+ */
+ String key = null;
+ Object value = null;
+ for (final Map.Entry<String,?> entry : properties.entrySet()) {
+ key = entry.getKey().trim().toLowerCase();
+ value = entry.getValue();
+ switch (key) {
+ case NAME_KEY: {
+ if (standalone) {
+ break;
+ }
+ code = value;
+ continue;
+ }
+ case CODE_KEY: {
+ code = value;
+ continue;
+ }
+ case CODESPACE_KEY: {
+ codeSpace = value;
+ continue;
+ }
+ case VERSION_KEY: {
+ version = value;
+ continue;
+ }
+ case AUTHORITY_KEY: {
+ if (value instanceof String) {
+ value = new SimpleCitation(value.toString());
+ }
+ authority = value;
+ continue;
+ }
+ case REMARKS_KEY: {
+ if (standalone && value instanceof InternationalString) {
+ remarks = value;
+ continue;
+ }
+ break;
+ }
+ }
+ /*
+ * Searches for additional locales (e.g. "remarks_fr").
+ */
+ if (standalone && value instanceof String) {
+ if (localized == null) {
+ if (remarks instanceof DefaultInternationalString) {
+ localized = (DefaultInternationalString) remarks;
+ } else {
+ localized = new DefaultInternationalString();
+ }
+ }
+ localized.add(REMARKS_KEY, key, value.toString());
+ }
+ }
+ /*
+ * Gets the localized remarks, if it was not yet set. If a user
specified remarks
+ * both as InternationalString and as String for some locales (which
is a weird
+ * usage...), then current implementation discards the later with a
warning.
+ */
+ if (localized != null && !localized.getLocales().isEmpty()) {
+ if (remarks == null) {
+ remarks = localized;
+ } else {
+ Logging.log(DefaultReferenceIdentifier.class, "<init>",
+ Messages.getResources(null).getLogRecord(Level.WARNING,
Messages.Keys.LocalesDiscarded));
+ }
+ }
+ /*
+ * Completes the code space if it was not explicitly set. We take the
first
+ * identifier if there is any, otherwise we take the shortest title.
+ */
+ if (codeSpace == null && authority instanceof Citation) {
+ codeSpace = getCodeSpace((Citation) authority);
+ }
+ /*
+ * Stores the definitive reference to the attributes. Note that casts
are performed only
+ * there (not before). This is a wanted feature, since we want to
catch ClassCastExceptions
+ * are rethrown them as more informative exceptions.
+ */
+ try {
+ key= CODE_KEY; this.code = (String) (value
= code);
+ key= VERSION_KEY; this.version = (String) (value
= version);
+ key= CODESPACE_KEY; this.codeSpace = (String) (value
= codeSpace);
+ 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);
+ }
+ ensureNonNull(CODE_KEY, code);
+ }
+
+ /**
+ * Returns the shortest title inferred from the specified authority.
+ * This is used both for creating a generic name, or for inferring a
+ * default identifier code space.
+ */
+ private static InternationalString getShortestTitle(final Citation
authority) {
+ InternationalString title = authority.getTitle();
+ int length = title.length();
+ final Collection<? extends InternationalString> alt =
authority.getAlternateTitles();
+ if (alt != null) {
+ for (final InternationalString candidate : alt) {
+ final int candidateLength = candidate.length();
+ if (candidateLength > 0 && candidateLength < length) {
+ title = candidate;
+ length = candidateLength;
+ }
+ }
+ }
+ return title;
+ }
+
+ /**
+ * Tries to get a code space from the specified authority. This method
scans first
+ * through the identifier, then through the titles if no suitable
identifier were found.
+ */
+ private static String getCodeSpace(final Citation authority) {
+ if (authority != null) {
+ final Collection<? extends Identifier> identifiers =
authority.getIdentifiers();
+ if (identifiers != null) {
+ for (final Identifier id : identifiers) {
+ final String identifier = id.getCode();
+ if (CharSequences.isUnicodeIdentifier(identifier)) {
+ return identifier;
+ }
+ }
+ }
+ final String title =
getShortestTitle(authority).toString(Locale.ROOT);
+ if (CharSequences.isUnicodeIdentifier(title)) {
+ return title;
+ }
+ }
+ return null;
+ }
+
+ /**
+ * Identifier code or name, optionally from a controlled list or pattern.
+ *
+ * @return The code, never {@code null}.
+ *
+ * @see NamedIdentifier#tip()
+ */
+ @Override
+ public String getCode() {
+ return code;
+ }
+
+ /**
+ * Name or identifier of the person or organization responsible for
namespace.
+ *
+ * @return The code space, or {@code null} if not available.
+ *
+ * @see NamedIdentifier#head()
+ * @see NamedIdentifier#scope()
+ */
+ @Override
+ public String getCodeSpace() {
+ return codeSpace;
+ }
+
+ /**
+ * Organization or party responsible for definition and maintenance of the
+ * {@linkplain #getCode code}.
+ *
+ * @return The authority, or {@code null} if not available.
+ *
+ * @see org.apache.sis.metadata.iso.citation.Citations#EPSG
+ */
+ @Override
+ public Citation getAuthority() {
+ return authority;
+ }
+
+ /**
+ * Identifier of the version of the associated code space or code, as
specified by the
+ * code authority. This version is included only when the {@linkplain
#getCode code}
+ * uses versions. When appropriate, the edition is identified by the
effective date,
+ * coded using ISO 8601 date format.
+ *
+ * @return The version, or {@code null} if not available.
+ */
+ @Override
+ public String getVersion() {
+ return version;
+ }
+
+ /**
+ * Comments on or information about this identifier, or {@code null} if
none.
+ *
+ * @return Optional comments about this identifier.
+ */
+ public InternationalString getRemarks() {
+ return remarks;
+ }
+
+ /**
+ * Returns {@code true} if the object represented by this identifier is
deprecated. In such
+ * case, the {@linkplain #getRemarks() remarks} may contains the new
identifier to use.
+ * <p>
+ * The default implementation returns {@code false} in all cases.
+ *
+ * @see AbstractIdentifiedObject#isDeprecated()
+ *
+ * @return {@code true} if this code is deprecated.
+ */
+ @Override
+ public boolean isDeprecated() {
+ return false;
+ }
+
+ /**
+ * Returns a hash code value for this object.
+ */
+ @Override
+ public int hashCode() {
+ int hash = (int) serialVersionUID;
+ if (code != null) {
+ hash ^= code.hashCode();
+ }
+ if (codeSpace != null) {
+ hash = hash*31 + codeSpace.hashCode();
+ }
+ return hash;
+ }
+
+ /**
+ * Compares this object with the given one for equality.
+ *
+ * @param object The object to compare with this identifier.
+ * @return {@code true} if both objects are equal.
+ */
+ @Override
+ public boolean equals(final Object object) {
+ if (object == this) {
+ return true;
+ }
+ if (object != null && object.getClass() == getClass()) {
+ final DefaultReferenceIdentifier that =
(DefaultReferenceIdentifier) object;
+ return Objects.equals(code, that.code) &&
+ Objects.equals(codeSpace, that.codeSpace) &&
+ Objects.equals(authority, that.authority) &&
+ Objects.equals(version, that.version) &&
+ Objects.equals(remarks, that.remarks);
+ }
+ return false;
+ }
+
+ /**
+ * Returns a string representation of this identifier.
+ * The default implementation returns a pseudo-WKT format.
+ *
+ * {@note The <code>NamedIdentifier</code> subclass overrides this method
with a different
+ * behavior, in order to be compliant with the contract of the
<code>GenericName</code>
+ * interface.}
+ *
+ * @see IdentifiedObjects#toString(Identifier)
+ * @see NamedIdentifier#toString()
+ */
+ @Override
+ public String toString() {
+ return ReferenceSystemMetadata.toString("IDENTIFIER", authority,
codeSpace, code, isDeprecated());
+ }
+}
Propchange:
sis/branches/JDK7/sis-metadata/src/main/java/org/apache/sis/referencing/DefaultReferenceIdentifier.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange:
sis/branches/JDK7/sis-metadata/src/main/java/org/apache/sis/referencing/DefaultReferenceIdentifier.java
------------------------------------------------------------------------------
svn:mime-type = text/plain;charset=UTF-8