protected void extractResolveMethod(final URI uri) { final String rawMethod = uri.getScheme(); Assertions.assertNotNullOrEmpty(rawMethod, "Resolve method not specified, please use format [resolve-method]:///[destination-name] [{}]", m_rawValue); m_resolveMethod = Assertions.assertNotNull(ResolveMethod.parse(rawMethod), "Unknown resolve method: '{}' [{}]", rawMethod, m_rawValue); }
protected void extractDestinationName(final URI uri) { String name; if (uri.isOpaque()) { // "scheme:scheme-specific-part" name = uri.getSchemeSpecificPart(); } else { // "scheme://host/path?parameters=map" name = StringUtility.join("", uri.getHost(), uri.getPath()); // If the host is empty, strip the path's leading slash. This is the case if three slashes are used after // the scheme. This format is recommended, because the host (unlike the path) may not contain special characters. if (StringUtility.startsWith(name, "/")) { name = name.substring(1); } } m_destinationName = Assertions.assertNotNullOrEmpty(name, "Missing destination name [{}]", m_rawValue); }
/** * @param name * the symbolic name for the destination * @param destinationType * the type of the resource that this destination represents, e.g. {@link DestinationType#QUEUE} * @param resolveMethod * the method how to resolve the actual destination, e.g. {@link ResolveMethod#JNDI} * @param properties * optional map of additional properties used to resolve the destination (may be set to <code>null</code> if * no properties are required) * @throws AssertionException * if one of <code>name</code>, <code>type</code> or <code>resolveMethod</code> is <code>null</code> or * empty */ public Destination(final String name, final IDestinationType type, IResolveMethod resolveMethod, Map<String, String> properties) { m_name = assertNotNullOrEmpty(name, "destination name not specified"); m_type = assertNotNull(type, "destination type not specified"); m_resolveMethod = assertNotNull(resolveMethod, "resolve method not specified"); m_properties = (properties == null ? Collections.emptyMap() : Collections.unmodifiableMap(properties)); }