Package org.eclipse.lyo.client
Class OslcOAuthClient
java.lang.Object
org.eclipse.lyo.client.OslcOAuthClient
- All Implemented Interfaces:
IOslcClient
-
Constructor Summary
ConstructorsConstructorDescriptionOslcOAuthClient
(net.oauth.OAuthAccessor accessor, String realm, ClientBuilder clientBuilder, UnderlyingHttpClient underlyingHttpClient) Initialize an OAuthClient with the required OAuth URLs -
Method Summary
Modifier and TypeMethodDescriptioncreateResource
(String url, Object artifact, String mediaType) Create (POST) an artifact to a URL - usually an OSLC Creation FactorycreateResource
(String url, Object artifact, String mediaType, String acceptType) Create (POST) an artifact to a URL - usually an OSLC Creation FactorycreateResource
(String url, Object artifact, String mediaType, String acceptType, String configurationContext) deleteResource
(String url) Delete an OSLC resource and return a Wink ClientResponsedeleteResource
(String url, String configurationContext) Returns the JAX-RS client for this OslcClient.getResource
(String url) Gets an OSLC resource usingapplication/rdf+xml
.getResource
(String url, String mediaType) Gets an OSLC resource.getResource
(String url, Map<String, String> requestHeaders) Gets an OSLC resource.getResource
(String url, Map<String, String> requestHeaders, String mediaType, boolean handleRedirects) getResource
(String url, Map<String, String> requestHeaders, String mediaType, String configurationContext) getResource
(String url, Map<String, String> requestHeaders, String mediaType, String configurationContext, boolean handleRedirects) performOAuthNegotiation
(String callbackURL) Performs necessary OAuth negotiationupdateResource
(String url, Object artifact, String mediaType) Update (PUT) an artifact to a URL - usually the URL for an existing OSLC artifactupdateResource
(String url, Object artifact, String mediaType, String acceptType) Update (PUT) an artifact to a URL - usually the URL for an existing OSLC artifactUpdate (PUT) an artifact to a URL - usually the URL for an existing OSLC artifactupdateResource
(String url, Object artifact, String mediaType, String acceptType, String ifMatch, String configurationContext)
-
Constructor Details
-
OslcOAuthClient
public OslcOAuthClient(net.oauth.OAuthAccessor accessor, String realm, ClientBuilder clientBuilder, UnderlyingHttpClient underlyingHttpClient) Initialize an OAuthClient with the required OAuth URLs
-
-
Method Details
-
getOslcClient
-
performOAuthNegotiation
public Optional<String> performOAuthNegotiation(String callbackURL) throws IOException, net.oauth.OAuthException, URISyntaxException Performs necessary OAuth negotiation. - get request token - throw redirect exception to authorization URL (and print message) - exchange request token for access token - access protected URL and return OAuthMessage- Parameters:
callbackURL
-- Returns:
- Throws:
IOException
net.oauth.OAuthException
URISyntaxException
-
getClient
Description copied from interface:IOslcClient
Returns the JAX-RS client for this OslcClient. Do not touch unless needed.- Specified by:
getClient
in interfaceIOslcClient
- Returns:
- the JAX-RS client
-
getResource
Description copied from interface:IOslcClient
Gets an OSLC resource usingapplication/rdf+xml
. UseIOslcClient.getResource(String, String)
to specify the media type orIOslcClient.getResource(String, Map)
to add other request headers.- Specified by:
getResource
in interfaceIOslcClient
-
getResource
Description copied from interface:IOslcClient
Gets an OSLC resource. UseIOslcClient.getResource(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
Description copied from interface:IOslcClient
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
- Specified by:
getResource
in interfaceIOslcClient
-
getResource
public Response getResource(String url, Map<String, String> requestHeaders, String mediaType, String configurationContext) - Specified by:
getResource
in interfaceIOslcClient
-
getResource
public Response getResource(String url, Map<String, String> requestHeaders, String mediaType, boolean handleRedirects) - Specified by:
getResource
in interfaceIOslcClient
-
getResource
public Response getResource(String url, Map<String, String> requestHeaders, String mediaType, String configurationContext, boolean handleRedirects) - Specified by:
getResource
in interfaceIOslcClient
-
deleteResource
Description copied from interface:IOslcClient
Delete an OSLC resource and return a Wink ClientResponse- Specified by:
deleteResource
in interfaceIOslcClient
-
deleteResource
- Specified by:
deleteResource
in interfaceIOslcClient
-
createResource
Description copied from interface:IOslcClient
Create (POST) an artifact to a URL - usually an OSLC Creation Factory- Specified by:
createResource
in interfaceIOslcClient
-
createResource
Description copied from interface:IOslcClient
Create (POST) an artifact to a URL - usually an OSLC Creation Factory- Specified by:
createResource
in interfaceIOslcClient
-
createResource
public Response createResource(String url, Object artifact, String mediaType, String acceptType, String configurationContext) - Specified by:
createResource
in interfaceIOslcClient
-
updateResource
Description copied from interface:IOslcClient
Update (PUT) an artifact to a URL - usually the URL for an existing OSLC artifact- Specified by:
updateResource
in interfaceIOslcClient
-
updateResource
Description copied from interface:IOslcClient
Update (PUT) an artifact to a URL - usually the URL for an existing OSLC artifact- Specified by:
updateResource
in interfaceIOslcClient
-
updateResource
public Response updateResource(String url, Object artifact, String mediaType, String acceptType, String ifMatch) Description copied from interface:IOslcClient
Update (PUT) an artifact to a URL - usually the URL for an existing OSLC artifact- Specified by:
updateResource
in interfaceIOslcClient
-
updateResource
public Response updateResource(String url, Object artifact, String mediaType, String acceptType, String ifMatch, String configurationContext) - Specified by:
updateResource
in interfaceIOslcClient
-