Class ValidateConnection<T extends RootServices>

  • 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 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 (usually RootServices, 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 (usually RootServices, but can be extended).
        monitor - the monitor on which progress can be reported and cancellation be checked.
    • Method Detail

      • getClient

        protected final OslcClient getClient()
      • 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 interface Callable<T extends RootServices>
        Specified by:
        call in interface ResourceRequest<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.