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
- 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
ConstructorsConstructorDescriptionCounterDelegator(IOptionsServer server) Instantiates a new change delegator. -
Method Summary
Modifier and TypeMethodDescriptionvoiddeleteCounter(String counterName, boolean perforceCounter) getCounter(String counterName) getCounter(String counterName, CounterOptions opts) Get the value of a named Perforce counter from the Perforce server.voidsetCounter(String counterName, String value, boolean perforceCounter) setCounter(String counterName, String value, CounterOptions opts) Create, set or delete a counter on a Perforce server.
-
Constructor Details
-
CounterDelegator
Instantiates a new change delegator.- Parameters:
server- the server
-
-
Method Details
-
getCounter
public String getCounter(String counterName) throws ConnectionException, RequestException, AccessException - Specified by:
getCounterin interfaceICounterDelegator- Throws:
ConnectionExceptionRequestExceptionAccessException
-
getCounter
Description copied from interface:ICounterDelegatorGet 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:
getCounterin 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(String counterName, String value, boolean perforceCounter) throws ConnectionException, RequestException, AccessException - Specified by:
setCounterin interfaceICounterDelegator- Throws:
ConnectionExceptionRequestExceptionAccessException
-
setCounter
public String setCounter(String counterName, String value, CounterOptions opts) throws P4JavaException Description copied from interface:ICounterDelegatorCreate, 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:
setCounterin 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(String counterName, boolean perforceCounter) throws ConnectionException, RequestException, AccessException - Specified by:
deleteCounterin interfaceICounterDelegator- Throws:
ConnectionExceptionRequestExceptionAccessException
-