1 23 24 29 30 package com.sun.enterprise.tools.common.deploy; 31 32 import java.beans.*; 33 import java.util.*; 34 import java.util.List ; 35 import javax.swing.JOptionPane ; 36 import java.net.InetAddress ; 37 38 import com.sun.enterprise.tools.common.LoginFailureException; 39 40 import com.sun.enterprise.tools.common.ui.UIMessenger; 41 42 47 public class AdminInstance extends Object implements java.io.Serializable { 48 49 50 private String host_name; 51 private static String pw_editor; 52 transient private PropertyChangeSupport propertySupport; 53 54 private String name; 55 56 private int port_no; 57 58 private String path; 59 60 private String userName; 61 private String password; 62 63 64 public AdminInstance(String host, int port, String path) { 65 this(host,port,path,null,null); 66 } 67 68 public AdminInstance(String host, int port, String path, String userName, String password) { 69 propertySupport = new PropertyChangeSupport ( this ); 70 this.host_name = host; 71 this.port_no = port; 72 this.name = host_name + ":" + port_no; this.path = path; 74 this.userName = userName; 75 this.password = password; 76 } 77 78 81 public String getUserName() { 82 return userName; 83 } 84 85 88 public void setUserName(String value) { 89 String oldValue = host_name; 90 userName = value; 91 initPropertyChangeSupport(); 92 propertySupport.firePropertyChange ("userName", oldValue, userName); } 94 97 public String getPrivatePassword() { 98 String pw = getPassword(); 99 String passw = ""; for(int i=0; i<pw.length(); i++) 101 passw = passw + "*"; return passw; 103 } 104 107 public String getPassword() { 108 pw_editor = password; 109 return password; 110 } 111 112 115 public void setPassword(String value) { 116 String oldValue = password; 117 password = value; 118 initPropertyChangeSupport(); 119 propertySupport.firePropertyChange ("password", oldValue, password); } 121 public String getHost() { 122 return this.host_name; 123 } 124 125 public void setHost(String value) { 126 String oldValue = host_name; 127 this.host_name = value; 128 initPropertyChangeSupport(); 129 propertySupport.firePropertyChange ("host", oldValue, host_name); } 131 132 private void initPropertyChangeSupport(){ 133 if(propertySupport==null) 134 propertySupport = new PropertyChangeSupport ( this ); 135 136 } 137 public void addPropertyChangeListener (PropertyChangeListener listener) { 138 initPropertyChangeSupport(); 139 140 propertySupport.addPropertyChangeListener (listener); 141 } 142 143 public void removePropertyChangeListener (PropertyChangeListener listener) { 144 initPropertyChangeSupport(); 145 propertySupport.removePropertyChangeListener (listener); 146 } 147 148 149 public String getName() { 150 return this.name; 151 } 152 153 public void setName(String value) { 154 String oldValue = name; 155 this.name = value; 156 initPropertyChangeSupport(); 157 propertySupport.firePropertyChange ("name", oldValue, name); } 159 160 public int getPort() { 161 return this.port_no; 162 } 163 164 public void setPort(int value) { 165 int oldValue = port_no; 166 this.port_no = value; 167 initPropertyChangeSupport(); 168 propertySupport.firePropertyChange ("port", oldValue, port_no); } 170 171 public String getPath() { 172 return this.path; 173 } 174 175 public void setPath(String value) { 176 String oldValue = path; 177 this.path = value; 178 initPropertyChangeSupport(); 179 propertySupport.firePropertyChange ("path", oldValue, path); } 181 182 public static boolean AdminServName(String host, int port, List admin){ 183 boolean exists = false; 184 String value = host + ":" + port; for(int i=0; i<admin.size(); i++){ 186 IAdminInstanceBean instance = (IAdminInstanceBean) admin.get(i); 187 String inst = instance.getName(); 188 if(inst.equals(value)) 189 exists = true; 190 } return exists; 192 } 193 } 194 | Popular Tags |