1 19 package org.netbeans.modules.j2ee.websphere6.j2ee; 20 21 import org.netbeans.modules.j2ee.deployment.plugins.api.InstanceProperties; 22 import org.netbeans.modules.j2ee.deployment.plugins.api.InstanceCreationException; 23 import org.netbeans.modules.j2ee.websphere6.WSURIManager; 24 import org.netbeans.modules.j2ee.websphere6.WSDeploymentManager; 25 import javax.enterprise.deploy.spi.DeploymentManager ; 26 27 31 public class DeploymentManagerProperties { 32 33 36 public static final String USERNAME_ATTR = "username"; 38 41 public static final String PASSWORD_ATTR = "password"; 43 44 47 public static final String DISPLAY_NAME_ATTR = "displayName"; 49 52 public static final String LOCATION_ATTR = "LOCATION"; 54 57 public static final String PORT_ATTR = "port"; 58 59 60 private InstanceProperties instanceProperties; 61 private WSDeploymentManager WSDM; 62 63 public DeploymentManagerProperties(DeploymentManager dm) { 64 65 WSDM = (WSDeploymentManager)dm; 66 67 instanceProperties = WSURIManager.getInstanceProperties(WSDM.getHost(),WSDM.getPort()); 68 69 if (instanceProperties==null){ 70 try { 71 72 instanceProperties = WSURIManager.createInstanceProperties( 73 WSDM.getHost(), 74 WSDM.getPort(), 75 WSDM.getUsername(), 76 WSDM.getPassword(), 77 WSDM.getHost()+":"+WSDM.getPort()); 78 } catch (InstanceCreationException e){ 79 80 } 81 } 82 } 83 84 88 89 90 94 public java.lang.String getPassword() { 95 if (instanceProperties==null) 96 return null; 97 return instanceProperties.getProperty(InstanceProperties.PASSWORD_ATTR) ; 98 } 99 100 104 public void setPassword(java.lang.String password) { 105 instanceProperties.setProperty(InstanceProperties.PASSWORD_ATTR, password); 106 107 } 108 109 110 114 public java.lang.String getUserName() { 115 if (instanceProperties==null) 116 return null; 117 return instanceProperties.getProperty(InstanceProperties.USERNAME_ATTR) ; 118 } 119 120 124 public void setUserName(java.lang.String UserName) { 125 instanceProperties.setProperty(InstanceProperties.USERNAME_ATTR, UserName); 126 127 } 128 132 public void refreshServerInstance(){ 133 instanceProperties.refreshServerInstance(); 134 } 135 136 public String getPort() { 137 if (instanceProperties==null) 138 return "8880"; 139 return instanceProperties.getProperty(PORT_ATTR) ; 140 } 141 142 public void setPort(String port) { 143 if(port.trim().matches("[0-9]+")) 144 { 145 instanceProperties.setProperty(PORT_ATTR, port); 146 WSDM.setPort(port); 147 } 148 } 149 150 public String getDisplayName() { 151 if (instanceProperties == null) { 152 return null; 153 } 154 return instanceProperties.getProperty(InstanceProperties.DISPLAY_NAME_ATTR); 155 } 156 157 public String getUrl() { 158 if (instanceProperties == null) { 159 return null; 160 } 161 return instanceProperties.getProperty(InstanceProperties.URL_ATTR); 162 } 163 164 public InstanceProperties getInstanceProperties() { 165 return instanceProperties; 166 } 167 168 public String getServerRoot() { 169 return WSDM.getServerRoot(); 170 } 171 172 public void setServerRoot(String serverRoot) { 173 WSDM.setServerRoot(serverRoot); 174 } 175 public String getDomainRoot() { 176 return WSDM.getDomainRoot(); 177 } 178 public void setDomainRoot(String domainRoot) { 179 WSDM.setDomainRoot(domainRoot); 180 } 181 public void setHost(String host) { 182 WSDM.setHost(host); 183 } 184 public void setServerName(String name) { 185 WSDM.setServerName(name); 186 } 187 public void setConfigXmlPath(String path) { 188 WSDM.setConfigXmlPath(path); 189 } 190 public void setIsLocal(String isLocal) { 191 WSDM.setIsLocal(isLocal); 192 } 193 public String getIsLocal() { 194 return WSDM.getIsLocal(); 195 } 196 197 198 } 199 | Popular Tags |