Package org.jboss.as.controller.client
Class OperationBuilder
- java.lang.Object
-
- org.jboss.as.controller.client.OperationBuilder
-
- Direct Known Subclasses:
Operations.CompositeOperationBuilder
public class OperationBuilder extends Object
Builder for aOperation.- Author:
- Kabir Khan, Brian Stansberry (c) 2011 Red Hat Inc.
-
-
Constructor Summary
Constructors Constructor Description OperationBuilder(org.jboss.dmr.ModelNode operation)OperationBuilder(org.jboss.dmr.ModelNode operation, boolean autoCloseStreams)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description OperationBuilderaddFileAsAttachment(File file)Associate a file with the operation.OperationBuilderaddFileAsAttachment(Path file)Associate a file with the operation.OperationBuilderaddInputStream(InputStream in)Associate an input stream with the operation.Operationbuild()Builds the operation.static OperationBuildercreate(org.jboss.dmr.ModelNode operation)Create an operation builder.static OperationBuildercreate(org.jboss.dmr.ModelNode operation, boolean autoCloseStreams)Create an operation builder.intgetInputStreamCount()Gets the number of input streams currently associated with the operation,voidsetAutoCloseStreams(boolean autoCloseStreams)Automatically try to close the stream, once the operation finished executing.
-
-
-
Method Detail
-
addFileAsAttachment
public OperationBuilder addFileAsAttachment(File file)
Associate a file with the operation. This will create aFileInputStreamand 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 aFileInputStreamand 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 benull- 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(org.jboss.dmr.ModelNode operation)
Create an operation builder.- Parameters:
operation- the operation- Returns:
- the builder
-
create
public static OperationBuilder create(org.jboss.dmr.ModelNode operation, boolean autoCloseStreams)
Create an operation builder.- Parameters:
operation- the operationautoCloseStreams- whether streams should be automatically closed- Returns:
- the builder
-
-