Class RpcPropertyDefs
- java.lang.Object
-
- com.perforce.p4java.impl.mapbased.rpc.RpcPropertyDefs
-
public class RpcPropertyDefs extends java.lang.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
Fields Modifier and Type Field Description static java.lang.String
RPC_APPLICATION_NAME_NICK
If this property is set, attempt to set the underlying RPC protocol 'app' tag to the associated value.static int
RPC_DEFAULT_FILE_BUF_SIZE
Default size in bytes of the "standard" file I/O buffer.static java.lang.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 java.lang.String
RPC_DEFAULT_PROPERTY_DELIMITER
The default property delimiter for RPC properties.static int
RPC_DEFAULT_QUEUE_SIZE
Default blocking queue size used in RPC send / recv queues; size is in elements.static java.lang.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 java.lang.String
RPC_DEFAULT_RECV_BYTE_BUF_SIZE_NICK
Short form for the RPC_DEFAULT_RECV_BYTE_BUF_SIZE property key.static int
RPC_DEFAULT_SECURE_CLIENT_CERT_VALIDATE
Default for Certificate validation Methodstatic int
RPC_DEFAULT_SECURE_CLIENT_TRUST_NAME
Default for Certificate validation Methodstatic java.lang.String
RPC_DEFAULT_SECURE_SOCKET_ENABLED_PROTOCOLS
Default secure socket enabled protocol versions.static java.lang.String
RPC_DEFAULT_SECURE_SOCKET_PROTOCOL
Default secure socket protocol.static boolean
RPC_DEFAULT_SECURE_SOCKET_SET_ENABLED_PROTOCOLS
Default secure socket set enabled protocols.static boolean
RPC_DEFAULT_SECURE_SOCKET_TRUST_ALL
Default secure socket trust all certificates (i.e.static int
RPC_DEFAULT_SEND_BYTE_BUF_SIZE
Default size in bytes of the "standard" send byte buffer.static java.lang.String
RPC_DEFAULT_SEND_BYTE_BUF_SIZE_NICK
Short form for the RPC_DEFAULT_SEND_BYTE_BUF_SIZE property key.static java.lang.String
RPC_PROPERTY_PREFIX
The standard property name prefix for all RPC properties.static java.lang.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 java.lang.String
RPC_SECURE_CLIENT_CERT_VALIDATE_NICK
Client Certificate validation Method, corresponds to p4api ssl.client.cert.validatestatic java.lang.String
RPC_SECURE_CLIENT_TRUST_NAME_NICK
P4TRUST file entries, corresponds to p4api ssl.client.trust.namestatic java.lang.String
RPC_SECURE_SOCKET_ENABLED_PROTOCOLS_NICK
If this property is set, attempt to set enabled protocol versions (SSLSocket.setEnabledProtocols()) for the connection.static java.lang.String
RPC_SECURE_SOCKET_PROTOCOL_NICK
If this property is set, attempt to instantiate the SSLContext with the associated value.static java.lang.String
RPC_SECURE_SOCKET_SET_ENABLED_PROTOCOLS_NICK
If this property is set and equals "false", do not attempt to set enabled protocol versions (SSLSocket.setEnabledProtocols()) for the connection and use the protocol versions currently enabled for the connection.static java.lang.String
RPC_SECURE_SOCKET_TRUST_ALL_NICK
If this property is set and equals "false", do not trust all certificates.static int[]
RPC_SOCKET_PERFORMANCE_PREFERENCES_DEFAULT
Default socket performance preferences are described by three integers whose values indicate the relative importance of short connection time, low latency, and high bandwidth.static java.lang.String
RPC_SOCKET_PERFORMANCE_PREFERENCES_NICK
If this property is set, attempt to set the underlying RPC socket's performance preferences to the associated values, in integers, delimited by commas.static int
RPC_SOCKET_POOL_DEFAULT_SIZE
Default number of sockets retained in poolstatic java.lang.String
RPC_SOCKET_POOL_SIZE_NICK
Number of sockets to retain in pool when releasedstatic java.lang.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 java.lang.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 int
RPC_SOCKET_SO_TIMEOUT_DEFAULT
Default number of milliseconds to use for RPC socket read or write timeouts.static java.lang.String
RPC_SOCKET_SO_TIMEOUT_NICK
The number of milliseconds to use for RPC socket read or write timeouts.static boolean
RPC_SOCKET_TCP_NO_DELAY_DEFAULT
Default setting for enable/disable TCP_NODELAY (disable/enable Nagle's algorithm).static java.lang.String
RPC_SOCKET_TCP_NO_DELAY_NICK
If this property is set, attempt to use the associated value to enable/disable TCP_NODELAY (disable/enable Nagle's algorithm).static java.lang.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
Constructors Constructor Description RpcPropertyDefs()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static java.lang.String
getProperty(java.util.Properties props, java.lang.String nick)
Convenience method to first try to get the short form from the passed-in properties, then try for the long form.static java.lang.String
getProperty(java.util.Properties props, java.lang.String nick, java.lang.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(java.util.Properties props, java.lang.String nick, boolean defaultValue)
Return a named property a boolean, if possible.static int
getPropertyAsInt(java.util.Properties props, java.lang.String nick, int defaultValue)
Return a named property as an int, if possible.static int[]
getPropertyAsIntArray(java.util.Properties props, java.lang.String nick, java.lang.String delimiter, int[] defaultValues)
Return a named property as an int array, if possible.
-
-
-
Field Detail
-
RPC_PROPERTY_PREFIX
public static final java.lang.String RPC_PROPERTY_PREFIX
The standard property name prefix for all RPC properties.- See Also:
- Constant Field Values
-
RPC_DEFAULT_PROPERTY_DELIMITER
public static final java.lang.String RPC_DEFAULT_PROPERTY_DELIMITER
The default property delimiter for 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 java.lang.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 java.lang.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 java.lang.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_TCP_NO_DELAY_DEFAULT
public static final boolean RPC_SOCKET_TCP_NO_DELAY_DEFAULT
Default setting for enable/disable TCP_NODELAY (disable/enable Nagle's algorithm).- See Also:
- Constant Field Values
-
RPC_SOCKET_TCP_NO_DELAY_NICK
public static final java.lang.String RPC_SOCKET_TCP_NO_DELAY_NICK
If this property is set, attempt to use the associated value to enable/disable TCP_NODELAY (disable/enable Nagle's algorithm).- See Also:
- Constant Field Values
-
RPC_SOCKET_USE_KEEPALIVE_NICK
public static final java.lang.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_DEFAULT
public static final int RPC_SOCKET_SO_TIMEOUT_DEFAULT
Default number of milliseconds to use for RPC socket read or write timeouts.- See Also:
- Constant Field Values
-
RPC_SOCKET_SO_TIMEOUT_NICK
public static final java.lang.String RPC_SOCKET_SO_TIMEOUT_NICK
The number of milliseconds to use for RPC socket read or write timeouts. If set to zero, timeouts are disabled.- See Also:
- Constant Field Values
-
RPC_SOCKET_PERFORMANCE_PREFERENCES_DEFAULT
public static final int[] RPC_SOCKET_PERFORMANCE_PREFERENCES_DEFAULT
Default socket performance preferences are described by three integers whose values indicate the relative importance of short connection time, low latency, and high bandwidth.
-
RPC_SOCKET_PERFORMANCE_PREFERENCES_NICK
public static final java.lang.String RPC_SOCKET_PERFORMANCE_PREFERENCES_NICK
If this property is set, attempt to set the underlying RPC socket's performance preferences to the associated values, in integers, delimited by commas. Note that you must specify exactly three integers, otherwise this property will be ignored.The absolute values of the integers are irrelevant; in order to choose a protocol the values are simply compared, with larger values indicating stronger preferences. Negative values represent a lower priority than positive values.
If the application prefers short connection time over both low latency and high bandwidth, for example, then it could invoke this method with the values (1, 0, 0). If the application prefers high bandwidth above low latency, and low latency above short connection time, then it could invoke this method with the values (0, 1, 2).
- See Also:
- Constant Field Values
-
RPC_SOCKET_RECV_BUF_SIZE_NICK
public static final java.lang.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 java.lang.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 java.lang.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 java.lang.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_SECURE_SOCKET_TRUST_ALL_NICK
public static final java.lang.String RPC_SECURE_SOCKET_TRUST_ALL_NICK
If this property is set and equals "false", do not trust all certificates.- See Also:
- Constant Field Values
-
RPC_DEFAULT_SECURE_SOCKET_TRUST_ALL
public static final boolean RPC_DEFAULT_SECURE_SOCKET_TRUST_ALL
Default secure socket trust all certificates (i.e. self-signed).- See Also:
- Constant Field Values
-
RPC_SECURE_SOCKET_PROTOCOL_NICK
public static final java.lang.String RPC_SECURE_SOCKET_PROTOCOL_NICK
If this property is set, attempt to instantiate the SSLContext with the associated value. The property value represents a standard name of a protocol (for example, TLS, SSL, etc.).Use Security.getProviders(), Provider.getServices() and Service.getAlgorithm() to list all the providers and the algorithms supporter.
- See Also:
- Constant Field Values
-
RPC_DEFAULT_SECURE_SOCKET_PROTOCOL
public static final java.lang.String RPC_DEFAULT_SECURE_SOCKET_PROTOCOL
Default secure socket protocol.- See Also:
- Constant Field Values
-
RPC_SECURE_CLIENT_CERT_VALIDATE_NICK
public static final java.lang.String RPC_SECURE_CLIENT_CERT_VALIDATE_NICK
Client Certificate validation Method, corresponds to p4api ssl.client.cert.validate0: always use the P4TRUST mechanism. This is pre 2022.1 behavior.
1: validate the certificate chain (default)
2: validate the subject matches the P4PORT. The chain is not validated. but the CN of the certificate is compared to the host in the P4PORT.
- See Also:
- Constant Field Values
-
RPC_DEFAULT_SECURE_CLIENT_CERT_VALIDATE
public static final int RPC_DEFAULT_SECURE_CLIENT_CERT_VALIDATE
Default for Certificate validation Method- See Also:
- Constant Field Values
-
RPC_SECURE_CLIENT_TRUST_NAME_NICK
public static final java.lang.String RPC_SECURE_CLIENT_TRUST_NAME_NICK
P4TRUST file entries, corresponds to p4api ssl.client.trust.name0: Only IP address This is pre 2022.1 behavior.
1: both IP and hostname (default)
2: Only hostname The chain is not validated. but the CN of the certificate is compared to the host in the P4PORT.
- See Also:
- Constant Field Values
-
RPC_DEFAULT_SECURE_CLIENT_TRUST_NAME
public static final int RPC_DEFAULT_SECURE_CLIENT_TRUST_NAME
Default for Certificate validation Method- See Also:
- Constant Field Values
-
RPC_SECURE_SOCKET_SET_ENABLED_PROTOCOLS_NICK
public static final java.lang.String RPC_SECURE_SOCKET_SET_ENABLED_PROTOCOLS_NICK
If this property is set and equals "false", do not attempt to set enabled protocol versions (SSLSocket.setEnabledProtocols()) for the connection and use the protocol versions currently enabled for the connection.- See Also:
- Constant Field Values
-
RPC_DEFAULT_SECURE_SOCKET_SET_ENABLED_PROTOCOLS
public static final boolean RPC_DEFAULT_SECURE_SOCKET_SET_ENABLED_PROTOCOLS
Default secure socket set enabled protocols.- See Also:
- Constant Field Values
-
RPC_SECURE_SOCKET_ENABLED_PROTOCOLS_NICK
public static final java.lang.String RPC_SECURE_SOCKET_ENABLED_PROTOCOLS_NICK
If this property is set, attempt to set enabled protocol versions (SSLSocket.setEnabledProtocols()) for the connection. The property value represents a comma-separated list of one or more protocol versions (for example, TLSv1, SSLv3, etc.).Use SSLSocket.getSupportedProtocols() and SSLSocket.getEnabledProtocols() to list all supported and enabled protocol versions for the connection.
- See Also:
- Constant Field Values
-
RPC_DEFAULT_SECURE_SOCKET_ENABLED_PROTOCOLS
public static final java.lang.String RPC_DEFAULT_SECURE_SOCKET_ENABLED_PROTOCOLS
Default secure socket enabled protocol versions.The current server (12.1) limit the protocol version support to the IETF-standard TLSv1.
- See Also:
- Constant Field Values
-
RPC_RELAX_CMD_NAME_CHECKS_NICK
public static final java.lang.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
-
RPC_APPLICATION_NAME_NICK
public static final java.lang.String RPC_APPLICATION_NAME_NICK
If this property is set, attempt to set the underlying RPC protocol 'app' tag to the associated value.- See Also:
- Constant Field Values
-
-
Method Detail
-
getProperty
public static java.lang.String getProperty(java.util.Properties props, java.lang.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.
- Parameters:
props
- propsnick
- nick- Returns:
- property
-
getProperty
public static java.lang.String getProperty(java.util.Properties props, java.lang.String nick, java.lang.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.
- Parameters:
props
- propsnick
- nickdefaultValue
- defaultValue- Returns:
- property
-
getPropertyAsInt
public static int getPropertyAsInt(java.util.Properties props, java.lang.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.
- Parameters:
props
- propsnick
- nickdefaultValue
- defaultValue- Returns:
- value
-
getPropertyAsIntArray
public static int[] getPropertyAsIntArray(java.util.Properties props, java.lang.String nick, java.lang.String delimiter, int[] defaultValues)
Return a named property as an int array, if possible. The property value is split into values by a specified delimiter (if null, a default delimiter will be used). Return an empty int array 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 an empty int array.
- Parameters:
props
- propsnick
- nickdelimiter
- delimiterdefaultValues
- defaultValues- Returns:
- int array
-
getPropertyAsBoolean
public static boolean getPropertyAsBoolean(java.util.Properties props, java.lang.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.
- Parameters:
props
- propsnick
- nickdefaultValue
- defaultValue- Returns:
- boolean
-
-