{
out.println("PackageAdmin service is unavailable.");
return;
}
PackageAdmin pa = (PackageAdmin) m_context.getService(ref);
if (pa == null)
{
out.println("PackageAdmin service is unavailable.");
return;
}
// Array to hold the bundles.
Bundle[] bundles = null;
// Parse the bundle identifiers.
StringTokenizer st = new StringTokenizer(s, " ");
// Ignore the command name.
st.nextToken();
if (st.countTokens() >= 1)
{
List bundleList = new ArrayList();
while (st.hasMoreTokens())
{
String id = st.nextToken().trim();
try
{
long l = Long.parseLong(id);
Bundle bundle = m_context.getBundle(l);
if (bundle != null)
{
bundleList.add(bundle);
}
else
{
err.println("Bundle ID " + id + " is invalid.");
}
} catch (NumberFormatException ex) {
err.println("Unable to parse id '" + id + "'.");
}
}
if (bundleList.size() > 0)
{
bundles = (Bundle[]) bundleList.toArray(new Bundle[bundleList.size()]);
}
}
pa.resolveBundles(bundles);
}