|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface BranchNode
A branch in the Seedling component hierarchy. The main function of a branch is to provide access to child nodes.
Branches must also implement these interfaces:
LocatableNode
ServiceNode
ServiceNode.stopService()
such that
it will recursively stop any child services. This is necessary so that
the Seedling can cleanly release scopes.
Method Summary | |
---|---|
Object |
availableChild(String nodeName)
Gets a child node, provisioning and installing it if possible. |
Collection<String> |
availableChildNames()
Extracts a collection of the names of child nodes that are available on request from this branch. |
Object |
getChild(String nodeName)
Deprecated. Use NodeReference.required() instead. |
Object |
getInstalledNode(String path)
Deprecated. Use NodeReference.installed() instead. |
RootNode |
getLocalRoot()
Gets the root node of the local scope. |
Log |
getLog()
Gets the Log associated with this branch. |
Object |
getNode(String path)
Deprecated. Use NodeReference.required() instead. |
Object |
installedChild(String nodeName)
Gets a child node, but doesn't provision it if it's not already installed. |
Collection<String> |
installedChildNames()
Extracts a collection of the names of this branch's current child nodes. |
Methods inherited from interface consciouscode.seedling.LocatableNode |
---|
getNodeLocation, nodeInstalled |
Methods inherited from interface consciouscode.seedling.ServiceNode |
---|
startService, stopService |
Method Detail |
---|
RootNode getLocalRoot()
RootNode
, this method returns
this
.
The local root can be located by recursive use of
LocatableNode.getNodeLocation()
.
getParentBranch()
but implementations should generally cache the root
to avoid the search. This is most effectively done in
LocatableNode.nodeInstalled(NodeLocation)
.
LocatableNode.nodeInstalled(NodeLocation)
is invoked.Collection<String> availableChildNames()
The result is a snapshot of the current state: subsequent changes to the branch are not reflected in the result. Thus the actual children may have changed by the time the collection is inspected; in particular, another thread may uninstall a node named in this collection (thereby making it unavailable) before the name is even read from this collection.
Implementations must ensure that the result stays usable even when the
branch changes in another thread. For example, iterating the result
must not throw ConcurrentModificationException
if the branch
changes during iteration.
Collection<String> installedChildNames()
The result is a snapshot of the current state: subsequent changes to the branch are not reflected in the result. Thus the actual children may have changed by the time the collection is inspected; in particular, another thread may uninstall a node named in this collection before the name is even read from this list.
Implementations must ensure that the result stays usable even when the
branch changes in another thread. For example, iterating the result
must not throw ConcurrentModificationException
if the branch
changes during iteration.
@Deprecated Object getNode(String path) throws NodeProvisioningException
NodeReference.required()
instead.
path
- is interpreted relative to this branch. It may also be a
(local or global) full path. It must not be null or empty.
NodeProvisioningException
- if no such node exists, or if there
was an error instantiating it.@Deprecated Object getInstalledNode(String path)
NodeReference.installed()
instead.
path
- is interpreted relative to this branch. It may also be a
(local or global) full path. It must not be null or empty.
null
if no node exists at
the given path.@Deprecated Object getChild(String nodeName) throws NoSuchNodeException, NodeProvisioningException
NodeReference.required()
instead.
Provisioning of uninstalled nodes is defined by the implementation class, which may not do any dynamic provisioning at all.
This method will not return null
; see
availableChild(String)
and
installedChild(String)
for alternatives.
nodeName
- must not be null or empty.
NoSuchNodeException
- if the node isn't installed and if the
branch cannot provision it on demand. This usually means that there's
no applicable configuration for the node
NodeProvisioningException
- if there
was an error provisioning the node.Object availableChild(String nodeName) throws NodeProvisioningException
A node is available if its already installed, or if it can be
provided for installation, usually by being created from configuration.
Provisioning of uninstalled nodes is defined by the implementation
class, which may not do any dynamic provisioning at all, in which case
this method behaves identically to installedChild(String)
.
If the requested node is not available then null
is returned.
This is in contrast to getChild(String)
, which throws
NoSuchNodeException
in that case.
nodeName
- must not be null or empty.
null
if it's not available.
NodeProvisioningException
- if there was an error provisioning
the node.Object installedChild(String nodeName)
nodeName
- must not be null or empty.
Log getLog()
Log
associated with this branch.
Implementations should return a "do-nothing" log instance if no logging
is desired; see for example
NoOpLog
.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |