Package org.apache.solr.common.util
Class CommandOperation
- java.lang.Object
-
- org.apache.solr.common.util.CommandOperation
-
public class CommandOperation extends Object
-
-
Constructor Summary
Constructors Constructor Description CommandOperation(String operationName, Object metaData)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addError(String s)
static List<Map>
captureErrors(List<CommandOperation> ops)
static List<CommandOperation>
clone(List<CommandOperation> ops)
boolean
getBoolean(String key, boolean def)
Object
getCommandData()
CommandOperation
getCopy()
Map<String,Object>
getDataMap()
List<String>
getErrors()
Integer
getInt(String name)
Integer
getInt(String name, Integer def)
Map
getMap(String key, Map def)
String
getStr(String key)
Get a required field.String
getStr(String key, String def)
List<String>
getStrs(String key)
List<String>
getStrs(String key, List<String> def)
Get collection of values for a key.Object
getVal(String key)
Map<String,Object>
getValuesExcluding(String... keys)
Get all the values from the metadata for the command without the specified keysboolean
hasError()
static List<CommandOperation>
parse(InputStream in, Set<String> singletonCommands)
Parse the command operations into command objects from javabin payload * @param singletonCommands commands that cannot be repeatedstatic List<CommandOperation>
parse(Reader rdr)
static List<CommandOperation>
parse(Reader rdr, Set<String> singletonCommands)
Parse the command operations into command objects from a json payloadstatic List<CommandOperation>
readCommands(Iterable<ContentStream> streams, NamedList resp)
static List<CommandOperation>
readCommands(Iterable<ContentStream> streams, NamedList resp, Set<String> singletonCommands)
Read commands from request streamsvoid
setCommandData(Object o)
String
toString()
void
unknownOperation()
-
-
-
Field Detail
-
name
public final String name
-
ERR_MSGS
public static final String ERR_MSGS
- See Also:
- Constant Field Values
-
ROOT_OBJ
public static final String ROOT_OBJ
- See Also:
- Constant Field Values
-
-
Method Detail
-
getCommandData
public Object getCommandData()
-
getBoolean
public boolean getBoolean(String key, boolean def)
-
setCommandData
public void setCommandData(Object o)
-
unknownOperation
public void unknownOperation()
-
getStrs
public List<String> getStrs(String key, List<String> def)
Get collection of values for a key. If only one val is present a single value collection is returned
-
hasError
public boolean hasError()
-
addError
public void addError(String s)
-
getValuesExcluding
public Map<String,Object> getValuesExcluding(String... keys)
Get all the values from the metadata for the command without the specified keys
-
captureErrors
public static List<Map> captureErrors(List<CommandOperation> ops)
-
parse
public static List<CommandOperation> parse(Reader rdr) throws IOException
- Throws:
IOException
-
parse
public static List<CommandOperation> parse(InputStream in, Set<String> singletonCommands) throws IOException
Parse the command operations into command objects from javabin payload * @param singletonCommands commands that cannot be repeated- Throws:
IOException
-
parse
public static List<CommandOperation> parse(Reader rdr, Set<String> singletonCommands) throws IOException
Parse the command operations into command objects from a json payload- Parameters:
rdr
- The payloadsingletonCommands
- commands that cannot be repeated- Returns:
- parsed list of commands
- Throws:
IOException
-
getCopy
public CommandOperation getCopy()
-
readCommands
public static List<CommandOperation> readCommands(Iterable<ContentStream> streams, NamedList resp) throws IOException
- Throws:
IOException
-
readCommands
public static List<CommandOperation> readCommands(Iterable<ContentStream> streams, NamedList resp, Set<String> singletonCommands) throws IOException
Read commands from request streams- Parameters:
streams
- the streamsresp
- solr query responsesingletonCommands
- , commands that cannot be repeated- Returns:
- parsed list of commands
- Throws:
IOException
- if there is an error while parsing the stream
-
clone
public static List<CommandOperation> clone(List<CommandOperation> ops)
-
-