1 45 package org.exolab.jms.server.net; 46 47 import org.exolab.jms.config.ConfigHelper; 48 import org.exolab.jms.config.Configuration; 49 import org.exolab.jms.config.HttpConfigurationType; 50 import org.exolab.jms.config.ServerConfiguration; 51 import org.exolab.jms.config.types.SchemeType; 52 import org.exolab.jms.net.socket.SocketRequestInfo; 53 import org.exolab.jms.net.uri.URI; 54 import org.exolab.jms.net.util.Properties; 55 56 57 63 abstract class AbstractHTTPConnectorCfg extends AbstractConnectorCfg { 64 65 68 private HttpConfigurationType _config; 69 70 71 78 public AbstractHTTPConnectorCfg(SchemeType scheme, Configuration config, 79 HttpConfigurationType httpConfig) { 80 super(scheme, config); 81 if (httpConfig == null) { 82 throw new IllegalArgumentException ("Argument 'httpConfig' is null"); 83 } 84 _config = httpConfig; 85 } 86 87 92 public String getConnectURI() { 93 return ConfigHelper.getServerURL(getScheme(), getConfiguration()); 94 } 95 96 101 public String getExportURI() { 102 return getExportURI(_config.getPort()); 103 } 104 105 110 public String getJNDIExportURI() { 111 String uri; 112 if (_config.getJndiPort() != 0) { 113 uri = getExportURI(_config.getJndiPort()); 114 } else { 115 uri = getExportURI(); 116 } 117 return uri; 118 } 119 120 125 public String getAdminExportURI() { 126 String uri; 127 if (_config.getAdminPort() != 0) { 128 uri = getExportURI(_config.getAdminPort()); 129 } else { 130 uri = getExportURI(); 131 } 132 return uri; 133 } 134 135 140 protected void populateAcceptProperties(Properties properties) { 141 URI uri = getURI(getExportURI()); 142 SocketRequestInfo info = new SocketRequestInfo(uri); 143 info.setBindAll(_config.getBindAll()); 144 info.setMaxThreads(_config.getMaxThreads()); 145 info.export(properties); 146 } 147 148 154 private String getExportURI(int port) { 155 SchemeType scheme = getScheme(); 156 String acceptScheme = scheme.toString() + "-server"; 157 ServerConfiguration server 158 = getConfiguration().getServerConfiguration(); 159 return getURI(acceptScheme, server.getHost(), port).toString(); 160 } 161 162 } 163 | Popular Tags |