org.eclipse.lyo.client.oslc
Class OslcClient

java.lang.Object
  extended by org.eclipse.lyo.client.oslc.OslcClient
Direct Known Subclasses:
JazzFormAuthClient, OslcOAuthClient

public class OslcClient
extends Object

An OSLC Client. Provides an Apache HttpClient, an Apache Wink REST ClientConfig and defines a getResource method which returns an Apache Wink ClientResponse. This class is not currently thread safe.


Nested Class Summary
protected  class OslcClient.OAuthHttpPool
           
 
Field Summary
protected  org.apache.http.impl.client.DefaultHttpClient httpClient
           
 
Constructor Summary
OslcClient()
          Initialize a new OslcClient using an Apache Http Components 4 Http client and configuration.
OslcClient(TrustManager[] trustManagers, org.apache.http.conn.ssl.X509HostnameVerifier hostnameVerifier)
          Initialize a new OslcClient using an Apache Http Components 4 Http client and configuration.
 
Method Summary
 org.apache.wink.client.ClientResponse createResource(String url, Object artifact, String mediaType)
          Create (POST) an artifact to a URL - usually an OSLC Creation Factory
 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 deleteResource(String url)
          Delete an OSLC resource and return a Wink ClientResponse
protected  org.apache.wink.client.ClientConfig getClientConfig()
           
protected  net.oauth.client.httpclient4.HttpClientPool getClientPool()
           
 String getConfiguredSecureSocketProtocol()
          Sets the Secure Socket Protocol to be used, valid values "TLS","SSL","SSL_TLS".
 org.apache.http.client.HttpClient getHttpClient()
          Returns the HTTP client associated with this OSLC Client
 org.apache.wink.client.Resource getQueryResource(OslcQuery query)
          Create a Wink Resource for the given OslcQuery object
 org.apache.wink.client.ClientResponse getResource(String url, String mediaType)
          Abstract method get an OSLC resource and return a Wink ClientResponse
 String lookupCreationFactory(String serviceProviderUrl, String oslcDomain, String oslcResourceType)
          Find the OSLC Creation Factory URL for a given OSLC resource type.
 String lookupCreationFactory(String serviceProviderUrl, String oslcDomain, String oslcResourceType, String oslcUsage)
          Find the OSLC Creation Factory URL for a given OSLC resource type and OSLC usage.
 org.eclipse.lyo.oslc4j.core.model.CreationFactory lookupCreationFactoryResource(String serviceProviderUrl, String oslcDomain, String oslcResourceType)
           
 org.eclipse.lyo.oslc4j.core.model.CreationFactory lookupCreationFactoryResource(String serviceProviderUrl, String oslcDomain, String oslcResourceType, String oslcUsage)
           
 String lookupQueryCapability(String serviceProviderUrl, String oslcDomain, String oslcResourceType)
          Find the OSLC Query Capability URL for a given OSLC resource type.
 String lookupServiceProviderUrl(String catalogUrl, String serviceProviderTitle)
          Lookup the URL of a specific OSLC Service Provider in an OSLC Catalog using the service provider's title
 void setConfiguredSecureSocketProtocol(String configuredSecureSocketProtocol)
          Returns theSecure Sockect Protocol associated with this OSLC Client
 org.apache.wink.client.ClientResponse updateResource(String url, Object artifact, String mediaType)
          Update (PUT) an artifact to a URL - usually the URL for an existing OSLC artifact
 org.apache.wink.client.ClientResponse updateResource(String url, Object artifact, String mediaType, String acceptType)
          Update (PUT) an artifact to a URL - usually the URL for an existing OSLC artifact
 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 java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

httpClient

protected org.apache.http.impl.client.DefaultHttpClient httpClient
Constructor Detail

OslcClient

public OslcClient()
Initialize a new OslcClient using an Apache Http Components 4 Http client and configuration.


OslcClient

public OslcClient(TrustManager[] trustManagers,
                  org.apache.http.conn.ssl.X509HostnameVerifier hostnameVerifier)
Initialize a new OslcClient using an Apache Http Components 4 Http client and configuration. Use the provided TrustManagers and X509HostnameVerifiers instead of the defaults which do no verification;

Method Detail

getConfiguredSecureSocketProtocol

public String getConfiguredSecureSocketProtocol()
Sets the Secure Socket Protocol to be used, valid values "TLS","SSL","SSL_TLS".


setConfiguredSecureSocketProtocol

public void setConfiguredSecureSocketProtocol(String configuredSecureSocketProtocol)
Returns theSecure Sockect Protocol associated with this OSLC Client


getHttpClient

public org.apache.http.client.HttpClient getHttpClient()
Returns the HTTP client associated with this OSLC Client

Returns:
the HTTP client

getClientPool

protected net.oauth.client.httpclient4.HttpClientPool getClientPool()

getClientConfig

protected org.apache.wink.client.ClientConfig getClientConfig()

getResource

public org.apache.wink.client.ClientResponse getResource(String url,
                                                         String mediaType)
                                                  throws IOException,
                                                         net.oauth.OAuthException,
                                                         URISyntaxException
Abstract method get an OSLC resource and return a Wink ClientResponse

Parameters:
url -
method -
mediaType -
Returns:
a Wink ClientResponse
Throws:
IOException
net.oauth.OAuthException
URISyntaxException

deleteResource

public org.apache.wink.client.ClientResponse deleteResource(String url)
                                                     throws IOException,
                                                            net.oauth.OAuthException,
                                                            URISyntaxException
Delete an OSLC resource and return a Wink ClientResponse

Parameters:
url -
Returns:
a Wink ClientResponse
Throws:
IOException
net.oauth.OAuthException
URISyntaxException

createResource

public org.apache.wink.client.ClientResponse createResource(String url,
                                                            Object artifact,
                                                            String mediaType)
                                                     throws IOException,
                                                            net.oauth.OAuthException,
                                                            URISyntaxException
Create (POST) an artifact to a URL - usually an OSLC Creation Factory

Parameters:
url -
artifact -
mediaType -
Returns:
Throws:
URISyntaxException
net.oauth.OAuthException
IOException

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

Parameters:
url -
artifact -
mediaType -
acceptType -
Returns:
Throws:
URISyntaxException
net.oauth.OAuthException
IOException

updateResource

public org.apache.wink.client.ClientResponse updateResource(String url,
                                                            Object artifact,
                                                            String mediaType)
Update (PUT) an artifact to a URL - usually the URL for an existing OSLC artifact

Parameters:
url -
artifact -
mediaType -
Returns:

updateResource

public org.apache.wink.client.ClientResponse updateResource(String url,
                                                            Object artifact,
                                                            String mediaType,
                                                            String acceptType)
Update (PUT) an artifact to a URL - usually the URL for an existing OSLC artifact

Parameters:
url -
artifact -
mediaType -
acceptType -
Returns:

updateResource

public org.apache.wink.client.ClientResponse updateResource(String url,
                                                            Object artifact,
                                                            String mediaType,
                                                            String acceptType,
                                                            String ifMatch)
                                                     throws IOException,
                                                            net.oauth.OAuthException,
                                                            URISyntaxException
Update (PUT) an artifact to a URL - usually the URL for an existing OSLC artifact

Parameters:
url -
artifact -
mediaType -
acceptType -
Returns:
Throws:
URISyntaxException
net.oauth.OAuthException
IOException

getQueryResource

public org.apache.wink.client.Resource getQueryResource(OslcQuery query)
Create a Wink Resource for the given OslcQuery object

Parameters:
query -
Returns:

lookupServiceProviderUrl

public String lookupServiceProviderUrl(String catalogUrl,
                                       String serviceProviderTitle)
                                throws IOException,
                                       net.oauth.OAuthException,
                                       URISyntaxException,
                                       ResourceNotFoundException
Lookup the URL of a specific OSLC Service Provider in an OSLC Catalog using the service provider's title

Parameters:
catalogUrl -
serviceProviderTitle -
Returns:
Throws:
IOException
net.oauth.OAuthException
URISyntaxException
ResourceNotFoundException

lookupQueryCapability

public String lookupQueryCapability(String serviceProviderUrl,
                                    String oslcDomain,
                                    String oslcResourceType)
                             throws IOException,
                                    net.oauth.OAuthException,
                                    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:
serviceProviderUrl -
oslcDomain -
oslcResourceType - - the resource type of the desired query capability. This may differ from the OSLC artifact type.
Returns:
URL of requested Query Capablility or null if not found.
Throws:
IOException
net.oauth.OAuthException
URISyntaxException
ResourceNotFoundException

lookupCreationFactoryResource

public org.eclipse.lyo.oslc4j.core.model.CreationFactory lookupCreationFactoryResource(String serviceProviderUrl,
                                                                                       String oslcDomain,
                                                                                       String oslcResourceType)
                                                                                throws IOException,
                                                                                       net.oauth.OAuthException,
                                                                                       URISyntaxException,
                                                                                       ResourceNotFoundException
Throws:
IOException
net.oauth.OAuthException
URISyntaxException
ResourceNotFoundException

lookupCreationFactoryResource

public org.eclipse.lyo.oslc4j.core.model.CreationFactory lookupCreationFactoryResource(String serviceProviderUrl,
                                                                                       String oslcDomain,
                                                                                       String oslcResourceType,
                                                                                       String oslcUsage)
                                                                                throws IOException,
                                                                                       net.oauth.OAuthException,
                                                                                       URISyntaxException,
                                                                                       ResourceNotFoundException
Throws:
IOException
net.oauth.OAuthException
URISyntaxException
ResourceNotFoundException

lookupCreationFactory

public String lookupCreationFactory(String serviceProviderUrl,
                                    String oslcDomain,
                                    String oslcResourceType)
                             throws IOException,
                                    net.oauth.OAuthException,
                                    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:
serviceProviderUrl -
oslcDomain -
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
net.oauth.OAuthException
URISyntaxException
ResourceNotFoundException

lookupCreationFactory

public String lookupCreationFactory(String serviceProviderUrl,
                                    String oslcDomain,
                                    String oslcResourceType,
                                    String oslcUsage)
                             throws IOException,
                                    net.oauth.OAuthException,
                                    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:
serviceProviderUrl -
oslcDomain -
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
net.oauth.OAuthException
URISyntaxException
ResourceNotFoundException


Copyright © 2014. All Rights Reserved.