1
2
3
4
5
6
7
8
9
10
11 package org.mule.module.jca;
12
13 import org.mule.api.MuleContext;
14 import org.mule.api.context.MuleContextAware;
15 import org.mule.config.spring.SpringXmlConfigurationBuilder;
16 import org.mule.util.StringUtils;
17
18 import java.io.IOException;
19 import java.io.ObjectInputStream;
20 import java.io.Serializable;
21
22 import javax.resource.spi.ConnectionRequestInfo;
23
24
25
26
27 public class MuleConnectionRequestInfo implements ConnectionRequestInfo, Cloneable, Serializable, MuleContextAware
28 {
29
30
31
32 private static final long serialVersionUID = 910828075890304726L;
33
34
35 private String configurationBuilder = SpringXmlConfigurationBuilder.class.getName();
36 private String configurations;
37 private String username;
38 private String password;
39
40 private MuleContext muleContext;
41
42 public MuleConnectionRequestInfo()
43 {
44 super();
45 }
46
47 private void readObject(ObjectInputStream ois) throws ClassNotFoundException, IOException
48 {
49 ois.defaultReadObject();
50 }
51
52 public String getConfigurationBuilder()
53 {
54 return configurationBuilder;
55 }
56
57 public void setConfigurationBuilder(String configurationBuilder)
58 {
59 this.configurationBuilder = configurationBuilder;
60 }
61
62 public String getConfigurations()
63 {
64 return configurations;
65 }
66
67 public String[] getConfigurationsAsArray()
68 {
69 return StringUtils.splitAndTrim(configurations, ",");
70 }
71
72 public void setConfigurations(String configurations)
73 {
74 this.configurations = configurations;
75 }
76
77 public String getUserName()
78 {
79 return username;
80 }
81
82 public void setUserName(String username)
83 {
84 this.username = username;
85 }
86
87 public String getPassword()
88 {
89 return password;
90 }
91
92 public void setPassword(String password)
93 {
94 this.password = password;
95 }
96
97 public MuleContext getMuleContext()
98 {
99 return muleContext;
100 }
101
102 public void setMuleContext(MuleContext context)
103 {
104 this.muleContext = context;
105 }
106
107 public boolean equals(Object obj)
108 {
109 if (this == obj)
110 {
111 return true;
112 }
113
114 if (obj == null)
115 {
116 return false;
117 }
118
119 if (this.getClass() != obj.getClass())
120 {
121 return false;
122 }
123
124 final MuleConnectionRequestInfo muleConnectionRequestInfo = (MuleConnectionRequestInfo)obj;
125
126 if (configurationBuilder != null
127 ? !configurationBuilder.equals(muleConnectionRequestInfo.configurationBuilder)
128 : muleConnectionRequestInfo.configurationBuilder != null)
129 {
130 return false;
131 }
132
133 if (configurations != null
134 ? !configurations.equals(muleConnectionRequestInfo.configurations)
135 : muleConnectionRequestInfo.configurations != null)
136 {
137 return false;
138 }
139
140 if (password != null
141 ? !password.equals(muleConnectionRequestInfo.password)
142 : muleConnectionRequestInfo.password != null)
143 {
144 return false;
145 }
146
147 if (username != null
148 ? !username.equals(muleConnectionRequestInfo.username)
149 : muleConnectionRequestInfo.username != null)
150 {
151 return false;
152 }
153
154 return true;
155 }
156
157 public int hashCode()
158 {
159 int result = (configurationBuilder != null ? configurationBuilder.hashCode() : 0);
160 result = 29 * result + (configurations != null ? configurations.hashCode() : 0);
161 result = 29 * result + (username != null ? username.hashCode() : 0);
162 return 29 * result + (password != null ? password.hashCode() : 0);
163 }
164
165 protected Object clone() throws CloneNotSupportedException
166 {
167 return super.clone();
168 }
169 }