edu.ucsb.nceas.metacat.doi.datacite

## Class DataCiteMetadataFactory

- java.lang.Object
- - edu.ucsb.nceas.metacat.doi.datacite.DataCiteMetadataFactory

- Direct Known Subclasses:
    DefaultDataCiteFactory, EML2DataCiteFactory

      public abstract class DataCiteMetadataFactory
      extends java.lang.Object

  A factory abstract class to generate the datacite metadata (xml format) for an DOI object. If you want to add a new factory for a meta data standard, you can extends this class and also register the new factory on the property "guid.ezid.datacite.factories" on the metacat.properties file.
  Author:
    tao

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static java.lang.String` | `ABSTRACT`
    `static java.lang.String` | `CREATOR`
    `static java.lang.String` | `CREATORNAME`
    `static java.lang.String` | `CREATORS`
    `static java.lang.String` | `DESCRIPTIONS`
    `static java.lang.String` | `DOI`
    `static java.lang.String` | `EN`
    `static java.lang.String` | `FORMATS`
    `protected static java.lang.String` | `INVALIDCODE`
    `static java.lang.String` | `NAMESPACE`
    `static java.lang.String` | `RESOURCE`
    `static java.lang.String` | `SCHEMALOCATION`
    `static java.lang.String` | `SUBJECTS`
    `static java.lang.String` | `TITLES`
    `static java.lang.String` | `XML_LANG`
    `protected static javax.xml.xpath.XPath` | `xpath`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `DataCiteMetadataFactory()`

  - ### Method Summary

    All Methods Static Methods Instance Methods Abstract Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `protected org.w3c.dom.Document` | `addIdentifier(org.w3c.dom.Document doc, java.lang.String identifier, java.lang.String scheme)` Add the identifier element to the root document.
    `protected org.w3c.dom.Document` | `addLanguage(org.w3c.dom.Document doc, java.lang.String language)` Append a subject to the document.
    `protected org.w3c.dom.Document` | `addPublicationYear(org.w3c.dom.Document doc, java.lang.String publicationYear)` Add the publication year node
    `protected org.w3c.dom.Document` | `addPublisher(org.w3c.dom.Document doc, java.lang.String publisher)` Add the publisher node
    `protected org.w3c.dom.Document` | `addResourceType(org.w3c.dom.Document doc, java.lang.String resourceTypeGeneral, java.lang.String resourceType)` Add the resource type to the document
    `protected org.w3c.dom.Document` | `addVersion(org.w3c.dom.Document doc, java.lang.String version)` Add the version element to the document
    `protected org.w3c.dom.Document` | `appendCreator(java.lang.String creatorName, org.w3c.dom.Document doc, java.lang.String affiliation, java.lang.String nameIdentifier, java.lang.String nameIdentifierSchemeURI, java.lang.String nameIdentifierScheme)` Append a creator element to the root element.
    `protected org.w3c.dom.Document` | `appendDescription(java.lang.String description, org.w3c.dom.Document doc, java.lang.String language, java.lang.String descriptionType)` Append a description to the document.
    `protected org.w3c.dom.Document` | `appendFormat(org.w3c.dom.Document doc, java.lang.String format)` Add the format (MIME type) of the meta data object to the document
    `protected org.w3c.dom.Document` | `appendSubject(java.lang.String subject, org.w3c.dom.Document doc, java.lang.String language)` Append a subject to the document
    `org.w3c.dom.Document` | `appendTitle(java.lang.String title, org.w3c.dom.Document doc, java.lang.String language)` Append a title to the title list element
    `abstract boolean` | `canProcess(java.lang.String namespace)` Determine if the factory can handle the meta data with the given name space
    `abstract java.lang.String` | `generateMetadata(org.dataone.service.types.v1.Identifier identifier, org.dataone.service.types.v2.SystemMetadata sysmeta)` Method to generate the datacite meta data xml string for an object with the given system meta data.
    `protected org.w3c.dom.Document` | `generateROOTDoc()` Generate the blank DOM document for the datacite name space
    `static java.lang.String` | `lookupFormat(org.dataone.service.types.v2.SystemMetadata sysMeta)` Figure out the format (mime type) of the data object
    `protected java.lang.String` | `removeIdSchemePrefix(java.lang.String id, java.lang.String scheme)` Remove the sheme prefix for a given id.
    `protected java.lang.String` | `serializeDoc(org.w3c.dom.Document doc)` Serialize the given doc object to a string

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Field Detail

    - #### EN

          public static final java.lang.String EN

      See Also:
        Constant Field Values

    - #### XML_LANG

          public static final java.lang.String XML_LANG

      See Also:
        Constant Field Values

    - #### NAMESPACE

          public static final java.lang.String NAMESPACE

      See Also:
        Constant Field Values

    - #### SCHEMALOCATION

          public static final java.lang.String SCHEMALOCATION

      See Also:
        Constant Field Values

    - #### RESOURCE

          public static final java.lang.String RESOURCE

      See Also:
        Constant Field Values

    - #### CREATORS

          public static final java.lang.String CREATORS

      See Also:
        Constant Field Values

    - #### CREATOR

          public static final java.lang.String CREATOR

      See Also:
        Constant Field Values

    - #### CREATORNAME

          public static final java.lang.String CREATORNAME

      See Also:
        Constant Field Values

    - #### TITLES

          public static final java.lang.String TITLES

      See Also:
        Constant Field Values

    - #### SUBJECTS

          public static final java.lang.String SUBJECTS

      See Also:
        Constant Field Values

    - #### DESCRIPTIONS

          public static final java.lang.String DESCRIPTIONS

      See Also:
        Constant Field Values

    - #### FORMATS

          public static final java.lang.String FORMATS

      See Also:
        Constant Field Values

    - #### DOI

          public static final java.lang.String DOI

      See Also:
        Constant Field Values

    - #### ABSTRACT

          public static final java.lang.String ABSTRACT

      See Also:
        Constant Field Values

    - #### INVALIDCODE

          protected static final java.lang.String INVALIDCODE

      See Also:
        Constant Field Values

    - #### xpath

          protected static javax.xml.xpath.XPath xpath

  - ### Constructor Detail

    - #### DataCiteMetadataFactory

          public DataCiteMetadataFactory()

  - ### Method Detail

    - #### generateMetadata

          public abstract java.lang.String generateMetadata(org.dataone.service.types.v1.Identifier identifier,
                                                            org.dataone.service.types.v2.SystemMetadata sysmeta)
                                                     throws org.dataone.service.exceptions.InvalidRequest,
                                                            org.dataone.service.exceptions.ServiceFailure

      Method to generate the datacite meta data xml string for an object with the given system meta data.
      Parameters:
        `sysmeta` - the system meta data information of an given object
      Returns:
        the xml string of the datacite meta data.
      Throws:
        `org.dataone.service.exceptions.InvalidRequest`
        `org.dataone.service.exceptions.ServiceFailure`

    - #### canProcess

          public abstract boolean canProcess(java.lang.String namespace)

      Determine if the factory can handle the meta data with the given name space
      Parameters:
        `namespace` - the name space of the meta data
      Returns:
        true if this factory can process it; false otherwise.

    - #### generateROOTDoc

          protected org.w3c.dom.Document generateROOTDoc()
                                                  throws java.lang.Exception

      Generate the blank DOM document for the datacite name space
      Returns:
      Throws:
        `java.lang.Exception`

    - #### addIdentifier

          protected org.w3c.dom.Document addIdentifier(org.w3c.dom.Document doc,
                                                       java.lang.String identifier,
                                                       java.lang.String scheme)
                                                throws org.dataone.service.exceptions.InvalidRequest

      Add the identifier element to the root document. This method must be called after we calling the generateROOTDoc method and it can be called only once
      Parameters:
        `doc` -
        `identifier` -
      Returns:
      Throws:
        `org.dataone.service.exceptions.InvalidRequest`

    - #### appendCreator

          protected org.w3c.dom.Document appendCreator(java.lang.String creatorName,
                                                       org.w3c.dom.Document doc,
                                                       java.lang.String affiliation,
                                                       java.lang.String nameIdentifier,
                                                       java.lang.String nameIdentifierSchemeURI,
                                                       java.lang.String nameIdentifierScheme)
                                                throws javax.xml.xpath.XPathExpressionException

      Append a creator element to the root element. This method should be called immediately after we calling the method addIdentifier. It can be called more than one time.
      Parameters:
        `creatorName` - the name of the creator. If it is a person, it should be this format - lastName, firstName.
        `doc` -
        `nameIdentifier` - the value of the name identifier, e.g., 0000-0003-0003-2515
        `nameIdentifierSchemeURI` - the URI of the name identifier scheme, e.g., http://orcid.org/
        `nameIdentifierScheme` - the name of the name identifier scheme, e.g., ORCID
        `affilication` - the affiliation the creator associates with
      Returns:
      Throws:
        `javax.xml.xpath.XPathExpressionException`

    - #### appendTitle

          public org.w3c.dom.Document appendTitle(java.lang.String title,
                                                  org.w3c.dom.Document doc,
                                                  java.lang.String language)
                                           throws javax.xml.xpath.XPathExpressionException

      Append a title to the title list element
      Parameters:
        `doc` - the document which will be modified
        `title` - the title will be appended
        `language` - the language which the tile uses. This method will transform the language to the ISO 639 two-letter code. If it is null, EN will be used
      Returns:
        the modified document object
      Throws:
        `javax.xml.xpath.XPathExpressionException`

    - #### addPublisher

          protected org.w3c.dom.Document addPublisher(org.w3c.dom.Document doc,
                                                      java.lang.String publisher)
                                               throws org.dataone.service.exceptions.InvalidRequest

      Add the publisher node
      Parameters:
        `doc` - the doc needs to be modified
        `publisher` - the publisher will be added
      Returns:
      Throws:
        `org.dataone.service.exceptions.InvalidRequest`

    - #### addPublicationYear

          protected org.w3c.dom.Document addPublicationYear(org.w3c.dom.Document doc,
                                                            java.lang.String publicationYear)
                                                     throws org.dataone.service.exceptions.InvalidRequest

      Add the publication year node
      Parameters:
        `doc` - the doc needs to be modified
        `publicationYear` - the publication year will be added
      Returns:
      Throws:
        `org.dataone.service.exceptions.InvalidRequest`

    - #### appendSubject

          protected org.w3c.dom.Document appendSubject(java.lang.String subject,
                                                       org.w3c.dom.Document doc,
                                                       java.lang.String language)
                                                throws javax.xml.xpath.XPathExpressionException

      Append a subject to the document
      Parameters:
        `subject` - the subject will be appended
        `doc` - the document will be modified
        `language` - the language which the subject is using. This method will transform the language string to the ISO 639 two-letter code. If it is null, EN will be used.
      Returns:
        the modified document object
      Throws:
        `javax.xml.xpath.XPathExpressionException`

    - #### addLanguage

          protected org.w3c.dom.Document addLanguage(org.w3c.dom.Document doc,
                                                     java.lang.String language)

      Append a subject to the document. The language will be changed to the ISO639 code
      Parameters:
        `doc` - the document object will be modified
        `language` - the language is used in the meta data. This method will transform the language string to the ISO 639 two-letter code.
      Returns:
        the modified document object

    - #### addResourceType

          protected org.w3c.dom.Document addResourceType(org.w3c.dom.Document doc,
                                                         java.lang.String resourceTypeGeneral,
                                                         java.lang.String resourceType)

      Add the resource type to the document
      Parameters:
        `doc` - the document object will be modified
        `resourceType` - it should be one of those options: "Audiovisual" "Collection" "Dataset" "Event" "Image" "InteractiveResource" "Model" "PhysicalObject" "Service" "Software "Sound" "Text" "Workflow" "Other"
      Returns:
        the modified document object

    - #### appendFormat

          protected org.w3c.dom.Document appendFormat(org.w3c.dom.Document doc,
                                                      java.lang.String format)
                                               throws javax.xml.xpath.XPathExpressionException

      Add the format (MIME type) of the meta data object to the document
      Parameters:
        `doc` - the document object will be modified
        `format` - the format of the meta data object
      Returns:
        the modfied docment
      Throws:
        `javax.xml.xpath.XPathExpressionException`

    - #### addVersion

          protected org.w3c.dom.Document addVersion(org.w3c.dom.Document doc,
                                                    java.lang.String version)

      Add the version element to the document
      Parameters:
        `doc` - the document object will be modified
        `version` - the value of the version
      Returns:
        the modified document

    - #### appendDescription

          protected org.w3c.dom.Document appendDescription(java.lang.String description,
                                                           org.w3c.dom.Document doc,
                                                           java.lang.String language,
                                                           java.lang.String descriptionType)
                                                    throws javax.xml.xpath.XPathExpressionException

      Append a description to the document. This method can be called multiple times.
      Parameters:
        `description` - the value of the description
        `doc` - the document object will be modified
        `language` - the language is used in the description
        `descriptionType` - the type of the description. It only can be the these options: "Abstract" "Methods" "SeriesInformation" "TableOfContents" "Other"
      Returns:
        the modified document object
      Throws:
        `javax.xml.xpath.XPathExpressionException`

    - #### serializeDoc

          protected java.lang.String serializeDoc(org.w3c.dom.Document doc)

      Serialize the given doc object to a string
      Parameters:
        `doc` -
      Returns:
        the string representation of the document object

    - #### lookupFormat

          public static java.lang.String lookupFormat(org.dataone.service.types.v2.SystemMetadata sysMeta)

      Figure out the format (mime type) of the data object
      Parameters:
        `sysMeta` -
      Returns:

    - #### removeIdSchemePrefix

          protected java.lang.String removeIdSchemePrefix(java.lang.String id,
                                                          java.lang.String scheme)

      Remove the sheme prefix for a given id. For example, it returns 123 for given doi:123 and doi.
      Parameters:
        `id` -
        `scheme` -
      Returns:

Copyright © 2020 Regents of the University of California. All Rights Reserved.