org.springframework.extensions.webscripts.connector
Class AbstractConnector

java.lang.Object
  extended by org.springframework.extensions.webscripts.connector.AbstractConnector
All Implemented Interfaces:
Connector
Direct Known Subclasses:
HttpConnector

public abstract class AbstractConnector
extends Object
implements Connector

Abstract class for use by developers in building their own custom connectors. This provides basic implementations of most of the helper functions that simply call through to workhorse functions. The primary workhorse functions are the two call methods - one of which buffers response data onto the response object and the other which streams data from source to destination. Extending this class makes it easier for developers by removing most of the tedious stuff and letting them concentrate on the interesting functions.

Author:
muzquiano

Field Summary
protected  ConnectorSession connectorSession
           
protected  RemoteConfigElement.ConnectorDescriptor descriptor
           
protected  String endpoint
           
 
Constructor Summary
protected AbstractConnector(RemoteConfigElement.ConnectorDescriptor descriptor, String endpoint)
          Instantiates a new abstract connector.
 
Method Summary
 Response call(String uri)
          Invokes a URI on a remote service.
 ConnectorSession getConnectorSession()
          Returns the connector session
 Credentials getCredentials()
          Returns the credents for this connector.
 String getEndpoint()
          Returns the endpoint to which this connector connects.
 void setConnectorSession(ConnectorSession connectorSession)
          Sets the connector session
 void setCredentials(Credentials credentials)
          Binds Credentials to this connector.
 void setEndpoint(String endpoint)
          Sets the endpoint.
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.springframework.extensions.webscripts.connector.Connector
call, call, call, call
 

Field Detail

endpoint

protected String endpoint

descriptor

protected RemoteConfigElement.ConnectorDescriptor descriptor

connectorSession

protected ConnectorSession connectorSession
Constructor Detail

AbstractConnector

protected AbstractConnector(RemoteConfigElement.ConnectorDescriptor descriptor,
                            String endpoint)
Instantiates a new abstract connector.

Parameters:
descriptor - the descriptor
endpoint - the endpoint
Method Detail

call

public Response call(String uri)
Description copied from interface: Connector
Invokes a URI on a remote service. The response data is buffered into a data element on the returned object of type Response.

Specified by:
call in interface Connector
Parameters:
uri - the uri
Returns:
the response

setCredentials

public void setCredentials(Credentials credentials)
Description copied from interface: Connector
Binds Credentials to this connector.

Specified by:
setCredentials in interface Connector
Parameters:
credentials - the new credentials

getCredentials

public Credentials getCredentials()
Description copied from interface: Connector
Returns the credents for this connector.

Specified by:
getCredentials in interface Connector
Returns:
the credentials

setEndpoint

public void setEndpoint(String endpoint)
Description copied from interface: Connector
Sets the endpoint.

Specified by:
setEndpoint in interface Connector
Parameters:
endpoint - the new endpoint

getEndpoint

public String getEndpoint()
Description copied from interface: Connector
Returns the endpoint to which this connector connects.

Specified by:
getEndpoint in interface Connector
Returns:
endpoint the endpoint

setConnectorSession

public void setConnectorSession(ConnectorSession connectorSession)
Description copied from interface: Connector
Sets the connector session

Specified by:
setConnectorSession in interface Connector

getConnectorSession

public ConnectorSession getConnectorSession()
Description copied from interface: Connector
Returns the connector session

Specified by:
getConnectorSession in interface Connector
Returns:
the connector session

toString

public String toString()
Overrides:
toString in class Object


Copyright © 2009 SpringSource, Inc. All Rights Reserved.