Class OperationBuilder

java.lang.Object
org.jboss.as.controller.client.OperationBuilder
Direct Known Subclasses:
Operations.CompositeOperationBuilder

public class OperationBuilder extends Object
Builder for a Operation.
Author:
Kabir Khan, Brian Stansberry (c) 2011 Red Hat Inc.
  • Constructor Details

    • OperationBuilder

      public OperationBuilder(ModelNode operation)
    • OperationBuilder

      public OperationBuilder(ModelNode operation, boolean autoCloseStreams)
  • Method Details

    • addFileAsAttachment

      public OperationBuilder addFileAsAttachment(File file)
      Associate a file with the operation. This will create a FileInputStream and add it as attachment.
      Parameters:
      file - the file
      Returns:
      the operation builder
    • addFileAsAttachment

      public OperationBuilder addFileAsAttachment(Path file)
      Associate a file with the operation. This will create a FileInputStream and add it as attachment.
      Parameters:
      file - the file
      Returns:
      the operation builder
    • addInputStream

      public OperationBuilder addInputStream(InputStream in)
      Associate an input stream with the operation. Closing the input stream is the responsibility of the caller.
      Parameters:
      in - the input stream. Cannot be null
      Returns:
      a builder than can be used to continue building the operation
    • getInputStreamCount

      public int getInputStreamCount()
      Gets the number of input streams currently associated with the operation,
      Returns:
      the number of input streams
    • setAutoCloseStreams

      public void setAutoCloseStreams(boolean autoCloseStreams)
      Automatically try to close the stream, once the operation finished executing.
      Parameters:
      autoCloseStreams - whether to close the streams or not
    • build

      public Operation build()
      Builds the operation.
      Returns:
      the operation
    • create

      public static OperationBuilder create(ModelNode operation)
      Create an operation builder.
      Parameters:
      operation - the operation
      Returns:
      the builder
    • create

      public static OperationBuilder create(ModelNode operation, boolean autoCloseStreams)
      Create an operation builder.
      Parameters:
      operation - the operation
      autoCloseStreams - whether streams should be automatically closed
      Returns:
      the builder