1 25 26 package org.objectweb.jonas.webapp.jonasadmin.catalina; 27 28 import java.io.Serializable ; 29 30 import javax.management.ObjectName ; 31 32 import org.objectweb.jonas.jmx.JonasManagementRepr; 33 34 37 public class ConnectorItem implements Serializable { 38 39 41 private String objectName = null; 42 private String port = null; 43 private String address = null; 44 private String scheme = null; 45 private String connectorType = null; 46 private boolean applicationServerPort = false; 47 48 50 public ConnectorItem() { 51 } 52 53 public ConnectorItem(ObjectName p_OnConnector, int p_ApplicationServerPort) 54 throws Exception { 55 setObjectName(p_OnConnector.toString()); 56 setPort(p_OnConnector.getKeyProperty("port")); 57 applicationServerPort = port.equals(String.valueOf(p_ApplicationServerPort)); 58 setAddress((String ) JonasManagementRepr.getAttribute(p_OnConnector, "address")); 59 setScheme((String ) JonasManagementRepr.getAttribute(p_OnConnector, "scheme")); 60 61 String sHandlerClassName = (String ) JonasManagementRepr.getAttribute(p_OnConnector 62 , "protocolHandlerClassName"); 63 int period = sHandlerClassName.lastIndexOf('.'); 64 String sHandlerType = sHandlerClassName.substring(period + 1); 65 setConnectorType("HTTPS"); 66 if ("JkCoyoteHandler".equalsIgnoreCase(sHandlerType)) { 67 setConnectorType("AJP"); 68 } 69 else if (("Http11Protocol".equalsIgnoreCase(sHandlerType) == true) 70 && ("http".equalsIgnoreCase(getScheme()) == true)) { 71 setConnectorType("HTTP"); 72 } 73 } 74 75 77 public String getPort() { 78 return port; 79 } 80 81 public void setPort(String port) { 82 this.port = port; 83 } 84 85 public String getAddress() { 86 return address; 87 } 88 89 public void setAddress(String address) { 90 this.address = address; 91 } 92 93 public String getScheme() { 94 return scheme; 95 } 96 97 public void setScheme(String scheme) { 98 this.scheme = scheme; 99 } 100 101 public String getObjectName() { 102 return objectName; 103 } 104 105 public void setObjectName(String objectName) { 106 this.objectName = objectName; 107 } 108 109 public String getConnectorType() { 110 return connectorType; 111 } 112 113 public void setConnectorType(String connectorType) { 114 this.connectorType = connectorType; 115 } 116 117 public boolean isApplicationServerPort() { 118 return applicationServerPort; 119 } 120 121 public String getLabel() { 122 StringBuffer sb = new StringBuffer (getPort()); 123 if (getAddress() != null) { 124 sb.append(" ("); 125 sb.append(getAddress()); 126 sb.append(")"); 127 } 128 return sb.toString(); 129 } 130 } | Popular Tags |