public int cmdInfo(Dictionary opts, Reader in, PrintWriter outPW, Session session) {
String[] infos = (String[])opts.get("name;version");
ParsedCommand pc = parseInfo(infos);
for (int i = 0; (pc != null) && (i < pc.getTargetCount()); i++) {
BundleRecord record = null;
// If there is no version, then try to retrieve by
// name, but error if there are multiple versions.
if (pc.getTargetVersion(i) == null) {
BundleRecord[] records =
brs.getBundleRecords(pc.getTargetName(i));
if (records.length == 1) {
record = records[0];
} else {
}
} else {
record =
brs.getBundleRecord(pc.getTargetName(i),
new Version(pc.getTargetVersion(i)));
}
if (record != null) {
PrintStream outStream = new PrintWriterStream(outPW);
record.printAttributes(outStream);
} else {
outPW.println("Unknown bundle or ambiguous version: "
+ pc.getTargetName(i));
for (int j = 0; j < brs.getBundleRecordCount(); j++) {
BundleRecord r2 = brs.getBundleRecord(j);
String name = (String) r2.getAttribute(BundleRecord.BUNDLE_NAME);
String version = (String) r2.getAttribute(BundleRecord.BUNDLE_VERSION);
if(name.equals(pc.getTargetName(i))) {
outPW.println(" \"" + name + ";" + version + "\"");
}
}
}