public final class CommandHelper extends Object
Modifier and Type | Field and Description |
---|---|
static String |
CURRENT_NODE_KEY
Current node key
|
static String |
OUTPUT_KEY
output key
|
static String |
REPO_ADDRESS_KEY
address key
|
static String |
REPOSITORY_KEY
repository key
|
static String |
SESSION_KEY
session key
|
Modifier and Type | Method and Description |
---|---|
static ResourceBundle |
getBundle() |
static Node |
getCurrentNode(org.apache.commons.chain.Context ctx)
Gets the current working
Node |
static Item |
getItem(org.apache.commons.chain.Context ctx,
String path)
Gets the
Item at the given path. |
static Iterator<Item> |
getItems(org.apache.commons.chain.Context ctx,
Node node,
String pattern)
Gets the
Item s under the given Node that
match the pattern |
static Node |
getNode(org.apache.commons.chain.Context ctx,
String path)
Gets the
Node at the given path. |
static NodeIterator |
getNodes(org.apache.commons.chain.Context ctx,
Node node,
String pattern)
Gets the
Node s under the given Node that
match the given pattern. |
static PrintWriter |
getOutput(org.apache.commons.chain.Context ctx)
Gets the current
PrintWriter |
static PropertyIterator |
getProperties(org.apache.commons.chain.Context ctx,
Node node,
String pattern)
Gets the
Property s under the current working node for the
given pattern |
static Repository |
getRepository(org.apache.commons.chain.Context ctx)
Gets the current working
Repository |
static String |
getRepositoryAddress(org.apache.commons.chain.Context ctx) |
static Session |
getSession(org.apache.commons.chain.Context ctx)
Gets the current working
Session |
static boolean |
hasNode(org.apache.commons.chain.Context ctx,
String path)
Checks
Node existence. |
static void |
setCurrentNode(org.apache.commons.chain.Context ctx,
Node node)
Sets the current working
Node . |
static void |
setOutput(org.apache.commons.chain.Context ctx,
PrintWriter out)
Sets the current
PrintWriter . |
static void |
setRepository(org.apache.commons.chain.Context ctx,
Repository repository,
String address)
Sets the current working
Repository |
static void |
setSession(org.apache.commons.chain.Context ctx,
Session session)
Sets the current working
Session |
public static final String CURRENT_NODE_KEY
public static final String REPOSITORY_KEY
public static final String SESSION_KEY
public static final String OUTPUT_KEY
public static final String REPO_ADDRESS_KEY
public static void setOutput(org.apache.commons.chain.Context ctx, PrintWriter out)
PrintWriter
.ctx
- the Context
out
- the PrintWriter
public static void setCurrentNode(org.apache.commons.chain.Context ctx, Node node)
Node
.ctx
- the Context
node
- the current working Node
.public static void setRepository(org.apache.commons.chain.Context ctx, Repository repository, String address)
Repository
ctx
- the Context
repository
- the current working Repository
public static void setSession(org.apache.commons.chain.Context ctx, Session session) throws CommandException
Session
ctx
- the Context
session
- the current working Session
CommandException
- if there's an open working Session
public static PrintWriter getOutput(org.apache.commons.chain.Context ctx)
PrintWriter
ctx
- the Context
PrintWriter
public static Node getCurrentNode(org.apache.commons.chain.Context ctx) throws CommandException
Node
ctx
- the Context
Node
CommandException
- if the current working Node
can't be found.public static Repository getRepository(org.apache.commons.chain.Context ctx) throws CommandException
Repository
ctx
- the Context
Repository
CommandException
- if the current working Repository
is unset.public static String getRepositoryAddress(org.apache.commons.chain.Context ctx) throws CommandException
CommandException
public static Session getSession(org.apache.commons.chain.Context ctx) throws CommandException
Session
ctx
- the Context
Session
CommandException
- if the current working Session
is unset.public static Node getNode(org.apache.commons.chain.Context ctx, String path) throws CommandException, RepositoryException
Node
at the given path.ctx
- the Context
path
- the path to the Node
Node
at the given pathCommandException
- if the Node
isn't found.RepositoryException
- if the underlying repository throws a
RepositoryException
public static Item getItem(org.apache.commons.chain.Context ctx, String path) throws CommandException, PathNotFoundException, RepositoryException
Item
at the given path. Node
.ctx
- the Context
path
- the path to the Item
Item
at the given pathCommandException
- if a Command
internal error occurs.PathNotFoundException
- if there's no Node
at the given path.RepositoryException
- if the underlying repository throws a
RepositoryException
public static boolean hasNode(org.apache.commons.chain.Context ctx, String path) throws CommandException, RepositoryException
Node
existence.ctx
- the Context
path
- the path to the Node
Node
exists at the given pathCommandException
- if the current working Session
is unset.RepositoryException
- if the underlying repository throws a
RepositoryException
public static NodeIterator getNodes(org.apache.commons.chain.Context ctx, Node node, String pattern) throws RepositoryException
Node
s under the given Node
that
match the given pattern.ctx
- the Context
node
- the parent Node
pattern
- the patternIterator
that contains the matching nodesRepositoryException
- if the underlying repository throws a
RepositoryException
public static PropertyIterator getProperties(org.apache.commons.chain.Context ctx, Node node, String pattern) throws RepositoryException
Property
s under the current working node for the
given patternctx
- the Context
node
- the parent Node
pattern
- the patternPropertyIterator
RepositoryException
- if the underlying repository throws a
RepositoryException
public static ResourceBundle getBundle()
ResourceBundle
public static Iterator<Item> getItems(org.apache.commons.chain.Context ctx, Node node, String pattern) throws RepositoryException
Item
s under the given Node
that
match the patternctx
- the Context
node
- the parent Node
pattern
- the patternIterator
with the Item
s that
match the given pattern.RepositoryException
- if the underlying repository throws a
RepositoryException
Copyright © 2004–2024 The Apache Software Foundation. All rights reserved.