/** * The {@link Option}s to be used when closing the {@link Assembly}. * * @param options the {@link Option}s * * @return the {@link AbstractAssemblyResource} to permit fluent-style method calls * * @see Assembly#close(Option...) */ public R withClosingOptions(Option... options) { this.closingOptionsByType.addAll(options); return (R) this; } }
/** * The {@link Option}s to be used as the basis launching each {@link Application}s. This will be overridden * by those specifically provided for each application and those defined by {@link #withOverridingOptions(Option...)}. * * @param options the {@link Option}s * * @return the {@link AbstractAssemblyResource} to permit fluent-style method calls * * @see AssemblyBuilder#build(Infrastructure, Option...) */ public R with(Option... options) { this.commonOptionsByType.addAll(options); return (R) this; }
/** * The {@link Option}s to be provided when launching {@link Application}s, overriding those * that may be been defined for each {@link Application}. * * @param options the {@link Option}s * * @return the {@link AbstractAssemblyResource} to permit fluent-style method calls * * @see AssemblyBuilder#build(Infrastructure, Option...) */ public R withOverridingOptions(Option... options) { this.creationOptionsByType.addAll(options); return (R) this; }
/** * The {@link Option}s to be used as the basis launching each {@link Application}s. This will be overridden * by those specifically provided for each application and those defined by {@link #withOverridingOptions(Option...)}. * * @param options the {@link Option}s * * @return the {@link AbstractAssemblyResource} to permit fluent-style method calls * * @see AssemblyBuilder#build(Infrastructure, Option...) */ public R with(Option... options) { this.commonOptionsByType.addAll(options); return (R) this; }
/** * The {@link Option}s to be provided when launching {@link Application}s, overriding those * that may be been defined for each {@link Application}. * * @param options the {@link Option}s * * @return the {@link AbstractAssemblyResource} to permit fluent-style method calls * * @see AssemblyBuilder#build(Infrastructure, Option...) */ public R withOverridingOptions(Option... options) { this.creationOptionsByType.addAll(options); return (R) this; }
/** * The {@link Option}s to be used when closing the {@link Assembly}. * * @param options the {@link Option}s * * @return the {@link AbstractAssemblyResource} to permit fluent-style method calls * * @see Assembly#close(Option...) */ public R withClosingOptions(Option... options) { this.closingOptionsByType.addAll(options); return (R) this; } }
/** * Adds the {@link Option}s to the {@link DiagnosticsRecording}. * * @param options the {@link Option}s * * @return the {@link DiagnosticsRecording} to permit fluent-style method calls */ public DiagnosticsRecording with(Option... options) { if (options != null) { // add all of the options to the table this.table.getOptions().addAll(options); } return this; }
/** * Adds the {@link Option}s to the {@link DiagnosticsRecording}. * * @param options the {@link Option}s * * @return the {@link DiagnosticsRecording} to permit fluent-style method calls */ public DiagnosticsRecording with(Option... options) { if (options != null) { // add all of the options to the table this.table.getOptions().addAll(options); } return this; }
@Override public int waitFor(Option... options) { // include the application specific options for waiting OptionsByType waitForOptions = OptionsByType.of(getOptions().asArray()).addAll(options); return process.waitFor(waitForOptions.asArray()); }
@Override protected boolean performRemoteCopy(String source, String destination, Platform platform, OptionsByType deploymentOptions) { if (platform instanceof RemotePlatform) { JSchRemoteTerminal terminal = new JSchRemoteTerminal((RemotePlatform) platform); OptionsByType optionsByType = OptionsByType.of(platform.getOptions()); optionsByType.addAll(deploymentOptions.asArray()); terminal.moveFile(source, destination, optionsByType); return false; } else { throw new IllegalArgumentException("The platform argument must be an instance of a RemotePlatform"); } }
@Override public int waitFor(Option... options) { // include the application specific options for waiting OptionsByType waitForOptions = OptionsByType.of(getOptions().asArray()).addAll(options); return process.waitFor(waitForOptions.asArray()); }
@Override protected boolean performRemoteCopy(String source, String destination, Platform platform, OptionsByType deploymentOptions) throws IOException { if (platform instanceof RemotePlatform) { WindowsRemoteTerminal terminal = new WindowsRemoteTerminal((RemotePlatform) platform); OptionsByType optionsByType = OptionsByType.of(platform.getOptions()); optionsByType.addAll(deploymentOptions.asArray()); terminal.moveFile(source, destination, optionsByType); return false; } else { throw new IllegalArgumentException("The platform argument must be an instance of a RemotePlatform"); } } }
@Override public <A extends Application> A launch(MetaClass<A> metaClass, Option... options) { // establish the initial launch options based on those defined by the platform OptionsByType launchOptions = OptionsByType.of(getOptions().asArray()); // include the options specified when this method was called launchOptions.addAll(options); // obtain the application launcher for the class of application ApplicationLauncher<A> launcher = getApplicationLauncher(metaClass, launchOptions); if (launcher == null) { throw new IllegalArgumentException("Can't determine ApplicationLauncher for " + metaClass + " using " + launchOptions); } else { // now launch the application return launcher.launch(this, metaClass, launchOptions); } }
@Override public <A extends Application> A launch(MetaClass<A> metaClass, Option... options) { // establish the initial launch options based on those defined by the platform OptionsByType launchOptions = OptionsByType.of(getOptions().asArray()); // include the options specified when this method was called launchOptions.addAll(options); // obtain the application launcher for the class of application ApplicationLauncher<A> launcher = getApplicationLauncher(metaClass, launchOptions); if (launcher == null) { throw new IllegalArgumentException("Can't determine ApplicationLauncher for " + metaClass + " using " + launchOptions); } else { // now launch the application return launcher.launch(this, metaClass, launchOptions); } }
OptionsByType launchOptions = OptionsByType.of(application.getOptions()).addAll(options);
OptionsByType launchOptions = OptionsByType.of(application.getOptions()).addAll(options);
@Override public G build(Infrastructure infrastructure, Option... options) { // establish the assembly starting with a copy of the common options G assembly = createAssembly(OptionsByType.of(optionsByType)); // use the characteristics to expand the assembly on the infrastructure for (Characteristics characteristic : characteristics) { int instanceCount = characteristic.getCount(); Class<? extends A> applicationClass = characteristic.getApplicationClass(); OptionsByType launchOptions = OptionsByType.of(characteristic.getOptions()).addAll(options); // expand the assembly based on the desired characteristics assembly.expand(instanceCount, infrastructure, applicationClass, launchOptions.asArray()); } return assembly; }
@Override public G build(Infrastructure infrastructure, Option... options) { // establish the assembly starting with a copy of the common options G assembly = createAssembly(OptionsByType.of(optionsByType)); // use the characteristics to expand the assembly on the infrastructure for (Characteristics characteristic : characteristics) { int instanceCount = characteristic.getCount(); Class<? extends A> applicationClass = characteristic.getApplicationClass(); OptionsByType launchOptions = OptionsByType.of(characteristic.getOptions()).addAll(options); // expand the assembly based on the desired characteristics assembly.expand(instanceCount, infrastructure, applicationClass, launchOptions.asArray()); } return assembly; }
@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(); }