Class CounterDelegator
- java.lang.Object
-
- com.perforce.p4java.impl.mapbased.server.cmd.BaseDelegator
-
- com.perforce.p4java.impl.mapbased.server.cmd.CounterDelegator
-
- All Implemented Interfaces:
ICounterDelegator
public class CounterDelegator extends BaseDelegator implements ICounterDelegator
- Since:
- 26/09/2016
-
-
Field Summary
-
Fields inherited from class com.perforce.p4java.impl.mapbased.server.cmd.BaseDelegator
MAX_LIMIT_SUPPORTED_MIN_VERSION, QUERY_EXPRESSIONS_SUPPORTED_MIN_VERSION, USER_RESTRICTIONS_SUPPORTED_MIN_VERSION
-
-
Constructor Summary
Constructors Constructor Description CounterDelegator(IOptionsServer server)
Instantiates a new change delegator.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
deleteCounter(java.lang.String counterName, boolean perforceCounter)
java.lang.String
getCounter(java.lang.String counterName)
java.lang.String
getCounter(java.lang.String counterName, CounterOptions opts)
Get the value of a named Perforce counter from the Perforce server.void
setCounter(java.lang.String counterName, java.lang.String value, boolean perforceCounter)
java.lang.String
setCounter(java.lang.String counterName, java.lang.String value, CounterOptions opts)
Create, set or delete a counter on a Perforce server.
-
-
-
Constructor Detail
-
CounterDelegator
public CounterDelegator(IOptionsServer server)
Instantiates a new change delegator.- Parameters:
server
- the server
-
-
Method Detail
-
getCounter
public java.lang.String getCounter(java.lang.String counterName) throws ConnectionException, RequestException, AccessException
- Specified by:
getCounter
in interfaceICounterDelegator
- Throws:
ConnectionException
RequestException
AccessException
-
getCounter
public java.lang.String getCounter(java.lang.String counterName, CounterOptions opts) throws P4JavaException
Description copied from interface:ICounterDelegator
Get the value of a named Perforce counter from the Perforce server. Note that this method will return a zero string (i.e. "0") if the named counter doesn't exist (rather than throw an exception); use getCounters to see if a counter actually exists before you use it.Note that despite their name, counters can be any value, not just a number; hence the string return value here.
- Specified by:
getCounter
in interfaceICounterDelegator
- Parameters:
counterName
- non-null counter name.opts
- CounterOptions object describing optional parameters; if null, no options are set.- Returns:
- non-null (but possibly empty or useless) counter value associated with counterName.
- Throws:
P4JavaException
- if an error occurs processing this method and its parameters.
-
setCounter
public void setCounter(java.lang.String counterName, java.lang.String value, boolean perforceCounter) throws ConnectionException, RequestException, AccessException
- Specified by:
setCounter
in interfaceICounterDelegator
- Throws:
ConnectionException
RequestException
AccessException
-
setCounter
public java.lang.String setCounter(java.lang.String counterName, java.lang.String value, CounterOptions opts) throws P4JavaException
Description copied from interface:ICounterDelegator
Create, set or delete a counter on a Perforce server. This method can be used to create, set, increment, or delete a counter according to the specific options set in the associated options object. Note that the increment operation does not work on servers earlier than 10.1, and that the return value is never guaranteed to be non-null -- use with caution.- Specified by:
setCounter
in interfaceICounterDelegator
- Parameters:
counterName
- non-null counter name.value
- value the counter should be set to; can be null if the set operation is an increment.opts
- CounterOptions object describing optional parameters; if null, no options are set.- Returns:
- possibly-null current (post-set, post-increment) value; may be zero if the operation was a delete; may not be reliable for pre 10.1 servers.
- Throws:
P4JavaException
- if an error occurs processing this method and its parameters.
-
deleteCounter
public void deleteCounter(java.lang.String counterName, boolean perforceCounter) throws ConnectionException, RequestException, AccessException
- Specified by:
deleteCounter
in interfaceICounterDelegator
- Throws:
ConnectionException
RequestException
AccessException
-
-