/** * Parse the service URI into an array of names. The service URI is in one of the following formats: * <ul> * <li>componentName * <li>componentName/serviceName * <li>componentName/serviceName/bindingName * </ul> * @param serviceURI * @return */ private static String[] parseServiceURI(String serviceURI) { if (serviceURI.startsWith("/")) { serviceURI = serviceURI.substring(1); } if (serviceURI.contains("#")) { return parseStructuralURI(serviceURI); } String[] names = new String[3]; String[] segments = serviceURI.split("/"); for (int i = 0; i < names.length && i < segments.length; i++) { names[i] = segments[i]; } return names; }
/** * Parse the service URI into an array of names. The service URI is in one of the following formats: * <ul> * <li>componentName * <li>componentName/serviceName * <li>componentName/serviceName/bindingName * </ul> * @param serviceURI * @return */ private static String[] parseServiceURI(String serviceURI) { if (serviceURI.startsWith("/")) { serviceURI = serviceURI.substring(1); } if (serviceURI.contains("#")) { return parseStructuralURI(serviceURI); } String[] names = new String[3]; String[] segments = serviceURI.split("/"); for (int i = 0; i < names.length && i < segments.length; i++) { names[i] = segments[i]; } return names; }
public boolean matches(String serviceURI) { String[] parts1 = parseServiceURI(serviceURI); String[] parts2 = parseStructuralURI(getURI()); for (int i = 0; i < parts1.length; i++) { if (parts1[i] == null || parts1[i].equals(parts2[i])) { continue; } else { return false; } } return true; }
public boolean matches(String serviceURI) { String[] parts1 = parseServiceURI(serviceURI); String[] parts2 = parseStructuralURI(getURI()); for (int i = 0; i < parts1.length; i++) { if (parts1[i] == null || parts1[i].equals(parts2[i])) { continue; } else { return false; } } return true; }