@@ -0,0 +1,2795 @@
+package org.jboss.cx.remoting.core.util;%0A%0Aimport java.net.URI;%0Aimport java.net.URISyntaxException;%0Aimport java.util.regex.Pattern;%0Aimport java.util.regex.Matcher;%0A%0A/**%0A *%0A */%0Apublic final class ServiceURI %7B%0A    public static final String SCHEME = %22jrs%22;%0A%0A    private static final String FIRST_CHAR = %22%5B$_a-zA-Z%5D%22;%0A    private static final String SUBSEQUENT_CHAR = %22%5B-+$_a-zA-Z0-9%5D*%22;%0A    private static final String ID = FIRST_CHAR + SUBSEQUENT_CHAR;%0A    private static final String SEPARATOR = %22%5B./%5D%22;%0A%0A    private static final Pattern VALID_PATTERN = Pattern.compile(%22%5E(?:%22 + ID + %22(?:%22 + SEPARATOR + ID + %22)*)*$%22);%0A%0A    private final URI uri;%0A    private final String serviceType;%0A    private final String groupName;%0A    private final String endpointName;%0A%0A    public ServiceURI(final String str) throws URISyntaxException %7B%0A        this(new URI(str));%0A    %7D%0A%0A    public ServiceURI(final URI uri) %7B%0A        this.uri = uri;%0A        if (! uri.getScheme().equals(SCHEME)) %7B%0A            throw new IllegalArgumentException(%22Invalid URI scheme for service%22);%0A        %7D%0A        final String ssp = uri.getSchemeSpecificPart();%0A        final int stcp = ssp.indexOf(':');%0A        if (stcp == -1) %7B%0A            serviceType = ssp;%0A            groupName = %22%22;%0A            endpointName = %22%22;%0A        %7D else %7B%0A            serviceType = ssp.substring(0, stcp).trim();%0A            final int gncp = ssp.indexOf(':', stcp + 1);%0A            if (gncp == -1) %7B%0A                groupName = ssp.substring(stcp + 1).trim();%0A                endpointName = %22%22;%0A            %7D else %7B%0A                groupName = ssp.substring(stcp + 1, gncp).trim();%0A                // ignore everything after the last :%0A                final int encp = ssp.indexOf(':', gncp + 1);%0A                if (encp == -1) %7B%0A                    endpointName = ssp.substring(gncp + 1).trim();%0A                %7D else %7B%0A                    endpointName = ssp.substring(gncp + 1, encp).trim();%0A                %7D%0A            %7D%0A        %7D%0A        final Matcher matcher = VALID_PATTERN.matcher(serviceType);%0A        if (! matcher.matches()) %7B%0A            throw new IllegalArgumentException(%22Syntax error in service type URI part%22);%0A        %7D%0A        matcher.reset(groupName);%0A        if (! matcher.matches()) %7B%0A            throw new IllegalArgumentException(%22Syntax error in group name URI part%22);%0A        %7D%0A        matcher.reset(endpointName);%0A        if (! matcher.matches()) %7B%0A            throw new IllegalArgumentException(%22Syntax error in endpoint name URI part%22);%0A        %7D%0A    %7D%0A%0A    public URI getUri() %7B%0A        return uri;%0A    %7D%0A%0A    public String getServiceType() %7B%0A        return serviceType;%0A    %7D%0A%0A    public String getGroupName() %7B%0A        return groupName;%0A    %7D%0A%0A    public String getEndpointName() %7B%0A        return endpointName;%0A    %7D%0A%7D%0A

Add service URI utility class