| java.lang.Object helma.objectmodel.db.NodeManager
NodeManager | final public class NodeManager (Code) | | 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.
|
Method Summary | |
public void | addNodeChangeListener(NodeChangeListener listener) Add a listener that is notified each time a transaction commits
that adds, modifies or deletes any Nodes. | public void | clearCache() Clear the object cache, causing all objects to be recreated. | public int | countCacheEntries() | public int | countNodes(Node home, Relation rel) Count the nodes contained in the child collection of the home node
which is defined by Relation rel. | public Node | createNode(DbMapping dbm, ResultSet rs, DbColumn[] columns, int offset) Create a new Node from a ResultSet. | public void | deleteNode(Node node) Delete a node from the database. | public void | deleteNode(IDatabase db, ITransaction txn, Node node) Performs the actual deletion of a node from either the embedded or an external
SQL database. | public String | doGenerateID(DbMapping map) Actually generates an ID, using a method matching the given DbMapping. | public void | evictKey(Key key) Used when a key stops being valid for a node. | public void | evictNode(Node node) Remove a node from the node cache. | public void | evictNodeByKey(Key key) Remove a node from the node cache. | public void | exportNode(Node node, DbSource dbs) Insert a node into a different (relational) database than its default one. | public void | exportNode(Node node, DbMapping dbm) Insert a node into a different (relational) database than its default one. | protected void | fireNodeChangeEvent(List inserted, List updated, List deleted, List parents) Called by transactors after committing. | synchronized String | generateEmbeddedID(DbMapping map) Gererates an ID for use with the embedded database. | public String | generateID(DbMapping map) Generate a new ID for a given type, delegating to our IDGenerator if set. | synchronized String | generateMaxID(DbMapping map) | String | generateSequenceID(DbMapping map) | public Object[] | getCacheEntries() | public DbMapping | getDbMapping(String protoname) Get a DbMapping for a given prototype name. | public Node | getNode(Key key) Get a node by key. | public Node | getNode(Node home, String kstr, Relation rel) Get a node by relation, using the home node, the relation and a key to apply. | public SubnodeList | getNodeIDs(Node home, Relation rel) Loades subnodes via subnode relation. | public SubnodeList | getNodes(Node home, Relation rel) Loades subnodes via subnode relation. | public Vector | getPropertyNames(Node home, Relation rel) | public Node | getRootNode() Gets the application's root node. | protected boolean | hasNodeChangeListeners() | public void | init(File dbHome, Properties props) Initialize the NodeManager for the given dbHome and
application properties. | public 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, Connection con) Insert a node into a relational database. | public boolean | isRootNode(Node node) Checks if the given node is the application's root node. | public void | prefetchNodes(Node home, Relation rel, Key[] keys) | public 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. | public void | removeNodeChangeListener(NodeChangeListener listener) Remove a previously added NodeChangeListener. | public void | replicateCache(Vector add, Vector delete) Receive notification from a remote app that objects in its cache have been
modified. | public void | shutdown() Shut down this node manager. | public 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. | public void | updateProperties(Properties props) app.properties file has been updated. | public 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. |
logReplication | protected boolean logReplication(Code) | | |
NodeManager | public NodeManager(Application app)(Code) | | Create a new NodeManager for Application app.
|
addNodeChangeListener | public void addNodeChangeListener(NodeChangeListener listener)(Code) | | Add a listener that is notified each time a transaction commits
that adds, modifies or deletes any Nodes.
|
clearCache | public void clearCache()(Code) | | Clear the object cache, causing all objects to be recreated.
|
countCacheEntries | public int countCacheEntries()(Code) | | Get the number of elements in the object cache
|
countNodes | public int countNodes(Node home, Relation rel) throws Exception(Code) | | Count the nodes contained in the child collection of the home node
which is defined by Relation rel.
|
deleteNode | public void deleteNode(Node node) throws Exception(Code) | | Delete a node from the database.
|
evictKey | public void evictKey(Key key)(Code) | | Used when a key stops being valid for a node. The cached node itself
remains valid, if it is present in the cache by other keys.
|
evictNode | public void evictNode(Node node)(Code) | | Remove a node from the node cache. If at a later time it is accessed again,
it will be refetched from the database.
|
evictNodeByKey | public void evictNodeByKey(Key key)(Code) | | Remove a node from the node cache. If at a later time it is accessed again,
it will be refetched from the database.
|
fireNodeChangeEvent | protected void fireNodeChangeEvent(List inserted, List updated, List deleted, List parents)(Code) | | Called by transactors after committing.
|
generateMaxID | synchronized String generateMaxID(DbMapping map) throws Exception(Code) | | Generates an ID for the table by finding out the maximum current value
|
getCacheEntries | public Object[] getCacheEntries()(Code) | | Get an array of the the keys currently held in the object cache
|
getDbMapping | public DbMapping getDbMapping(String protoname)(Code) | | Get a DbMapping for a given prototype name. This is just a proxy
method to the app's getDbMapping() method.
|
getNode | public Node getNode(Key key) throws Exception(Code) | | Get a node by key. This is called from a node that already holds
a reference to another node via a NodeHandle/Key.
|
getNode | public Node getNode(Node home, String kstr, Relation rel) throws Exception(Code) | | Get a node by relation, using the home node, the relation and a key to apply.
In contrast to getNode (Key key), this is usually called when we don't yet know
whether such a node exists.
|
getNodeIDs | public SubnodeList getNodeIDs(Node home, Relation rel) throws Exception(Code) | | Loades subnodes via subnode relation. Only the ID index is loaded, the nodes are
loaded later on demand.
|
getNodes | public SubnodeList getNodes(Node home, Relation rel) throws Exception(Code) | | Loades subnodes via subnode relation. This is similar to getNodeIDs, but it
actually loades all nodes in one go, which is better for small node collections.
This method is used when xxx.loadmode=aggressive is specified.
|
getPropertyNames | public Vector getPropertyNames(Node home, Relation rel) throws Exception(Code) | | Similar to getNodeIDs, but returns a Vector that return's the nodes property names instead of IDs
|
hasNodeChangeListeners | protected boolean hasNodeChangeListeners()(Code) | | Let transactors know if they should collect and fire NodeChangeListener
events
|
isRootNode | public boolean isRootNode(Node node)(Code) | | Checks if the given node is the application's root node.
|
registerNode | public void registerNode(Node node)(Code) | | Register a node in the node cache.
|
registerNode | protected void registerNode(Node node, Key key)(Code) | | Register a node in the node cache using the key argument.
|
removeNodeChangeListener | public void removeNodeChangeListener(NodeChangeListener listener)(Code) | | Remove a previously added NodeChangeListener.
|
replicateCache | public void replicateCache(Vector add, Vector delete)(Code) | | Receive notification from a remote app that objects in its cache have been
modified.
|
shutdown | public void shutdown() throws DatabaseException(Code) | | Shut down this node manager. This is called when the application
using this node manager is stopped.
|
updateProperties | public void updateProperties(Properties props)(Code) | | app.properties file has been updated. Reread some settings.
|
updateSubnodeList | public int updateSubnodeList(Node home, Relation rel) throws Exception(Code) | | 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.
Parameters: home - the home of this subnode-list Parameters: rel - the relation the home-node has to the nodes contained inside the subnodelist A map having two properties of type String (newNodes (number of nodes retreived by the select-statment), addedNodes (nodes added to the collection)) throws: Exception - |
|
|