use of org.openecard.addon.manifest.AddonSpecification in project open-ecard by ecsec.
the class CacheTest method addAppExtAction.
@Test
public void addAppExtAction() {
AppExtensionActionProxy proxy = new AppExtensionActionProxy(null, null);
int initialHash = proxy.hashCode();
AddonSpecification spec = new AddonSpecification();
String id = "test";
spec.setId(id);
spec.setVersion("1.0.0");
cache.addAppExtensionAction(spec, id, proxy);
// now get it back from the cache
AppExtensionAction proto = cache.getAppExtensionAction(spec, id);
Assert.assertEquals(proto.hashCode(), initialHash);
}
use of org.openecard.addon.manifest.AddonSpecification in project open-ecard by ecsec.
the class ManagementDialog method createCoreList.
private void createCoreList() {
JLabel label = new JLabel(lang.translationForKey("addon.list.core", AppVersion.getName()));
label.setFont(label.getFont().deriveFont(Font.BOLD));
GridBagConstraints labelConstraints = new GridBagConstraints();
labelConstraints.insets = new Insets(5, 0, 5, 10);
labelConstraints.anchor = GridBagConstraints.NORTH;
labelConstraints.gridx = 0;
labelConstraints.gridy = 1;
selectionPanel.add(label, labelConstraints);
coreList = new JList();
coreList.setFont(coreList.getFont().deriveFont(Font.PLAIN));
coreList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
GridBagConstraints coreListConstraints = new GridBagConstraints();
coreListConstraints.fill = GridBagConstraints.HORIZONTAL;
coreListConstraints.insets = new Insets(0, 5, 5, 10);
coreListConstraints.anchor = GridBagConstraints.NORTH;
coreListConstraints.gridx = 0;
coreListConstraints.gridy = 2;
AddonSelectionModel model = new AddonSelectionModel(this, addonPanel);
coreList.setModel(model);
coreList.addListSelectionListener(model);
// save current addon settings when closed
addWindowListener(model);
// add addon panels
model.addElement(lang.translationForKey("addon.list.core.general"), new GeneralSettingsAddon());
model.addElement(lang.translationForKey("addon.list.core.connection"), new ConnectionSettingsAddon());
model.addElement(lang.translationForKey("addon.list.core.logging"), new LogSettingsAddon());
// an ActionPanel for every addon that has one ore more AppExtensionActions will be added
for (AddonSpecification desc : cpReg.listAddons()) {
createAddonPaneFromAddonSpec(desc, model, true);
}
selectionPanel.add(coreList, coreListConstraints);
}
use of org.openecard.addon.manifest.AddonSpecification in project open-ecard by ecsec.
the class ManagementDialog method createAddonList.
private void createAddonList() {
JLabel label = new JLabel(lang.translationForKey("addon.list.addon"));
label.setFont(label.getFont().deriveFont(Font.BOLD));
GridBagConstraints labelConstraints = new GridBagConstraints();
labelConstraints.insets = new Insets(5, 0, 5, 10);
labelConstraints.anchor = GridBagConstraints.NORTH;
labelConstraints.gridx = 0;
labelConstraints.gridy = 3;
selectionPanel.add(label, labelConstraints);
// TODO: remove this code
// label.setVisible(false);
addonList = new JList();
addonList.setFont(addonList.getFont().deriveFont(Font.PLAIN));
addonList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
GridBagConstraints addonListConstraints = new GridBagConstraints();
addonListConstraints.fill = GridBagConstraints.HORIZONTAL;
addonListConstraints.insets = new Insets(0, 5, 5, 10);
addonListConstraints.anchor = GridBagConstraints.NORTH;
addonListConstraints.gridx = 0;
addonListConstraints.gridy = 4;
AddonSelectionModel model = new AddonSelectionModel(this, addonPanel);
addonList.setModel(model);
addonList.addListSelectionListener(model);
// save current addon settings when closed
addWindowListener(model);
// this assumes that all addons in the FileRegistry are non core addons
for (AddonSpecification desc : fileReg.listAddons()) {
createAddonPaneFromAddonSpec(desc, model, false);
}
selectionPanel.add(addonList, addonListConstraints);
}
use of org.openecard.addon.manifest.AddonSpecification in project open-ecard by ecsec.
the class AddonFileSystemMonitor method replaceAddon.
private void replaceAddon(Path file) throws WSMarshallerException {
try {
// try to look up spec, only perform replace if there is not already a registered addon with the same id
AddonSpecification spec = extractSpec(file);
if (spec != null) {
removeAddon(file);
addAddon(file);
}
} catch (MultipleAddonRegistration ex) {
// addon is already registered properly, so do nothing
String fName = file.toFile().getName();
logger.error("The jar file {} is an already registered add-on.", fName);
}
}
use of org.openecard.addon.manifest.AddonSpecification in project open-ecard by ecsec.
the class AddonSelector method getSALProtocol.
public SALProtocol getSALProtocol(@Nonnull String uri) throws AddonNotFoundException {
Set<AddonSpecification> addons = manager.getRegistry().searchSALProtocol(uri);
if (addons.isEmpty()) {
throw new AddonNotFoundException("No Add-on for SAL protocol '" + uri + "' found.");
}
AddonSpecification addon = strategy.select(addons);
return manager.getSALProtocol(addon, uri);
}
Aggregations