org.persvr.datasource
Class LocalJsonFileSource
java.lang.Object
org.persvr.remote.JsonReceiver
org.persvr.datasource.AbstractJsonSource
org.persvr.datasource.LocalJsonFileSource
- All Implemented Interfaces:
- ChangeableData, DataSource, ListDataSource, WritableDataSource, PersevereFilter.LocalDataSource
public class LocalJsonFileSource
- extends AbstractJsonSource
- implements PersevereFilter.LocalDataSource, WritableDataSource, ChangeableData
|
Method Summary |
boolean |
doesObjectNeedUpdating(java.lang.String objectId)
This indicates how long an object can be accessed by id before an id request should
go back to the data source for an update. |
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 resourceName)
Gets the JSON string for a particular object id. |
java.lang.String |
getPathSeparator()
|
protected 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 |
protected void |
mapJson(PersistableInitializer initializer,
java.lang.Object object,
java.lang.String objectId)
|
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)
|
boolean |
passThrough()
|
void |
recordDelete(java.lang.String objectId)
This is called when an object should be deleted |
NewObjectPersister |
recordNewObject(Persistable object)
This is called when a new object is persisted |
protected void |
setJson(java.lang.String resourceName,
java.lang.String json)
|
static void |
setLocalJsonPath(java.lang.String localJsonPath)
|
| Methods inherited from class org.persvr.datasource.AbstractJsonSource |
abortTransaction, commitTransaction, convertJsonToJavaScript, getId, getMap, getResourceAsString, handleNewObject, hiddenId, makeDirty, mapObject, mapSchema, recordList, recordPropertyAddition, recordPropertyChange, recordPropertyRemoval, serialize, setId, startTransaction |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
LOCAL_JSPON_RELATIVE_PATH
public static final java.lang.String LOCAL_JSPON_RELATIVE_PATH
- See Also:
- Constant Field Values
localPath
protected java.lang.String localPath
pathSeparator
public static final java.lang.String pathSeparator
- See Also:
- Constant Field Values
LocalJsonFileSource
public LocalJsonFileSource()
doesObjectNeedUpdating
public boolean doesObjectNeedUpdating(java.lang.String objectId)
- Description copied from interface:
ChangeableData
- This indicates how long an object can be accessed by id before an id request should
go back to the data source for an update.
- Specified by:
doesObjectNeedUpdating in interface ChangeableData
- Returns:
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
recordNewObject
public NewObjectPersister recordNewObject(Persistable object)
throws java.lang.Exception
- Description copied from interface:
WritableDataSource
- This is called when a new object is persisted
- Specified by:
recordNewObject in interface WritableDataSource- Overrides:
recordNewObject in class AbstractJsonSource
- Returns:
- persister
- Throws:
java.lang.Exception
setLocalJsonPath
public static void setLocalJsonPath(java.lang.String localJsonPath)
getJson
protected java.lang.Object getJson(java.lang.String resourceName)
throws java.lang.Exception
- 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:
java.lang.Exception
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
getPathSeparator
public java.lang.String getPathSeparator()
- Overrides:
getPathSeparator in class AbstractJsonSource
mapJson
protected void mapJson(PersistableInitializer initializer,
java.lang.Object object,
java.lang.String objectId)
- Overrides:
mapJson in class AbstractJsonSource
idFromJSPONObject
protected ObjectId idFromJSPONObject(java.util.Map object,
ObjectId defaultId)
- Specified by:
idFromJSPONObject in class JsonReceiver
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
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
passThrough
public boolean passThrough()
- Specified by:
passThrough in interface PersevereFilter.LocalDataSource
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
newJson
protected void newJson(java.lang.String json)
throws java.lang.Exception
- Specified by:
newJson in class AbstractJsonSource
- Throws:
java.lang.Exception