Package org.eclipse.lyo.client
Class OslcClient
java.lang.Object
org.eclipse.lyo.client.OslcClient
- All Implemented Interfaces:
IOslcClient
An OSLC Client that extends the JAX-RS 2.0 REST client with OSLC specific CRUD and discovery capabilities. Client
applications would typically provide a ClientBuilder to the constructor to configure the REST client too meet their
needs.
-
Constructor Summary
ConstructorDescriptionA simple OslcClient that provides http access to unprotected resourcesOslcClient
(jakarta.ws.rs.client.ClientBuilder clientBuilder) An OslcClient that allows client applications to provide a configured (but not built) ClientBuilder typically used for supporting https, and various kinds of authentication.OslcClient
(jakarta.ws.rs.client.ClientBuilder clientBuilder, String version) An OslcClient that allows client applications to provide a configured (but not built) ClientBuilder typically used for supporting https, and various kinds of authentication.OslcClient
(jakarta.ws.rs.client.ClientBuilder clientBuilder, String version, Set<Class<?>> providers) An OslcClient that allows client applications to provide a configured (but not built) ClientBuilder typically used for supporting https, and various kinds of authentication.OslcClient
(String version) -
Method Summary
Modifier and TypeMethodDescriptionjakarta.ws.rs.core.Response
createResource
(String url, Object artifact, String mediaType) Create (POST) an artifact to a URL - usually an OSLC Creation Factoryjakarta.ws.rs.core.Response
createResource
(String url, Object artifact, String mediaType, String acceptType) Create (POST) an artifact to a URL - usually an OSLC Creation Factoryjakarta.ws.rs.core.Response
createResource
(String url, Object artifact, String mediaType, String acceptType, String configurationContext) jakarta.ws.rs.core.Response
deleteResource
(String url) Delete an OSLC resource and return the Responsejakarta.ws.rs.core.Response
deleteResource
(String url, String configurationContext) Delete an OSLC resource in the given configuration context and return the Responsejakarta.ws.rs.client.Client
Returns the JAX-RS client for this OslcClient.jakarta.ws.rs.core.Response
getResource
(String url) Gets an OSLC resource usingapplication/rdf+xml
.<T> T
getResource
(String link, Class<T> clazz) Gets an OSLC resource from a given URI string and unwraps a corresponding entity.jakarta.ws.rs.core.Response
getResource
(String url, String mediaType) Gets an OSLC resource.jakarta.ws.rs.core.Response
getResource
(String url, Map<String, String> requestHeaders) Gets an OSLC resource.jakarta.ws.rs.core.Response
jakarta.ws.rs.core.Response
getResource
(String url, Map<String, String> requestHeaders, String defaultMediaType, boolean handleRedirects) jakarta.ws.rs.core.Response
getResource
(String url, Map<String, String> requestHeaders, String defaultMediaType, String configurationContext) jakarta.ws.rs.core.Response
getResource
(String url, Map<String, String> requestHeaders, String defaultMediaType, String configurationContext, boolean handleRedirects) <T> T
getResource
(URI link, Class<T> clazz) Gets an OSLC resource from a given URI and unwraps a corresponding entity.<T> T
getResource
(Link link, Class<T> clazz) Gets an OSLC resource from a URI in a given Link and unwraps a corresponding entity.<T> List<T>
getResources
(URI[] links, Class<T> clazz) Gets OSLC resources in parallel from an array of URIs and unwraps their corresponding entities.<T> List<T>
getResources
(Collection<URI> links, Class<T> clazz) Gets OSLC resources in parallel from a collection of URIs and unwraps their corresponding entities.<T> List<T>
getResourcesFromLinks
(Collection<Link> links, Class<T> clazz) Gets OSLC resources in parallel from a set of Links and unwraps their corresponding entities.jakarta.ws.rs.client.WebTarget
getWebResource
(String capabilityUri) Create a Wink Resource for the given OslcQuery objectlookupCreationFactory
(String serviceProviderUrl, String oslcDomain, String oslcResourceType) Find the OSLC Creation Factory URL for a given OSLC resource type.lookupCreationFactory
(String serviceProviderUrl, String oslcDomain, String oslcResourceType, String oslcUsage) Find the OSLC Creation Factory URL for a given OSLC resource type and OSLC usage.lookupCreationFactoryResource
(String serviceProviderUrl, String oslcDomain, String oslcResourceType) lookupCreationFactoryResource
(String serviceProviderUrl, String oslcDomain, String oslcResourceType, String oslcUsage) lookupQueryCapability
(String serviceProviderUrl, String oslcDomain, String oslcResourceType) Find the OSLC Query Capability URL for a given OSLC resource type.lookupServiceProviderUrl
(String catalogUrl, String serviceProviderTitle) Lookup the URL of a specific OSLC Service Provider in an OSLC Catalog using the service provider's titlejakarta.ws.rs.core.Response
updateResource
(String url, Object artifact, String mediaType) Update (PUT) an artifact to a URL - usually the URL for an existing OSLC artifactjakarta.ws.rs.core.Response
updateResource
(String url, Object artifact, String mediaType, String acceptType) Update (PUT) an artifact to a URL - usually the URL for an existing OSLC artifactjakarta.ws.rs.core.Response
Update (PUT) an artifact to a URL - usually the URL for an existing OSLC artifactjakarta.ws.rs.core.Response
updateResource
(String url, Object artifact, String mediaType, String acceptType, String ifMatch, String configurationContext)
-
Constructor Details
-
OslcClient
public OslcClient()A simple OslcClient that provides http access to unprotected resources -
OslcClient
- Parameters:
version
- OSLC version, seeOSLCConstants
-
OslcClient
public OslcClient(jakarta.ws.rs.client.ClientBuilder clientBuilder) An OslcClient that allows client applications to provide a configured (but not built) ClientBuilder typically used for supporting https, and various kinds of authentication.- Parameters:
clientBuilder
- HTTP client configuration
-
OslcClient
An OslcClient that allows client applications to provide a configured (but not built) ClientBuilder typically used for supporting https, and various kinds of authentication.- Parameters:
clientBuilder
- HTTP client configurationversion
- OSLC version, seeOSLCConstants
-
OslcClient
public OslcClient(jakarta.ws.rs.client.ClientBuilder clientBuilder, String version, Set<Class<?>> providers) An OslcClient that allows client applications to provide a configured (but not built) ClientBuilder typically used for supporting https, and various kinds of authentication.- Parameters:
clientBuilder
- HTTP client configurationversion
- OSLC version, seeOSLCConstants
providers
- Set of Providers forMessageBodyReader
andMessageBodyWriter
-
-
Method Details
-
getClient
public jakarta.ws.rs.client.Client getClient()Returns the JAX-RS client for this OslcClient. Do not touch unless needed.- Specified by:
getClient
in interfaceIOslcClient
- Returns:
- the JAX-RS client
-
getResource
Gets an OSLC resource from a given URI string and unwraps a corresponding entity. -
getResource
Gets an OSLC resource from a given URI and unwraps a corresponding entity. -
getResource
Gets an OSLC resource from a URI in a given Link and unwraps a corresponding entity. -
getResources
Gets OSLC resources in parallel from an array of URIs and unwraps their corresponding entities. -
getResources
Gets OSLC resources in parallel from a collection of URIs and unwraps their corresponding entities. -
getResourcesFromLinks
Gets OSLC resources in parallel from a set of Links and unwraps their corresponding entities.Method renamed due to type erasure in Java
-
getResource
Gets an OSLC resource usingapplication/rdf+xml
. UsegetResource(String, String)
to specify the media type orgetResource(String, Map)
to add other request headers.- Specified by:
getResource
in interfaceIOslcClient
-
getResource
Gets an OSLC resource. UsegetResource(String, Map)
instead to add other request headers.- Specified by:
getResource
in interfaceIOslcClient
- Parameters:
url
- the resource URLmediaType
- the requested media type to use in the HTTP Accept request header
-
getResource
Gets an OSLC resource.- Specified by:
getResource
in interfaceIOslcClient
- Parameters:
url
- the resource URLrequestHeaders
- the HTTP request headers to use. If theAccept
header is not in the map, it defaults toapplication/rdf+xml
. IfOSLC-Core-Version
is not in the map, it defaults to2.0
.
-
getResource
public jakarta.ws.rs.core.Response getResource(String url, Map<String, String> requestHeaders, String defaultMediaType) - Specified by:
getResource
in interfaceIOslcClient
-
getResource
public jakarta.ws.rs.core.Response getResource(String url, Map<String, String> requestHeaders, String defaultMediaType, String configurationContext) - Specified by:
getResource
in interfaceIOslcClient
-
getResource
public jakarta.ws.rs.core.Response getResource(String url, Map<String, String> requestHeaders, String defaultMediaType, boolean handleRedirects) - Specified by:
getResource
in interfaceIOslcClient
-
getResource
public jakarta.ws.rs.core.Response getResource(String url, Map<String, String> requestHeaders, String defaultMediaType, String configurationContext, boolean handleRedirects) - Specified by:
getResource
in interfaceIOslcClient
-
deleteResource
Delete an OSLC resource and return the Response- Specified by:
deleteResource
in interfaceIOslcClient
- Parameters:
url
-
-
deleteResource
Delete an OSLC resource in the given configuration context and return the Response- Specified by:
deleteResource
in interfaceIOslcClient
-
createResource
Create (POST) an artifact to a URL - usually an OSLC Creation Factory- Specified by:
createResource
in interfaceIOslcClient
-
createResource
public jakarta.ws.rs.core.Response createResource(String url, Object artifact, String mediaType, String acceptType) Create (POST) an artifact to a URL - usually an OSLC Creation Factory- Specified by:
createResource
in interfaceIOslcClient
-
createResource
public jakarta.ws.rs.core.Response createResource(String url, Object artifact, String mediaType, String acceptType, String configurationContext) - Specified by:
createResource
in interfaceIOslcClient
-
updateResource
Update (PUT) an artifact to a URL - usually the URL for an existing OSLC artifact- Specified by:
updateResource
in interfaceIOslcClient
-
updateResource
public jakarta.ws.rs.core.Response updateResource(String url, Object artifact, String mediaType, String acceptType) Update (PUT) an artifact to a URL - usually the URL for an existing OSLC artifact- Specified by:
updateResource
in interfaceIOslcClient
-
updateResource
public jakarta.ws.rs.core.Response updateResource(String url, Object artifact, String mediaType, String acceptType, String ifMatch) Update (PUT) an artifact to a URL - usually the URL for an existing OSLC artifact- Specified by:
updateResource
in interfaceIOslcClient
-
updateResource
public jakarta.ws.rs.core.Response updateResource(String url, Object artifact, String mediaType, String acceptType, String ifMatch, String configurationContext) - Specified by:
updateResource
in interfaceIOslcClient
-
getWebResource
Create a Wink Resource for the given OslcQuery object -
lookupServiceProviderUrl
public String lookupServiceProviderUrl(String catalogUrl, String serviceProviderTitle) throws IOException, URISyntaxException, ResourceNotFoundException Lookup the URL of a specific OSLC Service Provider in an OSLC Catalog using the service provider's title -
lookupQueryCapability
public String lookupQueryCapability(String serviceProviderUrl, String oslcDomain, String oslcResourceType) throws IOException, URISyntaxException, ResourceNotFoundException Find the OSLC Query Capability URL for a given OSLC resource type. If no resource type is given, returns the default Query Capability, if it exists.- Parameters:
oslcResourceType
- - the resource type of the desired query capability. This may differ from the OSLC artifact type.- Returns:
- URL of requested Query Capability or null if not found.
- Throws:
IOException
URISyntaxException
ResourceNotFoundException
-
lookupCreationFactoryResource
public CreationFactory lookupCreationFactoryResource(String serviceProviderUrl, String oslcDomain, String oslcResourceType) throws IOException, URISyntaxException, ResourceNotFoundException -
lookupCreationFactoryResource
public CreationFactory lookupCreationFactoryResource(String serviceProviderUrl, String oslcDomain, String oslcResourceType, String oslcUsage) throws IOException, URISyntaxException, ResourceNotFoundException -
lookupCreationFactory
public String lookupCreationFactory(String serviceProviderUrl, String oslcDomain, String oslcResourceType) throws IOException, URISyntaxException, ResourceNotFoundException Find the OSLC Creation Factory URL for a given OSLC resource type. If no resource type is given, returns the default Creation Factory, if it exists.- Parameters:
oslcResourceType
- - the resource type of the desired query capability. This may differ from the OSLC artifact type.- Returns:
- URL of requested Creation Factory or null if not found.
- Throws:
IOException
URISyntaxException
ResourceNotFoundException
-
lookupCreationFactory
public String lookupCreationFactory(String serviceProviderUrl, String oslcDomain, String oslcResourceType, String oslcUsage) throws IOException, URISyntaxException, ResourceNotFoundException Find the OSLC Creation Factory URL for a given OSLC resource type and OSLC usage. If no resource type is given, returns the default Creation Factory, if it exists.- Parameters:
oslcResourceType
- - the resource type of the desired query capability. This may differ from the OSLC artifact type.- Returns:
- URL of requested Creation Factory or null if not found.
- Throws:
IOException
URISyntaxException
ResourceNotFoundException
-