Package edu.ucsb.nceas.metacat.dataone
Class SystemMetadataFactory
java.lang.Object
edu.ucsb.nceas.metacat.dataone.SystemMetadataFactory
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic org.dataone.service.types.v2.SystemMetadata
createSystemMetadata
(String localId) Creates a system metadata object for insertion into metacatprotected static org.dataone.service.types.v1.ReplicationPolicy
Create a default ReplicationPolicy by reading properties from metacat's configuration and using those defaults.getDocumentInfoMap
(String docid) Get the document information in the format of a map.static long
Find the size (in bytes) of a stream.
-
Field Details
-
RESOURCE_MAP_PREFIX
- See Also:
-
-
Constructor Details
-
SystemMetadataFactory
public SystemMetadataFactory()
-
-
Method Details
-
createSystemMetadata
public static org.dataone.service.types.v2.SystemMetadata createSystemMetadata(String localId) throws McdbException, McdbDocNotFoundException, SQLException, IOException, AccessionNumberException, ClassNotFoundException, InsufficientKarmaException, edu.ucsb.nceas.utilities.ParseLSIDException, edu.ucsb.nceas.utilities.PropertyNotFoundException, org.dataone.service.exceptions.BaseException, NoSuchAlgorithmException, org.dataone.exceptions.MarshallingException, AccessControlException, HandlerException, 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- Returns:
- sysMeta The system metadata object created
- Throws:
McdbException
McdbDocNotFoundException
SQLException
IOException
AccessionNumberException
ClassNotFoundException
InsufficientKarmaException
edu.ucsb.nceas.utilities.ParseLSIDException
edu.ucsb.nceas.utilities.PropertyNotFoundException
org.dataone.service.exceptions.BaseException
NoSuchAlgorithmException
org.dataone.exceptions.MarshallingException
AccessControlException
HandlerException
SAXException
AccessException
-
sizeOfStream
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:
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
-
getDocumentInfoMap
public static Hashtable<String,String> getDocumentInfoMap(String docid) throws HandlerException, AccessControlException, org.dataone.exceptions.MarshallingException, IOException, McdbException, SAXException Get the document information in the format of a map.- Parameters:
docid
- the id of the document- Returns:
- a map containing the document information
- Throws:
HandlerException
AccessControlException
org.dataone.exceptions.MarshallingException
IOException
McdbException
SAXException
-