Package com.codingchili.core.context
Class StorageContext<Value>
java.lang.Object
com.codingchili.core.context.SystemContext
com.codingchili.core.context.StorageContext<Value>
- All Implemented Interfaces:
- CoreContext
context used by storage plugins.
- 
Field SummaryFields inherited from class com.codingchili.core.context.SystemContextvertx
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionget the name of the collection within the database used by the context.database()get the name of the database used by the context.voidhandles a handler successfully with the given value.host()voidCalled when the collection has been dropped/cleared.voidonWatcherCompleted(String name, int affected)Called when a value failed to expire as it was not found.voidonWatcherFailed(String name, String cause)Called when a value has been expired by ttl.voidonWatcherPaused(String name)voidonWatcherResumed(String name)Class<? extends AsyncStorage>plugin()port()io.vertx.core.json.JsonObjectsets the class that is used for deserialization.setCollection(String collection)sets the collection context of the storage engine.setDatabase(String database)sets the database name to be usedsetPlugin(Class<? extends AsyncStorage> plugin)sets the storage plugin name the context is bound to so that configuration for it may be retrieved.setProperties(io.vertx.core.json.JsonObject properties)protected StorageSettingssettings()storage()io.vertx.core.json.JsonObjectconverts the given object of generic type into a json object.byte[]converts the given object of generic type into a byte arraytoValue(io.vertx.core.json.JsonObject json)converts a json object into the generic template used by a storageconverts a byte array to a value using the deserialization template classbooleanvalidate(Comparable comparable)Validates that the given string consists only of plaintext and is at least as long as the specified number of feedback-characters.Methods inherited from class com.codingchili.core.context.SystemContextblocking, blocking, bus, cancel, close, close, clustered, deploy, handler, listener, metrics, metrics, periodic, service, stop, stop, system, timer, vertxMethods inherited from class java.lang.Objectclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.codingchili.core.context.CoreContextfileSystem
- 
Constructor Details- 
StorageContextpublic StorageContext()
- 
StorageContext
 
- 
- 
Method Details- 
logger- Specified by:
- loggerin interface- CoreContext
- Overrides:
- loggerin class- SystemContext
- Parameters:
- aClass- added as metadata to all logged events.
- Returns:
- get a new instance of a logger.
 
- 
settings- Returns:
- get the storage settings.
 
- 
storage- Returns:
- get the storage settings for the current plugin.
 
- 
propertiespublic io.vertx.core.json.JsonObject properties()
- 
valueClass- Returns:
- the class to be stored in the storage.
 
- 
plugin- Returns:
- the plugin identifier to us as storage.
 
- 
toValueconverts a json object into the generic template used by a storage- Parameters:
- json- the json object to convert
- Returns:
- json mapped to an object of generic type
 
- 
toValueconverts a byte array to a value using the deserialization template class- Parameters:
- string- a json-formatted string
- Returns:
- generic Value inflated using the bytes and template class.
 
- 
toJsonconverts the given object of generic type into a json object.- Parameters:
- object- the object to be converted to json
- Returns:
- the serialized form of the given object
 
- 
toPackedconverts the given object of generic type into a byte array- Parameters:
- value- the object to be converted
- Returns:
- a byte array created from the serialized objects json text
 
- 
handlehandles a handler successfully with the given value.- Parameters:
- handler- the handler to be handled
- value- the value to send the handler.
 
- 
databaseget the name of the database used by the context.- Returns:
- the name of the database as a string
 
- 
collectionget the name of the collection within the database used by the context.- Returns:
- the name of the collection as a string.
 
- 
port- Returns:
- the port of a remote database if configured.
 
- 
host- Returns:
- the hostname of a remote database if configured.
 
- 
validateValidates that the given string consists only of plaintext and is at least as long as the specified number of feedback-characters.- Parameters:
- comparable- the text to check if plaintext
- Returns:
- true if the given comparable contains only plaintext
 
- 
minFeedbackChars
- 
maxResults- Returns:
- the number of results all queries are limited to.
 
- 
onWatcherFailedCalled when a value has been expired by ttl.- Parameters:
- name- the id of the object that was expired.
- cause- the reason why invocation failed.
 
- 
onWatcherCompletedCalled when a value failed to expire as it was not found.- Parameters:
- name- the id of the object that was expired.
- affected- the number of items affected by the query.
 
- 
onWatcherPaused
- 
onWatcherResumed
- 
onCollectionDroppedpublic void onCollectionDropped()Called when the collection has been dropped/cleared.
- 
setClasssets the class that is used for deserialization. This should be the same or a supertype of the object type in the storage.- Parameters:
- aClass- the class template to inflate
- Returns:
- fluent
 
- 
setCollectionsets the collection context of the storage engine.- Parameters:
- collection- name of the collection
- Returns:
- fluent
 
- 
setDatabasesets the database name to be used- Parameters:
- database- name as string
- Returns:
- fluent
 
- 
setProperties- Parameters:
- properties- implementation specific configuration options.
- Returns:
- fluent
 
- 
setPluginsets the storage plugin name the context is bound to so that configuration for it may be retrieved.- Parameters:
- plugin- fully qualified class name as String.
- Returns:
- fluent
 
- 
identifier- Returns:
- storage identifier.
 
 
-