Search in sources :

Example 1 with ServiceData

use of org.apache.aries.jmx.codec.ServiceData in project aries by apache.

the class ServiceState method listServices.

private TabularData listServices(String clazz, String filter, Collection<String> serviceTypeItems) throws IOException {
    TabularData servicesTable = new TabularDataSupport(SERVICES_TYPE);
    ServiceReference[] allServiceReferences = null;
    try {
        allServiceReferences = bundleContext.getAllServiceReferences(clazz, filter);
    } catch (InvalidSyntaxException e) {
        throw new IllegalStateException("Failed to retrieve all service references", e);
    }
    if (allServiceReferences != null) {
        for (ServiceReference reference : allServiceReferences) {
            servicesTable.put(new ServiceData(reference).toCompositeData(serviceTypeItems));
        }
    }
    return servicesTable;
}
Also used : TabularDataSupport(javax.management.openmbean.TabularDataSupport) InvalidSyntaxException(org.osgi.framework.InvalidSyntaxException) ServiceData(org.apache.aries.jmx.codec.ServiceData) TabularData(javax.management.openmbean.TabularData) ServiceReference(org.osgi.framework.ServiceReference)

Aggregations

TabularData (javax.management.openmbean.TabularData)1 TabularDataSupport (javax.management.openmbean.TabularDataSupport)1 ServiceData (org.apache.aries.jmx.codec.ServiceData)1 InvalidSyntaxException (org.osgi.framework.InvalidSyntaxException)1 ServiceReference (org.osgi.framework.ServiceReference)1