Class ScpLocation

    • Method Detail

      • getHost

        public String getHost()
      • setHost

        public void setHost​(String host)
      • isLocal

        public boolean isLocal()
      • getPort

        public int getPort()
      • setPort

        public void setPort​(int port)
      • resolvePort

        public int resolvePort()
      • getUsername

        public String getUsername()
        Specified by:
        getUsername in interface UsernameHolder
        Returns:
        The attached username - may be null/empty if holder not yet initialized
      • resolveUsername

        public String resolveUsername()
        Resolves the effective username to use for a remote location. If username not set then uses the current username
        Returns:
        The resolved username
        See Also:
        getUsername(), OsUtils.getCurrentUser()
      • getPath

        public String getPath()
      • setPath

        public void setPath​(String path)
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class Object
      • parse

        public static ScpLocation parse​(String locSpec)
        Parses a local or remote SCP location in the format "user@host:path" or "scp://[user@]host[:port][/path]"
        Parameters:
        locSpec - The location specification - ignored if null/empty
        Returns:
        The ScpLocation or null if no specification provider
        Throws:
        IllegalArgumentException - if invalid specification
        See Also:
        update(String, ScpLocation)
      • update

        public static <L extends ScpLocation> L update​(String spec,
                                                       L location)
        Parses a local or remote SCP location in the format "user@host:path" or "scp://[user@]host[:port][/path]"
        Type Parameters:
        L - Type of ScpLocation being updated
        Parameters:
        spec - The location specification - ignored if null/empty
        location - The ScpLocation to update - never null
        Returns:
        The updated location (unless no specification)
        Throws:
        IllegalArgumentException - if invalid specification