use of org.openecard.addon.AddonSelector in project open-ecard by ecsec.
the class ActivationController method activate.
/**
* Performs an activation according to BSI TR-03124-1, but does not perform the return to web session part.
* A result containing the outcome of the
*
* @param url
* @return
*/
public ActivationResult activate(String url) {
// create request uri and extract query strings
URI requestURI = URI.create(url);
String path = requestURI.getPath();
// remove leading '/'
String resourceName = path.substring(1, path.length());
// find suitable addon
String failureMessage;
AddonManager manager = sctx.getManager();
AddonSelector selector = new AddonSelector(manager);
try {
if (manager == null || selector == null) {
throw new IllegalStateException("Addon initialization failed.");
} else {
AppPluginAction action = selector.getAppPluginAction(resourceName);
String rawQuery = requestURI.getRawQuery();
Map<String, String> queries = new HashMap<>(0);
if (rawQuery != null) {
queries = HttpRequestLineUtils.transform(rawQuery);
}
BindingResult result = action.execute(null, queries, null, null);
return createActivationResult(result);
}
} catch (AddonNotFoundException ex) {
failureMessage = ex.getMessage();
LOG.info("Addon not found.", ex);
} catch (UnsupportedEncodingException ex) {
failureMessage = "Unsupported encoding.";
LOG.warn(failureMessage, ex);
} catch (Exception ex) {
failureMessage = ex.getMessage();
LOG.warn(ex.getMessage(), ex);
}
LOG.info("Returning error as INTERRUPTED result.");
return new ActivationResult(INTERRUPTED, failureMessage);
}
use of org.openecard.addon.AddonSelector in project open-ecard by ecsec.
the class TinySAL method setAddonManager.
public void setAddonManager(AddonManager manager) {
protocolSelector = new AddonSelector(manager);
protocolSelector.setStrategy(new HighestVersionSelector());
}
Aggregations