edu.ucsb.nceas.metacat.dataone

## Class SystemMetadataFactory

- java.lang.Object
- - edu.ucsb.nceas.metacat.dataone.SystemMetadataFactory

-     public class SystemMetadataFactory
      extends java.lang.Object

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static java.lang.String` | `RESOURCE_MAP_PREFIX`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `SystemMetadataFactory()`

  - ### Method Summary

    All Methods Static Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `static org.dataone.service.types.v2.SystemMetadata` | `createSystemMetadata(boolean indexDataFile, java.lang.String localId, boolean includeORE, boolean downloadData)` Creates a system metadata object for insertion into metacat
    `static org.dataone.service.types.v2.SystemMetadata` | `createSystemMetadata(java.lang.String localId, boolean includeORE, boolean downloadData)` Create a system metadata object for insertion into metacat
    `static void` | `generateSystemMetadata(java.util.List<java.lang.String> idList, boolean includeOre, boolean downloadData)` Generate SystemMetadata for any object in the object store that does not already have it.
    `protected static org.dataone.service.types.v1.ReplicationPolicy` | `getDefaultReplicationPolicy()` Create a default ReplicationPolicy by reading properties from metacat's configuration and using those defaults.
    `static boolean` | `oreExistsFor(org.dataone.service.types.v1.Identifier identifier)` Checks for potential ORE object existence
    `static long` | `sizeOfStream(java.io.InputStream is)` Find the size (in bytes) of a stream.

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

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

- - ### Field Detail

    - #### RESOURCE_MAP_PREFIX

          public static final java.lang.String RESOURCE_MAP_PREFIX

      See Also:
        Constant Field Values

  - ### Constructor Detail

    - #### SystemMetadataFactory

          public SystemMetadataFactory()

  - ### Method Detail

    - #### createSystemMetadata

          public static org.dataone.service.types.v2.SystemMetadata createSystemMetadata(java.lang.String localId,
                                                                                         boolean includeORE,
                                                                                         boolean downloadData)
                                                                                  throws McdbException,
                                                                                         McdbDocNotFoundException,
                                                                                         java.sql.SQLException,
                                                                                         java.io.IOException,
                                                                                         AccessionNumberException,
                                                                                         java.lang.ClassNotFoundException,
                                                                                         InsufficientKarmaException,
                                                                                         edu.ucsb.nceas.utilities.ParseLSIDException,
                                                                                         edu.ucsb.nceas.utilities.PropertyNotFoundException,
                                                                                         org.dataone.service.exceptions.BaseException,
                                                                                         java.security.NoSuchAlgorithmException,
                                                                                         org.dataone.exceptions.MarshallingException,
                                                                                         AccessControlException,
                                                                                         HandlerException,
                                                                                         org.xml.sax.SAXException,
                                                                                         AccessException

      Create a system metadata object for insertion into metacat
      Parameters:
        `localId` -
        `includeORE` -
        `downloadData` -
      Returns:
      Throws:
        `McdbException`
        `McdbDocNotFoundException`
        `java.sql.SQLException`
        `java.io.IOException`
        `AccessionNumberException`
        `java.lang.ClassNotFoundException`
        `InsufficientKarmaException`
        `edu.ucsb.nceas.utilities.ParseLSIDException`
        `edu.ucsb.nceas.utilities.PropertyNotFoundException`
        `org.dataone.service.exceptions.BaseException`
        `java.security.NoSuchAlgorithmException`
        `org.dataone.exceptions.MarshallingException`
        `AccessControlException`
        `HandlerException`
        `org.xml.sax.SAXException`
        `AccessException`

    - #### createSystemMetadata

          public static org.dataone.service.types.v2.SystemMetadata createSystemMetadata(boolean indexDataFile,
                                                                                         java.lang.String localId,
                                                                                         boolean includeORE,
                                                                                         boolean downloadData)
                                                                                  throws McdbException,
                                                                                         McdbDocNotFoundException,
                                                                                         java.sql.SQLException,
                                                                                         java.io.IOException,
                                                                                         AccessionNumberException,
                                                                                         java.lang.ClassNotFoundException,
                                                                                         InsufficientKarmaException,
                                                                                         edu.ucsb.nceas.utilities.ParseLSIDException,
                                                                                         edu.ucsb.nceas.utilities.PropertyNotFoundException,
                                                                                         org.dataone.service.exceptions.BaseException,
                                                                                         java.security.NoSuchAlgorithmException,
                                                                                         org.dataone.exceptions.MarshallingException,
                                                                                         AccessControlException,
                                                                                         HandlerException,
                                                                                         org.xml.sax.SAXException,
                                                                                         AccessException

      Creates a system metadata object for insertion into metacat
      Parameters:
        `indexDataFile` - Indicate if we need to index data file.
        `localId` - The local document identifier
        `user` - The user submitting the system metadata document
        `groups` - The groups the user belongs to
      Returns:
        sysMeta The system metadata object created
      Throws:
        `org.xml.sax.SAXException`
        `HandlerException`
        `AccessControlException`
        `AccessException`
        `McdbException`
        `McdbDocNotFoundException`
        `java.sql.SQLException`
        `java.io.IOException`
        `AccessionNumberException`
        `java.lang.ClassNotFoundException`
        `InsufficientKarmaException`
        `edu.ucsb.nceas.utilities.ParseLSIDException`
        `edu.ucsb.nceas.utilities.PropertyNotFoundException`
        `org.dataone.service.exceptions.BaseException`
        `java.security.NoSuchAlgorithmException`
        `org.dataone.exceptions.MarshallingException`

    - #### oreExistsFor

          public static boolean oreExistsFor(org.dataone.service.types.v1.Identifier identifier)

      Checks for potential ORE object existence
      Parameters:
        `identifier` -
      Returns:

    - #### generateSystemMetadata

          public static void generateSystemMetadata(java.util.List<java.lang.String> idList,
                                                    boolean includeOre,
                                                    boolean downloadData)
                                             throws edu.ucsb.nceas.utilities.PropertyNotFoundException,
                                                    java.security.NoSuchAlgorithmException,
                                                    AccessionNumberException,
                                                    java.sql.SQLException,
                                                    AccessControlException,
                                                    AccessException,
                                                    McdbException,
                                                    java.io.IOException,
                                                    java.lang.ClassNotFoundException,
                                                    InsufficientKarmaException,
                                                    edu.ucsb.nceas.utilities.ParseLSIDException,
                                                    org.dataone.service.exceptions.BaseException,
                                                    org.dataone.exceptions.MarshallingException,
                                                    HandlerException,
                                                    org.xml.sax.SAXException

      Generate SystemMetadata for any object in the object store that does not already have it. SystemMetadata documents themselves, are, of course, exempt. This is a utility method for migration of existing object stores to DataONE where SystemMetadata is required for all objects.
      Parameters:
        `idList` -
        `includeOre` -
        `downloadData` -
      Throws:
        `edu.ucsb.nceas.utilities.PropertyNotFoundException`
        `java.security.NoSuchAlgorithmException`
        `AccessionNumberException`
        `java.sql.SQLException`
        `org.xml.sax.SAXException`
        `HandlerException`
        `org.dataone.exceptions.MarshallingException`
        `org.dataone.service.exceptions.BaseException`
        `edu.ucsb.nceas.utilities.ParseLSIDException`
        `InsufficientKarmaException`
        `java.lang.ClassNotFoundException`
        `java.io.IOException`
        `McdbException`
        `AccessException`
        `AccessControlException`

    - #### sizeOfStream

          public static long sizeOfStream(java.io.InputStream is)
                                   throws java.io.IOException

      Find the size (in bytes) of a stream. Note: This needs to refactored out of MetacatHandler and into a utility when stream i/o in Metacat is evaluated.
      Parameters:
        `is` - The InputStream of bytes
      Returns:
        size The size in bytes of the input stream as a long
      Throws:
        `java.io.IOException`

    - #### getDefaultReplicationPolicy

          protected static org.dataone.service.types.v1.ReplicationPolicy getDefaultReplicationPolicy()

      Create a default ReplicationPolicy by reading properties from metacat's configuration and using those defaults. If the numReplicas property is not found, malformed, or less than or equal to zero, no policy needs to be set, so return null.
      Returns:
        ReplicationPolicy, or null if no replication policy is needed

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