/** * Given a URI parse and extract any URI query options and return them as a Key / Value mapping. * * This method differs from the {@link parseQuery} method in that it handles composite URI types and * will extract the URI options from the outermost composite URI. * * @param uri The URI whose query should be extracted and processed. * @return A Mapping of the URI options. * @throws java.net.URISyntaxException */ public static Map<String, String> parseParameters(URI uri) throws URISyntaxException { if (!isCompositeURI(uri)) { return uri.getQuery() == null ? emptyMap() : parseQuery(stripPrefix(uri.getQuery(), "?")); } else { CompositeData data = URISupport.parseComposite(uri); Map<String, String> parameters = new HashMap<>(); parameters.putAll(data.getParameters()); if (parameters.isEmpty()) { parameters = emptyMap(); } return parameters; } }
/** * Given a composite URI, parse the individual URI elements contained within that URI and return * a CompositeData instance that contains the parsed URI values. * * @param uri The target URI that should be parsed. * @return a new CompositeData instance representing the parsed composite URI. * @throws java.net.URISyntaxException */ public static CompositeData parseComposite(URI uri) throws URISyntaxException { CompositeData rc = new CompositeData(); rc.scheme = uri.getScheme(); String ssp = stripPrefix(uri.getRawSchemeSpecificPart().trim(), "//").trim(); parseComposite(uri, rc, ssp); rc.fragment = uri.getFragment(); return rc; }
/** * Given a URI parse and extract any URI query options and return them as a Key / Value mapping. * * This method differs from the {@link parseQuery} method in that it handles composite URI types and * will extract the URI options from the outermost composite URI. * * @param uri The URI whose query should be extracted and processed. * @return A Mapping of the URI options. * @throws java.net.URISyntaxException */ public static Map<String, String> parseParameters(URI uri) throws URISyntaxException { if (!isCompositeURI(uri)) { return uri.getQuery() == null ? emptyMap() : parseQuery(stripPrefix(uri.getQuery(), "?")); } else { CompositeData data = URISupport.parseComposite(uri); Map<String, String> parameters = new HashMap<>(); parameters.putAll(data.getParameters()); if (parameters.isEmpty()) { parameters = emptyMap(); } return parameters; } }
/** * Given a URI parse and extract any URI query options and return them as a Key / Value mapping. * * This method differs from the {@link parseQuery} method in that it handles composite URI types and * will extract the URI options from the outermost composite URI. * * @param uri The URI whose query should be extracted and processed. * @return A Mapping of the URI options. * @throws java.net.URISyntaxException */ public static Map<String, String> parseParameters(URI uri) throws URISyntaxException { if (!isCompositeURI(uri)) { return uri.getQuery() == null ? emptyMap() : parseQuery(stripPrefix(uri.getQuery(), "?")); } else { CompositeData data = URISupport.parseComposite(uri); Map<String, String> parameters = new HashMap<>(); parameters.putAll(data.getParameters()); if (parameters.isEmpty()) { parameters = emptyMap(); } return parameters; } }
/** * Given a URI parse and extract any URI query options and return them as a Key / Value mapping. * * This method differs from the {@link parseQuery} method in that it handles composite URI types and * will extract the URI options from the outermost composite URI. * * @param uri The URI whose query should be extracted and processed. * @return A Mapping of the URI options. * @throws java.net.URISyntaxException */ public static Map<String, String> parseParameters(URI uri) throws URISyntaxException { if (!isCompositeURI(uri)) { return uri.getQuery() == null ? emptyMap() : parseQuery(stripPrefix(uri.getQuery(), "?")); } else { CompositeData data = URISupport.parseComposite(uri); Map<String, String> parameters = new HashMap<>(); parameters.putAll(data.getParameters()); if (parameters.isEmpty()) { parameters = emptyMap(); } return parameters; } }
/** * Given a URI parse and extract any URI query options and return them as a Key / Value mapping. * * This method differs from the {@link parseQuery} method in that it handles composite URI types and * will extract the URI options from the outermost composite URI. * * @param uri The URI whose query should be extracted and processed. * @return A Mapping of the URI options. * @throws java.net.URISyntaxException */ public static Map<String, String> parseParameters(URI uri) throws URISyntaxException { if (!isCompositeURI(uri)) { return uri.getQuery() == null ? emptyMap() : parseQuery(stripPrefix(uri.getQuery(), "?")); } else { CompositeData data = URISupport.parseComposite(uri); Map<String, String> parameters = new HashMap<>(); parameters.putAll(data.getParameters()); if (parameters.isEmpty()) { parameters = emptyMap(); } return parameters; } }
/** * Given a URI parse and extract any URI query options and return them as a Key / Value mapping. * * This method differs from the {@link parseQuery} method in that it handles composite URI types and * will extract the URI options from the outermost composite URI. * * @param uri The URI whose query should be extracted and processed. * @return A Mapping of the URI options. * @throws java.net.URISyntaxException */ public static Map<String, String> parseParameters(URI uri) throws URISyntaxException { if (!isCompositeURI(uri)) { return uri.getQuery() == null ? emptyMap() : parseQuery(stripPrefix(uri.getQuery(), "?")); } else { CompositeData data = URISupport.parseComposite(uri); Map<String, String> parameters = new HashMap<>(); parameters.putAll(data.getParameters()); if (parameters.isEmpty()) { parameters = emptyMap(); } return parameters; } }
/** * Given a URI parse and extract any URI query options and return them as a Key / Value mapping. * * This method differs from the {@link parseQuery} method in that it handles composite URI types and * will extract the URI options from the outermost composite URI. * * @param uri The URI whose query should be extracted and processed. * @return A Mapping of the URI options. * @throws java.net.URISyntaxException */ public static Map<String, String> parseParameters(URI uri) throws URISyntaxException { if (!isCompositeURI(uri)) { return uri.getQuery() == null ? emptyMap() : parseQuery(stripPrefix(uri.getQuery(), "?")); } else { CompositeData data = URISupport.parseComposite(uri); Map<String, String> parameters = new HashMap<>(); parameters.putAll(data.getParameters()); if (parameters.isEmpty()) { parameters = emptyMap(); } return parameters; } }
/** * Given a composite URI, parse the individual URI elements contained within that URI and return * a CompositeData instance that contains the parsed URI values. * * @param uri The target URI that should be parsed. * @return a new CompositeData instance representing the parsed composite URI. * @throws java.net.URISyntaxException */ public static CompositeData parseComposite(URI uri) throws URISyntaxException { CompositeData rc = new CompositeData(); rc.scheme = uri.getScheme(); String ssp = stripPrefix(uri.getRawSchemeSpecificPart().trim(), "//").trim(); parseComposite(uri, rc, ssp); rc.fragment = uri.getFragment(); return rc; }
/** * Given a composite URI, parse the individual URI elements contained within that URI and return * a CompositeData instance that contains the parsed URI values. * * @param uri The target URI that should be parsed. * @return a new CompositeData instance representing the parsed composite URI. * @throws java.net.URISyntaxException */ public static CompositeData parseComposite(URI uri) throws URISyntaxException { CompositeData rc = new CompositeData(); rc.scheme = uri.getScheme(); String ssp = stripPrefix(uri.getRawSchemeSpecificPart().trim(), "//").trim(); parseComposite(uri, rc, ssp); rc.fragment = uri.getFragment(); return rc; }
/** * Given a composite URI, parse the individual URI elements contained within that URI and return * a CompositeData instance that contains the parsed URI values. * * @param uri The target URI that should be parsed. * @return a new CompositeData instance representing the parsed composite URI. * @throws java.net.URISyntaxException */ public static CompositeData parseComposite(URI uri) throws URISyntaxException { CompositeData rc = new CompositeData(); rc.scheme = uri.getScheme(); String ssp = stripPrefix(uri.getRawSchemeSpecificPart().trim(), "//").trim(); parseComposite(uri, rc, ssp); rc.fragment = uri.getFragment(); return rc; }
/** * Given a composite URI, parse the individual URI elements contained within that URI and return * a CompositeData instance that contains the parsed URI values. * * @param uri The target URI that should be parsed. * @return a new CompositeData instance representing the parsed composite URI. * @throws java.net.URISyntaxException */ public static CompositeData parseComposite(URI uri) throws URISyntaxException { CompositeData rc = new CompositeData(); rc.scheme = uri.getScheme(); String ssp = stripPrefix(uri.getRawSchemeSpecificPart().trim(), "//").trim(); parseComposite(uri, rc, ssp); rc.fragment = uri.getFragment(); return rc; }
/** * This method will match the configuration and return the proper TransportConfiguration for the Configuration */ public TransportConfiguration[] getTransportConfigurations(Configuration configuration) throws Exception { if (getCompositeMembers() != null) { URI[] members = getCompositeMembers().getComponents(); List<TransportConfiguration> list = new LinkedList<>(); for (URI member : members) { list.addAll(ConfigurationUtils.parseConnectorURI(null, member)); } return list.toArray(new TransportConfiguration[list.size()]); } else { return staticConnectors != null ? configuration.getTransportConfigurations(staticConnectors) : null; } }
/** * Given a composite URI, parse the individual URI elements contained within that URI and return * a CompositeData instance that contains the parsed URI values. * * @param uri The target URI that should be parsed. * @return a new CompositeData instance representing the parsed composite URI. * @throws java.net.URISyntaxException */ public static CompositeData parseComposite(URI uri) throws URISyntaxException { CompositeData rc = new CompositeData(); rc.scheme = uri.getScheme(); String ssp = stripPrefix(uri.getRawSchemeSpecificPart().trim(), "//").trim(); parseComposite(uri, rc, ssp); rc.fragment = uri.getFragment(); return rc; }
/** * Given a composite URI, parse the individual URI elements contained within that URI and return * a CompositeData instance that contains the parsed URI values. * * @param uri The target URI that should be parsed. * @return a new CompositeData instance representing the parsed composite URI. * @throws java.net.URISyntaxException */ public static CompositeData parseComposite(URI uri) throws URISyntaxException { CompositeData rc = new CompositeData(); rc.scheme = uri.getScheme(); String ssp = stripPrefix(uri.getRawSchemeSpecificPart().trim(), "//").trim(); parseComposite(uri, rc, ssp); rc.fragment = uri.getFragment(); return rc; }
@Test public void testClusterConnectionStatic2() throws Exception { ClusterConnectionConfigurationParser parser = new ClusterConnectionConfigurationParser(); ClusterConnectionConfiguration configuration = parser.newObject(new URI("static://(tcp://localhost:6556,tcp://localhost:6557)?minLargeMessageSize=132;messageLoadBalancingType=OFF"), null); Assert.assertEquals(132, configuration.getMinLargeMessageSize()); Assert.assertEquals(2, configuration.getCompositeMembers().getComponents().length); Assert.assertEquals("tcp://localhost:6556", configuration.getCompositeMembers().getComponents()[0].toString()); Assert.assertEquals("tcp://localhost:6557", configuration.getCompositeMembers().getComponents()[1].toString()); }
@Test public void testClusterConnectionStatic() throws Exception { ClusterConnectionConfigurationParser parser = new ClusterConnectionConfigurationParser(); ClusterConnectionConfiguration configuration = parser.newObject(new URI("static:(tcp://localhost:6556,tcp://localhost:6557)?minLargeMessageSize=132;s&messageLoadBalancingType=OFF"), null); Assert.assertEquals(MessageLoadBalancingType.OFF, configuration.getMessageLoadBalancingType()); Assert.assertEquals(132, configuration.getMinLargeMessageSize()); Assert.assertEquals("tcp://localhost:6556", configuration.getCompositeMembers().getComponents()[0].toString()); Assert.assertEquals("tcp://localhost:6557", configuration.getCompositeMembers().getComponents()[1].toString()); }
@Override public void populateObject(URI uri, ClusterConnectionConfiguration bean) throws Exception { URISupport.CompositeData compositeData = URISupport.parseComposite(uri); bean.setCompositeMembers(compositeData); BeanSupport.setData(uri, bean, compositeData.getParameters()); }
@Test public void testClusterConnectionStaticOnConstrcutor() throws Exception { ClusterConnectionConfiguration configuration = new ClusterConnectionConfiguration(new URI("static:(tcp://localhost:6556,tcp://localhost:6557)?minLargeMessageSize=132")); Assert.assertEquals(132, configuration.getMinLargeMessageSize()); Assert.assertEquals("tcp://localhost:6556", configuration.getCompositeMembers().getComponents()[0].toString()); Assert.assertEquals("tcp://localhost:6557", configuration.getCompositeMembers().getComponents()[1].toString()); }