Class AbstractAdminConnection
- java.lang.Object
-
- com.complexible.stardog.api.admin.AbstractAdminConnection
-
- All Implemented Interfaces:
AdminConnection,java.lang.AutoCloseable
- Direct Known Subclasses:
KernelAdminConnection
public abstract class AbstractAdminConnection extends java.lang.Object implements AdminConnection
- Since:
- 5.0
- Version:
- 5.0
- Author:
- Michael Grove
-
-
Field Summary
-
Fields inherited from interface com.complexible.stardog.api.admin.AdminConnection
NO_TIMEOUT
-
-
Constructor Summary
Constructors Constructor Description AbstractAdminConnection(Views<AdminConnection> theViews)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected abstract void_close()protected abstract Metadata_get(java.lang.String theName, java.lang.Iterable<? extends MetaProperty<?>> theOptions)protected abstract <T> java.lang.String_set(java.lang.String theName, MetaProperty<T> theOption, T theValue)<T extends AdminConnection>
Tas(java.lang.Class<T> theView)Return this admin connection viewed as a different type of admin connection.protected voidassertOpen()Assert that the client is currently logged into the Stardog serverprotected voidassertValidName(java.lang.String theName)DatabaseBuilderbuilder(Metadata theOptions)Convenience method to create a database builder with the given options.voidclose()Log out of the Stardog server and close the client.DatabaseBuilderdisk(java.lang.String theName)Create a new builder for creating disk databases<T> Tget(java.lang.String theName, MetaProperty<T> theOption)Gets the value of the specified option in the given database.Metadataget(java.lang.String theName, java.lang.Iterable<? extends MetaProperty<?>> theOptions)Gets the values of the specified options in the given database.booleanisOpen()Return whether or not this connection is open.DatabaseBuildernewDatabase(java.lang.String theName)Create a builder for creating a new database.protected abstract DatabaseBuildernewDatabaseBuilder()java.lang.Stringoffline(java.lang.String theName)Makes the database offline according to the default strategy and default timeout.<T> java.lang.Stringset(java.lang.String theName, MetaProperty<T> theOption, T theValue)Sets the value of the specified option for the database with the given name.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface com.complexible.stardog.api.admin.AdminConnection
backup, backup, backup, backup, backupAll, checkpoint, currentStatus, currentStatus, drop, generateDiagnosticReport, getLogs, getPermissionManager, getProcessManager, getProperty, getQueryManager, getRoleManager, getStoredFunctions, getStoredQueries, getTokenManager, getUserManager, list, offline, online, optimize, optimize, renameDatabase, repair, restore, restore, setProperty, shutdown, verify, whoami
-
-
-
-
Constructor Detail
-
AbstractAdminConnection
public AbstractAdminConnection(Views<AdminConnection> theViews)
-
-
Method Detail
-
_close
protected abstract void _close()
-
newDatabaseBuilder
protected abstract DatabaseBuilder newDatabaseBuilder()
-
_set
protected abstract <T> java.lang.String _set(java.lang.String theName, MetaProperty<T> theOption, T theValue) throws StardogException- Throws:
StardogException
-
_get
protected abstract Metadata _get(java.lang.String theName, java.lang.Iterable<? extends MetaProperty<?>> theOptions) throws StardogException
- Throws:
StardogException
-
disk
public DatabaseBuilder disk(java.lang.String theName) throws StardogException
Create a new builder for creating disk databases- Specified by:
diskin interfaceAdminConnection- Parameters:
theName- the name of the disk database to create- Returns:
- a builder for a disk database
- Throws:
StardogException- if the name of the database is invalid
-
builder
public DatabaseBuilder builder(Metadata theOptions) throws StardogException
Convenience method to create a database builder with the given options. The provided options should include at least two options: the name of the database and the index type.- Specified by:
builderin interfaceAdminConnection- Returns:
- a builder for a database
- Throws:
StardogException- if there was an error while creating the db
-
close
public final void close()
Log out of the Stardog server and close the client.- Specified by:
closein interfaceAdminConnection- Specified by:
closein interfacejava.lang.AutoCloseable
-
as
public final <T extends AdminConnection> T as(java.lang.Class<T> theView) throws StardogException
Return this admin connection viewed as a different type of admin connection.- Specified by:
asin interfaceAdminConnection- Type Parameters:
T- the connection view to return- Parameters:
theView- the type of connection to view this object as- Returns:
- the new view of the connection.
- Throws:
StardogException- if the connection cannot be viewed as the provided type. This could be from the parent connection having been closed or it does not support the provided view.
-
isOpen
public final boolean isOpen()
Return whether or not this connection is open.- Specified by:
isOpenin interfaceAdminConnection- Returns:
- true if it is open, false otherwise
-
newDatabase
public final DatabaseBuilder newDatabase(java.lang.String theName) throws StardogException
Create a builder for creating a new database.- Specified by:
newDatabasein interfaceAdminConnection- Parameters:
theName- the name of the database to create- Returns:
- a builder for a database
- Throws:
StardogException- if the name of the database is invalid
-
get
public <T> T get(java.lang.String theName, MetaProperty<T> theOption) throws StardogExceptionGets the value of the specified option in the given database. The function will returnnullif the option is NOT aknown Stardog options, or if it is NOTreadable. The function may also returnnullif the option is set tonullvalue for the database. To differentiate these cases,AdminConnection.get(String, Iterable)function can be used instead. This function will throw an exception if the user does not have read access to the database metadata.- Specified by:
getin interfaceAdminConnection- Type Parameters:
T- type of the option value- Parameters:
theName- name of the databasetheOption- the option to get- Returns:
- current value of the option in the database or
nullas explained above - Throws:
StardogException- if there was an error while getting the value
-
get
public final Metadata get(java.lang.String theName, java.lang.Iterable<? extends MetaProperty<?>> theOptions) throws StardogException
Gets the values of the specified options in the given database. The returned map is not guaranteed tocontainall the specified options. Only the values forknown Stardog optionsthat are should bereadablewill be contained in the result. This function will throw an exception if the user does not have read access to the database metadata.- Specified by:
getin interfaceAdminConnection- Parameters:
theName- database nametheOptions- options for which values will be retrieved- Returns:
- metadata that contains values for the specified met properties
- Throws:
StardogException- if an error occurs while retrieving option values
-
set
public final <T> java.lang.String set(java.lang.String theName, MetaProperty<T> theOption, T theValue) throws StardogExceptionSets the value of the specified option for the database with the given name. For this function to complete without an exception, the logged in user should have write access to the database metadata for the specified database, the option should be aknown Stardog option, the provided value should bevalid, and either the option should bewritable onlineor it should bewritableand the database should NOT beonline.- Specified by:
setin interfaceAdminConnection- Type Parameters:
T- type of the option value- Parameters:
theName- name of the databasetheOption- option to settheValue- option value- Throws:
StardogException- if an error occurs trying to set the option value
-
offline
public java.lang.String offline(java.lang.String theName) throws StardogExceptionMakes the database offline according to the default strategy and default timeout. Offline databases cannot be queried or updated and will be inaccessible to users.- Specified by:
offlinein interfaceAdminConnection- Returns:
- the server output of offline
- Throws:
StardogException
-
assertOpen
protected void assertOpen()
Assert that the client is currently logged into the Stardog server- Throws:
java.lang.IllegalStateException- if the client is not connected
-
assertValidName
protected void assertValidName(java.lang.String theName) throws StardogException- Throws:
StardogException
-
-