Package com.sodius.oslc.client.requests
Class Validations
- java.lang.Object
-
- com.sodius.oslc.client.requests.Validations
-
public class Validations extends Object
Provides methods to validate connectivity with a remote OSLC application. Validation methods do never throw any exception but provide a validation result that can contain an error message.- Since:
- 1.9.0
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
Validations.ValidationResult<T>
The result of a validation, which is either the retrieved resource or a message explaining the validation error.
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static Validations.ValidationResult<Void>
validateFriend(RootServices rootServices, Friend friend, List<Locale> locales)
Verifies an OAuth connection can be realized for the specified friend and root services.static Validations.ValidationResult<Publisher>
validatePublisher(OslcClient client, RootServices rootServices, String identifier, List<Locale> locales)
Validates the root services publisher, to ensure the OSLC server matches the expected application type.static Validations.ValidationResult<Publisher>
validatePublisher(RootServices rootServices, String identifier, List<Locale> locales)
Validates the root services publisher, to ensure the OSLC server matches the expected application type.static <T extends RootServices>
Validations.ValidationResult<T>validateRootServices(OslcClient client, URI rootServicesLocation, Class<T> rootServicesType, List<Locale> locales)
Validates the root services resource, to ensure the OSLC server is accessible and declares discovery services as expected.static <T extends RootServices>
Validations.ValidationResult<T>validateRootServices(URI rootServicesLocation, Class<T> rootServicesType, List<Locale> locales)
Validates the root services resource, to ensure the OSLC server is accessible and declares discovery services as expected.
-
-
-
Method Detail
-
validateRootServices
public static <T extends RootServices> Validations.ValidationResult<T> validateRootServices(URI rootServicesLocation, Class<T> rootServicesType, List<Locale> locales)
Validates the root services resource, to ensure the OSLC server is accessible and declares discovery services as expected.- Type Parameters:
T
- the type of RootServices to de-serialize.- Parameters:
rootServicesLocation
- the root services location of the remote OSLC server.rootServicesType
- the RootServices subclass to use when binding the stream to a resource.locales
- the locales to use for messages, in order of preference.- Returns:
- a validation result with retrieved root services or an error message indicating why root services are not accessible.
-
validateRootServices
public static <T extends RootServices> Validations.ValidationResult<T> validateRootServices(OslcClient client, URI rootServicesLocation, Class<T> rootServicesType, List<Locale> locales)
Validates the root services resource, to ensure the OSLC server is accessible and declares discovery services as expected.The client must be
unauthenticated
, as root services is an authorization-free resource, and some servers may reject requests providing an Authorization header. The client may be customized usingOslcClientFactory
for specific parameters, like a proxy configuration.- Type Parameters:
T
- the type of RootServices to de-serialize.- Parameters:
client
- the client to userootServicesLocation
- the root services location of the remote OSLC server.rootServicesType
- the RootServices subclass to use when binding the stream to a resource.locales
- the locales to use for messages, in order of preference.- Returns:
- a validation result with retrieved root services or an error message indicating why root services are not accessible.
- Since:
- 3.5.1
-
validatePublisher
public static Validations.ValidationResult<Publisher> validatePublisher(OslcClient client, RootServices rootServices, String identifier, List<Locale> locales)
Validates the root services publisher, to ensure the OSLC server matches the expected application type.The client must be
unauthenticated
, as publisher is an authorization-free resource, and some servers may reject requests providing an Authorization header. The client may be customized usingOslcClientFactory
for specific parameters, like a proxy configuration.- Parameters:
client
- the client to userootServices
- the root services of the remote OSLC server.identifier
- the expected OSLC application identifier (e.g."http://jazz.net/application/rm"
)locales
- the locales to use for messages, in order of preference.- Returns:
- a validation result with retrieved publisher or an error message indicating the publisher doesn't match the expectation.
- Since:
- 3.5.1
-
validatePublisher
public static Validations.ValidationResult<Publisher> validatePublisher(RootServices rootServices, String identifier, List<Locale> locales)
Validates the root services publisher, to ensure the OSLC server matches the expected application type.- Parameters:
rootServices
- the root services of the remote OSLC server.identifier
- the expected OSLC application identifier (e.g."http://jazz.net/application/rm"
)locales
- the locales to use for messages, in order of preference.- Returns:
- a validation result with retrieved publisher or an error message indicating the publisher doesn't match the expectation.
-
validateFriend
public static Validations.ValidationResult<Void> validateFriend(RootServices rootServices, Friend friend, List<Locale> locales)
Verifies an OAuth connection can be realized for the specified friend and root services. This method is notably useful to verify the consumer information stored in the friend are valid and recognized by the target application.- Parameters:
rootServices
- the root services of the remote OSLC server.friend
- the friend to validate.locales
- the locales to use for messages, in order of preference.- Returns:
- a validation result, with an error message if the OAuth connection is not validated.
-
-