Search in sources :

Example 1 with AuditCountClientFactory

use of org.apache.gobblin.compaction.audit.AuditCountClientFactory in project incubator-gobblin by apache.

the class CompactionAuditCountVerifier method getClientFactory.

/**
 * Obtain a client factory
 * @param state job state
 * @return a factory which creates {@link AuditCountClient}.
 *         If no factory is set or an error occurred, a {@link EmptyAuditCountClientFactory} is
 *         returned which creates a <code>null</code> {@link AuditCountClient}
 */
private static AuditCountClientFactory getClientFactory(State state) {
    if (!state.contains(AuditCountClientFactory.AUDIT_COUNT_CLIENT_FACTORY)) {
        return new EmptyAuditCountClientFactory();
    }
    try {
        String factoryName = state.getProp(AuditCountClientFactory.AUDIT_COUNT_CLIENT_FACTORY);
        ClassAliasResolver<AuditCountClientFactory> conditionClassAliasResolver = new ClassAliasResolver<>(AuditCountClientFactory.class);
        AuditCountClientFactory factory = conditionClassAliasResolver.resolveClass(factoryName).newInstance();
        return factory;
    } catch (Exception e) {
        throw new RuntimeException(e);
    }
}
Also used : AuditCountClientFactory(org.apache.gobblin.compaction.audit.AuditCountClientFactory) ClassAliasResolver(org.apache.gobblin.util.ClassAliasResolver) IOException(java.io.IOException)

Aggregations

IOException (java.io.IOException)1 AuditCountClientFactory (org.apache.gobblin.compaction.audit.AuditCountClientFactory)1 ClassAliasResolver (org.apache.gobblin.util.ClassAliasResolver)1