Package org.apache.activemq.util.URISupport

Examples of org.apache.activemq.util.URISupport.CompositeData


     * @return
     * @throws IOException
     * @throws URISyntaxException
     */
    public Transport createTransport(URI location) throws IOException, URISyntaxException {
        CompositeData compositeData = URISupport.parseComposite(location);
        Map<String, String> parameters = compositeData.getParameters();
        FanoutTransport fanoutTransport = createTransport(parameters);       
        DiscoveryTransport discoveryTransport = DiscoveryTransportFactory.createTransport(fanoutTransport, compositeData, parameters);
        return discoveryTransport;
    }
View Full Code Here


        } else {

            // It might be a composite URI.
            try {
                CompositeData data = URISupport.parseComposite(this.brokerURL);
                Map<String,Object> jmsOptionsMap = IntrospectionSupport.extractProperties(data.getParameters(), "jms.");
                if (buildFromMap(jmsOptionsMap)) {
                    if (!jmsOptionsMap.isEmpty()) {
                        String msg = "There are " + jmsOptionsMap.size()
                            + " jms options that couldn't be set on the ConnectionFactory."
                            + " Check the options are spelled correctly."
                            + " Unknown parameters=[" + jmsOptionsMap + "]."
                            + " This connection factory cannot be started.";
                        throw new IllegalArgumentException(msg);
                    }

                    this.brokerURL = data.toURI();
                }
            } catch (URISyntaxException e) {
            }
        }
    }
View Full Code Here

        URI brokerURI;
        String host;
        Map<String, String> options;
        boolean create = true;
        int waitForStart = -1;
        CompositeData data = URISupport.parseComposite(location);
        if (data.getComponents().length == 1 && "broker".equals(data.getComponents()[0].getScheme())) {
            brokerURI = data.getComponents()[0];
            CompositeData brokerData = URISupport.parseComposite(brokerURI);
            host = (String)brokerData.getParameters().get("brokerName");
            if (host == null) {
                host = "localhost";
            }
            if (brokerData.getPath() != null) {
                host = brokerData.getPath();
            }
            options = data.getParameters();
            location = new URI("vm://" + host);
        } else {
            // If using the less complex vm://localhost?broker.persistent=true
View Full Code Here

*/
public class DefaultBrokerFactory implements BrokerFactoryHandler {

    public BrokerService createBroker(URI brokerURI) throws Exception {

        CompositeData compositeData = URISupport.parseComposite(brokerURI);
        Map<String, String> params = new HashMap<String, String>(compositeData.getParameters());

        BrokerService brokerService = new BrokerService();
        IntrospectionSupport.setProperties(brokerService, params);
        if (!params.isEmpty()) {
            String msg = "There are " + params.size()
                + " Broker options that couldn't be set on the BrokerService."
                + " Check the options are spelled correctly."
                + " Unknown parameters=[" + params + "]."
                + " This BrokerService cannot be started.";
            throw new IllegalArgumentException(msg);
        }

        if (compositeData.getPath() != null) {
            brokerService.setBrokerName(compositeData.getPath());
        }

        URI[] components = compositeData.getComponents();
        for (int i = 0; i < components.length; i++) {
            if ("network".equals(components[i].getScheme())) {
                brokerService.addNetworkConnector(components[i].getSchemeSpecificPart());
            } else if ("proxy".equals(components[i].getScheme())) {
                brokerService.addProxyConnector(components[i].getSchemeSpecificPart());
View Full Code Here

    @Override
    protected DiscoveryAgent doCreateDiscoveryAgent(URI uri) throws IOException {
        try {

            CompositeData data = URISupport.parseComposite(uri);
            Map options = data.getParameters();

            MasterSlaveDiscoveryAgent rc = new MasterSlaveDiscoveryAgent();
            IntrospectionSupport.setProperties(rc, options);
            rc.setServices(data.getComponents());

            return rc;

        } catch (Throwable e) {
            throw IOExceptionSupport.create("Could not create discovery agent: " + uri, e);
View Full Code Here

     *
     * @param _uri
     *            LDAP server URI
     */
    public void setUri(URI uri) throws Exception {
        CompositeData data = URISupport.parseComposite(uri);
        if (data.getScheme().equals("failover")) {
            availableURIs = data.getComponents();
            failover = true;
        } else {
            availableURIs = new URI[] { uri };
        }
    }
View Full Code Here

public class SimpleDiscoveryAgentFactory extends DiscoveryAgentFactory {

    protected DiscoveryAgent doCreateDiscoveryAgent(URI uri) throws IOException {
        try {
           
            CompositeData data = URISupport.parseComposite(uri);
            Map options = data.getParameters();

            SimpleDiscoveryAgent rc = new SimpleDiscoveryAgent();
            IntrospectionSupport.setProperties(rc, options);
            rc.setServices(data.getComponents());
           
            return rc;
           
        } catch (Throwable e) {
            throw IOExceptionSupport.create("Could not create discovery agent: " + uri, e);
View Full Code Here

        URI brokerURI;
        String host;
        Map<String, String> options;
        boolean create = true;
        int waitForStart = -1;
        CompositeData data = URISupport.parseComposite(location);
        if (data.getComponents().length == 1 && "broker".equals(data.getComponents()[0].getScheme())) {
            brokerURI = data.getComponents()[0];
            CompositeData brokerData = URISupport.parseComposite(brokerURI);
            host = (String)brokerData.getParameters().get("brokerName");
            if (host == null) {
                host = "localhost";
            }
            if (brokerData.getPath() != null) {
                host = brokerData.getPath();
            }
            options = data.getParameters();
            location = new URI("vm://" + host);
        } else {
            // If using the less complex vm://localhost?broker.persistent=true
View Full Code Here

     * @throws IOException
     * @throws URISyntaxException
     */
    public Transport createTransport(URI location) throws IOException, URISyntaxException {

        CompositeData compositeData = URISupport.parseComposite(location);
        Map<String, String> parameters = new HashMap<String, String>(compositeData.getParameters());
        DiscoveryTransport transport = new DiscoveryTransport(createTransport(parameters));

        DiscoveryAgent discoveryAgent = DiscoveryAgentFactory.createDiscoveryAgent(compositeData.getComponents()[0]);
        transport.setDiscoveryAgent(discoveryAgent);

        return transport;

    }
View Full Code Here

TOP

Related Classes of org.apache.activemq.util.URISupport.CompositeData

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.