1
2
3
4
5
6
7
8
9 package it.imolinfo.jbi4cics.connection.jca.ims;
10
11 import it.imolinfo.jbi4cics.connection.jca.JCACommareaBasedConnectionManager;
12 import it.imolinfo.jbi4cics.exception.ConnectionException;
13 import it.imolinfo.jbi4cics.service.ServiceContext;
14
15 import javax.resource.cci.ConnectionSpec;
16 import javax.resource.cci.InteractionSpec;
17 import it.imolinfo.jbi4cics.Logger;
18 import it.imolinfo.jbi4cics.LoggerFactory;
19
20
21
22
23
24
25
26 public class IMSConnectionManager extends JCACommareaBasedConnectionManager {
27
28
29
30
31 private static final Logger LOG
32 = LoggerFactory.getLogger(IMSConnectionManager.class);
33
34 public IMSConnectionManager() {
35 super();
36 }
37
38
39
40
41 protected InteractionSpec createInteractionSpec(ServiceContext serviceContext) throws ConnectionException {
42
43 InteractionSpec imsInteractionSpec = null;
44
45 try {
46 imsInteractionSpec = (InteractionSpec)
47 this.getConnectorClassLoader().loadClass("com.ibm.connector2.ims.ico.IMSInteractionSpec").newInstance();
48 } catch (InstantiationException e) {
49 LOG.error("CIC000500_Error_istantiating_connection_spec", new Object[] {e.getMessage()}, e);
50 throw new ConnectionException("CIC000500_Error_istantiating_connection_spec", new Object[] {e.getMessage()}, e);
51 } catch (IllegalAccessException e) {
52 LOG.error("CIC000500_Error_istantiating_connection_spec", new Object[] {e.getMessage()}, e);
53 throw new ConnectionException("CIC000500_Error_istantiating_connection_spec", new Object[] {e.getMessage()}, e);
54 } catch (ClassNotFoundException e) {
55 LOG.error("CIC000500_Error_istantiating_connection_spec", new Object[] {e.getMessage()}, e);
56 throw new ConnectionException("CIC000500_Error_istantiating_connection_spec", new Object[] {e.getMessage()}, e);
57 }
58
59
60
61
62
63
64
65 if (imsInteractionSpec != null) {
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80 } else {
81 LOG.error("CIC000501_InteractionSpec_not_retrieved");
82 throw new ConnectionException("CIC000501_InteractionSpec_not_retrieved");
83 }
84 return imsInteractionSpec;
85
86 }
87
88
89
90
91 protected ConnectionSpec createConnectionSpec(ServiceContext serviceContext) throws ConnectionException {
92 ConnectionSpec imsConnectionSpec = null;
93
94 try {
95 imsConnectionSpec = (ConnectionSpec)
96 this.getConnectorClassLoader().loadClass("com.ibm.connector2.ims.ico.IMSConnectionSpec").newInstance();
97 } catch (InstantiationException e) {
98 LOG.error("CIC000500_Error_istantiating_connection_spec", new Object[] {e.getMessage()}, e);
99 throw new ConnectionException("CIC000500_Error_istantiating_connection_spec", new Object[] {e.getMessage()}, e);
100 } catch (IllegalAccessException e) {
101 LOG.error("CIC000500_Error_istantiating_connection_spec", new Object[] {e.getMessage()}, e);
102 throw new ConnectionException("CIC000500_Error_istantiating_connection_spec", new Object[] {e.getMessage()}, e);
103 } catch (ClassNotFoundException e) {
104 LOG.error("CIC000500_Error_istantiating_connection_spec", new Object[] {e.getMessage()}, e);
105 throw new ConnectionException("CIC000500_Error_istantiating_connection_spec", new Object[] {e.getMessage()}, e);
106 }
107
108 if (imsConnectionSpec != null) {
109
110
111
112
113
114
115
116
117
118
119
120
121
122 } else {
123 LOG.error("CIC000502_ConnectionSpec_not_retrieved");
124 throw new ConnectionException("CIC000502_ConnectionSpec_not_retrieved");
125 }
126
127 return imsConnectionSpec;
128 }
129
130 }