Class RpcServer
- All Implemented Interfaces:
IListDelegator,IServerControl,IAttributeDelegator,IBranchDelegator,IBranchesDelegator,IChangeDelegator,IChangesDelegator,IClientDelegator,IClientsDelegator,ICommitDelegator,IConfigureDelegator,ICounterDelegator,ICountersDelegator,IDBSchemaDelegator,IDepotDelegator,IDepotsDelegator,IDescribeDelegator,IDiff2Delegator,IDirsDelegator,IDiskspaceDelegator,IDuplicateDelegator,IExportDelegator,IExtensionDelegator,IFileAnnotateDelegator,IFileLogDelegator,IFilesDelegator,IFixDelegator,IFixesDelegator,IFstatDelegator,IGraphCommitLogDelegator,IGraphListTreeDelegator,IGraphReceivePackDelegator,IGraphRevListDelegator,IGraphShowRefDelegator,IGrepDelegator,IGroupDelegator,IGroupsDelegator,IInfoDelegator,IIntegratedDelegator,IInterchangesDelegator,IJobDelegator,IJobsDelegator,IJobSpecDelegator,IJournalWaitDelegator,IKeyDelegator,IKeysDelegator,ILabelDelegator,ILabelsDelegator,ILicenseDelegator,ILogin2Delegator,ILoginDelegator,ILogoutDelegator,ILogTailDelegator,IMonitorDelegator,IMoveDelegator,IObliterateDelegator,IOpenedDelegator,IPasswdDelegator,IPrintDelegator,IPropertyDelegator,IProtectDelegator,IProtectsDelegator,IReloadDelegator,IRenameClientDelegator,IRenameUserDelegator,IReposDelegator,IReviewDelegator,IReviewsDelegator,ISearchDelegator,ISizesDelegator,ISpecDelegator,IStatDelegator,IStreamDelegator,IStreamlogDelegator,IStreamsDelegator,ITagDelegator,ITriggersDelegator,IUnloadDelegator,IUserDelegator,IUsersDelegator,IVerifyDelegator,IHelixCommandExecutor,IOptionsServer,IServer
- Direct Known Subclasses:
NtsServerImpl,OneShotServerImpl
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected Stringprotected RpcUserAuthCounterprotected longprotected intprotected longprotected intprotected ClientTrustThe RPC command args before the function name (i.e.protected longstatic final intDefault Perforce client API level; 81 represents 2016.2 capabilities.static final StringThe default string sent to the Perforce server in the protocol command defining the client's program name.static final StringThe default string sent to the Perforce server in the protocol command defining the client's program version.static final intDefault Perforce server API level; 99999 apparently means "whatever...".static final IServerImplMetadata.ImplTypeThe implementation type of this implementation.protected Stringprotected booleanIf true, relax the command name validation checks done in the RPC layer.static final Stringstatic final booleanSignifies whether or not the client is capable of handling streams.static final StringThe system properties key for the JVM's current directory.static final StringWhat 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 final StringWhat 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 final StringWhat 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 final StringThe system properties key for the OS name.static final StringWhat we use in the RPC environment packet to signal to the Perforce server that we're a NON-Windows box.static final StringRPC_ENV_OS_NAME_KEY property value prefix for Windows systems.static final StringWhat we use in the RPC environment packet to signal to the Perforce server that we're a Windows box.static final booleanSignifies whether or not we use tagged output.static final StringUse to key converter to use out of state mapstatic final StringUsed to key temporary output streams in the command environment's state map for things like getFileContents(), etc., using the execStreamCmd method(s).protected IServerAddressprotected intprotected Stringprotected ServerStatsprotected Stringstatic final StringWhat we use as a P4JTracer trace prefix for methods here.protected Stringprotected booleanprotected booleanprotected booleanFields inherited from class com.perforce.p4java.impl.mapbased.server.Server
authTickets, browserCallback, browserVersion, caseSensitive, charsetName, client, clientName, clientPath, clientProgressCallback, 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, p4Charset, 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, userNameFields inherited from interface com.perforce.p4java.server.IServer
ATTRIBUTE_STREAM_MAP_KEY, IN_MAP_USE_TAGS_KEY -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionaddTrust(TrustOptions opts) Approve and add the fingerprint for the Perforce SSL connection.Approve and add the specified fingerprint for the Perforce SSL connection.addTrust(String fingerprintValue, TrustOptions options) Approve and add the specified fingerprint or replacement for the Perforce SSL connection.protected voidcheckFingerprint(RpcConnection rpcConnection) Check the fingerprint of the Perforce server SSL connectionprotected voidcloseTmpOutputStream(CommandEnv cmdEnv) Closes the temp RPC output stream registered in the command env state map, if any, so its file handle is released on Windows.protected StringcomposeAuthTicketEntryKey(String userName, String serverAddress) Compose the key for an auth ticket entryvoidconnect()Try to establish an actual RPC connection to the target Perforce server.voidTry to cleanly disconnect from the Perforce server at the other end of the current connection (with the emphasis on "cleanly").Get the RPC user authentication counter.Return the Perforce Server's authId.getAuthTicket(String userName) Deprecated.getAuthTicket(String userName, String serverId) Return the Perforce authentication ticket for specified user.intprotected StringgetErrorOrInfoStr(Map<String, Object> map) Deprecated.getErrorStr(Map<String, Object> map) Deprecated.intgetGenericCode(Map<String, Object> map) protected StringgetInfoStr(Map<String, Object> map) Deprecated.protected Stringprotected Stringprotected RpcPacketFieldRulegetRpcPacketFieldRule(Map<String, 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.Get the server's address for the RPC connection.getSecretKey(String userName) Get the server's address field used for storing authentication tickets.Get the server's host and port used for the RPC connection.Get the server's id field used for storing authentication tickets.intgetSeverityCode(Map<String, Object> map) Return the Perforce authentication tickets file path.getTrust()Return the fingerprint for the Perforce SSL connection.Return the Perforce trust file path.List all fingerprints in the trust file.getTrusts(TrustOptions opts) List all fingerprints or replacements in the trust file.protected Stringinit(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.init(String host, int port, Properties props, UsageOptions opts) Convenience method for init(host, port, props, opts, secure).init(String host, int port, Properties properties, UsageOptions opts, boolean secure) Convenience method for init(host, port, props, opts, secure, null).booleanisAuthFail(String errStr) Deprecated.booleanisInfoMessage(Map<String, Object> map) Deprecated.booleanisLoginNotRequired(String msgStr) protected booleanbooleanbooleanwas the server ssl connection validated by chain?booleanwas the server ssl connection validated by fingerprint?booleanwas the server ssl connection validated by hostname match?loadFingerprint(String serverKey, String fingerprintUser) Get the p4trust entry value for the server IP and port based upon a search of either the file found atPropertyDefs.TRUST_PATH_KEY_SHORT_FORM,PropertyDefs.TRUST_PATH_KEY, the P4TRUST environment variable or the standard p4trust file location for the current OS.Get the p4trust entries from the file found atPropertyDefs.TRUST_PATH_KEY_SHORT_FORM,PropertyDefs.TRUST_PATH_KEY, the P4TRUST environment variable or the standard p4trust file location for the current OS.loadTicket(String serverId) Get the p4tickets entry value for the current user returned fromServer.getUserName()and server address based upon a search of either the file found atPropertyDefs.TICKET_PATH_KEY_SHORT_FORM,PropertyDefs.TICKET_PATH_KEY, the P4TICKETS environment variable or the standard p4tickets file location for the current OS.loadTicket(String serverId, String name) Get the p4tickets entry value for the specified user and server address based upon a search of either the file found atPropertyDefs.TICKET_PATH_KEY_SHORT_FORM,PropertyDefs.TICKET_PATH_KEY, the P4TICKETS environment variable or the standard p4tickets file location for the current OS.protected voidprocessCmdCallbacks(int cmdCallBackKey, long timeTaken, List<Map<String, Object>> resultMaps) Remove the fingerprint for the Perforce SSL connection.removeTrust(TrustOptions opts) Remove the fingerprint or replacement for the Perforce SSL connection.voidDeprecated.voidsaveFingerprint(String serverIpPort, String fingerprintUser, String fingerprintValue) Save specified fingerprint value as associate with this server's address.voidsaveTicket(String ticketValue) Deprecated.voidsaveTicket(String userName, String serverId, String ticketValue) Save specified auth ticket value as associate with this server's address and user name from the userName parameter.voidsetApplicationName(String applicationName) voidsetAuthTicket(String userName, String authTicket) Deprecated.voidsetAuthTicket(String userName, String serverId, String authTicket) Set the server's Perforce authentication ticket for the specified user to the passed-in string.voidsetClientApiLevel(int clientApiLevel) voidvoidsetPerfMonitor(PerformanceMonitor perfMonitor) protected voidsetRelaxCmdNameValidationChecks(boolean relaxCmdNameValidationChecks) voidsetRpcServerAddress(IServerAddress rpcServerAddress) Set the server's address for the RPC connection.voidsetSecretKey(String secretKey) voidsetSecretKey(String userName, String secretKey) voidsetServerId(String serverId) Set the server's id field used for storing authentication tickets.voidsetTicketsFilePath(String ticketsFilePath) Set the Perforce authentication tickets file path.voidsetTrustFilePath(String trustFilePath) Set the Perforce trust file path.booleanReturn true IFF the underlying Perforce server supports the new 2009.1 and later "smart move" command.voidtrustConnectionCheck(RpcConnection rpcConnection) Check Server Trustprotected booleanAllow for per-command use of tags or not.protected booleanwriteInPlace(String cmdName) Return true if we should be performing server -> client file write I/O operations in place for this command.Methods inherited from class com.perforce.p4java.impl.mapbased.server.Server
changePassword, convertSparseStream, createBranchSpec, createClient, createDepot, createExtensionConfig, createJob, createLabel, createProtectionEntries, createStream, createTempClient, createTriggerEntries, createUser, createUser, createUserGroup, createUserGroup, deleteBranchSpec, deleteBranchSpec, deleteClient, deleteClient, deleteCounter, deleteDepot, deleteExtension, deleteJob, deleteKey, deleteLabel, deleteLabel, deletePendingChangelist, deletePendingChangelist, deleteProperty, deleteStream, deleteUser, deleteUser, deleteUserGroup, deleteUserGroup, doGraphReceivePack, duplicateRevisions, fixJobs, fixJobs, getAuthTicket, getBlobObject, getBranchSpec, getBranchSpec, getBranchSpecs, getBranchSpecs, getBrowserCallback, getChangelist, getChangelist, getChangelistDiffs, getChangelistDiffs, getChangelistDiffsStream, getChangelistExtendedFiles, getChangelistExtendedFiles, getChangelistFiles, getChangelistFiles, getChangelists, getChangelists, getChangelists, getCharsetName, getClient, getClient, getClientName, getClientPath, getClientProgressCallback, getClients, getClients, getClientTemplate, getClientTemplate, getClientTemplate, getCommitFiles, getCommitObject, getCommitObject, getCounter, getCounter, getCounters, getCounters, getCounters, getCurrentClient, getCurrentServerInfo, getDbSchema, getDefaultP4TicketsFile, getDefaultP4TrustFile, getDepot, getDepotFiles, getDepotFiles, getDepots, getDepots, getDirectories, getDirectories, getDiskSpace, getExportRecords, getExportRecords, getExtendedFiles, getExtendedFiles, getExtensionConfig, getFileAnnotations, getFileAnnotations, getFileContents, 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, getLicense, getLimits, getListData, getListData, getLogin2Status, getLogin2Status, 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, getSpec, getSSOCallback, getSSOKey, getStatus, getStream, getStream, getStreamingExportRecords, getStreamIntegrationStatus, getStreamlog, getStreams, getSubmittedIntegrations, getSubmittedIntegrations, getTriggerEntries, getTriggersTable, getUsageOptions, getUser, getUserGroup, getUserGroups, getUserGroups, getUserName, getUsers, getUsers, getValidServerIPMACAddress, getWorkingDirectory, guardNull, handleFileReturn, handleFileReturn, init, installExtension, isCaseSensitive, isConnected, isDontWriteTicket, isEnableProgress, isEnableTracking, isNonCheckedSyncs, isQuietMode, isRunningOnWindows, isSecure, isUnicode, journalWait, listExtensions, login, login, login, login, login, login2, login2, login2CheckAuth, login2InitAuth, login2ListMethods, logout, logout, moveFile, moveFile, moveFile, obliterateFiles, packageExtension, parseVersionString, populatePathArray, registerBrowserCallback, registerCallback, registerProgressCallback, registerProgressCallback, registerSSOCallback, reload, renameClient, renameUser, sampleExtension, searchJobs, setAuthTicket, setCharsetName, setClientName, setClientPath, setCounter, setCounter, setCurrentClient, setCurrentServerInfo, setEnableProgress, setEnableTracking, setFileAttributes, setFileAttributes, setIgnoreFileName, setKey, setMultipleKeyValuePair, setNonCheckedSyncs, setOrUnsetServerConfigurationValue, setProperty, setQuietMode, setSecure, setUsageOptions, setUserName, setWorkingDirectory, showServerConfiguration, supportsUnicode, switchClientView, switchStreamView, tagFiles, tagFiles, unload, unsetFileAttribute, unsetFileAttributes, updateBranchSpec, updateClient, updateClient, updateClient, updateExtensionConfig, updateJob, updateLabel, updateLicense, updateProtectionEntries, updateSpec, updateSpecString, updateStream, updateTriggerEntries, updateUser, updateUser, updateUserGroup, updateUserGroup, verifyFilesMethods inherited from class com.perforce.p4java.server.HelixCommandExecutor
execMapCmdList, handleErrorStr, handleFileErrorStrMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.perforce.p4java.server.IHelixCommandExecutor
execMapCmdList, execMapCmdList, execMapCmdList, execStreamCmd, execStreamCmdForBuffer, handleErrorStr, handleFileErrorStrMethods inherited from interface com.perforce.p4java.server.IOptionsServer
execInputStringMapCmdList, execInputStringMapCmdList, execInputStringStreamCmd, execInputStringStreamingMapCmd, execMapCmdList, execQuietMapCmdList, execStreamCmd, getGlobalOptions, setGlobalOptionsMethods inherited from interface com.perforce.p4java.server.IServer
execInputStringMapCmd, execInputStringStreamingMapComd, execMapCmd, execQuietMapCmd, execQuietStreamCmd, execStreamingMapCommand, execStreamingMapCommand
-
Field Details
-
IMPL_TYPE
The implementation type of this implementation. -
DEFAULT_PROG_NAME
The default string sent to the Perforce server in the protocol command defining the client's program name. This can be set with the IServer interface.- See Also:
-
DEFAULT_PROG_VERSION
The default string sent to the Perforce server in the protocol command defining the client's program version. This can be set with the IServer interface.- See Also:
-
DEFAULT_CLIENT_API_LEVEL
public static final int DEFAULT_CLIENT_API_LEVELDefault Perforce client API level; 81 represents 2016.2 capabilities. Don't change this unless you know what you're doing. Note that this is a default for most commands; some commands dynamically bump up the level for the command's duration.- See Also:
-
DEFAULT_SERVER_API_LEVEL
public static final int DEFAULT_SERVER_API_LEVELDefault Perforce server API level; 99999 apparently means "whatever...". Don't change this unless you know what you're doing.- See Also:
-
RPC_TAGS_USED
public static final boolean RPC_TAGS_USEDSignifies whether or not we use tagged output. Don't change this unless you like weird incomprehensible errors and days of debugging.- See Also:
-
RPC_ENABLE_STREAMS
public static final boolean RPC_ENABLE_STREAMSSignifies whether or not the client is capable of handling streams.- See Also:
-
RPC_ENV_CWD_KEY
The system properties key for the JVM's current directory.- See Also:
-
RPC_ENV_OS_NAME_KEY
The system properties key for the OS name.- See Also:
-
RPC_ENV_WINDOWS_PREFIX
RPC_ENV_OS_NAME_KEY property value prefix for Windows systems.- See Also:
-
RPC_ENV_WINDOWS_SPEC
What we use in the RPC environment packet to signal to the Perforce server that we're a Windows box.- See Also:
-
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.- See Also:
-
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.- See Also:
-
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.- See Also:
-
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.- See Also:
-
TRACE_PREFIX
What we use as a P4JTracer trace prefix for methods here.- See Also:
-
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).- See Also:
-
RPC_BYTE_BUFFER_OUTPUT_KEY
- See Also:
-
RPC_TMP_CONVERTER_KEY
Use to key converter to use out of state map- See Also:
-
localHostName
-
clientApiLevel
protected int clientApiLevel -
serverApiLevel
protected int serverApiLevel -
applicationName
-
connectionStart
protected long connectionStart -
serverProtocolMap
-
serverStats
-
serverId
-
secretKeys
-
pBufs
-
clientTrust
-
ticketsFilePath
-
trustFilePath
-
validatedByChain
protected boolean validatedByChain -
validatedByFingerprint
protected boolean validatedByFingerprint -
validatedByHostname
protected boolean validatedByHostname -
authFileLockTry
protected int authFileLockTry -
authFileLockDelay
protected long authFileLockDelay -
authFileLockWait
protected long authFileLockWait -
authCounter
-
rpcServerAddress
-
cmdMapArgs
The RPC command args before the function name (i.e. "tag") -
relaxCmdNameValidationChecks
protected boolean relaxCmdNameValidationChecksIf true, relax the command name validation checks done in the RPC layer. This is dangerous, and any use of this should only be done if you know what you're doing and you're able to deal with the consequences (which won't be spelled out here).
-
-
Constructor Details
-
RpcServer
public RpcServer()
-
-
Method Details
-
isValidatedByChain
public boolean isValidatedByChain()was the server ssl connection validated by chain?- Returns:
- true if it's an ssl connection with valid chain
-
isValidatedByFingerprint
public boolean isValidatedByFingerprint()was the server ssl connection validated by fingerprint?- Returns:
- true if it's an ssl connection validated by fingerprint
-
isValidatedByHostname
public boolean isValidatedByHostname()was the server ssl connection validated by hostname match?- Returns:
- true if it's an ssl connection validated by "cert's CN" == "P4Port's hostname"
-
getApplicationName
-
setApplicationName
-
getAuthCounter
Get the RPC user authentication counter.- Returns:
- RPC user authentication counter
-
getClientApiLevel
public int getClientApiLevel() -
setClientApiLevel
public void setClientApiLevel(int clientApiLevel) -
getPerfMonitor
-
setPerfMonitor
-
getRpcServerAddress
Get the server's address for the RPC connection.- Returns:
- possibly-null RPC server address
-
setRpcServerAddress
Set the server's address for the RPC connection.- Parameters:
rpcServerAddress- RPC server address
-
getServerAddress
Get the server's address field used for storing authentication tickets.- Returns:
- - possibly null server address
-
getServerHostPort
Get the server's host and port used for the RPC connection.- Returns:
- - possibly null server host and port
-
getClientCharset
-
isServerUnicode
public boolean isServerUnicode() -
getServerId
Get the server's id field used for storing authentication tickets. This id should only be used as a server address portion for entries in a p4 tickets file.- Returns:
- - possibly null server id
-
setServerId
Set the server's id field used for storing authentication tickets. The id specified here will be used when saving ticket values to a p4 tickets file. This field should only be set to the server id returned as part of a server message.- Parameters:
serverId- serverId
-
getTicketsFilePath
Description copied from interface:IOptionsServerReturn the Perforce authentication tickets file path.- Returns:
- possibly-null Perforce auth tickets file path
-
setTicketsFilePath
Description copied from interface:IOptionsServerSet the Perforce authentication tickets file path.- Parameters:
ticketsFilePath- non-null Perforce auth tickets file path
-
getTrustFilePath
Description copied from interface:IOptionsServerReturn the Perforce trust file path.- Returns:
- possibly-null Perforce trust file path
-
setTrustFilePath
Description copied from interface:IOptionsServerSet the Perforce trust file path.- Parameters:
trustFilePath- non-null Perforce trust file path
-
isRelaxCmdNameValidationChecks
protected boolean isRelaxCmdNameValidationChecks() -
setRelaxCmdNameValidationChecks
protected void setRelaxCmdNameValidationChecks(boolean relaxCmdNameValidationChecks) -
isAuthFail
Deprecated.- Parameters:
errStr- error string- Returns:
- true if error
-
getInfoStr
Deprecated.Description copied from interface:IHelixCommandExecutorGets 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.- Parameters:
map- Perforce command results map- Returns:
- possibly-null info string
-
isInfoMessage
Deprecated.Description copied from interface:IHelixCommandExecutorChecks if is info message.- Parameters:
map- the map- Returns:
- true, if is info message
-
getErrorStr
Deprecated.Description copied from interface:IHelixCommandExecutorGets 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.- Parameters:
map- Perforce command results map- Returns:
- possibly-null error/fatal string
-
setAuthTicket
Deprecated.Description copied from interface:IOptionsServerSet the server's Perforce authentication ticket for the specified user to the passed-in string.- Parameters:
userName- non-null Perforce user nameauthTicket- possibly-null Perforce authentication ticket
-
setAuthTicket
Description copied from interface:IOptionsServerSet the server's Perforce authentication ticket for the specified user to the passed-in string.- Parameters:
userName- non-null Perforce user nameserverId- possibly-null Perforce server's auth.id/IP:portauthTicket- possibly-null Perforce authentication ticket
-
getTrust
Description copied from interface:IOptionsServerReturn the fingerprint for the Perforce SSL connection.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.
- Returns:
- possibly-null fingerprint for the Perforce SSL connection.
- Throws:
P4JavaException- if an error occurs processing this method and its parameters.
-
addTrust
Description copied from interface:IOptionsServerApprove and add the fingerprint for the Perforce SSL connection. The fingerprint or replacement will be stored in the trust file. If the attribute TrustOptions.isReplacement() is true, then the replacement fingerprint will be stored. Otherwise, the normal fingerprint is stored.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.
- Parameters:
opts- TrustOptions object describing optional parameters; if null, no options are set.- Returns:
- non-null result message string from the trust operation; this may include the fingerprint for the Perforce server public key.
- Throws:
P4JavaException- if an error occurs processing this method and its parameters.
-
addTrust
Description copied from interface:IOptionsServerApprove and add the specified fingerprint for the Perforce SSL connection. The fingerprint will be stored in the trust file.- Parameters:
fingerprintValue- non-null fingerprint value to be added.- Returns:
- non-null result message string from the trust operation; this may include the fingerprint for the Perforce server public key.
- Throws:
P4JavaException- if an error occurs processing this method and its parameters.
-
addTrust
Description copied from interface:IOptionsServerApprove and add the specified fingerprint or replacement for the Perforce SSL connection. The fingerprint or replacement will be stored in the trust file. If the attribute TrustOptions.isReplacement() is true, then the replacement fingerprint will be stored. Otherwise, the normal fingerprint is stored.- Parameters:
fingerprintValue- non-null fingerprint value to be added.options- TrustOptions object describing optional parameters; if null, no options are set.- Returns:
- non-null result message string from the trust operation; this may include the fingerprint for the Perforce server public key.
- Throws:
P4JavaException- if an error occurs processing this method and its parameters.
-
removeTrust
Description copied from interface:IOptionsServerRemove the fingerprint for the Perforce SSL connection. The fingerprint will removed from the trust file.- Returns:
- non-null result message string from the trust operation; this may include the fingerprint for the Perforce server public key.
- Throws:
P4JavaException- if an error occurs processing this method and its parameters.
-
removeTrust
Description copied from interface:IOptionsServerRemove the fingerprint or replacement for the Perforce SSL connection. The fingerprint or replacement will removed from the trust file. If the attribute TrustOptions.isReplacement() is true, then the replacement fingerprint will be removed. Otherwise the normal fingerprint is removed.- Parameters:
opts- TrustOptions object describing optional parameters; if null, no options are set.- Returns:
- non-null result message string from the trust operation; this may include the fingerprint for the Perforce server public key.
- Throws:
P4JavaException- if an error occurs processing this method and its parameters.
-
getTrusts
Description copied from interface:IOptionsServerList all fingerprints in the trust file.- Returns:
- non-null list of known fingerprints in the trust file.
- Throws:
P4JavaException- if an error occurs processing this method and its parameters.
-
getTrusts
Description copied from interface:IOptionsServerList all fingerprints or replacements in the trust file. If the attribute TrustOptions.isReplacement() is true, then replacement fingerprints will be returned. Otherwise, normal fingerprints are returned.- Parameters:
opts- TrustOptions object describing optional parameters; if null, no options are set.- Returns:
- non-null list of fingerprints in the trust file.
- Throws:
P4JavaException- if an error occurs processing this method and its parameters.
-
connect
public void connect() throws ConnectionException, AccessException, RequestException, ConfigExceptionTry to establish an actual RPC connection to the target Perforce server. Most of the actual setup work is done in the RpcConnection and RpcPacketDispatcher constructors, but associated gubbins such as auto login, etc., are done in the superclass.- Specified by:
connectin interfaceIServer- Overrides:
connectin classServer- Throws:
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 occurs
-
closeTmpOutputStream
Closes the temp RPC output stream registered in the command env state map, if any, so its file handle is released on Windows. Call from afinallyblock to free the handle on every exit path.- Parameters:
cmdEnv- the command env whose temp output stream should be closed; ignored ifnullor it has no state map
-
disconnect
Try to cleanly disconnect from the Perforce server at the other end of the current connection (with the emphasis on "cleanly"). This should theoretically include sending a release2 message, but we don't always get the chance to do that.- Specified by:
disconnectin interfaceIServer- Overrides:
disconnectin classServer- Throws:
ConnectionException- on errorAccessException- on error
-
getAuthTicket
Deprecated.Description copied from interface:IServerReturn the Perforce authentication ticket for specified user.- Parameters:
userName- non-null Perforce user name- Returns:
- possibly-null Perforce authentication ticket
-
getAuthTicket
Description copied from interface:IServerReturn the Perforce authentication ticket for specified user.- Parameters:
userName- non-null Perforce user nameserverId- non-null Perforce server's auth.id/IP:port- Returns:
- possibly-null Perforce authentication ticket
-
isLoginNotRequired
-
supportsSmartMove
Description copied from interface:IServerReturn true IFF the underlying Perforce server supports the new 2009.1 and later "smart move" command. Note that this returns whether the server can support moves only at the time the server is first created; it's entirely possible for the underlying server to change versions, etc., under the user in the meanitme or over time. In any case, if you do try to run a move command on such a server, the results will be safe, if not entirely what you expected. As of 2010.2 it also possible for the server to be configured to disable the move command, in which case this function will return false.- Returns:
- true iff the server supports the smart move command.
- Throws:
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 caller
-
init
public ServerStatus init(String host, int port, Properties properties, UsageOptions opts, boolean secure) throws ConfigException, ConnectionException Description copied from interface:IServerControlConvenience method for init(host, port, props, opts, secure, null). See init's main Javadoc for full documentation.- Specified by:
initin interfaceIServerControl- Overrides:
initin classServer- Parameters:
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.secure- secure option- Returns:
- the resulting status; should be ACTIVE unless otherwise specified
- Throws:
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).
-
init
public ServerStatus init(String host, int port, Properties props, UsageOptions opts) throws ConfigException, ConnectionException Description copied from interface:IServerControlConvenience method for init(host, port, props, opts, secure). See init's main Javadoc for full documentation.- Specified by:
initin interfaceIServerControl- Overrides:
initin classServer- Parameters:
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.- Returns:
- the resulting status; should be ACTIVE unless otherwise specified
- Throws:
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).
-
init
public ServerStatus init(String host, int port, Properties props) throws ConfigException, ConnectionException The default init sets up things like host names, etc., and fails if we can't establish some pretty basic things at connect time. Does not attempt to actually connect to the target Perforce server -- this is left for the connect() call, below.- Specified by:
initin interfaceIServerControl- Overrides:
initin classServer- Parameters:
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 UsageOptions object to be associated with the server object; if null, the server should construct a new default UsageOptions object.- Returns:
- the resulting status; should be ACTIVE unless otherwise specified
- Throws:
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).
-
trustConnectionCheck
Check Server TrustCertificate Validation depends on RPC_SSL_CLIENT_CERT_VALIDATE_NICK.
Self-signed certs use only a fingerprint comparison after checking the cert's dates.
- Parameters:
rpcConnection- rpcConnection- Throws:
ConnectionException- on error
-
checkFingerprint
Check the fingerprint of the Perforce server SSL connection- Parameters:
rpcConnection- rpcConnection- Throws:
ConnectionException- on error
-
composeAuthTicketEntryKey
Compose the key for an auth ticket entry- Parameters:
userName- userNameserverAddress- serverAddress- Returns:
- key
-
getClientNameForEnv
-
getHostForEnv
-
getLanguageForEnv
-
getOsTypeForEnv
-
getRpcPacketFieldRule
Get the RPC packet field rule for skipping the charset conversion of a range of RPC packet fields; leave the values as bytes.Note: currently only supporting the "export" command.
- Parameters:
inMap- inMapcmdSpec- cmdSpec- Returns:
- RpcPacketFieldRule
-
getSecretKey
-
setSecretKey
-
getSecretKey
-
getPBuf
-
getUserForEnv
-
loadFingerprint
Get the p4trust entry value for the server IP and port based upon a search of either the file found atPropertyDefs.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.- Parameters:
serverKey- serverKeyfingerprintUser- fingerprintUser- Returns:
- - fingerprint or null if not found.
-
loadFingerprints
Get the p4trust entries from the file found atPropertyDefs.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.- Returns:
- - list of fingerprints or null if nothing found.
-
loadTicket
Get the p4tickets entry value for the current user returned fromServer.getUserName()and server address based upon a search of either the file found atPropertyDefs.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.- Parameters:
serverId- serverId- Returns:
- - ticket value to get used for
Server.setAuthTicket(String)or null if not found.
-
loadTicket
Get the p4tickets entry value for the specified user and server address based upon a search of either the file found atPropertyDefs.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.- Parameters:
serverId- serverIdname- name- Returns:
- - ticket value to get used for
Server.setAuthTicket(String)or null if not found.
-
processCmdCallbacks
-
getErrorOrInfoStr
Deprecated.Description copied from interface:IHelixCommandExecutorGets 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.- Parameters:
map- Perforce command results map- Returns:
- possibly-null info/warning/error/fatal string
-
getSeverityCode
-
getGenericCode
-
getAuthId
Return the Perforce Server's authId.This may be: addr:port or clusterId or authId If the connection hasn't been made yet, this could be null.
- Returns:
- possibly-null Perforce authentication id
- Since:
- 2016.1
-
saveCurrentTicket
Deprecated.Save current ticket returned fromServer.getAuthTicket().- Throws:
P4JavaException- on error
-
saveTicket
Deprecated.Save specified auth ticket value as associate with this server's address and configured user returned fromServer.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.- Parameters:
ticketValue- ticketValue- Throws:
ConfigException- on error
-
saveFingerprint
public void saveFingerprint(String serverIpPort, String fingerprintUser, String fingerprintValue) throws ConfigException Save specified fingerprint value as associate with this server's address. This will attempt to write an entry to the p4trust file either specified as the P4TRUST environment variable or at the OS specific default location. If the fingerprint value is null then the current entry will be cleared.- Parameters:
serverIpPort- serverIpPortfingerprintUser- fingerprintUserfingerprintValue- fingerprintValue- Throws:
ConfigException- on error
-
saveTicket
Save specified auth ticket value as associate with this server's address and user name from the userName parameter. 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 will be cleared.- Parameters:
userName- userNameserverId- serverIdticketValue- ticketValue- Throws:
ConfigException- on error
-
setSecretKey
-
setPbuf
-
useTags
protected boolean useTags(String cmdName, String[] cmdArgs, Map<String, Object> inMap, boolean isStreamCmd) Allow for per-command use of tags or not. Currently has limited use (only a few commands are anomalous as far as we can tell), but may find more uses generally with experience.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.
- Parameters:
cmdName- cmdNamecmdArgs- cmdArgsinMap- inMapisStreamCmd- isStreamCmd- Returns:
- RPC_TAGS_USED | false
-
writeInPlace
Return true if we should be performing server -> client file write I/O operations in place for this command.See PropertyDefs.WRITE_IN_PLACE_KEY javadoc for the semantics of this.
- Parameters:
cmdName- non-null command command name string- Returns:
- true iff we should do a sync in place
-
getAuthTicket(String, String)