}
StartLevel startLevel = visitor.getStartLevel();
if (startLevel == null) {
throw new IOException("StartLevel is not available");
}
TabularDataSupport dataSupport = new TabularDataSupport(BUNDLES_TYPE);
if (bundles != null) {
for (Bundle bundle : bundles) {
Map<String, Object> values = new HashMap<String, Object>();
values.put(EXPORTED_PACKAGES, getExportedPackages(bundle, packageAdmin));
values.put(FRAGMENT, isFragment(bundle, packageAdmin));
values.put(FRAGMENTS, Utils.toLongArray(getFragments(bundle, packageAdmin)));
values.put(HEADERS, getHeaders(bundle));
values.put(HOSTS, Utils.toLongArray(getHosts(bundle, packageAdmin)));
values.put(IDENTIFIER, bundle.getBundleId());
values.put(IMPORTED_PACKAGES, getImportedPackages(bundle, packageAdmin));
values.put(LAST_MODIFIED, bundle.getLastModified());
values.put(LOCATION, bundle.getLocation());
values.put(PERSISTENTLY_STARTED, isPersistentlyStarted(bundle, startLevel));
values.put(REGISTERED_SERVICES, Utils.toLongArray(getRegisteredServices(bundle)));
values.put(REMOVAL_PENDING, isRemovalPending(bundle, packageAdmin));
values.put(REQUIRED, isRequired(bundle, packageAdmin));
values.put(REQUIRED_BUNDLES, Utils.toLongArray(getRequiredBundles(bundle, packageAdmin)));
values.put(REQUIRING_BUNDLES, Utils.toLongArray(getRequiringBundles(bundle, packageAdmin)));
values.put(START_LEVEL, getStartLevel(bundle, startLevel));
values.put(STATE, getState(bundle));
values.put(SERVICES_IN_USE, Utils.toLongArray(getServicesInUse(bundle)));
values.put(SYMBOLIC_NAME, getSymbolicName(bundle));
values.put(VERSION, getVersion(bundle));
dataSupport.put(new CompositeDataSupport(BUNDLE_TYPE, values));
}
}
return dataSupport;
} catch (IOException e) {
logVisitor.warning("listBundles error", e);