org.persvr.datasource
Class HttpJsonSource
java.lang.Object
org.persvr.remote.JsonReceiver
org.persvr.datasource.AbstractJsonSource
org.persvr.datasource.HttpJsonSource
- All Implemented Interfaces:
- DataSource, ListDataSource, WritableDataSource
public class HttpJsonSource
- extends AbstractJsonSource
- implements WritableDataSource
|
Method Summary |
java.lang.Object |
getFieldValue(LazyPropertyId valueId)
This is called when a field value contains an unfulfilled value (ValueId) |
protected java.lang.Object |
getJson(java.lang.String objectId)
Gets the JSON string for a particular object id. |
protected static java.lang.Object |
getThreadValue(java.lang.Object key)
|
ObjectId |
idFromJSPONObject(java.util.Map object,
ObjectId defaultId)
|
void |
initParameters(java.util.Map<java.lang.String,java.lang.Object> parameters)
This is called on initialization and provides access to the data source configuration parameters |
java.util.Iterator |
mapQuery(Query query)
This is called when an object is being activated to retrieve the persisted data for a given object with a filter |
protected void |
newJson(java.lang.String json)
|
protected static void |
putThreadValue(java.lang.Object key,
java.lang.Object value)
|
void |
recordDelete(java.lang.String objectId)
This is called when an object should be deleted |
protected void |
setJson(java.lang.String resourceName,
java.lang.String json)
|
static java.lang.String |
slurp(java.io.InputStream in)
|
| Methods inherited from class org.persvr.datasource.AbstractJsonSource |
abortTransaction, commitTransaction, convertJsonToJavaScript, getId, getMap, getPathSeparator, getResourceAsString, handleNewObject, hiddenId, makeDirty, mapJson, mapObject, mapSchema, recordList, recordNewObject, recordPropertyAddition, recordPropertyChange, recordPropertyRemoval, serialize, setId, startTransaction |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
HttpJsonSource
public HttpJsonSource()
setJson
protected void setJson(java.lang.String resourceName,
java.lang.String json)
throws java.lang.Exception
- Specified by:
setJson in class AbstractJsonSource
- Throws:
java.lang.Exception
newJson
protected void newJson(java.lang.String json)
throws java.lang.Exception
- Specified by:
newJson in class AbstractJsonSource
- Throws:
java.lang.Exception
getJson
protected java.lang.Object getJson(java.lang.String objectId)
throws HttpException,
java.io.IOException
- Description copied from class:
AbstractJsonSource
- Gets the JSON string for a particular object id. This is called when an object needs to be initialized,
and this AbstractJsonSource/JsonReceiver will handle the conversion of the JSON
string to an object
- Specified by:
getJson in class AbstractJsonSource
- Returns:
- the JSON string
- Throws:
HttpException
java.io.IOException
initParameters
public void initParameters(java.util.Map<java.lang.String,java.lang.Object> parameters)
- Description copied from interface:
DataSource
- This is called on initialization and provides access to the data source configuration parameters
- Specified by:
initParameters in interface DataSource
getFieldValue
public java.lang.Object getFieldValue(LazyPropertyId valueId)
throws java.lang.Exception
- Description copied from interface:
DataSource
- This is called when a field value contains an unfulfilled value (ValueId)
- Specified by:
getFieldValue in interface DataSource
- Returns:
- the real value referred to by valueId
- Throws:
java.lang.Exception
putThreadValue
protected static void putThreadValue(java.lang.Object key,
java.lang.Object value)
getThreadValue
protected static java.lang.Object getThreadValue(java.lang.Object key)
idFromJSPONObject
public ObjectId idFromJSPONObject(java.util.Map object,
ObjectId defaultId)
- Specified by:
idFromJSPONObject in class JsonReceiver
recordDelete
public void recordDelete(java.lang.String objectId)
throws java.lang.Exception
- Description copied from interface:
WritableDataSource
- This is called when an object should be deleted
- Specified by:
recordDelete in interface WritableDataSource
- Throws:
java.lang.Exception
mapQuery
public java.util.Iterator mapQuery(Query query)
throws java.lang.Exception
- Description copied from interface:
DataSource
- This is called when an object is being activated to retrieve the persisted data for a given object with a filter
- Specified by:
mapQuery in interface DataSource
- Returns:
-
- Throws:
java.lang.Exception
slurp
public static java.lang.String slurp(java.io.InputStream in)
throws java.io.IOException
- Throws:
java.io.IOException