Package com.c8db.internal
Class C8DBImpl
- java.lang.Object
-
- com.c8db.internal.C8Executeable<E>
-
- com.c8db.internal.InternalC8DB<C8ExecutorSync>
-
- com.c8db.internal.C8DBImpl
-
- All Implemented Interfaces:
C8DB,C8SerializationAccessor
public class C8DBImpl extends InternalC8DB<C8ExecutorSync> implements C8DB
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface com.c8db.C8DB
C8DB.Builder
-
-
Field Summary
-
Fields inherited from class com.c8db.internal.InternalC8DB
PATH_ALERT, PATH_API_USER
-
Fields inherited from class com.c8db.internal.C8Executeable
context, executor, util
-
-
Constructor Summary
Constructors Constructor Description C8DBImpl(VstCommunicationSync.Builder vstBuilder, HttpCommunication.Builder httpBuilder, C8SerializationFactory util, Protocol protocol, HostResolver hostResolver, C8Context context)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description C8DBImpl_setCursorInitializer(C8CursorInitializer cursorInitializer)Attention: Please do not use!AlertEntitycreateAlerts(AlertEntity entity)Creates an AlertBooleancreateGeoFabric(String tenant, String name, String spotDc, String dcList, String geoFabric)Creates a new database with the given name.UserEntitycreateUser(String user, String passwd)Create a new user.UserEntitycreateUser(String user, String passwd, UserCreateOptions options)Create a new user.C8Databasedb()Returns aArangoDatabaseinstance for the_systemdatabase.C8Databasedb(String tenant, String name)Returns aArangoDatabaseinstance for the given database name and tenant.C8Databasedb(String tenant, String name, String spotDc, String dcList)Returns aArangoDatabaseinstance for the given database name.C8Databasedb(String tenant, String name, Map<String,String> headerParams)Returns aArangoDatabaseinstance for the given database name and tenant.voiddeleteUser(String user)Removes an existing user, identified by user.Responseexecute(Request request)Generic Execute.Responseexecute(Request request, HostHandle hostHandle)Generic Execute.protected C8ExecutorSyncexecutor()Collection<String>getAccessibleGeoFabrics()Retrieves a list of all databases the current user can accessCollection<String>getAccessibleGeoFabricsFor(String user)List available database to the specified userCollection<AlertEntity>getAlerts(Map<String,String> queryParamMap)Gets AlertsList<DcInfoEntity>getAllEdgeLocations()Return a list of all Edge Locations (AKA Datacenters) deployed in the Macrometa Fabric.DcInfoEntitygetEdgeLocation(String dcName)Fetches data about the specified Edge Location.List<DataCenterEntity>getEdgeLocations(String tenant)Edge LocationsGeoFabricEntitygetGeoFabricInformation(String tenant, String name)Collection<String>getGeoFabrics()Retrieves a list of all existing databasesDcInfoEntitygetLocalEdgeLocation()List details of Local Edge LocationLogLevelEntitygetLogLevel()Returns the server's current loglevel settings.LogEntitygetLogs(LogOptions options)Returns fatal, error, warning or info log messages from the server's global log.ServerRolegetRole()Returns the server role.UserEntitygetUser(String user)Fetches data about the specified user.UserEntitygetUser(String user, String tenant)Fetches data about the specified user for a given tenant.Collection<UserEntity>getUsers()Fetches data about all users.C8DBVersiongetVersion()Returns the server name and version number.voidgrantDefaultCollectionAccess(String user, Permissions permissions)Sets the default access level for collections for the useruser.voidgrantDefaultDatabaseAccess(String user, Permissions permissions)Sets the default access level for databases for the useruser.UserEntityreplaceUser(String user, UserUpdateOptions options)Replaces the data of an existing user.LogLevelEntitysetLogLevel(LogLevelEntity entity)Modifies and returns the server's current loglevel settings.voidshutdown()Releases all connections to the server and clear the connection pool.AlertEntityupdateAlerts(String updateParam, Map<String,String> queryParamMap)Acknowledges or Resolves an alertBooleanupdateDataCentersForGeoFabric(String tenant, String name, String dcList)Updated the data centers for the specified databaseBooleanupdateSpotRegionForGeoFabric(String tenant, String name, String spotDc)Updates the edge location where on-spot operations will be performed.BooleanupdateSpotStatus(String dcName, boolean isSpot)Change whether an edge location (Datacenter) is capable of being on-spot.UserEntityupdateUser(String user, UserUpdateOptions options)Partially updates the data of an existing user.-
Methods inherited from class com.c8db.internal.InternalC8DB
alertsResponseDeserializer, BooleanResponseDeserializer, createAlertRequest, createGeoFabricRequest, createGeoFabricResponseDeserializer, createUserRequest, deleteUserRequest, getAccessibleGeoFabricsForRequest, getAccessibleGeoFabricsForResponseDeserializer, getAlertRequest, getAlertsResponseDeserializer, getAllEdgeLocationsRequest, getAllEdgeLocationsResponseDeserializer, getEdgeLocationRequest, getEdgeLocationResponseDeserializer, getEdgeLocationsRequest, getEdgeLocationsResponseDeserializer, getGeoFabricInfoRequest, getGeoFabricInfoResponseDeserializer, getGeoFabricsRequest, getGeoFabricsResponseDeserializer, getLocalEdgeLocationRequest, getLocalEdgeLocationResponseDeserializer, getLogLevelRequest, getLogsRequest, getRoleRequest, getRoleResponseDeserializer, getUserRequest, getUsersRequest, getUsersResponseDeserializer, replaceUserRequest, setLogLevelRequest, updateAlertRequest, updateDCListRequest, updateDCListResponseDeserializer, updateSpotDcRequest, updateSpotDcResponseDeserializer, updateSpotStatusRequest, updateUserDefaultCollectionAccessRequest, updateUserDefaultDatabaseAccessRequest, updateUserRequest
-
Methods inherited from class com.c8db.internal.C8Executeable
createPath, request, util, util
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface com.c8db.C8SerializationAccessor
util, util
-
-
-
-
Constructor Detail
-
C8DBImpl
public C8DBImpl(VstCommunicationSync.Builder vstBuilder, HttpCommunication.Builder httpBuilder, C8SerializationFactory util, Protocol protocol, HostResolver hostResolver, C8Context context)
-
-
Method Detail
-
executor
protected C8ExecutorSync executor()
- Overrides:
executorin classC8Executeable<C8ExecutorSync>
-
shutdown
public void shutdown() throws C8DBExceptionDescription copied from interface:C8DBReleases all connections to the server and clear the connection pool.- Specified by:
shutdownin interfaceC8DB- Throws:
C8DBException
-
db
public C8Database db()
Description copied from interface:C8DBReturns aArangoDatabaseinstance for the_systemdatabase.
-
db
public C8Database db(String tenant, String name)
Description copied from interface:C8DBReturns aArangoDatabaseinstance for the given database name and tenant.
-
db
public C8Database db(String tenant, String name, String spotDc, String dcList)
Description copied from interface:C8DBReturns aArangoDatabaseinstance for the given database name.- Specified by:
dbin interfaceC8DB- Parameters:
tenant- Name of the tenantname- Name of the databasespotDc- The Edge Location (Datacenter) where on-spot operations for the given geofabric will be performed. By default a random datacenter is chosen from those which are capable.dcList- The list of Edge Locations (Datacenters) as a comma-separated string. The individual elements for this parameter are your Edge Location URL prefixes up to the first . character.- Returns:
- database handler
-
db
public C8Database db(String tenant, String name, Map<String,String> headerParams)
Description copied from interface:C8DBReturns aArangoDatabaseinstance for the given database name and tenant.
-
createGeoFabric
public Boolean createGeoFabric(String tenant, String name, String spotDc, String dcList, String geoFabric) throws C8DBException
Description copied from interface:C8DBCreates a new database with the given name.- Specified by:
createGeoFabricin interfaceC8DB- Parameters:
tenant- Name of the tenantname- Name of the database to createspotDc- The Edge Location (Datacenter) where on-spot operations for the given geofabric will be performed. By default a random datacenter is chosen from those which are capable.dcList- The list of Edge Locations (Datacenters) as a comma-separated string. The individual elements for this parameter are your Edge Location URL prefixes up to the first . character.geoFabric- The name of the new db/geofabric- Returns:
- true if the database was created successfully.
- Throws:
C8DBException- See Also:
- API Documentation
-
getGeoFabrics
public Collection<String> getGeoFabrics() throws C8DBException
Description copied from interface:C8DBRetrieves a list of all existing databases- Specified by:
getGeoFabricsin interfaceC8DB- Returns:
- a list of all existing databases
- Throws:
C8DBException- See Also:
- API Documentation
-
getAccessibleGeoFabrics
public Collection<String> getAccessibleGeoFabrics() throws C8DBException
Description copied from interface:C8DBRetrieves a list of all databases the current user can access- Specified by:
getAccessibleGeoFabricsin interfaceC8DB- Returns:
- a list of all databases the current user can access
- Throws:
C8DBException- See Also:
- API Documentation
-
getAccessibleGeoFabricsFor
public Collection<String> getAccessibleGeoFabricsFor(String user) throws C8DBException
Description copied from interface:C8DBList available database to the specified user- Specified by:
getAccessibleGeoFabricsForin interfaceC8DB- Parameters:
user- The name of the user for which you want to query the databases- Returns:
- list of database names which are available for the specified user
- Throws:
C8DBException- See Also:
- API Documentation
-
updateDataCentersForGeoFabric
public Boolean updateDataCentersForGeoFabric(String tenant, String name, String dcList) throws C8DBException
Description copied from interface:C8DBUpdated the data centers for the specified database- Specified by:
updateDataCentersForGeoFabricin interfaceC8DB- Parameters:
tenant- Name of the tenantname- Name of the database for changedcList- The full list of Datacenters to be added to the GeoFabric including the new datacenters to be added, as a string. The Datacenter list cannot be empty. Each edge location in the string should be separated from the previous one with a comma character (‘,’)- Returns:
- true if the operation was successful
- Throws:
C8DBException
-
updateSpotRegionForGeoFabric
public Boolean updateSpotRegionForGeoFabric(String tenant, String name, String spotDc) throws C8DBException
Description copied from interface:C8DBUpdates the edge location where on-spot operations will be performed.- Specified by:
updateSpotRegionForGeoFabricin interfaceC8DB- Parameters:
tenant- Name of the tenantname- Name of the database for changespotDc- The Edge Location (Datacenter) where on-spot operations for the given geofabric will be performed. By default a random datacenter is chosen from those which are capable.- Returns:
- true if successful
- Throws:
C8DBException
-
getGeoFabricInformation
public GeoFabricEntity getGeoFabricInformation(String tenant, String name) throws C8DBException
- Specified by:
getGeoFabricInformationin interfaceC8DB- Parameters:
tenant- Name of the tenantname- Name of the database for change- Returns:
- Retrieves information about the current geo-fabric
- Throws:
C8DBException
-
getEdgeLocations
public List<DataCenterEntity> getEdgeLocations(String tenant) throws C8DBException
Edge Locations- Specified by:
getEdgeLocationsin interfaceC8DB- Parameters:
tenant- Name of the tenant- Returns:
- Edge Location (AKA Datacenter) details for specified tenant
- Throws:
C8DBException
-
getAllEdgeLocations
public List<DcInfoEntity> getAllEdgeLocations() throws C8DBException
Description copied from interface:C8DBReturn a list of all Edge Locations (AKA Datacenters) deployed in the Macrometa Fabric.- Specified by:
getAllEdgeLocationsin interfaceC8DB- Returns:
- all Edge Locations (AKA Datacenters) deployed in the Macrometa Fabric.
- Throws:
C8DBException
-
getLocalEdgeLocation
public DcInfoEntity getLocalEdgeLocation() throws C8DBException
Description copied from interface:C8DBList details of Local Edge Location- Specified by:
getLocalEdgeLocationin interfaceC8DB- Returns:
- details of Local Edge Location
- Throws:
C8DBException
-
getEdgeLocation
public DcInfoEntity getEdgeLocation(String dcName) throws C8DBException
Description copied from interface:C8DBFetches data about the specified Edge Location.- Specified by:
getEdgeLocationin interfaceC8DB- Parameters:
dcName- datacenter name for which you want details- Returns:
- the specified edge location details
- Throws:
C8DBException
-
updateSpotStatus
public Boolean updateSpotStatus(String dcName, boolean isSpot)
Description copied from interface:C8DBChange whether an edge location (Datacenter) is capable of being on-spot.- Specified by:
updateSpotStatusin interfaceC8DB- Parameters:
dcName- The target edge locationisSpot- Whether the edge location is capable of being on-spot- Returns:
-
getVersion
public C8DBVersion getVersion() throws C8DBException
Description copied from interface:C8DBReturns the server name and version number.- Specified by:
getVersionin interfaceC8DB- Returns:
- the server version, number
- Throws:
C8DBException- See Also:
- API Documentation
-
getRole
public ServerRole getRole() throws C8DBException
Description copied from interface:C8DBReturns the server role.- Specified by:
getRolein interfaceC8DB- Returns:
- the server role
- Throws:
C8DBException
-
createUser
public UserEntity createUser(String user, String passwd) throws C8DBException
Description copied from interface:C8DBCreate a new user. This user will not have access to any database. You need permission to the _system database in order to execute this call.- Specified by:
createUserin interfaceC8DB- Parameters:
user- The name of the userpasswd- The user password- Returns:
- information about the user
- Throws:
C8DBException- See Also:
- API Documentation
-
createUser
public UserEntity createUser(String user, String passwd, UserCreateOptions options) throws C8DBException
Description copied from interface:C8DBCreate a new user. This user will not have access to any database. You need permission to the _system database in order to execute this call.- Specified by:
createUserin interfaceC8DB- Parameters:
user- The name of the userpasswd- The user passwordoptions- Additional options, can be null- Returns:
- information about the user
- Throws:
C8DBException- See Also:
- API Documentation
-
deleteUser
public void deleteUser(String user) throws C8DBException
Description copied from interface:C8DBRemoves an existing user, identified by user. You need access to the _system database.- Specified by:
deleteUserin interfaceC8DB- Parameters:
user- The name of the user- Throws:
C8DBException- See Also:
- API Documentation
-
getUser
public UserEntity getUser(String user) throws C8DBException
Description copied from interface:C8DBFetches data about the specified user. You can fetch information about yourself or you need permission to the _system database in order to execute this call.- Specified by:
getUserin interfaceC8DB- Parameters:
user- The name of the user- Returns:
- information about the user
- Throws:
C8DBException- See Also:
- API Documentation
-
getUser
public UserEntity getUser(String user, String tenant) throws C8DBException
Description copied from interface:C8DBFetches data about the specified user for a given tenant. You can fetch information about yourself or you need permission to the _system database in order to execute this call.- Specified by:
getUserin interfaceC8DB- Parameters:
user- The name of the usertenant- The tenant of the user- Returns:
- information about the user
- Throws:
C8DBException- See Also:
- API Documentation
-
getUsers
public Collection<UserEntity> getUsers() throws C8DBException
Description copied from interface:C8DBFetches data about all users. You can only execute this call if you have access to the _system database.- Specified by:
getUsersin interfaceC8DB- Returns:
- informations about all users
- Throws:
C8DBException- See Also:
- API Documentation
-
updateUser
public UserEntity updateUser(String user, UserUpdateOptions options) throws C8DBException
Description copied from interface:C8DBPartially updates the data of an existing user. The name of an existing user must be specified in user. You can only change the password of your self. You need access to the _system database to change the active flag.- Specified by:
updateUserin interfaceC8DB- Parameters:
user- The name of the useroptions- Properties of the user to be changed- Returns:
- information about the user
- Throws:
C8DBException- See Also:
- API Documentation
-
replaceUser
public UserEntity replaceUser(String user, UserUpdateOptions options) throws C8DBException
Description copied from interface:C8DBReplaces the data of an existing user. The name of an existing user must be specified in user. You can only change the password of your self. You need access to the _system database to change the active flag.- Specified by:
replaceUserin interfaceC8DB- Parameters:
user- The name of the useroptions- Additional properties of the user, can be null- Returns:
- information about the user
- Throws:
C8DBException- See Also:
- API Documentation
-
grantDefaultDatabaseAccess
public void grantDefaultDatabaseAccess(String user, Permissions permissions) throws C8DBException
Description copied from interface:C8DBSets the default access level for databases for the useruser. You need permission to the _system database in order to execute this call.- Specified by:
grantDefaultDatabaseAccessin interfaceC8DB- Parameters:
user- The name of the userpermissions- The permissions the user grant- Throws:
C8DBException
-
grantDefaultCollectionAccess
public void grantDefaultCollectionAccess(String user, Permissions permissions) throws C8DBException
Description copied from interface:C8DBSets the default access level for collections for the useruser. You need permission to the _system database in order to execute this call.- Specified by:
grantDefaultCollectionAccessin interfaceC8DB- Parameters:
user- The name of the userpermissions- The permissions the user grant- Throws:
C8DBException
-
execute
public Response execute(Request request) throws C8DBException
Description copied from interface:C8DBGeneric Execute. Use this method to execute custom FOXX services.- Specified by:
executein interfaceC8DB- Parameters:
request- VelocyStream request- Returns:
- VelocyStream response
- Throws:
C8DBException
-
execute
public Response execute(Request request, HostHandle hostHandle) throws C8DBException
Description copied from interface:C8DBGeneric Execute. Use this method to execute custom FOXX services.- Specified by:
executein interfaceC8DB- Parameters:
request- VelocyStream requesthostHandle- Used to stick to a specific host when usingLoadBalancingStrategy.ROUND_ROBIN- Returns:
- VelocyStream response
- Throws:
C8DBException
-
getLogs
public LogEntity getLogs(LogOptions options) throws C8DBException
Description copied from interface:C8DBReturns fatal, error, warning or info log messages from the server's global log.- Specified by:
getLogsin interfaceC8DB- Parameters:
options- Additional options, can be null- Returns:
- the log messages
- Throws:
C8DBException- See Also:
- API Documentation
-
getLogLevel
public LogLevelEntity getLogLevel() throws C8DBException
Description copied from interface:C8DBReturns the server's current loglevel settings.- Specified by:
getLogLevelin interfaceC8DB- Returns:
- the server's current loglevel settings
- Throws:
C8DBException
-
setLogLevel
public LogLevelEntity setLogLevel(LogLevelEntity entity) throws C8DBException
Description copied from interface:C8DBModifies and returns the server's current loglevel settings.- Specified by:
setLogLevelin interfaceC8DB- Parameters:
entity- loglevel settings- Returns:
- the server's current loglevel settings
- Throws:
C8DBException
-
_setCursorInitializer
public C8DBImpl _setCursorInitializer(C8CursorInitializer cursorInitializer)
Description copied from interface:C8DBAttention: Please do not use!- Specified by:
_setCursorInitializerin interfaceC8DB- Returns:
- ArangoDB
-
getAlerts
public Collection<AlertEntity> getAlerts(Map<String,String> queryParamMap) throws C8DBException
Description copied from interface:C8DBGets Alerts- Specified by:
getAlertsin interfaceC8DB- Returns:
- Throws:
C8DBException
-
updateAlerts
public AlertEntity updateAlerts(String updateParam, Map<String,String> queryParamMap) throws C8DBException
Description copied from interface:C8DBAcknowledges or Resolves an alert- Specified by:
updateAlertsin interfaceC8DB- Returns:
- Throws:
C8DBException
-
createAlerts
public AlertEntity createAlerts(AlertEntity entity) throws C8DBException
Description copied from interface:C8DBCreates an Alert- Specified by:
createAlertsin interfaceC8DB- Returns:
- Throws:
C8DBException
-
-