|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objecthelma.objectmodel.db.Node
public final class Node
An implementation of INode that can be stored in the internal database or an external relational database.
Field Summary | |
---|---|
protected boolean |
anonymous
|
protected long |
created
|
protected long |
lastmodified
|
protected NodeHandle |
parentHandle
|
protected short |
version
|
Fields inherited from interface helma.objectmodel.INodeState |
---|
CLEAN, DELETED, INVALID, MODIFIED, NEW, TRANSIENT, VIRTUAL |
Constructor Summary | |
---|---|
protected |
Node()
Creates an empty, uninitialized Node. |
protected |
Node(long timestamp)
Creates an empty, uninitialized Node with the given create and modify time. |
|
Node(Node home,
java.lang.String propname,
WrappedNodeManager nmgr,
java.lang.String prototype)
Constructor used for virtual nodes. |
|
Node(java.lang.String name,
java.lang.String id,
java.lang.String prototype,
WrappedNodeManager nmgr)
Creates a new Node with the given name. |
|
Node(java.lang.String name,
java.lang.String id,
java.lang.String prototype,
WrappedNodeManager nmgr,
long created,
long lastmodified)
Constructor used to create a Node with a given name from a embedded database. |
|
Node(java.lang.String name,
java.lang.String prototype,
WrappedNodeManager nmgr)
Creates a new Node with the given name. |
Method Summary | |
---|---|
INode |
addNode(INode elem)
INode-related |
INode |
addNode(INode elem,
int where)
Add a node to this Node's subnodes, making the added node persistent if it hasn't been before and this Node is already persistent. |
void |
clearCacheNode()
Reset the cache node for this node. |
int |
contains(INode n)
Check if the given node is contained in this node's child list. |
long |
created()
|
INode |
createNode()
|
INode |
createNode(int where)
|
INode |
createNode(java.lang.String nm)
|
INode |
createNode(java.lang.String nm,
int where)
|
SubnodeList |
createSubnodeList()
Retrieve an empty subnodelist. |
protected void |
deepRemoveNode()
Delete the node from the db. |
void |
dump()
|
IProperty |
get(java.lang.String propname)
|
boolean |
getBoolean(java.lang.String propname)
|
Node |
getCachedParent()
Get parent, using cached info if it exists. |
INode |
getCacheNode()
Get the cache node for this node. |
IPathElement |
getChildElement(java.lang.String name)
This implements the getChildElement() method of the IPathElement interface |
java.util.Date |
getDate(java.lang.String propname)
|
DbMapping |
getDbMapping()
|
java.lang.String |
getElementName()
Get something to identify this node within a URL. |
double |
getFloat(java.lang.String propname)
|
java.lang.String |
getFullName()
|
java.lang.String |
getFullName(INode root)
|
protected Node |
getGroupbySubnode(Node node,
boolean create)
|
protected Node |
getGroupbySubnode(java.lang.String sid,
boolean create)
|
NodeHandle |
getHandle()
|
java.lang.String |
getID()
Get the ID of this Node. |
long |
getInteger(java.lang.String propname)
|
java.lang.Object |
getJavaObject(java.lang.String propname)
|
Key |
getKey()
|
java.lang.String |
getName()
Return this node' name, which may or may not have some meaning |
INode |
getNode(java.lang.String propname)
|
Node |
getNonVirtualParent()
This method walks down node path to the first non-virtual node and return it. |
INode |
getParent()
Get parent, retrieving it if necessary. |
IPathElement |
getParentElement()
This implements the getParentElement() method of the IPathElement interface |
java.lang.String |
getParentInfo()
|
protected Property |
getProperty(java.lang.String propname)
|
java.util.Hashtable |
getPropMap()
|
java.lang.String |
getPrototype()
Get the name of the prototype to be used for this object. |
int |
getState()
Gets this node's stateas defined in the INode interface |
java.lang.String |
getString(java.lang.String propname)
|
INode |
getSubnode(java.lang.String subid)
|
INode |
getSubnodeAt(int index)
|
SubnodeList |
getSubnodeList()
Return this Node's subnode list |
java.lang.String |
getSubnodeRelation()
|
java.util.Enumeration |
getSubnodes()
|
int |
hashCode()
We overwrite hashCode to make it dependant from the prototype. |
void |
init(DbMapping dbm,
java.lang.String id,
java.lang.String name,
java.lang.String prototype,
java.util.Hashtable propMap,
WrappedNodeManager nmgr)
Initializer used for nodes being instanced from an embedded or relational database. |
void |
invalidate()
Mark node as invalid so it is re-fetched from the database |
void |
invalidateNode(java.lang.String key)
Check for a child mapping and evict the object specified by key from the cache |
boolean |
isAnonymous()
Returns true if this node is accessed by id from its aprent, false if it is accessed by name |
boolean |
isNullNode()
Instances of this class may be used to mark an entry in the object cache as null. |
boolean |
isParentOf(Node n)
Check if the given node is contained in this node's child list. |
boolean |
isRelational()
Tell whether this node is stored inside a relational db. |
long |
lastModified()
|
void |
loadNodes()
Make sure the subnode index is loaded for subnodes stored in a relational data source. |
void |
markSubnodesChanged()
Called by the transactor on registered parent nodes to mark the child index as changed |
int |
numberOfNodes()
Count the subnodes of this node. |
void |
persist()
Public method to make a node persistent. |
void |
prefetchChildren(int startIndex,
int length)
|
void |
prefetchChildren(Key[] keys)
|
java.util.Enumeration |
properties()
Get all properties of this node. |
protected void |
releaseNode(Node node)
"Locally" remove a subnode from the subnodes table. |
boolean |
remove()
|
void |
removeNode(INode node)
|
protected void |
set(java.lang.String propname,
java.lang.Object value,
int type)
Directly set a property on this node |
void |
setBoolean(java.lang.String propname,
boolean value)
|
void |
setDate(java.lang.String propname,
java.util.Date value)
|
void |
setDbMapping(DbMapping dbmap)
|
void |
setFloat(java.lang.String propname,
double value)
|
void |
setInteger(java.lang.String propname,
long value)
|
void |
setJavaObject(java.lang.String propname,
java.lang.Object value)
|
void |
setName(java.lang.String name)
|
void |
setNode(java.lang.String propname,
INode value)
|
void |
setParent(Node parent)
Set this node's parent node. |
void |
setParentHandle(NodeHandle parent)
Set this node's parent node to the node referred to by the NodeHandle. |
void |
setPropMap(java.util.Hashtable propMap)
used by Xml deserialization |
void |
setPrototype(java.lang.String proto)
|
void |
setState(int s)
Sets this node's state as defined in the INode interface |
void |
setString(java.lang.String propname,
java.lang.String value)
|
void |
setSubnodeRelation(java.lang.String rel)
|
void |
setSubnodes(SubnodeList subnodes)
used by Xml deserialization |
void |
setWrappedNodeManager(WrappedNodeManager nmgr)
|
java.lang.String |
toString()
Return a string representation for this node. |
void |
unset(java.lang.String propname)
Remove a property. |
int |
updateSubnodes()
This method get's called from the JavaScript environment (HopObject.updateSubnodes() or HopObject.collection.updateSubnodes())) The subnode-collection will be updated with a selectstatement getting all Nodes having a higher id than the highest id currently contained within this Node's subnoderelation. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
protected NodeHandle parentHandle
protected long created
protected long lastmodified
protected boolean anonymous
protected short version
Constructor Detail |
---|
protected Node()
protected Node(long timestamp)
timestamp
- public Node(java.lang.String name, java.lang.String id, java.lang.String prototype, WrappedNodeManager nmgr)
public Node(java.lang.String name, java.lang.String id, java.lang.String prototype, WrappedNodeManager nmgr, long created, long lastmodified)
public Node(Node home, java.lang.String propname, WrappedNodeManager nmgr, java.lang.String prototype)
public Node(java.lang.String name, java.lang.String prototype, WrappedNodeManager nmgr)
Method Detail |
---|
public void init(DbMapping dbm, java.lang.String id, java.lang.String name, java.lang.String prototype, java.util.Hashtable propMap, WrappedNodeManager nmgr)
public void setPropMap(java.util.Hashtable propMap)
public void setSubnodes(SubnodeList subnodes)
public void markSubnodesChanged()
public int getState()
getState
in interface INode
public void setState(int s)
setState
in interface INode
s
- this node's new statepublic void invalidate()
public void invalidateNode(java.lang.String key)
public java.lang.String getID()
getID
in interface INode
public boolean isAnonymous()
isAnonymous
in interface INode
public java.lang.String getName()
getName
in interface INode
public java.lang.String getElementName()
getElementName
in interface IPathElement
public java.lang.String getFullName()
getFullName
in interface INode
public java.lang.String getFullName(INode root)
getFullName
in interface INode
root
- ...
public java.lang.String getPrototype()
IPathElement
getPrototype
in interface IPathElement
getPrototype
in interface INode
public void setPrototype(java.lang.String proto)
setPrototype
in interface INode
proto
- ...public void setDbMapping(DbMapping dbmap)
setDbMapping
in interface INode
dbmap
- ...public DbMapping getDbMapping()
getDbMapping
in interface INode
public void setWrappedNodeManager(WrappedNodeManager nmgr)
nmgr
- public Key getKey()
public NodeHandle getHandle()
public void setSubnodeRelation(java.lang.String rel)
setSubnodeRelation
in interface INode
rel
- ...public java.lang.String getSubnodeRelation()
getSubnodeRelation
in interface INode
public void setName(java.lang.String name)
setName
in interface INode
name
- ...public void setParent(Node parent)
public void setParentHandle(NodeHandle parent)
public INode getParent()
getParent
in interface INode
public Node getCachedParent()
public INode addNode(INode elem)
addNode
in interface INode
elem
- ...
public INode addNode(INode elem, int where)
addNode
in interface INode
elem
- the node to add to this Nodes subnode-listwhere
- the index-position where this node has to be added
public INode createNode()
public INode createNode(int where)
where
- ...
public INode createNode(java.lang.String nm)
createNode
in interface INode
nm
- ...
public INode createNode(java.lang.String nm, int where)
createNode
in interface INode
nm
- ...where
- ...
public IPathElement getChildElement(java.lang.String name)
getChildElement
in interface IPathElement
public IPathElement getParentElement()
getParentElement
in interface IPathElement
public INode getSubnode(java.lang.String subid)
getSubnode
in interface INode
subid
- ...
public INode getSubnodeAt(int index)
getSubnodeAt
in interface INode
index
- ...
protected Node getGroupbySubnode(Node node, boolean create)
protected Node getGroupbySubnode(java.lang.String sid, boolean create)
sid
- ...create
- ...
public boolean remove()
remove
in interface INode
public void removeNode(INode node)
removeNode
in interface INode
node
- ...protected void releaseNode(Node node)
removeNode(INode)
.
protected void deepRemoveNode()
public int contains(INode n)
contains
in interface INode
n
- a node
public boolean isParentOf(Node n)
contains(INode)
but does not load the
child index for relational nodes.
n
- a node
public int numberOfNodes()
numberOfNodes
in interface INode
public void loadNodes()
public SubnodeList createSubnodeList()
public void prefetchChildren(int startIndex, int length) throws java.lang.Exception
startIndex
- ...length
- ...
java.lang.Exception
- ...public void prefetchChildren(Key[] keys) throws java.lang.Exception
java.lang.Exception
public java.util.Enumeration getSubnodes()
getSubnodes
in interface INode
public SubnodeList getSubnodeList()
public java.util.Enumeration properties()
properties
in interface INode
public java.util.Hashtable getPropMap()
public IProperty get(java.lang.String propname)
get
in interface INode
propname
- ...
public java.lang.String getParentInfo()
protected Property getProperty(java.lang.String propname)
propname
- ...
public java.lang.String getString(java.lang.String propname)
getString
in interface INode
propname
- ...
public long getInteger(java.lang.String propname)
getInteger
in interface INode
propname
- ...
public double getFloat(java.lang.String propname)
getFloat
in interface INode
propname
- ...
public java.util.Date getDate(java.lang.String propname)
getDate
in interface INode
propname
- ...
public boolean getBoolean(java.lang.String propname)
getBoolean
in interface INode
propname
- ...
public INode getNode(java.lang.String propname)
getNode
in interface INode
propname
- ...
public java.lang.Object getJavaObject(java.lang.String propname)
getJavaObject
in interface INode
propname
- ...
protected void set(java.lang.String propname, java.lang.Object value, int type)
propname
- ...value
- ...public void setString(java.lang.String propname, java.lang.String value)
setString
in interface INode
propname
- ...value
- ...public void setInteger(java.lang.String propname, long value)
setInteger
in interface INode
propname
- ...value
- ...public void setFloat(java.lang.String propname, double value)
setFloat
in interface INode
propname
- ...value
- ...public void setBoolean(java.lang.String propname, boolean value)
setBoolean
in interface INode
propname
- ...value
- ...public void setDate(java.lang.String propname, java.util.Date value)
setDate
in interface INode
propname
- ...value
- ...public void setJavaObject(java.lang.String propname, java.lang.Object value)
setJavaObject
in interface INode
propname
- ...value
- ...public void setNode(java.lang.String propname, INode value)
setNode
in interface INode
propname
- ...value
- ...public void unset(java.lang.String propname)
unset
in interface INode
propname
- ...public long lastModified()
lastModified
in interface INode
public long created()
created
in interface INode
public java.lang.String toString()
toString
in class java.lang.Object
public boolean isRelational()
public void persist()
public INode getCacheNode()
getCacheNode
in interface INode
public void clearCacheNode()
clearCacheNode
in interface INode
public Node getNonVirtualParent()
public boolean isNullNode()
public int hashCode()
hashCode
in class java.lang.Object
public void dump()
public int updateSubnodes()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |