Class DataCiteMetadataFactory

java.lang.Object
edu.ucsb.nceas.metacat.doi.datacite.DataCiteMetadataFactory
Direct Known Subclasses:
DefaultDataCiteFactory, EML2DataCiteFactory

public abstract class DataCiteMetadataFactory extends 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 Details

  • Constructor Details

    • DataCiteMetadataFactory

      public DataCiteMetadataFactory()
  • Method Details

    • generateMetadata

      public abstract 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(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 Document generateROOTDoc() throws Exception
      Generate the blank DOM document for the datacite name space
      Returns:
      Throws:
      Exception
    • addIdentifier

      protected Document addIdentifier(Document doc, String identifier, 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 Document appendCreator(String creatorName, Document doc, String affiliation, String nameIdentifier, String nameIdentifierSchemeURI, String nameIdentifierScheme) throws 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:
      XPathExpressionException
    • appendTitle

      public Document appendTitle(String title, Document doc, String language) throws 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:
      XPathExpressionException
    • addPublisher

      protected Document addPublisher(Document doc, 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 Document addPublicationYear(Document doc, 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 Document appendSubject(String subject, Document doc, String language) throws 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:
      XPathExpressionException
    • addLanguage

      protected Document addLanguage(Document doc, 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 Document addResourceType(Document doc, String resourceTypeGeneral, 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 Document appendFormat(Document doc, String format) throws 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:
      XPathExpressionException
    • addVersion

      protected Document addVersion(Document doc, 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 Document appendDescription(String description, Document doc, String language, String descriptionType) throws 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:
      XPathExpressionException
    • serializeDoc

      protected String serializeDoc(Document doc)
      Serialize the given doc object to a string
      Parameters:
      doc -
      Returns:
      the string representation of the document object
    • lookupFormat

      public static String lookupFormat(org.dataone.service.types.v2.SystemMetadata sysMeta)
      Figure out the format (mime type) of the data object
      Parameters:
      sysMeta -
      Returns:
    • removeIdSchemePrefix

      protected String removeIdSchemePrefix(String id, 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: