Class Target
java.lang.Object
org.springframework.cloud.dataflow.shell.Target
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
-
Nested Class Summary
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionReturn the target status, which is either Success or Error.Returns the target credentialsIf during targeting an error occurred, the resultingException
is made available for further introspection.Provides a result message indicating whether the providegetTargetUri()
was successfully targeted or not.Returns the target URI as a String.boolean
boolean
Indicates whether authentication is enabled for this target.boolean
Returns if sslValidation should be skippedvoid
setAuthenticated
(boolean authenticated) void
setAuthenticationEnabled
(boolean authenticationEnabled) void
setTargetCredentials
(TargetCredentials targetCredentials) void
setTargetException
(Exception targetException) Sets the exception in case an error occurred during targeting.void
setTargetResultMessage
(String targetResultMessage) Set the result messages indicating the success or failure while targeting the Spring Cloud Data Flow Server.toString()
-
Field Details
-
DEFAULT_SCHEME
- See Also:
-
DEFAULT_HOST
- See Also:
-
DEFAULT_PORT
public static final int DEFAULT_PORT- See Also:
-
DEFAULT_TARGET
- See Also:
-
DEFAULT_USERNAME
- See Also:
-
DEFAULT_PASSWORD
- See Also:
-
DEFAULT_CLIENT_REGISTRATION_ID
- See Also:
-
DEFAULT_SKIP_SSL_VALIDATION
- See Also:
-
DEFAULT_CREDENTIALS_PROVIDER_COMMAND
- See Also:
-
DEFAULT_PROXY_USERNAME
- See Also:
-
DEFAULT_PROXY_PASSWORD
- See Also:
-
DEFAULT_PROXY_URI
- See Also:
-
-
Constructor Details
-
Target
public Target(String targetUriAsString, String targetUsername, String targetPassword, boolean skipSslValidation) Construct a new Target. The passed intargetUriAsString
String parameter will be converted to aURI
. This method allows for providing a username and password for authentication.- Parameters:
targetUriAsString
- the data flow server URI, must not be emptytargetUsername
- the username, may be empty, if access is unauthenticatedtargetPassword
- the password, may be emptyskipSslValidation
- whether or not we skip SSL validation.- Throws:
IllegalArgumentException
- if the given URI string violates RFC 2396.
-
Target
Construct a new Target. The passed intargetUriAsString
String parameter will be converted to aURI
.- Parameters:
targetUriAsString
- Must not be empty- Throws:
IllegalArgumentException
- if the given string violates RFC 2396
-
-
Method Details
-
getStatus
Return the target status, which is either Success or Error.- Returns:
- The
Target.TargetStatus
. May be null.
-
getTargetException
If during targeting an error occurred, the resultingException
is made available for further introspection.- Returns:
- If present, returns the Exception, otherwise null is returned.
-
setTargetException
Sets the exception in case an error occurred during targeting. Will also set the respectiveTarget.TargetStatus
toTarget.TargetStatus.ERROR
.- Parameters:
targetException
- Must not be null.
-
getTargetResultMessage
Provides a result message indicating whether the providegetTargetUri()
was successfully targeted or not.- Returns:
- The formatted result message.
-
setTargetResultMessage
Set the result messages indicating the success or failure while targeting the Spring Cloud Data Flow Server.- Parameters:
targetResultMessage
- Must not be empty.
-
getTargetUri
- Returns:
- The Target Uri. Will never be null.
-
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
Returns the target credentials- Returns:
- The target credentials. May be null if there is no authentication
-
setTargetCredentials
-
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
-