Search in sources :

Example 1 with ProviderProxy

use of org.ovirt.engine.core.bll.provider.ProviderProxy in project ovirt-engine by oVirt.

the class GetProviderCertificateChainQuery method executeQueryCommand.

@Override
protected void executeQueryCommand() {
    Provider<?> provider = getProvider();
    try {
        ProviderProxy proxy = providerProxyFactory.create(provider);
        List<? extends Certificate> chain = proxy.getCertificateChain();
        List<CertificateInfo> results = new ArrayList<>();
        if (CollectionUtils.isNotEmpty(chain)) {
            for (Certificate cert : chain) {
                if (cert instanceof X509Certificate) {
                    results.add(createCertificateInfo((X509Certificate) cert));
                }
            }
        }
        getQueryReturnValue().setReturnValue(results);
    } catch (Exception e) {
        log.error("Error in encoding certificate: {}", e.getMessage());
        log.debug("Exception", e);
    }
}
Also used : ArrayList(java.util.ArrayList) CertificateInfo(org.ovirt.engine.core.common.businessentities.CertificateInfo) ProviderProxy(org.ovirt.engine.core.bll.provider.ProviderProxy) X509Certificate(java.security.cert.X509Certificate) GeneralSecurityException(java.security.GeneralSecurityException) X509Certificate(java.security.cert.X509Certificate) Certificate(java.security.cert.Certificate)

Aggregations

GeneralSecurityException (java.security.GeneralSecurityException)1 Certificate (java.security.cert.Certificate)1 X509Certificate (java.security.cert.X509Certificate)1 ArrayList (java.util.ArrayList)1 ProviderProxy (org.ovirt.engine.core.bll.provider.ProviderProxy)1 CertificateInfo (org.ovirt.engine.core.common.businessentities.CertificateInfo)1