Search in sources :

Example 21 with AddonSpecification

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);
}
Also used : AppExtensionAction(org.openecard.addon.bind.AppExtensionAction) AddonSpecification(org.openecard.addon.manifest.AddonSpecification) AppExtensionActionProxy(org.openecard.addon.bind.AppExtensionActionProxy) Test(org.testng.annotations.Test)

Example 22 with AddonSpecification

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);
}
Also used : GridBagConstraints(java.awt.GridBagConstraints) LogSettingsAddon(org.openecard.richclient.gui.manage.core.LogSettingsAddon) Insets(java.awt.Insets) GeneralSettingsAddon(org.openecard.richclient.gui.manage.core.GeneralSettingsAddon) ConnectionSettingsAddon(org.openecard.richclient.gui.manage.core.ConnectionSettingsAddon) JLabel(javax.swing.JLabel) AddonSpecification(org.openecard.addon.manifest.AddonSpecification) JList(javax.swing.JList)

Example 23 with AddonSpecification

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);
}
Also used : GridBagConstraints(java.awt.GridBagConstraints) Insets(java.awt.Insets) JLabel(javax.swing.JLabel) AddonSpecification(org.openecard.addon.manifest.AddonSpecification) JList(javax.swing.JList)

Example 24 with AddonSpecification

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);
    }
}
Also used : AddonSpecification(org.openecard.addon.manifest.AddonSpecification)

Example 25 with AddonSpecification

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);
}
Also used : AddonSpecification(org.openecard.addon.manifest.AddonSpecification)

Aggregations

AddonSpecification (org.openecard.addon.manifest.AddonSpecification)37 Test (org.testng.annotations.Test)21 AppPluginActionProxy (org.openecard.addon.bind.AppPluginActionProxy)5 IOException (java.io.IOException)4 HashSet (java.util.HashSet)4 AppExtensionAction (org.openecard.addon.bind.AppExtensionAction)4 AppExtensionActionProxy (org.openecard.addon.bind.AppExtensionActionProxy)3 AppPluginAction (org.openecard.addon.bind.AppPluginAction)3 GridBagConstraints (java.awt.GridBagConstraints)2 Insets (java.awt.Insets)2 ArrayList (java.util.ArrayList)2 TreeSet (java.util.TreeSet)2 JLabel (javax.swing.JLabel)2 JList (javax.swing.JList)2 AddonRegistry (org.openecard.addon.AddonRegistry)2 IFDProtocolProxy (org.openecard.addon.ifd.IFDProtocolProxy)2 ProtocolPluginSpecification (org.openecard.addon.manifest.ProtocolPluginSpecification)2 SALProtocolProxy (org.openecard.addon.sal.SALProtocolProxy)2 InitializeFramework (de.bund.bsi.ecard.api._1.InitializeFramework)1 ApplicationCapabilitiesType (iso.std.iso_iec._24727.tech.schema.ApplicationCapabilitiesType)1