/** * 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()); }
/** * 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()); }
@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 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 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 operationId = header.getOperationId(); switch (operationId) { case DomainControllerProtocol.UNREGISTER_HOST_CONTROLLER_REQUEST: { handlers.registerActiveOperation(header.getBatchId(), null); return new UnregisterOperation(); } case DomainControllerProtocol.GET_FILE_REQUEST: { handlers.registerActiveOperation(header.getBatchId(), null); return new GetFileOperation(); } } return handlers.resolveNext(); }
@Override public ManagementRequestHandler<?, ?> resolveHandler(RequestHandlerChain handlers, ManagementRequestHeader header) { final byte operationId = header.getOperationId(); switch (operationId) { case DomainControllerProtocol.UNREGISTER_HOST_CONTROLLER_REQUEST: { handlers.registerActiveOperation(header.getBatchId(), null); return new UnregisterOperation(); } case DomainControllerProtocol.GET_FILE_REQUEST: { handlers.registerActiveOperation(header.getBatchId(), null); return new GetFileOperation(); } case DomainControllerProtocol.SERVER_INSTABILITY_REQUEST: { handlers.registerActiveOperation(header.getBatchId(), null); return new ServerUnstableHandler(); } } return handlers.resolveNext(); }
@Override public ManagementRequestHandler<?, ?> resolveHandler(final RequestHandlerChain handlers, final ManagementRequestHeader header) { final byte operationId = header.getOperationId(); switch (operationId) { case DomainServerProtocol.REGISTER_REQUEST: handlers.registerActiveOperation(header.getBatchId(), null); return new ServerRegistrationRequestHandler(); case DomainServerProtocol.SERVER_RECONNECT_REQUEST: handlers.registerActiveOperation(header.getBatchId(), null); return new ServerReconnectRequestHandler(); case DomainServerProtocol.GET_FILE_REQUEST: handlers.registerActiveOperation(header.getBatchId(), null); return new GetFileOperation(); case DomainServerProtocol.SERVER_STARTED_REQUEST: handlers.registerActiveOperation(header.getBatchId(), serverInventory); return new ServerStartedHandler(serverProcessName); } return handlers.resolveNext(); }
@Override public ManagementRequestHandler<?, ?> resolveHandler(RequestHandlerChain handlers, ManagementRequestHeader header) { final byte operationId = header.getOperationId(); switch (operationId) { case DomainControllerProtocol.UNREGISTER_HOST_CONTROLLER_REQUEST: { handlers.registerActiveOperation(header.getBatchId(), null); return new UnregisterOperation(); } case DomainControllerProtocol.GET_FILE_REQUEST: { handlers.registerActiveOperation(header.getBatchId(), null); return new GetFileOperation(); } case DomainControllerProtocol.SERVER_INSTABILITY_REQUEST: { handlers.registerActiveOperation(header.getBatchId(), null); return new ServerUnstableHandler(); } } return handlers.resolveNext(); }
/** * Handle a message. * * @param channel the channel * @param message the message * @param header the protocol header * @param handler the request handler * @throws IOException */ protected <T, A> void handleMessage(final Channel channel, final DataInput message, final ManagementRequestHeader header, ManagementRequestHandler<T, A> handler) throws IOException { final ActiveOperation<T, A> support = getActiveOperation(header); if(support == null) { throw ProtocolMessages.MESSAGES.responseHandlerNotFound(header.getBatchId()); } handleMessage(channel, message, header, support, handler); }
/** * Handle a message. * * @param channel the channel * @param message the message * @param header the protocol header * @param handler the request handler * @throws IOException */ protected <T, A> void handleMessage(final Channel channel, final DataInput message, final ManagementRequestHeader header, ManagementRequestHandler<T, A> handler) throws IOException { final ActiveOperation<T, A> support = getActiveOperation(header); if(support == null) { throw ProtocolLogger.ROOT_LOGGER.responseHandlerNotFound(header.getBatchId()); } handleMessage(channel, message, header, support, handler); }
/** * Handle a message. * * @param channel the channel * @param message the message * @param header the protocol header * @param handler the request handler * @throws IOException */ protected <T, A> void handleMessage(final Channel channel, final DataInput message, final ManagementRequestHeader header, ManagementRequestHandler<T, A> handler) throws IOException { final ActiveOperation<T, A> support = getActiveOperation(header); if(support == null) { throw ProtocolLogger.ROOT_LOGGER.responseHandlerNotFound(header.getBatchId()); } handleMessage(channel, message, header, support, handler); }
@Override public ManagementRequestHandler<?, ?> resolveHandler(final RequestHandlerChain handlers, final ManagementRequestHeader header) { switch (header.getOperationId()) { case ModelControllerProtocol.EXECUTE_ASYNC_CLIENT_REQUEST: case ModelControllerProtocol.EXECUTE_CLIENT_REQUEST: // initialize the operation ctx before executing the request handler handlers.registerActiveOperation(header.getBatchId(), null); return new ExecuteRequestHandler(); case ModelControllerProtocol.CANCEL_ASYNC_REQUEST: return new CancelAsyncRequestHandler(); case ModelControllerProtocol.GET_CHUNKED_INPUTSTREAM_REQUEST: // initialize the operation ctx before executing the request handler handlers.registerActiveOperation(header.getBatchId(), null); return responseAttachmentSupport.getReadHandler(); case ModelControllerProtocol.CLOSE_INPUTSTREAM_REQUEST: // initialize the operation ctx before executing the request handler handlers.registerActiveOperation(header.getBatchId(), null); return responseAttachmentSupport.getCloseHandler(); } return handlers.resolveNext(); }
@Override public ManagementRequestHandler<?, ?> resolveHandler(final RequestHandlerChain handlers, final ManagementRequestHeader header) { switch (header.getOperationId()) { case ModelControllerProtocol.EXECUTE_ASYNC_CLIENT_REQUEST: case ModelControllerProtocol.EXECUTE_CLIENT_REQUEST: // initialize the operation ctx before executing the request handler handlers.registerActiveOperation(header.getBatchId(), null); return new ExecuteRequestHandler(); case ModelControllerProtocol.CANCEL_ASYNC_REQUEST: return new CancelAsyncRequestHandler(); case ModelControllerProtocol.GET_CHUNKED_INPUTSTREAM_REQUEST: // initialize the operation ctx before executing the request handler handlers.registerActiveOperation(header.getBatchId(), null); return responseAttachmentSupport.getReadHandler(); case ModelControllerProtocol.CLOSE_INPUTSTREAM_REQUEST: // initialize the operation ctx before executing the request handler handlers.registerActiveOperation(header.getBatchId(), null); return responseAttachmentSupport.getCloseHandler(); } return handlers.resolveNext(); }
@Override public ManagementRequestHandler<?, ?> resolveHandler(final RequestHandlerChain handlers, final ManagementRequestHeader header) { switch (header.getOperationId()) { case ModelControllerProtocol.EXECUTE_ASYNC_CLIENT_REQUEST: case ModelControllerProtocol.EXECUTE_CLIENT_REQUEST: // initialize the operation ctx before executing the request handler handlers.registerActiveOperation(header.getBatchId(), null); return new ExecuteRequestHandler(); case ModelControllerProtocol.CANCEL_ASYNC_REQUEST: return new CancelAsyncRequestHandler(); } return handlers.resolveNext(); }
@Override public ManagementRequestHandler<?, ?> resolveHandler(final RequestHandlerChain handlers, final ManagementRequestHeader header) { switch (header.getOperationId()) { case ModelControllerProtocol.EXECUTE_ASYNC_CLIENT_REQUEST: case ModelControllerProtocol.EXECUTE_CLIENT_REQUEST: // initialize the operation ctx before executing the request handler handlers.registerActiveOperation(header.getBatchId(), null); return new ExecuteRequestHandler(); case ModelControllerProtocol.CANCEL_ASYNC_REQUEST: return new CancelAsyncRequestHandler(); } return handlers.resolveNext(); }
@Override public ManagementRequestHandler<?, ?> resolveHandler(RequestHandlerChain handlers, ManagementRequestHeader request) { switch(request.getOperationId()) { case ModelControllerProtocol.EXECUTE_TX_REQUEST: // Initialize the request context final ExecuteRequestContext executeRequestContext = new ExecuteRequestContext(); executeRequestContext.operation = handlers.registerActiveOperation(request.getBatchId(), executeRequestContext, executeRequestContext); return new ExecuteRequestHandler(); case ModelControllerProtocol.COMPLETE_TX_REQUEST: return new CompleteTxOperationHandler(); } return handlers.resolveNext(); }
@Override public ManagementRequestHandler<?, ?> resolveHandler(RequestHandlerChain handlers, ManagementRequestHeader request) { switch(request.getOperationId()) { case ModelControllerProtocol.EXECUTE_TX_REQUEST: // Initialize the request context final ExecuteRequestContext executeRequestContext = new ExecuteRequestContext(); executeRequestContext.operation = handlers.registerActiveOperation(request.getBatchId(), executeRequestContext, executeRequestContext); return new ExecuteRequestHandler(); case ModelControllerProtocol.COMPLETE_TX_REQUEST: return new CompleteTxOperationHandler(); } return handlers.resolveNext(); }
@Override public ManagementRequestHandler<?, ?> resolveHandler(final RequestHandlerChain handlers, final ManagementRequestHeader header) { final byte operationId = header.getOperationId(); switch (operationId) { case DomainControllerProtocol.REGISTER_HOST_CONTROLLER_REQUEST: // Start the registration process final RegistrationContext context = new RegistrationContext(domainController.getExtensionRegistry().getTransformerRegistry()); context.activeOperation = handlers.registerActiveOperation(header.getBatchId(), context, context); return new InitiateRegistrationHandler(); case DomainControllerProtocol.REQUEST_SUBSYSTEM_VERSIONS: // register the subsystem versions return new RegisterSubsystemVersionsHandler(); case DomainControllerProtocol.COMPLETE_HOST_CONTROLLER_REGISTRATION: // Complete the registration process return new CompleteRegistrationHandler(); } return handlers.resolveNext(); }