1 19 24 25 package org.netbeans.modules.j2ee.sun.share.configbean.customizers.webservice; 26 27 import org.netbeans.modules.j2ee.sun.dd.api.common.PortInfo; 28 import org.netbeans.modules.j2ee.sun.dd.api.common.WsdlPort; 29 30 31 37 public class PortInfoMapping { 38 39 private PortInfo portInfo; 40 private String displayText; 41 private boolean textOutOfDate; 42 43 public PortInfoMapping(final PortInfo pi) { 44 portInfo = pi; 45 displayText = buildDisplayText(); 46 } 47 48 public PortInfoMapping(final PortInfo pi, final String display) { 49 portInfo = pi; 50 displayText = display; 51 } 52 53 public String toString() { 54 if(textOutOfDate) { 55 displayText = buildDisplayText(); 56 } 57 58 return displayText; 59 } 60 61 public PortInfo getPortInfo() { 62 return portInfo; 63 } 64 65 public void updateDisplayText() { 66 textOutOfDate = true; 67 } 68 69 private String buildDisplayText() { 70 String sei = portInfo.getServiceEndpointInterface(); 71 WsdlPort wsdl = portInfo.getWsdlPort(); 72 String localPart = null; 73 String namespaceURI = null; 74 75 if(wsdl != null) { 76 localPart = wsdl.getLocalpart(); 77 namespaceURI = wsdl.getNamespaceURI(); 78 } 79 80 StringBuffer resultBuf = new StringBuffer (128); 81 boolean separator = false; 82 83 if(sei != null && sei.length() > 0) { 84 resultBuf.append(sei); 85 separator = true; 86 } 87 88 if(localPart != null && localPart.length() > 0) { 89 if(separator) { 90 resultBuf.append(", "); 91 } 92 93 resultBuf.append(localPart); 94 separator = true; 95 } 96 97 if(namespaceURI != null && namespaceURI.length() > 0) { 98 if(separator) { 99 resultBuf.append(", "); 100 } 101 102 resultBuf.append(namespaceURI); 103 } 104 105 if(resultBuf.length() == 0) { 106 resultBuf.append(ServiceRefCustomizer.bundle.getString("LBL_UntitledPortInfo")); 107 } 108 109 textOutOfDate = false; 110 111 return resultBuf.toString(); 112 } 113 } 114 | Popular Tags |