DESY ACOP Beans Home

de.desy.acop.transport.adapters
Class DefaultAdapterFactory

java.lang.Object
  extended by de.desy.acop.transport.adapters.DefaultAdapterFactory
All Implemented Interfaces:
AdapterFactory

public class DefaultAdapterFactory
extends java.lang.Object
implements AdapterFactory

Default implementaion of the AdapterFactory.

Author:
Jaka Bobnar, Cosylab

Constructor Summary
protected DefaultAdapterFactory()
           
 
Method Summary
 void clear()
          Destroys all data source and clears all cache information.
protected  AcopTransportDataSource createAdapter(ConnectionParameters param)
           
 AcopTransportDataSource createDataSource(ConnectionParameters param)
          Returns data source for parameters and increases use count for that data source for 1.
 java.util.Map<java.lang.String,java.lang.Object> getCharacteristics(ConnectionParameters param)
          Method returns the characteristics for specified parameters.
 AcopTransportDataSource getDataSource(ConnectionParameters param)
          Returns adapter assotiated with the parameters, does not increase use count.
 boolean isUseCache()
          Returns true if caching is enabled.
 void releaseDataSource(AcopTransportDataSource ds)
          Decreases use count on data source.
 AcopTransportDataSource releaseDataSource(ConnectionParameters param)
          Decreases use count on data source associated with parameters.
 void setUseCache(boolean useCache)
          Enables/disables caching of adapters for multiple use.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultAdapterFactory

protected DefaultAdapterFactory()
Method Detail

createDataSource

public AcopTransportDataSource createDataSource(ConnectionParameters param)
                                         throws ConnectionFailed
Description copied from interface: AdapterFactory
Returns data source for parameters and increases use count for that data source for 1. If adapter does not already exists, it is created.

Specified by:
createDataSource in interface AdapterFactory
Parameters:
param - parameters for the data source
Returns:
data source
Throws:
ConnectionFailed

getDataSource

public AcopTransportDataSource getDataSource(ConnectionParameters param)
                                      throws ConnectionFailed
Description copied from interface: AdapterFactory
Returns adapter assotiated with the parameters, does not increase use count. If no data source is associated, then create is called.

Specified by:
getDataSource in interface AdapterFactory
Parameters:
param - parameters for the data source
Returns:
Throws:
ConnectionFailed

releaseDataSource

public void releaseDataSource(AcopTransportDataSource ds)
Description copied from interface: AdapterFactory
Decreases use count on data source. If use count reaches 0, then destroys data source and releases all handles to the data source.

Specified by:
releaseDataSource in interface AdapterFactory
Parameters:
ds - data source to be destroyed

releaseDataSource

public AcopTransportDataSource releaseDataSource(ConnectionParameters param)
Description copied from interface: AdapterFactory
Decreases use count on data source associated with parameters. If use count reaches 0, then destroys data source and releases all handles to the data source.

Specified by:
releaseDataSource in interface AdapterFactory
Returns:
released DataSource

clear

public void clear()
Description copied from interface: AdapterFactory
Destroys all data source and clears all cache information.

Specified by:
clear in interface AdapterFactory

createAdapter

protected AcopTransportDataSource createAdapter(ConnectionParameters param)
                                         throws ConnectionFailed
Throws:
ConnectionFailed

isUseCache

public boolean isUseCache()
Returns true if caching is enabled.

Returns:
See Also:
setUseCache(boolean)

setUseCache

public void setUseCache(boolean useCache)
Enables/disables caching of adapters for multiple use. If adapters are cached there is only one adapter for one ConnectionParameters. If displayers are connected to the same channel, they share the adapter.

Parameters:
useCache -

getCharacteristics

public java.util.Map<java.lang.String,java.lang.Object> getCharacteristics(ConnectionParameters param)
                                                                    throws ConnectionFailed
Description copied from interface: AdapterFactory
Method returns the characteristics for specified parameters. Characteristics should be read from cache (from DataSource) if DataSource associated with these parameters exists. If not, characteristics should be obtained by other means.

Specified by:
getCharacteristics in interface AdapterFactory
Returns:
Throws:
ConnectionFailed


Copyright © 2010. All Rights Reserved.