|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectconsciouscode.seedling.tree.GenericNode
consciouscode.seedling.tree.EmptyBranch
public class EmptyBranch
A trivial branch that has no child nodes, and can't have any installed. This can be useful for unit tests, or perhaps for disabling an entire subtree by overriding construction of an existing branch.
Constructor Summary | |
---|---|
EmptyBranch()
|
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. |
Object |
getInstalledNode(String path)
Deprecated. |
Object |
getNode(String path)
Deprecated. |
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. |
void |
startService()
Starts a Seedling service. |
void |
stopService()
Stops a Seedling service. |
Methods inherited from class consciouscode.seedling.tree.GenericNode |
---|
getLocalRoot, getLog, getNodeLocation, getNodeName, getParentBranch, isLoggingDebug, nodeInstalled, setLog, setLoggingDebug |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface consciouscode.seedling.BranchNode |
---|
getLocalRoot, getLog |
Methods inherited from interface consciouscode.seedling.LocatableNode |
---|
getNodeLocation, nodeInstalled |
Constructor Detail |
---|
public EmptyBranch()
Method Detail |
---|
public void startService()
ServiceNode
RuntimeException
are propagated
to the application, but any other kind of exception is wrapped in a
ServiceException
and rethrown.
startService
in interface ServiceNode
public void stopService()
ServiceNode
Implementations of this method must not do anything that may change
the state of the parent Seedling. In particular, it cannot call
any overload of the following methods:
BranchNode.getNode(java.lang.String)
,
BranchNode.getChild(java.lang.String)
, GrowingBranch.installChild(java.lang.String, java.lang.Object)
,
GrowingBranch.uninstallChild(java.lang.String)
.
Furthermore, this method may be called from within a JVM shutdown hook, which implies that it must work promptly and carefully.
stopService
in interface ServiceNode
Runtime.addShutdownHook(java.lang.Thread)
public Collection<String> installedChildNames()
BranchNode
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.
installedChildNames
in interface BranchNode
public Collection<String> availableChildNames()
BranchNode
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.
availableChildNames
in interface BranchNode
@Deprecated public Object getNode(String path) throws NodeProvisioningException
BranchNode
getNode
in interface BranchNode
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 public Object getInstalledNode(String path)
BranchNode
getInstalledNode
in interface BranchNode
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 public Object getChild(String nodeName) throws NoSuchNodeException
BranchNode
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
BranchNode.availableChild(String)
and
BranchNode.installedChild(String)
for alternatives.
getChild
in interface BranchNode
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 nodepublic Object availableChild(String nodeName)
BranchNode
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 BranchNode.installedChild(String)
.
If the requested node is not available then null
is returned.
This is in contrast to BranchNode.getChild(String)
, which throws
NoSuchNodeException
in that case.
availableChild
in interface BranchNode
nodeName
- must not be null or empty.
null
if it's not available.public Object installedChild(String nodeName)
BranchNode
installedChild
in interface BranchNode
nodeName
- must not be null or empty.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |