List of usage examples for com.google.common.collect ImmutableList copyOf
public static <E> ImmutableList<E> copyOf(E[] elements)
From source file:co.cask.cdap.data.stream.StreamTailer.java
public static void main(String[] args) throws Exception { if (args.length < 1) { System.out.println(String.format("Usage: java %s [streamName]", StreamTailer.class.getName())); return;/*from w ww . ja v a 2 s . co m*/ } String streamName = args[0]; CConfiguration cConf = CConfiguration.create(); Configuration hConf = new Configuration(); Injector injector = Guice.createInjector(new ConfigModule(cConf, hConf), new DataFabricModules().getDistributedModules(), new DataSetsModules().getDistributedModules(), new LocationRuntimeModule().getDistributedModules(), new StreamAdminModules().getDistributedModules(), new NotificationFeedClientModule()); StreamAdmin streamAdmin = injector.getInstance(StreamAdmin.class); //TODO: get namespace from commandline arguments Id.Stream streamId = Id.Stream.from(Constants.DEFAULT_NAMESPACE, streamName); StreamConfig streamConfig = streamAdmin.getConfig(streamId); Location streamLocation = streamConfig.getLocation(); List<Location> eventFiles = Lists.newArrayList(); for (Location partition : streamLocation.list()) { if (!partition.isDirectory()) { continue; } for (Location file : partition.list()) { if (StreamFileType.EVENT.isMatched(file.getName())) { eventFiles.add(file); } } } int generation = StreamUtils.getGeneration(streamConfig); MultiLiveStreamFileReader reader = new MultiLiveStreamFileReader(streamConfig, ImmutableList.copyOf(Iterables.transform(eventFiles, createOffsetConverter(generation)))); List<StreamEvent> events = Lists.newArrayList(); while (reader.read(events, 10, 100, TimeUnit.MILLISECONDS) >= 0) { for (StreamEvent event : events) { System.out.println(event.getTimestamp() + " " + Charsets.UTF_8.decode(event.getBody())); } events.clear(); } reader.close(); }
From source file:com.google.devtools.build.buildjar.VanillaJavaBuilder.java
public static void main(String[] args) throws IOException { if (args.length == 1 && args[0].equals("--persistent_worker")) { System.exit(runPersistentWorker()); } else {/* www . j a va 2s . co m*/ try (VanillaJavaBuilder builder = new VanillaJavaBuilder()) { VanillaJavaBuilderResult result = builder.run(ImmutableList.copyOf(args)); System.err.print(result.output()); System.exit(result.ok() ? 0 : 1); } } }
From source file:io.bazel.rules.closure.ClosureWorker.java
public static void main(String[] args) throws IOException { System.exit(DaggerClosureWorker_Server.builder().fs(FileSystems.getDefault()).build().worker() .run(ImmutableList.copyOf(args))); }
From source file:ezbake.helpers.cdh.Cdh2EzProperties.java
public static void main(String[] args) throws CmdLineException { logToStdErr();/*from w w w .j a va 2 s . com*/ Cdh2EzProperties program = new Cdh2EzProperties(); final CmdLineParser cmdLineParser = new CmdLineParser(program); if (args.length == 0) { cmdLineParser.printUsage(System.err); System.exit(-1); } cmdLineParser.parseArgument(ImmutableList.copyOf(args)); Logger.getRootLogger().setLevel(program.verbose ? Level.DEBUG : Level.ERROR); program.run(); }
From source file:org.obiba.opal.datashield.expr.DataShieldScriptValidator.java
public static DataShieldScriptValidator of(DataShieldScriptValidator... validators) { return of(ImmutableList.copyOf(validators)); }
From source file:org.prebake.util.MoreAsserts.java
public static void assertContainsInOrder(String[] actual, String... required) { assertContainsInOrder(ImmutableList.copyOf(actual), required); }
From source file:ninja.leaping.permissionsex.util.ShellGlobParser.java
public static List<String> parseFrom(String input) { return ImmutableList.copyOf(new ShellGlobParser(input).parse()); }
From source file:com.proofpoint.reporting.ReportedMethodInfo.java
static ReportedMethodInfo reportedMethodInfo(Collection<ReportedBeanAttribute> attributes, Collection<PrometheusBeanAttribute> prometheusAttributes) { return new AutoValue_ReportedMethodInfo(ImmutableList.copyOf(attributes), ImmutableList.copyOf(prometheusAttributes)); }
From source file:com.mycompany.mavenproject3.List.java
public static Cons makeList(Sexpression... args) { ImmutableList<Sexpression> list = ImmutableList.copyOf(args); return makeCons(list); }
From source file:org.chaston.oakfunds.storage.OrSearchTerm.java
public static OrSearchTerm of(SearchTerm... searchTerms) { return new OrSearchTerm(ImmutableList.copyOf(searchTerms)); }