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);
}
}
Aggregations