use of org.xipki.ca.api.publisher.CertPublisherException in project xipki by xipki.
the class CaManagerImpl method createPublisher.
// method createCertprofile
IdentifiedX509CertPublisher createPublisher(PublisherEntry dbEntry) throws CaMgmtException {
ParamUtil.requireNonNull("dbEntry", dbEntry);
String type = dbEntry.getType();
X509CertPublisher publisher;
IdentifiedX509CertPublisher ret;
try {
if ("OCSP".equalsIgnoreCase(type)) {
publisher = new OcspCertPublisher();
} else {
publisher = x509CertPublisherFactoryRegister.newPublisher(type);
}
ret = new IdentifiedX509CertPublisher(dbEntry, publisher);
ret.initialize(securityFactory.getPasswordResolver(), datasources);
return ret;
} catch (ObjectCreationException | CertPublisherException | RuntimeException ex) {
String msg = "invalid configuration for the publisher " + dbEntry.getIdent();
LogUtil.error(LOG, ex, msg);
throw new CaMgmtException(msg, ex);
}
}
use of org.xipki.ca.api.publisher.CertPublisherException in project xipki by xipki.
the class OcspCertPublisher method initialize.
@Override
public void initialize(String conf, PasswordResolver passwordResolver, Map<String, DataSourceWrapper> datasources) throws CertPublisherException {
ParamUtil.requireNonNull("conf", conf);
ParamUtil.requireNonEmpty("datasources", datasources);
ConfPairs pairs = new ConfPairs(conf);
String str = pairs.value("publish.goodcerts");
this.publishsGoodCert = (str == null) ? true : Boolean.parseBoolean(str);
str = pairs.value("asyn");
this.asyn = (str == null) ? false : Boolean.parseBoolean(str);
ConfPairs confPairs = new ConfPairs(conf);
String datasourceName = confPairs.value("datasource");
DataSourceWrapper datasource = null;
if (datasourceName != null) {
datasource = datasources.get(datasourceName);
}
if (datasource == null) {
throw new CertPublisherException("no datasource named '" + datasourceName + "' is specified");
}
try {
queryExecutor = new OcspStoreQueryExecutor(datasource, this.publishsGoodCert);
} catch (NoSuchAlgorithmException | DataAccessException ex) {
throw new CertPublisherException(ex.getMessage(), ex);
}
}
Aggregations