org.wso2.carbon.databridge.agent.client
Class AbstractClientPoolFactory

java.lang.Object
  extended by org.apache.commons.pool.BaseKeyedPoolableObjectFactory
      extended by org.wso2.carbon.databridge.agent.client.AbstractClientPoolFactory
All Implemented Interfaces:
org.apache.commons.pool.KeyedPoolableObjectFactory
Direct Known Subclasses:
AbstractSecureClientPoolFactory, BinaryClientPoolFactory, ThriftClientPoolFactory

public abstract class AbstractClientPoolFactory
extends org.apache.commons.pool.BaseKeyedPoolableObjectFactory

The abstract class that needs to be implemented when supporting a new non-secure transport to mainly create, validate and terminate the client to the endpoint.


Constructor Summary
AbstractClientPoolFactory()
           
 
Method Summary
abstract  Object createClient(String protocol, String hostName, int port)
          Make a connection to the receiver and return the client.
 void destroyObject(Object key, Object obj)
           
 Object makeObject(Object key)
           
abstract  void terminateClient(Object client)
          Terminates the connection between the client and the endpoint.
abstract  boolean validateClient(Object client)
          Check the validity of the client whether it's in the position to make the communication with endpoint.
 boolean validateObject(Object key, Object obj)
           
 
Methods inherited from class org.apache.commons.pool.BaseKeyedPoolableObjectFactory
activateObject, passivateObject
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AbstractClientPoolFactory

public AbstractClientPoolFactory()
Method Detail

makeObject

public Object makeObject(Object key)
                  throws DataEndpointException,
                         DataEndpointSecurityException
Specified by:
makeObject in interface org.apache.commons.pool.KeyedPoolableObjectFactory
Specified by:
makeObject in class org.apache.commons.pool.BaseKeyedPoolableObjectFactory
Throws:
DataEndpointException
DataEndpointSecurityException

createClient

public abstract Object createClient(String protocol,
                                    String hostName,
                                    int port)
                             throws DataEndpointException,
                                    DataEndpointSecurityException
Make a connection to the receiver and return the client.

Parameters:
protocol - protocol that is used to connect to the endpoint
hostName - hostname of the endpoint
port - port of the endpoint that is listening to
Returns:
A valid client which has connected to the receiver and can be used for rest of the operations regarding the endpoint.
Throws:
DataEndpointException
DataEndpointSecurityException

validateObject

public boolean validateObject(Object key,
                              Object obj)
Specified by:
validateObject in interface org.apache.commons.pool.KeyedPoolableObjectFactory
Overrides:
validateObject in class org.apache.commons.pool.BaseKeyedPoolableObjectFactory

validateClient

public abstract boolean validateClient(Object client)
Check the validity of the client whether it's in the position to make the communication with endpoint.

Parameters:
client - Client object which needs to be validated.
Returns:
Returns true/false based on the client is valid or invalid.

destroyObject

public void destroyObject(Object key,
                          Object obj)
Specified by:
destroyObject in interface org.apache.commons.pool.KeyedPoolableObjectFactory
Overrides:
destroyObject in class org.apache.commons.pool.BaseKeyedPoolableObjectFactory

terminateClient

public abstract void terminateClient(Object client)
Terminates the connection between the client and the endpoint.

Parameters:
client - The client which needs to be terminated.


Copyright © 2015 WSO2. All rights reserved.