use of aQute.bnd.osgi.Instructions in project bnd by bndtools.
the class Main method _settings.
@Description("Manage user settings of jpm (in ~/.jpm)")
public void _settings(settingOptions opts) throws Exception {
try {
logger.debug("settings {}", opts.clear());
List<String> rest = opts._arguments();
if (opts.clear()) {
settings.clear();
logger.debug("clear {}", settings.entrySet());
}
if (opts.publicKey()) {
out.println(tos(opts.hex(), settings.getPublicKey()));
return;
}
if (opts.secretKey()) {
out.println(tos(opts.hex(), settings.getPrivateKey()));
return;
}
if (opts.id()) {
out.printf("%s\n", tos(opts.hex(), settings.getPublicKey()));
}
if (opts.mac()) {
for (String s : rest) {
byte[] data = s.getBytes(UTF_8);
byte[] signature = settings.sign(data);
out.printf("%s\n", tos(opts.hex(), signature));
}
return;
}
if (rest.isEmpty()) {
list(null, settings);
} else {
boolean set = false;
for (String s : rest) {
Matcher m = ASSIGNMENT.matcher(s);
logger.debug("try {}", s);
if (m.matches()) {
logger.debug("matches {} {} {}", s, m.group(1), m.group(2));
String key = m.group(1);
Instructions instr = new Instructions(key);
Collection<String> select = instr.select(settings.keySet(), true);
String value = m.group(2);
if (value == null) {
logger.debug("list wildcard {} {} {}", instr, select, settings.keySet());
list(select, settings);
} else {
logger.debug("assignment ");
settings.put(key, value);
set = true;
}
} else {
err.printf("Cannot assign %s\n", s);
}
}
if (set) {
logger.debug("saving");
settings.save();
}
}
} catch (Exception e) {
e.printStackTrace();
}
}
use of aQute.bnd.osgi.Instructions in project bndtools by bndtools.
the class DeltaWrapper method hasChangedSubbundles.
public boolean hasChangedSubbundles() throws CoreException {
if (delta == null)
return true;
final List<String> files = toFiles(false);
Instructions instr = new Instructions(model.getProperty(Constants.SUB));
Collection<String> selected = instr.select(files, false);
return !selected.isEmpty();
}
Aggregations