Class AbstractDiscoveryLinkIndexService

java.lang.Object
com.sodius.oslc.server.process.links.services.AbstractDiscoveryLinkIndexService

public abstract class AbstractDiscoveryLinkIndexService extends Object
Provides services to discover links stored in the link index of a remote application.

Concrete services extending this class may declare the following path:
@Path("/process/discovery/linkIndex")

Since:
1.7.0
  • Constructor Details

    • AbstractDiscoveryLinkIndexService

      public AbstractDiscoveryLinkIndexService()
  • Method Details

    • getAll

      @GET @Path("/query") @Produces({"application/rdf+xml","application/xml","text/xml","application/json","application/ld+json","text/turtle"}) public Response getAll(@QueryParam("resource") URI resource, @QueryParam("resourceType") URI resourceType, @QueryParam("oslc_config.context") URI gcURL, @QueryParam("rootServices") URI friendToAuthorize)
      This method goes through the resource's project associations and returns a collection of LinkIndexQuery containing the rootservices and link types that can hold links to discover.

      When architecture management associations are used, additional LinkIndexQuery resources are added to the returned collection. They are used to execute OSLC Queries on each associated Service Provider. If this end-point is called without a GC url, only such OSLC queries are returned.

      If a friend used for architecture management is not connected (i.e. the server responds with HTTP 401), the corresponding LinkIndexQuery is marked as unauthorized. The caller may trigger the authorization by executing again the request, this time setting the friend rootServices URI as query parameter. In this case the service starts the OAuth dance, which is to complete in the front-end.

      Parameters:
      resource - the uri of the resource
      resourceType - the target range (optional)
      gcURL - the url of the Global Configuration (optional)
      friendToAuthorize - the root services of the friend for which authorization is required, or null if none
      Returns:
      a collection of LinkIndexQuery resources
      Throws:
      OslcWebApplicationException - if friendToAuthorize is used and there's no authorization available for this friend.
    • discover

      @POST @Path("/query") @Consumes({"application/rdf+xml","application/xml","text/xml","application/json","application/ld+json","text/turtle"}) @Produces({"application/rdf+xml","application/xml","text/xml","application/json","application/ld+json","text/turtle"}) public Response discover()
    • getProjectAreaAssociations

      protected abstract ProjectAreaAssociations getProjectAreaAssociations(URI resource)
      Returns the project area associations of the given resource's project
      Parameters:
      resource - the resource URI
      Returns:
      the project area associations of the given resource's project
    • getLinkIndexQueries

      protected Collection<LinkIndexQuery> getLinkIndexQueries(ProjectAreaAssociations projectAreaAssociations, URI resource, URI resourceType, URI gcURL)
      Returns the collection of link index queries to execute in order to discover all the incoming links on the given resource.
      Parameters:
      projectAreaAssociations - the project area associations for the given resource's project
      resource - the local resource to get incoming links for, i.e: the target resource of the returned link index queries
      resourceType - the given resource's type
      gcURL - the global configuration URL
      Returns:
      the collection of link index queries to execute in order to discover all the incoming links on the given resource
    • discoverIncomingLinks

      protected ResourceResponse<Collection<DirectedLink>> discoverIncomingLinks(LinkIndexQuery linkIndexQuery) throws LinkingTypesStoreException
      Discovers the incoming links on the target resources of the given link index query.

      To discover the incoming links this method does the following:

      1. Execute the given link index query
      2. Reverse the resulting directed links, so we have the incoming links to display on local resources rather than the outgoing links owned by the remote application
      Parameters:
      linkIndexQuery - the link index query to execute
      Returns:
      the response containing the collection of discovered incoming links
      Throws:
      LinkingTypesStoreException - if an error prevents link types from being retrieved.