Package org.apache.activemq.util.URISupport

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


    public Transport doCompositeConnect(URI location) throws Exception{
        URI brokerURI;
        String host;
        Map options;
        boolean create=true;
        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=data.getPath();
            options=data.getParameters();
            location=new URI("vm://"+host);
        }else{
            // If using the less complex vm://localhost?broker.persistent=true form
View Full Code Here


        } else {

            // It might be a composite URI.
            try {
                CompositeData data = URISupport.parseComposite(this.brokerURL);
                if (buildFromMap(IntrospectionSupport.extractProperties(data.getParameters(), "jms."))) {
                    this.brokerURL = data.toURI();
                }
            } catch (URISyntaxException e) {
            }
        }
    }
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 (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

    * @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

* @version $Revision: 1.1 $
*/
public class URISupportTest extends TestCase {
   
    public void testEmptyCompositePath() throws Exception {
        CompositeData data = URISupport.parseComposite(new URI("broker:()/localhost?persistent=false"));
        assertEquals(0, data.getComponents().length);       
    }
View Full Code Here

        CompositeData data = URISupport.parseComposite(new URI("broker:()/localhost?persistent=false"));
        assertEquals(0, data.getComponents().length);       
    }
           
    public void testCompositePath() throws Exception {
        CompositeData data = URISupport.parseComposite(new URI("test:(path)/path"));
        assertEquals("path", data.getPath());       
        data = URISupport.parseComposite(new URI("test:path"));
        assertNull(data.getPath());
    }
View Full Code Here

        data = URISupport.parseComposite(new URI("test:path"));
        assertNull(data.getPath());
    }

    public void testSimpleComposite() throws Exception {
        CompositeData data = URISupport.parseComposite(new URI("test:part1"));
        assertEquals(1, data.getComponents().length);
    }
View Full Code Here

        CompositeData data = URISupport.parseComposite(new URI("test:part1"));
        assertEquals(1, data.getComponents().length);
    }

    public void testComposite() throws Exception {
        CompositeData data = URISupport.parseComposite(new URI("test:(part1://host,part2://(sub1://part,sube2:part))"));
        assertEquals(2, data.getComponents().length);
    }
View Full Code Here

        assertEquals(2, data.getComponents().length);
    }

   
    public void testCompositeWithComponentParam() throws Exception {
        CompositeData data = URISupport.parseComposite(new URI("test:(part1://host?part1=true)?outside=true"));
        assertEquals(1, data.getComponents().length);
        assertEquals(1, data.getParameters().size());
        Map part1Params = URISupport.parseParamters(data.getComponents()[0]);
        assertEquals(1, part1Params.size());
        assertTrue(part1Params.containsKey("part1"));
    }
View Full Code Here

    protected void assertMapKey(Map map, String key, Object expected) {
        assertEquals("Map key: " + key, map.get(key), expected);
    }
   
    public void testParsingCompositeURI() throws URISyntaxException {
        CompositeData data = URISupport.parseComposite(new URI("broker://(tcp://localhost:61616)?name=foo"));
        assertEquals("one component", 1, data.getComponents().length);
        assertEquals("Size: " + data.getParameters(), 1, data.getParameters().size());
    }
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.