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 private String configurationBuilder = MuleXmlConfigurationBuilder.class.getName();
37 private String configurations;
38 private String username;
39 private String password;
40
41 public MuleConnectionRequestInfo()
42 {
43 super();
44 }
45
46 private void readObject(ObjectInputStream ois) throws ClassNotFoundException, IOException
47 {
48 ois.defaultReadObject();
49 this.manager = MuleManager.getInstance();
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 UMOManager getManager()
98 {
99 return manager;
100 }
101
102 public void setManager(UMOManager manager)
103 {
104 this.manager = manager;
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 }