com.force.sdk.jpa
Class ForceManagedConnection

java.lang.Object
  extended by org.datanucleus.store.connection.AbstractManagedConnection
      extended by com.force.sdk.jpa.ForceManagedConnection
All Implemented Interfaces:
org.datanucleus.store.connection.ManagedConnection

public class ForceManagedConnection
extends org.datanucleus.store.connection.AbstractManagedConnection

Managed connection class that delegates to the ForceServiceConnector.

Author:
Fiaz Hossain

Field Summary
 
Fields inherited from class org.datanucleus.store.connection.AbstractManagedConnection
closeOnRelease, commitOnRelease, conn, listeners, locked, useCount
 
Constructor Summary
ForceManagedConnection(ForceServiceConnector connector)
          Constructor for a managed connection.
 
Method Summary
 void close()
          Closes all API connections (SOAP, metadata, and bulk) and resets configs.
 com.sforce.async.BulkConnection getBulkConnection()
          Get the BulkConnection object, connection will be lazily instantiated.
 Object getConnection()
          Get the PartnerConnection object, connection will be lazily instantiated.
 com.sforce.soap.metadata.MetadataConnection getMetadataConnection()
          Get the MetadataConnection object, connection will be lazily instantiated.
 String getNamespace()
          Retrieve the namespace of the Force.com organization.
 
Methods inherited from class org.datanucleus.store.connection.AbstractManagedConnection
addListener, flush, getXAResource, isLocked, lock, release, removeListener, setManagedResource, setPooled, toString, unlock
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ForceManagedConnection

public ForceManagedConnection(ForceServiceConnector connector)
Constructor for a managed connection.

Parameters:
connector - a ForceServiceConnector object configured for the org that the application will run against
Method Detail

close

public void close()
Closes all API connections (SOAP, metadata, and bulk) and resets configs.


getConnection

public Object getConnection()
Get the PartnerConnection object, connection will be lazily instantiated.

Returns:
a PartnerConnection to the Force.com SOAP API

getMetadataConnection

public com.sforce.soap.metadata.MetadataConnection getMetadataConnection()
                                                                  throws com.sforce.ws.ConnectionException
Get the MetadataConnection object, connection will be lazily instantiated.

Returns:
MetadataConnection to the Force.com metadata API
Throws:
com.sforce.ws.ConnectionException - thrown if an error occurs during initialization of the connection

getBulkConnection

public com.sforce.async.BulkConnection getBulkConnection()
                                                  throws com.sforce.ws.ConnectionException,
                                                         com.sforce.async.AsyncApiException
Get the BulkConnection object, connection will be lazily instantiated.

Returns:
BulkConnection to the Force.com Bulk API
Throws:
com.sforce.ws.ConnectionException - thrown if an error occurs during initialization of the connection
com.sforce.async.AsyncApiException - thrown if an error occurs during initialization of the connection

getNamespace

public String getNamespace()
                    throws com.sforce.ws.ConnectionException
Retrieve the namespace of the Force.com organization. Connection will be instantiated if it hasn't been established yet.

Returns:
the SFDC namespace of the organization that is connected to Force.com
Throws:
com.sforce.ws.ConnectionException - thrown if an error occurs during initialization of the connection (if the connection has not yet been instantiated this method will first instantiate it)


Copyright © 2011. All Rights Reserved.