ch.agent.crnickl.jdbc
Class JDBCDatabase

java.lang.Object
  extended by ch.agent.crnickl.impl.DatabaseBackendImpl
      extended by ch.agent.crnickl.jdbc.JDBCDatabase
All Implemented Interfaces:
ch.agent.crnickl.api.Database, ch.agent.crnickl.impl.DatabaseBackend, ch.agent.crnickl.impl.PermissionChecker

public class JDBCDatabase
extends ch.agent.crnickl.impl.DatabaseBackendImpl

A JDBC implementation of DatabaseBackendImpl.

Author:
Jean-Paul Vetterli

Field Summary
 
Fields inherited from interface ch.agent.crnickl.impl.DatabaseBackend
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 Summary
JDBCDatabase(String name)
          Construct a DatabaseBackend.
 
Method Summary
 void commit()
           
 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 schemas)
           
 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)
           
 Connection getConnection()
           
 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.
 void rollback()
           
 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)
           
 
Methods inherited from class ch.agent.crnickl.impl.DatabaseBackendImpl
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, isChronicleUpdatePolicyExtensionAllowed, isChronicleUpdatePolicyExtensionMandatory, isStrictNameSpaceMode, publish, setAccessMethods, setMessageListener, setStrictNameSpaceMode, update, update
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

JDBCDatabase

public JDBCDatabase(String name)
Construct a DatabaseBackend.

Parameters:
name - the name of the database
Method Detail

configure

public void configure(ch.agent.crnickl.api.DatabaseConfiguration configuration)
               throws ch.agent.crnickl.T2DBException
Specified by:
configure in interface ch.agent.crnickl.api.Database
Overrides:
configure in class ch.agent.crnickl.impl.DatabaseBackendImpl
Throws:
ch.agent.crnickl.T2DBException

getSchemaUpdatePolicy

public ch.agent.crnickl.impl.SchemaUpdatePolicy getSchemaUpdatePolicy()
Specified by:
getSchemaUpdatePolicy in interface ch.agent.crnickl.impl.DatabaseBackend
Overrides:
getSchemaUpdatePolicy in class ch.agent.crnickl.impl.DatabaseBackendImpl

getConnection

public Connection getConnection()
                         throws ch.agent.crnickl.T2DBException
Throws:
ch.agent.crnickl.T2DBException

commit

public void commit()
            throws ch.agent.crnickl.T2DBException
Throws:
ch.agent.crnickl.T2DBException

rollback

public void rollback()
              throws ch.agent.crnickl.T2DBException
Throws:
ch.agent.crnickl.T2DBException

getReadMethodsForChronicleAndSeries

protected ReadMethodsForChroniclesAndSeries getReadMethodsForChronicleAndSeries()
Return the object providing read methods for chronicles and series.

Returns:
the object providing read methods for chronicles and series

getWriteMethodsForChroniclesAndSeries

protected WriteMethodsForChroniclesAndSeries getWriteMethodsForChroniclesAndSeries()
Return the object providing write methods for chronicles and series.

Returns:
the object providing write methods for chronicles and series

create

public void create(ch.agent.crnickl.api.UpdatableChronicle entity)
            throws ch.agent.crnickl.T2DBException
Throws:
ch.agent.crnickl.T2DBException

update

public void update(ch.agent.crnickl.api.UpdatableChronicle entity)
            throws ch.agent.crnickl.T2DBException
Throws:
ch.agent.crnickl.T2DBException

deleteAttributeValue

public void deleteAttributeValue(ch.agent.crnickl.api.UpdatableChronicle entity,
                                 ch.agent.crnickl.api.AttributeDefinition<?> def)
                          throws ch.agent.crnickl.T2DBException
Throws:
ch.agent.crnickl.T2DBException

update

public void update(ch.agent.crnickl.api.UpdatableChronicle entity,
                   ch.agent.crnickl.api.AttributeDefinition<?> def,
                   String value,
                   String description)
            throws ch.agent.crnickl.T2DBException
Throws:
ch.agent.crnickl.T2DBException

deleteChronicle

public void deleteChronicle(ch.agent.crnickl.api.UpdatableChronicle entity)
                     throws ch.agent.crnickl.T2DBException
Throws:
ch.agent.crnickl.T2DBException

create

public <T> void create(ch.agent.crnickl.api.UpdatableSeries<T> series)
            throws ch.agent.crnickl.T2DBException
Throws:
ch.agent.crnickl.T2DBException

deleteSeries

public <T> void deleteSeries(ch.agent.crnickl.api.UpdatableSeries<T> series)
                  throws ch.agent.crnickl.T2DBException
Throws:
ch.agent.crnickl.T2DBException

getChronicle

public ch.agent.crnickl.api.Chronicle getChronicle(ch.agent.crnickl.api.Chronicle chronicle)
                                            throws ch.agent.crnickl.T2DBException
Throws:
ch.agent.crnickl.T2DBException

getChronicleOrNull

public ch.agent.crnickl.api.Chronicle getChronicleOrNull(ch.agent.crnickl.api.Chronicle parent,
                                                         String simpleName)
                                                  throws ch.agent.crnickl.T2DBException
Throws:
ch.agent.crnickl.T2DBException

getChroniclesByParent

public Collection<ch.agent.crnickl.api.Chronicle> getChroniclesByParent(ch.agent.crnickl.api.Chronicle parent)
                                                                 throws ch.agent.crnickl.T2DBException
Throws:
ch.agent.crnickl.T2DBException

getChroniclesByAttributeValue

public <T> List<ch.agent.crnickl.api.Chronicle> getChroniclesByAttributeValue(ch.agent.crnickl.api.Property<T> property,
                                                                              T value,
                                                                              int maxSize)
                                                                   throws ch.agent.crnickl.T2DBException
Throws:
ch.agent.crnickl.T2DBException

getAttributeValue

public boolean getAttributeValue(List<ch.agent.crnickl.api.Chronicle> chronicles,
                                 ch.agent.crnickl.api.Attribute<?> attribute)
                          throws ch.agent.crnickl.T2DBException
Throws:
ch.agent.crnickl.T2DBException

getSeries

public <T> ch.agent.crnickl.api.Series<T>[] getSeries(ch.agent.crnickl.api.Chronicle chronicle,
                                                      String[] names,
                                                      int[] numbers)
                                           throws ch.agent.crnickl.T2DBException
Throws:
ch.agent.crnickl.T2DBException

getSeries

public <T> ch.agent.crnickl.api.Series<T> getSeries(ch.agent.crnickl.api.Surrogate surrogate)
                                         throws ch.agent.crnickl.T2DBException
Throws:
ch.agent.crnickl.T2DBException

getReadMethodsForProperty

protected ReadMethodsForProperty getReadMethodsForProperty()
Return the object providing read methods for properties.

Returns:
the object providing read methods for properties

getWriteMethodsForProperty

protected WriteMethodsForProperty getWriteMethodsForProperty()
Return the object providing write methods for properties.

Returns:
the object providing write methods for properties

getProperties

public Collection<ch.agent.crnickl.api.Property<?>> getProperties(String pattern)
                                                           throws ch.agent.crnickl.T2DBException
Throws:
ch.agent.crnickl.T2DBException

getProperty

public ch.agent.crnickl.api.Property<?> getProperty(ch.agent.crnickl.api.Surrogate surrogate)
                                             throws ch.agent.crnickl.T2DBException
Throws:
ch.agent.crnickl.T2DBException

getProperty

public ch.agent.crnickl.api.Property<?> getProperty(String name)
                                             throws ch.agent.crnickl.T2DBException
Throws:
ch.agent.crnickl.T2DBException

create

public void create(ch.agent.crnickl.api.UpdatableProperty<?> property)
            throws ch.agent.crnickl.T2DBException
Throws:
ch.agent.crnickl.T2DBException

deleteProperty

public void deleteProperty(ch.agent.crnickl.api.UpdatableProperty<?> property)
                    throws ch.agent.crnickl.T2DBException
Throws:
ch.agent.crnickl.T2DBException

update

public void update(ch.agent.crnickl.api.UpdatableProperty<?> property)
            throws ch.agent.crnickl.T2DBException
Throws:
ch.agent.crnickl.T2DBException

getReadMethodsForValueType

protected ReadMethodsForValueType getReadMethodsForValueType()
Return the object providing read methods for value types.

Returns:
the object providing read methods for value types

getWriteMethodsForValueType

protected WriteMethodsForValueType getWriteMethodsForValueType()
Return the object providing write methods for value types.

Returns:
the object providing write methods for value types

getValueTypes

public Collection<ch.agent.crnickl.api.ValueType<?>> getValueTypes(String pattern)
                                                            throws ch.agent.crnickl.T2DBException
Throws:
ch.agent.crnickl.T2DBException

getValueType

public <T> ch.agent.crnickl.api.ValueType<T> getValueType(String name)
                                               throws ch.agent.crnickl.T2DBException
Throws:
ch.agent.crnickl.T2DBException

getValueType

public <T> ch.agent.crnickl.api.ValueType<T> getValueType(ch.agent.crnickl.api.Surrogate surrogate)
                                               throws ch.agent.crnickl.T2DBException
Throws:
ch.agent.crnickl.T2DBException

create

public <T> void create(ch.agent.crnickl.api.UpdatableValueType<T> valueType)
            throws ch.agent.crnickl.T2DBException
Throws:
ch.agent.crnickl.T2DBException

deleteValueType

public void deleteValueType(ch.agent.crnickl.api.UpdatableValueType<?> valueType)
                     throws ch.agent.crnickl.T2DBException
Throws:
ch.agent.crnickl.T2DBException

update

public void update(ch.agent.crnickl.api.UpdatableValueType<?> valueType)
            throws ch.agent.crnickl.T2DBException
Throws:
ch.agent.crnickl.T2DBException

getReadMethodsForSchema

protected ReadMethodsForSchema getReadMethodsForSchema()
Return the object providing read methods for schemas.

Returns:
the object providing read methods for schemass

getWriteMethodsForSchema

protected WriteMethodsForSchema getWriteMethodsForSchema()
Return the object providing write methods for schemas.

Returns:
the object providing write methods for schemas

getSchemaSurrogates

public Collection<ch.agent.crnickl.api.Surrogate> getSchemaSurrogates(String pattern)
                                                               throws ch.agent.crnickl.T2DBException
Throws:
ch.agent.crnickl.T2DBException

getUpdatableSchema

public ch.agent.crnickl.api.UpdatableSchema getUpdatableSchema(ch.agent.crnickl.api.Surrogate surrogate)
                                                        throws ch.agent.crnickl.T2DBException
Throws:
ch.agent.crnickl.T2DBException

create

public void create(ch.agent.crnickl.api.UpdatableSchema schema)
            throws ch.agent.crnickl.T2DBException
Throws:
ch.agent.crnickl.T2DBException

update

public void update(ch.agent.crnickl.api.UpdatableSchema schema)
            throws ch.agent.crnickl.T2DBException
Throws:
ch.agent.crnickl.T2DBException

deleteSchema

public void deleteSchema(ch.agent.crnickl.api.UpdatableSchema schema)
                  throws ch.agent.crnickl.T2DBException
Throws:
ch.agent.crnickl.T2DBException

findChronicle

public ch.agent.crnickl.api.Surrogate findChronicle(ch.agent.crnickl.api.Schema schema)
                                             throws ch.agent.crnickl.T2DBException
Throws:
ch.agent.crnickl.T2DBException

findChronicle

public ch.agent.crnickl.api.Surrogate findChronicle(ch.agent.crnickl.api.Property<?> property,
                                                    ch.agent.crnickl.api.Schema schemas)
                                             throws ch.agent.crnickl.T2DBException
Throws:
ch.agent.crnickl.T2DBException

findChronicle

public ch.agent.crnickl.api.Surrogate findChronicle(ch.agent.crnickl.api.SeriesDefinition ss,
                                                    ch.agent.crnickl.api.Schema schema)
                                             throws ch.agent.crnickl.T2DBException
Throws:
ch.agent.crnickl.T2DBException

toString

public String toString()
Overrides:
toString in class ch.agent.crnickl.impl.DatabaseBackendImpl


Copyright © 2013. All Rights Reserved.