Class CommandEnv
- java.lang.Object
-
- com.perforce.p4java.impl.mapbased.rpc.CommandEnv
-
public class CommandEnv extends java.lang.Object
Used to package up the Perforce function environment for a single Perforce command across multiple RPC function calls.In particular, we need to keep things like file handles, arbitrary RPC function arguments, etc., around for use during complex long-running commands that span many dispatch calls in loop or duplex mode, etc., in response to single user commands like 'sync'.
Note that this is in distinction to a) the command's external environment (in the ExternalEnv class), and b) the command's individual function environments,
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description class
CommandEnv.RpcHandler
P4Java's version of the notorious handler class in the C++ API.
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
LINE_SEPARATOR
Sequence used by operating system to separate lines in text files.static int
MAX_HANDLERS
Max number of live handlers per command cycle.
-
Constructor Summary
Constructors Constructor Description CommandEnv(RpcServer server, RpcCmdSpec cmdSpec, RpcConnection rpcConnection, ProtocolCommand protocolSpecs, java.util.Map<java.lang.String,java.lang.Object> serverProtocolSpecsMap, IProgressCallback progressCallback, int cmdCallBackKey, boolean syncInPlace, boolean nonCheckedSyncs)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
addHandler(CommandEnv.RpcHandler handler)
void
clearLastResultMap()
int
getCmdCallBackKey()
RpcCmdSpec
getCmdSpec()
RpcPacketFieldRule
getFieldRule()
IFilterCallback
getFilterCallback()
CommandEnv.RpcHandler
getHandler(java.lang.String handlerName)
CommandEnv.RpcHandler[]
getHandlers()
IParallelCallback
getParallelCallback()
IProgressCallback
getProgressCallback()
ProtocolCommand
getProtocolSpecs()
java.util.List<java.util.Map<java.lang.String,java.lang.Object>>
getResultMaps()
RpcConnection
getRpcConnection()
RpcServer
getServer()
int
getServerProtocolLevel()
java.util.Map<java.lang.String,java.lang.Object>
getServerProtocolSpecsMap()
java.util.Map<java.lang.String,java.lang.Object>
getStateMap()
IStreamingCallback
getStreamingCallback()
int
getStreamingCallbackKey()
long
getSyncTime()
void
handlePartialResult(java.util.Map<java.lang.String,java.lang.Object> resultMap)
Handle a partial result by either adding it to the resultsMapVec for later processing or passing it up to the streaming results callback handler.void
handleResult(java.util.Map<java.lang.String,java.lang.Object> resultMap)
Handle a result by either adding it to the resultsMapVec for later processing or passing it up to the streaming results callback handler.boolean
isBufferOutput()
boolean
isDontWriteTicket()
boolean
isNonCheckedSyncs()
boolean
isNullSync()
boolean
isStreamCmd()
boolean
isSyncInPlace()
boolean
isUserCanceled()
void
newHandler()
void
resetPartialResult()
void
setBufferOutput(boolean bufferOutput)
void
setCmdCallBackKey(int cmdCallBackKey)
void
setCmdSpec(RpcCmdSpec cmdSpec)
void
setDontWriteTicket(boolean dontWriteTicket)
void
setFieldRule(RpcPacketFieldRule fieldRule)
void
setFilterCallback(IFilterCallback filterCallback)
void
setHandlers(CommandEnv.RpcHandler[] handlers)
void
setNonCheckedSyncs(boolean nonCheckedSyncs)
void
setNullSync(boolean nullSync)
void
setParallelCallback(IParallelCallback parallelCallback)
void
setProgressCallback(IProgressCallback progressCallback)
void
setProtocolSpecs(ProtocolCommand protocolSpecs)
void
setResultMaps(java.util.List<java.util.Map<java.lang.String,java.lang.Object>> resultMaps)
void
setRpcConnection(RpcConnection rpcConnection)
void
setServerProtocolSpecsMap(java.util.Map<java.lang.String,java.lang.Object> serverProtocolSpecsMap)
void
setStateMap(java.util.Map<java.lang.String,java.lang.Object> stateMap)
void
setStreamCmd(boolean streamCmd)
void
setStreamingCallback(IStreamingCallback streamingCallback)
void
setStreamingCallbackKey(int streamingCallbackKey)
void
setSyncInPlace(boolean syncInPlace)
void
setSyncTime(long syncTime)
void
setUserCanceled(boolean userCanceled)
-
-
-
Field Detail
-
MAX_HANDLERS
public static final int MAX_HANDLERS
Max number of live handlers per command cycle. Value copied straight from the C++ API.- See Also:
- Constant Field Values
-
LINE_SEPARATOR
public static final java.lang.String LINE_SEPARATOR
Sequence used by operating system to separate lines in text files. Default to "\n" if it is not available.
-
-
Constructor Detail
-
CommandEnv
public CommandEnv(RpcServer server, RpcCmdSpec cmdSpec, RpcConnection rpcConnection, ProtocolCommand protocolSpecs, java.util.Map<java.lang.String,java.lang.Object> serverProtocolSpecsMap, IProgressCallback progressCallback, int cmdCallBackKey, boolean syncInPlace, boolean nonCheckedSyncs)
-
-
Method Detail
-
addHandler
public boolean addHandler(CommandEnv.RpcHandler handler)
-
handleResult
public void handleResult(java.util.Map<java.lang.String,java.lang.Object> resultMap)
Handle a result by either adding it to the resultsMapVec for later processing or passing it up to the streaming results callback handler.- Parameters:
resultMap
- resultMap
-
handlePartialResult
public void handlePartialResult(java.util.Map<java.lang.String,java.lang.Object> resultMap)
Handle a partial result by either adding it to the resultsMapVec for later processing or passing it up to the streaming results callback handler.- Parameters:
resultMap
- resultMap
-
resetPartialResult
public void resetPartialResult()
-
getHandler
public CommandEnv.RpcHandler getHandler(java.lang.String handlerName)
-
getCmdSpec
public RpcCmdSpec getCmdSpec()
-
setCmdSpec
public void setCmdSpec(RpcCmdSpec cmdSpec)
-
getResultMaps
public java.util.List<java.util.Map<java.lang.String,java.lang.Object>> getResultMaps()
-
setResultMaps
public void setResultMaps(java.util.List<java.util.Map<java.lang.String,java.lang.Object>> resultMaps)
-
clearLastResultMap
public void clearLastResultMap()
-
getStateMap
public java.util.Map<java.lang.String,java.lang.Object> getStateMap()
-
setStateMap
public void setStateMap(java.util.Map<java.lang.String,java.lang.Object> stateMap)
-
getProtocolSpecs
public ProtocolCommand getProtocolSpecs()
-
getServerProtocolLevel
public int getServerProtocolLevel()
-
setProtocolSpecs
public void setProtocolSpecs(ProtocolCommand protocolSpecs)
-
getRpcConnection
public RpcConnection getRpcConnection()
-
setRpcConnection
public void setRpcConnection(RpcConnection rpcConnection)
-
getHandlers
public CommandEnv.RpcHandler[] getHandlers()
-
setHandlers
public void setHandlers(CommandEnv.RpcHandler[] handlers)
-
newHandler
public void newHandler()
-
getServerProtocolSpecsMap
public java.util.Map<java.lang.String,java.lang.Object> getServerProtocolSpecsMap()
-
setServerProtocolSpecsMap
public void setServerProtocolSpecsMap(java.util.Map<java.lang.String,java.lang.Object> serverProtocolSpecsMap)
-
getProgressCallback
public IProgressCallback getProgressCallback()
-
setProgressCallback
public void setProgressCallback(IProgressCallback progressCallback)
-
getCmdCallBackKey
public int getCmdCallBackKey()
-
setCmdCallBackKey
public void setCmdCallBackKey(int cmdCallBackKey)
-
isUserCanceled
public boolean isUserCanceled()
-
setUserCanceled
public void setUserCanceled(boolean userCanceled)
-
isSyncInPlace
public boolean isSyncInPlace()
-
setSyncInPlace
public void setSyncInPlace(boolean syncInPlace)
-
getStreamingCallback
public IStreamingCallback getStreamingCallback()
-
setStreamingCallback
public void setStreamingCallback(IStreamingCallback streamingCallback)
-
getStreamingCallbackKey
public int getStreamingCallbackKey()
-
setStreamingCallbackKey
public void setStreamingCallbackKey(int streamingCallbackKey)
-
isNonCheckedSyncs
public boolean isNonCheckedSyncs()
-
setNonCheckedSyncs
public void setNonCheckedSyncs(boolean nonCheckedSyncs)
-
isDontWriteTicket
public boolean isDontWriteTicket()
-
setDontWriteTicket
public void setDontWriteTicket(boolean dontWriteTicket)
-
isStreamCmd
public boolean isStreamCmd()
-
setStreamCmd
public void setStreamCmd(boolean streamCmd)
-
getFieldRule
public RpcPacketFieldRule getFieldRule()
-
setFieldRule
public void setFieldRule(RpcPacketFieldRule fieldRule)
-
getFilterCallback
public IFilterCallback getFilterCallback()
-
setFilterCallback
public void setFilterCallback(IFilterCallback filterCallback)
-
getParallelCallback
public IParallelCallback getParallelCallback()
-
setParallelCallback
public void setParallelCallback(IParallelCallback parallelCallback)
-
getServer
public RpcServer getServer()
-
getSyncTime
public long getSyncTime()
-
setSyncTime
public void setSyncTime(long syncTime)
-
isNullSync
public boolean isNullSync()
-
setNullSync
public void setNullSync(boolean nullSync)
-
isBufferOutput
public boolean isBufferOutput()
-
setBufferOutput
public void setBufferOutput(boolean bufferOutput)
-
-