com.perforce.p4java.impl.mapbased.rpc
Class RpcPropertyDefs

java.lang.Object
  extended by com.perforce.p4java.impl.mapbased.rpc.RpcPropertyDefs

public class RpcPropertyDefs
extends Object

A convenience class used to hold all publicly-visible properties keys used by the RPC implementation.

The intention here is to simply centralize property key names so end users have some idea what's available and what each key's semantics are. This is NOT intended as a full property repository -- property management is generally up to individual classes and packages.

Note that in general, all properties can have an optional short form ("NICK", Anglo-English for nickname...) which is typically just the full form without the cumbersome com.perforce.whatever prefix; use of the short form is particularly convenient for passing in properties through the url mechanism, but you have to be very careful that there are no conflicting system or environmental properties...

Note that if you add a property somewhere that's likely to be useful to end users, you should use the mechanism here to document it.


Field Summary
static int RPC_DEFAULT_FILE_BUF_SIZE
          Default size in bytes of the "standard" file I/O buffer.
static String RPC_DEFAULT_FILE_BUF_SIZE_NICK
          Short form for the RPC_DEFAULT_FILE_BUF_SIZE property key.
static int RPC_DEFAULT_FILETYPE_PEEK_SIZE
          Default size in bytes of the "peek" we take into local files to try to infer from the contents what type the file is.
static int RPC_DEFAULT_QUEUE_SIZE
          Default blocking queue size used in RPC send / recv queues; size is in elements.
static String RPC_DEFAULT_QUEUE_SIZE_NICK
          If this property is set, attempt to set the underlying RPC connection's queue lengths to the associated value, in elements.
static int RPC_DEFAULT_RECV_BYTE_BUF_SIZE
          Default size in bytes of the "standard" recv byte buffer.
static String RPC_DEFAULT_RECV_BYTE_BUF_SIZE_NICK
          Short form for the RPC_DEFAULT_RECV_BYTE_BUF_SIZE property key.
static int RPC_DEFAULT_SEND_BYTE_BUF_SIZE
          Default size in bytes of the "standard" send byte buffer.
static String RPC_DEFAULT_SEND_BYTE_BUF_SIZE_NICK
          Short form for the RPC_DEFAULT_SEND_BYTE_BUF_SIZE property key.
static String RPC_PROPERTY_PREFIX
          The standard property name prefix for all RPC properties.
static String RPC_RELAX_CMD_NAME_CHECKS_NICK
          If this property is set and equals "true", do not perform command metadata checks in the RPC layer.
static int RPC_SOCKET_POOL_DEFAULT_SIZE
          Default number of sockets retained in pool
static String RPC_SOCKET_POOL_SIZE_NICK
          Number of sockets to retain in pool when released
static String RPC_SOCKET_RECV_BUF_SIZE_NICK
          If this property is set, attempt to set the underlying RPC socket's system receive buffer size to the associated value, in bytes.
static String RPC_SOCKET_SEND_BUF_SIZE_NICK
          If this property is set, attempt to set the underlying RPC socket's system send buffer size to the associated value, in bytes.
static String RPC_SOCKET_SO_TIMEOUT_NICK
          If this property is set, it is interpreted as the number of milliseconds to use for RPC socket read or write timeouts.
static String RPC_SOCKET_USE_KEEPALIVE_NICK
          If this property is set and starts with "n" or "N", DON'T use the socket keepalive option.
 
Constructor Summary
RpcPropertyDefs()
           
 
Method Summary
static String getProperty(Properties props, String nick)
          Convenience method to first try to get the short form from the passed-in properties, then try for the long form.
static String getProperty(Properties props, String nick, String defaultValue)
          Convenience method to first try to get the short form from the passed-in properties, then try for the long form.
static boolean getPropertyAsBoolean(Properties props, String nick, boolean defaultValue)
          Return a named property a boolean, if possible.
static int getPropertyAsInt(Properties props, String nick, int defaultValue)
          Return a named property as an int, if possible.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

RPC_PROPERTY_PREFIX

public static final String RPC_PROPERTY_PREFIX
The standard property name prefix for all RPC properties.

See Also:
Constant Field Values

RPC_DEFAULT_SEND_BYTE_BUF_SIZE

public static final int RPC_DEFAULT_SEND_BYTE_BUF_SIZE
Default size in bytes of the "standard" send byte buffer. Usually interpreted by P4Java as a hint for initial allocation, and may be overridden in the face of actual conditions. It's rare that you'd want to change this.

See Also:
Constant Field Values

RPC_DEFAULT_RECV_BYTE_BUF_SIZE

public static final int RPC_DEFAULT_RECV_BYTE_BUF_SIZE
Default size in bytes of the "standard" recv byte buffer. Usually interpreted by P4Java as a hint for initial allocation, and may be overridden in the face of actual conditions. It's rare that you'd want to change this.

See Also:
Constant Field Values

RPC_DEFAULT_SEND_BYTE_BUF_SIZE_NICK

public static final String RPC_DEFAULT_SEND_BYTE_BUF_SIZE_NICK
Short form for the RPC_DEFAULT_SEND_BYTE_BUF_SIZE property key.

See Also:
Constant Field Values

RPC_DEFAULT_RECV_BYTE_BUF_SIZE_NICK

public static final String RPC_DEFAULT_RECV_BYTE_BUF_SIZE_NICK
Short form for the RPC_DEFAULT_RECV_BYTE_BUF_SIZE property key.

See Also:
Constant Field Values

RPC_DEFAULT_FILE_BUF_SIZE

public static final int RPC_DEFAULT_FILE_BUF_SIZE
Default size in bytes of the "standard" file I/O buffer. Usually interpreted by P4Java as a hint for initial allocation, and may be overridden in the face of actual conditions.

See Also:
Constant Field Values

RPC_DEFAULT_FILE_BUF_SIZE_NICK

public static final String RPC_DEFAULT_FILE_BUF_SIZE_NICK
Short form for the RPC_DEFAULT_FILE_BUF_SIZE property key.

See Also:
Constant Field Values

RPC_DEFAULT_FILETYPE_PEEK_SIZE

public static final int RPC_DEFAULT_FILETYPE_PEEK_SIZE
Default size in bytes of the "peek" we take into local files to try to infer from the contents what type the file is.

See Also:
Constant Field Values

RPC_SOCKET_USE_KEEPALIVE_NICK

public static final String RPC_SOCKET_USE_KEEPALIVE_NICK
If this property is set and starts with "n" or "N", DON'T use the socket keepalive option. Defaults to using keepalive.

See Also:
Constant Field Values

RPC_SOCKET_SO_TIMEOUT_NICK

public static final String RPC_SOCKET_SO_TIMEOUT_NICK
If this property is set, it is interpreted as the number of milliseconds to use for RPC socket read or write timeouts. If not set, or set to zero, timeouts are disabled.

See Also:
Constant Field Values

RPC_SOCKET_RECV_BUF_SIZE_NICK

public static final String RPC_SOCKET_RECV_BUF_SIZE_NICK
If this property is set, attempt to set the underlying RPC socket's system receive buffer size to the associated value, in bytes.

See Also:
Constant Field Values

RPC_SOCKET_SEND_BUF_SIZE_NICK

public static final String RPC_SOCKET_SEND_BUF_SIZE_NICK
If this property is set, attempt to set the underlying RPC socket's system send buffer size to the associated value, in bytes.

See Also:
Constant Field Values

RPC_DEFAULT_QUEUE_SIZE

public static final int RPC_DEFAULT_QUEUE_SIZE
Default blocking queue size used in RPC send / recv queues; size is in elements.

See Also:
Constant Field Values

RPC_DEFAULT_QUEUE_SIZE_NICK

public static final String RPC_DEFAULT_QUEUE_SIZE_NICK
If this property is set, attempt to set the underlying RPC connection's queue lengths to the associated value, in elements.

See Also:
Constant Field Values

RPC_SOCKET_POOL_SIZE_NICK

public static final String RPC_SOCKET_POOL_SIZE_NICK
Number of sockets to retain in pool when released

See Also:
Constant Field Values

RPC_SOCKET_POOL_DEFAULT_SIZE

public static final int RPC_SOCKET_POOL_DEFAULT_SIZE
Default number of sockets retained in pool

See Also:
Constant Field Values

RPC_RELAX_CMD_NAME_CHECKS_NICK

public static final String RPC_RELAX_CMD_NAME_CHECKS_NICK
If this property is set and equals "true", do not perform command metadata checks in the RPC layer. This is not recommended, and you're on your own if you set this to true -- any number of "interesting" things can happen if not used properly.

See Also:
Constant Field Values
Constructor Detail

RpcPropertyDefs

public RpcPropertyDefs()
Method Detail

getProperty

public static String getProperty(Properties props,
                                 String nick)
Convenience method to first try to get the short form from the passed-in properties, then try for the long form. Returns null if it can't find a definition associated with either short or long form keys.

Note: this method is null safe, i.e. if either or both props or nick is null, it simply returns null.


getProperty

public static String getProperty(Properties props,
                                 String nick,
                                 String defaultValue)
Convenience method to first try to get the short form from the passed-in properties, then try for the long form. Returns defaultValue if it can't find a definition associated with either short or long form keys.

Note: this method is null safe, i.e. if either or both props or nick is null, it simply returns null.


getPropertyAsInt

public static int getPropertyAsInt(Properties props,
                                   String nick,
                                   int defaultValue)
Return a named property as an int, if possible. Defaults to defaultValue if the property wasn't found under first its short form, then its long form, or if the resulting attempt to convert to an integer was unsuccessful.

Will log to P4JLog any conversion error as a warning.

Note: this method is null safe, i.e. if either or both props or nick is null, it simply returns defaultValue.


getPropertyAsBoolean

public static boolean getPropertyAsBoolean(Properties props,
                                           String nick,
                                           boolean defaultValue)
Return a named property a boolean, if possible. Defaults to defaultValue if the property wasn't found under first its short form, then its long form, or if the resulting attempt to convert to an integer was unsuccessful.

Will log to P4JLog any conversion error as a warning.

Note: this method is null safe, i.e. if either or both props or nick is null, it simply returns defaultValue.



Copyright © 2011 Perforce Software. All Rights Reserved.