1
2
3
4
5
6
7
8
9
10
11 package it.imolinfo.jbi4cics.locator;
12
13 import it.imolinfo.jbi4cics.exception.LocationException;
14 import it.imolinfo.jbi4cics.jbi.Messages;
15
16
17
18
19
20
21 public class SimpleLocation implements ServiceLocation {
22
23 public final static String DUMMY_TYPE="DUMMY";
24 public final static String CICS_TYPE="CICS";
25 public final static String IMS_TYPE="IMS";
26 public final static String JDBC_TYPE="JDBC";
27
28
29
30
31
32
33 private static final Messages MESSAGES
34 = Messages.getMessages(SimpleLocation.class);
35
36 String locationName;
37 int connectionType;
38
39
40
41
42
43 public SimpleLocation() {
44 super();
45
46 }
47
48
49
50
51 public String getLocationName() {
52
53 return locationName;
54 }
55
56 public void setLocationName(String locationName) {
57
58 this.locationName=locationName;
59 }
60
61
62
63
64 public int getConnectionType() {
65
66 return connectionType;
67 }
68
69 public void setConnectionType(int connectionType) {
70 this.connectionType=connectionType;
71 }
72
73
74
75
76
77 public String getConnectionTypeName() throws LocationException {
78 switch (getConnectionType()) {
79 case ServiceLocation.DUMMY : return DUMMY_TYPE;
80 case ServiceLocation.CICS : return CICS_TYPE;
81 case ServiceLocation.IMS : return IMS_TYPE;
82 case ServiceLocation.JDBC : return JDBC_TYPE;
83
84
85 default : throw new LocationException(MESSAGES.getString(
86 "CIC001500_Unknown_type", getConnectionType()));
87 }
88 }
89
90
91
92
93
94 public void setConnectionTypeName(String connectionTypeName) throws LocationException {
95 if (DUMMY_TYPE.equals(connectionTypeName)) {
96 setConnectionType(ServiceLocation.DUMMY);
97 return;
98 }
99 if (CICS_TYPE.equals(connectionTypeName)) {
100 setConnectionType(ServiceLocation.CICS);
101 return;
102 }
103 if (IMS_TYPE.equals(connectionTypeName)) {
104 setConnectionType(ServiceLocation.IMS);
105 return;
106 }
107 if (JDBC_TYPE.equals(connectionTypeName)) {
108 setConnectionType(ServiceLocation.JDBC);
109 return;
110 }
111 throw new LocationException(MESSAGES.getString("CIC001501_Invalid_type", connectionTypeName));
112 }
113
114 }