Package com.illumon.iris.db.schema
Interface SchemaService
- All Superinterfaces:
AutoCloseable,NamedImplementation,SchemaServiceBase
- All Known Subinterfaces:
SchemaServiceAuthenticatedMutator,SchemaServiceUtilLayer
- All Known Implementing Classes:
SchemaService.Delegating,SchemaServiceEmptyTransientImpl,SchemaServiceEtcdImpl,SchemaServiceKvImpl,SchemaServiceLegacyTransientImpl,StaticSchemaServiceImpl
Provides methods for interacting with the system Schema store using legacy
Schema instances.-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic classDelegate all method calls to an implementation object. -
Method Summary
Modifier and TypeMethodDescriptionAdd the specified schema to the service.Add the specified schema to the service.addSchema(TableDefinitionSchema newSchema) Add the specified schema to the service.addSchema(TableDefinitionSchema newSchema, String code, String comment) Add the specified schema to the service.org.jdom2.ElementasSchemaXml(Schema schema) booleancreateNamespace(NamespaceSet namespaceSet, String namespaceName) Add a namespace with the given name to the schema service, in the requested namespace set.booleancreateNamespace(NamespaceSet namespaceSet, String namespaceName, String code, String comment) Add a namespace with the given name to the schema service, in the requested namespace set.default booleancreateNamespace(String namespaceSet, String namespaceName) Convenience method translates the namespace set from string toNamespaceSetand delegate tocreateNamespace(NamespaceSet, String)default voiddeleteSchema(TableDefinitionSchema schema) Delete the specified schema.default voiddeleteSchema(TableDefinitionSchema schema, String code, String comment) Delete the specified schema.default MutableSchemafromDefinition(TableDefinition definition, NamespaceSet namespaceSet) Create aMutableSchemathat supportsSchemaXmlfrom aTableDefinition, using the given namespace set and taking namespace, table name, and storage type from the given TableDefinition.default MutableSchemafromDefinition(TableDefinition definition, String namespaceSet) Convenience method translates the namespace set from string toNamespaceSetand delegate tofromDefinition(TableDefinition, NamespaceSet)default MutableSchemafromDefinition(TableDefinition definition, String namespace, String tableName, int storageType, NamespaceSet set) Create aMutableSchemathat supportsSchemaXmlfrom aTableDefinition, using the specified namespace, table name, storage type andNamespaceSet.fromDefinition(TableDefinition definition, String namespace, String tableName, int storageType, NamespaceSet set, boolean useNanosecondTimePrecision) Create aMutableSchemathat supportsSchemaXmlfrom aTableDefinition, using the specified namespace, table name, storage type andNamespaceSet.default MutableSchemafromDefinition(TableDefinition definition, String namespace, String tableName, int storageType, String set) Convenience method translates the namespace set from string toNamespaceSetand delegate tofromDefinition(TableDefinition, String, String, int, NamespaceSet)fromElement(org.jdom2.Element elem) Get a collection of all known schemas in the system.getLatestSchema(String namespace, String tableName) Get the latest version of theSchemadefined by namespace and table namegetLatestSchemaXml(String namespace, String tableName) default TableDefinitiongetLatestTableDefinition(String namespace, String tableName) Get the latest version of theSchemafor the namespace and table name, and return itsTableDefinition.default TableDefinitiongetLatestTableDefinitionRequired(String namespace, String tableName) Get the latest version of theSchemafor the namespace and table name, and return itsTableDefinition.getLatestTableDefinitionSchema(String namespace, String tableName) Get the latest version of theTableDefinitionSchemadefined by namespace and table namegetNamespaceSet(String namespace) Get theNamespaceSetfor a particular namespace.default SchemaConvenience method forgetLatestSchema(String, String).getSchema(String namespace, String tableName, SchemaVersion version) Get the specified version of theSchemadefined by namespace and table namegetSchemas(NamespaceSet namespaceSet) Get a collection of all known schemas in the system, with the given namespace set.getSchemas(String namespace) Get a collection of all known schemas in the given namespace.default Collection<Schema>getSchemasForNamespaceSet(String namespaceSet) Convenience method translates the namespace set from string toNamespaceSetand delegate togetSchemas(NamespaceSet)Get a map of all known tables in all known namespaces for all namespace sets.default Collection<String>listNamespaces(NamespaceSet namespaceSet) Get a collection of the namespaces available in the given namespace set.listNamespaces(NamespaceSet namespaceSet, boolean includeDeleted) Get a collection of the namespaces available in the given namespace set.default Collection<String>listNamespaces(String namespaceSet) Convenience method translates the namespace set from string toNamespaceSetand delegate tolistNamespaces(NamespaceSet)updateSchema(Schema newSchema) Update the schema with the same namespace and table name with the specified new schema.updateSchema(Schema newSchema, String code, String comment) Update the schema with the same namespace and table name with the specified new schema.updateSchema(TableDefinitionSchema newSchema) Update the schema with the same namespace and table name with the specified new schema.updateSchema(TableDefinitionSchema newSchema, String code, String comment) Update the schema with the same namespace and table name with the specified new schema.Methods inherited from interface com.illumon.util.type.NamedImplementation
getImplementationNameMethods inherited from interface io.deephaven.enterprise.schema.internal.SchemaServiceBase
about, authenticate, authenticate, authenticate, close, containsNamespace, containsNamespace, containsSchema, deleteSchema, deleteSchema, initializationStage, listNamespaces, listNamespaces, listTableNames, listTableNames, removeNamespace, removeNamespace, shutdown
-
Method Details
-
getNamespaceSet
Get theNamespaceSetfor a particular namespace.- Parameters:
namespace- The namespace name- Returns:
- the namespace set of the namespace
- Throws:
IllegalArgumentException- if the namespace does not exist
-
listNamespaces
Get a collection of the namespaces available in the given namespace set.- Parameters:
namespaceSet- list namespaces in this namespace set (User, System)- Returns:
- a collection of namespace names
-
listNamespaces
Convenience method translates the namespace set from string toNamespaceSetand delegate tolistNamespaces(NamespaceSet) -
listNamespaces
@NotNull Collection<String> listNamespaces(@NotNull NamespaceSet namespaceSet, boolean includeDeleted) Get a collection of the namespaces available in the given namespace set.- Parameters:
namespaceSet- list namespaces in this set (User, System)includeDeleted- true if deleted namespaces should be included- Returns:
- a collection of namespace names
-
listAllTables
Get a map of all known tables in all known namespaces for all namespace sets.- Returns:
- all the table names, mapped by namespace set and namespace
-
fromDefinition
@NotNull default MutableSchema fromDefinition(@NotNull TableDefinition definition, @NotNull String namespace, @NotNull String tableName, int storageType, @NotNull NamespaceSet set) throws SchemaValidationException Create aMutableSchemathat supportsSchemaXmlfrom aTableDefinition, using the specified namespace, table name, storage type andNamespaceSet. Values of namespace, table name, storage type and Namespace set from the input definition are not used.- Parameters:
definition- create a schema based on this table definitionnamespace- the namespace of the new schematableName- the table name of the new schemastorageType- the storage type of the tableset- the namespace set for the schema- Returns:
- a new
MutableSchema. - Throws:
SchemaValidationException- if there was a problem creating the new schema.
-
fromDefinition
@NotNull MutableSchema fromDefinition(@NotNull TableDefinition definition, @NotNull String namespace, @NotNull String tableName, int storageType, @NotNull NamespaceSet set, boolean useNanosecondTimePrecision) throws SchemaValidationException Create aMutableSchemathat supportsSchemaXmlfrom aTableDefinition, using the specified namespace, table name, storage type andNamespaceSet. Values of namespace, table name, storage type and Namespace set from the input definition are not used.- Parameters:
definition- create a schema based on this table definitionnamespace- the namespace of the new schematableName- the table name of the new schemastorageType- the storage type of the tableset- the namespace set for the schemauseNanosecondTimePrecision- whether to set nanosecond time precision for DateTime columns- Returns:
- a new
MutableSchema. - Throws:
SchemaValidationException- if there was a problem creating the new schema.
-
fromDefinition
@NotNull default MutableSchema fromDefinition(@NotNull TableDefinition definition, @NotNull String namespace, @NotNull String tableName, int storageType, @NotNull String set) throws SchemaValidationException Convenience method translates the namespace set from string toNamespaceSetand delegate tofromDefinition(TableDefinition, String, String, int, NamespaceSet)- Throws:
SchemaValidationException
-
fromDefinition
@NotNull default MutableSchema fromDefinition(@NotNull TableDefinition definition, @NotNull NamespaceSet namespaceSet) throws SchemaValidationException Create aMutableSchemathat supportsSchemaXmlfrom aTableDefinition, using the given namespace set and taking namespace, table name, and storage type from the given TableDefinition.- Parameters:
definition- create a schema based on this table definitionnamespaceSet- the namespace set for the schema- Returns:
- a new
MutableSchema. - Throws:
SchemaValidationException- if there was a problem creating the new schema
-
fromDefinition
@NotNull default MutableSchema fromDefinition(@NotNull TableDefinition definition, @NotNull String namespaceSet) throws SchemaValidationException Convenience method translates the namespace set from string toNamespaceSetand delegate tofromDefinition(TableDefinition, NamespaceSet)- Throws:
SchemaValidationException
-
fromElement
- Parameters:
elem- the element to create the schema from- Returns:
- a new
Schema - Throws:
SchemaValidationException- if the input element is not a properly structured Schema element
-
asElement
-
asSchemaXml
-
getLatestSchema
Get the latest version of theSchemadefined by namespace and table name- Parameters:
namespace- the namespace of the tabletableName- the table name- Returns:
- the latest version of namespace.tablename or null if none was found
-
getSchema
Convenience method forgetLatestSchema(String, String). -
getLatestSchemaXml
Get the latest version of theSchemadefined by namespace and table name, as an implementation supportingSchemaXml.- Parameters:
namespace- the namespace of the tabletableName- the table name- Returns:
- the latest version of namespace.tablename or null if none was found
-
getSchema
@Nullable Schema getSchema(@NotNull String namespace, @NotNull String tableName, @NotNull SchemaVersion version) Get the specified version of theSchemadefined by namespace and table name- Parameters:
namespace- the namespace of the tabletableName- the table nameversion- the version of this schema to retrieve- Returns:
- the requested version of the schema for namespace.tableName or null if none was found
-
getAllSchemas
Get a collection of all known schemas in the system. The latest version of each will be returned. // TODO: subject to ACL visibility?- Returns:
- a collection of all known schemas
-
getSchemas
Get a collection of all known schemas in the system, with the given namespace set. The latest version of each will be returned.- Returns:
- a collection of all known schemas in the given namespace set
-
getSchemasForNamespaceSet
Convenience method translates the namespace set from string toNamespaceSetand delegate togetSchemas(NamespaceSet) -
getSchemas
Get a collection of all known schemas in the given namespace. The latest version of each will be returned.- Returns:
- a collection of all known schemas in the given namespace
-
getLatestTableDefinitionSchema
@Nullable TableDefinitionSchema getLatestTableDefinitionSchema(@NotNull String namespace, @NotNull String tableName) Get the latest version of theTableDefinitionSchemadefined by namespace and table name- Parameters:
namespace- the namespace of the tabletableName- the table name- Returns:
- the latest version of namespace.tableName or null if none was found
-
getLatestTableDefinition
@Nullable default TableDefinition getLatestTableDefinition(@NotNull String namespace, @NotNull String tableName) Get the latest version of theSchemafor the namespace and table name, and return itsTableDefinition.- Parameters:
namespace- The namespace of the tabletableName- The table name- Returns:
- The
TableDefinitionfor the latest version of namespace.tableName or null if none was found
-
getLatestTableDefinitionRequired
default TableDefinition getLatestTableDefinitionRequired(@NotNull String namespace, @NotNull String tableName) Get the latest version of theSchemafor the namespace and table name, and return itsTableDefinition.- Parameters:
namespace- The namespace of the tabletableName- The table name- Returns:
- The
TableDefinitionfor the latest version of namespace.tableName - Throws:
SchemaException- if theSchemawas not found
-
createNamespace
boolean createNamespace(@NotNull NamespaceSet namespaceSet, @NotNull String namespaceName) throws SchemaException Add a namespace with the given name to the schema service, in the requested namespace set. Returns true if the namespace was added, false if it already exists. Throws a SchemaException if the namespace could not be added.- Parameters:
namespaceSet- add namespaceName to this namespace setnamespaceName- name of the new namespace- Returns:
- true if the namespace was added, false if it already exists.
- Throws:
SchemaException- if the namespace could not be added to the given namespace set
-
createNamespace
default boolean createNamespace(@NotNull String namespaceSet, @NotNull String namespaceName) throws SchemaException Convenience method translates the namespace set from string toNamespaceSetand delegate tocreateNamespace(NamespaceSet, String)- Throws:
SchemaException
-
createNamespace
boolean createNamespace(@NotNull NamespaceSet namespaceSet, @NotNull String namespaceName, @NotNull String code, @NotNull String comment) throws SchemaException Add a namespace with the given name to the schema service, in the requested namespace set. Returns true if the namespace was added, false if it already exists. Throws a SchemaException if the namespace could not be added.- Parameters:
namespaceSet- add namespaceName to this namespace setnamespaceName- name of the new namespacecode- pass-thru to kv persistence, indicates the code source of this updatecomment- pass-thru to kv persistence - a comment for this update- Returns:
- true if the namespace was added, false if it already exists.
- Throws:
SchemaException- if the namespace could not be added to the given namespace set
-
addSchema
Add the specified schema to the service.- Parameters:
newSchema- the schema to add- Returns:
- the schema actually stored in the SchemaService
- Throws:
SchemaException- if the schema could not be added
-
addSchema
@NotNull Schema addSchema(@NotNull Schema newSchema, @NotNull String code, @NotNull String comment) throws SchemaException Add the specified schema to the service.- Parameters:
newSchema- the schema to addcode- pass-thru to kv persistence, indicates the code source of this updatecomment- pass-thru to kv persistence - a comment for this update- Returns:
- the schema actually stored in the SchemaService
- Throws:
SchemaException- if the schema could not be added
-
addSchema
Add the specified schema to the service.- Parameters:
newSchema- the schema to add- Returns:
- the schema actually stored in the SchemaService
- Throws:
SchemaException- if the schema could not be added or already exists
-
addSchema
@NotNull Schema addSchema(@NotNull TableDefinitionSchema newSchema, @NotNull String code, @NotNull String comment) throws SchemaException Add the specified schema to the service.- Parameters:
newSchema- the schema to addcode- pass-thru to kv persistence, indicates the code source of this updatecomment- pass-thru to kv persistence - a comment for this update- Returns:
- the schema actually stored in the SchemaService
- Throws:
SchemaException- if the schema could not be added or already exists
-
updateSchema
@NotNull Schema updateSchema(@NotNull Schema newSchema) throws IllegalArgumentException, SchemaException Update the schema with the same namespace and table name with the specified new schema.- Parameters:
newSchema- the schema to update with- Throws:
IllegalArgumentException- if the namespace or table does not existSchemaException- if the schema could not be updated
-
updateSchema
@NotNull Schema updateSchema(@NotNull Schema newSchema, @NotNull String code, @NotNull String comment) throws IllegalArgumentException, SchemaException Update the schema with the same namespace and table name with the specified new schema.- Parameters:
newSchema- the schema to update withcode- pass-thru to kv persistence, indicates the code source of this updatecomment- pass-thru to kv persistence - a comment for this update- Returns:
- the schema actually stored in the SchemaService
- Throws:
IllegalArgumentException- if the namespace or table does not existSchemaException- if the schema could not be updated
-
updateSchema
@NotNull Schema updateSchema(@NotNull TableDefinitionSchema newSchema) throws IllegalArgumentException, SchemaException Update the schema with the same namespace and table name with the specified new schema.- Parameters:
newSchema- the schema to update with.- Returns:
- the schema actually stored in the SchemaService
- Throws:
IllegalArgumentException- if the namespace or table does not existSchemaException- if the schema could not be updated
-
updateSchema
@NotNull Schema updateSchema(@NotNull TableDefinitionSchema newSchema, @NotNull String code, @NotNull String comment) throws IllegalArgumentException, SchemaException Update the schema with the same namespace and table name with the specified new schema.- Parameters:
newSchema- the schema to update with.code- pass-thru to kv persistence, indicates the code source of this updatecomment- pass-thru to kv persistence - a comment for this update- Returns:
- the schema actually stored in the SchemaService
- Throws:
IllegalArgumentException- if the namespace or table does not existSchemaException- if the schema could not be updated
-
deleteSchema
default void deleteSchema(@NotNull TableDefinitionSchema schema) throws IllegalArgumentException, SchemaException Delete the specified schema.- Parameters:
schema- the schema to delete- Throws:
IllegalArgumentException- if the namespace or table could not be foundSchemaException- if the schema could not be deleted
-
deleteSchema
default void deleteSchema(@NotNull TableDefinitionSchema schema, @NotNull String code, @NotNull String comment) throws IllegalArgumentException, SchemaException Delete the specified schema.- Parameters:
schema- the schema to deletecode- pass-thru to kv persistence, indicates the code source of this deletecomment- pass-thru to kv persistence - a comment for this delete- Throws:
IllegalArgumentException- if the namespace or table could not be foundSchemaException- if the schema could not be deleted
-