java.lang.Object
org.springframework.cloud.dataflow.shell.Target

public class Target extends Object
Encapsulates various data points related to the Data Flow Server Target, such as target URI, success/error state, exception messages that may have occurred.
Since:
1.0
Author:
Gunnar Hillert, Chris Bono
  • Field Details

  • Constructor Details

    • Target

      public Target(String targetUriAsString, String targetUsername, String targetPassword, boolean skipSslValidation)
      Construct a new Target. The passed in targetUriAsString String parameter will be converted to a URI. This method allows for providing a username and password for authentication.
      Parameters:
      targetUriAsString - the data flow server URI, must not be empty
      targetUsername - the username, may be empty, if access is unauthenticated
      targetPassword - the password, may be empty
      skipSslValidation - whether or not we skip SSL validation.
      Throws:
      IllegalArgumentException - if the given URI string violates RFC 2396.
    • Target

      public Target(String targetUriAsString)
      Construct a new Target. The passed in targetUriAsString String parameter will be converted to a URI.
      Parameters:
      targetUriAsString - Must not be empty
      Throws:
      IllegalArgumentException - if the given string violates RFC 2396
  • Method Details

    • getStatus

      public Target.TargetStatus getStatus()
      Return the target status, which is either Success or Error.
      Returns:
      The Target.TargetStatus. May be null.
    • getTargetException

      public Exception getTargetException()
      If during targeting an error occurred, the resulting Exception is made available for further introspection.
      Returns:
      If present, returns the Exception, otherwise null is returned.
    • setTargetException

      public void setTargetException(Exception targetException)
      Sets the exception in case an error occurred during targeting. Will also set the respective Target.TargetStatus to Target.TargetStatus.ERROR.
      Parameters:
      targetException - Must not be null.
    • getTargetResultMessage

      public String getTargetResultMessage()
      Provides a result message indicating whether the provide getTargetUri() was successfully targeted or not.
      Returns:
      The formatted result message.
    • setTargetResultMessage

      public void setTargetResultMessage(String targetResultMessage)
      Set the result messages indicating the success or failure while targeting the Spring Cloud Data Flow Server.
      Parameters:
      targetResultMessage - Must not be empty.
    • getTargetUri

      public URI getTargetUri()
      Returns:
      The Target Uri. Will never be null.
    • getTargetUriAsString

      public String getTargetUriAsString()
      Returns the target URI as a String.
      Returns:
      Never null and will always return a valid URI value
    • isSkipSslValidation

      public boolean isSkipSslValidation()
      Returns if sslValidation should be skipped
      Returns:
      Return whether or not we skip SSL validation.
    • getTargetCredentials

      public TargetCredentials getTargetCredentials()
      Returns the target credentials
      Returns:
      The target credentials. May be null if there is no authentication
    • setTargetCredentials

      public void setTargetCredentials(TargetCredentials targetCredentials)
    • isAuthenticationEnabled

      public boolean isAuthenticationEnabled()
      Indicates whether authentication is enabled for this target.
      Returns:
      True if authentication is enabled, false otherwise
    • setAuthenticationEnabled

      public void setAuthenticationEnabled(boolean authenticationEnabled)
      Parameters:
      authenticationEnabled - False by default
    • isAuthenticated

      public boolean isAuthenticated()
      Returns:
      True if the user is successfully authenticated with this Target
    • setAuthenticated

      public void setAuthenticated(boolean authenticated)
      Parameters:
      authenticated - whether a user is successfully authenticated with the Target
    • toString

      public String toString()
      Overrides:
      toString in class Object