Class DatabaseEnvironment
Configuration (database/redis sections of "service.yaml" on the
classpath) is loaded once into static final fields the first time this class is
loaded. The same static initializer then calls initGraphDB(): if the configured
OrientDB database does not exist yet, it is created, Record-Level Security is enabled
(setRecordLevelSecurity(OMetadata)), and the administrative user/password are set up;
only in that case (created == true) does the initializer go on to create the
AdminEnvironment, QueryTemplateEnvironment, TypeEnvironment, and the
Context partition tree (ContextEnvironment parent, then its
LiveContextEnvironment and CemeteryContextEnvironment children — the parent
must exist first so hierarchical role propagation applies at child creation), and finally runs
IsModelBootstrap.bootstrap(boolean) to register every information-system-model
type. On every subsequent JVM start against an already-initialized database, none of that
one-time setup runs again.
- Author:
- Luca Frosini (ISTI - CNR)
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final com.orientechnologies.orient.client.remote.OStorageRemote.CONNECTION_STRATEGYThe connection strategy parameter to use.protected static final StringINI variable name for key algorithm.protected static final StringINI variable name for key file.static final StringThe database server URI.static final StringThe default administrative role name.static final Map<Environment.PermissionMode,String> Default passwords for the read/write database accounts.static final StringThe default prefix for keys stored in Redis cache.static final booleanWhether bootstrap Discovery scans packages contributed by externalRegistrationProviderSPI implementations (e.g.static final StringOrientDB standard Edge class name.static final StringOperator-declared directory where the generated live-registry type documentation (model-docs) is written.static final FileAbsolute directory the live-registry model documentation (model-docs) is actually written to.static final intIn-use Redis database index.static final StringIn-use Redis host address.static final StringIn-use Redis key prefix.static final StringIn-use Redis password.static final intIn-use Redis port.static final StringIn-use Redis username.static final StringOperator-declared name of the runtime model, the one holding the types created through REST (seeModelIdentityResolver).static final StringOrientDB standard Vertex class name. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic voidchangeDefaultAdminPassword(com.orientechnologies.orient.core.metadata.security.OSecurity oSecurity) Deprecated.This code must be removed for OrientDB versions higher than 3.2.Xstatic KeyReturns the initialized database cryptographic symmetric key.protected static KeyInitializes the database key.protected static voidsetDateTimeFormat(com.orientechnologies.orient.core.db.document.ODatabaseDocument oDatabaseDocument) Sets the datetime format attribute for the given database connection.protected static voidsetRecordLevelSecurity(com.orientechnologies.orient.core.metadata.OMetadata oMetadata) Deprecated.This code must be removed for OrientDB versions higher than 3.2.X
-
Field Details
-
DISCOVER_ALL_REGISTRATION_PROVIDERS
public static final boolean DISCOVER_ALL_REGISTRATION_PROVIDERSWhether bootstrap Discovery scans packages contributed by externalRegistrationProviderSPI implementations (e.g.gcube-model's), in addition toinformation-system-model's own intrinsic packages (always scanned regardless). Defaults tofalsewhen absent from "service.yaml" — harmless in production, where no such SPI-contributed provider is ever present on the classpath; test environments that rely on an external provider's types (e.g.gcube-model) must set this explicitly totrue. It also decides whether the domain provider identifies the model (ModelIdentityResolver) and whether a migration realigns its types. -
RUNTIME_MODEL_NAME
Operator-declared name of the runtime model, the one holding the types created through REST (seeModelIdentityResolver).nullwhen absent from "service.yaml": the resolver's default applies. -
MODEL_DOCS_DIRECTORY
Operator-declared directory where the generated live-registry type documentation (model-docs) is written. When absent from "service.yaml", defaults to"model-docs". SeeMODEL_DOCS_OUTPUT_DIRECTORYfor how this value is actually resolved to a filesystem location. -
MODEL_DOCS_OUTPUT_DIRECTORY
Absolute directory the live-registry model documentation (model-docs) is actually written to. An absoluteMODEL_DOCS_DIRECTORYis used as-is; a relative one is resolved against the deployed webapp's own root -- not the JVM's working directory -- so it lands where thedefaultservlet mapped to/model-docs/*inweb.xmllooks for it. Falls back to resolving against the working directory only when the webapp root cannot be determined (e.g. "service.yaml" loaded from a non-webapp classpath, such as a test run). -
DEFAULT_ADMIN_ROLE
The default administrative role name.- See Also:
-
DEFAULT_PASSWORDS
Default passwords for the read/write database accounts. -
DB_URI
The database server URI. -
CONNECTION_STRATEGY_PARAMETER
public static final com.orientechnologies.orient.client.remote.OStorageRemote.CONNECTION_STRATEGY CONNECTION_STRATEGY_PARAMETERThe connection strategy parameter to use. -
DB_KEY_FILENAME_VARNAME
INI variable name for key file.- See Also:
-
DB_KEY_ALGORITHM_VARNAME
INI variable name for key algorithm.- See Also:
-
DEFAULT_REDIS_KEY_PREFIX
The default prefix for keys stored in Redis cache.- See Also:
-
REDIS_HOST
In-use Redis host address. -
REDIS_PORT
public static final int REDIS_PORTIn-use Redis port. -
REDIS_USERNAME
In-use Redis username. -
REDIS_PASSWORD
In-use Redis password. -
REDIS_DB_INDEX
public static final int REDIS_DB_INDEXIn-use Redis database index. -
REDIS_KEY_PREFIX
In-use Redis key prefix. -
VERTEX_CLASS_NAME
OrientDB standard Vertex class name.- See Also:
-
EDGE_CLASS_NAME
OrientDB standard Edge class name.- See Also:
-
-
Constructor Details
-
DatabaseEnvironment
public DatabaseEnvironment()
-
-
Method Details
-
initDbKey
Initializes the database key.- Parameters:
dbSection- the database section of the configuration profile- Returns:
- the initialized key
-
setDateTimeFormat
protected static void setDateTimeFormat(com.orientechnologies.orient.core.db.document.ODatabaseDocument oDatabaseDocument) Sets the datetime format attribute for the given database connection.- Parameters:
oDatabaseDocument- the OrientDB database connection
-
setRecordLevelSecurity
@Deprecated protected static void setRecordLevelSecurity(com.orientechnologies.orient.core.metadata.OMetadata oMetadata) Deprecated.This code must be removed for OrientDB versions higher than 3.2.XConfigures Record-Level Security (RLS) on Vertex and Edge classes.- Parameters:
oMetadata- the OrientDB schema metadata
-
getDatabaseKey
Returns the initialized database cryptographic symmetric key.- Returns:
- the symmetric database key
-
changeDefaultAdminPassword
@Deprecated public static void changeDefaultAdminPassword(com.orientechnologies.orient.core.metadata.security.OSecurity oSecurity) Deprecated.This code must be removed for OrientDB versions higher than 3.2.XChanges the default passwords for database administrative accounts.- Parameters:
oSecurity- the OrientDB security context
-