public class IdentifierManager
extends java.lang.Object
| Modifier and Type | Field and Description |
|---|---|
static java.lang.String |
TYPE_IDENTIFIER |
static java.lang.String |
TYPE_SYSTEM_METADATA |
| Modifier and Type | Method and Description |
|---|---|
java.util.List<org.dataone.service.types.v1.Permission> |
convertPermission(int permission) |
int |
convertPermission(org.dataone.service.types.v1.Permission permission) |
void |
createMapping(java.lang.String guid,
java.lang.String localId)
create a mapping in the identifier table
|
boolean |
deleteSystemMetadata(java.lang.String guid) |
boolean |
existsInXmlLRevisionTable(java.lang.String docid,
int rev)
IF the given localId exists on the xml_revisions table
|
java.lang.String |
generateLocalId(java.lang.String guid,
int rev) |
java.lang.String |
generateLocalId(java.lang.String guid,
int rev,
boolean isSystemMetadata)
Given a global identifier (guid), create a suitable local identifier that
follows Metacat's docid semantics and format (scope.id.rev), and create
a mapping between these two identifiers.
|
org.dataone.service.types.v1.AccessPolicy |
getAccessPolicy(java.lang.String guid)
Lookup access policy from Metacat
|
java.util.List<java.lang.String> |
getAllLocalIds()
return a listing of all local ids in the object store
|
java.util.List<java.lang.String> |
getAllSystemMetadataGUIDs()
return a listing of all guids in the object store
|
java.lang.String |
getGUID(java.lang.String docid,
int rev)
given a local identifer, look up the guid.
|
org.dataone.service.types.v1.Identifier |
getHeadPID(org.dataone.service.types.v1.Identifier sid)
Get the pid of the head (current) version of objects match the specified sid.
|
static IdentifierManager |
getInstance()
Return the single instance of the manager after initializing it if it
wasn't previously initialized.
|
java.util.Date |
getLastModifiedDate()
returns a list of system metadata-only guids since the given date
|
int |
getLatestRevForLocalId(java.lang.String localId)
return the newest rev for a given localId
|
java.lang.String |
getLocalId(java.lang.String guid)
Lookup a localId given the GUID.
|
java.util.List<java.lang.String> |
getLocalIdsWithNoSystemMetadata(boolean includeRevisions,
int serverLocation)
return all local ids in the object store that do not have associated
system metadata
|
java.lang.String |
getObjectFilePath(java.lang.String localId,
boolean isScienceMetadata)
Get the the file path for the given object local id
|
org.dataone.service.types.v2.SystemMetadata |
getSystemMetadata(java.lang.String guid)
return a hash of all of the info that is in the systemmetadata table
|
java.util.List<java.lang.String> |
getUpdatedSystemMetadataIds(java.util.Date since)
returns a list of system metadata-only guids since the given date
|
boolean |
identifierExists(java.lang.String guid)
Determine if an identifier exists already, returning true if so.
|
void |
insertOrUpdateSystemMetadata(org.dataone.service.types.v2.SystemMetadata sysmeta)
creates a system metadata mapping and adds additional fields from sysmeta
to the table for quick searching.
|
boolean |
mappingExists(java.lang.String guid)
Determine if an identifier mapping exists already,
returning true if so.
|
boolean |
objectFileExists(java.lang.String localId,
boolean isScienceMetadata)
Determine if the object file exist for the given localId.
|
org.dataone.service.types.v1.ObjectList |
querySystemMetadata(java.util.Date startTime,
java.util.Date endTime,
org.dataone.service.types.v1.ObjectFormatIdentifier objectFormatId,
org.dataone.service.types.v1.NodeReference nodeId,
int start,
int count,
org.dataone.service.types.v1.Identifier identifier,
boolean isSID)
query the systemmetadata table based on the given parameters
|
void |
removeMapping(java.lang.String guid,
java.lang.String localId)
remove a mapping in the identifier table
|
boolean |
systemMetadataPIDExists(org.dataone.service.types.v1.Identifier pid)
Determine if the specified identifier object exists or not.
|
boolean |
systemMetadataPIDExists(java.lang.String guid) |
boolean |
systemMetadataSIDExists(org.dataone.service.types.v1.Identifier sid)
Check if the specified sid object exists on the serial id field on the system metadata table
|
boolean |
systemMetadataSIDExists(java.lang.String sid)
Check if the specified sid exists on the serial id field on the system metadata table
|
void |
updateAuthoritativeMemberNodeId(java.lang.String existingMemberNodeId,
java.lang.String newMemberNodeId) |
void |
updateMapping(java.lang.String guid,
java.lang.String localId)
update a mapping
|
void |
updateSystemMetadata(org.dataone.service.types.v2.SystemMetadata sm,
DBConnection dbConn)
Insert the system metadata fields into the db
|
public static final java.lang.String TYPE_SYSTEM_METADATA
public static final java.lang.String TYPE_IDENTIFIER
public static IdentifierManager getInstance()
public org.dataone.service.types.v2.SystemMetadata getSystemMetadata(java.lang.String guid)
throws McdbDocNotFoundException
guid - McdbDocNotFoundExceptionpublic int getLatestRevForLocalId(java.lang.String localId)
throws McdbDocNotFoundException
localId - McdbDocNotFoundExceptionpublic java.util.List<java.lang.String> getLocalIdsWithNoSystemMetadata(boolean includeRevisions,
int serverLocation)
public java.util.List<java.lang.String> getAllLocalIds()
public java.util.List<java.lang.String> getAllSystemMetadataGUIDs()
public java.util.List<java.lang.String> getUpdatedSystemMetadataIds(java.util.Date since)
throws java.lang.Exception
java.lang.Exceptionpublic java.util.Date getLastModifiedDate()
throws java.lang.Exception
java.lang.Exceptionpublic boolean identifierExists(java.lang.String guid)
throws java.sql.SQLException
guid - the global identifier to look upjava.sql.SQLExceptionpublic boolean mappingExists(java.lang.String guid)
throws java.sql.SQLException
guid - the global identifier to look upjava.sql.SQLExceptionpublic java.lang.String generateLocalId(java.lang.String guid,
int rev)
guid - rev - public java.lang.String generateLocalId(java.lang.String guid,
int rev,
boolean isSystemMetadata)
guid - the global string identifierrev - the revision number to be used in the localIdpublic java.lang.String getGUID(java.lang.String docid,
int rev)
throws McdbDocNotFoundException
docid - the docid to look uprev - the revision of the docid to look upMcdbDocNotFoundException - if the docid, rev is not foundpublic org.dataone.service.types.v1.Identifier getHeadPID(org.dataone.service.types.v1.Identifier sid)
throws java.sql.SQLException
sid - specified sid which should match.java.sql.SQLExceptionpublic boolean systemMetadataSIDExists(org.dataone.service.types.v1.Identifier sid)
throws java.sql.SQLException
sid - java.sql.SQLExceptionpublic boolean systemMetadataSIDExists(java.lang.String sid)
throws java.sql.SQLException
id - java.sql.SQLExceptionpublic boolean systemMetadataPIDExists(org.dataone.service.types.v1.Identifier pid)
throws java.sql.SQLException
pid - - the specified identifierjava.sql.SQLExceptionjava.lang.NullPointerExceptionpublic boolean systemMetadataPIDExists(java.lang.String guid)
throws java.sql.SQLException
java.sql.SQLExceptionpublic void insertOrUpdateSystemMetadata(org.dataone.service.types.v2.SystemMetadata sysmeta)
throws McdbDocNotFoundException,
java.sql.SQLException,
org.dataone.service.exceptions.InvalidSystemMetadata
guid - the id to insertlocalId - the systemMetadata object to get the local id forMcdbDocNotFoundExceptionjava.sql.SQLExceptionorg.dataone.service.exceptions.InvalidSystemMetadatapublic void updateMapping(java.lang.String guid,
java.lang.String localId)
guid - localId - public void updateSystemMetadata(org.dataone.service.types.v2.SystemMetadata sm,
DBConnection dbConn)
throws McdbDocNotFoundException,
java.sql.SQLException,
org.dataone.service.exceptions.InvalidSystemMetadata,
AccessException
sm - McdbDocNotFoundExceptionjava.sql.SQLExceptionorg.dataone.service.exceptions.InvalidSystemMetadataAccessExceptionpublic org.dataone.service.types.v1.AccessPolicy getAccessPolicy(java.lang.String guid)
throws McdbDocNotFoundException,
AccessException
guid - McdbDocNotFoundExceptionAccessExceptionpublic int convertPermission(org.dataone.service.types.v1.Permission permission)
public java.util.List<org.dataone.service.types.v1.Permission> convertPermission(int permission)
public java.lang.String getLocalId(java.lang.String guid)
throws McdbDocNotFoundException,
java.sql.SQLException
guid - the global identifier to look upMcdbDocNotFoundException - if the identifier is not foundjava.sql.SQLExceptionpublic org.dataone.service.types.v1.ObjectList querySystemMetadata(java.util.Date startTime,
java.util.Date endTime,
org.dataone.service.types.v1.ObjectFormatIdentifier objectFormatId,
org.dataone.service.types.v1.NodeReference nodeId,
int start,
int count,
org.dataone.service.types.v1.Identifier identifier,
boolean isSID)
throws java.sql.SQLException,
edu.ucsb.nceas.utilities.PropertyNotFoundException,
ServiceException
startTime - endTime - objectFormat - nodeId - start - count - java.sql.SQLExceptionServiceExceptionedu.ucsb.nceas.utilities.PropertyNotFoundExceptionpublic void createMapping(java.lang.String guid,
java.lang.String localId)
guid - localId - public void removeMapping(java.lang.String guid,
java.lang.String localId)
guid - localId - public boolean deleteSystemMetadata(java.lang.String guid)
public void updateAuthoritativeMemberNodeId(java.lang.String existingMemberNodeId,
java.lang.String newMemberNodeId)
public boolean objectFileExists(java.lang.String localId,
boolean isScienceMetadata)
throws edu.ucsb.nceas.utilities.PropertyNotFoundException
localId - isScienceMetadata - edu.ucsb.nceas.utilities.PropertyNotFoundExceptionpublic java.lang.String getObjectFilePath(java.lang.String localId,
boolean isScienceMetadata)
throws edu.ucsb.nceas.utilities.PropertyNotFoundException
localId - isScienceMetadata - edu.ucsb.nceas.utilities.PropertyNotFoundExceptionpublic boolean existsInXmlLRevisionTable(java.lang.String docid,
int rev)
throws java.sql.SQLException
localId - java.sql.SQLExceptionCopyright © 2017 Regents of the University of California. All Rights Reserved.