java.lang.Object
com.perforce.p4java.server.HelixCommandExecutor
com.perforce.p4java.impl.mapbased.server.Server
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:
RpcServer

public abstract class Server extends HelixCommandExecutor implements IServerControl, IOptionsServer
Generic abstract superclass for implementation-specific server implementations that use a command-style server interface implementation.

Normal users should not be creating this class or subclasses of this class directly; you should use the ServerFactory server factory methods to get a suitable server implementation class.

  • Field Details

    • SCREEN_NAME_FIELD_NAME

      public static final String SCREEN_NAME_FIELD_NAME
      See Also:
    • IMPL_COMMENTS_FIELD_NAME

      public static final String IMPL_COMMENTS_FIELD_NAME
      See Also:
    • IMPL_TYPE_FIELD_NAME

      public static final String IMPL_TYPE_FIELD_NAME
      See Also:
    • MINIMUM_SUPPORTED_SERVER_LEVEL_FIELD_NAME

      public static final String MINIMUM_SUPPORTED_SERVER_LEVEL_FIELD_NAME
      See Also:
    • PROTOCOL_NAME_FIELD_NAME

      public static final String PROTOCOL_NAME_FIELD_NAME
      See Also:
    • DEFAULT_STATUS_FIELD_NAME

      public static final String DEFAULT_STATUS_FIELD_NAME
      See Also:
    • P4TICKETS_ENV_VAR

      public static final String P4TICKETS_ENV_VAR
      See Also:
    • P4TICKETS_DEFAULT_WINDOWS

      public static final String P4TICKETS_DEFAULT_WINDOWS
      See Also:
    • P4TICKETS_DEFAULT_OTHER

      public static final String P4TICKETS_DEFAULT_OTHER
      See Also:
    • P4TRUST_ENV_VAR

      public static final String P4TRUST_ENV_VAR
      See Also:
    • P4TRUST_DEFAULT_WINDOWS

      public static final String P4TRUST_DEFAULT_WINDOWS
      See Also:
    • P4TRUST_DEFAULT_OTHER

      public static final String P4TRUST_DEFAULT_OTHER
      See Also:
    • P4IGNORE_ENV_VAR

      public static final String P4IGNORE_ENV_VAR
      See Also:
    • CORE_AUTH_FAIL_STRING_1

      protected static final String CORE_AUTH_FAIL_STRING_1
      Signals access (login) needed
      See Also:
    • CORE_AUTH_FAIL_STRING_2

      protected static final String CORE_AUTH_FAIL_STRING_2
      Signals access (login) needed
      See Also:
    • CORE_AUTH_FAIL_STRING_3

      protected static final String CORE_AUTH_FAIL_STRING_3
      Signals ticket has expired
      See Also:
    • CORE_AUTH_FAIL_STRING_4

      protected static final String CORE_AUTH_FAIL_STRING_4
      Signals ticket has expired
      See Also:
    • UNKNOWN_SERVER_VERSION

      protected static final int UNKNOWN_SERVER_VERSION
      See Also:
    • UNKNOWN_SERVER_HOST

      protected static final String UNKNOWN_SERVER_HOST
    • UNKNOWN_SERVER_PORT

      protected static final int UNKNOWN_SERVER_PORT
      See Also:
    • runningOnWindows

      protected static boolean runningOnWindows
    • usageOptions

      protected UsageOptions usageOptions
    • status

      protected ServerStatus status
    • props

      protected Properties props
    • serverInfo

      protected IServerInfo serverInfo
    • serverAddress

      protected String serverAddress
    • caseSensitive

      protected boolean caseSensitive
    • serverVersion

      protected int serverVersion
    • serverHost

      protected String serverHost
    • serverPort

      protected int serverPort
    • serverProtocol

      protected IServerAddress.Protocol serverProtocol
    • userName

      protected String userName
    • password

      protected String password
    • authTickets

      protected Map<String,String> authTickets
      Storage for user auth tickets. What's returned from p4 login -p command, and what we can add to each command when non-null to authenticate it
    • client

      protected IClient client
    • clientName

      protected String clientName
    • clientPath

      protected String clientPath
    • clientUnsetName

      protected String clientUnsetName
      Used when we have no client set.
    • setupOnConnect

      protected boolean setupOnConnect
    • loginOnConnect

      protected boolean loginOnConnect
    • commandCallback

      protected ICommandCallback commandCallback
    • progressCallback

      protected IProgressCallback progressCallback
    • clientProgressCallback

      protected IProgress clientProgressCallback
    • ssoCallback

      protected ISSOCallback ssoCallback
    • browserCallback

      protected IBrowserCallback browserCallback
    • ssoKey

      protected String ssoKey
    • charsetName

      protected String charsetName
    • p4Charset

      protected P4Charset p4Charset
    • connected

      protected boolean connected
    • minimumSupportedServerVersion

      protected int minimumSupportedServerVersion
    • tmpDirName

      protected String tmpDirName
    • nextCmdCallBackKey

      protected AtomicInteger nextCmdCallBackKey
    • nextProgressCallbackKey

      protected AtomicInteger nextProgressCallbackKey
    • nonCheckedSyncs

      protected boolean nonCheckedSyncs
    • enableStreams

      protected boolean enableStreams
    • enableAndmaps

      protected boolean enableAndmaps
    • enableGraph

      protected boolean enableGraph
    • enableTracking

      protected boolean enableTracking
    • enableProgress

      protected boolean enableProgress
    • quietMode

      protected boolean quietMode
    • secure

      protected boolean secure
    • useAuthMemoryStore

      protected boolean useAuthMemoryStore
    • ignoreFileName

      protected String ignoreFileName
    • rsh

      protected String rsh
    • browserVersion

      protected Object browserVersion
    • rand

      protected Random rand
      Useful source of random integers, etc.
  • Constructor Details

    • Server

      public Server()
  • Method Details

    • guardNull

      public static String guardNull(String str)
    • getPreferredPathArray

      public static String[] getPreferredPathArray(String[] preamble, List<IFileSpec> specList)
    • getPreferredPathArray

      public static String[] getPreferredPathArray(String[] preamble, List<IFileSpec> specList, boolean annotate)
    • populatePathArray

      public static String[] populatePathArray(String[] pathArray, int start, List<IFileSpec> fileSpecList)
    • isRunningOnWindows

      public static boolean isRunningOnWindows()
      Returns:
      true if the JVM indicates that we're running on a Windows platform. Not entirely reliable, but good enough for our purposes.
    • getCharsetName

      public String getCharsetName()
      Description copied from interface: IServer
      Get the current charset name for the server connection. May be null, in which case there is no associated character set.
      Specified by:
      getCharsetName in interface IServer
      Returns:
      charset name associated with this server; may be null.
    • getClientName

      public String getClientName()
    • setClientName

      public void setClientName(String clientName)
    • getClientPath

      public String getClientPath()
    • setClientPath

      public void setClientPath(String clientPath)
      Description copied from interface: IServer
      Set the Perforce P4CLIENTPATH - directories the client can access.

      A list of directories to which Perforce applications are permitted to write. Any attempt by a Perforce application to access or modify files outside these areas of the filesystem will result in an error message. To specify more than one directory, separate the directories with semicolons.

      Specified by:
      setClientPath in interface IServer
      Parameters:
      clientPath - client path
    • getIgnoreFileName

      public String getIgnoreFileName()
    • setIgnoreFileName

      public void setIgnoreFileName(String ignoreFileName)
    • getStatus

      public ServerStatus getStatus()
      Description copied from interface: IServer
      Return the current status of this server object.
      Specified by:
      getStatus in interface IServer
      Returns:
      non-null ServerStatus representing the server status.
    • getUsageOptions

      public UsageOptions getUsageOptions()
      Description copied from interface: IOptionsServer
      Get the UsageOptions object associated with this server.
      Specified by:
      getUsageOptions in interface IOptionsServer
      Returns:
      possibly-null UsageOptions object.
    • setUsageOptions

      public Server setUsageOptions(UsageOptions usageOptions)
      Description copied from interface: IOptionsServer
      Set the UsageOptions object associated with this server. Note that changing this object (or its contents) while a server is busy can cause issues.
      Specified by:
      setUsageOptions in interface IOptionsServer
      Parameters:
      usageOptions - non-null UsageOptions object to associate with this server.
      Returns:
      the current server.
    • getGraphRevList

      public List<IRevListCommit> getGraphRevList(GraphRevListOptions options) throws P4JavaException
      Returns a list of revisions given the options
      Specified by:
      getGraphRevList in interface IGraphRevListDelegator
      Parameters:
      options - graph Revision List Options
      Returns:
      list of graph commits
      Throws:
      P4JavaException - API errors
    • getGraphCommitLogList

      public List<ICommit> getGraphCommitLogList(GraphCommitLogOptions options) throws P4JavaException
      Description copied from interface: ICommitDelegator
      Usage: log -n {repo} {object-sha}
      Specified by:
      getGraphCommitLogList in interface ICommitDelegator
      Specified by:
      getGraphCommitLogList in interface IGraphCommitLogDelegator
      Parameters:
      options - graph log options
      Returns:
      list of commit objects
      Throws:
      P4JavaException - API error
    • doGraphReceivePack

      public void doGraphReceivePack(GraphReceivePackOptions options) throws P4JavaException
      Specified by:
      doGraphReceivePack in interface IGraphReceivePackDelegator
      Throws:
      P4JavaException
    • getListData

      public ListData getListData(List<IFileSpec> fileSpecs, ListOptions options) throws P4JavaException
      Usage: list [-l label [-d]] [-C] [-M] files..
      Specified by:
      getListData in interface IListDelegator
      Parameters:
      fileSpecs - List of file specs
      options - Command options
      Returns:
      ListData
      Throws:
      P4JavaException - API errors
    • getListData

      public ListData getListData(List<IFileSpec> fileSpecs, ListOptions options, String clientName) throws P4JavaException
      Internal use only.

      Use IClient.getListData to restrict list to client view.

      Specified by:
      getListData in interface IListDelegator
      Parameters:
      fileSpecs - List of file specs
      options - Command options
      Returns:
      ListData
      Throws:
      P4JavaException - API errors
    • getUserName

      public String getUserName()
      Description copied from interface: IServer
      Return the user name currently associated with this server, if any. User names are set using the setUserName method.
      Specified by:
      getUserName in interface IServer
      Returns:
      the user name currently associated with this server, if any; null otherwise.
    • setUserName

      public void setUserName(String userName)
      Description copied from interface: IServer
      Set the Perforce user name to be used with this server. This does not perform any login or checking, just associates a user name with this session. Once set, the user name is used with all commands where it makes sense.

      Note that the auth ticket (if available) for this user will also be set to this server instance.

      Specified by:
      setUserName in interface IServer
      Parameters:
      userName - Perforce user name; can be null, which is interpreted as "don't associate a user name with this server".
    • isCaseSensitive

      public boolean isCaseSensitive()
      Description copied from interface: IServer
      Returns whether the Perforce server associated with this IServer object is case sensitive.
      Specified by:
      isCaseSensitive in interface IServer
      Returns:
      - true if case sensitive, false if case insensitive.
    • isConnected

      public boolean isConnected()
      Description copied from interface: IServer
      Return true iff and the server object is connected to the associated Perforce server.

      The meaning of "connected" is generally dependent on the underlying transport layer, but in general, if the server is not connected, issuing server commands to the associated Perforce server will fail with a connection exception.

      Specified by:
      isConnected in interface IServer
      Returns:
      - true iff connected, false otherwise
    • isEnableProgress

      public boolean isEnableProgress()
    • setEnableProgress

      public void setEnableProgress(boolean enableProgress)
    • isEnableTracking

      public boolean isEnableTracking()
    • setEnableTracking

      public void setEnableTracking(boolean enableTracking)
    • isNonCheckedSyncs

      public boolean isNonCheckedSyncs()
    • setNonCheckedSyncs

      public void setNonCheckedSyncs(boolean nonCheckedSyncs)
    • isQuietMode

      public boolean isQuietMode()
    • setQuietMode

      public void setQuietMode(boolean quietMode)
    • isSecure

      protected boolean isSecure()
      Check if the server is secure (SSL) or not.
      Returns:
      if secure
    • setSecure

      protected void setSecure(boolean secure)
      Sets the server to secure (SSL) or non-secure mode.
      Parameters:
      secure - secure
    • getServerVersion

      public int getServerVersion() throws ConnectionException
      Description copied from interface: IServer
      Try to get the Perforce server version. This is likely to be the first time actual connectivity is tested for the server... Since this is called before we know much about the state or type of the Perforce server, we do virtually no real error checking or recovery -- we either get a suitable response and dig out the server version, or we just leave things alone.

      NOTE: has the side effect of setting the server impl's serverVersion field.

      Specified by:
      getServerVersion in interface IServer
      Returns:
      version
      Throws:
      ConnectionException - on error
    • setCurrentServerInfo

      public void setCurrentServerInfo(IServerInfo info)
      Description copied from interface: IServer
      Set the server's Info object without calling `p4 info`. Intended to be used for initialising new server connections for parallel threads.
      Specified by:
      setCurrentServerInfo in interface IServer
      Parameters:
      info - possibly-null Perforce server information
    • getCurrentServerInfo

      public IServerInfo getCurrentServerInfo()
      Description copied from interface: IServer
      Get the server's Info object without calling `p4 info`. Intended to be used for initialising new server connections for parallel threads.
      Specified by:
      getCurrentServerInfo in interface IServer
      Returns:
      the current server's info (may be null)
    • connect

      Description copied from interface: IServer
      Connect to the Perforce server associated with this server object.

      This method's detailed semantics depend on the underlying transport implementation, but in general, it's intended to be called before any attempt is made to issue a command to the associated Perforce server. It's also intended to be called after any (intentional or accidental) disconnect.

      Note that certain implementations may try to request a client, etc., on connection (in response to property values passed in through the URL, etc.), which may cause a RequestException to be generated.

      Specified by:
      connect in interface IServer
      Throws:
      ConnectionException - 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 occurs
    • disconnect

      public void disconnect() throws ConnectionException, AccessException
      Description copied from interface: IServer
      Disconnect from this Perforce server. Does not affect the current IServer's current user, password, or client settings, but if you later reconnect to the same Perforce server, you may also need to re-login.

      This command should be run at the point at which this server is not going to be used any more, and attempts to disconnect from the associated server. "Disconnect" here has different meanings according to the underlying transport mechanism, but in practice it will mean that attempting to use this server object to issue Perforce commands will fail, usually with a ConnectionException exception.

      Specified by:
      disconnect in interface IServer
      Throws:
      ConnectionException - on error
      AccessException - on error
    • getAuthTicket

      public String getAuthTicket()
      Description copied from interface: IServer
      Return the current Perforce authentication ticket being used by this server, if any. This ticket is not always guaranteed to be currently valid, so reuse should be done carefully.
      Specified by:
      getAuthTicket in interface IServer
      Returns:
      possibly-null Perforce authentication ticket
    • setAuthTicket

      public void setAuthTicket(String authTicket)
      Description copied from interface: IServer
      Set the server's Perforce authentication ticket to the passed-in string. If the string is null, auth tickets won't be used when talking to the associated Perforce server; otherwise, the auth ticket will be used to authenticate against the Perforce server for each call to the server.

      No checking is performed on the passed-in ticket, and any changes to existing tickets can cause authentication failures, so you should ensure the passed-in ticket is valid and makes sense for the current context.

      Specified by:
      setAuthTicket in interface IServer
      Parameters:
      authTicket - possibly-null Perforce authentication ticket
    • getKnownCharsets

      public String[] getKnownCharsets()
      Description copied from interface: IServer
      Return an array of strings representing "known" charsets (e.g. "utf8" or "utf32le".

      Note that in this context, "known" simply means that Perforce servers supported by this API can potentially recognize the charset name and (hopefully) act accordingly.

      Charset support in Perforce is described in more detail in the main p4 command documentation; in summary, although the list returned here is comprehensive and quite impressive, unless the Perforce server is actually primed to cope with Unicode (which, by default, they're not), the only charset listed here that will work is "none"; furthermore, actual charset support is somewhat idiosyncratic -- please refer to specific documentation for guidance with this. You probably need to use this method in conjunction with the supportsUnicode() method above.

      Specified by:
      getKnownCharsets in interface IServer
      Returns:
      a non-null array of strings representing lower-case charset names known to the server.
    • getProperties

      public Properties getProperties()
      Description copied from interface: IServer
      Return the Java properties associated with this server. The Properties returned here are the actual properties used in the server and can be updated through this method (i.e. the object is not just a copy). The interpretation of the individual Properties are implementation-specific and not discussed here.
      Specified by:
      getProperties in interface IServer
      Returns:
      Properties object; may be empty but will not be null.
    • getServerVersionNumber

      public int getServerVersionNumber()
      Description copied from interface: IServer
      Get the Perforce version number of the Perforce server associated with this IServer object, if any. This will be in the form 20092 or 20073 (corresponding to 2009.2 and 2007.3 respectively), but the version number will not be available if you're not actually connected to a Perforce server.
      Specified by:
      getServerVersionNumber in interface IServer
      Returns:
      positive integer version number or -1 if not known or unavailable.
    • getWorkingDirectory

      public String getWorkingDirectory()
      Description copied from interface: IServer
      Get the underlying server's notion of the current working directory. If this method returns null, the server is using the JVM's current working directory, typically available as the System user.dir property.
      Specified by:
      getWorkingDirectory in interface IServer
      Returns:
      current working directory path, or null if not set
    • setWorkingDirectory

      public void setWorkingDirectory(String dirPath)
      Description copied from interface: IServer
      Set the Perforce server's idea of each command's working directory. This affects all commands on this server from this point on, and the passed-in path should be both absolute and valid, otherwise strange errors may appear from the server. If dirPath is null, the Java VM's actual current working directory is used instead (which is almost always a safe option unless you're using Perforce alt roots).

      Note: no checking is done at call time for correctness (or otherwise) of the passed-in path.

      Specified by:
      setWorkingDirectory in interface IServer
      Parameters:
      dirPath - absolute path of directory to be used, or null
    • getCurrentClient

      public IClient getCurrentClient()
      Description copied from interface: IServer
      Return the Perforce client currently associated with this Perforce server, if any.
      Specified by:
      getCurrentClient in interface IServer
      Returns:
      IClient representing the current client, or null if no client associated with this server.
    • setCurrentClient

      public void setCurrentClient(IClient client)
      Description copied from interface: IServer
      Set the Perforce client associated with this server.
      Specified by:
      setCurrentClient in interface IServer
      Parameters:
      client - client object
    • registerCallback

      public ICommandCallback registerCallback(ICommandCallback callback)
      Description copied from interface: IServer
      Register a P4Java command callback with this Perforce server.

      See the ICommandCallback javadocs for callback semantics. Note that only one command callback can be active and registered for a given server at any one time.

      Specified by:
      registerCallback in interface IServer
      Parameters:
      callback - ICommandCallback object to be registered; if null, command callbacks are disabled.
      Returns:
      the previous command callback, if it existed; null otherwise
    • registerProgressCallback

      public IProgressCallback registerProgressCallback(IProgressCallback progressCallback)
      Description copied from interface: IServer
      Register a P4Java command progress callback with this Perforce server.

      See the IProgressCallback javadocs for callback semantics. Note that only one progress callback can be active and registered for a given server at any one time.

      Specified by:
      registerProgressCallback in interface IServer
      Parameters:
      progressCallback - IProgressCallback object to be registered; if null, progress callbacks are disabled.
      Returns:
      the previous progress callback, if it existed; null otherwise
    • registerProgressCallback

      public IProgress registerProgressCallback(IProgress progressCallback)
      Specified by:
      registerProgressCallback in interface IServer
      Parameters:
      progressCallback - IProgress object to be registered; if null, progress callbacks are disabled.
      Returns:
      registered IProgress callback; null if none was registered
    • getClientProgressCallback

      public IProgress getClientProgressCallback()
    • registerSSOCallback

      public void registerSSOCallback(ISSOCallback callback, String ssoKey)
      Description copied from interface: IServer
      Register a Perforce Single Sign On (SSO) callback and key for this server.

      See the ISSOCallback Javadoc comments for an explanation of the SSO callback feature; note that only one SSO callback can be active and registered for a given P4Jserver object at any one time.

      Note that SSO callbacks work only with the (default) pure Java (RPC) protocol implementation.

      Specified by:
      registerSSOCallback in interface IServer
      Parameters:
      callback - ISSOCallback object to be registered; if null, SSO callbacks are disabled.
      ssoKey - opaque string to be passed untouched to the callback; can be null, in which case null is passed in to the callback
    • registerBrowserCallback

      public void registerBrowserCallback(IBrowserCallback browserCallback)
      Description copied from interface: IServer
      Register a Perforce browser callback to launch the browser for a given url for this server.

      See the IBrowserCallback Javadoc comments for an explanation of the browser callback feature; note that only one browser callback can be active and registered for a given P4server object at any one time.

      Specified by:
      registerBrowserCallback in interface IServer
      Parameters:
      browserCallback - BrowserCallback object to be registered; if null, browser callbacks are disabled.
    • setCharsetName

      public boolean setCharsetName(String charsetName) throws UnsupportedCharsetException
      Description copied from interface: IServer
      Set the Perforce server's charset to the passed-in charset name. The semantics of this are described in the full Perforce documentation, but note that odd things will happen if the named charset isn't recognized by both the JVM and the Perforce server (i.e. "utf8" works fine, but bizarre variants may not). What constitutes a good charset name, and whether or not the server recognises it, is somewhat fraught and may involve retrieving the unicode counter and using the (printed) list of recognised charsets.
      Specified by:
      setCharsetName in interface IServer
      Parameters:
      charsetName - charset name; if null, resets the charset to "no charset".
      Returns:
      true if the attempt to set the charset name succeeded; false otherwise. False will only be returned if the JVM doesn't support the charset. (an exception will be thrown if the server doesn't recognize it).
      Throws:
      UnsupportedCharsetException - if the Perforce server doesn't support or recognize the charset name.
    • supportsUnicode

      public boolean supportsUnicode() throws ConnectionException, RequestException, AccessException
      Description copied from interface: IServer
      Return true if the underlying Perforce server supports Unicode (and is connected). In this context "supporting unicode" simply means that the method was able to contact the server and retrieve a "true" unicode-enabled status using the info command.

      Specified by:
      supportsUnicode in interface IServer
      Returns:
      true iff the underlying server supports Unicode.
      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 request
      AccessException - 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: IServerControl
      Convenience method for init(host, port, props, opts, secure, null). See init's main Javadoc for full documentation.
      Specified by:
      init in interface IServerControl
      Parameters:
      host - the Perforce server hostname or IP address as passed in to the factory method
      port - the Perforce server port number as passed in to the factory method
      properties - the properties passed in to the factory method
      opts - 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: IServerControl
      Convenience method for init(host, port, props, opts, secure). See init's main Javadoc for full documentation.
      Specified by:
      init in interface IServerControl
      Parameters:
      host - the Perforce server hostname or IP address as passed in to the factory method
      port - the Perforce server port number as passed in to the factory method
      props - the properties passed in to the factory method
      opts - 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
      Description copied from interface: IServerControl
      Convenience method for init(host, port, props, null). See init's main Javadoc for full documentation.
      Specified by:
      init in interface IServerControl
      Parameters:
      host - the Perforce server hostname or IP address as passed in to the factory method
      port - the Perforce server port number as passed in to the factory method
      props - 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).
    • getDefaultP4TicketsFile

      protected String getDefaultP4TicketsFile()
      Get default p4tickets file for the running OS
      Returns:
      - default p4tickets file
    • getDefaultP4TrustFile

      protected String getDefaultP4TrustFile()
      Get default p4trust file for the running OS
      Returns:
      - default p4trust file
    • getInfoServerAddress

      protected String getInfoServerAddress()
      Get the server address entry from the p4 info.
      Returns:
      - server address or null if error
    • parseVersionString

      protected int parseVersionString(String versionString)
      Return the major version number (e.g. 20081) from the passed-in complete version string. Instead of using regex or anything too complex we just keep splitting the string and recombining; this could be optimised or flexibilised fairly easily on one of those long rainy days... (HR).
      Parameters:
      versionString - versionString
      Returns:
      version
    • getRandomInt

      protected int getRandomInt()
      Returns:
      the next positive pseudo random int.
    • getSSOCallback

      public ISSOCallback getSSOCallback()
    • getSSOKey

      public String getSSOKey()
    • getBrowserCallback

      public IBrowserCallback getBrowserCallback()
    • isUnicode

      protected boolean isUnicode()
    • unsetFileAttribute

      public List<IFileSpec> unsetFileAttribute(List<IFileSpec> files, String attribute, SetFileAttributesOptions opts) throws P4JavaException
      Description copied from interface: IAttributeDelegator
      Unset file attributes on one or more files (unsupported). See the main Perforce documentation for an explanation of file attributes, which are potentially complex and difficult to use efficiently. Attributes can currently only be retrieved using the getExtendedFiles (fstat) operation.

      Specified by:
      unsetFileAttribute in interface IAttributeDelegator
      Parameters:
      files - non-null list of files to be affected
      attribute - attribute to remove from perforce
      opts - SetFileAttributesOptions object describing optional parameters; if null, no options are set.
      Returns:
      non-null but possibly empty list of filespec results for the operation.
      Throws:
      P4JavaException - if an error occurs processing this method and its parameters.
    • unsetFileAttributes

      public List<IFileSpec> unsetFileAttributes(List<IFileSpec> files, List<String> attributes, SetFileAttributesOptions opts) throws P4JavaException
      Description copied from interface: IAttributeDelegator
      Set file attributes on one. See the main Perforce documentation for an explanation of file attributes, which are potentially complex and difficult to use efficiently. Attributes can currently only be retrieved using the getExtendedFiles (fstat) operation.

      Specified by:
      unsetFileAttributes in interface IAttributeDelegator
      Parameters:
      files - non-null list of files to be affected
      attributes - a non-null Map of attribute name / value pairs; if any value is null, that attribute is removed.
      opts - SetFileAttributesOptions object describing optional parameters; if null, no options are set.
      Returns:
      non-null but possibly empty list of filespec results for the operation.
      Throws:
      P4JavaException - if an error occurs processing this method and its parameters.
    • setFileAttributes

      public List<IFileSpec> setFileAttributes(List<IFileSpec> files, Map<String,String> attributes, SetFileAttributesOptions opts) throws P4JavaException
      Description copied from interface: IAttributeDelegator
      Set file attributes on one or more files (unsupported). See the main Perforce documentation for an explanation of file attributes, which are potentially complex and difficult to use efficiently. Attributes can currently only be retrieved using the getExtendedFiles (fstat) operation.

      Note that this method only accepts String attribute values; if the attribute is intended to be binary, use the setHexValue setter on the associated SetFileAttributesOptions object and hexify the value, or, alternatively, use the stream version of this method. String input this way will be converted to bytes for the attributes before being sent to the Perforce server using the prevailing character set. If this is a problem, use hex encoding or the stream variant of this method

      Note that attributes can only be removed from a file by setting the appropriate value of the name / value pair passed-in through the attributes map to null.

      Note that the filespecs returned by this method, if valid, contain only the depot path and version information; no other field can be assumed to be valid. Note also that, while the p4 command line executable returns a list of results that amounts to the cross product of files and attributes, this method never returns more than one result for each file affected.

      Specified by:
      setFileAttributes in interface IAttributeDelegator
      Parameters:
      files - non-null list of files to be affected
      attributes - a non-null Map of attribute name / value pairs; if any value is null, that attribute is removed.
      opts - SetFileAttributesOptions object describing optional parameters; if null, no options are set.
      Returns:
      non-null but possibly empty list of filespec results for the operation.
      Throws:
      P4JavaException - if an error occurs processing this method and its parameters.
    • setFileAttributes

      public List<IFileSpec> setFileAttributes(List<IFileSpec> files, @Nonnull String attributeName, @Nonnull InputStream inStream, SetFileAttributesOptions opts) throws P4JavaException
      Description copied from interface: IAttributeDelegator
      Set a file attribute on one or more files using the passed-in input stream as the source for the attribute's value (unsupported). See the main Perforce documentation for an explanation of file attributes, which are potentially complex and difficult to use efficiently. Attributes can currently only be retrieved using the getExtendedFiles (fstat) operation.

      This method is intended to allow for unmediated binary definitions of file attribute contents, and is typically used for things like thumbnails that are too big to be conveniently handled using hex conversion with the strings-based version of this method. Absolutely no interpretation is done on the stream -- it's bytes all the way... there is also no hard limit to the size of the stream that contains the attribute value, but the consequences on both the enclosing app and the associated Perforce server of too-large attributes may be severe. Typical 8K thumbnails are no problem at all, but something in the megabyte range or larger might be problematic at both ends.

      Note that this method will leave the passed-in stream open, but (in general) the stream's read pointer will be at the end of the stream when this method returns. You are responsible for closing the stream if necessary after the call; you are also responsible for ensuring that the read pointer is where you want it to be in the stream (i.e. where you want the method to start reading the attribute value from) when you pass in the stream. I/O errors while reading the stream will be logged, but otherwise generally ignored -- you must check the actual results of this operation yourself.

      Note that the server currently only supports setting file attributes using a stream for one filespec at a time, but for reasons of symmetry you must pass in a list of (one) filespec. Note that this doesn't necessarily mean only one file is affected in the depot, just that only one file spec is used to specify the affected file(s).

      Note that attributes can only be removed from a file by setting the appropriate value of the name / value pair passed-in through the attributes map to null.

      Note that the filespecs returned by this method, if valid, contain only the depot path and version information; no other field can be assumed to be valid. Note also that, while the p4 command line executable returns a list of results that amounts to the cross product of files and attributes, this method never returns more than one result for each file affected.

      Specified by:
      setFileAttributes in interface IAttributeDelegator
      Parameters:
      files - non-null list of files to be affected.
      attributeName - the non-null name of the attribute to be set.
      inStream - non-null InputStream ready for reading the attribute value from.
      opts - SetFileAttributesOptions object describing optional parameters; if null, no options are set.
      Returns:
      non-null but possibly empty list of filespec results for the operation.
      Throws:
      P4JavaException - if an error occurs processing this method and its parameters.
    • getBranchSpecs

      public List<IBranchSpecSummary> getBranchSpecs(GetBranchSpecsOptions opts) throws P4JavaException
      Description copied from interface: IBranchesDelegator
      Get a list of all summary Perforce branch specs known to the Perforce server.

      Note that the IBranchSpecSummary objects returned here do not have branch view specs; you must call the getBranchSpec method on a specific branch to get valid view specs for a branch.

      Specified by:
      getBranchSpecs in interface IBranchesDelegator
      Parameters:
      opts - object describing optional parameters; if null, no options are set.
      Returns:
      non-null (but possibly-empty) list of IBranchSpecSummary objects.
      Throws:
      P4JavaException - if any error occurs in the processing of this method.
    • getBranchSpecs

      public List<IBranchSpecSummary> getBranchSpecs(String userName, String nameFilter, int maxReturns) throws ConnectionException, RequestException, AccessException
      Description copied from interface: IBranchesDelegator
      Old style getBranchSpecs api call. deprecated use getBranchSpecs(final GetBranchSpecsOptions opts) instead
      Specified by:
      getBranchSpecs in interface IBranchesDelegator
      Parameters:
      userName - user name
      nameFilter - name filter
      maxReturns - maximum results
      Returns:
      list of Branch spec summaries
      Throws:
      ConnectionException - connection errors
      RequestException - server request errors
      AccessException - access restrictions
    • getBranchSpec

      public IBranchSpec getBranchSpec(String name, GetBranchSpecOptions opts) throws P4JavaException
      Description copied from interface: IBranchDelegator
      Get a specific named Perforce branch spec from the Perforce server.

      Note that since the Perforce server usually interprets asking for a non-existent branch spec as equivalent to asking for a template for a new branch spec, you will normally always get back a result here. It is best to first use the getBranchSpecList method to see if the branch spec exists, then use this method to retrieve a specific branch spec once you know it exists.

      Specified by:
      getBranchSpec in interface IBranchDelegator
      Parameters:
      name - non-null Perforce branch name.
      opts - GetBranchSpecOptions object describing optional parameters; if null, no options are set.
      Returns:
      potentially-null IBranchSpec for the named Perforce branch spec.
      Throws:
      P4JavaException - if any error occurs in the processing of this method.
    • deleteBranchSpec

      public String deleteBranchSpec(String branchSpecName, DeleteBranchSpecOptions opts) throws P4JavaException
      Description copied from interface: IBranchDelegator
      Delete a named Perforce branch spec from the Perforce server.
      Specified by:
      deleteBranchSpec in interface IBranchDelegator
      Parameters:
      branchSpecName - non-null name of the branch spec to be deleted.
      opts - DeleteBranchSpecOptions object describing optional parameters; if null, no options are set.
      Returns:
      non-null result message string from the Perforce server; this may include form trigger output pre-pended and / or appended to the "normal" message
      Throws:
      P4JavaException - if any error occurs in the processing of this method.
    • getBranchSpec

      Description copied from interface: IBranchDelegator
      Get the branch spec for the given name.
      Specified by:
      getBranchSpec in interface IBranchDelegator
      Parameters:
      name - the name of the branch
      Returns:
      a populated branch spec object
      Throws:
      ConnectionException - when there is an error talking to the Helix server
      RequestException - when there is a problem with the data provided in the request
      AccessException - when access to the branch command is not authorised
    • createBranchSpec

      public String createBranchSpec(@Nonnull IBranchSpec branchSpec) throws ConnectionException, RequestException, AccessException
      Description copied from interface: IBranchDelegator
      TODO: This should be moved up to Server and changed to delegate to createBranchSpec with an options class. This would also allow for a force option.
      Specified by:
      createBranchSpec in interface IBranchDelegator
      Parameters:
      branchSpec - the spec object containing the branch data fields.
      Returns:
      The name of the newly create branch spec
      Throws:
      ConnectionException - when there is an error talking to the Helix server
      RequestException - when there is a problem with the data provided in the request
      AccessException - when access to the branch command is not authorised
    • updateBranchSpec

      public String updateBranchSpec(@Nonnull IBranchSpec branchSpec) throws ConnectionException, RequestException, AccessException
      Description copied from interface: IBranchDelegator
      Update the data fields in an existing branch spec.
      Specified by:
      updateBranchSpec in interface IBranchDelegator
      Parameters:
      branchSpec - the branch data
      Returns:
      the name of the updated spec
      Throws:
      ConnectionException - when there is an error talking to the Helix server
      RequestException - when there is a problem with the data provided in the request
      AccessException - when access to the branch command is not authorised
    • deleteBranchSpec

      @Deprecated public String deleteBranchSpec(String branchSpecName, boolean force) throws ConnectionException, RequestException, AccessException
      Deprecated.
      Description copied from interface: IBranchDelegator
      Delete a branch spec specifing whether it should be a forced operation.
      Specified by:
      deleteBranchSpec in interface IBranchDelegator
      Parameters:
      branchSpecName - the name of the spec to delete
      force - whether to force the operation through
      Returns:
      name of the deleted spec
      Throws:
      ConnectionException - when there is an error talking to the Helix server
      RequestException - when there is a problem with the data provided in the request
      AccessException - when access to the branch command is not authorised
    • deletePendingChangelist

      public String deletePendingChangelist(int id) throws ConnectionException, RequestException, AccessException
      Description copied from interface: IChangeDelegator
      Delete a pending Perforce changelist. Throws a P4JavaException if the changelist was associated with opened files or was not a pending changelist.

      Note: any IChangelist object associated with the given changelist will no longer be valid after this operation, and using that object may cause undefined results or even global disaster -- you must ensure that the object is not used again improperly.

      Specified by:
      deletePendingChangelist in interface IChangeDelegator
      Parameters:
      id - the ID of the Perforce pending changelist to be deleted.
      Returns:
      possibly-null operation result message string from the Perforce server
      Throws:
      ConnectionException - the connection exception
      RequestException - the request exception
      AccessException - the access exception
    • getChangelist

      public IChangelist getChangelist(int id) throws ConnectionException, RequestException, AccessException
      Description copied from interface: IChangeDelegator
      Get a specific Perforce changelist from a Perforce server.

      Corresponds fairly well to the p4 command-line command "change -o", and (like "change -o") does not include the associated changelist files (if any) in the returned changelist object -- you must use getChangelistFiles (or similar) to properly populate the changelist for submission, for example.

      Specified by:
      getChangelist in interface IChangeDelegator
      Parameters:
      id - the Perforce changelist ID; if id is IChangelist.DEFAULT, get the default changelist for the current client (if available)
      Returns:
      non-null IChangelist describing the changelist; if no such changelist, a RequestException is thrown.
      Throws:
      ConnectionException - the connection exception
      RequestException - the request exception
      AccessException - the access exception
    • deletePendingChangelist

      public String deletePendingChangelist(int id, ChangelistOptions opts) throws P4JavaException
      Description copied from interface: IChangeDelegator
      Delete a pending Perforce changelist. Throws a P4JavaException if the changelist was associated with opened files or was not a pending changelist.

      Note: any IChangelist object associated with the given changelist will no longer be valid after this operation, and using that object may cause undefined results or even global disaster -- you must ensure that the object is not used again improperly.

      Specified by:
      deletePendingChangelist in interface IChangeDelegator
      Parameters:
      id - the ID of the Perforce pending changelist to be deleted.
      opts - ChangelistOptions object describing optional parameters; if null, no options are set.
      Returns:
      possibly-null operation result message string from the Perforce server
      Throws:
      P4JavaException - if any error occurs in the processing of this method
    • getChangelist

      public IChangelist getChangelist(int id, ChangelistOptions opts) throws P4JavaException
      Description copied from interface: IChangeDelegator
      Get a specific Perforce changelist from a Perforce server.

      Corresponds fairly well to the p4 command-line command "change -o", and (like "change -o") does not include the associated changelist files (if any) in the returned changelist object -- you must use getChangelistFiles (or similar) to properly populate the changelist for submission, for example.

      Specified by:
      getChangelist in interface IChangeDelegator
      Parameters:
      id - the Perforce changelist ID; if id is IChangelist.DEFAULT, get the default changelist for the current client (if available)
      opts - ChangelistOptions object describing optional parameters; if null, no options are set.
      Returns:
      non-null IChangelist describing the changelist; if no such changelist, a RequestException is thrown.
      Throws:
      P4JavaException - if any error occurs in the processing of this method
    • getChangelists

      public List<IChangelistSummary> getChangelists(int maxMostRecent, List<IFileSpec> fileSpecs, String clientName, String userName, boolean includeIntegrated, IChangelist.Type type, boolean longDesc) throws ConnectionException, RequestException, AccessException
      Description copied from interface: IChangesDelegator
      Gets the changelists.
      Specified by:
      getChangelists in interface IChangesDelegator
      Parameters:
      maxMostRecent - the max most recent
      fileSpecs - the file specs
      clientName - the client name
      userName - the user name
      includeIntegrated - the include integrated
      type - the type
      longDesc - the long desc
      Returns:
      the changelists
      Throws:
      ConnectionException - the connection exception
      RequestException - the request exception
      AccessException - the access exception
    • getChangelists

      public List<IChangelistSummary> getChangelists(int maxMostRecent, List<IFileSpec> fileSpecs, String clientName, String userName, boolean includeIntegrated, boolean submittedOnly, boolean pendingOnly, boolean longDesc) throws ConnectionException, RequestException, AccessException
      Description copied from interface: IChangesDelegator
      Gets the changelists.
      Specified by:
      getChangelists in interface IChangesDelegator
      Parameters:
      maxMostRecent - the max most recent
      fileSpecs - the file specs
      clientName - the client name
      userName - the user name
      includeIntegrated - the include integrated
      submittedOnly - the submitted only
      pendingOnly - the pending only
      longDesc - the long desc
      Returns:
      the changelists
      Throws:
      ConnectionException - the connection exception
      RequestException - the request exception
      AccessException - the access exception
    • getChangelists

      public List<IChangelistSummary> getChangelists(List<IFileSpec> fileSpecs, GetChangelistsOptions opts) throws P4JavaException
      Description copied from interface: IChangesDelegator
      Get a list of Perforce changelist summary objects from the Perforce server.
      Specified by:
      getChangelists in interface IChangesDelegator
      Parameters:
      fileSpecs - if non-empty, limits the results to changelists that affect the specified files. If the file specification includes a revision range, limits its results to submitted changelists that affect those particular revisions
      opts - GetChangelistsOptions object describing optional parameters; if null, no options are set.
      Returns:
      a non-null (but possibly empty) list of qualifying changelists.
      Throws:
      P4JavaException - if any error occurs in the processing of this method
    • getChangelistDiffs

      public InputStream getChangelistDiffs(int id, GetChangelistDiffsOptions opts) throws P4JavaException
      Description copied from interface: IDescribeDelegator
      Get an InputStream onto the file diffs associated with a specific submitted changelist. This method (like the similar "p4 describe" command) will not return diffs for pending changelists.

      This is one of the guaranteed "live" method on this interface, and will return the diff output as it exists when called (rather than when the underlying implementation object was created). This can be an expensive method to evaluate, and can generate reams and reams (and reams) of output, so don't use it willy-nilly.

      Note that unlike the corresponding command-line command, which keeps going in the face of errors by moving on to the next file (or whatever), any errors encountered in this method will cause an exception from this method at the first error, so plan accordingly....

      Specified by:
      getChangelistDiffs in interface IDescribeDelegator
      Parameters:
      id - the ID of the target changelist.
      opts - GetChangelistDiffsOptions object describing optional parameters; if null, no options are set.
      Returns:
      InputStream onto the diff stream. Note that while this stream will not be null, it may be empty.
      Throws:
      P4JavaException - if any error occurs in the processing of this method.
    • getChangelistDiffsStream

      public InputStream getChangelistDiffsStream(int id, DescribeOptions options) throws ConnectionException, RequestException, AccessException
      Description copied from interface: IDescribeDelegator
      Get an InputStream onto the file diffs associated with a specific submitted changelist. This method (like the similar "p4 describe" command) will not return diffs for pending changelists.

      This is one of the guaranteed "live" method on this interface, and will return the diff output as it exists when called (rather than when the underlying implementation object was created). This can be an expensive method to evaluate, and can generate reams and reams (and reams) of output, so don't use it willy-nilly.

      Note that unlike the corresponding command-line command, which keeps going in the face of errors by moving on to the next file (or whatever), any errors encountered in this method will cause an exception from this method at the first error, so plan accordingly....

      Specified by:
      getChangelistDiffsStream in interface IDescribeDelegator
      Parameters:
      id - the ID of the target changelist
      options - DescribeOptions behavioural options for method.
      Returns:
      InputStream onto the diff stream. Note that while this stream will not be null, it may be empty
      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 request
      AccessException - if the Perforce server denies access to the caller
    • getShelvedFiles

      public List<IFileSpec> getShelvedFiles(int changelistId) throws P4JavaException
      Description copied from interface: IDescribeDelegator
      Get a list of shelved files associated with a Perforce pending changelist.

      Specified by:
      getShelvedFiles in interface IDescribeDelegator
      Parameters:
      changelistId - numeric pending changelist identifier
      Returns:
      non-null (but possibly empty) list of shelved files associated with the pending changelist.
      Throws:
      P4JavaException - if an error occurs processing this method and its parameters.
    • getShelvedFiles

      public List<IFileSpec> getShelvedFiles(int changelistId, int max) throws P4JavaException
      Description copied from interface: IDescribeDelegator
      Get a list of shelved files associated with a Perforce pending changelist.

      Specified by:
      getShelvedFiles in interface IDescribeDelegator
      Parameters:
      changelistId - numeric pending changelist identifier
      max - limit the number of files returned
      Returns:
      non-null (but possibly empty) list of shelved files associated with the pending changelist.
      Throws:
      P4JavaException - if an error occurs processing this method and its parameters.
    • getChangelistDiffs

      public InputStream getChangelistDiffs(int id, DiffType diffType) throws ConnectionException, RequestException, AccessException
      Description copied from interface: IServer
      Get an InputStream onto the file diffs associated with a specific submitted changelist. This method (like the similar "p4 describe" command) will not return diffs for pending changelists.

      This is one of the guaranteed "live" method on this interface, and will return the diff output as it exists when called (rather than when the underlying implementation object was created). This can be an expensive method to evaluate, and can generate reams and reams (and reams) of output, so don't use it willy-nilly.

      Note that unlike the corresponding command-line command, which keeps going in the face of errors by moving on to the next file (or whatever), any errors encountered in this method will cause an exception from this method at the first error, so plan accordingly....

      Specified by:
      getChangelistDiffs in interface IServer
      Parameters:
      id - the ID of the target changelist
      diffType - if non-null, describes which type of diff to perform.
      Returns:
      InputStream onto the diff stream. Note that while this stream will not be null, it may be empty
      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 request
      AccessException - if the Perforce server denies access to the caller
    • getChangelistFiles

      public List<IFileSpec> getChangelistFiles(int id) throws ConnectionException, RequestException, AccessException
      Description copied from interface: IDescribeDelegator
      Get a list of the Perforce depot files associated with a Perforce changelist.

      The IFileSpec objects returned are not guaranteed to have any fields except depot path, version, and action valid.

      Changelists that are pending will not have files visible through this method; you should use the client openedFiles method for retrieving files in that situation.

      Specified by:
      getChangelistFiles in interface IDescribeDelegator
      Parameters:
      id - numeric changelist identifier
      Returns:
      non-null (but possibly empty) list of files associated with the changelist.
      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 request
      AccessException - if the Perforce server denies access to the caller
    • getChangelistFiles

      public List<IFileSpec> getChangelistFiles(int id, int max) throws ConnectionException, RequestException, AccessException
      Description copied from interface: IDescribeDelegator
      Get a list of the Perforce depot files associated with a Perforce changelist.

      The IFileSpec objects returned are not guaranteed to have any fields except depot path, version, and action valid.

      Changelists that are pending will not have files visible through this method; you should use the client openedFiles method for retrieving files in that situation.

      Specified by:
      getChangelistFiles in interface IDescribeDelegator
      Parameters:
      id - numeric changelist identifier
      max - limit the number of files returned
      Returns:
      non-null (but possibly empty) list of files associated with the changelist.
      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 request
      AccessException - if the Perforce server denies access to the caller
    • getChangelistExtendedFiles

      public List<IExtendedFileSpec> getChangelistExtendedFiles(int id) throws ConnectionException, RequestException, AccessException
      Description copied from interface: IDescribeDelegator
      Get an extended list of the Perforce depot files associated with a Perforce changelist.

      The IExtendedFileSpec objects returned are not guaranteed to have any fields except depot path, version, and action valid.

      Changelists that are pending will not have files visible through this method; you should use the client openedFiles method for retrieving files in that situation.

      Specified by:
      getChangelistExtendedFiles in interface IDescribeDelegator
      Parameters:
      id - numeric changelist identifier
      Returns:
      non-null (but possibly empty) list of extended files associated with the changelist.
      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 request
      AccessException - if the Perforce server denies access to the caller
    • getChangelistExtendedFiles

      public List<IExtendedFileSpec> getChangelistExtendedFiles(int id, int max) throws ConnectionException, RequestException, AccessException
      Description copied from interface: IDescribeDelegator
      Get an extended list of the Perforce depot files associated with a Perforce changelist.

      The IExtendedFileSpec objects returned are not guaranteed to have any fields except depot path, version, and action valid.

      Changelists that are pending will not have files visible through this method; you should use the client openedFiles method for retrieving files in that situation.

      Specified by:
      getChangelistExtendedFiles in interface IDescribeDelegator
      Parameters:
      id - numeric changelist identifier
      max - limit the number of files returned
      Returns:
      non-null (but possibly empty) list of extended files associated with the changelist.
      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 request
      AccessException - if the Perforce server denies access to the caller
    • getCommitFiles

      public List<IFileSpec> getCommitFiles(String repo, String commit) throws ConnectionException, RequestException, AccessException
      Specified by:
      getCommitFiles in interface IServer
      Parameters:
      repo - the graph repo
      commit - the commit SHA
      Returns:
      non-null (but possibly empty) list of files associated with the commit.
      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 request
      AccessException - if the Perforce server denies access to the caller
    • setOrUnsetServerConfigurationValue

      public String setOrUnsetServerConfigurationValue(@Nonnull String name, @Nullable String value) throws P4JavaException
      Description copied from interface: IConfigureDelegator
      Set or unset a specific names server configuration variable. Config variables are unset by passing in a null value parameter.

      Expected variable name formats are as specified in the main Perforce documentation: [servername + #] variablename -- but this is not enforced by P4Java itself.

      Note: you must be an admin or super user for this command to work.

      Specified by:
      setOrUnsetServerConfigurationValue in interface IConfigureDelegator
      Parameters:
      name - non-null config variable name.
      value - if null, unset the named variable; otherwise, set it to the passed-in string value.
      Returns:
      possibly-empty operation status string returned by the server in response to this set / unset attempt.
      Throws:
      P4JavaException - if an error occurs processing this method and its parameters.
    • showServerConfiguration

      public List<ServerConfigurationValue> showServerConfiguration(String serverName, String variableName) throws P4JavaException
      Description copied from interface: IConfigureDelegator
      Show server configuration values. See the main Perforce documentation for the details of this admin command, but note that only one of serverName or variableName should be non-null (they can both be null, which means ignore them both). If they're both null, serverName currently takes precedence, but that's not guaranteed.

      Note: you must be an admin or super user for this command to work.

      Specified by:
      showServerConfiguration in interface IConfigureDelegator
      Parameters:
      serverName - if not null, only show values associated with the named server; if equals ServerConfigurationValue.ALL_SERVERS, show values associated with all participating servers.
      variableName - if not null, only show the value of this named config variable.
      Returns:
      non-null (but possibly-empty) list of qualifying ServerConfigurationValue objects.
      Throws:
      P4JavaException - if an error occurs processing this method and its parameters.
    • getDbSchema

      public List<IDbSchema> getDbSchema(List<String> tableSpecs) throws P4JavaException
      Description copied from interface: IDBSchemaDelegator
      Gets the db schema.
      Specified by:
      getDbSchema in interface IDBSchemaDelegator
      Parameters:
      tableSpecs - the table specs
      Returns:
      the db schema
      Throws:
      P4JavaException - the p4 java exception
    • getClient

      public IClient getClient(String clientName) throws ConnectionException, RequestException, AccessException
      Specified by:
      getClient in interface IClientDelegator
      Throws:
      ConnectionException
      RequestException
      AccessException
    • getClient

      public IClient getClient(@Nonnull IClientSummary clientSummary) throws ConnectionException, RequestException, AccessException
      Specified by:
      getClient in interface IClientDelegator
      Throws:
      ConnectionException
      RequestException
      AccessException
    • getClientTemplate

      public IClient getClientTemplate(String clientName) throws ConnectionException, RequestException, AccessException
      Specified by:
      getClientTemplate in interface IClientDelegator
      Throws:
      ConnectionException
      RequestException
      AccessException
    • getClientTemplate

      public IClient getClientTemplate(String clientName, boolean allowExistent) throws ConnectionException, RequestException, AccessException
      Specified by:
      getClientTemplate in interface IClientDelegator
      Throws:
      ConnectionException
      RequestException
      AccessException
    • getClientTemplate

      public IClient getClientTemplate(String clientName, GetClientTemplateOptions opts) throws P4JavaException
      Description copied from interface: IClientDelegator
      Get a template of a non-existent named Perforce client. This will only return an IClient for clients that don't exist unless the allowExistent parameter is set to true. This method is designed to be able to get the server returned default values it uses when a non-existent client is requested.
      Specified by:
      getClientTemplate in interface IClientDelegator
      Parameters:
      clientName - Not blank Perforce client name.
      opts - GetClientTemplateOptions object describing optional parameters; if null, no options are set.
      Returns:
      IClient representing the specified Perforce client template, or null if no such client template.
      Throws:
      P4JavaException - if any error occurs in the processing of this method.
    • getInterchanges

      public List<IChangelist> getInterchanges(IFileSpec fromFile, IFileSpec toFile, GetInterchangesOptions opts) throws P4JavaException
      Description copied from interface: IInterchangesDelegator
      Returns a list of changelists that have not been integrated from a set of source files to a set of target files.
      Specified by:
      getInterchanges in interface IInterchangesDelegator
      Parameters:
      fromFile - if non-null, use this as the from-file specification.
      toFile - if non-null, use this as the to-file specification.
      opts - GetInterchangesOptions object describing optional parameters; if null, no options are set.
      Returns:
      non-null (but possibly empty) list of qualifying changelists. Note that the changelists returned here may not have all fields set (only description, ID, date, user, and client are known to be properly set by the server for this command)
      Throws:
      P4JavaException - if an error occurs processing this method and its parameters.
    • getInterchanges

      public List<IChangelist> getInterchanges(String branchSpecName, List<IFileSpec> fromFileList, List<IFileSpec> toFileList, GetInterchangesOptions opts) throws P4JavaException
      Description copied from interface: IInterchangesDelegator
      Returns a list of changelists that have not been integrated from a set of source files to a set of target files.

      Note that depending on the specific options passed-in the fromFileList can be null or one file spec; the toFileList can be null, one or more file specs. The full semantics of this operation are found in the main 'p4 help interchanges' documentation.

      Specified by:
      getInterchanges in interface IInterchangesDelegator
      Parameters:
      branchSpecName - if non-null and not empty, use this as the branch spec name.
      fromFileList - if non-null and not empty, and biDirectional is true, use this as the from file list.
      toFileList - if non-null and not empty, use this as the to file list.
      opts - GetInterchangesOptions object describing optional parameters; if null, no options are set.
      Returns:
      non-null (but possibly empty) list of qualifying changelists. Note that the changelists returned here may not have all fields set (only description, ID, date, user, and client are known to be properly set by the server for this command)
      Throws:
      P4JavaException - if an error occurs processing this method and its parameters.
    • getInterchanges

      public List<IChangelist> getInterchanges(IFileSpec fromFile, IFileSpec toFile, boolean showFiles, boolean longDesc, int maxChangelistId) throws ConnectionException, RequestException, AccessException
      Description copied from interface: IServer
      Get a list of changes and / or associated files not yet integrated (unsupported). Corresponds fairly closely to the p4 interchanges command for filespecs.

      Note that if showFiles is true, the returned files are attached to the associated changelist, and can be retrieved using the getFiles(false) method -- and note that if you call getFiles(true) you will get a refreshed list of all files associated with the changelist, which is probably different from the list associated with the integration.

      Note also that if there are no qualifying changes, this method will return an empty list rather than throw an exception; this behaviour is different to that seen with the p4 command line which will throw an exception.

      Specified by:
      getInterchanges in interface IServer
      Parameters:
      fromFile - non-null from-file specification.
      toFile - non-null to-file specification.
      showFiles - if true, show the individual files that would require integration.
      longDesc - if true, return a long description in the changelist.
      maxChangelistId - if greater than zero, only consider integration history from changelists at or below the given number
      Returns:
      non-null (but possibly empty) list of qualifying changelists. Note that the changelists returned here may not have all fields set (only description, ID, date, user, and client are known to be properly set by the server for this 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 request
      AccessException - if the Perforce server denies access to the caller
    • getInterchanges

      public List<IChangelist> getInterchanges(String branchSpecName, List<IFileSpec> fromFileList, List<IFileSpec> toFileList, boolean showFiles, boolean longDesc, int maxChangelistId, boolean reverseMapping, boolean biDirectional) throws ConnectionException, RequestException, AccessException
      Description copied from interface: IServer
      Get a list of changes and / or associated files not yet integrated, based on branchspecs (unsupported). Corresponds fairly closely to the p4 interchanges command for branchspecs.

      Note that if showFiles is true, the returned files are attached to the associated changelist, and can be retrieved using the getFiles(false) method -- and note that if you call getFiles(true) you will get a refreshed list of all files associated with the changelist, which is probably different from the list associated with the integration.

      Note also that if there are no qualifying changes, this method will return an empty list rather than throw an exception; this behaviour is different to that seen with the p4 command line which will throw an exception.

      Specified by:
      getInterchanges in interface IServer
      Parameters:
      branchSpecName - non-null, non-empty branch spec name.
      fromFileList - if non-null and not empty, and biDirectional is true, use this as the from file list.
      toFileList - if non-null and not empty, use this as the to file list.
      showFiles - if true, show the individual files that would require integration.
      longDesc - if true, return a long description in the changelist.
      maxChangelistId - if greater than zero, only consider integration
      reverseMapping - if true, reverse the mappings in the branch view, with the target files and source files exchanging place.
      biDirectional - if true, bi-directional option
      Returns:
      non-null (but possibly empty) list of qualifying changelists. Note that the changelists returned here may not have all fields set (only description, ID, date, user, and client are known to be properly set by the server for this 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 request
      AccessException - if the Perforce server denies access to the caller
    • createClient

      public String createClient(@Nonnull IClient newClient) throws ConnectionException, RequestException, AccessException
      Specified by:
      createClient in interface IClientDelegator
      Throws:
      ConnectionException
      RequestException
      AccessException
    • createTempClient

      public void createTempClient(@Nonnull IClient newClient) throws ConnectionException, RequestException, AccessException
      Specified by:
      createTempClient in interface IClientDelegator
      Throws:
      ConnectionException
      RequestException
      AccessException
    • updateClient

      public String updateClient(@Nonnull IClient client) throws ConnectionException, RequestException, AccessException
      Specified by:
      updateClient in interface IClientDelegator
      Throws:
      ConnectionException
      RequestException
      AccessException
    • updateClient

      public String updateClient(IClient client, boolean force) throws ConnectionException, RequestException, AccessException
      Description copied from interface: IClientDelegator
      Update an existing Perforce client on the current Perforce server. This client does not need to be the current client, and no association with the passed-in client is made by the server (i.e. it's not made the current client).
      Specified by:
      updateClient in interface IClientDelegator
      Parameters:
      client - non-null IClient defining the Perforce client to be updated
      force - if true, tell the server to attempt to force the update regardless of the consequences. You're on your own with this one...
      Returns:
      possibly-null operation result message string from the Perforce server
      Throws:
      ConnectionException - on error
      RequestException - if any error occurs in the processing of this method.
      AccessException - on error
    • updateClient

      public String updateClient(IClient client, UpdateClientOptions opts) throws P4JavaException
      Description copied from interface: IClientDelegator
      Update an existing Perforce client on the current Perforce server. This client does not need to be the current client, and no association with the passed-in client is made by the server (i.e. it's not made the current client).
      Specified by:
      updateClient in interface IClientDelegator
      Parameters:
      client - non-null IClient defining the Perforce client to be updated
      opts - UpdateClientOptions object describing optional parameters; if null, no options are set.
      Returns:
      possibly-null operation result message string from the Perforce server
      Throws:
      P4JavaException - if any error occurs in the processing of this method.
    • deleteClient

      public String deleteClient(String clientName, boolean force) throws ConnectionException, RequestException, AccessException
      Specified by:
      deleteClient in interface IClientDelegator
      Throws:
      ConnectionException
      RequestException
      AccessException
    • deleteClient

      public String deleteClient(String clientName, DeleteClientOptions opts) throws P4JavaException
      Description copied from interface: IClientDelegator
      Delete a Perforce client from a Perforce server. The effects this has on the client and the server are not well-defined here, and you should probably consult the relevant Perforce documentation for your specific case. In any event, you can cause quite a lot of inconvenience (and maybe even damage) doing a forced delete without preparing properly for it, especially if the client is the server object's current client.
      Specified by:
      deleteClient in interface IClientDelegator
      Parameters:
      clientName - non-null name of the client to be deleted from the server.
      opts - DeleteClientOptions object describing optional parameters; if null, no options are set.
      Returns:
      possibly-null operation result message string from the Perforce server.
      Throws:
      P4JavaException - if any error occurs in the processing of this method.
    • switchClientView

      public String switchClientView(String templateClientName, String targetClientName, SwitchClientViewOptions opts) throws P4JavaException
      Description copied from interface: IClientDelegator
      Switch the target client spec's view without invoking the editor. With -t to switch to a view defined in another client spec. Switching views is not allowed in a client that has opened files. The -f flag can be used with -s to force switching with opened files. View switching has no effect on files in a client workspace until 'p4 sync' is run.
      Specified by:
      switchClientView in interface IClientDelegator
      Parameters:
      templateClientName - non-null name of the template client who's view will be used for the target (or current) client to switched to.
      targetClientName - possibly-null name of the target client whose view will be changed to the template client's view. If null, the current client will be used.
      opts - SwitchClientViewOptions object describing optional parameters; if null, no options are set.
      Returns:
      possibly-null operation result message string from the Perforce server
      Throws:
      P4JavaException - if any error occurs in the processing of this method.
    • switchStreamView

      public String switchStreamView(String streamPath, String targetClientName, SwitchClientViewOptions opts) throws P4JavaException
      Description copied from interface: IClientDelegator
      Switch the target client spec's view without invoking the editor. With -S to switch to the specified stream's view. Switching views is not allowed in a client that has opened files. The -f flag can be used with -s to force switching with opened files. View switching has no effect on files in a client workspace until 'p4 sync' is run.
      Specified by:
      switchStreamView in interface IClientDelegator
      Parameters:
      streamPath - non-null stream's path in a stream depot, of the form //depotname/streamname who's view will be used for the target (or current) client to switched to.
      targetClientName - possibly-null name of the target client whose view will be changed to the stream's view. If null, the current client will be used.
      opts - SwitchClientViewOptions object describing optional parameters; if null, no options are set.
      Returns:
      possibly-null operation result message string from the Perforce server
      Throws:
      P4JavaException - if any error occurs in the processing of this method.
    • getClients

      public List<IClientSummary> getClients(GetClientsOptions opts) throws P4JavaException
      Description copied from interface: IClientsDelegator
      Get a list of IClientSummary objects for all Perforce clients known to this Perforce server.

      Note that this method returns light-weight IClientSummary objects rather than full IClient objects; if you need the heavy-weight IClient objects, you should use getClient().

      Note also that the returned IClient objects are not "complete", in the sense that implementations are free to leave certain attributes null for performance reasons. In general, at least the client's name, root, description, last modification time are guaranteed correct.

      Specified by:
      getClients in interface IClientsDelegator
      Parameters:
      opts - GetClientsOptions object describing optional parameters; if null, no options are set.
      Returns:
      non-null (but possibly empty) list of Client objects for Perforce clients known to this Perforce server.
      Throws:
      P4JavaException - if any error occurs in the processing of this method.
    • getClients

      public List<IClientSummary> getClients(String userName, String nameFilter, int maxResults) throws ConnectionException, RequestException, AccessException
      Description copied from interface: IClientsDelegator
      Get a list of IClientSummary objects for all Perforce clients known to this Perforce server.

      Note that this method returns light-weight IClientSummary objects rather than full IClient objects; if you need the heavy-weight IClient objects, you should use getClient().

      Note also that the returned IClient objects are not "complete", in the sense that implementations are free to leave certain attributes null for performance reasons. In general, at least the client's name, root, description, last modification time are guaranteed correct.

      Specified by:
      getClients in interface IClientsDelegator
      Parameters:
      userName - user name
      nameFilter - limits output to clients whose name matches the nameFilter pattern. Corresponds to -enameFilter flag
      maxResults - If greater than zero, limit output to the first maxResults number of clients.
      Returns:
      non-null (but possibly empty) list of Client objects for Perforce clients known to
      Throws:
      ConnectionException - on error
      RequestException - on error
      AccessException - on error
    • getCounter

      public String getCounter(String counterName) throws ConnectionException, RequestException, AccessException
      Specified by:
      getCounter in interface ICounterDelegator
      Throws:
      ConnectionException
      RequestException
      AccessException
    • getCounter

      public String getCounter(String counterName, CounterOptions opts) throws P4JavaException
      Description copied from interface: ICounterDelegator
      Get the value of a named Perforce counter from the Perforce server. Note that this method will return a zero string (i.e. "0") if the named counter doesn't exist (rather than throw an exception); use getCounters to see if a counter actually exists before you use it.

      Note that despite their name, counters can be any value, not just a number; hence the string return value here.

      Specified by:
      getCounter in interface ICounterDelegator
      Parameters:
      counterName - non-null counter name.
      opts - CounterOptions object describing optional parameters; if null, no options are set.
      Returns:
      non-null (but possibly empty or useless) counter value associated with counterName.
      Throws:
      P4JavaException - if an error occurs processing this method and its parameters.
    • setCounter

      public void setCounter(String counterName, String value, boolean perforceCounter) throws ConnectionException, RequestException, AccessException
      Specified by:
      setCounter in interface ICounterDelegator
      Throws:
      ConnectionException
      RequestException
      AccessException
    • setCounter

      public String setCounter(String counterName, String value, CounterOptions opts) throws P4JavaException
      Description copied from interface: ICounterDelegator
      Create, set or delete a counter on a Perforce server. This method can be used to create, set, increment, or delete a counter according to the specific options set in the associated options object. Note that the increment operation does not work on servers earlier than 10.1, and that the return value is never guaranteed to be non-null -- use with caution.
      Specified by:
      setCounter in interface ICounterDelegator
      Parameters:
      counterName - non-null counter name.
      value - value the counter should be set to; can be null if the set operation is an increment.
      opts - CounterOptions object describing optional parameters; if null, no options are set.
      Returns:
      possibly-null current (post-set, post-increment) value; may be zero if the operation was a delete; may not be reliable for pre 10.1 servers.
      Throws:
      P4JavaException - if an error occurs processing this method and its parameters.
    • deleteCounter

      public void deleteCounter(String counterName, boolean perforceCounter) throws ConnectionException, RequestException, AccessException
      Specified by:
      deleteCounter in interface ICounterDelegator
      Throws:
      ConnectionException
      RequestException
      AccessException
    • getCounters

      public Map<String,String> getCounters(GetCountersOptions opts) throws P4JavaException
      Description copied from interface: ICountersDelegator
      Get a map of the Perforce server's counters.
      Specified by:
      getCounters in interface ICountersDelegator
      Parameters:
      opts - GetCountersOptions object describing optional parameters; if null, no options are set.
      Returns:
      a non-null (but possibly empty) map of counters.
      Throws:
      P4JavaException - if an error occurs processing this method and its parameters.
    • getCounters

      @Deprecated public Map<String,String> getCounters(CounterOptions opts) throws P4JavaException
      Deprecated.
      Description copied from interface: ICountersDelegator
      Get a map of the Perforce server's counters.
      Specified by:
      getCounters in interface ICountersDelegator
      Parameters:
      opts - CounterOptions object describing optional parameters; if null, no options are set.
      Returns:
      a non-null (but possibly empty) map of counters.
      Throws:
      P4JavaException - if an error occurs processing this method and its parameters.
    • getCounters

      Description copied from interface: ICountersDelegator
      This is here to allow access via both IOptionsServer and IServer, the underlying delegator implementation provides the concrete method.
      Specified by:
      getCounters in interface ICountersDelegator
      Returns:
      a non-null (but possibly empty) map of counters. key and value semantics and format are not specified here.
      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 request
      AccessException - if the Perforce server denies access to the caller
      See Also:
    • init

      public ServerStatus init(String host, int port, Properties props, UsageOptions opts, boolean secure, String rsh) throws ConfigException, ConnectionException
      Description copied from interface: IServerControl
      Initialize the server. Called immediately after the server class is instantiated. The semantics of this method are fairly broad: the result of calling this method is that a future call to "normal" server calls must not fail because of any setting-up problems.
      Specified by:
      init in interface IServerControl
      Parameters:
      host - the Perforce server hostname or IP address as passed in to the factory method
      port - the Perforce server port number as passed in to the factory method
      props - the properties passed in to the factory method
      opts - the UsageOptions object to be associated with the server object; if null, the server should construct a new default UsageOptions object.
      secure - indicates whether the server is secure (SSL) or not.
      rsh - the 'rsh' mode server launch command.
      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).
    • createDepot

      public String createDepot(@Nonnull IDepot newDepot) throws P4JavaException
      Description copied from interface: IDepotDelegator
      Create a new depot in the repository. You must be an admin for this operation to succeed.
      Specified by:
      createDepot in interface IDepotDelegator
      Parameters:
      newDepot - non-null IDepot object representing the depot to be created.
      Returns:
      possibly-null operation result message string from the Perforce server.
      Throws:
      P4JavaException - if any error occurs in the processing of this method.
    • deleteDepot

      public String deleteDepot(String name) throws P4JavaException
      Description copied from interface: IDepotDelegator
      Delete a named depot from the repository. You must be an admin for this operation to succeed.
      Specified by:
      deleteDepot in interface IDepotDelegator
      Parameters:
      name - non-null IDepot object representing the depot to be deleted
      Returns:
      possibly-null operation result message string from the Perforce server.
      Throws:
      P4JavaException - if any error occurs in the processing of this method.
    • getDepot

      public IDepot getDepot(String name) throws P4JavaException
      Description copied from interface: IDepotDelegator
      Get an individual depot by name. Note that this method will return a fake depot if you ask it for a non-existent depot, so it's not the most useful of operations.
      Specified by:
      getDepot in interface IDepotDelegator
      Parameters:
      name - non-null name of the depot to be retrieved.
      Returns:
      IDepot non-null object corresponding to the named depot if it exists and is retrievable; otherwise an IDepot object that looks real but does not, in fact, correspond to any known depot in the repository.
      Throws:
      P4JavaException - if any error occurs in the processing of this method.
    • getDepots

      Description copied from interface: IDepotsDelegator
      Gets the depots.
      Specified by:
      getDepots in interface IDepotsDelegator
      Returns:
      the depots
      Throws:
      ConnectionException - the connection exception
      RequestException - the request exception
      AccessException - the access exception
    • getDepots

      public List<IDepot> getDepots(GetDepotsOptions opts) throws P4JavaException
      Description copied from interface: IDepotsDelegator
      Gets depots with type and namefilter
      Specified by:
      getDepots in interface IDepotsDelegator
      Parameters:
      opts - options
      Returns:
      list of depots
      Throws:
      P4JavaException - on error
    • getRepos

      Description copied from interface: IReposDelegator
      Gets the repos.
      Specified by:
      getRepos in interface IReposDelegator
      Returns:
      a list of repos
      Throws:
      ConnectionException - the connection exception
      RequestException - the request exception
      AccessException - the access exception
    • getRepos

      public List<IRepo> getRepos(ReposOptions options) throws P4JavaException
      Description copied from interface: IReposDelegator
      Get the repos with filter options
      Specified by:
      getRepos in interface IReposDelegator
      Parameters:
      options - Repos filter options
      Returns:
      a list of repos
      Throws:
      P4JavaException - an api exception
    • getRepos

      public List<IRepo> getRepos(String clientName) throws ConnectionException, RequestException, AccessException
      Description copied from interface: IReposDelegator
      Gets the repos mapped within the client's view.
      Specified by:
      getRepos in interface IReposDelegator
      Parameters:
      clientName - the name of the client workspace
      Returns:
      a list of repos
      Throws:
      ConnectionException - on error
      RequestException - on error
      AccessException - on error
    • getFileDiffs

      public List<IFileDiff> getFileDiffs(IFileSpec file1, IFileSpec file2, String branchSpecName, GetFileDiffsOptions opts) throws P4JavaException
      Description copied from interface: IDiff2Delegator
      Run diff on the Perforce server of two files in the depot.

      With a branch view, fromFile and toFile are optional; fromFile limits the scope of the source file set, and toFile limits the scope of the target. If only one file argument is given, it is assumed to be toFile.

      This method corresponds closely to the standard diff2 command, and that command's documentation should be consulted for the overall and detailed semantics.

      Specified by:
      getFileDiffs in interface IDiff2Delegator
      Parameters:
      file1 - (optional, with a branch view) source file IFileSpec
      file2 - (optional, with a branch view) target file IFileSpec
      branchSpecName - optional branch spec name
      opts - GetFileDiffsOptions object describing optional parameters; if null, no options are set.
      Returns:
      non-null but possibly empty array of file diffs
      Throws:
      P4JavaException - if an error occurs processing this method and its parameters.
    • getFileDiffsStream

      public InputStream getFileDiffsStream(IFileSpec file1, IFileSpec file2, String branchSpecName, GetFileDiffsOptions opts) throws P4JavaException
      Description copied from interface: IDiff2Delegator
      Run diff on the Perforce server of two files in the depot.

      With a branch view, fromFile and toFile are optional; fromFile limits the scope of the source file set, and toFile limits the scope of the target. If only one file argument is given, it is assumed to be toFile.

      This method corresponds closely to the standard diff2 command, and that command's documentation should be consulted for the overall and detailed semantics.

      As with other streams-based IServer methods, callers should ensure that the stream returned here is always explicitly closed after use; if not closed, the stream's associated temporary files managed by P4Java (if they exist) may not be properly deleted.

      Specified by:
      getFileDiffsStream in interface IDiff2Delegator
      Parameters:
      file1 - (optional, with a branch view) source file IFileSpec
      file2 - (optional, with a branch view) target file IFileSpec
      branchSpecName - optional branch spec name
      opts - GetFileDiffsOptions object describing optional parameters; if null, no options are set.
      Returns:
      non-null but possibly empty InputStream of diffs and headers as returned from the server.
      Throws:
      P4JavaException - if an error occurs processing this method and its parameters.
    • getFileDiffs

      public List<IFileDiff> getFileDiffs(IFileSpec file1, IFileSpec file2, String branchSpecName, DiffType diffType, boolean quiet, boolean includeNonTextDiffs, boolean gnuDiffs) throws ConnectionException, RequestException, AccessException
      Description copied from interface: IDiff2Delegator
      Run diff on the Perforce server of two files in the depot.

      This method corresponds closely to the standard diff2 command, and that command's documentation should be consulted for the overall and detailed semantics. In particular, the various potentially-valid combinations of branch spec and file specs can be complicated and won't be repeated here.

      Specified by:
      getFileDiffs in interface IDiff2Delegator
      Parameters:
      file1 - optional first file IFileSpec
      file2 - optional second file IFileSpec
      branchSpecName - optional branch spec name
      diffType - diff type
      quiet - if true, suppresses the display of the header lines of files whose content and types are identical and suppresses the actual diff for all files.
      includeNonTextDiffs - if true, forces 'p4 diff2' to diff even files with non-text (binary) types
      gnuDiffs - see "-u" option in the main diff2 documentation.
      Returns:
      non-null but possibly empty array of file diffs
      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 request
      AccessException - if the Perforce server denies access to the caller
    • getServerFileDiffs

      public InputStream getServerFileDiffs(IFileSpec file1, IFileSpec file2, String branchSpecName, DiffType diffType, boolean quiet, boolean includeNonTextDiffs, boolean gnuDiffs) throws ConnectionException, RequestException, AccessException
      Description copied from interface: IDiff2Delegator
      Run diff on the Perforce server of two files in the depot.

      This method corresponds closely to the standard diff2 command, and that command's documentation should be consulted for the overall and detailed semantics. In particular, the various potentially-valid combinations of branch spec and file specs can be complicated and won't be repeated here.

      As with other streams-based IServer methods, callers should ensure that the stream returned here is always explicitly closed after use; if not closed, the stream's associated temporary files managed by P4Java (if they exist) may not be properly deleted.

      Specified by:
      getServerFileDiffs in interface IDiff2Delegator
      Parameters:
      file1 - optional first file IFileSpec
      file2 - optional second file IFileSpec
      branchSpecName - optional branch spec name
      diffType - diff type
      quiet - if true, suppresses the display of the header lines of files whose content and types are identical and suppresses the actual diff for all files.
      includeNonTextDiffs - if true, forces 'p4 diff2' to diff even files with non-text (binary) types
      gnuDiffs - see "-u" option in the main diff2 documentation.
      Returns:
      non-null but possibly empty InputStream of diffs and headers as returned from the server.
      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 request
      AccessException - if the Perforce server denies access to the caller
    • getDiskSpace

      public List<IDiskSpace> getDiskSpace(List<String> filesystems) throws P4JavaException
      Description copied from interface: IDiskspaceDelegator
      Get a list of disk space information about the current availability of disk space on the server. This command requires that the user be an operator or have 'super' access granted by 'p4 protect'.

      If no arguments are specified, disk space information for all relevant file systems is displayed; otherwise the output is restricted to the named filesystem(s).

      filesystems: P4ROOT | P4JOURNAL | P4LOG | TEMP | journalPrefix | depot See the main 'p4 diskspace' command documentation for full semantics and usage details.

      Specified by:
      getDiskSpace in interface IDiskspaceDelegator
      Parameters:
      filesystems - if not null, specify a list of Perforce named filesystem(s).
      Returns:
      non-null but possibly empty list of disk space information.
      Throws:
      P4JavaException - if an error occurs processing this method and its parameters.
    • duplicateRevisions

      public List<IFileSpec> duplicateRevisions(IFileSpec fromFile, IFileSpec toFile, DuplicateRevisionsOptions opts) throws P4JavaException
      Description copied from interface: IDuplicateDelegator
      Duplicate revisions with integration history (unsupported).

      Duplicate revisions as if they always existed. All aspects of the source revisions are mirrored to the target revisions, including changelist number, date, attributes, and contents. The target revision must not already exist and the target file must not be opened (for any operation) on any client.

      Note that integration records are duplicated as well. 'p4 duplicate' followed by a 'p4 obliterate' (of the source revisions) is in effect a deep rename operation, with any source revision in client workspace or labels forgotten. The full semantics of this operation are found in the main 'p4 help duplicate' documentation.

      Specified by:
      duplicateRevisions in interface IDuplicateDelegator
      Parameters:
      fromFile - non-null source file.
      toFile - non-null target file.
      opts - possibly-null CopyFilesOptions object specifying method options.
      Returns:
      non-null but possibly empty list of duplicated file info/error messages.
      Throws:
      P4JavaException - if an error occurs processing this method and its parameters.
    • getExportRecords

      public List<Map<String,Object>> getExportRecords(ExportRecordsOptions opts) throws P4JavaException
      Description copied from interface: IExportDelegator
      Get a list of exported journal or checkpoint records (admin / superuser command).

      See the main p4 export command documentation for full semantics and usage details.

      Note that the 'skip*' options in ExportRecordsOptions are specific to P4Java only; they are not Perforce command options. These options are for field handling rules in the lower layers of P4Java. The field rules are for identifying the fields that should skip charset translation of their values; leaving their values as bytes instead of converting them to strings. Please see ExportRecordsOptions for usage details.

      Specified by:
      getExportRecords in interface IExportDelegator
      Parameters:
      opts - ExportRecordsOptions object describing optional parameters; if null, no options are set.
      Returns:
      non-null but possibly empty list of maps representing exported journal or checkpoint records.
      Throws:
      P4JavaException - if an error occurs processing this method and its parameters.
    • getStreamingExportRecords

      public void getStreamingExportRecords(ExportRecordsOptions opts, @Nonnull IStreamingCallback callback, int key) throws P4JavaException
      Description copied from interface: IExportDelegator
      Get each exported journal or checkpoint record (admin / superuser command) as it comes in from the server, rather than waiting for the entire command to complete.

      The results are sent to the user using the IStreamingCallback handleResult method; see the IStreamingCallback Javadoc for details. The payload passed to handleResult is usually the raw map gathered together deep in the RPC protocol layer, and the user is assumed to have the knowledge and technology to be able to parse it and use it suitably in much the same way as a user unpacks or processes the results from the other low-level exec methods like execMapCommand.

      See the main p4 export command documentation for full semantics and usage details.

      Note that the 'skip*' options in ExportRecordsOptions are specific to P4Java only; they are not Perforce command options. These options are for field handling rules in the lower layers of P4Java. The field rules are for identifying the fields that should skip charset translation of their values; leaving their values as bytes instead of converting them to strings. Please see ExportRecordsOptions for usage details.

      Specified by:
      getStreamingExportRecords in interface IExportDelegator
      Parameters:
      opts - ExportRecordsOptions object describing optional parameters; if null, no options are set.
      callback - a non-null IStreamingCallback to be used to process the incoming results.
      key - an opaque integer key that is passed to the IStreamingCallback callback methods to identify the action as being associated with this specific call.
      Throws:
      P4JavaException - if an error occurs processing this method and its parameters.
    • getExportRecords

      public List<Map<String,Object>> getExportRecords(boolean useJournal, long maxRecs, int sourceNum, long offset, boolean format, String journalPrefix, String filter) throws ConnectionException, RequestException, AccessException
      Description copied from interface: IExportDelegator
      Get a list of exported journal or checkpoint records (admin / superuser command).

      See the main p4 export command documentation for full semantics and usage details.

      Note that the 'skip*' options in ExportRecordsOptions are specific to P4Java only; they are not Perforce command options. These options are for field handling rules in the lower layers of P4Java. The field rules are for identifying the fields that should skip charset translation of their values; leaving their values as bytes instead of converting them to strings. Please see ExportRecordsOptions for usage details.

      Specified by:
      getExportRecords in interface IExportDelegator
      Parameters:
      useJournal - *If true, specifies a journal number and optional offset position (journal number/offset) from which to start exporting. Corresponds to the '-j token' flag.

      If false, specifies a checkpoint number and optional offset position (checkpoint number#offset) from which to start exporting. Corresponds to the '-c token' flag.

      maxRecs - If greater than zero, limits the number of lines (records) exported. Corresponds to the '-l lines' flag.
      sourceNum - If positive, specifies a journal or checkpoint number. Corresponds to the 'token' part of the '-j token' and '-c token' flags.

      The '-j token' flag specifies a journal number and optional position (in the form: journal number/offset) from which to start exporting. The -c token flag specifies a checkpoint number and optional position (in the form: checkpoint number#offset) from which to start exporting.

      offset - If positive, specifies a journal or checkpoint optional offset position (journal number/offset or checkpoint number#offset) from which to start exporting.
      format - If true, formats non-textual datatypes appropriately. Corresponds to the '-f' flag.
      journalPrefix - If non-null, specifies a file name prefix to match the one used with 'p4d -jc prefix'. Corresponds to the '-J' flag.
      filter - If non-null, limits output to records that match the filter pattern. Corresponds to the '-F' flag.
      Returns:
      export records list
      Throws:
      ConnectionException - on error
      RequestException - on error
      AccessException - on error
    • getFileAnnotations

      public List<IFileAnnotation> getFileAnnotations(List<IFileSpec> fileSpecs, @Nonnull DiffType wsOpts, boolean allResults, boolean useChangeNumbers, boolean followBranches) throws ConnectionException, RequestException, AccessException
      Specified by:
      getFileAnnotations in interface IFileAnnotateDelegator
      Parameters:
      fileSpecs - non-null list of file specs to be annotated.
      wsOpts - If non-null, use the DiffType value to determine whitespace options.
      allResults - If true, include both deleted files and lines no longer present at the head revision; corresponds to the -a flag.
      useChangeNumbers - If true, annotate with change numbers rather than revision numbers with each line; correspond to the -c flag.
      followBranches - If true, follow branches; corresponds to the -f flag.
      Returns:
      list of file annotations
      Throws:
      ConnectionException - connection errors
      RequestException - server request errors
      AccessException - access restrictions
    • getFileAnnotations

      public List<IFileAnnotation> getFileAnnotations(List<IFileSpec> fileSpecs, GetFileAnnotationsOptions opts) throws P4JavaException
      Description copied from interface: IFileAnnotateDelegator
      Get a list of revision annotations for the specified files.
      Specified by:
      getFileAnnotations in interface IFileAnnotateDelegator
      Parameters:
      fileSpecs - non-null list of file specs to be annotated.
      opts - GetFileAnnotationsOptions object describing optional parameters; if null, no options are set.
      Returns:
      non-null (but possibly-empty) list of IFileAnnotation objects representing version annotations for the passed-in file specs.
      Throws:
      P4JavaException - if any error occurs in the processing of this method.
    • getRevisionHistory

      public Map<IFileSpec,List<IFileRevisionData>> getRevisionHistory(List<IFileSpec> fileSpecs, GetRevisionHistoryOptions opts) throws P4JavaException
      Description copied from interface: IFileLogDelegator
      Get the revision history data for one or more Perforce files.

      Specified by:
      getRevisionHistory in interface IFileLogDelegator
      Parameters:
      fileSpecs - fileSpecs to be processed; if null or empty, an empty Map is returned.
      opts - GetRevisionHistoryOptions object describing optional parameters; if null, no options are set.
      Returns:
      a non-null map of lists of revision data for qualifying files; the map is keyed by the IFileSpec of the associated file, meaning that errors are signaled using the normal IFileSpec getOpStatus() method.
      Throws:
      P4JavaException - if any error occurs in the processing of this method.
    • getRevisionHistory

      public Map<IFileSpec,List<IFileRevisionData>> getRevisionHistory(List<IFileSpec> fileSpecs, int maxRevs, boolean contentHistory, boolean includeInherited, boolean longOutput, boolean truncatedLongOutput) throws ConnectionException, AccessException
      Description copied from interface: IFileLogDelegator
      Get the revision history data for one or more Perforce files.
      Specified by:
      getRevisionHistory in interface IFileLogDelegator
      Parameters:
      fileSpecs - fileSpecs to be processed; if null or empty, an empty Map is returned.
      maxRevs - If positive, displays at most 'maxRevs' revisions per file of the file[rev] argument specified. Corresponds to -m.
      contentHistory - If true, display file content history instead of file name history. Corresponds to -h.
      includeInherited - If true, causes inherited file history to be displayed as well. Corresponds to -i.
      longOutput - If true, produces long output with the full text of the changelist descriptions. Corresponds to -l.
      truncatedLongOutput - If true, produces long output with the full text of the changelist descriptions truncated to 250 characters. Corresponds to -L.
      Returns:
      map spec revision data
      Throws:
      ConnectionException - on error
      AccessException - on error
    • getDirectories

      public List<IFileSpec> getDirectories(@Nonnull List<IFileSpec> fileSpecs, boolean clientOnly, boolean deletedOnly, boolean haveListOnly) throws ConnectionException, AccessException
      Description copied from interface: IDirsDelegator
      List any directories matching the passed-in file specifications and other options.
      Specified by:
      getDirectories in interface IDirsDelegator
      Parameters:
      fileSpecs - the file specs
      clientOnly - the client only
      deletedOnly - the deleted only
      haveListOnly - the have list only
      Returns:
      the directories
      Throws:
      ConnectionException - the connection exception
      AccessException - the access exception
    • getDirectories

      public List<IFileSpec> getDirectories(List<IFileSpec> fileSpecs, GetDirectoriesOptions opts) throws P4JavaException
      Description copied from interface: IDirsDelegator
      List any directories matching the passed-in file specifications.
      Specified by:
      getDirectories in interface IDirsDelegator
      Parameters:
      fileSpecs - non-null list of file specifications.
      opts - GetDirectoriesOptions object describing optional parameters; if null, no options are set.
      Returns:
      non-null but possibly empty list of qualifying directory file specs; only the getPath() path will be valid.
      Throws:
      P4JavaException - if any error occurs in the processing of this method.
    • getDepotFiles

      public List<IFileSpec> getDepotFiles(@Nonnull List<IFileSpec> fileSpecs, boolean allRevs) throws ConnectionException, AccessException
      Description copied from interface: IFilesDelegator
      List all Perforce depot files known to the Perforce server that conform to the passed-in wild-card file specification(s).

      If client file names are given as file spec arguments the current Perforce client view mapping is used to list the corresponding depot files, if the client and view exist (if not, the results are undefined).

      Normally, the head revision of each matching file is listed, but you can change this by specifying specific revisions or revision ranges. If the file spec argument includes a revision, then all files as of that revision are returned. If the file spec argument has a revision range, then only files selected by that revision range are returned, and the highest revision in the range is used for each file. If GetDepotFilesOptions.allRevs is true, all revisions within the specific range, rather than just the highest revision in the range, are returned.

      See 'p4 help revisions' for help specifying revisions.

      Note that the IFileSpec objects returned will have null client and local path components.

      Specified by:
      getDepotFiles in interface IFilesDelegator
      Parameters:
      fileSpecs - the file specs
      allRevs - the all revs
      Returns:
      the depot files
      Throws:
      ConnectionException - the connection exception
      AccessException - the access exception
    • getDepotFiles

      public List<IFileSpec> getDepotFiles(@Nonnull List<IFileSpec> fileSpecs, GetDepotFilesOptions opts) throws P4JavaException
      Description copied from interface: IFilesDelegator
      List all Perforce depot files known to the Perforce server that conform to the passed-in wild-card file specification(s).

      If client file names are given as file spec arguments the current Perforce client view mapping is used to list the corresponding depot files, if the client and view exist (if not, the results are undefined).

      Normally, the head revision of each matching file is listed, but you can change this by specifying specific revisions or revision ranges. If the file spec argument includes a revision, then all files as of that revision are returned. If the file spec argument has a revision range, then only files selected by that revision range are returned, and the highest revision in the range is used for each file. If GetDepotFilesOptions.allRevs is true, all revisions within the specific range, rather than just the highest revision in the range, are returned.

      See 'p4 help revisions' for help specifying revisions.

      Note that the IFileSpec objects returned will have null client and local path components.

      Specified by:
      getDepotFiles in interface IFilesDelegator
      Parameters:
      fileSpecs - a non-null list of one or more IFileSpecs to be used to qualify Perforce depot files
      opts - GetDepotFilesOptions describing the associated options; if null, no options are set.
      Returns:
      a non-null (but possible empty) list of all qualifying depot files
      Throws:
      P4JavaException - if any error occurs in the processing of this method.
    • fixJobs

      public List<IFix> fixJobs(List<String> jobIds, int changeListId, String status, boolean delete) throws ConnectionException, RequestException, AccessException
      Description copied from interface: IFixDelegator
      Mark each named job as being fixed by the changelist number given with changeListId.
      Specified by:
      fixJobs in interface IFixDelegator
      Parameters:
      jobIds - non-null non-empty list of affected job IDs.
      changeListId - changelist ID for affected changelist.
      status - the status
      delete - whether to delete.
      Returns:
      list of affected fixes.
      Throws:
      ConnectionException - the connection exception
      RequestException - the request exception
      AccessException - the access exception
    • fixJobs

      public List<IFix> fixJobs(@Nonnull List<String> jobIds, int changeListId, FixJobsOptions opts) throws P4JavaException
      Description copied from interface: IFixDelegator
      Mark each named job as being fixed by the changelist number given with changeListId.
      Specified by:
      fixJobs in interface IFixDelegator
      Parameters:
      jobIds - non-null non-empty list of affected job IDs.
      changeListId - changelist ID for affected changelist.
      opts - FixJobsOptions object describing optional parameters; if null, no options are set.
      Returns:
      list of affected fixes.
      Throws:
      P4JavaException - if an error occurs processing this method and its parameters.
    • getFixList

      public List<IFix> getFixList(List<IFileSpec> fileSpecs, int changeListId, String jobId, boolean includeIntegrations, int maxFixes) throws ConnectionException, RequestException, AccessException
      Description copied from interface: IFixesDelegator
      Return a list of all Perforce jobs with fix records associated with them, along with the changelist number of the fix. Detailed semantics for this method are given in the main Perforce documentation for the p4 command "fixes".

      Note that this method (unlike the main file list methods) throws an exception and stops at the first encountered error.

      Specified by:
      getFixList in interface IFixesDelegator
      Parameters:
      fileSpecs - if given, restrict output to fixes associated with these files
      changeListId - if positive, only fixes from the numbered changelist are listed.
      jobId - if non-null, only fixes for the named job are listed
      includeIntegrations - if true, include any fixes made by changelists integrated into the specified files
      maxFixes - if positive, restrict the list to the first maxFixes fixes
      Returns:
      non-null but possibly empty list of qualifying IFix fixes.
      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 request
      AccessException - if the Perforce server denies access to the caller
    • getFixes

      public List<IFix> getFixes(List<IFileSpec> fileSpecs, GetFixesOptions opts) throws P4JavaException
      Description copied from interface: IFixesDelegator
      Return a list of all Perforce jobs with fix records associated with them, along with the changelist number of the fix. Detailed semantics for this method are given in the main Perforce documentation for the p4 command "fixes".

      Note that this method (unlike the main file list methods) throws an exception and stops at the first encountered error.

      Specified by:
      getFixes in interface IFixesDelegator
      Parameters:
      fileSpecs - if given, restrict output to fixes associated with these files
      opts - FixListOptions object describing optional parameters; if null, no options are set
      Returns:
      non-null but possibly empty list of qualifying IFix fixes.
      Throws:
      P4JavaException - if any error occurs in the processing of this method.
    • getExtendedFiles

      public List<IExtendedFileSpec> getExtendedFiles(List<IFileSpec> fileSpecs, int maxFiles, int sinceChangelist, int affectedByChangelist, FileStatOutputOptions outputOptions, FileStatAncilliaryOptions ancilliaryOptions) throws ConnectionException, AccessException
      Description copied from interface: IFstatDelegator
      Return a list of everything Perforce knows about a possibly very large set of Perforce files.

      This method is not intended for general use, and is not documented in detail here; consult the main Perforce fstat command documentation for detailed help. In particular, the various options are too complex to be described in a few sentences here, and the various option arguments reflect this complexity. Note that setting both sinceChangelist and affectedByChangelist to zero or a positive value will cause usage errors from the server (these are currently intended to be mutually-exclusive options).

      This method can be a real server and bandwidth resource hog, and should be used as sparingly as possible; alternatively, try to use it with as narrow a set of file specs as possible.

      Specified by:
      getExtendedFiles in interface IFstatDelegator
      Parameters:
      fileSpecs - non-null list of Perforce file specification(s)
      maxFiles - if positive, restrict the output to the first maxReturns files. Implementations are free to ignore this parameter if necessary (and return all qualifying results).
      sinceChangelist - if larger than or equal to zero, display only files affected since the given changelist number; zero is equivalent to IChangelist.DEFAULT.
      affectedByChangelist - if larger than or equal to zero, display only files affected by the given changelist number; zero is equivalent to IChangelist.DEFAULT.
      outputOptions - if non-null, specifies the oputput options to be used
      ancilliaryOptions - if non-null, specifies the ancilliary output options to be used
      Returns:
      a non-null (but possibly empty) list of qualifying files and associated stat info
      Throws:
      ConnectionException - if the Perforce server is unreachable or is not connected.
      AccessException - if the Perforce server denies access to the caller
    • getExtendedFiles

      public List<IExtendedFileSpec> getExtendedFiles(List<IFileSpec> fileSpecs, GetExtendedFilesOptions opts) throws P4JavaException
      Description copied from interface: IFstatDelegator
      Return a list of everything Perforce knows about a set of Perforce files.

      This method is not intended for general use, and is not documented in detail here; consult the main Perforce fstat command documentation for detailed help. This method can be a real server and bandwidth resource hog, and should be used as sparingly as possible; alternatively, try to use it with as narrow a set of file specs as possible.

      Specified by:
      getExtendedFiles in interface IFstatDelegator
      Parameters:
      fileSpecs - non-null list of Perforce file specification(s).
      opts - GetExtendedFilesOptions object describing optional parameters; if null, no options are set.
      Returns:
      non-null (but possibly empty) list of qualifying files and associated stat info.
      Throws:
      P4JavaException - if an error occurs processing this method and its parameters.
    • getMatchingLines

      public List<IFileLineMatch> getMatchingLines(List<IFileSpec> fileSpecs, String pattern, MatchingLinesOptions options) throws P4JavaException
      Description copied from interface: IGrepDelegator
      Get list of matching lines in the specified file specs. This method implements the p4 grep command; for full semantics, see the separate p4 documentation and / or the GrepOptions Javadoc.
      Specified by:
      getMatchingLines in interface IGrepDelegator
      Parameters:
      fileSpecs - file specs to search for matching lines
      pattern - non-null string pattern to be passed to the grep command
      options - - Options to grep command
      Returns:
      - non-null but possibly empty list of file line matches
      Throws:
      P4JavaException - if any error occurs in the processing of this method.
    • getMatchingLines

      public List<IFileLineMatch> getMatchingLines(@Nonnull List<IFileSpec> fileSpecs, @Nonnull String pattern, @Nullable List<String> infoLines, MatchingLinesOptions options) throws P4JavaException
      Description copied from interface: IGrepDelegator
      Get list of matching lines in the specified file specs. This method implements the p4 grep command; for full semantics, see the separate p4 documentation and / or the GrepOptions Javadoc.

      This method allows the user to retrieve useful info and warning message lines the Perforce server may generate in response to things like encountering a too-long line, etc., by passing in a non-null infoLines parameter.

      Specified by:
      getMatchingLines in interface IGrepDelegator
      Parameters:
      fileSpecs - file specs to search for matching lines
      pattern - non-null string pattern to be passed to the grep command
      infoLines - if not null, any "info" lines returned from the server (i.e. warnings about exceeded line lengths, etc.) will be put into the passed-in list in the order they are received.
      options - - Options to grep command
      Returns:
      - non-null but possibly empty list of file line matches
      Throws:
      P4JavaException - if any error occurs in the processing of this method.
    • getServerInfo

      Description copied from interface: IInfoDelegator
      Gets the server info.
      Specified by:
      getServerInfo in interface IInfoDelegator
      Returns:
      the server info
      Throws:
      ConnectionException - the connection exception
      RequestException - the request exception
      AccessException - the access exception
    • createUserGroup

      public String createUserGroup(IUserGroup group) throws ConnectionException, RequestException, AccessException
      Description copied from interface: IServer
      Create a new Perforce user group on the Perforce server.
      Specified by:
      createUserGroup in interface IServer
      Parameters:
      group - non-null IUserGroup to be created.
      Returns:
      possibly-null status message string as returned from the server
      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 request.
      AccessException - if the Perforce server denies access to the caller.
    • createUserGroup

      public String createUserGroup(IUserGroup group, UpdateUserGroupOptions opts) throws P4JavaException
      Description copied from interface: IGroupDelegator
      Create a new Perforce user group on the Perforce server.
      Specified by:
      createUserGroup in interface IGroupDelegator
      Parameters:
      group - non-null IUserGroup to be created.
      opts - which create options to be applied
      Returns:
      possibly-null status message string as returned from the server
      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 request.
      AccessException - if the Perforce server denies access to the caller.
      P4JavaException
    • deleteUserGroup

      public String deleteUserGroup(IUserGroup group) throws ConnectionException, RequestException, AccessException
      Description copied from interface: IServer
      Delete a Perforce user group from the Perforce server.
      Specified by:
      deleteUserGroup in interface IServer
      Parameters:
      group - non-null group to be deleted.
      Returns:
      possibly-null status message string as returned from the server
      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 request.
      AccessException - if the Perforce server denies access to the caller.
    • deleteUserGroup

      public String deleteUserGroup(IUserGroup group, UpdateUserGroupOptions opts) throws P4JavaException
      Description copied from interface: IGroupDelegator
      Delete a Perforce user group from the Perforce server.
      Specified by:
      deleteUserGroup in interface IGroupDelegator
      Parameters:
      group - non-null group to be deleted.
      opts - which delete options to be applied
      Returns:
      possibly-null status message string as returned from the server
      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 request.
      AccessException - if the Perforce server denies access to the caller.
      P4JavaException
    • getUserGroup

      Description copied from interface: IGroupDelegator
      Get the named Perforce user group. Note that since the Perforce server usually interprets asking for a non-existent group as equivalent to asking for a template for a new user group, you will normally always get back a result here. It is best to first use the getUserGroups method to see if the group exists, then use this method to retrieve a specific group once you know it exists. TODO: once we have finished the delegators, IOptionServer should be made to extend IServer this definition can then be removed as there is no Options object for getUserGroup
      Specified by:
      getUserGroup in interface IGroupDelegator
      Parameters:
      name - non-null group name.
      Returns:
      IUserGroup representing the named user group if it exists on the server; null otherwise (but see note in main comments above).
      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 request.
      AccessException - if the Perforce server denies access to the caller.
    • updateUserGroup

      public String updateUserGroup(IUserGroup group, boolean updateIfOwner) throws ConnectionException, RequestException, AccessException
      Description copied from interface: IServer
      Update a Perforce user group on the Perforce server.
      Specified by:
      updateUserGroup in interface IServer
      Parameters:
      group - non-null user group to be updated.
      updateIfOwner - if true, allows a user without 'super' access to modify the group only if that user is an 'owner' of that group.
      Returns:
      possibly-null status message string as returned from the server
      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 request.
      AccessException - if the Perforce server denies access to the caller.
    • updateUserGroup

      public String updateUserGroup(IUserGroup group, UpdateUserGroupOptions opts) throws P4JavaException
      Description copied from interface: IGroupDelegator
      Update a Perforce user group on the Perforce server.
      Specified by:
      updateUserGroup in interface IGroupDelegator
      Parameters:
      group - non-null user group to be updated.
      opts - which update options to be applied
      Returns:
      possibly-null status message string as returned from the server
      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 request.
      AccessException - if the Perforce server denies access to the caller.
      P4JavaException
    • getUserGroups

      public List<IUserGroup> getUserGroups(String userOrGroupName, GetUserGroupsOptions opts) throws P4JavaException
      Description copied from interface: IGroupsDelegator
      Get a list of Perforce user groups from the server.

      Note that the Perforce server considers it an error to have both indirect and displayValues parameters set true; this will cause the server to throw a RequestException with an appropriate usage message.

      Specified by:
      getUserGroups in interface IGroupsDelegator
      Parameters:
      userOrGroupName - if non-null, restrict the list to the specified group or username.
      opts - GetUserGroupsOptions object describing optional parameters; if null, no options are set
      Returns:
      a non-null but possibly-empty list of qualifying groups.
      Throws:
      P4JavaException - if any error occurs in the processing of this method.
    • getUserGroups

      public List<IUserGroup> getUserGroups(String userOrGroupName, boolean indirect, boolean displayValues, int maxGroups) throws ConnectionException, RequestException, AccessException
      Description copied from interface: IServer
      Get a list of Perforce user groups from the server.

      Note that the Perforce server considers it an error to have both indirect and displayValues parameters set true; this will cause the server to throw a RequestException with an appropriate usage message.

      Specified by:
      getUserGroups in interface IServer
      Parameters:
      userOrGroupName - if non-null, restrict the list to the specified group or username.
      indirect - if true, also displays groups that the specified user or group belongs to indirectly via subgroups.
      displayValues - if true, display the MaxResults, MaxScanRows, MaxLockTime, and Timeout values for the named group.
      maxGroups - if > 0, display only the first m results.
      Returns:
      a non-zero but possibly-empty list of qualifying groups.
      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 request.
      AccessException - if the Perforce server denies access to the caller.
    • getSubmittedIntegrations

      public List<IFileSpec> getSubmittedIntegrations(List<IFileSpec> fileSpecs, String branchSpec, boolean reverseMappings) throws ConnectionException, RequestException, AccessException
      Description copied from interface: IIntegratedDelegator
      Get a list of submitted integrations for the passed-in filespecs.
      Specified by:
      getSubmittedIntegrations in interface IIntegratedDelegator
      Parameters:
      fileSpecs - if null or ommitted, all qualifying depot files are used.
      branchSpec - if non-null, only files integrated from the source to target files in the branch view are shown. Qualified files are displayed even if they were integrated without using the branch view itself.
      reverseMappings - if true,reverses the mappings in the branch view, with the target files and source files exchanging place. This requires the branchSpec to be non-null.
      Returns:
      a non-null but possibly empty list of IFileSpec representing qualifying integrations.
      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 request
      AccessException - if the Perforce server denies access to the caller
    • getSubmittedIntegrations

      public List<IFileSpec> getSubmittedIntegrations(List<IFileSpec> fileSpecs, GetSubmittedIntegrationsOptions opts) throws P4JavaException
      Description copied from interface: IIntegratedDelegator
      Get a list of submitted integrations for the passed-in filespecs.
      Specified by:
      getSubmittedIntegrations in interface IIntegratedDelegator
      Parameters:
      fileSpecs - if null or omitted, all qualifying depot files are used.
      opts - GetSubmittedIntegrations object describing optional parameters; if null, no options are set.
      Returns:
      a non-null but possibly empty list of IFileSpec representing qualifying integrations.
      Throws:
      P4JavaException - if an error occurs processing this method and its parameters.
    • getStreamIntegrationStatus

      public IStreamIntegrationStatus getStreamIntegrationStatus(String stream, StreamIntegrationStatusOptions opts) throws P4JavaException
      Description copied from interface: IStatDelegator
      Get a stream's cached integration status with respect to its parent. If the cache is stale, either because newer changes have been submitted or the stream's branch view has changed, 'p4 istat' checks for pending integrations and updates the cache before showing status.

      Pending integrations are shown only if they are expected by the stream; that is, only if they are warranted by the stream's type and its fromParent/toParent flow options. (See 'p4 help stream'.)

      Specified by:
      getStreamIntegrationStatus in interface IStatDelegator
      Parameters:
      stream - the stream's path in a stream depot, of the form //depotname/streamname.
      opts - StreamIntegrationStatusOptions object describing optional parameters; if null, no options are set.
      Returns:
      potentially-null IStreamIntegrationStatus object representing the stream's cached integration status with respect to its parent.
      Throws:
      P4JavaException - if an error occurs processing this method and its parameters.
    • createJob

      public IJob createJob(@Nonnull Map<String,Object> fieldMap) throws ConnectionException, RequestException, AccessException
      Description copied from interface: IJobDelegator
      Create a new Perforce job in the Perforce server corresponding to the passed-in Perforce job fields (which in turn should correspond to at least the mandatory fields defined in the reigning Perforce job spec).

      Perforce job semantics, field count and layout, etc., are to some extent free-form and specified for each server by the associated job spec (retrievable using the getJobSpec() method below), so map fields are passed to the Perforce server exactly as passed to the create method in the job's field map, so you need to know the field names and semantics given by the associated job spec. This includes setting the relevant job ID field to "new", but otherwise, no checking is done on fields in this method against the job spec (this may be added later).

      Specified by:
      createJob in interface IJobDelegator
      Parameters:
      fieldMap - non-null field map defining the new job in the Perforce server.
      Returns:
      returns an IJob representing the newly-created job, if successful.
      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 request
      AccessException - if the Perforce server denies access to the caller
    • deleteJob

      Description copied from interface: IJobDelegator
      Delete a job from the Perforce server. Note that this method does not change the status of the associated job locally, just on the Perforce server.
      Specified by:
      deleteJob in interface IJobDelegator
      Parameters:
      jobId - ID of the job to be deleted.
      Returns:
      possibly-null status message as returned from the server; this may include form trigger output pre-pended and / or appended to the "normal" message.
      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 request
      AccessException - if the Perforce server denies access to the caller
    • getJob

      Description copied from interface: IJobDelegator
      Get a specific job. Note that some implementations of the underlying server do not return null if you ask for a job that doesn't exist; you must do your own checking to see of what's returned represents a real job or not.
      Specified by:
      getJob in interface IJobDelegator
      Parameters:
      jobId - non-null job Id.
      Returns:
      IJob for the named job; null if no such job.
      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 request
      AccessException - if the Perforce server denies access to the caller
    • updateJob

      public String updateJob(@Nonnull IJob job) throws ConnectionException, RequestException, AccessException
      Description copied from interface: IJobDelegator
      Update a Perforce job on the Perforce server. Note that only the associated raw fields map is used for field values; the main description and ID fields are actually ignored.

      The returned string will contain whatever the Perforce server returned in response to this command; in general, if the update fails, an exception will be thrown, meaning that the returned string represents success only. There are two success states -- either the job was saved or it didn't need saving (it was the same after updating). Consumers should parse this accordingly.

      Specified by:
      updateJob in interface IJobDelegator
      Parameters:
      job - non-null candidate for updating.
      Returns:
      possibly-null status message as returned from the server; this may include form trigger output pre-pended and / or appended to the "normal" message.
      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 request
      AccessException - if the Perforce server denies access to the caller
    • getJobs

      public List<IJob> getJobs(List<IFileSpec> fileSpecs, int maxJobs, boolean longDescriptions, boolean reverseOrder, boolean includeIntegrated, String jobView) throws ConnectionException, RequestException, AccessException
      Description copied from interface: IJobsDelegator
      Return a list of Perforce jobs. Note that (as discussed in the IJob comments) Perforce jobs can have a wide variety of fields, formats, semantics, etc., and this method can return a list that may have to be unpacked at the map level by the consumer to make any sense of it.

      Note that this method (unlike the main file list methods) throws an exception and stops at the first encountered error.

      Specified by:
      getJobs in interface IJobsDelegator
      Parameters:
      fileSpecs - if given, return only jobspecs affecting the given file(s)
      maxJobs - if positive, return only up to maxJobs results
      longDescriptions - if true, return full descriptions, otherwise show only a subset (typically the first 128 characters, but this is not guaranteed).
      reverseOrder - if true, reverse the normal sort order
      includeIntegrated - if true, include any fixes made by changelists integrated into the specified files
      jobView - if non-null, a string in format detailed by "p4 help jobview" used to restrict jobs to those satisfying the job view expression.
      Returns:
      a non-null (but possibly-empty) list of qualifying Perforce jobs
      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 request
      AccessException - if the Perforce server denies access to the caller
    • getJobs

      public List<IJob> getJobs(List<IFileSpec> fileSpecs, GetJobsOptions opts) throws P4JavaException
      Description copied from interface: IJobsDelegator
      Return a list of Perforce jobs. Note that (as discussed in the IJob comments) Perforce jobs can have a wide variety of fields, formats, semantics, etc., and this method can return a list that may have to be unpacked at the map level by the consumer to make any sense of it.

      Note that this method (unlike the main file list methods) throws an exception and stops at the first encountered error.

      Specified by:
      getJobs in interface IJobsDelegator
      Parameters:
      fileSpecs - if given, return only jobspecs affecting the given file(s).
      opts - GetJobsOptions object describing optional parameters; if null, no options are set.
      Returns:
      a non-null (but possibly-empty) list of qualifying Perforce jobs.
      Throws:
      P4JavaException - if an error occurs processing this method and its parameters.
    • getJobSpec

      Description copied from interface: IJobSpecDelegator
      Return the Perforce jobspec associated with this Perforce server.

      Specified by:
      getJobSpec in interface IJobSpecDelegator
      Returns:
      possibly-null IJobSpec representing the underlying Perforce server's jobspec.
      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 request
      AccessException - if the Perforce server denies access to the caller
    • deleteKey

      public String deleteKey(String keyName) throws P4JavaException
      Description copied from interface: IKeyDelegator
      Delete a key on a Perforce server.
      Specified by:
      deleteKey in interface IKeyDelegator
      Parameters:
      keyName - non-null key name.
      Returns:
      non-null result message string (empty) from the delete operation.
      Throws:
      P4JavaException - if an error occurs processing this method and its parameters.
    • setKey

      public String setKey(String keyName, String value, KeyOptions opts) throws P4JavaException
      Description copied from interface: IKeyDelegator
      Create, set or delete a key on a Perforce server. This method can be used to create, set, increment, or delete a key according to the specific options set in the associated options object.
      Specified by:
      setKey in interface IKeyDelegator
      Parameters:
      keyName - non-null key name.
      value - value the key should be set to; can be null if the set operation is an increment.
      opts - KeyOptions object describing optional parameters; if null, no options are set.
      Returns:
      possibly-null current (post-set, post-increment) value; may be empty if the operation was a delete.
      Throws:
      P4JavaException - if an error occurs processing this method and its parameters.
    • getKey

      public String getKey(String keyName) throws P4JavaException
      Description copied from interface: IKeyDelegator
      Get the value of a named Perforce key from the Perforce server. Note that this method will return a zero string (i.e. "0") if the named key doesn't exist (rather than throw an exception); use getKeys to see if a key actually exists before you use it.
      Specified by:
      getKey in interface IKeyDelegator
      Parameters:
      keyName - non-null key name.
      Returns:
      non-null (but possibly zero, if non-existing) key value associated with keyName.
      Throws:
      P4JavaException - if an error occurs processing this method and its parameters.
    • setMultipleKeyValuePair

      public String setMultipleKeyValuePair(String[] pairs) throws P4JavaException
      Description copied from interface: IKeyDelegator
      It takes the pair list defining multiple set and delete operations to be performed. Each operation is defined by a value pair in the pair list. To set a key, use a name and value, to delete a key, use a - (hyphen) followed by the name.
      Specified by:
      setMultipleKeyValuePair in interface IKeyDelegator
      Parameters:
      pairs - List of multiple key name and value pairs
      Returns:
      non-null (but possibly zero, if non-existing) key value associated with keyName.
      Throws:
      P4JavaException - if an error occurs processing this method and its parameters.
    • getKeys

      public Map<String,String> getKeys(GetKeysOptions opts) throws P4JavaException
      Description copied from interface: IKeysDelegator
      Get a map of the Perforce server's keys.
      Specified by:
      getKeys in interface IKeysDelegator
      Parameters:
      opts - GetKeysOptions object describing optional parameters; if null, no options are set.
      Returns:
      a non-null (but possibly empty) map of keys.
      Throws:
      P4JavaException - if an error occurs processing this method and its parameters.
    • createLabel

      public String createLabel(@Nonnull ILabel label) throws ConnectionException, RequestException, AccessException
      Description copied from interface: ILabelDelegator
      Create a new Perforce label in the Perforce server.
      Specified by:
      createLabel in interface ILabelDelegator
      Parameters:
      label - non-null ILabel to be saved
      Returns:
      non-null result message string from the Perforce server; this may include form trigger output pre-pended and / or appended to the "normal" message.
      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 request
      AccessException - if the Perforce server denies access to the caller
    • deleteLabel

      public String deleteLabel(String labelName, boolean force) throws ConnectionException, RequestException, AccessException
      Description copied from interface: ILabelDelegator
      Delete a named Perforce label from the Perforce server.
      Specified by:
      deleteLabel in interface ILabelDelegator
      Parameters:
      labelName - non-null label name
      force - if true, forces the deletion of any label; normally labels can only be deleted by their owner
      Returns:
      non-null result message string from the Perforce server; this may include form trigger output pre-pended and / or appended to the "normal" message
      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 request
      AccessException - if the Perforce server denies access to the caller
    • deleteLabel

      public String deleteLabel(String labelName, DeleteLabelOptions opts) throws P4JavaException
      Description copied from interface: ILabelDelegator
      Delete a named Perforce label from the Perforce server.
      Specified by:
      deleteLabel in interface ILabelDelegator
      Parameters:
      labelName - non-null label name
      opts - DeleteLabelOptions object describing optional parameters; if null, no options are set.
      Returns:
      non-null result message string from the Perforce server; this may include form trigger output pre-pended and / or appended to the "normal" message
      Throws:
      P4JavaException - if any error occurs in the processing of this method.
    • getLabel

      public ILabel getLabel(String labelName) throws ConnectionException, RequestException, AccessException
      Description copied from interface: ILabelDelegator
      Get a specific named Perforce label.

      Unlike the getLabelList method, the getViewMapping method on the returned label will be valid. Note though that changes to the returned label or its view will not be reflected on to the server unless the updateLabel method is called with the label as an argument.

      Specified by:
      getLabel in interface ILabelDelegator
      Parameters:
      labelName - non-null label name
      Returns:
      ILabel representing the associated Perforce label, or null if no such label exists on the server.
      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 request
      AccessException - if the Perforce server denies access to the caller
    • updateLabel

      public String updateLabel(@Nonnull ILabel label) throws ConnectionException, RequestException, AccessException
      Description copied from interface: ILabelDelegator
      Update an existing Perforce label in the Perforce server.
      Specified by:
      updateLabel in interface ILabelDelegator
      Parameters:
      label - non-null ILabel to be updated
      Returns:
      non-null result message string from the Perforce server; this may include form trigger output pre-pended and / or appended to the "normal" message.
      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 request
      AccessException - if the Perforce server denies access to the caller
    • getLabels

      public List<ILabelSummary> getLabels(String user, int maxLabels, String nameFilter, List<IFileSpec> fileList) throws ConnectionException, RequestException, AccessException
      Description copied from interface: ILabelsDelegator
      Get a list of Perforce labels, optionally tied to a specific set of files.

      Note that the ILabel objects returned here do not have views associated with them (i.e. the getViewMapping() method will return an empty list. If you need to get the view mapping for a specific label, use the getLabel() method.

      Specified by:
      getLabels in interface ILabelsDelegator
      Parameters:
      user - if non-null, limit labels to those owned by the named user
      maxLabels - if larger than zero, return only the first maxLabels (or fewer) qualifying labels
      nameFilter - if not null, limits output to labels whose name matches the nameFilter pattern, e.g. -e 'svr-dev-rel*'
      fileList - if not null, limits its report to labels that contain those files
      Returns:
      non-null (but possibly-empty) list of qualifying Perforce labels
      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 request
      AccessException - if the Perforce server denies access to the caller
    • getLabels

      public List<ILabelSummary> getLabels(List<IFileSpec> fileList, GetLabelsOptions opts) throws P4JavaException
      Description copied from interface: ILabelsDelegator
      Get a list of Perforce labels, optionally tied to a specific set of files.

      Note that the ILabel objects returned here do not have views associated with them (i.e. the getViewMapping() method will return an empty list. If you need to get the view mapping for a specific label, use the getLabel() method.

      Specified by:
      getLabels in interface ILabelsDelegator
      Parameters:
      fileList - if not null, limits its report to labels that contain those files
      opts - GetLabelsOptions object describing optional parameters; if null, no options are set.
      Returns:
      non-null (but possibly-empty) list of qualifying Perforce labels
      Throws:
      P4JavaException - if any error occurs in the processing of this method.
    • journalWait

      public void journalWait(JournalWaitOptions opts) throws P4JavaException
      Description copied from interface: IJournalWaitDelegator
      Turns on/off journal-wait. The client application can specify "noWait" replication when using a forwarding replica or an edge server.

      Note that this method uses a deep undoc 'p4 journalwait [-i]' command.

      Specified by:
      journalWait in interface IJournalWaitDelegator
      Parameters:
      opts - JournalWaitOptions object describing optional parameters; if null, no options are set.
      Throws:
      P4JavaException - if an error occurs processing this method and its parameters.
    • getLoginStatus

      public String getLoginStatus() throws P4JavaException
      Description copied from interface: ILoginDelegator
      Return a string indicating the current login status; corresponds to the p4 login -s command. The resulting string should be interpreted by the caller, but is typically something like "User p4jtestsuper ticket expires in 9 hours 42 minutes." or "'login' not necessary, no password set for this user." or "Perforce password (P4PASSWD) invalid or unset." or "Access for user 'p4jtestinvaliduser' has not been enabled by 'p4 protect'", etc.
      Specified by:
      getLoginStatus in interface ILoginDelegator
      Returns:
      non-null, but possibly-empty ticket / login status string. Interpretation of this string is up to the caller.
      Throws:
      P4JavaException - if any errors occur during the processing of this command.
    • login

      Description copied from interface: ILoginDelegator
      Convenience method for login(password, false).
      Specified by:
      login in interface ILoginDelegator
      Parameters:
      password - Perforce password; can be null if no password is needed (as in the case of SSO logins)
      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 request
      AccessException - if the Perforce server denies access to the caller
      ConfigException - if the p4tickets file could not be updated successfully
    • login

      public void login(String password, boolean allHosts) throws ConnectionException, RequestException, AccessException, ConfigException
      Description copied from interface: ILoginDelegator
      Log the current user (if any) in to a Perforce server, optionally arranging to be logged in for all hosts.

      Attempts to log in to the underlying Perforce server. If successful, successive calls to server-side services will succeed until the session is terminated by the server or the user logs out.

      Behaviour is undefined if the server's user name attribute is null (but will probably cause a NullPointerError with most implementations).

      Login will work with the Perforce SSO (single sign-on) scheme: in this case your password should be null, and the environment variable P4LOGINSSO should point to an executable SSO script as described in p4 help undoc (help for this is beyond the scope of this method doc, unfortunately, and the feature is not well tested here, but it "works" in general...).

      Specified by:
      login in interface ILoginDelegator
      Parameters:
      password - Perforce password; can be null if no password is needed (as in the case of SSO logins)
      allHosts - if true, perform the equivalent of a "login -a"
      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 request
      AccessException - if the Perforce server denies access to the caller
      ConfigException - if the p4tickets file could not be updated successfully
    • login

      public void login(String password, LoginOptions opts) throws P4JavaException
      Description copied from interface: ILoginDelegator
      Log the current user (if any) in to a Perforce server, optionally arranging to be logged in for all hosts.

      Attempts to log in to the underlying Perforce server. If successful, successive calls to server-side services will succeed until the session is terminated by the server or the user logs out.

      Behavior is undefined if the server's user name attribute is null (but will probably cause a NullPointerError with most implementations).

      Login will work with the Perforce SSO (single sign-on) scheme: in this case your password should be null, and the environment variable P4LOGINSSO should point to an executable SSO script as described in p4 help undoc (help for this is beyond the scope of this method doc, unfortunately, and the feature is not well tested here, but it "works" in general...).

      Specified by:
      login in interface ILoginDelegator
      Parameters:
      password - Perforce password; can be null if no password is needed (as in the case of SSO logins)
      opts - if LoginOptions.allHosts is true, perform the equivalent of a "login -a". A null LoginOptions parameter is equivalent to no options being set.
      Throws:
      P4JavaException - if any error occurs in the processing of this method. A specific ConfigException is thrown if the p4tickets file could not be updated successfully.
    • login

      public void login(String password, StringBuffer ticket, LoginOptions opts) throws P4JavaException
      Description copied from interface: ILoginDelegator
      Log the current user (if any) in to a Perforce server using. If the ticket StringBuffer parameter is non-null, the auth ticket returned from the server will be appended to the passed-in ticket StringBuffer.

      Optionally, if the opts.isDontWriteTicket() is true ('login -p'), the ticket is not written to file; if opts.isAllHosts is true ('login -a'), the ticket is valid on all hosts; if opts.getHost() is non-null ('login -h'), the ticket is valid on the specified host.

      Note: if the passed-in ticket StringBuffer originally has content it will remain there. The auth ticket will only be appended to the buffer. If a null ticket StringBuffer is passed in, the auth ticket will not be appended to it. The normal use case should be to pass in a new ticket StringBuffer.

      Specified by:
      login in interface ILoginDelegator
      Parameters:
      password - Perforce actuallPassword; can be null if no actuallPassword is needed (as in the case of SSO logins)
      ticket - if the ticket StringBuffer parameter is non-null, the auth ticket that was returned by the login attempt is appended to the passed-in ticket StringBuffer.
      opts - LoginOptions describing the associated options; if null, no options are set.
      Throws:
      P4JavaException - if any error occurs in the processing of this method.
    • login

      public void login(@Nonnull IUser user, StringBuffer ticket, LoginOptions opts) throws P4JavaException
      Description copied from interface: ILoginDelegator
      Log another user in to Perforce by obtaining a session ticket for that user. If the ticket StringBuffer parameter is non-null, the auth ticket returned from the server will be appended to the passed-in ticket StringBuffer.

      Optionally, if the opts.isDontWriteTicket() is true ('login -p'), the ticket is not written to file; if opts.isAllHosts is true ('login -a'), the ticket is valid on all hosts; if opts.getHost() is non-null ('login -h'), the ticket is valid on the specified host.

      Specifying a user as an argument requires 'super' access, which is granted by 'p4 protect'. In this case, login another user does not require a password, assuming that you (a 'super' user) had already been logged in.

      Note: if the passed-in ticket StringBuffer originally has content it will remain there. The auth ticket will only be appended to the buffer. If a null ticket StringBuffer is passed in, the auth ticket will not be appended to it. The normal use case should be to pass in a new ticket StringBuffer.

      Specified by:
      login in interface ILoginDelegator
      Parameters:
      user - non-null Perforce user; login request is for this specified user.
      ticket - if the ticket StringBuffer parameter is non-null, the auth ticket that was returned by the login attempt is appended to the passed-in ticket StringBuffer.
      opts - LoginOptions describing the associated options; if null, no options are set.
      Throws:
      P4JavaException - if any error occurs in the processing of this method.
    • isDontWriteTicket

      public boolean isDontWriteTicket(String cmd, String[] cmdArgs)
      Description copied from interface: ILoginDelegator
      Special case handling of the "-p" flag for the "p4 login" command. The -p flag displays the ticket, but does not store it on the client machine.
      Specified by:
      isDontWriteTicket in interface ILoginDelegator
      Parameters:
      cmd - the cmd
      cmdArgs - the cmd args
      Returns:
      true, if is dont write ticket
    • login2

      public List<Map<String,Object>> login2(Login2Options opts, String user) throws P4JavaException
      Description copied from interface: ILogin2Delegator
      Generic access method for Login2, to bypass the non-interactive clients methods.
      Specified by:
      login2 in interface ILogin2Delegator
      Parameters:
      opts - Login2Options
      user - non-null Perforce user; login request is for this specified user, requires 'super' permission.
      Returns:
      A list of result map objects
      Throws:
      P4JavaException - if any errors occur during the processing of this command.
    • getLogin2Status

      public String getLogin2Status() throws P4JavaException
      Description copied from interface: ILogin2Delegator
      Return a string indicating the current 2fa login status; corresponds to the 'p4 login2 -s' command. The resulting string should be interpreted by the caller, but is typically something like: User bob1 on host 127.0.0.1: validated
      Specified by:
      getLogin2Status in interface ILogin2Delegator
      Returns:
      non-null, but possibly-empty. Interpretation of this string is up to the caller.
      Throws:
      P4JavaException - if any errors occur during the processing of this command.
    • getLogin2Status

      public String getLogin2Status(IUser user) throws P4JavaException
      Description copied from interface: ILogin2Delegator
      Return a string indicating the current 2fa login status; corresponds to the 'p4 login2 -s' command. The resulting string should be interpreted by the caller, but is typically something like: User bob1 on host 127.0.0.1: validated
      Specified by:
      getLogin2Status in interface ILogin2Delegator
      Parameters:
      user - Specifying a username requires 'super' access, which is granted by 'p4 protect'.
      Returns:
      non-null, but possibly-empty. Interpretation of this string is up to the caller.
      Throws:
      P4JavaException - if any errors occur during the processing of this command.
    • login2ListMethods

      public Map<String,String> login2ListMethods() throws P4JavaException
      Description copied from interface: ILogin2Delegator
      For non-interactive clients. The first stage 'list-methods'; will report the list of available second factor authentication methods for the given user.
      Specified by:
      login2ListMethods in interface ILogin2Delegator
      Returns:
      A key value pair of second factor method IDs and their descriptions
      Throws:
      P4JavaException - if any errors occur during the processing of this command.
    • login2InitAuth

      public String login2InitAuth(String method) throws P4JavaException
      Description copied from interface: ILogin2Delegator
      For non-interactive clients. The second stage 'init-auth' must specify a method (-m flag) to initiate the authentication with the second factor authentication provider.
      Specified by:
      login2InitAuth in interface ILogin2Delegator
      Parameters:
      method - Second factor authentication method, chosen from the list provided by 'list-methods'.
      Returns:
      Prompt from the second factor authentication method (e.g. a key, password, answer, etc...)
      Throws:
      P4JavaException - if any errors occur during the processing of this command.
    • login2CheckAuth

      public String login2CheckAuth(String auth, boolean persist) throws P4JavaException
      Description copied from interface: ILogin2Delegator
      For non-interactive clients. The final step is 'check-auth', which will either prompt for a OTP or request the authorization status from the second factor authentication provider, depending on the type of authentication method selected. The -p flag may be provided at the 'init-auth' stage. If a host and/or user is being specified, the appropriate arguments must be provided at each stage.
      Specified by:
      login2CheckAuth in interface ILogin2Delegator
      Parameters:
      auth - The answer to the second factor authorization prompt.
      persist - Persist the second factor authorization even after the user's ticket has expired.
      Returns:
      Verification message from second factor authorization.
      Throws:
      P4JavaException - if any errors occur during the processing of this command.
    • login2

      public String login2(IUser user, Login2Options opts) throws P4JavaException
      Description copied from interface: ILogin2Delegator
      Validate user second factor authentication. Specifying a username as an argument to 'p4 login2' requires 'super' access, which is granted by 'p4 protect'. In this case, 'p4 login2' skips the second factor authentication process and immediately marks the user as validated for the current host.
      Specified by:
      login2 in interface ILogin2Delegator
      Parameters:
      user - Specifying a username requires 'super' access, which is granted by 'p4 protect'.
      opts - Login2Options
      Returns:
      Verification message from second factor authorization.
      Throws:
      P4JavaException - if any errors occur during the processing of this command.
    • logout

      Description copied from interface: ILogoutDelegator
      Log the current Perforce user out of a Perforce server session.

      Specified by:
      logout in interface ILogoutDelegator
      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 request
      AccessException - if the Perforce server denies access to the caller
      ConfigException - if the p4tickets file could not be updated successfully
    • logout

      public void logout(LoginOptions opts) throws P4JavaException
      Description copied from interface: ILogoutDelegator
      Log the current Perforce user out of a Perforce server session.
      Specified by:
      logout in interface ILogoutDelegator
      Parameters:
      opts - currently ignored; can be null.
      Throws:
      P4JavaException - if any error occurs in the processing of this method.
    • getServerProcesses

      Description copied from interface: IMonitorDelegator
      Return a list of Perforce server processes active on the Perforce server. Will throw a request exception if monitors are not enabled on the target server.
      Specified by:
      getServerProcesses in interface IMonitorDelegator
      Returns:
      non-null but possibly-empty list of IServerProcess objects
      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 request
      AccessException - if the Perforce server denies access to the caller
    • getServerProcesses

      public List<IServerProcess> getServerProcesses(GetServerProcessesOptions opts) throws P4JavaException
      Description copied from interface: IMonitorDelegator
      Return a list of Perforce server processes active on the Perforce server. Will throw a request exception if monitors are not enabled on the target server.
      Specified by:
      getServerProcesses in interface IMonitorDelegator
      Parameters:
      opts - GetServerProcessesOptions object describing optional parameters; if null, no options are set.
      Returns:
      list of server processes
      Throws:
      P4JavaException - if an error occurs processing this method and its parameters.
    • getLogTail

      public ILogTail getLogTail(LogTailOptions opts) throws P4JavaException
      Description copied from interface: ILogTailDelegator
      Gets the log tail.
      Specified by:
      getLogTail in interface ILogTailDelegator
      Parameters:
      opts - the opts
      Returns:
      the log tail
      Throws:
      P4JavaException - the p4 java exception
    • getOpenedFiles

      public List<IFileSpec> getOpenedFiles(List<IFileSpec> fileSpecs, boolean allClients, String clientName, int maxFiles, int changeListId) throws ConnectionException, AccessException
      Description copied from interface: IOpenedDelegator
      If one or more Perforce file specs is passed-in, return the opened / locked status of each file (if known) within an IFileSpec object; otherwise return a list of all files known to be open for this Perforce client workspace.

      The returned list can be modified with the other arguments as described below.

      Specified by:
      getOpenedFiles in interface IOpenedDelegator
      Parameters:
      fileSpecs - if non-empty, determine the status of the specified files; otherwise return all qualifying files known to be open
      allClients - if true, return results for all known clients rather than the current client (if any).
      clientName - if non-null, return results for the named client only.
      maxFiles - if positive, return only the first maxFiles qualifying files.
      changeListId - if positive, return only files associated with the given changelist ID; if IChangelist.DEFAULT, retrieve files open associated with the default changelist.
      Returns:
      non-null but possibly-empty list of qualifying open files. Not all fields in individual file specs will be valid or make sense to be accessed.
      Throws:
      ConnectionException - if the Perforce server is unreachable or is not connected.
      AccessException - if the Perforce server denies access to the caller
    • getOpenedFiles

      public List<IFileSpec> getOpenedFiles(List<IFileSpec> fileSpecs, OpenedFilesOptions opts) throws P4JavaException
      Description copied from interface: IOpenedDelegator
      If one or more Perforce file specs is passed-in, return the opened / locked status of each file (if known) within an IFileSpec object; otherwise return a list of all files known to be open for this Perforce client workspace.

      Specified by:
      getOpenedFiles in interface IOpenedDelegator
      Parameters:
      fileSpecs - if non-empty, determine the status of the specified files; otherwise return all qualifying files known to be open
      opts - possibly-null OpenedFilesOptions object object specifying method options.
      Returns:
      non-null but possibly-empty list of qualifying open files. Not all fields in individual file specs will be valid or make sense to be accessed.
      Throws:
      P4JavaException - if an error occurs processing this method and its parameters.
    • moveFile

      public List<IFileSpec> moveFile(int changelistId, boolean listOnly, boolean noClientMove, String fileType, @Nonnull IFileSpec fromFile, @Nonnull IFileSpec toFile) throws ConnectionException, RequestException, AccessException
      Description copied from interface: IMoveDelegator
      Move a file already opened for edit or add (the fromFile) to the destination file (the toFile). A file can be moved many times before it is submitted; moving it back to its original location will reopen it for edit. The full semantics of this operation (which can be confusing) are found in the main 'p4 help' documentation.

      Note that this operation is not supported on servers earlier than 2009.1; any attempt to use this on earlier servers will result in a RequestException with a suitable message. Similarly, not all underlying IServer implementations will work with this either, and will also result in a suitable RequestException.

      Note also that the move command is special in that almost alone among Perforce file-based commands, it does not allow full filespecs with version specifiers; these are currently quietly stripped off in the move command implementation here, which may lead to unexpected behaviour if you pass in specific versions expecting them to be honoured.

      Specified by:
      moveFile in interface IMoveDelegator
      Parameters:
      changelistId - if not IChangelist.UNKNOWN, the files are opened in the numbered pending changelist instead of the 'default' changelist.
      listOnly - if true, don't actually perform the move, just return what would happen if the move was performed
      noClientMove - if true, bypasses the client file rename. This option can be used to tell the server that the user has already renamed a file on the client. The use of this option can confuse the server if you are wrong about the client's contents. Only works for 2009.2 and later servers; earlier servers will produce a RequestException if you set this true.
      fileType - if not null, the file is reopened as that filetype.
      fromFile - the original file; must be already open for edit.
      toFile - the target file.
      Returns:
      list of IFileSpec objects representing the results of this move
      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 request
      AccessException - if the Perforce server denies access to the caller
    • moveFile

      public List<IFileSpec> moveFile(@Nonnull IFileSpec fromFile, @Nonnull IFileSpec toFile, @Nullable MoveFileOptions opts) throws P4JavaException
      Description copied from interface: IMoveDelegator
      Move a file already opened for edit or add (the fromFile) to the destination file (the toFile). A file can be moved many times before it is submitted; moving it back to its original location will reopen it for edit. The full semantics of this operation (which can be confusing) are found in the main 'p4 help' documentation.

      Note that this operation is not supported on servers earlier than 2009.1; any attempt to use this on earlier servers will result in a RequestException with a suitable message.

      Note also that the move command is special in that almost alone among Perforce file-based commands, it does not allow full filespecs with version specifiers; these are currently quietly stripped off in the move command implementation here, which may lead to unexpected behaviour if you pass in specific versions expecting them to be honoured.

      Specified by:
      moveFile in interface IMoveDelegator
      Parameters:
      fromFile - the original file; must be already open for edit.
      toFile - the target file.
      opts - MoveFileOptions object describing optional parameters; if null, no options are set.
      Returns:
      list of IFileSpec objects representing the results of this move.
      Throws:
      P4JavaException - if any error occurs in the processing of this method.
    • moveFile

      public List<IFileSpec> moveFile(@Nullable MoveFileOptions opts) throws P4JavaException
      Description copied from interface: IMoveDelegator
      Move by default takes an already opened file and moves it from one client location to another, reopening it as a pending depot move. When the file is submitted with 'p4 submit', its depot file is moved accordingly. The 'p4 move' command is intended for moves that occur within the same branch and not for restructuring the depot by moving an entire branch.

      Note that this operation is not supported on servers earlier than 2025.1; any attempt to use this on earlier servers will result in a RequestException with a suitable message.

      Specified by:
      moveFile in interface IMoveDelegator
      Parameters:
      opts - MoveFileOptions object describing optional parameters; if null, no options are set.
      Returns:
      list of IFileSpec objects representing the results of this move.
      Throws:
      P4JavaException - if any error occurs in the processing of this method.
    • obliterateFiles

      public List<IObliterateResult> obliterateFiles(@Nonnull List<IFileSpec> fileSpecs, ObliterateFilesOptions opts) throws P4JavaException
      Description copied from interface: IObliterateDelegator
      Obliterate permanently remove files and their history from the server.

      Obliterate retrieves the disk space used by the obliterated files in the archive and clears the files from the metadata that is maintained by the server. Files in client workspaces are not physically affected, but they are no longer under Perforce control.

      By default, obliterate displays a preview of the results. To execute the operation, you must specify the -y flag (opts.executeObliterate). Obliterate requires 'admin' access, which is granted by 'p4 protect'.

      The "obliterate" command returns an IObliterateResult for each file passed into the command. Each IObliterateResult object contains a summary of various types of records deleted (or added) and a non-null list of returned filespecs have the equivalent of purgeFile and purgeRev output in the depotPath and endRevision fileds of the associated filespecs, and that no other file spec fields are valid. Sometimes, the server doesn't return any "purgeFile" and "purgeRev" values.

      Note: error and info messages are stored in filespec objects.

      Specified by:
      obliterateFiles in interface IObliterateDelegator
      Parameters:
      fileSpecs - non-null list of files to be obliterated
      opts - possibly-null ObliterateFilesOptions object specifying method options.
      Returns:
      a non-null list of IObliterateResult objects containing the records purged.
      Throws:
      P4JavaException - if an error occurs processing this method and its parameters
    • changePassword

      public String changePassword(String oldPassword, String newPassword, String userName) throws P4JavaException
      Description copied from interface: IPasswdDelegator
      Change a user's password on the server. After a password is changed for a user, the user must login again with the new password. Specifying a username as an argument to this command requires 'super' access granted by 'p4 protect'

      Note: setting the 'newPassword' to null or empty will delete the password.

      Specified by:
      changePassword in interface IPasswdDelegator
      Parameters:
      oldPassword - possibly-null or possibly-empty user's old password. If null or empty, it assumes the current password is not set.
      newPassword - non-null and non-empty user's new password.
      userName - possibly-null possibly-null name of the target user whose password will be changed to the new password. If null, the current user will be used. If non-null, this command requires 'super' access granted by 'p4 protect'.
      Returns:
      result
      Throws:
      P4JavaException - if any error occurs in the processing of this method.
    • getFileContents

      public InputStream getFileContents(List<IFileSpec> fileSpecs, GetFileContentsOptions opts) throws P4JavaException
      Description copied from interface: IPrintDelegator
      Return an InputStream onto the contents of one or more revisions of one or more Perforce depot file contents.

      If file is specified as a Perforce client workspace file name, the client view is used to find the corresponding depot file. If a file argument has a revision, then all files as of that revision are streamed. If a file argument has a revision range, then only files selected by that revision range are streamed, and the highest revision in the range is used for each file. Normally, only the head revision is printed.

      The underlying input stream is not guaranteed to support mark() and skip() operations, and in some cases can be absolutely ginormously long it is also not guaranteed to be printable, and will be in the charset encoding stored in the Perforce server.

      You should close the InputStreamReader after use in order to release any underlying stream-related resources. Failure to do this may lead to the proliferation of temp files or long-term memory wastage or even leaks.

      Note that unlike the corresponding command-line command, which keeps going in the face of errors by moving on to the next file (or whatever), any errors encountered in this method will cause an exception from this method at the first error, so plan accordingly....

      Specified by:
      getFileContents in interface IPrintDelegator
      Parameters:
      fileSpecs - non-null list of depot or client file specs defining files to be streamed
      opts - GetFileContentsOptions object describing optional parameters; if null, no options are set.
      Returns:
      a non-null but possibly-empty InputStream onto the file / revision contents.
      Throws:
      P4JavaException - if any error occurs in the processing of this method.
    • getFileContents

      public void getFileContents(ByteBuffer byteBufferContent, List<IFileSpec> fileSpecs, GetFileContentsOptions opts) throws Exception
      Description copied from interface: IPrintDelegator
      Saves the value of a ByteBuffer onto the contents of one or more Perforce depot file contents.

      If file is specified as a Perforce client workspace file name, the client view is used to find the corresponding depot file.

      Note that unlike the corresponding command-line command, which keeps going in the face of errors by moving on to the next file (or whatever), any errors encountered in this method will cause an exception from this method at the first error, so plan accordingly....

      Specified by:
      getFileContents in interface IPrintDelegator
      Parameters:
      byteBufferContent - Fills with content of the fileSpecs into a ByteBuffer
      fileSpecs - non-null list of depot or client file specs defining files to be streamed
      opts - GetFileContentsOptions object describing optional parameters; if null, no options are set.
      Throws:
      P4JavaException - if any error occurs in the processing of this method.
      Exception
    • getFileContents

      public InputStream getFileContents(List<IFileSpec> fileSpecs, boolean allrevs, boolean noHeaderLine) throws ConnectionException, RequestException, AccessException
      Specified by:
      getFileContents in interface IPrintDelegator
      Throws:
      ConnectionException
      RequestException
      AccessException
    • setProperty

      public String setProperty(String name, String value, PropertyOptions opts) throws P4JavaException
      Description copied from interface: IPropertyDelegator
      Updates a property value in the Perforce server, or adds the property value to the Perforce server if it is not yet there.

      This method require that the user have 'admin' access granted by 'p4 protect'.

      Specified by:
      setProperty in interface IPropertyDelegator
      Parameters:
      name - non-null property name.
      value - property value.
      opts - PropertyOptions object describing optional parameters; if null, no options are set.
      Returns:
      non-null result message string from the set (add/update) operation.
      Throws:
      P4JavaException - if an error occurs processing this method and its parameters.
    • getProperty

      public List<IProperty> getProperty(GetPropertyOptions opts) throws P4JavaException
      Description copied from interface: IPropertyDelegator
      Gets a list of one or more property values from the Perforce server.

      The -A flag require that the user have 'admin' access granted by 'p4 protect'.

      Note that specifying the -n flag when using the -l flag substantially improves the performance of this command.

      Specified by:
      getProperty in interface IPropertyDelegator
      Parameters:
      opts - GetPropertyOptions object describing optional parameters; if null, no options are set.
      Returns:
      a non-null (but possibly empty) list of property values.
      Throws:
      P4JavaException - if an error occurs processing this method and its parameters.
    • deleteProperty

      public String deleteProperty(String name, PropertyOptions opts) throws P4JavaException
      Description copied from interface: IPropertyDelegator
      Deletes a property value from the Perforce server.

      This method require that the user have 'admin' access granted by 'p4 protect'.

      Specified by:
      deleteProperty in interface IPropertyDelegator
      Parameters:
      name - non-null property name.
      opts - PropertyOptions object describing optional parameters; if null, no options are set.
      Returns:
      non-null result message string from the delete operation.
      Throws:
      P4JavaException - if an error occurs processing this method and its parameters.
    • createProtectionEntries

      public String createProtectionEntries(@Nonnull List<IProtectionEntry> entryList) throws P4JavaException
      Description copied from interface: IProtectDelegator
      Create or replace the protections table data on the Perforce server with these new protection entries.

      Each entry in the table contains a protection mode, a group/user indicator, the group/user name, client host ID and a depot file path pattern. Users receive the highest privilege that is granted on any entry.

      Warning: this will overwrite the existing protections table data.

      Specified by:
      createProtectionEntries in interface IProtectDelegator
      Parameters:
      entryList - non-null list of protection entries.
      Returns:
      possibly-null status message string as returned from the server
      Throws:
      P4JavaException - if an error occurs processing this method and its parameters.
    • updateProtectionEntries

      public String updateProtectionEntries(@Nonnull List<IProtectionEntry> entryList) throws P4JavaException
      Description copied from interface: IProtectDelegator
      Replace the protections table data on the Perforce server with these new protection entries.

      Each entry in the table contains a protection mode, a group/user indicator, the group/user name, client host ID and a depot file path pattern. Users receive the highest privilege that is granted on any entry.

      Warning: this will overwrite the existing protections table data.

      Specified by:
      updateProtectionEntries in interface IProtectDelegator
      Parameters:
      entryList - non-null list of protection entries.
      Returns:
      possibly-null status message string as returned from the server
      Throws:
      P4JavaException - if an error occurs processing this method and its parameters.
    • getProtectionsTable

      public InputStream getProtectionsTable() throws P4JavaException
      Description copied from interface: IProtectDelegator
      Get an InputStream onto the entries of the Perforce protections table.

      Specified by:
      getProtectionsTable in interface IProtectDelegator
      Returns:
      a non-null but possibly empty InputStream onto the protections table's entries.
      Throws:
      P4JavaException - if any error occurs in the processing of this method.
    • getProtectionEntries

      public List<IProtectionEntry> getProtectionEntries(List<IFileSpec> fileList, GetProtectionEntriesOptions opts) throws P4JavaException
      Description copied from interface: IProtectsDelegator
      Get a list of Perforce protection entries for the passed-in arguments.

      Note that the behavior of this method is unspecified when using clashing options (e.g. having both userName and groupName set non-null). Consult the main Perforce admin documentation for semantics and usage.

      Note that any annotations in the file paths will be ignored. The reason is the Perforce server 'protects' command requires a file list devoid of annotated revision specificity.

      Specified by:
      getProtectionEntries in interface IProtectsDelegator
      Parameters:
      fileList - if non-null, only those protection entries that apply to the specified files are displayed.
      opts - GetProtectionEntriesOptions object describing optional parameters; if null, no options are set.
      Returns:
      non-null but possibly empty list of protection entries.
      Throws:
      P4JavaException - if any error occurs in the processing of this method.
    • getProtectionEntries

      public List<IProtectionEntry> getProtectionEntries(boolean allUsers, String hostName, String userName, String groupName, List<IFileSpec> fileList) throws ConnectionException, RequestException, AccessException
      Description copied from interface: IProtectsDelegator
      Get a list of Perforce protection entries for the passed-in arguments.

      Note that the behavior of this method is unspecified when using clashing options (e.g. having both userName and groupName set non-null). Consult the main Perforce admin documentation for semantics and usage.

      Note that the annotations in the file paths will be dropped. The reason is the Perforce server 'protects' command requires a file list devoid of annotated revision specificity.

      Specified by:
      getProtectionEntries in interface IProtectsDelegator
      Parameters:
      allUsers - if true, protection lines for all users are displayed.
      hostName - only protection entries that apply to the given host (IP address) are displayed.
      userName - protection lines Perforce user "userName" are displayed.
      groupName - protection lines for Perforce group "groupName" are displayed.
      fileList - if non-null, only those protection entries that apply to the specified files are displayed.
      Returns:
      non-null but possibly empty list of protection entries.
      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 request.
      AccessException - if the Perforce server denies access to the caller.
    • reload

      public String reload(ReloadOptions opts) throws P4JavaException
      Description copied from interface: IReloadDelegator
      Reload an unloaded client or label.

      Note that by default, users can only unload their own clients or labels. The -f flag requires 'admin' access, which is granted by 'p4 protect'. The full semantics of this operation are found in the main 'p4 help unload' documentation.

      Specified by:
      reload in interface IReloadDelegator
      Parameters:
      opts - possibly-null ReloadOptions object specifying method options.
      Returns:
      non-null result message string from the reload operation.
      Throws:
      P4JavaException - if an error occurs processing this method and its parameters.
    • renameUser

      public String renameUser(String oldUserName, String newUserName) throws P4JavaException
      Description copied from interface: IRenameUserDelegator
      Completely renames a user, modifying all database records which mention the user.

      This includes all workspaces, labels, branches, streams, etc. which are owned by the user, all pending, shelved, and committed changes created by the user, any files that the user has opened or shelved, any fixes that the user made to jobs, any properties that apply to the user, any groups that the user is in, and the user record itself.

      The username is not changed in descriptive text fields (such as job descriptions, change descriptions, or workspace descriptions), only where it appears as the owner or user field of the database record.

      Protection table entries that apply to the user are updated only if the Name: field exactly matches the user name; if the Name: field contains wildcards, it is not modified.

      The only job field that is processed is attribute code 103. If you have included the username in other job fields they will have to be processed separately.

      The full semantics of this operation are found in the main 'p4 help' documentation.

      This method requires 'super' access granted by 'p4 protect'.

      Specified by:
      renameUser in interface IRenameUserDelegator
      Parameters:
      oldUserName - the old user name to be changed.
      newUserName - the new user name to be changed to.
      Returns:
      non-null result message string from the reload operation.
      Throws:
      P4JavaException - if an error occurs processing this method and its parameters.
    • getReviewChangelists

      public List<IReviewChangelist> getReviewChangelists(GetReviewChangelistsOptions opts) throws P4JavaException
      Description copied from interface: IReviewDelegator
      Get a list of all submitted changelists equal or above a provided changelist number that have not been reviewed before.

      If only the 'changelistId' option is provided, return a list of changelists that have not been reviewed before, equal or above the specified changelist#.

      If only the 'counter' option is provided, return a list of changelists that have not been reviewed before, above the specified counter's changelist#.

      If both the 'changelistId' and 'counter' options are specified, 'p4 review' sets the counter to that changelist# and produces no output. This functionality has been superceded by the 'p4 counter' command. The user must have permission to set counters.

      Specified by:
      getReviewChangelists in interface IReviewDelegator
      Parameters:
      opts - GetReviewChangelistsOptions object describing optional parameters; if null, no options are set.
      Returns:
      non-null but possibly empty list of IReviewChangelist objects; note that these objects will have null update and access fields.
      Throws:
      P4JavaException - if any error occurs in the processing of this method.
    • getReviews

      public List<IUserSummary> getReviews(int changelistId, List<IFileSpec> fileSpecs) throws ConnectionException, RequestException, AccessException
      Description copied from interface: IReviewsDelegator
      Get a list of all users who have subscribed to review the named files, the files in the numbered changelist, or all files by default.

      Note that the returned IUserSummary objects will have null access and update dates associated with them.

      Specified by:
      getReviews in interface IReviewsDelegator
      Parameters:
      changelistId - if not IChangelist.UNKNOWN, use this changelist ID.
      fileSpecs - if not null, use this list as the list of named files rather than all files.
      Returns:
      non-null but possibly empty list of IUserSummary objects; note that these objects will have null update and access fields.
      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 request
      AccessException - if the Perforce server denies access to the caller
    • getReviews

      public List<IUserSummary> getReviews(List<IFileSpec> fileSpecs, GetReviewsOptions opts) throws P4JavaException
      Description copied from interface: IReviewsDelegator
      Get a list of all users who have subscribed to review the named files.

      Note that the returned IUserSummary objects will have null access and update dates associated with them.

      Specified by:
      getReviews in interface IReviewsDelegator
      Parameters:
      fileSpecs - if not null, use this list as the list of named files rather than all files.
      opts - GetReviewsOptions object describing optional parameters; if null, no options are set.
      Returns:
      non-null but possibly empty list of IUserSummary objects; note that these objects will have null update and access fields.
      Throws:
      P4JavaException - if any error occurs in the processing of this method.
    • searchJobs

      public List<String> searchJobs(String words, SearchJobsOptions opts) throws P4JavaException
      Description copied from interface: ISearchDelegator
      Search for jobs that contain the specified words in the search engine's index.

      Note that this is an 'undoc' Perforce command.

      See also 'p4 help index'.

      Specified by:
      searchJobs in interface ISearchDelegator
      Parameters:
      words - non-null words to be searched.
      opts - SearchJobsOptions object describing optional parameters; if null, no options are set.
      Returns:
      non-null (but possibly-empty) list of job IDs.
      Throws:
      P4JavaException - if an error occurs processing this method and its parameters.
    • getFileSizes

      public List<IFileSize> getFileSizes(List<IFileSpec> fileSpecs, GetFileSizesOptions opts) throws P4JavaException
      Description copied from interface: ISizesDelegator
      Gets a list of file sizes for one or more files in the depot.

      For specified file specification, get the depot file name, revision, file count and file size. If you use client syntax for the file specification, the view mapping is used to list the corresponding depot files.

      Specified by:
      getFileSizes in interface ISizesDelegator
      Parameters:
      fileSpecs - filespecs to be processed; if null or empty, an empty list is returned.
      opts - GetFileSizesOptions object describing optional parameters; if null, no options are set.
      Returns:
      a non-null (but possibly empty) list of file sizes.
      Throws:
      P4JavaException - if any error occurs in the processing of this method.
    • createStream

      public String createStream(@Nonnull IStream stream) throws P4JavaException
      Description copied from interface: IStreamDelegator
      Create a new stream in the repository.
      Specified by:
      createStream in interface IStreamDelegator
      Parameters:
      stream - non-null IStream object representing the stream to be created.
      Returns:
      possibly-null operation result message string from the Perforce server.
      Throws:
      P4JavaException - if any error occurs in the processing of this method.
    • getStream

      public IStream getStream(@Nonnull String streamPath) throws P4JavaException
      Description copied from interface: IStreamDelegator
      Get an individual stream by stream path. Note that this method will return a fake stream if you ask it for a non-existent stream, so it's not the most useful of operations.
      Specified by:
      getStream in interface IStreamDelegator
      Parameters:
      streamPath - non-null stream's path in a stream depot, of the form //depotname/streamname
      Returns:
      IStream non-null object corresponding to the named stream if it exists and is retrievable; otherwise an IStream object that looks real but does not, in fact, correspond to any known stream in the repository.
      Throws:
      P4JavaException - if any error occurs in the processing of this method.
    • getStream

      public IStream getStream(String streamPath, GetStreamOptions opts) throws P4JavaException
      Description copied from interface: IStreamDelegator
      Get an individual stream by stream path. Note that this method will return a fake stream if you ask it for a non-existent stream, so it's not the most useful of operations.
      Specified by:
      getStream in interface IStreamDelegator
      Parameters:
      streamPath - non-null stream's path in a stream depot, of the form //depotname/streamname
      opts - GetStreamOptions object describing optional parameters; if null, no options are set.
      Returns:
      IStream non-null object corresponding to the named stream if it exists and is retrievable; otherwise an IStream object that looks real but does not, in fact, correspond to any known stream in the repository.
      Throws:
      P4JavaException - if any error occurs in the processing of this method.
    • updateStream

      public String updateStream(IStream stream, StreamOptions opts) throws P4JavaException
      Description copied from interface: IStreamDelegator
      Update a Perforce stream spec on the Perforce server.
      Specified by:
      updateStream in interface IStreamDelegator
      Parameters:
      stream - non-null stream spec to be updated.
      opts - StreamOptions object describing optional parameters; if null, no options are set.
      Returns:
      non-null result message string from the Perforce server; this may include form trigger output pre-pended and / or appended to the "normal" message.
      Throws:
      P4JavaException - if any error occurs in the processing of this method.
    • deleteStream

      public String deleteStream(String streamPath, StreamOptions opts) throws P4JavaException
      Description copied from interface: IStreamDelegator
      Delete a Perforce stream spec from the Perforce server.
      Specified by:
      deleteStream in interface IStreamDelegator
      Parameters:
      streamPath - non-null stream's path in a stream depot, of the form //depotname/streamname
      opts - StreamOptions object describing optional parameters; if null, no options are set.
      Returns:
      non-null result message string from the Perforce server; this may include form trigger output pre-pended and / or appended to the "normal" message
      Throws:
      P4JavaException - if any error occurs in the processing of this method.
    • convertSparseStream

      public String convertSparseStream(ConvertSparseOptions opts) throws P4JavaException
      Description copied from interface: IStreamDelegator
      Convert Sparse stream to development and release stream from the Perforce server.
      Specified by:
      convertSparseStream in interface IStreamDelegator
      Parameters:
      opts - ConvertsparseOptions object describing optional parameters; if null, no options are set.
      Returns:
      non-null result message string from the Perforce server; this may include form trigger output pre-pended and / or appended to the "normal" message
      Throws:
      P4JavaException - if any error occurs in the processing of this method.
    • getStreams

      public List<IStreamSummary> getStreams(List<String> streamPaths, GetStreamsOptions opts) throws P4JavaException
      Description copied from interface: IStreamsDelegator
      Get a list of all summary Perforce streams known to the Perforce server.

      Note that the IStreamSummary objects returned here do not have stream paths. You must call the getStream method on a specific stream to get valid paths for a stream.

      Specified by:
      getStreams in interface IStreamsDelegator
      Parameters:
      streamPaths - if specified, the list of streams is limited to those matching the supplied list of stream paths, of the form //depotname/streamname
      opts - object describing optional parameters; if null, no options are set.
      Returns:
      non-null (but possibly-empty) list of IStreamSummary objects.
      Throws:
      P4JavaException - if any error occurs in the processing of this method.
    • tagFiles

      public List<IFileSpec> tagFiles(List<IFileSpec> fileSpecs, String labelName, boolean listOnly, boolean delete) throws ConnectionException, RequestException, AccessException
      Description copied from interface: ITagDelegator
      Tag files with a Perforce label.
      Specified by:
      tagFiles in interface ITagDelegator
      Parameters:
      fileSpecs - non-null list of files to be tagged.
      labelName - non-null label name to use for the tagging.
      listOnly - if true, don't do the actual tag, just return the list of files that would have been tagged.
      delete - if true, delete the label tag from the files.
      Returns:
      a non-null (but possibly empty) list of affected file specs
      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 request
      AccessException - if the Perforce server denies access to the caller
    • tagFiles

      public List<IFileSpec> tagFiles(List<IFileSpec> fileSpecs, String labelName, TagFilesOptions opts) throws P4JavaException
      Specified by:
      tagFiles in interface ITagDelegator
      Parameters:
      fileSpecs - non-null list of files to be tagged.
      labelName - non-null label name to use for the tagging.
      opts - TagFilesOptions object describing optional parameters; if null, no options are set.
      Returns:
      a non-null (but possibly empty) list of affected file specs.
      Throws:
      P4JavaException - if any error occurs in the processing of this method.
    • createTriggerEntries

      public String createTriggerEntries(@Nonnull List<ITriggerEntry> entryList) throws P4JavaException
      Description copied from interface: ITriggersDelegator
      Create or replace the triggers table data on the Perforce server with these new trigger entries.

      This method require that the user have 'super' access granted by 'p4 protect'.

      Warning: this will overwrite the existing triggers table data.

      Specified by:
      createTriggerEntries in interface ITriggersDelegator
      Parameters:
      entryList - non-null list of trigger entries.
      Returns:
      possibly-null status message string as returned from the server
      Throws:
      P4JavaException - if an error occurs processing this method and its parameters.
    • getTriggerEntries

      public List<ITriggerEntry> getTriggerEntries() throws P4JavaException
      Description copied from interface: ITriggersDelegator
      Get a list of Perforce trigger entries.

      This method require that the user have 'super' access granted by 'p4 protect'.

      Specified by:
      getTriggerEntries in interface ITriggersDelegator
      Returns:
      non-null but possibly empty list of trigger entries.
      Throws:
      P4JavaException - if any error occurs in the processing of this method.
    • updateTriggerEntries

      public String updateTriggerEntries(@Nonnull List<ITriggerEntry> entryList) throws P4JavaException
      Description copied from interface: ITriggersDelegator
      Replace the triggers table data on the Perforce server with these new triggers entries.

      This method require that the user have 'super' access granted by 'p4 protect'.

      Warning: this will overwrite the existing triggers table data.

      Specified by:
      updateTriggerEntries in interface ITriggersDelegator
      Parameters:
      entryList - non-null list of trigger entries.
      Returns:
      possibly-null status message string as returned from the server
      Throws:
      P4JavaException - if an error occurs processing this method and its parameters.
    • getTriggersTable

      public InputStream getTriggersTable() throws P4JavaException
      Description copied from interface: ITriggersDelegator
      Get an InputStream onto the entries of the Perforce triggers table.

      This method require that the user have 'super' access granted by 'p4 protect'.

      Specified by:
      getTriggersTable in interface ITriggersDelegator
      Returns:
      a non-null but possibly empty InputStream onto the triggers table's entries.
      Throws:
      P4JavaException - if any error occurs in the processing of this method.
    • createUser

      public String createUser(@Nonnull IUser user, boolean force) throws ConnectionException, RequestException, AccessException
      Description copied from interface: IUserDelegator
      Create a new Perforce user on the Perforce server.
      Specified by:
      createUser in interface IUserDelegator
      Parameters:
      user - non-null IUser defining the new user to be created.
      force - if true, force the creation of any named user; requires admin privileges,
      Returns:
      possibly-null status message string as returned from the server
      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 request
      AccessException - if the Perforce server denies access to the caller
    • createUser

      public String createUser(@Nonnull IUser user, UpdateUserOptions opts) throws P4JavaException
      Description copied from interface: IUserDelegator
      Create a new Perforce user on the Perforce server.
      Specified by:
      createUser in interface IUserDelegator
      Parameters:
      user - non-null IUser defining the new user to be created.
      opts - UpdateUserOptions object describing optional parameters; if null, no options are set
      Returns:
      possibly-null status message string as returned from the server
      Throws:
      P4JavaException - if any error occurs in the processing of this method.
    • updateUser

      public String updateUser(@Nonnull IUser user, UpdateUserOptions opts) throws P4JavaException
      Description copied from interface: IUserDelegator
      Update a Perforce user on the Perforce server.
      Specified by:
      updateUser in interface IUserDelegator
      Parameters:
      user - non-null IUser defining the new user to be updated.
      opts - UpdateUserOptions object describing optional parameters; if null, no options are set
      Returns:
      possibly-null status message string as returned from the server
      Throws:
      P4JavaException - if any error occurs in the processing of this method.
    • updateUser

      public String updateUser(@Nonnull IUser user, boolean force) throws ConnectionException, RequestException, AccessException
      Description copied from interface: IUserDelegator
      Update a Perforce user on the Perforce server.
      Specified by:
      updateUser in interface IUserDelegator
      Parameters:
      user - non-null IUser defining the user to be updated
      force - if true, force update for users other than the caller. Requires super user / admin privileges (enforced by the server).
      Returns:
      possibly-null status message string as returned from the server
      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 request
      AccessException - if the Perforce server denies access to the caller
    • deleteUser

      public String deleteUser(String userName, boolean force) throws ConnectionException, RequestException, AccessException
      Description copied from interface: IUserDelegator
      Delete a named Perforce user from the Perforce server.
      Specified by:
      deleteUser in interface IUserDelegator
      Parameters:
      userName - non-null name of the user to be deleted.
      force - if true, force deletion for users other than the caller. Requires super user / admin privileges (enforced by the server).
      Returns:
      possibly-null status message string as returned from the server
      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 request
      AccessException - if the Perforce server denies access to the caller
    • deleteUser

      public String deleteUser(String userName, UpdateUserOptions opts) throws P4JavaException
      Description copied from interface: IUserDelegator
      Delete a named Perforce user from the Perforce server
      Specified by:
      deleteUser in interface IUserDelegator
      Parameters:
      userName - non-null name of the user to be deleted.
      opts - UpdateUserOptions object describing optional parameters; if null, no options are set
      Returns:
      possibly-null status message string as returned from the server
      Throws:
      P4JavaException - if any error occurs in the processing of this method.
    • getUser

      public IUser getUser(String userName) throws ConnectionException, RequestException, AccessException
      Description copied from interface: IUserDelegator
      Get the user details of a specific Perforce user from the Perforce server.
      Specified by:
      getUser in interface IUserDelegator
      Parameters:
      userName - if null, get the current user details, otherwise use the passed-in user name.
      Returns:
      IUser details for the user, or null if no such user is known.
      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 request
      AccessException - if the Perforce server denies access to the caller
    • getUsers

      public List<IUserSummary> getUsers(List<String> userList, int maxUsers) throws ConnectionException, RequestException, AccessException
      Description copied from interface: IUsersDelegator
      Get a list of Perforce users known to this Perforce server. Note that maxUsers and the user list are supposed to be mutually exclusive in usage, but this is not enforced by P4Java as the restriction doesn't make much sense and may be lifted in the Perforce server later.

      Note that this implementation differs a bit from the p4 command line version in that it simply doesn't return any output for unmatched users.

      Specified by:
      getUsers in interface IUsersDelegator
      Parameters:
      userList - if non-null, restrict output to users matching the passed-in list of users.
      maxUsers - if positive, only return the first maxUsers users.
      Returns:
      non-null (but possibly empty) list of non-null IUserSummary objects representing the underlying Perforce users (if any).
      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 request
      AccessException - if the Perforce server denies access to the caller
    • getUsers

      public List<IUserSummary> getUsers(List<String> userList, GetUsersOptions opts) throws P4JavaException
      Description copied from interface: IUsersDelegator
      Get a list of Perforce users known to this Perforce server. Note that maxUsers and the user list are supposed to be mutually exclusive in usage, but this is not enforced by P4Java as the restriction doesn't make much sense and may be lifted in the Perforce server later.

      Note that this implementation differs a bit from the p4 command line version in that it simply doesn't return any output for unmatched users.

      Specified by:
      getUsers in interface IUsersDelegator
      Parameters:
      userList - if non-null, restrict output to users matching the passed-in list of users.
      opts - GetUsersOptions object describing optional parameters; if null, no options are set
      Returns:
      non-null (but possibly empty) list of non-null IUserSummary objects representing the underlying Perforce users (if any).
      Throws:
      P4JavaException - if any error occurs in the processing of this method.
    • unload

      public String unload(UnloadOptions opts) throws P4JavaException
      Description copied from interface: IUnloadDelegator
      Unloads a client or label to the unload depot.

      Note that by default, users can only unload their own clients or labels. The -f flag requires 'admin' access, which is granted by 'p4 protect'. The full semantics of this operation are found in the main 'p4 help unload' documentation.

      Specified by:
      unload in interface IUnloadDelegator
      Parameters:
      opts - possibly-null UnloadOptions object specifying method options.
      Returns:
      non-null result message string from the unload operation.
      Throws:
      P4JavaException - if an error occurs processing this method and its parameters.
    • verifyFiles

      public List<IExtendedFileSpec> verifyFiles(List<IFileSpec> fileSpecs, VerifyFilesOptions opts) throws P4JavaException
      Description copied from interface: IVerifyDelegator
      Verify that the server archives are intact.

      This method require that the user be an operator or have 'admin' access, which is granted by 'p4 protect'.

      Specified by:
      verifyFiles in interface IVerifyDelegator
      Parameters:
      fileSpecs - filespecs to be processed; if null or empty, an empty list is returned.
      opts - VerifyFilesOptions object describing optional parameters; if null, no options are set.
      Returns:
      non-null (but possibly empty) list of files with revision-specific information and an MD5 digest of the revision's contents.
      Throws:
      P4JavaException - if an error occurs processing this method and its parameters.
    • renameClient

      public String renameClient(String oldUserName, String newUserName) throws P4JavaException
      Description copied from interface: IRenameClientDelegator
      Completely renames a client, modifying all database records which mention the client.

      This includes all workspaces, labels, branches, streams, etc. which are owned by the client, all pending, shelved, and committed changes created by the client, any files that the client has opened or shelved, any fixes that the client made to jobs, any properties that apply to the client, any groups that the client is in, and the client record itself.

      Protection table entries that apply to the client are updated only if the Name: field exactly matches the client name; if the Name: field contains wildcards, it is not modified.

      The full semantics of this operation are found in the main 'p4 help' documentation.

      This method requires 'super' access granted by 'p4 protect'.

      Specified by:
      renameClient in interface IRenameClientDelegator
      Parameters:
      oldUserName - the old client name to be changed.
      newUserName - the new client name to be changed to.
      Returns:
      non-null result message string from the reload operation.
      Throws:
      P4JavaException - if an error occurs processing this method and its parameters.
    • getGraphListTree

      public List<IGraphListTree> getGraphListTree(String sha) throws P4JavaException
      Usage: ls-tree {tree-sha}
      Specified by:
      getGraphListTree in interface IGraphListTreeDelegator
      Parameters:
      sha - graph SHA
      Returns:
      List of graph tree objects
      Throws:
      P4JavaException - API errors
    • getGraphShowRefs

      public List<IGraphRef> getGraphShowRefs(GraphShowRefOptions opts) throws P4JavaException
      Usage: show-ref [ -a -n {repo} -u {user} -t {type} -m {max} ]
      Specified by:
      getGraphShowRefs in interface IGraphShowRefDelegator
      Parameters:
      opts - graph Show Ref Options
      Returns:
      list of graph refs
      Throws:
      P4JavaException - API errors
    • getSpec

      public Map<String,Object> getSpec(CustomSpec type) throws P4JavaException
      Usage: p4 spec [ -o ] type
      Specified by:
      getSpec in interface ISpecDelegator
      Parameters:
      type - spec type, ('job' or 'stream') to be updated.
      Returns:
      non-null result message string from the Perforce server; this may include form trigger output pre-pended and / or appended to the "normal" message.
      Throws:
      P4JavaException - if any error occurs in the processing of this method.
    • updateSpec

      public String updateSpec(CustomSpec type, Map<String,Object> spec) throws P4JavaException
      Usage: p4 spec [ -i ] type
      Specified by:
      updateSpec in interface ISpecDelegator
      Parameters:
      type - spec type, ('job' or 'stream') to be updated.
      spec - updated spec as a map.
      Returns:
      non-null result message string from the Perforce server; this may include form trigger output pre-pended and / or appended to the "normal" message.
      Throws:
      P4JavaException - if any error occurs in the processing of this method.
      Since:
      2020.1
    • updateSpecString

      public String updateSpecString(CustomSpec type, String spec) throws P4JavaException
      Usage: p4 spec [ -i ] type
      Specified by:
      updateSpecString in interface ISpecDelegator
      Parameters:
      type - spec type, ('job' or 'stream') to be updated.
      spec - updated spec as a String.
      Returns:
      non-null result message string from the Perforce server; this may include form trigger output pre-pended and / or appended to the "normal" message.
      Throws:
      P4JavaException - if any error occurs in the processing of this method.
      Since:
      2020.1
    • getValidServerIPMACAddress

      public List<IServerIPMACAddress> getValidServerIPMACAddress() throws P4JavaException
      Specified by:
      getValidServerIPMACAddress in interface ILicenseDelegator
      Throws:
      P4JavaException
    • getLimits

      public ILicenseLimits getLimits() throws P4JavaException
      Specified by:
      getLimits in interface ILicenseDelegator
      Throws:
      P4JavaException
    • getLicense

      public ILicense getLicense() throws P4JavaException
      Specified by:
      getLicense in interface ILicenseDelegator
      Throws:
      P4JavaException
    • updateLicense

      public String updateLicense(ILicense license) throws P4JavaException
      Specified by:
      updateLicense in interface ILicenseDelegator
      Throws:
      P4JavaException
    • sampleExtension

      public String sampleExtension(String extnName) throws P4JavaException
      Description copied from interface: IExtensionDelegator
      Creates sample extension with the given name. As a result a folder extnName will be created with main.lua and manifest.json in it. command: extension [ --sample name ]
      Specified by:
      sampleExtension in interface IExtensionDelegator
      Parameters:
      extnName - - name of the extension
      Returns:
      result
      Throws:
      P4JavaException - on error
    • packageExtension

      public String packageExtension(String dirName) throws P4JavaException
      Description copied from interface: IExtensionDelegator
      Packages the extension. As a result creates a file with .p4-extension in the current folder. command: extension [ --package dir ]
      Specified by:
      packageExtension in interface IExtensionDelegator
      Parameters:
      dirName - - Directory name containing main.lua and manifest.json for the extension
      Returns:
      result
      Throws:
      P4JavaException - on error
    • installExtension

      public ExtensionSummary installExtension(String extnPackageName, boolean allowUnsigned) throws P4JavaException
      Description copied from interface: IExtensionDelegator
      Installs extension on p4 server. command: extension [ --install file [--yes] [--cert] [--allow-unsigned] ]
      Specified by:
      installExtension in interface IExtensionDelegator
      Parameters:
      extnPackageName - - Name of the extension package file. For ex. p4java-obliterate-extn.p4-extension
      allowUnsigned - if true
      Returns:
      extension summary
      Throws:
      P4JavaException - on error
    • createExtensionConfig

      public String createExtensionConfig(IExtension extension, String namespace, String instanceConfig) throws P4JavaException
      Description copied from interface: IExtensionDelegator
      Creates/updates an extension's global/instance config.
      Specified by:
      createExtensionConfig in interface IExtensionDelegator
      Parameters:
      extension - extension
      namespace - name space
      instanceConfig - - If provided, creates/updates this instance config.
      Returns:
      result
      Throws:
      P4JavaException - on error
    • updateExtensionConfig

      public String updateExtensionConfig(IExtension extension, String namespace, String instanceConfig) throws P4JavaException
      Description copied from interface: IExtensionDelegator
      Updates an extension's global/instance config.
      Specified by:
      updateExtensionConfig in interface IExtensionDelegator
      Parameters:
      extension - extension
      namespace - name space
      instanceConfig - - If provided updates this instance config.
      Returns:
      result
      Throws:
      P4JavaException - on error
    • listExtensions

      public List<ExtensionSummary> listExtensions(String type) throws P4JavaException
      Description copied from interface: IExtensionDelegator
      Lists extensions or configs based on type.
      Specified by:
      listExtensions in interface IExtensionDelegator
      Parameters:
      type - - Can be "extensions" or "configs"
      Returns:
      list of extensions
      Throws:
      P4JavaException - on error
    • deleteExtension

      public String deleteExtension(String namespace, String extnName) throws P4JavaException
      Description copied from interface: IExtensionDelegator
      Deletes an extension along with all of its configuration.
      Specified by:
      deleteExtension in interface IExtensionDelegator
      Parameters:
      namespace - name space
      extnName - extension name
      Returns:
      result
      Throws:
      P4JavaException - on error
    • getExtensionConfig

      public Extension getExtensionConfig(String namespace, String name, String instanceName) throws P4JavaException
      Description copied from interface: IExtensionDelegator
      Retrieves an extension/config.
      Specified by:
      getExtensionConfig in interface IExtensionDelegator
      Parameters:
      namespace - name space
      name - extension name
      instanceName - Optional, only required for instance config
      Returns:
      extension config
      Throws:
      P4JavaException - on error
    • getCommitObject

      public ICommit getCommitObject(String sha) throws P4JavaException
      Usage: cat-file commit {object-sha}
      Specified by:
      getCommitObject in interface ICommitDelegator
      Parameters:
      sha - graph SHA
      Returns:
      Commit
      Throws:
      P4JavaException - API errors
    • getCommitObject

      public ICommit getCommitObject(String sha, String repo) throws P4JavaException
      Usage: cat-file -n {repo} commit {object-sha}
      Specified by:
      getCommitObject in interface ICommitDelegator
      Parameters:
      sha - graph SHA
      repo - graph repo
      Returns:
      Commit
      Throws:
      P4JavaException - API errors
    • getBlobObject

      public InputStream getBlobObject(String repo, String sha) throws P4JavaException
      Usage: cat-file -n {repo} blob {object-sha}
      Specified by:
      getBlobObject in interface ICommitDelegator
      Parameters:
      repo - graph repo
      sha - graph SHA
      Returns:
      InputStream for graph blob
      Throws:
      P4JavaException - API errors
    • getGraphObject

      public IGraphObject getGraphObject(String sha) throws P4JavaException
      Usage: cat-file -t {object-sha}
      Specified by:
      getGraphObject in interface ICommitDelegator
      Parameters:
      sha - graph SHA
      Returns:
      graph object
      Throws:
      P4JavaException - API errors
    • handleFileReturn

      @Deprecated public IFileSpec handleFileReturn(Map<String,Object> map) throws AccessException, ConnectionException
      Deprecated.
      Parameters:
      map - map
      Returns:
      IFileSpec
      Throws:
      AccessException - on error
      ConnectionException - on error
    • handleFileReturn

      @Deprecated public IFileSpec handleFileReturn(Map<String,Object> map, IClient client) throws AccessException, ConnectionException
      Deprecated.
      Parameters:
      map - map
      client - client
      Returns:
      IFileSpec
      Throws:
      AccessException - on error
      ConnectionException - on error
    • getServerAddressDetails

      public abstract IServerAddress getServerAddressDetails()
    • getStreamlog

      public Map<String,List<IStreamlog>> getStreamlog(List<String> streamPaths, StreamlogOptions opts) throws P4JavaException
      Description copied from interface: IStreamlogDelegator
      List the revision history of the specified stream specs, from the most recent revision to the first. If the stream was opened for edit and submitted, the change list information is displayed. Otherwise only the maximum change num at the time of edit is displayed.
      Specified by:
      getStreamlog in interface IStreamlogDelegator
      Parameters:
      streamPaths - Stream paths to get history.
      opts - Command options.
      Returns:
      List of Streamlog.
      Throws:
      P4JavaException - on error
      See Also: