gobblin.annotation.Alias类的使用及代码示例

x33g5p2x  于2022-01-16 转载在 其他  
字(8.0k)|赞(0)|评价(0)|浏览(103)

本文整理了Java中gobblin.annotation.Alias类的一些代码示例,展示了Alias类的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Alias类的具体详情如下:
包路径:gobblin.annotation.Alias
类名称:Alias

Alias介绍

暂无

代码示例

代码示例来源:origin: com.linkedin.gobblin/gobblin-utility

@Alias(value = "time")
public static class Factory implements LimiterFactory {
 public static final String MAX_SECONDS_KEY = "maxSeconds";
 @Override
 public Limiter buildLimiter(Config config) {
  if (!config.hasPath(MAX_SECONDS_KEY)) {
   throw new RuntimeException("Missing key " + MAX_SECONDS_KEY);
  }
  return new TimeBasedLimiter(config.getLong(MAX_SECONDS_KEY));
 }
}

代码示例来源:origin: com.linkedin.gobblin/gobblin-utility

private static void printUsage(ClassAliasResolver<CliApplication> resolver) {
 System.out.println("Usage: gobblin <command>");
 System.out.println("Available commands:");
 for (Alias alias : resolver.getAliasObjects()) {
  System.out.println("\t" + alias.value() + "\t" + alias.description());
 }
}

代码示例来源:origin: com.linkedin.gobblin/gobblin-runtime

@Override
public String toString() {
 Alias alias = getClass().getAnnotation(Alias.class);
 return null != alias ? alias.value() : getClass().getName();
}

代码示例来源:origin: com.linkedin.gobblin/gobblin-runtime

private void listQuickApps() {
 List<Alias> aliases = getAllAliases();
 System.out.println("Usage: gobblin run <quick-app-name> [OPTIONS]");
 System.out.println("Available quick apps:");
 for (Alias thisAlias : aliases) {
  System.out.println(String.format("\t%s\t-\t%s", thisAlias.value(), thisAlias.description()));
 }
}

代码示例来源:origin: com.linkedin.gobblin/gobblin-api

public ClassAliasResolver(Class<T> subTypeOf) {
 Map<String, Class<? extends T>> cache = Maps.newHashMap();
 this.aliasObjects = Lists.newArrayList();
 for (Class<? extends T> clazz : REFLECTIONS.getSubTypesOf(subTypeOf)) {
  if (clazz.isAnnotationPresent(Alias.class)) {
   Alias aliasObject = clazz.getAnnotation(Alias.class);
   String alias = aliasObject.value().toUpperCase();
   if (cache.containsKey(alias)) {
    log.warn(String.format("Alias %s already mapped to class %s. Mapping for %s will be ignored", alias,
      cache.get(alias).getCanonicalName(), clazz.getCanonicalName()));
   } else {
    aliasObjects.add(aliasObject);
    cache.put(clazz.getAnnotation(Alias.class).value().toUpperCase(), clazz);
   }
  }
 }
 this.subtypeOf = subTypeOf;
 this.aliasToClassCache = ImmutableMap.copyOf(cache);
}

代码示例来源:origin: com.linkedin.gobblin/gobblin-utility

@Alias(value = FACTORY_ALIAS)
public static class Factory implements LimiterFactory {
 public static final String COUNT_KEY = "maxPermits";
 @Override
 public Limiter buildLimiter(Config config) {
  if (!config.hasPath(COUNT_KEY)) {
   throw new IllegalArgumentException("Missing key " + COUNT_KEY);
  }
  return new CountBasedLimiter(config.getLong(COUNT_KEY));
 }
}

代码示例来源:origin: com.linkedin.gobblin/gobblin-compaction

@Alias("RecompactBasedOnCombination")
public static class Factory implements RecompactionConditionFactory {
 @Override public RecompactionCondition createRecompactionCondition (Dataset dataset) {
  return new RecompactionCombineCondition(dataset);
 }
}

代码示例来源:origin: com.linkedin.gobblin/gobblin-utility

@Alias(value = "qps")
public static class Factory implements LimiterFactory {
 public static final String QPS_KEY = "qps";
 @Override
 public Limiter buildLimiter(Config config) {
  if (!config.hasPath(QPS_KEY)) {
   throw new RuntimeException("Missing key " + QPS_KEY);
  }
  return new RateBasedLimiter(config.getLong(QPS_KEY));
 }
}

代码示例来源:origin: com.linkedin.gobblin/gobblin-runtime

@Alias("fs")
public class FsDatasetStateStoreFactory implements DatasetStateStore.Factory {
 @Override
 public DatasetStateStore<JobState.DatasetState> createStateStore(Config config) {
  try {
   return FsDatasetStateStore.createStateStore(config, FsDatasetStateStore.class.getName());
  } catch (Exception e) {
   throw new RuntimeException("Failed to create FsDatasetStateStore with factory", e);
  }
 }
}

代码示例来源:origin: com.linkedin.gobblin/gobblin-runtime

@Alias("metrics")
public static class Factory implements GobblinInstancePluginFactory {
 @Override
 public GobblinInstancePlugin createPlugin(GobblinInstanceDriver instance) {
  return new GobblinMetricsPlugin(instance);
 }
}

代码示例来源:origin: com.linkedin.gobblin/gobblin-compaction

@Alias("SimpleCompactorCompletionHook")
 public static class Factory implements CompactorCompletionListenerFactory {
  @Override public CompactorCompletionListener createCompactorCompactionListener (State state) {
   return new SimpleCompactorCompletionListener (state);
  }
 }
}

代码示例来源:origin: com.linkedin.gobblin/gobblin-compaction

/**
 * A {@link CompactionSuiteFactory} that handles {@link CompactionAvroSuite} creation logic.
 */
@Alias("CompactionAvroSuiteFactory")
public class CompactionAvroSuiteFactory implements CompactionSuiteFactory {
 public CompactionAvroSuite createSuite (State state) {
  return new CompactionAvroSuite (state);
 }
}

代码示例来源:origin: com.linkedin.gobblin/gobblin-utility

@Alias(value = "PoolBasedLimiter")
public static class Factory implements LimiterFactory {
 public static final String POOL_SIZE_KEY = "poolSize";
 @Override
 public Limiter buildLimiter(Config config) {
  if (!config.hasPath(POOL_SIZE_KEY)) {
   throw new IllegalArgumentException("Missing key " + POOL_SIZE_KEY);
  }
  return new PoolBasedLimiter(config.getInt(POOL_SIZE_KEY));
 }
}

代码示例来源:origin: com.linkedin.gobblin/gobblin-runtime

@Alias("noop")
public class NoopEventMetadataGenerator implements EventMetadataGenerator{
 public Map<String, String> getMetadata(JobContext jobContext, EventName eventName) {
  return ImmutableMap.of();
 }
}

代码示例来源:origin: com.linkedin.gobblin/gobblin-compaction

@Alias("RecompactBasedOnRatio")
public static class Factory implements RecompactionConditionFactory {
 @Override public RecompactionCondition createRecompactionCondition (Dataset dataset) {
  return new RecompactionConditionBasedOnRatio (dataset);
 }
}

代码示例来源:origin: com.linkedin.gobblin/gobblin-compaction

/**
 * Factory to create an instance of type {@link KafkaAuditCountHttpClient}
 */
@Alias("KafkaAuditCountHttpClientFactory")
public class KafkaAuditCountHttpClientFactory implements AuditCountClientFactory {

 public KafkaAuditCountHttpClient createAuditCountClient (State state)  {
  return new KafkaAuditCountHttpClient(state);
 }
}

代码示例来源:origin: com.linkedin.gobblin/gobblin-throttling-service-server

@Alias(FACTORY_ALIAS)
public static class Factory implements ThrottlingPolicyFactory.SpecificPolicyFactory {
 @Override
 public ThrottlingPolicy createPolicy(SharedLimiterKey key, SharedResourcesBroker<ThrottlingServerScopes> broker, Config config) {
  Preconditions.checkArgument(config.hasPath(COUNT_KEY), "Missing key " + COUNT_KEY);
  return new CountBasedPolicy(config.getLong(COUNT_KEY));
 }
}

代码示例来源:origin: com.linkedin.gobblin/gobblin-throttling-service-server

@Alias(FACTORY_ALIAS)
public static class Factory implements ThrottlingPolicyFactory.SpecificPolicyFactory {
 @Override
 public ThrottlingPolicy createPolicy(SharedLimiterKey key, SharedResourcesBroker<ThrottlingServerScopes> broker, Config config) {
  return new QPSPolicy(config);
 }
}

代码示例来源:origin: com.linkedin.gobblin/gobblin-data-management

@Alias(value="DataFlowTopologyPickerByHadoopFsSource")
public class DataFlowTopologyPickerByHadoopFsSource implements DataFlowTopologyPickerBySource {

 @Override
 public Config getPreferredRoutes(Config allTopologies, EndPoint source) {
  Preconditions.checkArgument(source instanceof HadoopFsEndPoint,
    "source is NOT expectecd class " + HadoopFsEndPoint.class.getCanonicalName());

  HadoopFsEndPoint hadoopFsSource = (HadoopFsEndPoint)source;
  String clusterName = hadoopFsSource.getClusterName();

  Preconditions.checkArgument(allTopologies.hasPath(clusterName),
    "Can not find preferred topology for cluster name " + clusterName);
  return allTopologies.getConfig(clusterName);
 }
}

代码示例来源:origin: com.linkedin.gobblin/gobblin-runtime

@Alias("noop")
public static class Factory implements DatasetStateStore.Factory {
 @Override
 public DatasetStateStore<JobState.DatasetState> createStateStore(Config config) {
  // dummy root dir for noop state store
  Config config2 = config.withValue(ConfigurationKeys.STATE_STORE_ROOT_DIR_KEY, ConfigValueFactory.fromAnyRef(""));
  return FsDatasetStateStore.createStateStore(config2, NoopDatasetStateStore.class.getName());
 }
}

相关文章