Package com.sodius.oslc.client.requests
Class ValidateConnection<T extends RootServices>
java.lang.Object
com.sodius.oslc.client.requests.ValidateConnection<T>
- Type Parameters:
T- the type of RootServices to extract from the remote server.
- All Implemented Interfaces:
ResourceRequest<IStatus>,Callable<IStatus>
public abstract class ValidateConnection<T extends RootServices>
extends Object
implements ResourceRequest<IStatus>
Validates the connection to an OSLC server.
This class requires org.eclipse.equinox.common plug-in to be on classpath.
- Since:
- 1.1.0
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedValidateConnection(OslcClient client, URI rootServices, Class<T> rootServicesType) Creates an instance of request to validate the connection to an OSLC server.protectedValidateConnection(OslcClient client, URI rootServices, Class<T> rootServicesType, IProgressMonitor monitor) Creates an instance of request to validate the connection to an OSLC server, with progress reporting. -
Method Summary
Modifier and TypeMethodDescriptioncall()Validates the connection to the server by requesting the root services.protected abstract IStatusAllow subclasses refining the validation given the obtained root services.protected final OslcClientprotected final IProgressMonitorprotected final IStatusvalidatePublisher(T rootServices, String identifier) Allow subclasses to request the validation of the root services publisher, to ensure the OSLC server matches the expected application type.
-
Constructor Details
-
ValidateConnection
Creates an instance of request to validate the connection to an OSLC server.- Parameters:
client- the REST client used to execute requests.rootServices- the location of the root services.rootServicesType- the type of response to extract from the root services execution (usuallyRootServices, but can be extended).
-
ValidateConnection
protected ValidateConnection(OslcClient client, URI rootServices, Class<T> rootServicesType, IProgressMonitor monitor) Creates an instance of request to validate the connection to an OSLC server, with progress reporting.- Parameters:
client- the REST client used to execute requests.rootServices- the location of the root services.rootServicesType- the type of response to extract from the root services execution (usuallyRootServices, but can be extended).monitor- the monitor on which progress can be reported and cancellation be checked.
-
-
Method Details
-
getClient
-
getProgressMonitor
-
call
Validates the connection to the server by requesting the root services. Subclasses may perform additional validation on the obtained root services.Unlike any other
ResourceRequestsubclass, this implementation guarantees no exception shall be thrown during the executions. The returned status contains the thrown exception, if any.- Specified by:
callin interfaceCallable<T extends RootServices>- Specified by:
callin interfaceResourceRequest<T extends RootServices>- Returns:
- a status indicating whether the connection is validated or not.
-
call
Allow subclasses refining the validation given the obtained root services. Subclasses are typically encouraged to parse a protected resource, so that the credentials of the underlying OslcClient are verified.- Parameters:
rootServices- the root services of the remote OSLC server.- Returns:
- a status indicating whether the connection is validated or not.
-
validatePublisher
Allow subclasses to request the validation of 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")- Returns:
- a status indicating whether the publisher is validated or not.
-