Class AbstractDiscoveryLinkIndexService
Concrete services extending this class may declare the following path:
@Path("/process/discovery/linkIndex")
- Since:
- 1.7.0
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiondiscover()protected ResourceResponse<Collection<DirectedLink>> discoverIncomingLinks(LinkIndexQuery linkIndexQuery) Discovers the incoming links on the target resources of the given link index query.This method goes through the resource's project associations and returns a collection ofLinkIndexQuerycontaining the rootservices and link types that can hold links to discover.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.protected abstract ProjectAreaAssociationsgetProjectAreaAssociations(URI resource) Returns the project area associations of the given resource's project
-
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 ofLinkIndexQuerycontaining the rootservices and link types that can hold links to discover.When architecture management associations are used, additional
LinkIndexQueryresources 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
LinkIndexQueryis marked asunauthorized. 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 resourceresourceType- the target range (optional)gcURL- the url of the Global Configuration (optional)friendToAuthorize- the root services of the friend for which authorization is required, ornullif none- Returns:
- a collection of
LinkIndexQueryresources - Throws:
OslcWebApplicationException- if friendToAuthorize is used and there's no authorization available for this friend.
-
discover
-
getProjectAreaAssociations
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 projectresource- the local resource to get incoming links for, i.e: the target resource of the returned link index queriesresourceType- the given resource's typegcURL- 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:
- Execute the given link index query
- 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.
-