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
Constructors Modifier Constructor Description protected
ValidateConnection(OslcClient client, URI rootServices, Class<T> rootServicesType)
Creates an instance of request to validate the connection to an OSLC server.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.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description IStatus
call()
Validates the connection to the server by requesting the root services.protected abstract IStatus
call(T rootServices)
Allow subclasses refining the validation given the obtained root services.protected OslcClient
getClient()
protected IProgressMonitor
getProgressMonitor()
protected IStatus
validatePublisher(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 Detail
-
ValidateConnection
protected ValidateConnection(OslcClient client, URI rootServices, Class<T> rootServicesType)
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 Detail
-
getClient
protected final OslcClient getClient()
-
getProgressMonitor
protected final IProgressMonitor getProgressMonitor()
-
call
public IStatus 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
ResourceRequest
subclass, this implementation guarantees no exception shall be thrown during the executions. The returned status contains the thrown exception, if any.- Specified by:
call
in interfaceCallable<T extends RootServices>
- Specified by:
call
in interfaceResourceRequest<T extends RootServices>
- Returns:
- a status indicating whether the connection is validated or not.
-
call
protected abstract IStatus call(T rootServices)
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
protected final IStatus validatePublisher(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.- 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.
-
-