/** * Copyright (c) 2011, SOCIETIES Consortium (WATERFORD INSTITUTE OF TECHNOLOGY (TSSG), HERIOT-WATT UNIVERSITY (HWU), SOLUTA.NET * (SN), GERMAN AEROSPACE CENTRE (Deutsches Zentrum fuer Luft- und Raumfahrt e.V.) (DLR), Zavod za varnostne tehnologije * informacijske družbe in elektronsko poslovanje (SETCCE), INSTITUTE OF COMMUNICATION AND COMPUTER SYSTEMS (ICCS), LAKE * COMMUNICATIONS (LAKE), INTEL PERFORMANCE LEARNING SOLUTIONS LTD (INTEL), PORTUGAL TELECOM INOVAÇÃO, SA (PTIN), IBM Corp., * INSTITUT TELECOM (ITSUD), AMITEC DIACHYTI EFYIA PLIROFORIKI KAI EPIKINONIES ETERIA PERIORISMENIS EFTHINIS (AMITEC), TELECOM * ITALIA S.p.a.(TI), TRIALOG (TRIALOG), Stiftelsen SINTEF (SINTEF), NEC EUROPE LTD (NEC)) * All rights reserved. * * Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following * conditions are met: * * 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following * disclaimer in the documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT * SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.societies.android.platform.comms.state; /** * Stores and allows access to the XMPP connection configuration properties */ public class XMPPConnectionProperties { private String serviceName; private String userName; private String password; private String hostIP; private int servicePort; private boolean debug; private String nodeResource; public String getServiceName() { return serviceName; } public void setServiceName(String serviceName) { this.serviceName = serviceName; } public String getUserName() { return userName; } public void setUserName(String userName) { this.userName = userName; } public String getPassword() { return password; } public void setPassword(String password) { this.password = password; } public String getHostIP() { return hostIP; } public void setHostIP(String hostIP) { this.hostIP = hostIP; } public int getServicePort() { return servicePort; } public void setServicePort(int servicePort) { this.servicePort = servicePort; } public boolean isDebug() { return debug; } public void setDebug(boolean debug) { this.debug = debug; } public String getNodeResource() { return nodeResource; } public void setNodeResource(String nodeResource) { this.nodeResource = nodeResource; } /** * Use the XMPP server property is the XMPP host property, i.e. IP address is not specified * @return */ public String getValidHost() { String retValue = this.hostIP; if (null == this.hostIP || 0 == this.hostIP.length()) { retValue = this.serviceName; } return retValue; } @Override /** * Generated by Eclipse. Re-generate if members are modified. */ public int hashCode() { final int prime = 31; int result = 1; result = prime * result + (debug ? 1231 : 1237); result = prime * result + ((hostIP == null) ? 0 : hostIP.hashCode()); result = prime * result + ((nodeResource == null) ? 0 : nodeResource.hashCode()); result = prime * result + ((password == null) ? 0 : password.hashCode()); result = prime * result + ((serviceName == null) ? 0 : serviceName.hashCode()); result = prime * result + servicePort; result = prime * result + ((userName == null) ? 0 : userName.hashCode()); return result; } @Override /** * Generated by Eclipse. Re-generate if members are modified. */ public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; XMPPConnectionProperties other = (XMPPConnectionProperties) obj; if (debug != other.debug) return false; if (hostIP == null) { if (other.hostIP != null) return false; } else if (!hostIP.equals(other.hostIP)) return false; if (nodeResource == null) { if (other.nodeResource != null) return false; } else if (!nodeResource.equals(other.nodeResource)) return false; if (password == null) { if (other.password != null) return false; } else if (!password.equals(other.password)) return false; if (serviceName == null) { if (other.serviceName != null) return false; } else if (!serviceName.equals(other.serviceName)) return false; if (servicePort != other.servicePort) return false; if (userName == null) { if (other.userName != null) return false; } else if (!userName.equals(other.userName)) return false; return true; } @Override /** * Generated by Eclipse. Re-generate if members are modified. */ public String toString() { return "XMPPConnectionProperties [serviceName=" + serviceName + ", userName=" + userName + ", password=" + password + ", hostIP=" + hostIP + ", servicePort=" + servicePort + ", debug=" + debug + ", nodeResource=" + nodeResource + "]"; } }