public class MatrixStore
extends java.lang.Object
Example of usage: how to connect to a MatrixStore Vault.
// prepare credentials used to authenticate user String username = "john.smith"; char[] password = "Pa55W0rD".toCharArray(); Credentials cred = Credentials.newUsernamePasswordCredentials(username, password); String[] clusterHosts = new String[]{"10.0.20.101", "10.0.20.102", "10.0.20.103"}; MatrixStoreConnection conn = MatrixStoreConnection.builder().withHosts(clusterHosts).build(); MatrixStore mxs = MatrixStore.builder().withConnection(conn).withCredentials(cred).build(); String vaultId = "2d5fcd11-ff48-4e77-9640-0983c5dfa10c"; Vault vault = mxs.openVault(vaultId); try{ // // Multiple operations using the vault object // }catch(IOException e){ // Handle exceptions }finally{ // Free up resources vault.dispose(); mxs.dispose(); conn.close(); }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 |
MatrixStore.MatrixStoreContext |
Constructor and Description |
---|
MatrixStore()
Deprecated.
|
Modifier and Type | Method and Description |
---|---|
static MatrixStoreBuilder |
builder() |
void |
closeConnection()
Logout and close MatrixStore connection used to create this instance.
|
void |
dispose()
Disposes of this MatrixStore instance and logs out.
|
ClusterAttributesView |
getClusterAttributesView()
Returns a
ClusterAttributesView object that can be used to discover
information about the cluster such as name and Id. |
long |
getClusterTime()
Returns current time on the cluster (number of milliseconds since epoch UTC)
|
MatrixStoreConnection |
getConnection()
Returns object representing connection to a cluster or null if connection has been closed
|
IdentityManagement |
getIdentityManagement()
Returns an
IdentityManagement service that can be used to discover
the current user's privileges, user information and change their password. |
java.util.Iterator<VaultInfo> |
listVaults()
Returns an
Iterator of VaultInfo objects, one for each
vault in the space. |
Vault |
openVault(java.lang.String vaultId)
Provides access to a vault with a given ID.
|
static Vault |
openVault(UserInfo info)
Deprecated.
|
@Deprecated public MatrixStore()
MatrixStore
instance.public static MatrixStoreBuilder builder()
@Deprecated public static Vault openVault(UserInfo info)
info
- User credentials and connection detailspublic Vault openVault(java.lang.String vaultId) throws java.io.IOException
vaultId
- ID of a vault to openjava.lang.IllegalArgumentException
- if given vault ID was null or empty.java.io.IOException
public java.util.Iterator<VaultInfo> listVaults() throws java.io.IOException
Iterator
of VaultInfo
objects, one for each
vault in the space. This can be used to discover Ids and names of vaults.java.io.IOException
public IdentityManagement getIdentityManagement()
IdentityManagement
service that can be used to discover
the current user's privileges, user information and change their password.public ClusterAttributesView getClusterAttributesView()
ClusterAttributesView
object that can be used to discover
information about the cluster such as name and Id.public long getClusterTime() throws java.io.IOException
java.io.IOException
- if operation have failed e.g. network problempublic void dispose()
public void closeConnection()
public MatrixStoreConnection getConnection()