private List getInterfaceNames()

in rsa/src/main/java/org/apache/aries/rsa/core/RemoteServiceAdminCore.java [297:324]


    private List<String> getInterfaceNames(Map<String, Object> serviceProperties) {
        List<String> providedInterfaces = StringPlus.normalize(serviceProperties.get(org.osgi.framework.Constants.OBJECTCLASS));
        if (providedInterfaces == null || providedInterfaces.isEmpty()) {
            throw new IllegalArgumentException("service is missing the objectClass property");
        }

        List<String> exportedInterfaces
            = StringPlus.normalize(serviceProperties.get(RemoteConstants.SERVICE_EXPORTED_INTERFACES));
        if (exportedInterfaces == null || exportedInterfaces.isEmpty()) {
            throw new IllegalArgumentException("service is missing the service.exported.interfaces property");
        }

        List<String> interfaces = new ArrayList<>(1);
        if (exportedInterfaces.size() == 1 && "*".equals(exportedInterfaces.get(0))) {
            // FIXME: according to the spec, this should only return the interfaces, and not
            // non-interface classes (which are valid OBJECTCLASS values, even if discouraged)
            interfaces.addAll(providedInterfaces);
        } else {
            if (!providedInterfaces.containsAll(exportedInterfaces)) {
                throw new IllegalArgumentException(String.format(
                    "exported interfaces %s must be a subset of the service's registered types %s",
                        exportedInterfaces, providedInterfaces));
            }

            interfaces.addAll(exportedInterfaces);
        }
        return interfaces;
    }