public abstract class RpcServer extends Server
Modifier and Type | Field and Description |
---|---|
protected java.lang.String |
applicationName |
protected RpcUserAuthCounter |
authCounter |
protected long |
authFileLockDelay |
protected int |
authFileLockTry |
protected long |
authFileLockWait |
protected int |
clientApiLevel |
protected ClientTrust |
clientTrust |
protected java.util.Map<java.lang.String,java.lang.Object> |
cmdMapArgs
The RPC command args before the function name (i.e.
|
protected long |
connectionStart |
static int |
DEFAULT_CLIENT_API_LEVEL
Default Perforce client API level; 79 represents 2015.2 capabilities.
|
static java.lang.String |
DEFAULT_PROG_NAME
The default string sent to the Perforce server in the protocol command
defining the client's program name.
|
static java.lang.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 java.lang.String |
localHostName |
protected boolean |
relaxCmdNameValidationChecks
If true, relax the command name validation checks done in the RPC layer.
|
static boolean |
RPC_ENABLE_STREAMS
Signifies whether or not the client is capable of handling streams.
|
static java.lang.String |
RPC_ENV_CWD_KEY
The system properties key for the JVM's current directory.
|
static java.lang.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 java.lang.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 java.lang.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 java.lang.String |
RPC_ENV_OS_NAME_KEY
The system properties key for the OS name.
|
static java.lang.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 java.lang.String |
RPC_ENV_WINDOWS_PREFIX
RPC_ENV_OS_NAME_KEY property value prefix for Windows systems.
|
static java.lang.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 java.lang.String |
RPC_TMP_CONVERTER_KEY
Use to key converter to use out of state map
|
static java.lang.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 IServerAddress |
rpcServerAddress |
protected java.util.Map<java.lang.String,java.lang.String> |
secretKeys |
protected int |
serverApiLevel |
protected java.lang.String |
serverId |
protected java.util.Map<java.lang.String,java.lang.Object> |
serverProtocolMap |
protected ServerStats |
serverStats |
protected java.lang.String |
ticketsFilePath |
static java.lang.String |
TRACE_PREFIX
What we use as a P4JTracer trace prefix for methods here.
|
protected java.lang.String |
trustFilePath |
authTickets, caseSensitive, charset, charsetName, client, clientName, clientUnsetName, commandCallback, connected, CORE_AUTH_FAIL_STRING_1, CORE_AUTH_FAIL_STRING_2, CORE_AUTH_FAIL_STRING_3, CORE_AUTH_FAIL_STRING_4, DEFAULT_STATUS_FIELD_NAME, enableAndmaps, enableGraph, enableProgress, enableStreams, enableTracking, ignoreFileName, IMPL_COMMENTS_FIELD_NAME, IMPL_TYPE_FIELD_NAME, loginOnConnect, MINIMUM_SUPPORTED_SERVER_LEVEL_FIELD_NAME, minimumSupportedServerVersion, nextCmdCallBackKey, nextProgressCallbackKey, nonCheckedSyncs, P4IGNORE_ENV_VAR, P4TICKETS_DEFAULT_OTHER, P4TICKETS_DEFAULT_WINDOWS, P4TICKETS_ENV_VAR, P4TRUST_DEFAULT_OTHER, P4TRUST_DEFAULT_WINDOWS, P4TRUST_ENV_VAR, password, progressCallback, props, PROTOCOL_NAME_FIELD_NAME, quietMode, rand, rsh, runningOnWindows, SCREEN_NAME_FIELD_NAME, secure, serverAddress, serverHost, serverInfo, serverPort, serverProtocol, serverVersion, setupOnConnect, ssoCallback, ssoKey, status, tmpDirName, UNKNOWN_SERVER_HOST, UNKNOWN_SERVER_PORT, UNKNOWN_SERVER_VERSION, usageOptions, useAuthMemoryStore, userName
ATTRIBUTE_STREAM_MAP_KEY, IN_MAP_USE_TAGS_KEY
Constructor and Description |
---|
RpcServer() |
Modifier and Type | Method and Description |
---|---|
java.lang.String |
addTrust(java.lang.String fingerprintValue)
Approve and add the specified fingerprint for the Perforce SSL
connection.
|
java.lang.String |
addTrust(java.lang.String fingerprintValue,
TrustOptions options)
Approve and add the specified fingerprint or replacement for the Perforce
SSL connection.
|
java.lang.String |
addTrust(TrustOptions opts)
Approve and add the fingerprint for the Perforce SSL connection.
|
protected void |
checkFingerprint(RpcConnection rpcConnection)
Check the fingerprint of the Perforce server SSL connection
|
protected java.lang.String |
composeAuthTicketEntryKey(java.lang.String userName,
java.lang.String serverAddress)
Compose the key for an auth ticket entry
|
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").
|
java.lang.String |
getApplicationName() |
RpcUserAuthCounter |
getAuthCounter()
Get the RPC user authentication counter.
|
java.lang.String |
getAuthId()
Return the Perforce Server's authId.
|
java.lang.String |
getAuthTicket(java.lang.String userName)
Return the Perforce authentication ticket for specified user.
|
int |
getClientApiLevel() |
protected java.lang.String |
getClientNameForEnv() |
java.lang.String |
getErrorOrInfoStr(java.util.Map<java.lang.String,java.lang.Object> map)
Deprecated.
|
java.lang.String |
getErrorStr(java.util.Map<java.lang.String,java.lang.Object> map)
Deprecated.
|
int |
getGenericCode(java.util.Map<java.lang.String,java.lang.Object> map) |
protected java.lang.String |
getHostForEnv() |
java.lang.String |
getInfoStr(java.util.Map<java.lang.String,java.lang.Object> map)
Deprecated.
|
protected java.lang.String |
getLanguageForEnv() |
protected java.lang.String |
getOsTypeForEnv() |
PerformanceMonitor |
getPerfMonitor() |
protected RpcPacketFieldRule |
getRpcPacketFieldRule(java.util.Map<java.lang.String,java.lang.Object> inMap,
CmdSpec cmdSpec)
Get the RPC packet field rule for skipping the charset conversion of a
range of RPC packet fields; leave the values as bytes.
|
IServerAddress |
getRpcServerAddress()
Get the server's address for the RPC connection.
|
java.lang.String |
getSecretKey() |
java.lang.String |
getSecretKey(java.lang.String userName) |
java.lang.String |
getServerAddress()
Get the server's address field used for storing authentication tickets.
|
java.lang.String |
getServerHostPort()
Get the server's host and port used for the RPC connection.
|
java.lang.String |
getServerId()
Get the server's id field used for storing authentication tickets.
|
int |
getSeverityCode(java.util.Map<java.lang.String,java.lang.Object> map) |
java.lang.String |
getTicketsFilePath()
Return the Perforce authentication tickets file path.
|
java.lang.String |
getTrust()
Return the fingerprint for the Perforce SSL connection.
|
java.lang.String |
getTrustFilePath()
Return the Perforce trust file path.
|
java.util.List<Fingerprint> |
getTrusts()
List all fingerprints in the trust file.
|
java.util.List<Fingerprint> |
getTrusts(TrustOptions opts)
List all fingerprints or replacements in the trust file.
|
protected java.lang.String |
getUserForEnv() |
ServerStatus |
init(java.lang.String host,
int port,
java.util.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(java.lang.String host,
int port,
java.util.Properties props,
UsageOptions opts)
Convenience method for init(host, port, props, opts, secure).
|
ServerStatus |
init(java.lang.String host,
int port,
java.util.Properties properties,
UsageOptions opts,
boolean secure)
Convenience method for init(host, port, props, opts, secure, null).
|
boolean |
isAuthFail(java.lang.String errStr)
Deprecated.
|
boolean |
isInfoMessage(java.util.Map<java.lang.String,java.lang.Object> map)
Deprecated.
|
boolean |
isLoginNotRequired(java.lang.String msgStr) |
protected boolean |
isRelaxCmdNameValidationChecks() |
Fingerprint |
loadFingerprint(java.lang.String serverIpPort,
java.lang.String fingerprintUser)
Get the p4trust entry value for the server IP and port based upon a
search of either the file found at
PropertyDefs.TRUST_PATH_KEY_SHORT_FORM ,
PropertyDefs.TRUST_PATH_KEY , the P4TRUST environment variable or
the standard p4trust file location for the current OS. |
Fingerprint[] |
loadFingerprints()
Get the p4trust entries from the file found at
PropertyDefs.TRUST_PATH_KEY_SHORT_FORM ,
PropertyDefs.TRUST_PATH_KEY , the P4TRUST environment variable or
the standard p4trust file location for the current OS. |
java.lang.String |
loadTicket(java.lang.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. |
java.lang.String |
loadTicket(java.lang.String serverId,
java.lang.String name)
Get the p4tickets entry value for the specified user 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,
java.util.List<java.util.Map<java.lang.String,java.lang.Object>> resultMaps) |
java.lang.String |
removeTrust()
Remove the fingerprint for the Perforce SSL connection.
|
java.lang.String |
removeTrust(TrustOptions opts)
Remove the fingerprint or replacement for the Perforce SSL connection.
|
void |
saveCurrentTicket()
Save current ticket returned from
Server.getAuthTicket() . |
void |
saveFingerprint(java.lang.String serverIpPort,
java.lang.String fingerprintUser,
java.lang.String fingerprintValue)
Save specified fingerprint value as associate with this server's address.
|
void |
saveTicket(java.lang.String ticketValue)
Save specified auth ticket value as associate with this server's address
and configured user returned from
Server.getUserName() . |
void |
saveTicket(java.lang.String userName,
java.lang.String ticketValue)
Save specified auth ticket value as associate with this server's address
and user name from the userName parameter.
|
void |
setApplicationName(java.lang.String applicationName) |
void |
setAuthTicket(java.lang.String userName,
java.lang.String authTicket)
Set the server's Perforce authentication ticket for the specified user to
the passed-in string.
|
void |
setClientApiLevel(int clientApiLevel) |
void |
setPerfMonitor(PerformanceMonitor perfMonitor) |
protected void |
setRelaxCmdNameValidationChecks(boolean relaxCmdNameValidationChecks) |
void |
setRpcServerAddress(IServerAddress rpcServerAddress)
Set the server's address for the RPC connection.
|
void |
setSecretKey(java.lang.String secretKey) |
void |
setSecretKey(java.lang.String userName,
java.lang.String secretKey) |
void |
setServerId(java.lang.String serverId)
Set the server's id field used for storing authentication tickets.
|
void |
setTicketsFilePath(java.lang.String ticketsFilePath)
Set the Perforce authentication tickets file path.
|
void |
setTrustFilePath(java.lang.String trustFilePath)
Set the Perforce trust file path.
|
boolean |
supportsSmartMove()
Return true IFF the underlying Perforce server supports the new 2009.1
and later "smart move" command.
|
protected boolean |
useTags(java.lang.String cmdName,
java.lang.String[] cmdArgs,
java.util.Map<java.lang.String,java.lang.Object> inMap,
boolean isStreamCmd)
Allow for per-command use of tags or not.
|
protected boolean |
writeInPlace(java.lang.String cmdName)
Return true iff we should be performing server -> client file write I/O
operations in place for this command.
|
changePassword, createBranchSpec, createClient, createDepot, createJob, createLabel, createProtectionEntries, createStream, createTriggerEntries, createUser, createUser, createUserGroup, createUserGroup, deleteBranchSpec, deleteBranchSpec, deleteClient, deleteClient, deleteCounter, deleteDepot, deleteJob, deleteKey, deleteLabel, deleteLabel, deletePendingChangelist, deletePendingChangelist, deleteProperty, deleteStream, deleteUser, deleteUser, deleteUserGroup, deleteUserGroup, doGraphReceivePack, duplicateRevisions, fixJobs, fixJobs, getAuthTicket, getBlobObject, getBranchSpec, getBranchSpec, getBranchSpecs, getBranchSpecs, getChangelist, getChangelist, getChangelistDiffs, getChangelistDiffs, getChangelistDiffsStream, getChangelistFiles, getChangelistFiles, getChangelists, getChangelists, getChangelists, getCharsetName, getClient, getClient, getClientName, getClients, getClients, getClientTemplate, getClientTemplate, getClientTemplate, getCommitFiles, getCommitObject, getCommitObject, getCounter, getCounter, getCounters, getCounters, getCounters, getCurrentClient, getCurrentServerInfo, getDbSchema, getDefaultP4TicketsFile, getDefaultP4TrustFile, getDepot, getDepotFiles, getDepotFiles, getDepots, getDirectories, getDirectories, getDiskSpace, getExportRecords, getExportRecords, getExtendedFiles, getExtendedFiles, getFileAnnotations, getFileAnnotations, getFileContents, getFileContents, getFileDiffs, getFileDiffs, getFileDiffsStream, getFileSizes, getFixes, getFixList, getGraphCommitLogList, getGraphListTree, getGraphObject, getGraphRevList, getGraphShowRefs, getIgnoreFileName, getInfoServerAddress, getInterchanges, getInterchanges, getInterchanges, getInterchanges, getJob, getJobs, getJobs, getJobSpec, getKey, getKeys, getKnownCharsets, getLabel, getLabels, getLabels, getListData, getListData, getLoginStatus, getLogTail, getMatchingLines, getMatchingLines, getOpenedFiles, getOpenedFiles, getPreferredPathArray, getPreferredPathArray, getProperties, getProperty, getProtectionEntries, getProtectionEntries, getProtectionsTable, getRandomInt, getRepos, getRepos, getRepos, getReviewChangelists, getReviews, getReviews, getRevisionHistory, getRevisionHistory, getServerAddressDetails, getServerFileDiffs, getServerInfo, getServerProcesses, getServerProcesses, getServerVersion, getServerVersionNumber, getShelvedFiles, getShelvedFiles, getSSOCallback, getSSOKey, getStatus, getStream, getStream, getStreamingExportRecords, getStreamIntegrationStatus, getStreams, getSubmittedIntegrations, getSubmittedIntegrations, getTriggerEntries, getTriggersTable, getUsageOptions, getUser, getUserGroup, getUserGroups, getUserGroups, getUserName, getUsers, getUsers, getWorkingDirectory, guardNull, handleFileReturn, handleFileReturn, init, isCaseSensitive, isConnected, isDontWriteTicket, isEnableProgress, isEnableTracking, isNonCheckedSyncs, isQuietMode, isRunningOnWindows, isSecure, isUnicode, journalWait, login, login, login, login, login, logout, logout, moveFile, moveFile, obliterateFiles, parseVersionString, populatePathArray, registerCallback, registerProgressCallback, registerSSOCallback, reload, renameUser, searchJobs, setAuthTicket, setCharsetName, setClientName, setCounter, setCounter, setCurrentClient, setCurrentServerInfo, setEnableProgress, setEnableTracking, setFileAttributes, setFileAttributes, setIgnoreFileName, setKey, setNonCheckedSyncs, setOrUnsetServerConfigurationValue, setProperty, setQuietMode, setSecure, setUsageOptions, setUserName, setWorkingDirectory, showServerConfiguration, supportsUnicode, switchClientView, switchStreamView, tagFiles, tagFiles, unload, updateBranchSpec, updateClient, updateClient, updateClient, updateJob, updateLabel, updateProtectionEntries, updateStream, updateTriggerEntries, updateUser, updateUser, updateUserGroup, updateUserGroup, verifyFiles
execMapCmdList, handleErrorStr, handleFileErrorStr
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
execInputStringMapCmdList, execInputStringMapCmdList, execInputStringStreamCmd, execInputStringStreamingMapCmd, execMapCmdList, execQuietMapCmdList, execStreamCmd
execInputStringMapCmd, execInputStringStreamingMapComd, execMapCmd, execQuietMapCmd, execQuietStreamCmd, execStreamingMapCommand, execStreamingMapCommand
execMapCmdList, execMapCmdList, execMapCmdList, execStreamCmd, handleErrorStr, handleFileErrorStr
public static final IServerImplMetadata.ImplType IMPL_TYPE
public static final java.lang.String DEFAULT_PROG_NAME
public static final java.lang.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 boolean RPC_ENABLE_STREAMS
public static final java.lang.String RPC_ENV_CWD_KEY
public static final java.lang.String RPC_ENV_OS_NAME_KEY
public static final java.lang.String RPC_ENV_WINDOWS_PREFIX
public static final java.lang.String RPC_ENV_WINDOWS_SPEC
public static final java.lang.String RPC_ENV_UNIX_SPEC
public static final java.lang.String RPC_ENV_NOCLIENT_SPEC
public static final java.lang.String RPC_ENV_NOHOST_SPEC
public static final java.lang.String RPC_ENV_NOUSER_SPEC
public static final java.lang.String TRACE_PREFIX
public static final java.lang.String RPC_TMP_OUTFILE_STREAM_KEY
public static final java.lang.String RPC_TMP_CONVERTER_KEY
protected java.lang.String localHostName
protected int clientApiLevel
protected int serverApiLevel
protected java.lang.String applicationName
protected long connectionStart
protected java.util.Map<java.lang.String,java.lang.Object> serverProtocolMap
protected ServerStats serverStats
protected java.lang.String serverId
protected java.util.Map<java.lang.String,java.lang.String> secretKeys
protected ClientTrust clientTrust
protected java.lang.String ticketsFilePath
protected java.lang.String trustFilePath
protected int authFileLockTry
protected long authFileLockDelay
protected long authFileLockWait
protected RpcUserAuthCounter authCounter
protected IServerAddress rpcServerAddress
protected java.util.Map<java.lang.String,java.lang.Object> cmdMapArgs
protected boolean relaxCmdNameValidationChecks
public java.lang.String getApplicationName()
public void setApplicationName(java.lang.String applicationName)
public RpcUserAuthCounter getAuthCounter()
public int getClientApiLevel()
public void setClientApiLevel(int clientApiLevel)
public PerformanceMonitor getPerfMonitor()
public void setPerfMonitor(PerformanceMonitor perfMonitor)
public IServerAddress getRpcServerAddress()
public void setRpcServerAddress(IServerAddress rpcServerAddress)
rpcServerAddress
- RPC server addresspublic java.lang.String getServerAddress()
public java.lang.String getServerHostPort()
public java.lang.String getServerId()
public void setServerId(java.lang.String serverId)
public java.lang.String getTicketsFilePath()
IOptionsServer
public void setTicketsFilePath(java.lang.String ticketsFilePath)
IOptionsServer
ticketsFilePath
- non-null Perforce auth tickets file pathpublic java.lang.String getTrustFilePath()
IOptionsServer
public void setTrustFilePath(java.lang.String trustFilePath)
IOptionsServer
trustFilePath
- non-null Perforce trust file pathprotected boolean isRelaxCmdNameValidationChecks()
protected void setRelaxCmdNameValidationChecks(boolean relaxCmdNameValidationChecks)
public boolean isAuthFail(java.lang.String errStr)
ResultMapParser.isAuthFail(String)
public java.lang.String getInfoStr(java.util.Map<java.lang.String,java.lang.Object> map)
ResultMapParser.getInfoStr(Map)
IHelixCommandExecutor
Gets the info message from the passed-in Perforce command results map. If no info message found in the results map it returns null.
Note that the severity code is MessageSeverityCode.E_INFO. Therefore, only message with severity code = MessageSeverityCode.E_INFO will be returned.
RPC impl errors come across the wire as a map in the form usually like this:
fmt0=Access for user '%user%' has not been enabled by 'p4 protect'., func=client-Message, user=nouser, code0=822483067
Note that the code0 entry will be used to get the severity level; the fmt0 entry contains the message.
map
- Perforce command results map@Deprecated public boolean isInfoMessage(java.util.Map<java.lang.String,java.lang.Object> map)
ResultMapParser.isInfoMessage(Map)
IHelixCommandExecutor
map
- the map@Deprecated public java.lang.String getErrorStr(java.util.Map<java.lang.String,java.lang.Object> map)
ResultMapParser.getErrorStr(Map)
IHelixCommandExecutor
Gets the error/fatal message from the passed-in Perforce command results map. If no error/fatal message found in the results map it returns null.
Note that the minimum severity code is MessageSeverityCode.E_FAILED. Therefore, only message with severity code >= MessageSeverityCode.E_FAILED will be returned.
RPC impl errors come across the wire as a map in the form usually like this:
fmt0=Access for user '%user%' has not been enabled by 'p4 protect'., func=client-Message, user=nouser, code0=822483067
Note that the code0 entry will be used to get the severity level; the fmt0 entry contains the message.
map
- Perforce command results mappublic void setAuthTicket(java.lang.String userName, java.lang.String authTicket)
IOptionsServer
userName
- non-null Perforce user nameauthTicket
- possibly-null Perforce authentication ticketpublic java.lang.String getTrust() throws P4JavaException
IOptionsServer
Note that this fingerprint is generated from the connection, it may not be the same as the one (if any) stored in the trust file.
P4JavaException
- if an error occurs processing this method and its parameters.public java.lang.String addTrust(TrustOptions opts) throws P4JavaException
IOptionsServer
Note that an exception would be thrown if there is an identity change detected. If you want to trust the new key use the 'force' option.
opts
- TrustOptions object describing optional parameters; if null,
no options are set.P4JavaException
- if an error occurs processing this method and its parameters.public java.lang.String addTrust(java.lang.String fingerprintValue) throws P4JavaException
IOptionsServer
fingerprintValue
- non-null fingerprint value to be added.P4JavaException
- if an error occurs processing this method and its parameters.public java.lang.String addTrust(java.lang.String fingerprintValue, TrustOptions options) throws P4JavaException
IOptionsServer
fingerprintValue
- non-null fingerprint value to be added.options
- TrustOptions object describing optional parameters; if null,
no options are set.P4JavaException
- if an error occurs processing this method and its parameters.public java.lang.String removeTrust() throws P4JavaException
IOptionsServer
P4JavaException
- if an error occurs processing this method and its parameters.public java.lang.String removeTrust(TrustOptions opts) throws P4JavaException
IOptionsServer
opts
- TrustOptions object describing optional parameters; if null,
no options are set.P4JavaException
- if an error occurs processing this method and its parameters.public java.util.List<Fingerprint> getTrusts() throws P4JavaException
IOptionsServer
P4JavaException
- if an error occurs processing this method and its parameters.public java.util.List<Fingerprint> getTrusts(TrustOptions opts) throws P4JavaException
IOptionsServer
opts
- TrustOptions object describing optional parameters; if null,
no options are set.P4JavaException
- if an error occurs processing this method and its parameters.public void connect() throws ConnectionException, AccessException, RequestException, ConfigException
connect
in interface IServer
connect
in class Server
ConnectionException
- if the Perforce server is unreachable or is not connected.AccessException
- if the Perforce server denies access to the callerRequestException
- if the Perforce server encounters an error during its
processing of the requestConfigException
- if local I/O exception occurspublic void disconnect() throws ConnectionException, AccessException
disconnect
in interface IServer
disconnect
in class Server
ConnectionException
AccessException
public java.lang.String getAuthTicket(java.lang.String userName)
IServer
userName
- non-null Perforce user namepublic boolean isLoginNotRequired(java.lang.String msgStr)
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 requestAccessException
- if the Perforce server denies access to the callerpublic ServerStatus init(java.lang.String host, int port, java.util.Properties properties, UsageOptions opts, boolean secure) throws ConfigException, ConnectionException
IServerControl
init
in interface IServerControl
init
in class Server
host
- 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 methodproperties
- 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).public ServerStatus init(java.lang.String host, int port, java.util.Properties props, UsageOptions opts) throws ConfigException, ConnectionException
IServerControl
init
in interface IServerControl
init
in class Server
host
- 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).public ServerStatus init(java.lang.String host, int port, java.util.Properties props) throws ConfigException, ConnectionException
init
in interface IServerControl
init
in class Server
host
- 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 methodConfigException
- 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).protected void checkFingerprint(RpcConnection rpcConnection) throws ConnectionException
ConnectionException
protected java.lang.String composeAuthTicketEntryKey(java.lang.String userName, java.lang.String serverAddress)
protected java.lang.String getClientNameForEnv()
protected java.lang.String getHostForEnv()
protected java.lang.String getLanguageForEnv()
protected java.lang.String getOsTypeForEnv()
protected RpcPacketFieldRule getRpcPacketFieldRule(java.util.Map<java.lang.String,java.lang.Object> inMap, CmdSpec cmdSpec)
Note: currently only supporting the "export" command.
public java.lang.String getSecretKey()
public void setSecretKey(java.lang.String secretKey)
public java.lang.String getSecretKey(java.lang.String userName)
protected java.lang.String getUserForEnv()
public Fingerprint loadFingerprint(java.lang.String serverIpPort, java.lang.String fingerprintUser)
PropertyDefs.TRUST_PATH_KEY_SHORT_FORM
,
PropertyDefs.TRUST_PATH_KEY
, the P4TRUST environment variable or
the standard p4trust file location for the current OS. Will return null
if not found or if an error occurred attempt to lookup the value.public Fingerprint[] loadFingerprints()
PropertyDefs.TRUST_PATH_KEY_SHORT_FORM
,
PropertyDefs.TRUST_PATH_KEY
, the P4TRUST environment variable or
the standard p4trust file location for the current OS. Will return null
if nothing found or if an error occurred attempt to lookup the entries.@Nullable public java.lang.String loadTicket(java.lang.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 occurred attempt to lookup the value.Server.setAuthTicket(String)
or
null if not found.public java.lang.String loadTicket(java.lang.String serverId, java.lang.String name)
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 occurred attempt to lookup the value.Server.setAuthTicket(String)
or
null if not found.protected void processCmdCallbacks(int cmdCallBackKey, long timeTaken, java.util.List<java.util.Map<java.lang.String,java.lang.Object>> resultMaps)
public java.lang.String getErrorOrInfoStr(java.util.Map<java.lang.String,java.lang.Object> map)
ResultMapParser.getErrorOrInfoStr(Map)
IHelixCommandExecutor
Gets the info/warning/error/fatal message from the passed-in Perforce command results map. If no info/warning/error/fatal message found in the results map it returns null.
Note that the minimum severity code is MessageSeverityCode.E_INFO. Therefore, only message with severity code >= MessageSeverityCode.E_INFO will be returned.
RPC impl errors come across the wire as a map in the form usually like this:
fmt0=Access for user '%user%' has not been enabled by 'p4 protect'., func=client-Message, user=nouser, code0=822483067
Note that the code0 entry will be used to get the severity level; the fmt0 entry contains the message.
map
- Perforce command results mappublic int getSeverityCode(java.util.Map<java.lang.String,java.lang.Object> map)
public int getGenericCode(java.util.Map<java.lang.String,java.lang.Object> map)
public java.lang.String getAuthId()
This may be: addr:port or clusterId or authId If the connection hasn't been made yet, this could be null.
public void saveCurrentTicket() throws P4JavaException
Server.getAuthTicket()
.P4JavaException
public void saveTicket(java.lang.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.ConfigException
public void saveFingerprint(java.lang.String serverIpPort, java.lang.String fingerprintUser, java.lang.String fingerprintValue) throws ConfigException
ConfigException
public void saveTicket(java.lang.String userName, java.lang.String ticketValue) throws ConfigException
ConfigException
public void setSecretKey(java.lang.String userName, java.lang.String secretKey)
protected boolean useTags(java.lang.String cmdName, java.lang.String[] cmdArgs, java.util.Map<java.lang.String,java.lang.Object> inMap, boolean isStreamCmd)
.
This is normally used on a per-command (OneShot RPC server) basis. In order to use this on a per-session (NTS RPC server) implementation you must resend the RPC protocol, if the 'useTags' state has changed, prior to sending the command.
protected boolean writeInPlace(java.lang.String cmdName)
See PropertyDefs.WRITE_IN_PLACE_KEY javadoc for the semantics of this.
cmdName
- non-null command command name stringCopyright © 2018 Perforce Software. All Rights Reserved.