Package org.apache.hadoop.fs.shell.find
Class BaseExpression
java.lang.Object
org.apache.hadoop.fs.shell.find.BaseExpression
- All Implemented Interfaces:
Configurable,Expression
Abstract expression for use in the
Find command. Provides default
behavior for a no-argument primary expression.-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidaddArgument(String arg) Add a single argument to this expression.voidaddArguments(Deque<String> args) Adds arguments to this expression.protected voidaddArguments(Deque<String> args, int count) Add a specific number of arguments to this expression.voidaddChildren(Deque<Expression> exprs) Adds children to this expression.protected voidaddChildren(Deque<Expression> exprs, int count) Add a specific number of children to this expression.voidfinish()Finishes the expression, called once after processing all items.protected StringgetArgument(int position) Returns the argument at the given position (starting from 1).Returns the arguments of this expressionprotected List<Expression>Returns the children of this expression.getConf()Return the configuration used by this object.protected FileStatusgetFileStatus(PathData item, int depth) Returns theFileStatusfrom thePathDataitem.protected FileSystemgetFileSystem(PathData item) Returns theFileSystemassociated with thePathDataitem.String[]getHelp()Returns a description of the expression for use in help.protected FindOptionsReturn the options to be used by this expression.protected PathintReturns the precedence of this expression (only applicable to operators).String[]getUsage()Returns brief usage instructions for this expression.booleanisAction()Indicates whether this expression performs an action, i.e. provides output back to the user.booleanIdentifies the expression as an operator rather than a primary.voidprepare()Prepares the expression for execution, called once after setting options and before processing any options.voidsetConf(Configuration conf) Set the configuration to be used by this object.protected voidSets the help text for thisExpression.voidsetOptions(FindOptions options) Set the options for this expression, called once before processing any items.protected voidSets the usage text for thisExpression.toString()Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface org.apache.hadoop.fs.shell.find.Expression
apply
-
Constructor Details
-
BaseExpression
public BaseExpression()
-
-
Method Details
-
setUsage
Sets the usage text for thisExpression.- Parameters:
usage- usage array.
-
setHelp
Sets the help text for thisExpression.- Parameters:
help- help.
-
getUsage
Description copied from interface:ExpressionReturns brief usage instructions for this expression. Multiple items should be returned if there are multiple ways to use this expression.- Specified by:
getUsagein interfaceExpression- Returns:
- array of usage instructions
-
getHelp
Description copied from interface:ExpressionReturns a description of the expression for use in help. Multiple lines should be returned array items. Lines should be formated to 60 characters or less.- Specified by:
getHelpin interfaceExpression- Returns:
- array of description lines
-
setOptions
Description copied from interface:ExpressionSet the options for this expression, called once before processing any items.- Specified by:
setOptionsin interfaceExpression- Parameters:
options- options.- Throws:
IOException- raised on errors performing I/O.
-
prepare
Description copied from interface:ExpressionPrepares the expression for execution, called once after setting options and before processing any options.- Specified by:
preparein interfaceExpression- Throws:
IOException- raised on errors performing I/O.
-
finish
Description copied from interface:ExpressionFinishes the expression, called once after processing all items.- Specified by:
finishin interfaceExpression- Throws:
IOException- raised on errors performing I/O.
-
getOptions
Return the options to be used by this expression.- Returns:
- options.
-
setConf
Description copied from interface:ConfigurableSet the configuration to be used by this object.- Specified by:
setConfin interfaceConfigurable- Parameters:
conf- configuration to be used
-
getConf
Description copied from interface:ConfigurableReturn the configuration used by this object.- Specified by:
getConfin interfaceConfigurable- Returns:
- Configuration
-
toString
-
isAction
public boolean isAction()Description copied from interface:ExpressionIndicates whether this expression performs an action, i.e. provides output back to the user.- Specified by:
isActionin interfaceExpression- Returns:
- if is action true, not false.
-
isOperator
public boolean isOperator()Description copied from interface:ExpressionIdentifies the expression as an operator rather than a primary.- Specified by:
isOperatorin interfaceExpression- Returns:
- if is operator true, not false.
-
getArguments
Returns the arguments of this expression- Returns:
- list of argument strings
-
getArgument
Returns the argument at the given position (starting from 1).- Parameters:
position- argument to be returned- Returns:
- requested argument
- Throws:
IOException- if the argument doesn't exist or is null
-
getChildren
Returns the children of this expression.- Returns:
- list of child expressions
-
getPrecedence
public int getPrecedence()Description copied from interface:ExpressionReturns the precedence of this expression (only applicable to operators).- Specified by:
getPrecedencein interfaceExpression- Returns:
- precedence.
-
addChildren
Description copied from interface:ExpressionAdds children to this expression. Children are popped from the head of the deque.- Specified by:
addChildrenin interfaceExpression- Parameters:
exprs- deque of expressions from which to take the children
-
addChildren
Add a specific number of children to this expression. The children are popped off the head of the expressions.- Parameters:
exprs- deque of expressions from which to take the childrencount- number of children to be added
-
addArguments
Description copied from interface:ExpressionAdds arguments to this expression. Arguments are popped from the head of the deque and added to the front of the child list, ie last child added is the first evaluated.- Specified by:
addArgumentsin interfaceExpression- Parameters:
args- deque of arguments from which to take expression arguments
-
addArguments
Add a specific number of arguments to this expression. The children are popped off the head of the expressions.- Parameters:
args- deque of arguments from which to take the argumentcount- number of children to be added
-
addArgument
Add a single argument to this expression. The argument is popped off the head of the expressions.- Parameters:
arg- argument to add to the expression
-
getFileStatus
Returns theFileStatusfrom thePathDataitem. If the current options require links to be followed then the returned file status is that of the linked file.- Parameters:
item- PathDatadepth- current depth in the process directories- Returns:
- FileStatus
- Throws:
IOException- raised on errors performing I/O.
-
getPath
- Parameters:
item- PathData- Returns:
- Path
- Throws:
IOException- raised on errors performing I/O.
-
getFileSystem
Returns theFileSystemassociated with thePathDataitem.- Parameters:
item- PathData- Returns:
- FileSystem
- Throws:
IOException- raised on errors performing I/O.
-