org.apache.camel.component.salesforce.internal.client
Class DefaultRestClient

java.lang.Object
  extended by org.apache.camel.component.salesforce.internal.client.AbstractClientBase
      extended by org.apache.camel.component.salesforce.internal.client.DefaultRestClient
All Implemented Interfaces:
RestClient, SalesforceSession.SalesforceSessionListener, org.apache.camel.Service

public class DefaultRestClient
extends AbstractClientBase
implements RestClient


Nested Class Summary
 
Nested classes/interfaces inherited from class org.apache.camel.component.salesforce.internal.client.AbstractClientBase
AbstractClientBase.ClientResponseCallback
 
Nested classes/interfaces inherited from interface org.apache.camel.component.salesforce.internal.client.RestClient
RestClient.ResponseCallback
 
Field Summary
protected  PayloadFormat format
           
 
Fields inherited from class org.apache.camel.component.salesforce.internal.client.AbstractClientBase
accessToken, APPLICATION_JSON_UTF8, APPLICATION_XML_UTF8, httpClient, instanceUrl, log, session, version
 
Constructor Summary
DefaultRestClient(org.eclipse.jetty.client.HttpClient httpClient, String version, PayloadFormat format, SalesforceSession session)
           
 
Method Summary
protected  SalesforceException createRestException(org.eclipse.jetty.client.ContentExchange httpExchange)
           
 void createSObject(String sObjectName, InputStream sObject, RestClient.ResponseCallback callback)
          Creates a record for the specified object.
 void deleteSObject(String sObjectName, String id, RestClient.ResponseCallback callback)
          Deletes a record for the specified object ID.
 void deleteSObjectWithId(String sObjectName, String fieldName, String fieldValue, RestClient.ResponseCallback callback)
          Deletes a record based on the value of a specified external ID field.
protected  void doHttpRequest(org.eclipse.jetty.client.ContentExchange request, AbstractClientBase.ClientResponseCallback callback)
           
 void getBasicInfo(String sObjectName, RestClient.ResponseCallback callback)
          Describes the individual metadata for the specified object.
 void getBlobField(String sObjectName, String id, String blobFieldName, RestClient.ResponseCallback callback)
          Retrieves the specified blob field from an individual record.
 void getDescription(String sObjectName, RestClient.ResponseCallback callback)
          Completely describes the individual metadata at all levels for the specified object.
 void getGlobalObjects(RestClient.ResponseCallback callback)
          Lists the available objects and their metadata for your organization's data.
 void getResources(RestClient.ResponseCallback callback)
          Lists available resources for the specified API version, including resource name and URI.
 void getSObject(String sObjectName, String id, String[] fields, RestClient.ResponseCallback callback)
          Retrieves a record for the specified object ID.
 void getSObjectWithId(String sObjectName, String fieldName, String fieldValue, RestClient.ResponseCallback callback)
          Retrieves a record for the specified external ID.
 void getVersions(RestClient.ResponseCallback callback)
          Lists summary information about each API version currently available, including the version, label, and a link to each version's root.
 void query(String soqlQuery, RestClient.ResponseCallback callback)
          Executes the specified SOQL query.
 void queryMore(String nextRecordsUrl, RestClient.ResponseCallback callback)
          Get SOQL query results using nextRecordsUrl.
 void search(String soslQuery, RestClient.ResponseCallback callback)
          Executes the specified SOSL search.
protected  void setAccessToken(org.eclipse.jetty.client.HttpExchange httpExchange)
           
 void updateSObject(String sObjectName, String id, InputStream sObject, RestClient.ResponseCallback callback)
          Updates a record for the specified object ID.
 void upsertSObject(String sObjectName, String fieldName, String fieldValue, InputStream sObject, RestClient.ResponseCallback callback)
          Creates or updates a record based on the value of a specified external ID field.
 
Methods inherited from class org.apache.camel.component.salesforce.internal.client.AbstractClientBase
getContentExchange, onLogin, onLogout, setAccessToken, setInstanceUrl, start, stop
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

format

protected PayloadFormat format
Constructor Detail

DefaultRestClient

public DefaultRestClient(org.eclipse.jetty.client.HttpClient httpClient,
                         String version,
                         PayloadFormat format,
                         SalesforceSession session)
                  throws SalesforceException
Throws:
SalesforceException
Method Detail

doHttpRequest

protected void doHttpRequest(org.eclipse.jetty.client.ContentExchange request,
                             AbstractClientBase.ClientResponseCallback callback)
Overrides:
doHttpRequest in class AbstractClientBase

createRestException

protected SalesforceException createRestException(org.eclipse.jetty.client.ContentExchange httpExchange)
Specified by:
createRestException in class AbstractClientBase

getVersions

public void getVersions(RestClient.ResponseCallback callback)
Description copied from interface: RestClient
Lists summary information about each API version currently available, including the version, label, and a link to each version's root.

Specified by:
getVersions in interface RestClient
Parameters:
callback - RestClient.ResponseCallback to handle response or exception

getResources

public void getResources(RestClient.ResponseCallback callback)
Description copied from interface: RestClient
Lists available resources for the specified API version, including resource name and URI.

Specified by:
getResources in interface RestClient
Parameters:
callback - RestClient.ResponseCallback to handle response or exception

getGlobalObjects

public void getGlobalObjects(RestClient.ResponseCallback callback)
Description copied from interface: RestClient
Lists the available objects and their metadata for your organization's data.

Specified by:
getGlobalObjects in interface RestClient
Parameters:
callback - RestClient.ResponseCallback to handle response or exception

getBasicInfo

public void getBasicInfo(String sObjectName,
                         RestClient.ResponseCallback callback)
Description copied from interface: RestClient
Describes the individual metadata for the specified object.

Specified by:
getBasicInfo in interface RestClient
Parameters:
sObjectName - specified object name
callback - RestClient.ResponseCallback to handle response or exception

getDescription

public void getDescription(String sObjectName,
                           RestClient.ResponseCallback callback)
Description copied from interface: RestClient
Completely describes the individual metadata at all levels for the specified object.

Specified by:
getDescription in interface RestClient
Parameters:
sObjectName - specified object name
callback - RestClient.ResponseCallback to handle response or exception

getSObject

public void getSObject(String sObjectName,
                       String id,
                       String[] fields,
                       RestClient.ResponseCallback callback)
Description copied from interface: RestClient
Retrieves a record for the specified object ID.

Specified by:
getSObject in interface RestClient
Parameters:
sObjectName - specified object name
id - object id
callback - RestClient.ResponseCallback to handle response or exception

createSObject

public void createSObject(String sObjectName,
                          InputStream sObject,
                          RestClient.ResponseCallback callback)
Description copied from interface: RestClient
Creates a record for the specified object.

Specified by:
createSObject in interface RestClient
Parameters:
sObjectName - specified object name
sObject - request entity
callback - RestClient.ResponseCallback to handle response or exception

updateSObject

public void updateSObject(String sObjectName,
                          String id,
                          InputStream sObject,
                          RestClient.ResponseCallback callback)
Description copied from interface: RestClient
Updates a record for the specified object ID.

Specified by:
updateSObject in interface RestClient
Parameters:
sObjectName - specified object name
id - object id
sObject - request entity
callback - RestClient.ResponseCallback to handle response or exception

deleteSObject

public void deleteSObject(String sObjectName,
                          String id,
                          RestClient.ResponseCallback callback)
Description copied from interface: RestClient
Deletes a record for the specified object ID.

Specified by:
deleteSObject in interface RestClient
Parameters:
sObjectName - specified object name
id - object id
callback - RestClient.ResponseCallback to handle response or exception

getSObjectWithId

public void getSObjectWithId(String sObjectName,
                             String fieldName,
                             String fieldValue,
                             RestClient.ResponseCallback callback)
Description copied from interface: RestClient
Retrieves a record for the specified external ID.

Specified by:
getSObjectWithId in interface RestClient
Parameters:
sObjectName - specified object name
fieldName - external field name
fieldValue - external field value
callback - RestClient.ResponseCallback to handle response or exception

upsertSObject

public void upsertSObject(String sObjectName,
                          String fieldName,
                          String fieldValue,
                          InputStream sObject,
                          RestClient.ResponseCallback callback)
Description copied from interface: RestClient
Creates or updates a record based on the value of a specified external ID field.

Specified by:
upsertSObject in interface RestClient
Parameters:
sObjectName - specified object name
fieldName - external field name
fieldValue - external field value
sObject - input object to insert or update
callback - RestClient.ResponseCallback to handle response or exception

deleteSObjectWithId

public void deleteSObjectWithId(String sObjectName,
                                String fieldName,
                                String fieldValue,
                                RestClient.ResponseCallback callback)
Description copied from interface: RestClient
Deletes a record based on the value of a specified external ID field.

Specified by:
deleteSObjectWithId in interface RestClient
Parameters:
sObjectName - specified object name
fieldName - external field name
fieldValue - external field value
callback - RestClient.ResponseCallback to handle response or exception

getBlobField

public void getBlobField(String sObjectName,
                         String id,
                         String blobFieldName,
                         RestClient.ResponseCallback callback)
Description copied from interface: RestClient
Retrieves the specified blob field from an individual record.

Specified by:
getBlobField in interface RestClient

query

public void query(String soqlQuery,
                  RestClient.ResponseCallback callback)
Description copied from interface: RestClient
Executes the specified SOQL query.

Specified by:
query in interface RestClient
Parameters:
soqlQuery - SOQL query
callback - RestClient.ResponseCallback to handle response or exception

queryMore

public void queryMore(String nextRecordsUrl,
                      RestClient.ResponseCallback callback)
Description copied from interface: RestClient
Get SOQL query results using nextRecordsUrl.

Specified by:
queryMore in interface RestClient
Parameters:
nextRecordsUrl - URL for next records to fetch, returned by query()
callback - RestClient.ResponseCallback to handle response or exception

search

public void search(String soslQuery,
                   RestClient.ResponseCallback callback)
Description copied from interface: RestClient
Executes the specified SOSL search.

Specified by:
search in interface RestClient
Parameters:
soslQuery - SOSL query
callback - RestClient.ResponseCallback to handle response or exception

setAccessToken

protected void setAccessToken(org.eclipse.jetty.client.HttpExchange httpExchange)
Specified by:
setAccessToken in class AbstractClientBase


Apache Camel