|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.sag.osami.contextstore.ContextStoreBuilder
public class ContextStoreBuilder
This builder class can be used in non-OSGi-evnironments to configure and create a ContextStore instance conveniently.
It is also used internally in the OsgiContextStoreActivator
(using registered OSGi services as the respective implementations).
It provides methods (all of which return the builder itself, allowing to chain the configuration in one line) for configuring:
storeID(String)
serializer(ISerializationHandler)
storage(ISerializedContextStorage)
jdbcDialect(IJDBCDialect)
Following properties can be configured:
"contextstore_id"
: the context store ID
JDBCStorage
for JDBC-related properties
ContextStore store = new ContextStoreBuilder().build();
Field Summary | |
---|---|
static java.lang.String |
CONFIG_STORE_ID
|
Constructor Summary | |
---|---|
ContextStoreBuilder()
Creates a new ContextStore builder with defaults. |
|
ContextStoreBuilder(java.io.File propsFile)
Creates a new ContextStore builder, overriding defaults with the properties from the given file. |
|
ContextStoreBuilder(java.util.Properties props)
Creates a new ContextStore builder, overriding defaults with the given properties. |
Method Summary | |
---|---|
ContextStore |
build()
Builds the ContextStore according to the configuration. |
ContextStoreBuilder |
jdbcDialect(IJDBCDialect jdbcDialect)
Sets the dialect to be used by the JDBCStorage . |
ContextStoreBuilder |
serializer(ISerializationHandler serializer)
Sets the serialization handler implementation, which is used for serializing and deserializing context events (e.g. when persisting). |
ContextStoreBuilder |
storage(ISerializedContextStorage storage)
Sets the storage implementation, which is responsible for persisting, loading and querying context events. |
ContextStoreBuilder |
storeID(java.lang.String storeID)
Sets the context store ID as used in ContextEvent.getContextStoreOriginID() . |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final java.lang.String CONFIG_STORE_ID
Constructor Detail |
---|
public ContextStoreBuilder(java.util.Properties props)
props
- configuration propertiespublic ContextStoreBuilder(java.io.File propsFile)
propsFile
- '.properties' filepublic ContextStoreBuilder()
Method Detail |
---|
public ContextStoreBuilder serializer(ISerializationHandler serializer)
Default: JSONSerializer
serializer
- the implementation of the serialization handler
public ContextStoreBuilder storage(ISerializedContextStorage storage)
Default: JDBCStorage
with DerbyDialect
and DerbyDialect.DEFAULT_URL
.
storage
- the implementation of the storage
jdbcDialect(IJDBCDialect)
public ContextStoreBuilder jdbcDialect(IJDBCDialect jdbcDialect)
JDBCStorage
.
Default: DerbyDialect
jdbcDialect
- the implementation of the JDBC dialect
public ContextStoreBuilder storeID(java.lang.String storeID)
ContextEvent.getContextStoreOriginID()
.
Default: hostname of the executing machine
storeID
- the context store ID
public ContextStore build()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |