private static Transport createLocalTransport(URI uri, boolean async) throws Exception { HashMap<String, String> map = new HashMap<String, String>(URISupport.parseParameters(uri)); map.put("async", String.valueOf(async)); map.put("create", "false"); // we don't want a vm connect during shutdown to trigger a broker create uri = URISupport.createURIWithQuery(uri, URISupport.createQueryString(map)); return TransportFactory.connect(uri); }
public Transport doCompositeConnect(URI location) throws Exception { try { Map<String, String> options = new HashMap<String, String>(URISupport.parseParameters(location)); WireFormat wf = createWireFormat(options); Transport transport = createTransport(location, wf); Transport rc = compositeConfigure(transport, wf, options); if (!options.isEmpty()) { throw new IllegalArgumentException("Invalid connect parameters: " + options); } return rc; } catch (URISyntaxException e) { throw IOExceptionSupport.create(e); } }
protected DiscoveryAgent doCreateDiscoveryAgent(URI uri) throws IOException { try { if (LOG.isTraceEnabled()) { LOG.trace("doCreateDiscoveryAgent: uri = " + uri.toString()); } MulticastDiscoveryAgent mda = new MulticastDiscoveryAgent(); mda.setDiscoveryURI(uri); // allow MDA's params to be set via query arguments // (e.g., multicast://default?group=foo Map options = URISupport.parseParameters(uri); IntrospectionSupport.setProperties(mda, options); return mda; } catch (Throwable e) { throw IOExceptionSupport.create("Could not create discovery agent: " + uri, e); } } }
public Transport doConnect(URI location) throws Exception { try { Map<String, String> options = new HashMap<String, String>(URISupport.parseParameters(location)); if( !options.containsKey("wireFormat.host") ) { options.put("wireFormat.host", location.getHost()); } WireFormat wf = createWireFormat(options); Transport transport = createTransport(location, wf); Transport rc = configure(transport, wf, options); //remove auto IntrospectionSupport.extractProperties(options, "auto."); if (!options.isEmpty()) { throw new IllegalArgumentException("Invalid connect parameters: " + options); } return rc; } catch (URISyntaxException e) { throw IOExceptionSupport.create(e); } }
public void setUri(URI discoveryURI) throws IOException { this.discoveryUri = discoveryURI; setDiscoveryAgent(DiscoveryAgentFactory.createDiscoveryAgent(discoveryURI)); try { parameters = URISupport.parseParameters(discoveryURI); // allow discovery agent to grab it's parameters IntrospectionSupport.setProperties(getDiscoveryAgent(), parameters); } catch (URISyntaxException e) { LOG.warn("failed to parse query parameters from discoveryURI: {}", discoveryURI, e); } }
protected DiscoveryAgent doCreateDiscoveryAgent(URI uri) throws IOException { try { Map options = URISupport.parseParameters(uri); ZeroconfDiscoveryAgent rc = new ZeroconfDiscoveryAgent(); rc.setGroup(uri.getHost()); IntrospectionSupport.setProperties(rc, options); return rc; } catch (Throwable e) { throw IOExceptionSupport.create("Could not create discovery agent: " + uri, e); } } }
final Map<String, String> brokerOptions = new HashMap<String, String>(URISupport.parseParameters(location)); if (!brokerOptions.containsKey("persistent")) { brokerOptions.put("persistent", "false");
@Override public TransportServer doBind(final URI location) throws IOException { try { Map<String, String> options = new HashMap<String, String>(URISupport.parseParameters(location)); if (options.containsKey("port")) { throw new IllegalArgumentException("The port property cannot be specified on a UDP server transport - please use the port in the URI syntax"); } WireFormat wf = createWireFormat(options); int port = location.getPort(); OpenWireFormat openWireFormat = asOpenWireFormat(wf); UdpTransport transport = (UdpTransport) createTransport(location.getPort(), wf); Transport configuredTransport = configure(transport, wf, options, true); UdpTransportServer server = new UdpTransportServer(location, transport, configuredTransport, createReplayStrategy()); return server; } catch (URISyntaxException e) { throw IOExceptionSupport.create(e); } catch (Exception e) { throw IOExceptionSupport.create(e); } }
/** * Overriding to use SslTransportServer and allow for proper reflection. */ @Override public TransportServer doBind(final URI location) throws IOException { try { Map<String, String> options = new HashMap<String, String>(URISupport.parseParameters(location)); ServerSocketFactory serverSocketFactory = createServerSocketFactory(); SslTransportServer server = createSslTransportServer(location, (SSLServerSocketFactory)serverSocketFactory); server.setWireFormatFactory(createWireFormatFactory(options)); IntrospectionSupport.setProperties(server, options); Map<String, Object> transportOptions = IntrospectionSupport.extractProperties(options, "transport."); server.setTransportOption(transportOptions); server.bind(); return server; } catch (URISyntaxException e) { throw IOExceptionSupport.create(e); } }
@Override public TransportServer doBind(final URI location) throws IOException { try { Map<String, String> options = new HashMap<String, String>(URISupport.parseParameters(location)); ServerSocketFactory serverSocketFactory = createServerSocketFactory(); TcpTransportServer server = createTcpTransportServer(location, serverSocketFactory); server.setWireFormatFactory(createWireFormatFactory(options)); IntrospectionSupport.setProperties(server, options); Map<String, Object> transportOptions = IntrospectionSupport.extractProperties(options, "transport."); server.setTransportOption(transportOptions); server.bind(); return server; } catch (URISyntaxException e) { throw IOExceptionSupport.create(e); } }
@Override public TransportServer doBind(final URI location) throws IOException { try { Map<String, String> options = new HashMap<String, String>(URISupport.parseParameters(location)); Map<String, Object> autoProperties = IntrospectionSupport.extractProperties(options, "auto."); this.enabledProtocols = AutoTransportUtils.parseProtocols((String) autoProperties.get("protocols")); ServerSocketFactory serverSocketFactory = createServerSocketFactory(); AutoTcpTransportServer server = createTcpTransportServer(location, serverSocketFactory); //server.setWireFormatFactory(createWireFormatFactory(options)); server.setWireFormatFactory(new OpenWireFormatFactory()); if (options.get("allowLinkStealing") != null){ allowLinkStealingSet = true; } IntrospectionSupport.setProperties(server, options); server.setTransportOption(IntrospectionSupport.extractProperties(options, "transport.")); server.setWireFormatOptions(AutoTransportUtils.extractWireFormatOptions(options)); server.bind(); return server; } catch (URISyntaxException e) { throw IOExceptionSupport.create(e); } }
@Override public TransportServer doBind(final URI location) throws IOException { try { Map<String, String> options = new HashMap<String, String>(URISupport.parseParameters(location)); Map<String, Object> autoProperties = IntrospectionSupport.extractProperties(options, "auto."); this.enabledProtocols = AutoTransportUtils.parseProtocols((String) autoProperties.get("protocols")); ServerSocketFactory serverSocketFactory = createServerSocketFactory(); AutoTcpTransportServer server = createTcpTransportServer(location, serverSocketFactory); //server.setWireFormatFactory(createWireFormatFactory(options)); server.setWireFormatFactory(new OpenWireFormatFactory()); if (options.get("allowLinkStealing") != null){ allowLinkStealingSet = true; } IntrospectionSupport.setProperties(server, options); server.setTransportOption(IntrospectionSupport.extractProperties(options, "transport.")); server.setWireFormatOptions(AutoTransportUtils.extractWireFormatOptions(options)); server.bind(); return server; } catch (URISyntaxException e) { throw IOExceptionSupport.create(e); } }
/** * Overriding to use SslTransportServer and allow for proper reflection. */ @Override public TransportServer doBind(final URI location) throws IOException { try { Map<String, String> options = new HashMap<String, String>(URISupport.parseParameters(location)); Map<String, Object> autoProperties = IntrospectionSupport.extractProperties(options, "auto."); this.enabledProtocols = AutoTransportUtils.parseProtocols((String) autoProperties.get("protocols")); ServerSocketFactory serverSocketFactory = createServerSocketFactory(); AutoSslTransportServer server = createAutoSslTransportServer(location, (SSLServerSocketFactory)serverSocketFactory); if (options.get("allowLinkStealing") != null){ allowLinkStealingSet = true; } IntrospectionSupport.setProperties(server, options); server.setAutoTransportOptions(IntrospectionSupport.extractProperties(options, "auto.")); server.setTransportOption(IntrospectionSupport.extractProperties(options, "transport.")); server.setWireFormatOptions(AutoTransportUtils.extractWireFormatOptions(options)); server.bind(); return server; } catch (URISyntaxException e) { throw IOExceptionSupport.create(e); } }
options = URISupport.parseParameters(location); String config = options.remove("brokerConfig"); if (config != null) {
@Override public TransportServer doBind(final URI location) throws IOException { try { if (SslContext.getCurrentSslContext() != null) { try { context = SslContext.getCurrentSslContext().getSSLContext(); } catch (Exception e) { throw new IOException(e); } } Map<String, String> options = new HashMap<String, String>(URISupport.parseParameters(location)); Map<String, Object> autoProperties = IntrospectionSupport.extractProperties(options, "auto."); this.enabledProtocols = AutoTransportUtils.parseProtocols((String) autoProperties.get("protocols")); ServerSocketFactory serverSocketFactory = createServerSocketFactory(); AutoTcpTransportServer server = createTcpTransportServer(location, serverSocketFactory); server.setWireFormatFactory(new OpenWireFormatFactory()); if (options.get("allowLinkStealing") != null){ allowLinkStealingSet = true; } IntrospectionSupport.setProperties(server, options); server.setAutoTransportOptions(IntrospectionSupport.extractProperties(options, "auto.")); server.setTransportOption(IntrospectionSupport.extractProperties(options, "transport.")); server.setWireFormatOptions(AutoTransportUtils.extractWireFormatOptions(options)); server.bind(); return server; } catch (URISyntaxException e) { throw IOExceptionSupport.create(e); } }
public void setUri(URI discoveryURI) throws IOException { this.discoveryUri = discoveryURI; setDiscoveryAgent(DiscoveryAgentFactory.createDiscoveryAgent(discoveryURI)); try { parameters = URISupport.parseParameters(discoveryURI); // allow discovery agent to grab it's parameters IntrospectionSupport.setProperties(getDiscoveryAgent(), parameters); } catch (URISyntaxException e) { LOG.warn("failed to parse query parameters from discoveryURI: {}", discoveryURI, e); } }
protected DiscoveryAgent doCreateDiscoveryAgent(URI uri) throws IOException { try { Map options = URISupport.parseParameters(uri); ZeroconfDiscoveryAgent rc = new ZeroconfDiscoveryAgent(); rc.setGroup(uri.getHost()); IntrospectionSupport.setProperties(rc, options); return rc; } catch (Throwable e) { throw IOExceptionSupport.create("Could not create discovery agent: " + uri, e); } } }
public void setUri(URI discoveryURI) throws IOException { setDiscoveryAgent(DiscoveryAgentFactory.createDiscoveryAgent(discoveryURI)); try { parameters = URISupport.parseParameters(discoveryURI); // allow discovery agent to grab it's parameters IntrospectionSupport.setProperties(getDiscoveryAgent(), parameters); } catch (URISyntaxException e) { LOG.warn("failed to parse query parameters from discoveryURI: " + discoveryURI, e); } }
public void setUri(URI discoveryURI) throws IOException { this.discoveryUri = discoveryURI; setDiscoveryAgent(DiscoveryAgentFactory.createDiscoveryAgent(discoveryURI)); try { parameters = URISupport.parseParameters(discoveryURI); // allow discovery agent to grab it's parameters IntrospectionSupport.setProperties(getDiscoveryAgent(), parameters); } catch (URISyntaxException e) { LOG.warn("failed to parse query parameters from discoveryURI: {}", discoveryURI, e); } }
public TransportServer doBind(URI location) throws IOException { try { Map<String, String> options = new HashMap<String, String>(URISupport.parseParameters(location)); HttpsTransportServer result = new HttpsTransportServer(location, this, SslContext.getCurrentSslContext()); Map<String, Object> transportOptions = IntrospectionSupport.extractProperties(options, "transport."); result.setTransportOption(transportOptions); return result; } catch (URISyntaxException e) { throw IOExceptionSupport.create(e); } }