1 19 20 24 25 package org.netbeans.modules.j2ee.sun.ws7.ui; 26 import java.io.File ; 27 import org.netbeans.modules.j2ee.deployment.plugins.api.InstanceCreationException; 28 import org.netbeans.modules.j2ee.deployment.plugins.api.InstanceProperties; 29 30 31 32 36 public class WS70URIManager { 37 38 public static final String WS70SERVERURI = "deployer:Sun:WebServer70::"; 40 46 47 public static InstanceProperties getInstanceProperties(String serverLocation, String host, int port){ 48 InstanceProperties instanceProperties = 49 InstanceProperties.getInstanceProperties("["+serverLocation+"]"+WS70SERVERURI+host+":"+port); 50 51 return instanceProperties; 52 } 53 66 public static InstanceProperties createInstanceProperties(String serverLocation, String host, String port, String user, String password, String displayName) throws InstanceCreationException { 67 InstanceProperties instanceProperties = InstanceProperties.createInstanceProperties( 68 "["+serverLocation+"]"+WS70SERVERURI+host+":"+port, 69 user, 70 password,displayName); 71 72 return instanceProperties; 73 } 74 public static String getURIWithoutLocation(String uriwithlocation){ 75 int index = uriwithlocation.lastIndexOf("]"); 76 String retval = null; 77 if(index!=-1){ 78 retval = uriwithlocation.substring(index+1); 79 }else{ 80 retval = uriwithlocation; 81 } 82 return retval; 83 } 84 public static String getLocation(String url){ 85 int index = url.lastIndexOf("]"); 86 String retval = null; 87 if(index!=-1){ 88 if(url.startsWith("[")){ 89 retval = url.substring(1, index); 90 }else{ 91 retval = url.substring(0, index); 92 } 93 } 94 return retval; 95 } 96 public static String getHostFromURI(String uri){ 97 int index = uri.lastIndexOf("::"); 98 String newUrl = null; 99 if(index!=-1){ 100 newUrl = uri.substring(index+2); 101 }else{ 102 newUrl = uri; 103 } 104 105 String [] vals = newUrl.split(":"); 106 return vals[0]; 107 108 } 109 public static String getPortFromURI(String uri){ 110 int index = uri.lastIndexOf("::"); 111 String newUrl = null; 112 if(index!=-1){ 113 newUrl = uri.substring(index+2); 114 }else{ 115 newUrl = uri; 116 } 117 118 String [] vals = newUrl.split(":"); 119 return vals[1]; 120 } 121 122 } 123 | Popular Tags |