|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.perforce.p4java.impl.mapbased.server.Server
com.perforce.p4java.impl.mapbased.rpc.RpcServer
public abstract class RpcServer
RPC-based Perforce server implementation superclass.
| Field Summary | |
|---|---|
protected int |
clientApiLevel
|
protected long |
connectionStart
|
static int |
DEFAULT_CLIENT_API_LEVEL
Default Perforce client API level; 68 represents 2010.2 capabilities. |
static String |
DEFAULT_PROG_NAME
The default string sent to the Perforce server in the protocol command defining the client's program name. |
static String |
DEFAULT_PROG_VERSION
The default string sent to the Perforce server in the protocol command defining the client's program version. |
static int |
DEFAULT_SERVER_API_LEVEL
Default Perforce server API level; 99999 apparently means "whatever...". |
static IServerImplMetadata.ImplType |
IMPL_TYPE
The implementation type of this implementation. |
protected String |
localHostName
|
protected boolean |
relaxCmdNameValidationChecks
If true, relax the command name validation checks done in the RPC layer. |
static String |
RPC_ENV_CWD_KEY
The system properties key for the JVM's current directory. |
static String |
RPC_ENV_NOCLIENT_SPEC
What we use in the RPC environment packet to signal to the Perforce server that we don't have a client set yet or don't know what it is. |
static String |
RPC_ENV_NOHOST_SPEC
What we use in the RPC environment packet to signal to the Perforce server that we don't have a hostname set yet or don't know what it is. |
static String |
RPC_ENV_NOUSER_SPEC
What we use in the RPC environment packet to signal to the Perforce server that we don't have a client set yet or don't know what it is. |
static String |
RPC_ENV_OS_NAME_KEY
The system properties key for the OS name. |
static String |
RPC_ENV_UNIX_SPEC
What we use in the RPC environment packet to signal to the Perforce server that we're a NON-Windows box. |
static String |
RPC_ENV_WINDOWS_PREFIX
RPC_ENV_OS_NAME_KEY property value prefix for Windows systems. |
static String |
RPC_ENV_WINDOWS_SPEC
What we use in the RPC environment packet to signal to the Perforce server that we're a Windows box. |
static boolean |
RPC_TAGS_USED
Signifies whether or not we use tagged output. |
static String |
RPC_TMP_CONVERTER_KEY
Use to key converter to use out of state map |
static String |
RPC_TMP_OUTFILE_STREAM_KEY
Used to key temporary output streams in the command environment's state map for things like getFileContents(), etc., using the execStreamCmd method(s). |
protected String |
secretKey
|
protected int |
serverApiLevel
|
protected String |
serverId
|
protected Map<String,Object> |
serverProtocolMap
|
protected ServerStats |
serverStats
|
static String |
TRACE_PREFIX
What we use as a P4JTracer trace prefix for methods here. |
| Constructor Summary | |
|---|---|
RpcServer()
|
|
| Method Summary | |
|---|---|
void |
connect()
Try to establish an actual RPC connection to the target Perforce server. |
void |
disconnect()
Try to cleanly disconnect from the Perforce server at the other end of the current connection (with the emphasis on "cleanly"). |
int |
getClientApiLevel()
|
protected String |
getClientNameForEnv()
|
String |
getErrorOrInfoStr(Map<String,Object> map)
|
String |
getErrorStr(Map<String,Object> map)
RPC impl errors come across the wire as a map in the form usually like this: |
protected int |
getGenericCode(Map<String,Object> map)
|
protected String |
getHostForEnv()
|
String |
getInfoStr(Map<String,Object> map)
|
protected String |
getLanguageForEnv()
|
protected String |
getOsTypeForEnv()
|
PerformanceMonitor |
getPerfMonitor()
|
String |
getSecretKey()
|
String |
getServerId()
Get the server's id field used for storing authentication tickets. |
int |
getSeverityCode(Map<String,Object> map)
|
protected String |
getUserForEnv()
|
ServerStatus |
init(String host,
int port,
Properties props)
The default init sets up things like host names, etc., and fails if we can't establish some pretty basic things at connect time. |
ServerStatus |
init(String host,
int port,
Properties props,
UsageOptions opts)
Initialize the server. |
boolean |
isAuthFail(String errStr)
|
boolean |
isInfoMessage(Map<String,Object> map)
|
protected boolean |
isRelaxCmdNameValidationChecks()
|
String |
loadTicket(String serverId)
Get the p4tickets entry value for the current user returned from Server.getUserName() and server address based upon a search of either
the file found at PropertyDefs.TICKET_PATH_KEY_SHORT_FORM,
PropertyDefs.TICKET_PATH_KEY, the P4TICKETS environment variable
or the standard p4tickets file location for the current OS. |
protected void |
processCmdCallbacks(int cmdCallBackKey,
long timeTaken,
Map<String,Object>[] retMap)
|
void |
saveCurrentTicket()
Save current ticket returned from Server.getAuthTicket(). |
void |
saveTicket(String ticketValue)
Save specified auth ticket value as associate with this server's address and configured user returned from Server.getUserName(). |
void |
setClientApiLevel(int clientApiLevel)
|
void |
setPerfMonitor(PerformanceMonitor perfMonitor)
|
protected void |
setRelaxCmdNameValidationChecks(boolean relaxCmdNameValidationChecks)
|
void |
setSecretKey(String secretKey)
|
void |
setServerId(String serverId)
Set the server's id field used for storing authentication tickets. |
boolean |
supportsSmartMove()
Return true IFF the underlying Perforce server supports the new 2009.1 and later "smart move" command. |
protected boolean |
writeInPlace(String cmdName)
Return true iff we should be performing server -> client file write I/O operations in place for this command. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final IServerImplMetadata.ImplType IMPL_TYPE
public static final String DEFAULT_PROG_NAME
public static final String DEFAULT_PROG_VERSION
public static final int DEFAULT_CLIENT_API_LEVEL
public static final int DEFAULT_SERVER_API_LEVEL
public static final boolean RPC_TAGS_USED
public static final String RPC_ENV_CWD_KEY
public static final String RPC_ENV_OS_NAME_KEY
public static final String RPC_ENV_WINDOWS_PREFIX
public static final String RPC_ENV_WINDOWS_SPEC
public static final String RPC_ENV_UNIX_SPEC
public static final String RPC_ENV_NOCLIENT_SPEC
public static final String RPC_ENV_NOHOST_SPEC
public static final String RPC_ENV_NOUSER_SPEC
public static final String TRACE_PREFIX
public static final String RPC_TMP_OUTFILE_STREAM_KEY
public static final String RPC_TMP_CONVERTER_KEY
protected String localHostName
protected int clientApiLevel
protected int serverApiLevel
protected long connectionStart
protected Map<String,Object> serverProtocolMap
protected ServerStats serverStats
protected String serverId
protected String secretKey
protected boolean relaxCmdNameValidationChecks
| Constructor Detail |
|---|
public RpcServer()
| Method Detail |
|---|
public ServerStatus init(String host,
int port,
Properties props)
throws ConfigException,
ConnectionException
init in interface IServerControlinit in class Serverhost - the Perforce server hostname or IP address as passed in to the factory methodport - the Perforce server port number as passed in to the factory method
ConfigException - if there's something wrong with the
specified configuration or associated config files, etc.
ConnectionException - if the server is unreachable on initialization, and that
unreachability is serious and unrecoverable (there are implementations that don't
really do connections per se, so they may not consider this an error or even try
connecting during initialisation).Server.init(java.lang.String, int, java.util.Properties)
public ServerStatus init(String host,
int port,
Properties props,
UsageOptions opts)
throws ConfigException,
ConnectionException
IServerControl
init in interface IServerControlinit in class Serverhost - the Perforce server hostname or IP address as passed in to the factory methodport - the Perforce server port number as passed in to the factory methodprops - the properties passed in to the factory methodopts - the UsageOptions object to be associated with the server object; if null,
the server should construct a new default UsageOptions object.
ConfigException - if there's something wrong with the
specified configuration or associated config files, etc.
ConnectionException - if the server is unreachable on initialization, and that
unreachability is serious and unrecoverable (there are implementations that don't
really do connections per se, so they may not consider this an error or even try
connecting during initialisation).IServerControl.init(java.lang.String, int, java.util.Properties, com.perforce.p4java.option.UsageOptions)
public void connect()
throws ConnectionException,
AccessException,
RequestException,
ConfigException
connect in interface IServerconnect in class ServerConnectionException - if the Perforce server is unreachable or is not
connected.
AccessException - if the Perforce server denies access to the caller
RequestException - if the Perforce server encounters an error during
its processing of the request
ConfigException - if local I/O exception occursServer.connect()
public void disconnect()
throws ConnectionException,
AccessException
disconnect in interface IServerdisconnect in class ServerConnectionException
AccessExceptionServer.disconnect()
public boolean supportsSmartMove()
throws ConnectionException,
RequestException,
AccessException
IServer
ConnectionException - if the Perforce server is unreachable or is not
connected.
RequestException - if the Perforce server encounters an error during
its processing of the request
AccessException - if the Perforce server denies access to the callerIServer.supportsSmartMove()public String getErrorOrInfoStr(Map<String,Object> map)
getErrorOrInfoStr in class ServerServer.getErrorOrInfoStr(java.util.Map)public boolean isInfoMessage(Map<String,Object> map)
isInfoMessage in class Serverpublic int getSeverityCode(Map<String,Object> map)
getSeverityCode in class Serverprotected int getGenericCode(Map<String,Object> map)
getGenericCode in class Serverpublic String getErrorStr(Map<String,Object> map)
fmt0=Access for user '%user%' has not been enabled by 'p4 protect'., func=client-Message, user=nouser, code0=822483067With tags being used for non-error payloads, we can just basically pick up the presence of the code0 entry; if it's there, use fmt0 as the format and the other args as appropriate...
FIXME: work with multiple code/fmt sets... -- HR.
getErrorStr in class ServerServer.getErrorStr(java.util.Map)public String getInfoStr(Map<String,Object> map)
getInfoStr in class ServerServer.getInfoStr(java.util.Map)public boolean isAuthFail(String errStr)
isAuthFail in class ServerServer.isAuthFail(java.lang.String)public int getClientApiLevel()
public void setClientApiLevel(int clientApiLevel)
public PerformanceMonitor getPerfMonitor()
public void setPerfMonitor(PerformanceMonitor perfMonitor)
protected String getOsTypeForEnv()
protected String getLanguageForEnv()
protected String getClientNameForEnv()
protected String getHostForEnv()
protected String getUserForEnv()
protected void processCmdCallbacks(int cmdCallBackKey,
long timeTaken,
Map<String,Object>[] retMap)
public void saveCurrentTicket()
throws P4JavaException
Server.getAuthTicket().
P4JavaExceptionsaveTicket(String)
public void saveTicket(String ticketValue)
throws ConfigException
Server.getUserName(). This will
attempt to write an entry to the p4tickets file either specified as the
P4TICKETS environment variable or at the OS specific default location. If
the ticket value is null then the current entry in the will be cleared.
ticketValue -
ConfigExceptionpublic String loadTicket(String serverId)
Server.getUserName() and server address based upon a search of either
the file found at PropertyDefs.TICKET_PATH_KEY_SHORT_FORM,
PropertyDefs.TICKET_PATH_KEY, the P4TICKETS environment variable
or the standard p4tickets file location for the current OS. Will return
null if not found or if an error occured attempt to lookup the value.
serverId -
Server.setAuthTicket(String) or
null if not found.public void setServerId(String serverId)
serverId - public String getServerId()
protected boolean writeInPlace(String cmdName)
See PropertyDefs.WRITE_IN_PLACE_KEY javadoc for the semantics of this.
cmdName - non-null command command name string
public String getSecretKey()
public void setSecretKey(String secretKey)
protected boolean isRelaxCmdNameValidationChecks()
protected void setRelaxCmdNameValidationChecks(boolean relaxCmdNameValidationChecks)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||