org.eclipse.lyo.client.oslc

## Class OslcOAuthClient

- java.lang.Object
- - org.eclipse.lyo.client.oslc.OslcClient
  - - org.eclipse.lyo.client.oslc.OslcOAuthClient

-     public class OslcOAuthClient
      extends OslcClient

- - ### Nested Class Summary

    - ### Nested classes/interfaces inherited from class org.eclipse.lyo.client.oslc.OslcClient

      `OslcClient.OAuthHttpPool`

  - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected net.oauth.OAuthAccessor` | `accessor`

    - ### Fields inherited from class org.eclipse.lyo.client.oslc.OslcClient

      `httpClient`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `OslcOAuthClient(String consumerKey, String consumerSecret)` Creates a two-legged OAuth client.
    `OslcOAuthClient(String requestTokenURL, String authorizationTokenURL, String accessTokenURL, String consumerKey, String consumerSecret)` Initialize an OAuthClient with the required OAuth URLs
    `OslcOAuthClient(String requestTokenURL, String authorizationTokenURL, String accessTokenURL, String consumerKey, String consumerSecret, String oauthRealmName)`
    `OslcOAuthClient(String requestTokenURL, String authorizationTokenURL, String accessTokenURL, String consumerKey, String consumerSecret, String oauthRealmName, String callback)`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `org.apache.wink.client.ClientResponse` | `createResource(String url, Object artifact, String mediaType, String acceptType)` Create (POST) an artifact to a URL - usually an OSLC Creation Factory
    `org.apache.wink.client.ClientResponse` | `getResource(String url, String mediaType)` Gets an OSLC resource.
    `protected net.oauth.OAuthMessage` | `getResourceInternal(String url, String httpMethod, boolean restart)` Performs necessary OAuth negotiation.
    `protected boolean` | `isTwoLegged()` Are we using two-legged OAuth?
    `org.apache.wink.client.ClientResponse` | `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

    - ### Methods inherited from class org.eclipse.lyo.client.oslc.OslcClient

      `createResource, deleteResource, getClientConfig, getClientPool, getConfiguredSecureSocketProtocol, getHttpClient, getQueryResource, getResource, getResource, getResource, lookupCreationFactory, lookupCreationFactory, lookupCreationFactoryResource, lookupCreationFactoryResource, lookupQueryCapability, lookupServiceProviderUrl, setConfiguredSecureSocketProtocol, updateResource, updateResource`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Field Detail

    - #### accessor

          protected net.oauth.OAuthAccessor accessor

  - ### Constructor Detail

    - #### OslcOAuthClient

          public OslcOAuthClient(String requestTokenURL,
                         String authorizationTokenURL,
                         String accessTokenURL,
                         String consumerKey,
                         String consumerSecret)

      Initialize an OAuthClient with the required OAuth URLs
      Parameters:
        `requestTokenURL` -
        `authorizationTokenURL` -
        `accessTokenURL` -
        `consumerKey` -
        `consumerSecret` -

    - #### OslcOAuthClient

          public OslcOAuthClient(String requestTokenURL,
                         String authorizationTokenURL,
                         String accessTokenURL,
                         String consumerKey,
                         String consumerSecret,
                         String oauthRealmName)

    - #### OslcOAuthClient

          public OslcOAuthClient(String requestTokenURL,
                         String authorizationTokenURL,
                         String accessTokenURL,
                         String consumerKey,
                         String consumerSecret,
                         String oauthRealmName,
                         String callback)

    - #### OslcOAuthClient

          public OslcOAuthClient(String consumerKey,
                         String consumerSecret)

      Creates a two-legged OAuth client. This will only work if the server supports two-legged OAuth and a functional user has been assigned for this OAuth consumer.
      Parameters:
        `consumerKey` - the OAuth consumer key
        `consumerSecret` - the OAuth consumer secret

  - ### Method Detail

    - #### getResource

          public org.apache.wink.client.ClientResponse getResource(String url,
                                                          String mediaType)
                                                            throws IOException,
                                                                   net.oauth.OAuthException,
                                                                   URISyntaxException

      Description copied from class: `OslcClient`
      Gets an OSLC resource. Use `OslcClient.getResource(String, Map)` instead to add other request headers. Call `ClientResponse.getEntity(Class)` on the response to get the OSLC4J-annotated Java object.
      Overrides:
        `getResource` in class `OslcClient`
      Parameters:
        `url` - the resource URL
        `mediaType` - the requested media type to use in the HTTP Accept request header
      Returns:
        the Apache Wink ClientResponse
      Throws:
        `IOException`
        `net.oauth.OAuthException`
        `URISyntaxException`

    - #### updateResource

          public org.apache.wink.client.ClientResponse updateResource(String url,
                                                             Object artifact,
                                                             String mediaType,
                                                             String acceptType,
                                                             String ifMatch)
                                                               throws IOException,
                                                                      net.oauth.OAuthException,
                                                                      URISyntaxException

      Description copied from class: `OslcClient`
      Update (PUT) an artifact to a URL - usually the URL for an existing OSLC artifact
      Overrides:
        `updateResource` in class `OslcClient`
      Returns:
      Throws:
        `IOException`
        `net.oauth.OAuthException`
        `URISyntaxException`

    - #### createResource

          public org.apache.wink.client.ClientResponse createResource(String url,
                                                             Object artifact,
                                                             String mediaType,
                                                             String acceptType)
                                                               throws IOException,
                                                                      net.oauth.OAuthException,
                                                                      URISyntaxException

      Create (POST) an artifact to a URL - usually an OSLC Creation Factory
      Overrides:
        `createResource` in class `OslcClient`
      Parameters:
        `url` -
        `artifact` -
        `mediaType` -
        `acceptType` -
      Returns:
      Throws:
        `URISyntaxException`
        `net.oauth.OAuthException`
        `IOException`

    - #### getResourceInternal

          protected net.oauth.OAuthMessage getResourceInternal(String url,
                                                   String httpMethod,
                                                   boolean restart)
                                                        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:
        `url` -
        `httpMethod` -
        `restart` -
      Returns:
      Throws:
        `IOException`
        `net.oauth.OAuthException`
        `URISyntaxException`

    - #### isTwoLegged

          protected boolean isTwoLegged()

      Are we using two-legged OAuth?
      Returns:
        true if this is a two-legged OAuth consumer

Copyright © 2016. All Rights Reserved.