Package com.illumon.iris.db.schema
Class SchemaServiceFactory
java.lang.Object
com.illumon.iris.db.schema.SchemaServiceFactory
Factory class providing access to the schema service to allow retrieval and manipulation of table schemata.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumRelationship of the current code with the Deephaven system. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic SchemaServiceGet the system default SchemaService, based on the default Configuration.static SchemaServicegetDefault(@NotNull com.fishlib.configuration.Configuration configuration) Get the system default SchemaService, based on the given Configuration.Return a cached and settable default ConnectionMode.getDefaultConnectionMode(@NotNull com.fishlib.configuration.Configuration configuration) Determine the connection mode to a Deephaven system, based on the given Configuration.static SchemaServicegetEmptyTransientInstance(@NotNull com.fishlib.configuration.Configuration configuration) Create a service that will accept schemas and return them, but will not persist anything.Get the default etcd-backed SchemaService.getEtcdInstance(@NotNull com.fishlib.configuration.Configuration configuration) Get the default etcd-backed SchemaService using the given configuration.static SchemagetImmutable(Schema schema) Factory method that allows the implementation class to stay private.static SchemagetImmutable(Schema schema, boolean alreadyDetached) Factory method that allows the implementation class to stay private.static SchemaServicegetLocalInstance(@NotNull com.fishlib.configuration.Configuration configuration, @Nullable String directory) Create a read-only service.Create a new etcd-backed SchemaService using the default Configuration.getNewEtcdInstance(@NotNull com.fishlib.configuration.Configuration configuration) Create a new etcd-backed SchemaService using the given configuration.static SchemaServiceCreate a new client for Schema Service.static SchemaServicegetServiceInstance(@NotNull com.fishlib.configuration.Configuration configuration) Create a new client for Schema Service.static SchemaServicegetTransientInstance(@NotNull com.fishlib.configuration.Configuration configuration) Create a read-only service initialized with schema files from the legacy configuration settings.static voidsetDefaultConnectionMode(@NotNull SchemaServiceFactory.ConnectionMode newConnectionMode) Delegate togetDefault(Configuration)with the default Configuration.
-
Constructor Details
-
SchemaServiceFactory
public SchemaServiceFactory()
-
-
Method Details
-
getDefaultConnectionMode
Return a cached and settable default ConnectionMode. By default, set by delegating togetDefault(Configuration)with the default Configuration.- Returns:
- the default ConnectionMode of the system
-
setDefaultConnectionMode
public static void setDefaultConnectionMode(@NotNull @NotNull SchemaServiceFactory.ConnectionMode newConnectionMode) Delegate togetDefault(Configuration)with the default Configuration.- Parameters:
newConnectionMode- a new default ConnectionMode for the system
-
getDefaultConnectionMode
public static SchemaServiceFactory.ConnectionMode getDefaultConnectionMode(@NotNull @NotNull com.fishlib.configuration.Configuration configuration) Determine the connection mode to a Deephaven system, based on the given Configuration.- Parameters:
configuration- the Configuration to use- Returns:
- the default ConnectionMode of the system
-
getDefault
Get the system default SchemaService, based on the default Configuration. This is a cached singleton.- Returns:
- the default SchemaService singleton
-
getDefault
public static SchemaService getDefault(@NotNull @NotNull com.fishlib.configuration.Configuration configuration) Get the system default SchemaService, based on the given Configuration. Whenconfigurationis the default Configuration, this delegates togetDefault()and returns the cached singleton; otherwise a new, uncached instance is created and returned, owned by the caller.- Parameters:
configuration- the Configuration to use- Returns:
- the default SchemaService singleton, or a new instance if
configurationis not the default
-
getEtcdInstance
Get the default etcd-backed SchemaService. This is a cached singleton, and it must not be closed by callers that do not own its lifecycle. UsegetNewEtcdInstance()when a fresh, independently-closeable instance is required.- Returns:
- the default etcd-backed SchemaService singleton
-
getEtcdInstance
public static SchemaServiceAuthenticatedMutator getEtcdInstance(@NotNull @NotNull com.fishlib.configuration.Configuration configuration) Get the default etcd-backed SchemaService using the given configuration. Whenconfigurationis the default Configuration, this delegates togetEtcdInstance()and returns the cached singleton; otherwise a new, uncached instance is created and returned, owned by the caller. UsegetNewEtcdInstance(Configuration)when a fresh, independently-closeable instance is always required.- Parameters:
configuration- the configuration to use- Returns:
- the default etcd-backed SchemaService singleton, or a new instance if
configurationis not the default
-
getNewEtcdInstance
Create a new etcd-backed SchemaService using the default Configuration. The caller owns the returned instance and is responsible for closing it.- Returns:
- a new etcd-backed SchemaService
-
getNewEtcdInstance
public static SchemaServiceAuthenticatedMutator getNewEtcdInstance(@NotNull @NotNull com.fishlib.configuration.Configuration configuration) Create a new etcd-backed SchemaService using the given configuration. The caller owns the returned instance and is responsible for closing it.- Parameters:
configuration- the configuration to use- Returns:
- a new etcd-backed SchemaService
-
getServiceInstance
Create a new client for Schema Service. This is not cached: a new instance is created on every call, owned by the caller.- Returns:
- a new SchemaService
-
getServiceInstance
public static SchemaService getServiceInstance(@NotNull @NotNull com.fishlib.configuration.Configuration configuration) Create a new client for Schema Service. This is not cached: a new instance is created on every call, owned by the caller.- Parameters:
configuration- the configuration to use- Returns:
- a new SchemaService
-
getTransientInstance
public static SchemaService getTransientInstance(@NotNull @NotNull com.fishlib.configuration.Configuration configuration) Create a read-only service initialized with schema files from the legacy configuration settings. All mutating methods will throw an UnsupportedOperationException.- Parameters:
configuration- the configuration to use- Returns:
- a SchemaService
-
getEmptyTransientInstance
public static SchemaService getEmptyTransientInstance(@NotNull @NotNull com.fishlib.configuration.Configuration configuration) Create a service that will accept schemas and return them, but will not persist anything. Do not initialize it with any schemas.- Parameters:
configuration- the configuration to use- Returns:
- a SchemaService
-
getLocalInstance
public static SchemaService getLocalInstance(@NotNull @NotNull com.fishlib.configuration.Configuration configuration, @Nullable @Nullable String directory) Create a read-only service. Initialize with schema files from a single location, and throw a runtime exception if any of those files have errors.- Parameters:
configuration- the configuration to usedirectory- the single directory to search for schema files (if null, use the value of the LocalTransientSchemaService#SOURCE_DIRECTORY_PROPERTY property- Returns:
- a SchemaService
-
getImmutable
Factory method that allows the implementation class to stay private.- Parameters:
schema- source schema to make immutable- Returns:
- an immutable schema, per
Schema.getImmutable()rules.
-
getImmutable
Factory method that allows the implementation class to stay private.- Parameters:
schema- source schema to make immutablealreadyDetached- true indicates that the source schema is safe to use as-is- Returns:
- an immutable schema, per
Schema.getImmutable()rules.
-