public class Vault
extends java.lang.Object
Any operation on a MatrixStore server must be performed on a specific data store as a specific user. For that, we provide the concept of session. You can open different sessions and thus, perform operations as different users on different data stores, using the same MxsStore object.
Example of usage: How to get a Vault instance.
See MatrixStore
documentation on how to connect to the cluster first.
//credentials and connection created previously. MatrixStore mxs = ... //establish matrixstore connection ... Vault vault = null; try { String vaultId = "2d5fcd11-ff48-4e77-9640-0983c5dfa10c"; vault = mxs.openVault(vaultId); MxsObject obj = vault.createObject(); // ... several operations on object } catch (IOException e) { // ... handle any errors } finally { // Close all the remaining objects if (vault != null) vault.dispose(); }Note: You must dispose a Vault object when you don't need to perform operations on a given MatrixStore server.
Modifier and Type | Class and Description |
---|---|
class |
Vault.VaultInternalContext
Internal purposes only
|
Modifier and Type | Method and Description |
---|---|
void |
addAuditEntry(AuditEntryDescription description)
Adds user audit information to a given vault.
|
MxsObject |
createObject()
Creates a new object without any data nor metadata.
|
MxsObject |
createObject(Attribute[] attributes)
Creates a new object without any data, just metadata.
|
void |
dispose()
Disposes the resources used by this instance.
|
boolean |
exist()
true if and only if this vault exists in MatrixStore |
VaultAttributes |
getAttributes()
Returns a
VaultAttributes object you can use to discover storage capacity. |
Client |
getClient() |
static int |
getErrorCode(java.io.IOException e)
Extracts the API error code embedded in an exception if thrown by this Java API
|
java.lang.String |
getId()
Returns the unique identifier of the vault it is connected to
|
MxsObject |
getObject(java.lang.String id)
Returns a reference to a MatrixStore object.
|
UserCapabilities |
getUserCapabilities()
Returns the user capabilities of this vault
|
boolean |
online()
Tests whether the connection to MatrixStore can be established.
|
java.util.Iterator<AuditEntry> |
searchAudits(long fromMs)
Searches vault for all audit entries for which creation time is newer or equal to given fromMs timestamp.
|
java.util.Iterator<AuditEntry> |
searchAudits(long fromMs,
AuditSearchTerm term)
Searches vault for all audit entries for which creation time is newer or equal to given fromMs timestamp.
|
java.util.Iterator<AuditEntry> |
searchAudits(long fromMs,
long toMs)
Searches vault for all audit entries for which creation time is newer or equal to given fromMs timestamp and lower than toMs timestamp.
|
java.util.Iterator<AuditEntry> |
searchAudits(long fromMs,
long toMs,
AuditSearchTerm term)
Searches vault for all audit entries for which creation time is newer or equal to given fromMs timestamp and lower than toMs timestamp.
|
java.util.Set<java.lang.String> |
searchObjects(Attribute attribute,
int atOnce)
Searches for objects containing a specific metadata attribute.
|
java.util.Set<java.lang.String> |
searchObjects(SearchTerm term,
int atOnce)
Searches for objects matching a metadata search term.
|
java.util.Iterator<java.lang.String> |
searchObjectsIterator(Attribute attribute,
int atOnce)
Searches for objects containing a specific metadata attribute.
|
java.util.Iterator<java.lang.String> |
searchObjectsIterator(SearchTerm term,
int atOnce)
Searches for objects matching a metadata search term.
|
public VaultAttributes getAttributes() throws java.io.IOException
VaultAttributes
object you can use to discover storage capacity.java.io.IOException
public java.lang.String getId()
public MxsObject getObject(java.lang.String id)
id
- object identifier. Pass null if creating a new objectpublic MxsObject createObject() throws java.io.IOException
java.io.IOException
public MxsObject createObject(Attribute[] attributes) throws java.io.IOException
attributes
- Metadata attributes associated to this objectjava.io.IOException
public java.util.Set<java.lang.String> searchObjects(SearchTerm term, int atOnce) throws java.io.IOException
term
- Search termatOnce
- Number of object identifiers cached by Java API on search requests. It specifies the number of id's fetched in one single call to the server.java.io.IOException
public java.util.Set<java.lang.String> searchObjects(Attribute attribute, int atOnce) throws java.io.IOException
attribute
- Metadata attributeatOnce
- Number of object identifiers cached by Java API on search requests. It specifies the number of id's fetched in one single call to the server.java.io.IOException
public java.util.Iterator<java.lang.String> searchObjectsIterator(SearchTerm term, int atOnce) throws java.io.IOException
term
- Search termatOnce
- Number of object identifiers cached by Java API on search requests. It specifies the number of id's fetched in one single call to the server.java.io.IOException
public java.util.Iterator<java.lang.String> searchObjectsIterator(Attribute attribute, int atOnce) throws java.io.IOException
attribute
- Metadata attributeatOnce
- Number of object identifiers cached by Java API on search requests. It specifies the number of id's fetched in one single call to the server.java.io.IOException
public boolean online()
public UserCapabilities getUserCapabilities() throws java.io.IOException
java.io.IOException
- If an I/O error occurs when querying to MatrixStore.public boolean exist() throws java.io.IOException
true
if and only if this vault exists in MatrixStoretrue
if the vault exists in MatrixStorejava.io.IOException
- If an I/O error occurs when querying to MatrixStorepublic void addAuditEntry(AuditEntryDescription description) throws java.io.IOException
Once audit unique ID and a timestamp is assigned to it. Timestamp is a number of milliseconds since Unix epoch (midnight Jan 1st, 1970 UTC) and is taken from the cluster clock.
Cluster should be synchronised with external time source using e.g. NTP protocol.
Audit entries are automatically deleted when vault is deleted .
description
- audit information to be addedjava.io.IOException
- if I/O error occurs when accessing MatrixStorepublic java.util.Iterator<AuditEntry> searchAudits(long fromMs) throws java.io.IOException
fromMs
- number of milliseconds since epoch (standard Unix epoch) marking a starting point for search criteria.AuditEntry
elements. Iterator does not implement remove() operation (throws
UnsupportedOperationException
)java.io.IOException
- if I/O error occurs when accessing MatrixStorepublic java.util.Iterator<AuditEntry> searchAudits(long fromMs, long toMs) throws java.io.IOException
fromMs
- number of milliseconds since epoch (standard Unix epoch) marking a starting point for search criteria.toMs
- number of milliseconds since epoch (standard Unix epoch) marking an end point for search criteria.AuditEntry
elements. Iterator does not implement remove() operation (throws
UnsupportedOperationException
)java.io.IOException
- if I/O error occurs when accessing MatrixStorepublic java.util.Iterator<AuditEntry> searchAudits(long fromMs, AuditSearchTerm term) throws java.io.IOException
fromMs
- number of milliseconds since epoch (standard Unix epoch) marking a starting point for search criteria.term
- filtering search term used to reduce number of results returnedAuditEntry
elements. Iterator does not implement remove() operation (throws
UnsupportedOperationException
)java.io.IOException
- if I/O error occurs when accessing MatrixStorepublic java.util.Iterator<AuditEntry> searchAudits(long fromMs, long toMs, AuditSearchTerm term) throws java.io.IOException
fromMs
- number of milliseconds since epoch (standard Unix epoch) marking a starting point for search criteria.toMs
- number of milliseconds since epoch (standard Unix epoch) marking an end point for search criteria.term
- filtering search term used to reduce number of results returnedAuditEntry
elements. Iterator does not implement remove() operation (throws
UnsupportedOperationException
)java.io.IOException
- if I/O error occurs when accessing MatrixStorepublic Client getClient()
public void dispose()
public static int getErrorCode(java.io.IOException e)
e
- exception