DefaultMetadata changes for revisions 24819:24820

This commit propagates changes which were done in the GeoAPI interfaces:

Reverting this commits result in compiler errors, which can be resolved only by re-introducing the new methods found in the commit. The method bodies of those properties are straightforward, so rewriting them produce the same result.

The deprecated method has been removed. The freeze, equals, hashCode toString methods and the convenience constructor receiving many parameters do not exist anymore under this form in Geotk/SIS, so the changes in those methods do not appear in SIS.

Action: all contributions forced by changes in GeoAPI interfaces (mostly import statements and method signatures) have been rewritten from scratch by creating an empty Java class implementing the interface, clicking on the "Implement all abstract methods" contextual menu in NetBeans, removing the <? extends> part in parameterized type of collections, adding the synchronized keyword (for now) and finally adding the corresponding private fields. This action has been committed in the Apache SIS JDK7 branch at revision 1458238.

Command line:

svn diff --extensions "--unified --ignore-space-change --ignore-all-space --ignore-eol-style" -r24819:24820 https://svn.osgeo.org/geotools/trunk/modules/library/metadata/src/main/java/org/geotools/metadata/iso/MetaDataImpl.java
Revision 24819Revision 24820
private Locale language;

/**
 * Full name of the character coding standard used for the metadata set.
 */
private Charset characterSet;
private Locale language;

/**
 * Information about an alternatively used localized character
 * strings for linguistic extensions.
 */
private Collection locales;

/**
 * Full name of the character coding standard used for the metadata set.
 */
private Charset characterSet;
/**
 * Party responsible for the metadata information.
 */
private ResponsibleParty contact;

/**
 * Date that the metadata was created, in milliseconds ellapsed since January 1st, 1970.
 * If not defined, then then value is {@link Long#MIN_VALUE}.
 */
/**
 * Party responsible for the metadata information.
 */
private Collection contacts;

/**
 * Uniformed Resource Identifier (URI) of the dataset to which the metadata applies.
 */
private String dataSetUri;

/**
 * Date that the metadata was created, in milliseconds ellapsed since January 1st, 1970.
 * If not defined, then then value is {@link Long#MIN_VALUE}.
 */
                final Date             dateStamp,
                final Identification   identificationInfo)
{
    setContact           (contact);
    setDateStamp         (dateStamp);
    setIdentificationInfo(Collections.singleton(identificationInfo));
}
                final Date             dateStamp,
                final Identification   identificationInfo)
{
    setContacts          (Collections.singleton(contact));
    setDateStamp         (dateStamp);
    setIdentificationInfo(Collections.singleton(identificationInfo));
}
/**
 * Returns the party responsible for the metadata information.
 */
public ResponsibleParty getContact() {
    return contact;
}

/**
 * Set the party responsible for the metadata information.
 */
public synchronized void setContact(final ResponsibleParty newValue) {
    checkWritePermission();
    contact = newValue;
}

/**
/**
 * Returns the party responsible for the metadata information.
 * @deprecated use getContacts
 */
public ResponsibleParty getContact() {
    Collection contacts = getContacts();
    return (contacts.isEmpty()) ? null : (ResponsibleParty) contacts.toArray()[0];
}

/**
 * Returns the party responsible for the metadata information.
 */
public Collection getContacts() {
    return nonNullCollection(contacts, ResponsibleParty.class);
}

/**
 * Set the party responsible for the metadata information.
 * @deprecated use setContacts
 */
public synchronized void setContact(final ResponsibleParty newValue) {
    setContacts(Collections.singleton(newValue));
}

/**
 * Set the parties responsible for the metadata information.
 */
public synchronized void setContacts(final Collection newValues) {
    checkWritePermission();
    contacts = copyCollection(newValues, contacts, ResponsibleParty.class);
}

/**
}

/**
 * Declare this metadata and all its attributes as unmodifiable.
 */
protected void freeze() {
    super.freeze();
    language                  = (Locale)                 unmodifiable(language);
    characterSet              = (Charset)                unmodifiable(characterSet);
    hierarchyLevels           = (Collection)             unmodifiable(hierarchyLevels);
    hierarchyLevelNames       = (Collection)             unmodifiable(hierarchyLevelNames);
    contact                   = (ResponsibleParty)       unmodifiable(contact);
    spatialRepresentationInfo = (Collection)             unmodifiable(spatialRepresentationInfo);
    referenceSystemInfo       = (Collection)             unmodifiable(referenceSystemInfo);
    metadataExtensionInfo     = (Collection)             unmodifiable(metadataExtensionInfo);
}

/**
 * Provides information about an alternatively used localized character
 * string for a linguistic extension
 */
public synchronized Collection getLocales() {
    return nonNullCollection(locales, Locale.class);
}

/**
 * Set information about an alternatively used localized character
 * string for a linguistic extension
 */
public synchronized void setLocales(final Collection newValues) {
    locales = copyCollection(newValues, locales, Locale.class);
}

/**
 * Provides the URI of the dataset to which the metadata applies.
 */
public String getDataSetUri() {
    return dataSetUri;
}

/**
 * Sets the URI of the dataset to which the metadata applies.
 */
public void setDataSetUri(final String newValue) {
    checkWritePermission();
    dataSetUri = newValue;
}

/**
 * Declare this metadata and all its attributes as unmodifiable.
 */
protected void freeze() {
    super.freeze();
    language                  = (Locale)                 unmodifiable(language);
    locales                   = (Collection)             unmodifiable(locales);
    characterSet              = (Charset)                unmodifiable(characterSet);
    hierarchyLevels           = (Collection)             unmodifiable(hierarchyLevels);
    hierarchyLevelNames       = (Collection)             unmodifiable(hierarchyLevelNames);
    contacts                  = (Collection)             unmodifiable(contacts);
    spatialRepresentationInfo = (Collection)             unmodifiable(spatialRepresentationInfo);
    referenceSystemInfo       = (Collection)             unmodifiable(referenceSystemInfo);
    metadataExtensionInfo     = (Collection)             unmodifiable(metadataExtensionInfo);
return               this.dateStamp             ==   that.dateStamp                  &&
    Utilities.equals(this.fileIdentifier,            that.fileIdentifier           ) &&
    Utilities.equals(this.language,                  that.language                 ) &&
    Utilities.equals(this.characterSet,              that.characterSet             ) &&
    Utilities.equals(this.parentIdentifier,          that.parentIdentifier         ) &&
    Utilities.equals(this.hierarchyLevels,           that.hierarchyLevels          ) &&
    Utilities.equals(this.hierarchyLevelNames,       that.hierarchyLevelNames      ) &&
    Utilities.equals(this.contact,                   that.contact                  ) &&
    Utilities.equals(this.metadataStandardName,      that.metadataStandardName     ) &&
    Utilities.equals(this.metadataStandardVersion,   that.metadataStandardVersion  ) &&
    Utilities.equals(this.spatialRepresentationInfo, that.spatialRepresentationInfo) &&
return               this.dateStamp             ==   that.dateStamp                  &&
    Utilities.equals(this.fileIdentifier,            that.fileIdentifier           ) &&
    Utilities.equals(this.language,                  that.language                 ) &&
    Utilities.equals(this.locales,                   that.locales                  ) &&
    Utilities.equals(this.dataSetUri,                that.dataSetUri               ) &&
    Utilities.equals(this.characterSet,              that.characterSet             ) &&
    Utilities.equals(this.parentIdentifier,          that.parentIdentifier         ) &&
    Utilities.equals(this.hierarchyLevels,           that.hierarchyLevels          ) &&
    Utilities.equals(this.hierarchyLevelNames,       that.hierarchyLevelNames      ) &&
    Utilities.equals(this.contacts,                  that.contacts                 ) &&
    Utilities.equals(this.metadataStandardName,      that.metadataStandardName     ) &&
    Utilities.equals(this.metadataStandardVersion,   that.metadataStandardVersion  ) &&
    Utilities.equals(this.spatialRepresentationInfo, that.spatialRepresentationInfo) &&
 */
public synchronized int hashCode() {
    int code = (int)serialVersionUID;
    if (contact            != null) code ^= contact           .hashCode();
    if (identificationInfo != null) code ^= identificationInfo.hashCode();
    return code;
}
 */
public synchronized int hashCode() {
    int code = (int)serialVersionUID;
    if (fileIdentifier     != null) code ^= fileIdentifier    .hashCode();
    if (identificationInfo != null) code ^= identificationInfo.hashCode();
    return code;
}
     * @todo Provides a more elaborated implementation.
     */
    public String toString() {
        return String.valueOf(contact);
    }
}
     * @todo Provides a more elaborated implementation.
     */
    public String toString() {
        StringBuffer str = new StringBuffer();
        if (fileIdentifier != null) {
            str.append(fileIdentifier);
    }
        appendCollection(str, "ContentInfo", getContentInfo());
        appendCollection(str, "Contacts", getContacts());
        return str.toString();
}

}