/** * */ package at.knowcenter.wag.egov.egiz.sig.sigid; import org.apache.commons.lang.StringUtils; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import at.knowcenter.wag.egov.egiz.cfg.SettingsReader; import at.knowcenter.wag.egov.egiz.exceptions.SettingsException; /** * @author tknall * */ public class DetachedMOCIdFormatter implements IdFormatter { public static String SIG_ID_PREFIX = "etsi-moc-1.0"; /** * Key value in property file */ public static final String SIG_ID_PROPERTY_KEY = "default.moc.algorithm.id"; /** * The log. */ private static Log log = LogFactory.getLog(DetachedIdFormatter.class); /** * @see at.knowcenter.wag.egov.egiz.sig.sigid.IdFormatter#formatIds(java.lang.String[]) */ public String formatIds(String[] ids) { // read id from property file and use it String prefix = null; try { prefix = SettingsReader.getInstance().getValueFromKey(SIG_ID_PROPERTY_KEY); } catch (SettingsException e) { log.error(e.getMessage(), e); } prefix = StringUtils.defaultIfEmpty(prefix, SIG_ID_PREFIX); StringBuffer formattedIds = new StringBuffer(prefix).append("@").append(ids[0]); return formattedIds.toString(); } }