View Javadoc
1   /**
2    * Copyright (C) 2010-14 pvmanager developers. See COPYRIGHT.TXT
3    * All rights reserved. Use is subject to license terms. See LICENSE.TXT
4    */
5   package org.epics.pvmanager.jca;
6   
7   import gov.aps.jca.Channel;
8   import org.epics.pvmanager.DataSourceTypeSupport;
9   import org.epics.pvmanager.ValueCache;
10  
11  /**
12   * 
13   * Given a set of {@link JCATypeAdapter} prepares type support for the 
14   * JCA data source.
15   *
16   * @author carcassi
17   */
18  public class JCATypeSupport extends DataSourceTypeSupport {
19      
20      private final JCATypeAdapterSet adapters;
21  
22      /**
23       * A new type support for the jca type support.
24       * 
25       * @param adapters a set of jca adapters
26       */
27      public JCATypeSupport(JCATypeAdapterSet adapters) {
28          this.adapters = adapters;
29      }
30      
31      /**
32       * Returns a matching type adapter for the given
33       * cache and channel.
34       * 
35       * @param cache the cache that will store the data
36       * @param channel the jca channel
37       * @return the matched type adapter
38       */
39      protected JCATypeAdapter find(ValueCache<?> cache, JCAConnectionPayload channel) {
40          return find(adapters.getAdapters(), cache, channel);
41      }
42      
43  }