1
2
3
4
5
6
7
8
9
10
11 package it.imolinfo.jbi4cics.connection;
12
13 import it.imolinfo.jbi4cics.connection.jca.cics.CICSConnectionManager;
14 import it.imolinfo.jbi4cics.connection.jca.ims.IMSConnectionManager;
15 import it.imolinfo.jbi4cics.connection.jdbc.JdbcConnectionManager;
16 import it.imolinfo.jbi4cics.locator.ServiceLocation;
17 import it.imolinfo.jbi4cics.service.ServiceContext;
18 import it.imolinfo.jbi4cics.Logger;
19 import it.imolinfo.jbi4cics.LoggerFactory;
20
21
22
23
24
25 public class ConnectionManagerFactory {
26
27
28
29 private static final Logger LOG
30 = LoggerFactory.getLogger(ConnectionManagerFactory.class);
31
32 private static CICSConnectionManager cicsConnectionManager=new CICSConnectionManager();
33 private static IMSConnectionManager imsConnectionManager=new IMSConnectionManager();
34 private static JdbcConnectionManager jdbcConnectionManager=new JdbcConnectionManager();
35 private static EchoConnectionManager echoConnectionManager=new EchoConnectionManager();
36
37
38
39
40 public ConnectionManagerFactory(){
41 super();
42 }
43
44
45 public static ConnectionManager createConnectionManager(ServiceContext serviceContext){
46
47 LOG.debug("Using service location: {0}", serviceContext.getServiceLocation());
48 LOG.debug("Using connection type: {0}", serviceContext.getServiceLocation().getConnectionType());
49 switch (serviceContext.getServiceLocation().getConnectionType()){
50 case ServiceLocation.CICS : return cicsConnectionManager;
51 case ServiceLocation.IMS : return imsConnectionManager;
52 case ServiceLocation.JDBC : return jdbcConnectionManager;
53 default : return echoConnectionManager;
54 }
55 }
56 }