Search in sources :

Example 36 with InstanceProvider

use of com.yahoo.athenz.instance.provider.InstanceProvider in project athenz by yahoo.

the class InstanceProviderManager method getClassProvider.

InstanceProvider getClassProvider(String className, String providerName) {
    final String classKey = className + "-" + providerName;
    InstanceProvider provider = providerMap.get(classKey);
    if (provider != null) {
        return provider;
    }
    Class<?> instanceClass = null;
    try {
        instanceClass = Class.forName(className);
    } catch (ClassNotFoundException e) {
        LOGGER.error("getClassInstance: Provider class {} not found", className);
        return null;
    }
    try {
        provider = (InstanceProvider) instanceClass.newInstance();
    } catch (InstantiationException | IllegalAccessException ex) {
        LOGGER.error("getClassInstance: Unable to get new instance for provider {} error {}", className, ex.getMessage());
        return null;
    }
    provider.initialize(providerName, className, keyStore);
    providerMap.put(classKey, provider);
    return provider;
}
Also used : InstanceProvider(com.yahoo.athenz.instance.provider.InstanceProvider)

Aggregations

InstanceProvider (com.yahoo.athenz.instance.provider.InstanceProvider)36 Test (org.testng.annotations.Test)32 SignedDomain (com.yahoo.athenz.zms.SignedDomain)31 ChangeLogStore (com.yahoo.athenz.zts.store.ChangeLogStore)21 DataStore (com.yahoo.athenz.zts.store.DataStore)21 MockZMSFileChangeLogStore (com.yahoo.athenz.zts.store.impl.MockZMSFileChangeLogStore)21 ZMSFileChangeLogStore (com.yahoo.athenz.zts.store.impl.ZMSFileChangeLogStore)21 Path (java.nio.file.Path)21 InstanceConfirmation (com.yahoo.athenz.instance.provider.InstanceConfirmation)20 InstanceCertManager (com.yahoo.athenz.zts.cert.InstanceCertManager)20 X509Certificate (java.security.cert.X509Certificate)16 SimplePrincipal (com.yahoo.athenz.auth.impl.SimplePrincipal)15 CertificateAuthority (com.yahoo.athenz.auth.impl.CertificateAuthority)14 X509CertRecord (com.yahoo.athenz.zts.cert.X509CertRecord)14 InstanceProviderManager (com.yahoo.athenz.zts.InstanceProviderManager)11 WebApplicationException (javax.ws.rs.WebApplicationException)3 PrincipalToken (com.yahoo.athenz.auth.token.PrincipalToken)2 CryptoException (com.yahoo.athenz.auth.util.CryptoException)2 AuditLogMsgBuilder (com.yahoo.athenz.common.server.log.AuditLogMsgBuilder)2 X509CertRequest (com.yahoo.athenz.zts.cert.X509CertRequest)2