public class MongoDatabase
extends ch.agent.crnickl.impl.DatabaseBackendImpl
DatabaseBackendImpl.BUILTIN_PROP_SPARSITY, BUILTIN_PROP_SYMBOL, BUILTIN_PROP_TIME_DOMAIN, BUILTIN_PROP_TYPE, DB_PARAM_Boolean_STRICT_NAME_SPACE, DB_PARAM_Boolean_STRICT_NAME_SPACE_DEFAULT, DB_PARAM_Class_ChronicleUpdatePolicyExtension, DB_PARAM_Class_PermissionChecker, DB_PARAM_Float_CACHE_LOAD_FACTOR, DB_PARAM_Float_CACHE_LOAD_FACTOR_DEFAULT, DB_PARAM_Int_CACHE_SIZE, DB_PARAM_Int_CACHE_SIZE_DEFAULT, DB_PARAM_Int_MAX_GAP, MAGIC_NAME_NR, MAGIC_SPARSITY_NR, MAGIC_TIMEDOMAIN_NR, MAGIC_TYPE_NR, MAX_MAGIC_NR| Constructor and Description |
|---|
MongoDatabase(String name)
Construct a
DatabaseBackend. |
| Modifier and Type | Method and Description |
|---|---|
void |
commit()
manage back end store
|
void |
configure(ch.agent.crnickl.api.DatabaseConfiguration configuration) |
void |
create(ch.agent.crnickl.api.UpdatableChronicle entity) |
void |
create(ch.agent.crnickl.api.UpdatableProperty<?> property) |
void |
create(ch.agent.crnickl.api.UpdatableSchema schema) |
<T> void |
create(ch.agent.crnickl.api.UpdatableSeries<T> series) |
<T> void |
create(ch.agent.crnickl.api.UpdatableValueType<T> valueType) |
void |
deleteAttributeValue(ch.agent.crnickl.api.UpdatableChronicle entity,
ch.agent.crnickl.api.AttributeDefinition<?> def) |
void |
deleteChronicle(ch.agent.crnickl.api.UpdatableChronicle entity) |
void |
deleteProperty(ch.agent.crnickl.api.UpdatableProperty<?> property) |
void |
deleteSchema(ch.agent.crnickl.api.UpdatableSchema schema) |
<T> void |
deleteSeries(ch.agent.crnickl.api.UpdatableSeries<T> series) |
void |
deleteValueType(ch.agent.crnickl.api.UpdatableValueType<?> valueType) |
ch.agent.crnickl.api.Surrogate |
findChronicle(ch.agent.crnickl.api.Property<?> property,
ch.agent.crnickl.api.Schema schema) |
ch.agent.crnickl.api.Surrogate |
findChronicle(ch.agent.crnickl.api.Schema schema) |
ch.agent.crnickl.api.Surrogate |
findChronicle(ch.agent.crnickl.api.SeriesDefinition ss,
ch.agent.crnickl.api.Schema schema) |
boolean |
getAttributeValue(List<ch.agent.crnickl.api.Chronicle> chronicles,
ch.agent.crnickl.api.Attribute<?> attribute) |
ch.agent.crnickl.api.Chronicle |
getChronicle(ch.agent.crnickl.api.Chronicle chronicle) |
ch.agent.crnickl.api.Chronicle |
getChronicleOrNull(ch.agent.crnickl.api.Chronicle parent,
String simpleName) |
<T> List<ch.agent.crnickl.api.Chronicle> |
getChroniclesByAttributeValue(ch.agent.crnickl.api.Property<T> property,
T value,
int maxSize) |
Collection<ch.agent.crnickl.api.Chronicle> |
getChroniclesByParent(ch.agent.crnickl.api.Chronicle parent) |
MongoDB |
getMongoDB() |
Collection<ch.agent.crnickl.api.Property<?>> |
getProperties(String pattern) |
ch.agent.crnickl.api.Property<?> |
getProperty(String name) |
ch.agent.crnickl.api.Property<?> |
getProperty(ch.agent.crnickl.api.Surrogate surrogate) |
protected ReadMethodsForChroniclesAndSeries |
getReadMethodsForChronicleAndSeries()
Return the object providing read methods for chronicles and series.
|
protected ReadMethodsForProperty |
getReadMethodsForProperty()
Return the object providing read methods for properties.
|
protected ReadMethodsForSchema |
getReadMethodsForSchema()
Return the object providing read methods for schemas.
|
protected ReadMethodsForValueType |
getReadMethodsForValueType()
Return the object providing read methods for value types.
|
Collection<ch.agent.crnickl.api.Surrogate> |
getSchemaSurrogates(String pattern) |
ch.agent.crnickl.impl.SchemaUpdatePolicy |
getSchemaUpdatePolicy() |
<T> ch.agent.crnickl.api.Series<T>[] |
getSeries(ch.agent.crnickl.api.Chronicle chronicle,
String[] names,
int[] numbers) |
<T> ch.agent.crnickl.api.Series<T> |
getSeries(ch.agent.crnickl.api.Surrogate surrogate) |
ch.agent.crnickl.api.UpdatableSchema |
getUpdatableSchema(ch.agent.crnickl.api.Surrogate surrogate) |
<T> ch.agent.crnickl.api.ValueType<T> |
getValueType(String name) |
<T> ch.agent.crnickl.api.ValueType<T> |
getValueType(ch.agent.crnickl.api.Surrogate surrogate) |
Collection<ch.agent.crnickl.api.ValueType<?>> |
getValueTypes(String pattern) |
protected WriteMethodsForChroniclesAndSeries |
getWriteMethodsForChroniclesAndSeries()
Return the object providing write methods for chronicles and series.
|
protected WriteMethodsForProperty |
getWriteMethodsForProperty()
Return the object providing write methods for properties.
|
protected WriteMethodsForSchema |
getWriteMethodsForSchema()
Return the object providing write methods for schemas.
|
protected WriteMethodsForValueType |
getWriteMethodsForValueType()
Return the object providing write methods for value types.
|
protected boolean |
isChronicleUpdatePolicyExtensionAllowed() |
ch.agent.crnickl.api.DBObjectId |
makeDBObjectId(Object object) |
void |
rollback() |
void |
sleep()
Sleep a number of milliseconds before trying to detect violations of
referential integrity.
|
String |
toString() |
void |
update(ch.agent.crnickl.api.UpdatableChronicle entity) |
void |
update(ch.agent.crnickl.api.UpdatableChronicle entity,
ch.agent.crnickl.api.AttributeDefinition<?> def,
String value,
String description) |
void |
update(ch.agent.crnickl.api.UpdatableProperty<?> property) |
void |
update(ch.agent.crnickl.api.UpdatableSchema schema) |
void |
update(ch.agent.crnickl.api.UpdatableValueType<?> valueType) |
check, check, check, check, checkSurrogate, createProperty, createSchema, createValueType, deleteValue, equals, getAccessMethods, getCache, getChronicle, getChronicle, getChronicleUpdatePolicy, getFirstObservation, getLastObservation, getMessageListener, getNamingPolicy, getPermissionChecker, getProperty, getRange, getSchema, getSchemas, getSeries, getSparsityBuiltInProperty, getSymbolBuiltInProperty, getTimeDomainBuiltInProperty, getTopChronicle, getTypeBuiltInProperty, getUpdatableSchema, getUpdatableSchemas, getUpdatableSeries, getUpdateEventPublisher, getValues, hashCode, isBuiltIn, isChronicleUpdatePolicyExtensionMandatory, isStrictNameSpaceMode, makeSurrogate, publish, setAccessMethods, setMessageListener, setStrictNameSpaceMode, update, updatepublic static final String FLD_ID
public static final String COLL_CHRON
public static final String FLD_CHRON_NAME
public static final String FLD_CHRON_DESC
public static final String FLD_CHRON_PARENT
public static final String FLD_CHRON_SCHEMA
public static final String COLL_SER
public static final String FLD_SER_CHRON
public static final String FLD_SER_NUM
public static final String FLD_SER_FIRST
public static final String FLD_SER_LAST
public static final String FLD_SER_VALUES
public static final String COLL_ATTR
public static final String FLD_ATTR_CHRON
public static final String FLD_ATTR_PROP
public static final String FLD_ATTR_VALUE
public static final String FLD_ATTR_DESC
public static final String COLL_PROP
public static final String FLD_PROP_NAME
public static final String FLD_PROP_VT
public static final String FLD_PROP_INDEXED
public static final String COLL_SCHEMA
public static final String FLD_SCHEMA_NAME
public static final String FLD_SCHEMA_BASE
public static final String FLD_SCHEMA_ATTRIBS
public static final String FLD_SCHEMA_SERIES
public static final String FLD_ATTRIBDEF_NUM
public static final String FLD_ATTRIBDEF_PROP
public static final String FLD_ATTRIBDEF_VAL
public static final String FLD_ATTRIBDEF_ERASING
public static final String FLD_SERIESDEF_NUM
public static final String FLD_SERIESDEF_DESC
public static final String FLD_SERIESDEF_ATTRIBS
public static final String FLD_SERIESDEF_ERASING
public static final String COLL_VT
public static final String FLD_VT_NAME
public static final String FLD_VT_TYPE
public static final String FLD_VT_VALUES
public static final String DB_PARAM_IntInt_WAITING_DELAY_RANGE
DB_PARAM_IntInt_WAITING_DELAY_RANGE_DEFAULT.public static final String DB_PARAM_IntInt_WAITING_DELAY_RANGE_DEFAULT
public MongoDatabase(String name)
DatabaseBackend.name - the name of the databaseprotected boolean isChronicleUpdatePolicyExtensionAllowed()
isChronicleUpdatePolicyExtensionAllowed in class ch.agent.crnickl.impl.DatabaseBackendImplpublic void configure(ch.agent.crnickl.api.DatabaseConfiguration configuration)
throws ch.agent.crnickl.T2DBException
configure in interface ch.agent.crnickl.api.Databaseconfigure in class ch.agent.crnickl.impl.DatabaseBackendImplch.agent.crnickl.T2DBExceptionpublic ch.agent.crnickl.impl.SchemaUpdatePolicy getSchemaUpdatePolicy()
getSchemaUpdatePolicy in interface ch.agent.crnickl.impl.DatabaseBackendgetSchemaUpdatePolicy in class ch.agent.crnickl.impl.DatabaseBackendImplpublic ch.agent.crnickl.api.DBObjectId makeDBObjectId(Object object) throws ch.agent.crnickl.T2DBException
ch.agent.crnickl.T2DBExceptionpublic MongoDB getMongoDB()
public void sleep()
throws InterruptedException
InterruptedException else return false. This is a random number
in the range specified with the the
DB_PARAM_IntInt_WAITING_DELAY_RANGE configuration parameter.
A update is said to be dangerous when there is a risk of leaving the database in a inconsistent state. The underlying cause is lack of support for transactions or referential integrity. Example a.b == b._id and b is deleted. The following pseudo code shows how dangerous updates are performed.
count references of document if (count > 0) fail memo := get prior state of document to be updated update document sleep() count references again if (count > 0) do restore document to its prior state using memo fail done
InterruptedExceptionpublic void commit()
throws ch.agent.crnickl.T2DBException
ch.agent.crnickl.T2DBExceptionpublic void rollback()
throws ch.agent.crnickl.T2DBException
ch.agent.crnickl.T2DBExceptionprotected ReadMethodsForChroniclesAndSeries getReadMethodsForChronicleAndSeries()
protected WriteMethodsForChroniclesAndSeries getWriteMethodsForChroniclesAndSeries()
public void create(ch.agent.crnickl.api.UpdatableChronicle entity)
throws ch.agent.crnickl.T2DBException
ch.agent.crnickl.T2DBExceptionpublic void update(ch.agent.crnickl.api.UpdatableChronicle entity)
throws ch.agent.crnickl.T2DBException
ch.agent.crnickl.T2DBExceptionpublic void deleteAttributeValue(ch.agent.crnickl.api.UpdatableChronicle entity,
ch.agent.crnickl.api.AttributeDefinition<?> def)
throws ch.agent.crnickl.T2DBException
ch.agent.crnickl.T2DBExceptionpublic void update(ch.agent.crnickl.api.UpdatableChronicle entity,
ch.agent.crnickl.api.AttributeDefinition<?> def,
String value,
String description)
throws ch.agent.crnickl.T2DBException
ch.agent.crnickl.T2DBExceptionpublic void deleteChronicle(ch.agent.crnickl.api.UpdatableChronicle entity)
throws ch.agent.crnickl.T2DBException
ch.agent.crnickl.T2DBExceptionpublic <T> void create(ch.agent.crnickl.api.UpdatableSeries<T> series)
throws ch.agent.crnickl.T2DBException
ch.agent.crnickl.T2DBExceptionpublic <T> void deleteSeries(ch.agent.crnickl.api.UpdatableSeries<T> series)
throws ch.agent.crnickl.T2DBException
ch.agent.crnickl.T2DBExceptionpublic ch.agent.crnickl.api.Chronicle getChronicle(ch.agent.crnickl.api.Chronicle chronicle)
throws ch.agent.crnickl.T2DBException
ch.agent.crnickl.T2DBExceptionpublic ch.agent.crnickl.api.Chronicle getChronicleOrNull(ch.agent.crnickl.api.Chronicle parent,
String simpleName)
throws ch.agent.crnickl.T2DBException
ch.agent.crnickl.T2DBExceptionpublic Collection<ch.agent.crnickl.api.Chronicle> getChroniclesByParent(ch.agent.crnickl.api.Chronicle parent) throws ch.agent.crnickl.T2DBException
ch.agent.crnickl.T2DBExceptionpublic <T> List<ch.agent.crnickl.api.Chronicle> getChroniclesByAttributeValue(ch.agent.crnickl.api.Property<T> property, T value, int maxSize) throws ch.agent.crnickl.T2DBException
ch.agent.crnickl.T2DBExceptionpublic boolean getAttributeValue(List<ch.agent.crnickl.api.Chronicle> chronicles, ch.agent.crnickl.api.Attribute<?> attribute) throws ch.agent.crnickl.T2DBException
ch.agent.crnickl.T2DBExceptionpublic <T> ch.agent.crnickl.api.Series<T>[] getSeries(ch.agent.crnickl.api.Chronicle chronicle,
String[] names,
int[] numbers)
throws ch.agent.crnickl.T2DBException
ch.agent.crnickl.T2DBExceptionpublic <T> ch.agent.crnickl.api.Series<T> getSeries(ch.agent.crnickl.api.Surrogate surrogate)
throws ch.agent.crnickl.T2DBException
ch.agent.crnickl.T2DBExceptionprotected ReadMethodsForProperty getReadMethodsForProperty()
protected WriteMethodsForProperty getWriteMethodsForProperty()
public Collection<ch.agent.crnickl.api.Property<?>> getProperties(String pattern) throws ch.agent.crnickl.T2DBException
ch.agent.crnickl.T2DBExceptionpublic ch.agent.crnickl.api.Property<?> getProperty(ch.agent.crnickl.api.Surrogate surrogate)
throws ch.agent.crnickl.T2DBException
ch.agent.crnickl.T2DBExceptionpublic ch.agent.crnickl.api.Property<?> getProperty(String name) throws ch.agent.crnickl.T2DBException
ch.agent.crnickl.T2DBExceptionpublic void create(ch.agent.crnickl.api.UpdatableProperty<?> property)
throws ch.agent.crnickl.T2DBException
ch.agent.crnickl.T2DBExceptionpublic void deleteProperty(ch.agent.crnickl.api.UpdatableProperty<?> property)
throws ch.agent.crnickl.T2DBException
ch.agent.crnickl.T2DBExceptionpublic void update(ch.agent.crnickl.api.UpdatableProperty<?> property)
throws ch.agent.crnickl.T2DBException
ch.agent.crnickl.T2DBExceptionprotected ReadMethodsForValueType getReadMethodsForValueType()
protected WriteMethodsForValueType getWriteMethodsForValueType()
public Collection<ch.agent.crnickl.api.ValueType<?>> getValueTypes(String pattern) throws ch.agent.crnickl.T2DBException
ch.agent.crnickl.T2DBExceptionpublic <T> ch.agent.crnickl.api.ValueType<T> getValueType(String name) throws ch.agent.crnickl.T2DBException
ch.agent.crnickl.T2DBExceptionpublic <T> ch.agent.crnickl.api.ValueType<T> getValueType(ch.agent.crnickl.api.Surrogate surrogate)
throws ch.agent.crnickl.T2DBException
ch.agent.crnickl.T2DBExceptionpublic <T> void create(ch.agent.crnickl.api.UpdatableValueType<T> valueType)
throws ch.agent.crnickl.T2DBException
ch.agent.crnickl.T2DBExceptionpublic void deleteValueType(ch.agent.crnickl.api.UpdatableValueType<?> valueType)
throws ch.agent.crnickl.T2DBException
ch.agent.crnickl.T2DBExceptionpublic void update(ch.agent.crnickl.api.UpdatableValueType<?> valueType)
throws ch.agent.crnickl.T2DBException
ch.agent.crnickl.T2DBExceptionprotected ReadMethodsForSchema getReadMethodsForSchema()
protected WriteMethodsForSchema getWriteMethodsForSchema()
public Collection<ch.agent.crnickl.api.Surrogate> getSchemaSurrogates(String pattern) throws ch.agent.crnickl.T2DBException
ch.agent.crnickl.T2DBExceptionpublic ch.agent.crnickl.api.UpdatableSchema getUpdatableSchema(ch.agent.crnickl.api.Surrogate surrogate)
throws ch.agent.crnickl.T2DBException
ch.agent.crnickl.T2DBExceptionpublic void create(ch.agent.crnickl.api.UpdatableSchema schema)
throws ch.agent.crnickl.T2DBException
ch.agent.crnickl.T2DBExceptionpublic void update(ch.agent.crnickl.api.UpdatableSchema schema)
throws ch.agent.crnickl.T2DBException
ch.agent.crnickl.T2DBExceptionpublic void deleteSchema(ch.agent.crnickl.api.UpdatableSchema schema)
throws ch.agent.crnickl.T2DBException
ch.agent.crnickl.T2DBExceptionpublic ch.agent.crnickl.api.Surrogate findChronicle(ch.agent.crnickl.api.Schema schema)
throws ch.agent.crnickl.T2DBException
ch.agent.crnickl.T2DBExceptionpublic ch.agent.crnickl.api.Surrogate findChronicle(ch.agent.crnickl.api.Property<?> property,
ch.agent.crnickl.api.Schema schema)
throws ch.agent.crnickl.T2DBException
ch.agent.crnickl.T2DBExceptionpublic ch.agent.crnickl.api.Surrogate findChronicle(ch.agent.crnickl.api.SeriesDefinition ss,
ch.agent.crnickl.api.Schema schema)
throws ch.agent.crnickl.T2DBException
ch.agent.crnickl.T2DBExceptionpublic String toString()
toString in class ch.agent.crnickl.impl.DatabaseBackendImplCopyright © 2013. All Rights Reserved.