Search in sources :

Example 1 with DbCertStatusStore

use of org.xipki.ocsp.server.impl.store.db.DbCertStatusStore in project xipki by xipki.

the class OcspServerImpl method newStore.

// method initSigner
private OcspStore newStore(StoreType conf, Map<String, DataSourceWrapper> datasources) throws InvalidConfException {
    OcspStore store;
    String type = conf.getSource().getType();
    if ("CRL".equalsIgnoreCase(type)) {
        store = new CrlDbCertStatusStore();
    } else if ("XIPKI-DB".equals(type)) {
        store = new DbCertStatusStore();
    } else {
        try {
            store = ocspStoreFactoryRegister.newOcspStore(conf.getSource().getType());
        } catch (ObjectCreationException ex) {
            throw new InvalidConfException("ObjectCreationException of store " + conf.getName() + ":" + ex.getMessage(), ex);
        }
    }
    store.setName(conf.getName());
    Integer interval = conf.getRetentionInterval();
    int retentionInterva = (interval == null) ? -1 : interval.intValue();
    store.setRetentionInterval(retentionInterva);
    store.setUnknownSerialAsGood(getBoolean(conf.isUnknownSerialAsGood(), false));
    store.setIncludeArchiveCutoff(getBoolean(conf.isIncludeArchiveCutoff(), true));
    store.setIncludeCrlId(getBoolean(conf.isIncludeCrlID(), true));
    store.setIgnoreExpiredCert(getBoolean(conf.isIgnoreExpiredCert(), true));
    store.setIgnoreNotYetValidCert(getBoolean(conf.isIgnoreNotYetValidCert(), true));
    String datasourceName = conf.getSource().getDatasource();
    DataSourceWrapper datasource = null;
    if (datasourceName != null) {
        datasource = datasources.get(datasourceName);
        if (datasource == null) {
            throw new InvalidConfException("datasource named '" + datasourceName + "' not defined");
        }
    }
    try {
        store.init(conf.getSource().getConf(), datasource);
    } catch (OcspStoreException ex) {
        throw new InvalidConfException("CertStatusStoreException of store " + conf.getName() + ":" + ex.getMessage(), ex);
    }
    return store;
}
Also used : CrlDbCertStatusStore(org.xipki.ocsp.server.impl.store.crl.CrlDbCertStatusStore) DbCertStatusStore(org.xipki.ocsp.server.impl.store.db.DbCertStatusStore) BigInteger(java.math.BigInteger) CrlDbCertStatusStore(org.xipki.ocsp.server.impl.store.crl.CrlDbCertStatusStore) OcspStoreException(org.xipki.ocsp.api.OcspStoreException) OcspStore(org.xipki.ocsp.api.OcspStore) ObjectCreationException(org.xipki.common.ObjectCreationException) InvalidConfException(org.xipki.common.InvalidConfException) DataSourceWrapper(org.xipki.datasource.DataSourceWrapper)

Aggregations

BigInteger (java.math.BigInteger)1 InvalidConfException (org.xipki.common.InvalidConfException)1 ObjectCreationException (org.xipki.common.ObjectCreationException)1 DataSourceWrapper (org.xipki.datasource.DataSourceWrapper)1 OcspStore (org.xipki.ocsp.api.OcspStore)1 OcspStoreException (org.xipki.ocsp.api.OcspStoreException)1 CrlDbCertStatusStore (org.xipki.ocsp.server.impl.store.crl.CrlDbCertStatusStore)1 DbCertStatusStore (org.xipki.ocsp.server.impl.store.db.DbCertStatusStore)1