@Override public ModelNode execute(Operation operation) throws IOException { if (!operation.getInputStreams().isEmpty()) { throw new IllegalStateException("Operation has one or more attachments which is not allowed."); } return execute(operation.getOperation()); }
static List<InputStreamEntry> createStreamEntries(final Operation operation) { final List<InputStream> streams = operation.getInputStreams(); if(streams.isEmpty()) { return Collections.emptyList(); } final List<InputStreamEntry> entries = new ArrayList<InputStreamEntry>(); final boolean autoClose = operation.isAutoCloseStreams(); for(final InputStream stream : streams) { if(stream instanceof InputStreamEntry) { entries.add((InputStreamEntry) stream); } else { // TODO don't copy everything to memory... perhaps use InputStreamEntry.CachingStreamEntry entries.add(new InputStreamEntry.InMemoryEntry(stream, autoClose)); } } return entries; }
static List<InputStreamEntry> createStreamEntries(final Operation operation) { final List<InputStream> streams = operation.getInputStreams(); if(streams.isEmpty()) { return Collections.emptyList(); } final List<InputStreamEntry> entries = new ArrayList<InputStreamEntry>(); final boolean autoClose = operation.isAutoCloseStreams(); for(final InputStream stream : streams) { if(stream instanceof InputStreamEntry) { entries.add((InputStreamEntry) stream); } else { // TODO don't copy everything to memory... perhaps use InputStreamEntry.CachingStreamEntry entries.add(new InputStreamEntry.InMemoryEntry(stream, autoClose)); } } return entries; }
private Operation sanitizeOperation(Operation operation) { ModelNode sanitized = sanitizeOperation(operation.getOperation()); return Operation.Factory.create(sanitized, operation.getInputStreams(), operation.isAutoCloseStreams()); }
@Override protected void sendRequest(final ActiveOperation.ResultHandler<OperationResponse> resultHandler, final ManagementRequestContext<OperationExecutionContext> context, final FlushableDataOutput output) throws IOException { // Write the operation final List<InputStream> streams = executionContext.operation.getInputStreams(); final ModelNode operation = executionContext.operation.getOperation(); int inputStreamLength = 0; if (streams != null) { inputStreamLength = streams.size(); } output.write(ModelControllerProtocol.PARAM_OPERATION); operation.writeExternal(output); output.write(ModelControllerProtocol.PARAM_INPUTSTREAMS_LENGTH); output.writeInt(inputStreamLength); }
private Operation sanitizeOperation(Operation operation) { ModelNode sanitized = sanitizeOperation(operation.getOperation()); return Operation.Factory.create(sanitized, operation.getInputStreams(), operation.isAutoCloseStreams()); }
@Override protected void sendRequest(final ActiveOperation.ResultHandler<ModelNode> resultHandler, final ManagementRequestContext<OperationExecutionContext> context, final FlushableDataOutput output) throws IOException { // Write the operation final List<InputStream> streams = executionContext.operation.getInputStreams(); final ModelNode operation = executionContext.operation.getOperation(); int inputStreamLength = 0; if (streams != null) { inputStreamLength = streams.size(); } output.write(ModelControllerProtocol.PARAM_OPERATION); operation.writeExternal(output); output.write(ModelControllerProtocol.PARAM_INPUTSTREAMS_LENGTH); output.writeInt(inputStreamLength); }
assert operation.getInputStreams().size() == 0; // we don't support associating streams with an active op ModelNode responseNode = executor.joinActiveOperation(operation.getOperation(), messageHandler, control, handler, domainControllerLockId); return OperationResponse.Factory.createSimple(responseNode);
assert operation.getInputStreams().size() == 0; // we don't support associating streams with an active op ModelNode responseNode = executor.joinActiveOperation(operation.getOperation(), messageHandler, control, handler, domainControllerLockId); return OperationResponse.Factory.createSimple(responseNode);
for (InputStream in : builtOp.getInputStreams()) { IoUtils.safeClose(in);