|
|||||||||
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(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. |
protected |
Node(WrappedNodeManager nmgr)
Creates an empty, uninitialized Node. |
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()
Get the node's creation timestamp. |
INode |
createNode()
|
INode |
createNode(int where)
|
INode |
createNode(java.lang.String nm)
Create a new named property with a node value |
INode |
createNode(java.lang.String nm,
int where)
Create a new unnamed child node at the given position. |
SubnodeList |
createSubnodeList()
Create an empty subnode list. |
protected void |
deepRemoveNode()
Delete the node from the db. |
void |
dump()
|
IProperty |
get(java.lang.String propname)
Get a property with the given name. |
boolean |
getBoolean(java.lang.String propname)
Get a boolean property with the given name. |
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)
Get a date property with the given name. |
DbMapping |
getDbMapping()
Get the node's DbMapping . |
java.lang.String |
getElementName()
Get something to identify this node within a URL. |
double |
getFloat(java.lang.String propname)
Get a float property with the given name. |
protected Node |
getGroupbySubnode(Node node,
boolean create)
Get or create a group name for a given content node. |
protected Node |
getGroupbySubnode(java.lang.String groupname,
boolean create)
Get or create a group name for a given group name. |
NodeHandle |
getHandle()
Get the node's handle. |
java.lang.String |
getID()
Get the ID of this Node. |
long |
getInteger(java.lang.String propname)
Get an integer property with the given name. |
java.lang.Object |
getJavaObject(java.lang.String propname)
Get a Java object property with the given name. |
Key |
getKey()
Get the node's key. |
java.lang.String |
getName()
Return this node' name, which may or may not have some meaning |
INode |
getNode(java.lang.String propname)
Get a node property with the given name. |
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()
|
java.lang.String |
getPath()
Get the node's path |
protected Property |
getProperty(java.lang.String propname)
|
java.util.Hashtable |
getPropMap()
|
java.lang.String |
getPrototype()
Return the node's prototype name. |
int |
getState()
Gets this node's stateas defined in the INode interface |
java.lang.String |
getString(java.lang.String propname)
Get a string property with the given name. |
INode |
getSubnode(java.lang.String subid)
Get a named child node with the given id. |
INode |
getSubnodeAt(int index)
Get a node at a given position. |
SubnodeList |
getSubnodeList()
Return this Node's subnode list |
java.lang.String |
getSubnodeRelation()
Get the node's explicit subnode select clause if one was set, or null |
java.util.Enumeration |
getSubnodes()
Enumerate through the subnodes of this node. |
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)
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()
Get the node's last modification timestamp. |
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)
|
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()
Remove this node from the database. |
void |
removeNode(INode node)
Remove the given node from this node's child nodes. |
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)
Set the property with the given name to the given boolean value. |
void |
setDate(java.lang.String propname,
java.util.Date value)
Set the property with the given name to the given date value. |
void |
setDbMapping(DbMapping dbmap)
Set the node's DbMapping . |
void |
setFloat(java.lang.String propname,
double value)
Set the property with the given name to the given float value. |
void |
setInteger(java.lang.String propname,
long value)
Set the property with the given name to the given integer value. |
void |
setJavaObject(java.lang.String propname,
java.lang.Object value)
Set the property with the given name to the given Java object value. |
void |
setName(java.lang.String name)
Set the node's name. |
void |
setNode(java.lang.String propname,
INode value)
Set the property with the given name to the given node 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)
Set the node's prototype name. |
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)
Set the property with the given name to the given string value. |
void |
setSubnodeRelation(java.lang.String rel)
Set an explicit select clause for the node's subnodes |
java.lang.String |
toString()
Return a string representation for this node. |
void |
unset(java.lang.String propname)
Remove a property. |
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(long timestamp)
timestamp
- protected Node(WrappedNodeManager nmgr)
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)
public void setPropMap(java.util.Hashtable propMap)
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 getPath()
getPath
in interface INode
public java.lang.String getPrototype()
getPrototype
in interface IPathElement
getPrototype
in interface INode
public void setPrototype(java.lang.String proto)
setPrototype
in interface INode
public void setDbMapping(DbMapping dbmap)
DbMapping
.
setDbMapping
in interface INode
public DbMapping getDbMapping()
DbMapping
.
getDbMapping
in interface INode
public Key getKey()
public NodeHandle getHandle()
public void setSubnodeRelation(java.lang.String rel)
setSubnodeRelation
in interface INode
public java.lang.String getSubnodeRelation()
getSubnodeRelation
in interface INode
public void setName(java.lang.String name)
setName
in interface INode
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
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)
INode
createNode
in interface INode
nm
- ...
public INode createNode(java.lang.String nm, int where)
INode
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
public INode getSubnodeAt(int index)
getSubnodeAt
in interface INode
index
- the subnode index
protected Node getGroupbySubnode(Node node, boolean create)
node
- the content nodecreate
- whether the node should be created if it doesn't exist
protected Node getGroupbySubnode(java.lang.String groupname, boolean create)
groupname
- the group namecreate
- whether the node should be created if it doesn't exist
public boolean remove()
INode
remove
in interface INode
public void removeNode(INode node)
INode
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)
startIndex
- ...length
- ...
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)
INode
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)
INode
getString
in interface INode
propname
- ...
public long getInteger(java.lang.String propname)
INode
getInteger
in interface INode
propname
- ...
public double getFloat(java.lang.String propname)
INode
getFloat
in interface INode
propname
- ...
public java.util.Date getDate(java.lang.String propname)
INode
getDate
in interface INode
propname
- ...
public boolean getBoolean(java.lang.String propname)
INode
getBoolean
in interface INode
propname
- ...
public INode getNode(java.lang.String propname)
INode
getNode
in interface INode
propname
- ...
public java.lang.Object getJavaObject(java.lang.String propname)
INode
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)
INode
setString
in interface INode
propname
- ...value
- ...public void setInteger(java.lang.String propname, long value)
INode
setInteger
in interface INode
propname
- ...value
- ...public void setFloat(java.lang.String propname, double value)
INode
setFloat
in interface INode
propname
- ...value
- ...public void setBoolean(java.lang.String propname, boolean value)
INode
setBoolean
in interface INode
propname
- ...value
- ...public void setDate(java.lang.String propname, java.util.Date value)
INode
setDate
in interface INode
propname
- ...value
- ...public void setJavaObject(java.lang.String propname, java.lang.Object value)
INode
setJavaObject
in interface INode
propname
- ...value
- ...public void setNode(java.lang.String propname, INode value)
INode
setNode
in interface INode
propname
- ...value
- ...public void unset(java.lang.String propname)
unset
in interface INode
public long lastModified()
INode
lastModified
in interface INode
public long created()
INode
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()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |