/** * Defines the necessary information for launching one or more {@link Application}s of a specified * type as part of the {@link Assembly} when the {@link ExternalResource} is established. * <p> * The {@link Platform} on which the {@link Application}s are launched is based on the * {@link PlatformPredicate} specified as an {@link Option}. By default this is {@link PlatformPredicate#any()}. * <p> * Multiple calls to this method are permitted, allowing an {@link Assembly} to be created containing * multiple different types of {@link Application}s. * * @param count the number of instances of the {@link Application} that should be launched for * the {@link Assembly} * @param applicationClass the class of {@link Application} * @param options the {@link Option}s to use for launching the {@link Application}s * * @return the {@link AbstractAssemblyResource} to permit fluent-style method calls */ public R include(int count, Class<? extends A> applicationClass, Option... options) { // remember the launch definition launchDefinitions.add(new Triple<>(count, applicationClass, OptionsByType.of(options))); return (R) this; }
@Override protected void before() throws Throwable { // establish the launch definitions for the assembly builder for (Triple<Integer, Class<? extends A>, OptionsByType> launchDefinition : launchDefinitions) { // create the options for the application, based on the common options OptionsByType optionsByType = OptionsByType.of(commonOptionsByType).addAll(launchDefinition.getZ()); // include in the assembly builder assemblyBuilder.include(launchDefinition.getX(), launchDefinition.getY(), optionsByType.asArray()); } // build the assembly assembly = assemblyBuilder.build(infrastructure == null ? Infrastructure.local() : infrastructure, creationOptionsByType.asArray()); super.before(); }
@Override protected void before() throws Throwable { // establish the launch definitions for the assembly builder for (Triple<Integer, Class<? extends A>, OptionsByType> launchDefinition : launchDefinitions) { // create the options for the application, based on the common options OptionsByType optionsByType = OptionsByType.of(commonOptionsByType).addAll(launchDefinition.getZ()); // include in the assembly builder assemblyBuilder.include(launchDefinition.getX(), launchDefinition.getY(), optionsByType.asArray()); } // build the assembly assembly = assemblyBuilder.build(infrastructure == null ? Infrastructure.local() : infrastructure, creationOptionsByType.asArray()); super.before(); }
/** * Defines the necessary information for launching one or more {@link Application}s of a specified * type as part of the {@link Assembly} when the {@link ExternalResource} is established. * <p> * The {@link Platform} on which the {@link Application}s are launched is based on the * {@link PlatformPredicate} specified as an {@link Option}. By default this is {@link PlatformPredicate#any()}. * <p> * Multiple calls to this method are permitted, allowing an {@link Assembly} to be created containing * multiple different types of {@link Application}s. * * @param count the number of instances of the {@link Application} that should be launched for * the {@link Assembly} * @param applicationClass the class of {@link Application} * @param options the {@link Option}s to use for launching the {@link Application}s * * @return the {@link AbstractAssemblyResource} to permit fluent-style method calls */ public R include(int count, Class<? extends A> applicationClass, Option... options) { // remember the launch definition launchDefinitions.add(new Triple<>(count, applicationClass, OptionsByType.of(options))); return (R) this; }