use of javax.management.openmbean.TabularDataSupport in project aries by apache.
the class BundleWiringData method getCapReqCompositeData.
private static CompositeData getCapReqCompositeData(CompositeType type, String namespace, Set<Map.Entry<String, Object>> attributeSet, Set<Map.Entry<String, String>> directiveSet) throws OpenDataException {
Map<String, Object> reqItems = new HashMap<String, Object>();
TabularData attributes = new TabularDataSupport(BundleWiringStateMBean.ATTRIBUTES_TYPE);
for (Map.Entry<String, Object> entry : attributeSet) {
PropertyData<?> pd = PropertyData.newInstance(entry.getKey(), entry.getValue());
attributes.put(pd.toCompositeData());
}
reqItems.put(BundleWiringStateMBean.ATTRIBUTES, attributes);
TabularData directives = new TabularDataSupport(BundleWiringStateMBean.DIRECTIVES_TYPE);
for (Map.Entry<String, String> entry : directiveSet) {
CompositeData directive = new CompositeDataSupport(BundleWiringStateMBean.DIRECTIVE_TYPE, new String[] { BundleWiringStateMBean.KEY, BundleWiringStateMBean.VALUE }, new Object[] { entry.getKey(), entry.getValue() });
directives.put(directive);
}
reqItems.put(BundleWiringStateMBean.DIRECTIVES, directives);
reqItems.put(BundleWiringStateMBean.NAMESPACE, namespace);
CompositeData req = new CompositeDataSupport(type, reqItems);
return req;
}
use of javax.management.openmbean.TabularDataSupport in project aries by apache.
the class ServiceState method getProperties.
/**
* @see org.osgi.jmx.framework.ServiceStateMBean#getProperties(long)
*/
public TabularData getProperties(long serviceId) throws IOException {
ServiceReference reference = resolveService(bundleContext, serviceId);
TabularData propertiesTable = new TabularDataSupport(PROPERTIES_TYPE);
for (String propertyKey : reference.getPropertyKeys()) {
propertiesTable.put(PropertyData.newInstance(propertyKey, reference.getProperty(propertyKey)).toCompositeData());
}
return propertiesTable;
}
use of javax.management.openmbean.TabularDataSupport 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;
}
use of javax.management.openmbean.TabularDataSupport in project aries by apache.
the class UserAdmin method getProperties.
/**
* @see org.osgi.jmx.service.useradmin.UserAdminMBean#getProperties(java.lang.String)
*/
public TabularData getProperties(String rolename) throws IOException {
if (rolename == null) {
throw new IOException("Role name cannot be null");
}
Role role = userAdmin.getRole(rolename);
if (role == null) {
return null;
}
Dictionary<String, Object> properties = role.getProperties();
if (properties == null) {
return null;
}
TabularData data = new TabularDataSupport(JmxConstants.PROPERTIES_TYPE);
for (Enumeration<String> keys = properties.keys(); keys.hasMoreElements(); ) {
String key = keys.nextElement();
data.put(PropertyData.newInstance(key, properties.get(key)).toCompositeData());
}
return data;
}
use of javax.management.openmbean.TabularDataSupport in project aries by apache.
the class BundleWiringState method getRevisionsWiring.
/* (non-Javadoc)
* @see org.osgi.jmx.framework.BundleRevisionsStateMBean#getRevisionsWiring(long, java.lang.String)
*/
public TabularData getRevisionsWiring(long bundleId, String namespace) throws IOException {
Bundle bundle = FrameworkUtils.resolveBundle(bundleContext, bundleId);
BundleRevisions revisions = bundle.adapt(BundleRevisions.class);
TabularData td = new TabularDataSupport(BundleWiringStateMBean.BUNDLES_WIRING_TYPE);
for (BundleRevision revision : revisions.getRevisions()) {
Map<BundleRevision, Integer> revisionIDMap = getRevisionTransitiveClosure(revision, namespace);
td.put(getRevisionWiring(revision, System.identityHashCode(revision), namespace, revisionIDMap));
}
return td;
}
Aggregations