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:
IOExceptionnet.oauth.OAuthExceptionURISyntaxException
-
getClient
Description copied from interface:IOslcClientReturns the JAX-RS client for this OslcClient. Do not touch unless needed.- Specified by:
getClientin interfaceIOslcClient- Returns:
- the JAX-RS client
-
getResource
Description copied from interface:IOslcClientGets 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:
getResourcein interfaceIOslcClient
-
getResource
Description copied from interface:IOslcClientGets an OSLC resource. UseIOslcClient.getResource(String, Map)instead to add other request headers.- Specified by:
getResourcein interfaceIOslcClient- Parameters:
url- the resource URLmediaType- the requested media type to use in the HTTP Accept request header
-
getResource
Description copied from interface:IOslcClientGets an OSLC resource.- Specified by:
getResourcein interfaceIOslcClient- Parameters:
url- the resource URLrequestHeaders- the HTTP request headers to use. If theAcceptheader is not in the map, it defaults toapplication/rdf+xml. IfOSLC-Core-Versionis not in the map, it defaults to2.0.
-
getResource
- Specified by:
getResourcein interfaceIOslcClient
-
getResource
public Response getResource(String url, Map<String, String> requestHeaders, String mediaType, String configurationContext) - Specified by:
getResourcein interfaceIOslcClient
-
getResource
public Response getResource(String url, Map<String, String> requestHeaders, String mediaType, boolean handleRedirects) - Specified by:
getResourcein interfaceIOslcClient
-
getResource
public Response getResource(String url, Map<String, String> requestHeaders, String mediaType, String configurationContext, boolean handleRedirects) - Specified by:
getResourcein interfaceIOslcClient
-
deleteResource
Description copied from interface:IOslcClientDelete an OSLC resource and return a Wink ClientResponse- Specified by:
deleteResourcein interfaceIOslcClient
-
deleteResource
- Specified by:
deleteResourcein interfaceIOslcClient
-
createResource
Description copied from interface:IOslcClientCreate (POST) an artifact to a URL - usually an OSLC Creation Factory- Specified by:
createResourcein interfaceIOslcClient
-
createResource
Description copied from interface:IOslcClientCreate (POST) an artifact to a URL - usually an OSLC Creation Factory- Specified by:
createResourcein interfaceIOslcClient
-
createResource
public Response createResource(String url, Object artifact, String mediaType, String acceptType, String configurationContext) - Specified by:
createResourcein interfaceIOslcClient
-
updateResource
Description copied from interface:IOslcClientUpdate (PUT) an artifact to a URL - usually the URL for an existing OSLC artifact- Specified by:
updateResourcein interfaceIOslcClient
-
updateResource
Description copied from interface:IOslcClientUpdate (PUT) an artifact to a URL - usually the URL for an existing OSLC artifact- Specified by:
updateResourcein interfaceIOslcClient
-
updateResource
public Response updateResource(String url, Object artifact, String mediaType, String acceptType, String ifMatch) Description copied from interface:IOslcClientUpdate (PUT) an artifact to a URL - usually the URL for an existing OSLC artifact- Specified by:
updateResourcein interfaceIOslcClient
-
updateResource
public Response updateResource(String url, Object artifact, String mediaType, String acceptType, String ifMatch, String configurationContext) - Specified by:
updateResourcein interfaceIOslcClient
-