public final class Repository
extends java.lang.Object
Modifier and Type | Method and Description |
---|---|
static void |
checkRemainingTemporaryIDs(java.util.List<PDRObject> objects)
Tests if any PDR object in the provided list contains one or more
temporary ID.
|
static void |
deleteIDRange(PDRType type,
int instance,
int project,
int lowerBound,
int upperBound)
Purges objects of the provided range from the repository.
|
static java.util.List<java.lang.String> |
getModifiedObjects(int instance,
int project,
java.lang.String timestamp)
Returns all PDR objects of the given project which were modified since the
provided timestamp.
|
static java.util.List<java.lang.String> |
getObjects(PDRType type,
int instance,
int project,
int lowerBound,
int upperBound)
Returns all PDR objects of the given type and ID range.
|
static java.util.List<IDRange> |
getOccupiedObjectIDRanges(PDRType type,
int instance,
int project,
int lowerBound,
int upperBound)
Returns a list of occupied ID ranges in the repository.
|
static java.util.Map<java.lang.Integer,java.lang.Integer> |
getProjectSizes()
Returns a map of existing project IDs and the current number of their
objects.
|
static java.lang.String |
getTime()
Returns current timestamp from PaDRe server.
|
static Identifier |
getUserID(java.lang.String username,
int project)
Returns the PDR user ID of an user identified by username and project number.
|
static java.util.Map<Identifier,Identifier> |
ingestObjects(int instance,
int project,
java.util.List<java.lang.String> objects)
Ingests provided new PDR objects (with temporary IDs) into the repository and
returns a map from temporary to persistent IDs.
|
static java.util.List<java.lang.String> |
modifyObjects(int instance,
int project,
java.util.List<java.lang.String> objects,
boolean forceOverwrite)
Tries to store modified PDR object in the repository.
|
static boolean |
tryLockIndex()
Tries to lock the index component of the repository.
|
static boolean |
trylockStorage()
Tries to lock the storage component of the repository.
|
static boolean |
tryLockStorageAndIndex()
Tries to lock both storage, and index component of the repository.
|
static void |
unlockIndex()
Tries to unlock the index component of the repository.
|
static void |
unlockStorage()
Tries to unlock the storage component of the repository.
|
static void |
unlockStorageAndIndex()
Tries to unlock both index, and storage component of the repository.
|
public static void deleteIDRange(PDRType type, int instance, int project, int lowerBound, int upperBound) throws RepositoryException
type
- PDR type.instance
- Instance ID.project
- Project ID.lowerBound
- Lower bound.upperBound
- Upper bound.RepositoryException
- Could not delete provided range.public static java.util.List<java.lang.String> getModifiedObjects(int instance, int project, java.lang.String timestamp) throws RepositoryException
instance
- Instance ID.project
- Project ID.timestamp
- Timestamp.RepositoryException
- Could not get modified objects.public static java.util.List<java.lang.String> getObjects(PDRType type, int instance, int project, int lowerBound, int upperBound) throws RepositoryException
type
- PDR type.instance
- Instance ID.project
- Project ID.lowerBound
- Lower bound.upperBound
- Upper bound.RepositoryException
- Could not get objects.public static java.util.List<IDRange> getOccupiedObjectIDRanges(PDRType type, int instance, int project, int lowerBound, int upperBound) throws RepositoryException
type
- PDR type.instance
- Instance ID.project
- Project ID.lowerBound
- Lower bound.upperBound
- Upper bound.RepositoryException
- Could not get ranges.public static java.util.Map<java.lang.Integer,java.lang.Integer> getProjectSizes() throws RepositoryException
RepositoryException
- Could not get project sizes.public static java.lang.String getTime() throws RepositoryException
RepositoryException
- Communication failed.public static Identifier getUserID(java.lang.String username, int project) throws RepositoryException
username
- Username which is linked to the returned PDR user ID.project
- Number of user's project.RepositoryException
- Communication failed.public static java.util.Map<Identifier,Identifier> ingestObjects(int instance, int project, java.util.List<java.lang.String> objects) throws RepositoryException
instance
- Instance ID.project
- Project ID.objects
- PDR Objects to be inserted into the repository.RepositoryException
- Problems while interacting with repository.public static java.util.List<java.lang.String> modifyObjects(int instance, int project, java.util.List<java.lang.String> objects, boolean forceOverwrite) throws RepositoryException
instance
- Instance ID.project
- Project ID.objects
- Modified objects.forceOverwrite
- If set to true
all objects will be overwritten, regardless of any conflict.RepositoryException
- Modification of provided objects failed.public static boolean tryLockIndex() throws RepositoryException
RepositoryException
- Could not lock index.public static boolean trylockStorage() throws RepositoryException
RepositoryException
- Could not lock repository.public static boolean tryLockStorageAndIndex() throws RepositoryException
RepositoryException
- Could not lock index and storage.public static void unlockIndex()
public static void unlockStorage()
public static void unlockStorageAndIndex()
public static void checkRemainingTemporaryIDs(java.util.List<PDRObject> objects) throws RepositoryException
objects
- PDR objects.RepositoryException
- Temporary ID has been found.