001/* 002 * Copyright (c) 2009-2012 The Regents of the University of California. 003 * All rights reserved. 004 * 005 * '$Author: jianwu $' 006 * '$Date: 2012-10-10 00:45:41 +0000 (Wed, 10 Oct 2012) $' 007 * '$Revision: 30849 $' 008 * 009 * Permission is hereby granted, without written agreement and without 010 * license or royalty fees, to use, copy, modify, and distribute this 011 * software and its documentation for any purpose, provided that the above 012 * copyright notice and the following two paragraphs appear in all copies 013 * of this software. 014 * 015 * IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY 016 * FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES 017 * ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF 018 * THE UNIVERSITY OF CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF 019 * SUCH DAMAGE. 020 * 021 * THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES, 022 * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 023 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE 024 * PROVIDED HEREUNDER IS ON AN "AS IS" BASIS, AND THE UNIVERSITY OF 025 * CALIFORNIA HAS NO OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, 026 * ENHANCEMENTS, OR MODIFICATIONS. 027 * 028 */ 029 030package org.sdm.spa.actors.transport.vo; 031 032public class ConnectionDetails { 033 034 private String user; 035 private String host; 036 private int port = -1; 037 //Chandrika Addition -- Starts 038 private boolean connectionOrigin = false; 039 //Chandrika Addition -- Ends 040 public String getUser() { 041 return user; 042 } 043 044 public boolean isLocal() { 045 if (host == null || host.trim().equals("localhost") 046 || host.trim().equals("local")) { 047 return true; 048 } 049 return false; 050 } 051 052 public void setUser(String user) { 053 if(user==null || user.trim().equals("")){ 054 user = System.getProperty("user.name"); 055 } 056 this.user = user; 057 } 058 059 public String getHost() { 060 return host; 061 } 062 063 public void setHost(String host) { 064 065 if (host == null || host.trim().equals("") 066 || host.trim().equals("localhost") 067 || host.trim().equals("local")) { 068 host = "localhost"; 069 } 070 this.host = host.trim(); 071 072 } 073 074 public int getPort() { 075 return port; 076 } 077 078 public void setPort(int port) { 079 this.port = port; 080 } 081 082 @Override 083 public String toString(){ 084 StringBuffer buff = new StringBuffer(50); 085 buff.append(this.user); 086 buff.append("@"); 087 buff.append(this.host); 088 if(port!=-1){ 089 buff.append(":"); 090 buff.append(this.port); 091 } 092 return buff.toString(); 093 //Chandrika Addition -- Starts 094 } 095 096 public boolean isConnectionOrigin() { 097 return connectionOrigin; 098 } 099 100 public void setConnectionOrigin(boolean connectionOrigin) { 101 102 103 this.connectionOrigin = connectionOrigin; 104 //Chandrika Addition -- Ends 105 } 106}