001: /*
002: * $Id: MuleConnectionRequestInfo.java 10789 2008-02-12 20:04:43Z dfeist $
003: * --------------------------------------------------------------------------------------
004: * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com
005: *
006: * The software in this package is published under the terms of the CPAL v1.0
007: * license, a copy of which has been included with this distribution in the
008: * LICENSE.txt file.
009: */
010:
011: package org.mule.module.jca;
012:
013: import org.mule.api.MuleContext;
014: import org.mule.api.context.MuleContextAware;
015: import org.mule.config.spring.SpringXmlConfigurationBuilder;
016: import org.mule.util.StringUtils;
017:
018: import java.io.IOException;
019: import java.io.ObjectInputStream;
020: import java.io.Serializable;
021:
022: import javax.resource.spi.ConnectionRequestInfo;
023:
024: /**
025: * <code>MuleConnectionRequestInfo</code> TODO
026: */
027: public class MuleConnectionRequestInfo implements
028: ConnectionRequestInfo, Cloneable, Serializable,
029: MuleContextAware {
030: /**
031: * Serial version
032: */
033: private static final long serialVersionUID = 910828075890304726L;
034:
035: private String configurationBuilder = SpringXmlConfigurationBuilder.class
036: .getName();
037: private String configurations;
038: private String username;
039: private String password;
040:
041: private MuleContext muleContext;
042:
043: public MuleConnectionRequestInfo() {
044: super ();
045: }
046:
047: private void readObject(ObjectInputStream ois)
048: throws ClassNotFoundException, IOException {
049: ois.defaultReadObject();
050: }
051:
052: public String getConfigurationBuilder() {
053: return configurationBuilder;
054: }
055:
056: public void setConfigurationBuilder(String configurationBuilder) {
057: this .configurationBuilder = configurationBuilder;
058: }
059:
060: public String getConfigurations() {
061: return configurations;
062: }
063:
064: public String[] getConfigurationsAsArray() {
065: return StringUtils.splitAndTrim(configurations, ",");
066: }
067:
068: public void setConfigurations(String configurations) {
069: this .configurations = configurations;
070: }
071:
072: public String getUserName() {
073: return username;
074: }
075:
076: public void setUserName(String username) {
077: this .username = username;
078: }
079:
080: public String getPassword() {
081: return password;
082: }
083:
084: public void setPassword(String password) {
085: this .password = password;
086: }
087:
088: public MuleContext getMuleContext() {
089: return muleContext;
090: }
091:
092: public void setMuleContext(MuleContext context) {
093: this .muleContext = context;
094: }
095:
096: public boolean equals(Object obj) {
097: if (this == obj) {
098: return true;
099: }
100:
101: if (obj == null) {
102: return false;
103: }
104:
105: if (this .getClass() != obj.getClass()) {
106: return false;
107: }
108:
109: final MuleConnectionRequestInfo muleConnectionRequestInfo = (MuleConnectionRequestInfo) obj;
110:
111: if (configurationBuilder != null ? !configurationBuilder
112: .equals(muleConnectionRequestInfo.configurationBuilder)
113: : muleConnectionRequestInfo.configurationBuilder != null) {
114: return false;
115: }
116:
117: if (configurations != null ? !configurations
118: .equals(muleConnectionRequestInfo.configurations)
119: : muleConnectionRequestInfo.configurations != null) {
120: return false;
121: }
122:
123: if (password != null ? !password
124: .equals(muleConnectionRequestInfo.password)
125: : muleConnectionRequestInfo.password != null) {
126: return false;
127: }
128:
129: if (username != null ? !username
130: .equals(muleConnectionRequestInfo.username)
131: : muleConnectionRequestInfo.username != null) {
132: return false;
133: }
134:
135: return true;
136: }
137:
138: public int hashCode() {
139: int result = (configurationBuilder != null ? configurationBuilder
140: .hashCode()
141: : 0);
142: result = 29
143: * result
144: + (configurations != null ? configurations.hashCode()
145: : 0);
146: result = 29 * result
147: + (username != null ? username.hashCode() : 0);
148: return 29 * result
149: + (password != null ? password.hashCode() : 0);
150: }
151:
152: protected Object clone() throws CloneNotSupportedException {
153: return super.clone();
154: }
155: }
|