use of org.openecard.mdlw.sal.config.MiddlewareConfig in project open-ecard by ecsec.
the class MwStateCallback method addEntry.
public boolean addEntry(MwEventObject o) {
try {
ConnectionHandleType handle = o.getHandle();
MwSlot slot = o.getMwSlot();
MwToken token = slot.getTokenInfo();
String cardType = null;
String type = String.format("%s_%s", token.getManufacturerID(), token.getModel());
for (MiddlewareConfig mwConfig : mwConfigs) {
cardType = mwConfig.mapMiddlewareType(type);
if (cardType != null) {
break;
}
}
CardInfoType cif = null;
if (cardType != null) {
cif = env.getCIFProvider().getCardInfo(handle, cardType);
}
if (cif == null) {
LOG.warn("Unknown card recognized by Middleware.");
return false;
}
// create new entry in card states
CardStateEntry entry = new CardStateEntry(handle, cif, null);
states.addEntry(entry);
return true;
} catch (CryptokiException ex) {
LOG.info("Cryptoki Token invalid.", ex);
} catch (RuntimeException ex) {
LOG.error("Error in CIF augmentation process.", ex);
}
return false;
}
Aggregations