Class CommandHelper
- java.lang.Object
- 
- org.apache.jackrabbit.standalone.cli.CommandHelper
 
- 
 public final class CommandHelper extends Object Utility class for getting and setting context attributes.
- 
- 
Field SummaryFields Modifier and Type Field Description static StringCURRENT_NODE_KEYCurrent node keystatic StringOUTPUT_KEYoutput keystatic StringREPO_ADDRESS_KEYaddress keystatic StringREPOSITORY_KEYrepository keystatic StringSESSION_KEYsession key
 - 
Method SummaryAll Methods Static Methods Concrete Methods Modifier and Type Method Description static ResourceBundlegetBundle()static NodegetCurrentNode(org.apache.commons.chain.Context ctx)Gets the current workingNodestatic ItemgetItem(org.apache.commons.chain.Context ctx, String path)Gets theItemat the given path.static Iterator<Item>getItems(org.apache.commons.chain.Context ctx, Node node, String pattern)Gets theItems under the givenNodethat match the patternstatic NodegetNode(org.apache.commons.chain.Context ctx, String path)Gets theNodeat the given path.static NodeIteratorgetNodes(org.apache.commons.chain.Context ctx, Node node, String pattern)Gets theNodes under the givenNodethat match the given pattern.static PrintWritergetOutput(org.apache.commons.chain.Context ctx)Gets the currentPrintWriterstatic PropertyIteratorgetProperties(org.apache.commons.chain.Context ctx, Node node, String pattern)Gets thePropertys under the current working node for the given patternstatic RepositorygetRepository(org.apache.commons.chain.Context ctx)Gets the current workingRepositorystatic StringgetRepositoryAddress(org.apache.commons.chain.Context ctx)static SessiongetSession(org.apache.commons.chain.Context ctx)Gets the current workingSessionstatic booleanhasNode(org.apache.commons.chain.Context ctx, String path)ChecksNodeexistence.static voidsetCurrentNode(org.apache.commons.chain.Context ctx, Node node)Sets the current workingNode.static voidsetOutput(org.apache.commons.chain.Context ctx, PrintWriter out)Sets the currentPrintWriter.static voidsetRepository(org.apache.commons.chain.Context ctx, Repository repository, String address)Sets the current workingRepositorystatic voidsetSession(org.apache.commons.chain.Context ctx, Session session)Sets the current workingSession
 
- 
- 
- 
Field Detail- 
CURRENT_NODE_KEYpublic static final String CURRENT_NODE_KEY Current node key- See Also:
- Constant Field Values
 
 - 
REPOSITORY_KEYpublic static final String REPOSITORY_KEY repository key- See Also:
- Constant Field Values
 
 - 
SESSION_KEYpublic static final String SESSION_KEY session key- See Also:
- Constant Field Values
 
 - 
OUTPUT_KEYpublic static final String OUTPUT_KEY output key- See Also:
- Constant Field Values
 
 - 
REPO_ADDRESS_KEYpublic static final String REPO_ADDRESS_KEY address key- See Also:
- Constant Field Values
 
 
- 
 - 
Method Detail- 
setOutputpublic static void setOutput(org.apache.commons.chain.Context ctx, PrintWriter out)Sets the currentPrintWriter.- Parameters:
- ctx- the- Context
- out- the- PrintWriter
 
 - 
setCurrentNodepublic static void setCurrentNode(org.apache.commons.chain.Context ctx, Node node)Sets the current workingNode.- Parameters:
- ctx- the- Context
- node- the current working- Node.
 
 - 
setRepositorypublic static void setRepository(org.apache.commons.chain.Context ctx, Repository repository, String address)Sets the current workingRepository- Parameters:
- ctx- the- Context
- repository- the current working- Repository
 
 - 
setSessionpublic static void setSession(org.apache.commons.chain.Context ctx, Session session) throws CommandExceptionSets the current workingSession- Parameters:
- ctx- the- Context
- session- the current working- Session
- Throws:
- CommandException- if there's an open working- Session
 
 - 
getOutputpublic static PrintWriter getOutput(org.apache.commons.chain.Context ctx) Gets the currentPrintWriter- Parameters:
- ctx- the- Context
- Returns:
- the current PrintWriter
 
 - 
getCurrentNodepublic static Node getCurrentNode(org.apache.commons.chain.Context ctx) throws CommandException Gets the current workingNode- Parameters:
- ctx- the- Context
- Returns:
- the current working Node
- Throws:
- CommandException- if the current working- Nodecan't be found.
 
 - 
getRepositorypublic static Repository getRepository(org.apache.commons.chain.Context ctx) throws CommandException Gets the current workingRepository- Parameters:
- ctx- the- Context
- Returns:
- the current working Repository
- Throws:
- CommandException- if the current working- Repositoryis unset.
 
 - 
getRepositoryAddresspublic static String getRepositoryAddress(org.apache.commons.chain.Context ctx) throws CommandException - Throws:
- CommandException
 
 - 
getSessionpublic static Session getSession(org.apache.commons.chain.Context ctx) throws CommandException Gets the current workingSession- Parameters:
- ctx- the- Context
- Returns:
- the current working Session
- Throws:
- CommandException- if the current working- Sessionis unset.
 
 - 
getNodepublic static Node getNode(org.apache.commons.chain.Context ctx, String path) throws CommandException, RepositoryException Gets theNodeat the given path.- Parameters:
- ctx- the- Context
- path- the path to the- Node
- Returns:
- the Nodeat the given path
- Throws:
- CommandException- if the- Nodeisn't found.
- RepositoryException- if the underlying repository throws a- RepositoryException
 
 - 
getItempublic static Item getItem(org.apache.commons.chain.Context ctx, String path) throws CommandException, PathNotFoundException, RepositoryException Gets theItemat the given path.
 If the path is null it returns the current workingNode.- Parameters:
- ctx- the- Context
- path- the path to the- Item
- Returns:
- the Itemat the given path
- Throws:
- CommandException- if a- Commandinternal error occurs.
- PathNotFoundException- if there's no- Nodeat the given path.
- RepositoryException- if the underlying repository throws a- RepositoryException
 
 - 
hasNodepublic static boolean hasNode(org.apache.commons.chain.Context ctx, String path) throws CommandException, RepositoryExceptionChecksNodeexistence.- Parameters:
- ctx- the- Context
- path- the path to the- Node
- Returns:
- true if the Nodeexists at the given path
- Throws:
- CommandException- if the current working- Sessionis unset.
- RepositoryException- if the underlying repository throws a- RepositoryException
 
 - 
getNodespublic static NodeIterator getNodes(org.apache.commons.chain.Context ctx, Node node, String pattern) throws RepositoryException Gets theNodes under the givenNodethat match the given pattern.- Parameters:
- ctx- the- Context
- node- the parent- Node
- pattern- the pattern
- Returns:
- an Iteratorthat contains the matching nodes
- Throws:
- RepositoryException- if the underlying repository throws a- RepositoryException
 
 - 
getPropertiespublic static PropertyIterator getProperties(org.apache.commons.chain.Context ctx, Node node, String pattern) throws RepositoryException Gets thePropertys under the current working node for the given pattern- Parameters:
- ctx- the- Context
- node- the parent- Node
- pattern- the pattern
- Returns:
- a PropertyIterator
- Throws:
- RepositoryException- if the underlying repository throws a- RepositoryException
 
 - 
getBundlepublic static ResourceBundle getBundle() - Returns:
- the default ResourceBundle
 
 - 
getItemspublic static Iterator<Item> getItems(org.apache.commons.chain.Context ctx, Node node, String pattern) throws RepositoryException Gets theItems under the givenNodethat match the pattern- Parameters:
- ctx- the- Context
- node- the parent- Node
- pattern- the pattern
- Returns:
- an Iteratorwith theItems that match the given pattern.
- Throws:
- RepositoryException- if the underlying repository throws a- RepositoryException
 
 
- 
 
-