|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.hippoecm.hst.mock.content.beans.manager.MockObjectBeanPersistenceManager
public class MockObjectBeanPersistenceManager
Simple in-memory implementation for MockObjectBeanPersistenceManager
interface.
This implementation assumes that a content object has 'path' bean property to indicate
from which absolute path the content object is originated.
So, it will use getPath()
method to read the original absolute path to update
or remove the object.
The absolute content paths and objects mapped to the paths are stored in maps.
To store an object to maps, it uses Java Serialization.
Therefore, the object used with this implementation should implement
java.io.Serializable
, public boolean equals(Object object);
and public int hashCode();
properly.
By the way, this mock implementation does not have any knowledge on how to create a new content based on its node type.
Constructor Summary | |
---|---|
MockObjectBeanPersistenceManager()
|
Method Summary | |
---|---|
protected Object |
bytesToObject(byte[] bytes)
|
void |
create(String absPath,
String nodeTypeName,
String name)
Creates content node(s) with the specified node type at the specified absolute path. |
void |
create(String absPath,
String nodeTypeName,
String name,
boolean autoCreateFolders)
Creates content node(s) with the specified node type at the specified absolute path. |
String |
createAndReturn(String absPath,
String nodeTypeName,
String name,
boolean autoCreateFolders)
Creates content node(s) with the specified node type at the specified absolute path. |
Object |
getObject(String absPath)
Get an object from the JCR repository. |
Object |
getObjectByUuid(String uuid)
Get an object from the JCR repository |
protected String |
getPathProperty(Object object)
|
protected Object |
getSerializedCopy(Object object)
|
javax.jcr.Session |
getSession()
This method returns the JCR session. |
protected String |
getUuidProperty(Object object)
|
protected byte[] |
objectToBytes(Object object)
|
void |
refresh()
Invokes Session.refresh(boolean) with false parameter. |
void |
refresh(boolean keepChanges)
Invokes Session.refresh(boolean) . |
void |
remove(Object content)
Removes the content node which is mapped to the object. |
void |
save()
Saves all pending changes. |
void |
setObject(String absPath,
Object object)
|
void |
update(Object content)
Updates the content node which is mapped to the object. |
void |
update(Object content,
ContentNodeBinder customBinder)
Updates the content node which is mapped to the object by the customContentNodeBinder
provided by client. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public MockObjectBeanPersistenceManager()
Method Detail |
---|
public Object getObject(String absPath) throws ObjectBeanPersistenceException
ObjectBeanManager
path
is the absolute object path and must start with a "/"
getObject
in interface ObjectBeanManager
absPath
- the absolute object path.
ObjectBeanPersistenceException
public Object getObjectByUuid(String uuid) throws ObjectBeanPersistenceException
ObjectBeanManager
getObjectByUuid
in interface ObjectBeanManager
ObjectBeanPersistenceException
public void setObject(String absPath, Object object) throws ObjectBeanPersistenceException
ObjectBeanPersistenceException
public void create(String absPath, String nodeTypeName, String name) throws ObjectBeanPersistenceException
ObjectBeanPersistenceManager
The absolute path could be regarded differently according to physical implementations. For example, an implementation can regard the path as a simple one to create a simple JCR node. On the other hand, a sophisticated implementation can regard the path as an input for a workflow-enabled document/folder path.
create
in interface ObjectBeanPersistenceManager
absPath
- the absolute node pathnodeTypeName
- the node type name of the content objectname
- the content node name
ObjectBeanPersistenceException
public void create(String absPath, String nodeTypeName, String name, boolean autoCreateFolders) throws ObjectBeanPersistenceException
ObjectBeanPersistenceManager
The absolute path could be regarded differently according to physical implementations. For example, an implementation can regard the path as a simple one to create a simple JCR node. On the other hand, a sophisticated implementation can regard the path as an input for a workflow-enabled document/folder path.
If autoCreateFolders
is true, then folders will be automatically created.
create
in interface ObjectBeanPersistenceManager
absPath
- the absolute node pathnodeTypeName
- the node type name of the content objectname
- the content node nameautoCreateFolders
- the flag to create folders
ObjectBeanPersistenceException
public String createAndReturn(String absPath, String nodeTypeName, String name, boolean autoCreateFolders) throws ObjectBeanPersistenceException
ObjectBeanPersistenceManager
The absolute path could be regarded differently according to physical implementations. For example, an implementation can regard the path as a simple one to create a simple JCR node. On the other hand, a sophisticated implementation can regard the path as an input for a workflow-enabled document/folder path.
If autoCreateFolders
is true, then folders will be automatically created.
createAndReturn
in interface ObjectBeanPersistenceManager
absPath
- the absolute node pathnodeTypeName
- the node type name of the content objectname
- the content node nameautoCreateFolders
- the flag to create folders
ObjectBeanPersistenceException
public void update(Object content) throws ObjectBeanPersistenceException
ObjectBeanPersistenceManager
An implementation can provide binding the content object to the physical JCR node(s) and updates.
An implementation can provide automatic content binding, or another requires pre-registered
ContentNodeBinder
map to do real bindings. It probably depends on the functionalities
of underlying repository.
update
in interface ObjectBeanPersistenceManager
ObjectBeanPersistenceException
public void update(Object content, ContentNodeBinder customBinder) throws ObjectBeanPersistenceException
ObjectBeanPersistenceManager
customContentNodeBinder
provided by client.
Unlike ObjectBeanPersistenceManager.update(Object)
, the implementation should not try to do automatic or predefined bindings.
Instead, it should invoke customContentNodeBinder
to do bindings.
Therefore, if a developer wants to customize the bindings, the developer should provide a customContentNodeBinder
.
update
in interface ObjectBeanPersistenceManager
ObjectBeanPersistenceException
public void remove(Object content) throws ObjectBeanPersistenceException
ObjectBeanPersistenceManager
remove
in interface ObjectBeanPersistenceManager
ObjectBeanPersistenceException
public void save() throws ObjectBeanPersistenceException
ObjectBeanPersistenceManager
save
in interface ObjectBeanPersistenceManager
ObjectBeanPersistenceException
public void refresh() throws ObjectBeanPersistenceException
ObjectBeanPersistenceManager
Session.refresh(boolean)
with false
parameter.
refresh
in interface ObjectBeanPersistenceManager
ObjectBeanPersistenceException
public void refresh(boolean keepChanges) throws ObjectBeanPersistenceException
ObjectBeanPersistenceManager
Session.refresh(boolean)
.
refresh
in interface ObjectBeanPersistenceManager
ObjectBeanPersistenceException
protected String getPathProperty(Object object)
protected String getUuidProperty(Object object)
protected Object getSerializedCopy(Object object) throws ObjectBeanPersistenceException
ObjectBeanPersistenceException
protected byte[] objectToBytes(Object object) throws ObjectBeanPersistenceException
ObjectBeanPersistenceException
protected Object bytesToObject(byte[] bytes) throws ObjectBeanPersistenceException
ObjectBeanPersistenceException
public javax.jcr.Session getSession()
ObjectBeanManager
getSession
in interface ObjectBeanManager
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |