@Override public ManagementRequestHandler<?, ?> resolveNext() { if(index++ == length) { return getFallbackHandler(header); } final ManagementRequestHandlerFactory factory = snapshot[index]; if(factory == null) { // return getFallbackHandler(header); return resolveNext(); } return factory.resolveHandler(this, header); }
@Override public ManagementRequestHandler<?, ?> resolveNext() { if(index++ == length) { return getFallbackHandler(header); } final ManagementRequestHandlerFactory factory = snapshot[index]; if(factory == null) { // return getFallbackHandler(header); return resolveNext(); } return factory.resolveHandler(this, header); }
@Override protected void sendRequest(ActiveOperation.ResultHandler<Void> resultHandler, ManagementRequestContext<Void> voidManagementRequestContext, FlushableDataOutput output) throws IOException { output.write(DomainServerProtocol.PARAM_OK); // TODO handle server start failed message output.writeUTF(message); resultHandler.done(null); }
@Override public ManagementRequestHandler<?, ?> resolveHandler(RequestHandlerChain handlers, ManagementRequestHeader header) { final byte operationId = header.getOperationId(); switch (operationId) { case ManagementProtocol.TYPE_PING: handlers.registerActiveOperation(header.getBatchId(), null); return this; } return handlers.resolveNext(); }
@Override public ManagementRequestHandler<?, ?> resolveHandler(RequestHandlerChain handlers, ManagementRequestHeader header) { final byte operationType = header.getOperationId(); if (operationType == ModelControllerProtocol.HANDLE_REPORT_REQUEST) { return MESSAGE_HANDLER; } else if (operationType == ModelControllerProtocol.GET_INPUTSTREAM_REQUEST) { return GET_INPUT_STREAM; } return handlers.resolveNext(); }
/** {@inheritDoc} */ @Override public <T, A> ActiveOperation<T, A> executeRequest(ManagementRequest<T, A> request, A attachment, ActiveOperation.CompletedCallback<T> callback) throws IOException { final ActiveOperation<T, A> operation = super.registerActiveOperation(attachment, callback); executeRequest(operation, request); return operation; }
/** * Get an active operation. * * @param header the request header * @return the active operation, {@code null} if if there is no registered operation */ protected <T, A> ActiveOperation<T, A> getActiveOperation(final ManagementRequestHeader header) { return getActiveOperation(header.getBatchId()); }
/** * Get an active operation. * * @param header the request header * @return the active operation, {@code null} if if there is no registered operation */ protected <T, A> ActiveOperation<T, A> getActiveOperation(final ManagementRequestHeader header) { return getActiveOperation(header.getBatchId()); }
/** * Write the management protocol header. * * @param header the mgmt protocol header * @param os the output stream * @throws IOException */ private static void writeHeader(final ManagementProtocolHeader header, final OutputStream os) throws IOException { final FlushableDataOutput output = FlushableDataOutputImpl.create(os); header.write(output); }
/** {@inheritDoc} */ @Override public <T, A> AsyncFuture<T> executeRequest(final ActiveOperation<T, A> support, final ManagementRequest<T, A> request) throws IOException { return super.executeRequest(request, strategy.getChannel(), support); }
@Override protected void sendRequest(ActiveOperation.ResultHandler<Void> resultHandler, ManagementRequestContext<Void> voidManagementRequestContext, FlushableDataOutput output) throws IOException { output.write(DomainServerProtocol.PARAM_OK); // TODO handle server start failed message output.writeUTF(message); resultHandler.done(null); }
@Override public ManagementRequestHandler<?, ?> resolveHandler(RequestHandlerChain handlers, ManagementRequestHeader header) { final byte operationId = header.getOperationId(); switch (operationId) { case ManagementProtocol.TYPE_PING: handlers.registerActiveOperation(header.getBatchId(), null); return this; } return handlers.resolveNext(); }
/** {@inheritDoc} */ @Override public <T, A> ActiveOperation<T, A> executeRequest(final ManagementRequest<T, A> request, final A attachment) throws IOException { final ActiveOperation<T, A> operation = super.registerActiveOperation(attachment); executeRequest(operation, request); return operation; }
/** * Get an active operation. * * @param header the request header * @return the active operation, {@code null} if if there is no registered operation */ protected <T, A> ActiveOperation<T, A> getActiveOperation(final ManagementRequestHeader header) { return getActiveOperation(header.getBatchId()); }
/** * Write the management protocol header. * * @param header the mgmt protocol header * @param os the output stream * @throws IOException */ protected static void writeHeader(final ManagementProtocolHeader header, final OutputStream os) throws IOException { final FlushableDataOutput output = FlushableDataOutputImpl.create(os); header.write(output); }
@Override public ManagementRequestHandler<?, ?> resolveNext() { if(index++ == length) { return getFallbackHandler(header); } final ManagementRequestHandlerFactory factory = snapshot[index]; if(factory == null) { // return getFallbackHandler(header); return resolveNext(); } return factory.resolveHandler(this, header); }
@Override protected void sendRequest(ActiveOperation.ResultHandler<Void> resultHandler, ManagementRequestContext<Void> voidManagementRequestContext, FlushableDataOutput output) throws IOException { output.write(DomainServerProtocol.PARAM_OK); // TODO handle server start failed message output.writeUTF(message); resultHandler.done(null); }
/** {@inheritDoc} */ @Override public <T, A> ActiveOperation<T, A> executeRequest(final ManagementRequest<T, A> request, final A attachment) throws IOException { final ActiveOperation<T, A> operation = super.registerActiveOperation(attachment); executeRequest(operation, request); return operation; }
/** * Write the management protocol header. * * @param header the mgmt protocol header * @param os the output stream * @throws IOException */ protected static FlushableDataOutput writeHeader(final ManagementProtocolHeader header, final OutputStream os) throws IOException { final FlushableDataOutput output = FlushableDataOutputImpl.create(os); header.write(output); return output; }
/** {@inheritDoc} */ @Override public <T, A> ActiveOperation<T, A> executeRequest(ManagementRequest<T, A> request, A attachment, ActiveOperation.CompletedCallback<T> callback) throws IOException { final ActiveOperation<T, A> operation = super.registerActiveOperation(attachment, callback); executeRequest(operation, request); return operation; }