|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objecthelma.objectmodel.db.NodeManager
public final class NodeManager
The NodeManager is responsible for fetching Nodes from the internal or external data sources, caching them in a least-recently-used Hashtable, and writing changes back to the databases.
Field Summary | |
---|---|
protected Application |
app
|
protected IDatabase |
db
|
protected IDGenerator |
idgen
|
protected boolean |
logReplication
|
WrappedNodeManager |
safe
|
Constructor Summary | |
---|---|
NodeManager(Application app)
Create a new NodeManager for Application app. |
Method Summary | |
---|---|
void |
addNodeChangeListener(NodeChangeListener listener)
Add a listener that is notified each time a transaction commits that adds, modifies or deletes any Nodes. |
void |
clearCache()
Clear the object cache, causing all objects to be recreated. |
int |
countCacheEntries()
Get the number of elements in the object cache |
int |
countNodes(Node home,
Relation rel)
Count the nodes contained in the child collection of the home node which is defined by Relation rel. |
Node |
createNode(DbMapping dbm,
java.sql.ResultSet rs,
DbColumn[] columns,
int offset)
Create a new Node from a ResultSet. |
void |
deleteNode(IDatabase db,
ITransaction txn,
Node node)
Performs the actual deletion of a node from either the embedded or an external SQL database. |
void |
deleteNode(Node node)
Delete a node from the database. |
java.lang.String |
doGenerateID(DbMapping map)
Actually generates an ID, using a method matching the given DbMapping. |
void |
evictKey(Key key)
Used when a key stops being valid for a node. |
void |
evictNode(Node node)
Remove a node from the node cache. |
void |
evictNodeByKey(Key key)
Remove a node from the node cache. |
void |
exportNode(Node node,
DbMapping dbm)
Insert a node into a different (relational) database than its default one. |
void |
exportNode(Node node,
DbSource dbs)
Insert a node into a different (relational) database than its default one. |
protected void |
fireNodeChangeEvent(java.util.List inserted,
java.util.List updated,
java.util.List deleted,
java.util.List parents)
Called by transactors after committing. |
java.lang.String |
generateID(DbMapping map)
Generate a new ID for a given type, delegating to our IDGenerator if set. |
java.lang.Object[] |
getCacheEntries()
Get an array of the the keys currently held in the object cache |
DbMapping |
getDbMapping(java.lang.String protoname)
Get a DbMapping for a given prototype name. |
Node |
getNode(Key key)
Get a node by key. |
Node |
getNode(Node home,
java.lang.String kstr,
Relation rel)
Get a node by relation, using the home node, the relation and a key to apply. |
SubnodeList |
getNodeIDs(Node home,
Relation rel)
Loades subnodes via subnode relation. |
SubnodeList |
getNodes(Node home,
Relation rel)
Loades subnodes via subnode relation. |
java.util.Vector |
getPropertyNames(Node home,
Relation rel)
Similar to getNodeIDs, but returns a Vector that return's the nodes property names instead of IDs |
Node |
getRootNode()
Gets the application's root node. |
protected boolean |
hasNodeChangeListeners()
Let transactors know if they should collect and fire NodeChangeListener events |
void |
init(java.io.File dbHome,
java.util.Properties props)
Initialize the NodeManager for the given dbHome and application properties. |
void |
insertNode(IDatabase db,
ITransaction txn,
Node node)
Insert a new node in the embedded database or a relational database table, depending on its db mapping. |
protected void |
insertRelationalNode(Node node,
DbMapping dbm,
java.sql.Connection con)
Insert a node into a relational database. |
boolean |
isRootNode(Node node)
Checks if the given node is the application's root node. |
void |
prefetchNodes(Node home,
Relation rel,
Key[] keys)
|
void |
registerNode(Node node)
Register a node in the node cache. |
protected void |
registerNode(Node node,
Key key)
Register a node in the node cache using the key argument. |
void |
removeNodeChangeListener(NodeChangeListener listener)
Remove a previously added NodeChangeListener. |
void |
replicateCache(java.util.Vector add,
java.util.Vector delete)
Receive notification from a remote app that objects in its cache have been modified. |
void |
shutdown()
Shut down this node manager. |
boolean |
updateNode(IDatabase db,
ITransaction txn,
Node node)
Updates a modified node in the embedded db or an external relational database, depending on its database mapping. |
void |
updateProperties(java.util.Properties props)
app.properties file has been updated. |
int |
updateSubnodeList(Node home,
Relation rel)
Update a UpdateableSubnodeList retrieving all values having higher Values according to the updateCriteria's set for this Collection's Relation The returned Map-Object has two Properties: addedNodes = an Integer representing the number of Nodes added to this collection newNodes = an Integer representing the number of Records returned by the Select-Statement These two values may be different if a max-size is defined for this Collection and a new node would be outside of this Border because of the ordering of this collection. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected Application app
protected IDatabase db
protected IDGenerator idgen
protected boolean logReplication
public final WrappedNodeManager safe
Constructor Detail |
---|
public NodeManager(Application app)
Method Detail |
---|
public void init(java.io.File dbHome, java.util.Properties props) throws DatabaseException, java.lang.ClassNotFoundException, java.lang.IllegalAccessException, java.lang.InstantiationException
DatabaseException
java.lang.ClassNotFoundException
java.lang.IllegalAccessException
java.lang.InstantiationException
public Node getRootNode() throws java.lang.Exception
java.lang.Exception
public boolean isRootNode(Node node)
public void updateProperties(java.util.Properties props)
public void shutdown() throws DatabaseException
DatabaseException
public void deleteNode(Node node) throws java.lang.Exception
java.lang.Exception
public Node getNode(Key key) throws java.lang.Exception
java.lang.Exception
public Node getNode(Node home, java.lang.String kstr, Relation rel) throws java.lang.Exception
java.lang.Exception
public void registerNode(Node node)
protected void registerNode(Node node, Key key)
public void evictNode(Node node)
public void evictNodeByKey(Key key)
public void evictKey(Key key)
public void insertNode(IDatabase db, ITransaction txn, Node node) throws java.io.IOException, java.sql.SQLException, java.lang.ClassNotFoundException
java.io.IOException
java.sql.SQLException
java.lang.ClassNotFoundException
public void exportNode(Node node, DbSource dbs) throws java.sql.SQLException, java.lang.ClassNotFoundException
java.sql.SQLException
java.lang.ClassNotFoundException
public void exportNode(Node node, DbMapping dbm) throws java.sql.SQLException, java.lang.ClassNotFoundException
java.sql.SQLException
java.lang.ClassNotFoundException
protected void insertRelationalNode(Node node, DbMapping dbm, java.sql.Connection con) throws java.lang.ClassNotFoundException, java.sql.SQLException
java.lang.ClassNotFoundException
java.sql.SQLException
public boolean updateNode(IDatabase db, ITransaction txn, Node node) throws java.io.IOException, java.sql.SQLException, java.lang.ClassNotFoundException
java.io.IOException
java.sql.SQLException
java.lang.ClassNotFoundException
public void deleteNode(IDatabase db, ITransaction txn, Node node) throws java.lang.Exception
java.lang.Exception
public java.lang.String generateID(DbMapping map) throws java.lang.Exception
java.lang.Exception
public java.lang.String doGenerateID(DbMapping map) throws java.lang.Exception
java.lang.Exception
public SubnodeList getNodeIDs(Node home, Relation rel) throws java.lang.Exception
java.lang.Exception
public SubnodeList getNodes(Node home, Relation rel) throws java.lang.Exception
java.lang.Exception
public int updateSubnodeList(Node home, Relation rel) throws java.lang.Exception
home
- the home of this subnode-listrel
- the relation the home-node has to the nodes contained inside the subnodelist
java.lang.Exception
public void prefetchNodes(Node home, Relation rel, Key[] keys) throws java.lang.Exception
java.lang.Exception
public int countNodes(Node home, Relation rel) throws java.lang.Exception
java.lang.Exception
public java.util.Vector getPropertyNames(Node home, Relation rel) throws java.lang.Exception
java.lang.Exception
public Node createNode(DbMapping dbm, java.sql.ResultSet rs, DbColumn[] columns, int offset) throws java.sql.SQLException, java.io.IOException, java.lang.ClassNotFoundException
java.sql.SQLException
java.io.IOException
java.lang.ClassNotFoundException
public DbMapping getDbMapping(java.lang.String protoname)
public java.lang.Object[] getCacheEntries()
public int countCacheEntries()
public void clearCache()
public void addNodeChangeListener(NodeChangeListener listener)
public void removeNodeChangeListener(NodeChangeListener listener)
protected boolean hasNodeChangeListeners()
protected void fireNodeChangeEvent(java.util.List inserted, java.util.List updated, java.util.List deleted, java.util.List parents)
public void replicateCache(java.util.Vector add, java.util.Vector delete)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |