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