public interface UpdatableSchema extends Schema, Updatable
Updatable schemas are not only used in client applications like schema editors but also by CrNiCKL internally. Any schema can be defined as an extension to another schema. Schemas are kept in permanent storage without resolving these extensions. Before a schema is made available for use, CrNiCKL resolves the extensions. Extensions are visible to clients only in edit mode.
A hypothetical example will help to illustrate how schemas are constructed. The example uses 3 schemas: a, b, and c. Schema a defines two series, s1 and s2, and one attribute, a1. Schema b extends schema a; it removes series s2, and adds series s3. Schema c extends schema b; it adds attribute a2 and redefines attribute a1 (for example with a different default value). Given this design, a chronicle with effective schema c, will have two series, s1 and s3, and two attributes, a1 and a2. It will not be aware of the existence of schemas a and b.
Modifier and Type | Method and Description |
---|---|
AttributeDefinition<?> |
addAttribute(int attrNr)
Add a new attribute to the schema.
|
AttributeDefinition<?> |
addAttribute(int seriesNr,
int attrNr)
Add a new attribute to a series.
|
SeriesDefinition |
addSeries(int seriesNr)
Add a new series to the schema.
|
void |
deleteAttribute(int attrNr)
Delete an attribute from the schema.
|
void |
deleteAttribute(int seriesNr,
int attrNr)
Delete an attribute from a series.
|
void |
deleteSeries(int seriesNr)
Delete a series from the schema.
|
void |
destroy()
Destroy the schema.
|
void |
eraseAttribute(int attrNr)
Set an attribute as erasing.
|
void |
eraseAttribute(int seriesNr,
int attrNr)
Set a series attribute as erasing.
|
void |
eraseSeries(int seriesNr)
Set a series as erasing.
|
UpdatableSchema |
getBase()
Return the base schema if any.
|
Schema |
resolve()
Resolve into a schema.
|
void |
setAttributeDefault(int seriesNr,
int attrNr,
Object defaultValue)
Set the default value of a series attribute.
|
<T> void |
setAttributeDefault(int attrNr,
T defaultValue)
Set the default value of an attribute.
|
void |
setAttributeProperty(int seriesNr,
int attrNr,
Property<?> property)
Set the property of a series attribute.
|
<T> void |
setAttributeProperty(int attrNr,
Property<T> property)
Set the property of an attribute.
|
void |
setBase(UpdatableSchema base)
Set the base of the schema.
|
void |
setName(String name)
Set the name of the schema.
|
void |
setSeriesDescription(int seriesNr,
String description)
Set the description of the series.
|
void |
setSeriesName(int seriesNr,
String name)
Set the name of a series.
|
void |
setSeriesSparsity(int seriesNr,
boolean sparse)
Set the sparsity of the series.
|
void |
setSeriesTimeDomain(int seriesNr,
ch.agent.t2.time.TimeDomain timeDomain)
Set the time domain of the series.
|
void |
setSeriesType(int seriesNr,
String type)
Set the value type of the series using the name of the value type.
|
void |
setSeriesType(int seriesNr,
ValueType<?> type)
Set the value type of the series.
|
dependsOnSchema, edit, getSeriesDefinition, getSeriesDefinition, getSeriesDefinitions, isComplete
getAttributeDefinition, getAttributeDefinition, getAttributeDefinitions, getName
getDatabase, getId, getSurrogate, inConstruction, isValid
applyUpdates
void destroy() throws T2DBException
T2DBException
Schema resolve() throws T2DBException
Schema.isComplete()
.T2DBException
void setName(String name) throws T2DBException
name
- a stringT2DBException
void setBase(UpdatableSchema base) throws T2DBException
DBObject.inConstruction()
).base
- an updatable schema or nullT2DBException
AttributeDefinition<?> addAttribute(int attrNr) throws T2DBException
attrNr
- a positive number not already usedT2DBException
void deleteAttribute(int attrNr) throws T2DBException
attrNr
- the number of an existing attributeT2DBException
void eraseAttribute(int attrNr) throws T2DBException
attrNr
- the number of an existing attributeT2DBException
<T> void setAttributeProperty(int attrNr, Property<T> property) throws T2DBException
attrNr
- the number of an existing attributeproperty
- a propertyT2DBException
<T> void setAttributeDefault(int attrNr, T defaultValue) throws T2DBException
attrNr
- the number of an existing attributedefaultValue
- a valueT2DBException
SeriesDefinition addSeries(int seriesNr) throws T2DBException
seriesNr
- a positive number not already usedT2DBException
void deleteSeries(int seriesNr) throws T2DBException
seriesNr
- the number of an existing seriesT2DBException
void eraseSeries(int seriesNr) throws T2DBException
seriesNr
- the number of an existing seriesT2DBException
void setSeriesName(int seriesNr, String name) throws T2DBException
seriesNr
- the number of an existing seriesname
- a stringT2DBException
void setSeriesDescription(int seriesNr, String description) throws T2DBException
seriesNr
- the number of an existing seriesdescription
- a stringT2DBException
void setSeriesType(int seriesNr, ValueType<?> type) throws T2DBException
seriesNr
- the number of an existing seriestype
- a value typeT2DBException
void setSeriesType(int seriesNr, String type) throws T2DBException
seriesNr
- the number of an existing seriestype
- the name of a value type defined in the databaseT2DBException
void setSeriesTimeDomain(int seriesNr, ch.agent.t2.time.TimeDomain timeDomain) throws T2DBException
seriesNr
- the number of an existing seriestimeDomain
- a time domainT2DBException
void setSeriesSparsity(int seriesNr, boolean sparse) throws T2DBException
seriesNr
- the number of an existing seriessparse
- true to force the series to use sparse time series, else falseT2DBException
AttributeDefinition<?> addAttribute(int seriesNr, int attrNr) throws T2DBException
seriesNr
- the number of an existing seriesattrNr
- a positive number not yet in use within the seriesT2DBException
void deleteAttribute(int seriesNr, int attrNr) throws T2DBException
seriesNr
- the number of an existing seriesattrNr
- the number of an existing attribute within the seriesT2DBException
void eraseAttribute(int seriesNr, int attrNr) throws T2DBException
seriesNr
- the number of an existing seriesattrNr
- the number of an existing attribute within the seriesT2DBException
void setAttributeProperty(int seriesNr, int attrNr, Property<?> property) throws T2DBException
seriesNr
- the number of an existing seriesattrNr
- the number of an existing attribute within the seriesproperty
- a propertyT2DBException
void setAttributeDefault(int seriesNr, int attrNr, Object defaultValue) throws T2DBException
seriesNr
- the number of an existing seriesattrNr
- the number of an existing attribute within the seriesdefaultValue
- a valueT2DBException
UpdatableSchema getBase()
Copyright © 2017. All rights reserved.