1 /*
2 * Copyright (c) 2006 Stiftung Deutsches Elektronen-Synchroton,
3 * Member of the Helmholtz Association, (DESY), HAMBURG, GERMANY.
4 *
5 * THIS SOFTWARE IS PROVIDED UNDER THIS LICENSE ON AN "../AS IS" BASIS.
6 * WITHOUT WARRANTY OF ANY KIND, EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED
7 * TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR PARTICULAR PURPOSE AND
8 * NON-INFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE
9 * FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
10 * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR
11 * THE USE OR OTHER DEALINGS IN THE SOFTWARE. SHOULD THE SOFTWARE PROVE DEFECTIVE
12 * IN ANY RESPECT, THE USER ASSUMES THE COST OF ANY NECESSARY SERVICING, REPAIR OR
13 * CORRECTION. THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL PART OF THIS LICENSE.
14 * NO USE OF ANY SOFTWARE IS AUTHORIZED HEREUNDER EXCEPT UNDER THIS DISCLAIMER.
15 * DESY HAS NO OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS,
16 * OR MODIFICATIONS.
17 * THE FULL LICENSE SPECIFYING FOR THE SOFTWARE THE REDISTRIBUTION, MODIFICATION,
18 * USAGE AND OTHER RIGHTS AND OBLIGATIONS IS INCLUDED WITH THE DISTRIBUTION OF THIS
19 * PROJECT IN THE FILE LICENSE.HTML. IF THE LICENSE IS NOT INCLUDED YOU MAY FIND A COPY
20 * AT HTTP://WWW.DESY.DE/LEGAL/LICENSE.HTM
21 */
22
23 package de.desy.acop.transport.adapters;
24
25
26 import java.util.Map;
27
28 import de.desy.acop.transport.ConnectionFailed;
29 import de.desy.acop.transport.ConnectionParameters;
30
31
32 /**
33 *
34 * @author Jaka Bobnar, Cosylab
35 *
36 */
37 public interface AdapterFactory
38 {
39 /**
40 * Returns data source for parameters and increases use count for that data
41 * source for 1. If adapter does not already exists, it is created.
42 *
43 * @param param parameters for the data source
44 *
45 * @return data source
46 */
47 public AcopTransportDataSource createDataSource(ConnectionParameters param) throws ConnectionFailed;
48
49 /**
50 * Returns adapter assotiated with the parameters, does not increase use
51 * count. If no data source is associated, then create is called.
52 *
53 * @param param parameters for the data source
54 *
55 * @return
56 */
57 public AcopTransportDataSource getDataSource(ConnectionParameters param) throws ConnectionFailed;
58
59 /**
60 * Decreases use count on data source. If use count reaches 0, then destroys
61 * data source and releases all handles to the data source.
62 *
63 * @param ds data source to be destroyed
64 */
65 public void releaseDataSource(AcopTransportDataSource ds);
66
67 /**
68 * Decreases use count on data source associated with parameters.
69 * If use count reaches 0, then destroys data source and releases all handles
70 * to the data source.
71 *
72 * @param param
73 * @return released DataSource
74 */
75 public AcopTransportDataSource releaseDataSource(ConnectionParameters param);
76
77 /**
78 * Destroys all data source and clears all cache information.
79 */
80 public void clear();
81
82 /**
83 * Method returns the characteristics for specified parameters. Characteristics should
84 * be read from cache (from DataSource) if DataSource associated with these parameters
85 * exists. If not, characteristics should be obtained by other means.
86 * @param param
87 * @return
88 * @throws ConnectionFailed
89 *
90 */
91 public Map<String, Object> getCharacteristics(ConnectionParameters param) throws ConnectionFailed;
92 }
93
94 /* __oOo__ */