public interface ObjDB extends TypeResolver
Modifier and Type | Method and Description |
---|---|
void |
addClass(String tag,
Class<?> type)
Inform the object database about a mapping from a JSON object type tag
string to a Java class.
|
void |
getObject(String ref,
String collectionName,
ArgRunnable handler)
Fetch an object from the object database.
|
void |
putObject(String ref,
Encodable obj,
String collectionName,
boolean requireNew,
ArgRunnable handler)
Store an object into the object database.
|
void |
queryObjects(JSONObject template,
String collectionName,
int maxResults,
ArgRunnable handler)
Query one or more objects from the object database.
|
void |
removeObject(String ref,
String collectionName,
ArgRunnable handler)
Delete an object from the object database.
|
void |
shutdown()
Shutdown the object database.
|
void |
updateObject(String ref,
int version,
Encodable obj,
String collectionName,
ArgRunnable handler)
Update an object in the object database.
|
resolveType
void addClass(String tag, Class<?> type)
tag
- The JSON object type tag string.type
- The class that 'tag' labels.void getObject(String ref, String collectionName, ArgRunnable handler)
ref
- Reference string naming the object desired.collectionName
- Name of collection to get from, or null to take
the configured default (or the db doesn't use this abstraction).handler
- Handler to be called with the result. The result will
be the object requested, or null if the object could not be
retrieved.void putObject(String ref, Encodable obj, String collectionName, boolean requireNew, ArgRunnable handler)
ref
- Reference string naming the object to be stored.obj
- The object to be stored.collectionName
- Name of collection to put into, or null to take
the configured default (or the db doesn't use this abstraction).requireNew
- If true, require that the object with the given ref
not already existhandler
- Handler to be called with the result. The result will
be a status indicator: an error message string if there was an error,
or null if the operation was successful.void queryObjects(JSONObject template, String collectionName, int maxResults, ArgRunnable handler)
template
- Template object for the objects desired.collectionName
- Name of collection to query, or null to take the
configured default.maxResults
- Maximum number of result objects to return, or 0 to
indicate no fixed limit.handler
- Handler to be called with the results. The results will
be an array of the object(s) requested, or null if no objects could
be retrieved.void removeObject(String ref, String collectionName, ArgRunnable handler)
ref
- Reference string naming the object to remove.collectionName
- Name of collection to delete from, or null to
take the configured default (or the db doesn't use this abstraction).handler
- Handler to be called with the result. The result will
be a status indicator: an error message string if there was an error,
or null if the operation was successful.void shutdown()
void updateObject(String ref, int version, Encodable obj, String collectionName, ArgRunnable handler)
ref
- Reference string naming the object to be stored.version
- Version number of the object to be updated.obj
- The object to be stored.collectionName
- Name of collection to put into, or null to take
the configured default (or the db doesn't use this abstraction).handler
- Handler to be called with the result. The result will
be a status indicator: an error message string if there was an error,
or null if the operation was successful.Copyright © 2017. All rights reserved.