Examples of ServiceRegistry


Examples of org.jboss.msc.service.ServiceRegistry

        context.readModelForUpdate(PathAddress.EMPTY_ADDRESS).get(CommonAttributes.LEVEL).set(level);

        if (context.getType() == OperationContext.Type.SERVER) {
            context.addStep(new OperationStepHandler() {
                public void execute(OperationContext context, ModelNode operation) {
                    final ServiceRegistry serviceRegistry = context.getServiceRegistry(false);
                    final ServiceController<Handler> controller = (ServiceController<Handler>) serviceRegistry.getService(LogServices.handlerName(name));
                    if (controller != null) {
                        controller.getValue().setLevel(Level.parse(level));
                    }
                    context.completeStep();
                }
View Full Code Here

Examples of org.jboss.msc.service.ServiceRegistry

        model.get(CommonAttributes.ROOT_LOGGER, CommonAttributes.LEVEL).set(level);

        if (context.getType() == OperationContext.Type.SERVER) {
            context.addStep(new OperationStepHandler() {
                public void execute(OperationContext context, ModelNode operation) {
                    final ServiceRegistry serviceRegistry = context.getServiceRegistry(false);
                    final ServiceController<Logger> controller = (ServiceController<Logger>) serviceRegistry.getService(LogServices.ROOT_LOGGER);
                    if (controller != null) {
                        controller.getValue().setLevel(Level.parse(level));
                    }
                    context.completeStep();
                }
View Full Code Here

Examples of org.jboss.msc.service.ServiceRegistry

     * @param handlerNameToAdd the name of the handler to add.
     *
     * @throws OperationFailedException if an error occurs.
     */
    public static void addHandler(final OperationContext context, final String asyncHandlerName, final String handlerNameToAdd) throws OperationFailedException {
        final ServiceRegistry serviceRegistry = context.getServiceRegistry(true);
        @SuppressWarnings("unchecked")
        final ServiceController<Handler> asyncHandlerController = (ServiceController<Handler>) serviceRegistry.getService(LogServices.handlerName(asyncHandlerName));
        @SuppressWarnings("unchecked")
        final ServiceController<Handler> handlerToAssignController = (ServiceController<Handler>) serviceRegistry.getService(LogServices.handlerName(handlerNameToAdd));

        if (handlerToAssignController == null) {
            throw createFailureMessage(MESSAGES.handlerNotFound(handlerNameToAdd));
        }

View Full Code Here

Examples of org.jboss.msc.service.ServiceRegistry

    @Override
    protected final boolean applyUpdateToRuntime(final OperationContext context, final ModelNode operation, final String attributeName, final ModelNode resolvedValue, final ModelNode currentValue, final HandbackHolder<T> handbackHolder) throws OperationFailedException {
        final PathAddress address = PathAddress.pathAddress(operation.require(OP_ADDR));
        final String name = address.getLastElement().getValue();
        final ServiceRegistry serviceRegistry = context.getServiceRegistry(false);
        @SuppressWarnings("unchecked")
        final ServiceController<Handler> controller = (ServiceController<Handler>) serviceRegistry.getService(LogServices.handlerName(name));
        if (controller == null) {
            return false;
        }
        // Attempt to cast handler
        @SuppressWarnings("unchecked")
View Full Code Here

Examples of org.jboss.msc.service.ServiceRegistry

                public void execute(OperationContext context, ModelNode operation) throws OperationFailedException {
                    final List<ServiceController<?>> controllers = new ArrayList<ServiceController<?>>();
                    final ServiceVerificationHandler verificationHandler = new ServiceVerificationHandler();
                    final PathAddress address = PathAddress.pathAddress(operation.require(OP_ADDR));
                    final String name = address.getLastElement().getValue();
                    final ServiceRegistry serviceRegistry = context.getServiceRegistry(false);
                    @SuppressWarnings("unchecked")
                    final ServiceController<Handler> controller = (ServiceController<Handler>) serviceRegistry.getService(LogServices.handlerName(name));
                    if (controller != null) {
                        @SuppressWarnings("unchecked")
                        final T handler = (T) controller.getValue();
                        final ModelNode level = LEVEL.resolveModelAttribute(context, model);
                        final ModelNode formatter = FORMATTER.resolveModelAttribute(context, model);
View Full Code Here

Examples of org.jboss.msc.service.ServiceRegistry

    protected void performRuntime(final OperationContext context, final ModelNode operation, final ModelNode model,
                                  final ServiceVerificationHandler verificationHandler, final List<ServiceController<?>> newControllers) throws OperationFailedException {
        final PathAddress address = PathAddress.pathAddress(operation.require(OP_ADDR));
        final String name = address.getLastElement().getValue();
        final ModelNode level = LEVEL.resolveModelAttribute(context, model);
        final ServiceRegistry serviceRegistry = context.getServiceRegistry(true);
        @SuppressWarnings("unchecked")
        final ServiceController<Logger> controller = (ServiceController<Logger>) serviceRegistry.getService(LogServices.loggerName(name));
        if (controller != null && level.isDefined()) {
            controller.getValue().setLevel(ModelParser.parseLevel(level));
        }
    }
View Full Code Here

Examples of org.jboss.msc.service.ServiceRegistry

        LEVEL.validateAndSet(operation, model.get(ROOT_LOGGER));
    }

    @Override
    protected void performRuntime(final OperationContext context, final ModelNode operation, final ModelNode model, final ServiceVerificationHandler verificationHandler, final List<ServiceController<?>> newControllers) throws OperationFailedException {
        final ServiceRegistry serviceRegistry = context.getServiceRegistry(false);
        @SuppressWarnings("unchecked")
        final ServiceController<Logger> controller = (ServiceController<Logger>) serviceRegistry.getService(LogServices.ROOT_LOGGER);
        final ModelNode level = LEVEL.resolveModelAttribute(context, model.get(ROOT_LOGGER));
        if (controller != null && level.isDefined()) {
            controller.getValue().setLevel(ModelParser.parseLevel(level));
        }
    }
View Full Code Here

Examples of org.jboss.msc.service.ServiceRegistry

    @Override
    protected void performRuntime(final OperationContext context, final ModelNode operation, final ModelNode model,
                                  final ServiceVerificationHandler verificationHandler, final List<ServiceController<?>> newControllers) throws OperationFailedException {
        final PathAddress address = PathAddress.pathAddress(operation.require(OP_ADDR));
        final String name = address.getLastElement().getValue();
        final ServiceRegistry serviceRegistry = context.getServiceRegistry(true);
        @SuppressWarnings("unchecked")
        final ServiceController<Handler> controller = (ServiceController<Handler>) serviceRegistry.getService(LogServices.handlerName(name));
        final ModelNode level = LEVEL.resolveModelAttribute(context, model);
        if (controller != null && level.isDefined()) {
            controller.getValue().setLevel(ModelParser.parseLevel(level));
        }
    }
View Full Code Here

Examples of org.jboss.msc.service.ServiceRegistry

    @Override
    protected boolean applyUpdateToRuntime(final OperationContext context, final ModelNode operation, final String attributeName, final ModelNode resolvedValue, final ModelNode currentValue, final HandbackHolder<Logger> handbackHolder) throws OperationFailedException {
        final PathAddress address = PathAddress.pathAddress(operation.require(OP_ADDR));
        final String name = address.getLastElement().getValue();
        final ServiceRegistry serviceRegistry = context.getServiceRegistry(false);
        @SuppressWarnings("unchecked")
        final ServiceController<Logger> controller = (ServiceController<Logger>) serviceRegistry.getService(LogServices.handlerName(name));
        if (controller == null) {
            return false;
        }
        // Get the logger
        final Logger logger = controller.getValue();
View Full Code Here

Examples of org.jboss.msc.service.ServiceRegistry

     * @param handlerNameToRemove the name of the handler to remove.
     *
     * @throws OperationFailedException if an error occurs.
     */
    public static void removeHandler(final OperationContext context, final String asyncHandlerName, final String handlerNameToRemove) throws OperationFailedException {
        ServiceRegistry serviceRegistry = context.getServiceRegistry(true);
        @SuppressWarnings("unchecked")
        ServiceController<Handler> handlerController = (ServiceController<Handler>) serviceRegistry.getService(LogServices.handlerName(asyncHandlerName));
        @SuppressWarnings("unchecked")
        ServiceController<Handler> handlerToRemoveController = (ServiceController<Handler>) serviceRegistry.getService(LogServices.handlerName(handlerNameToRemove));

        AsyncHandlerService service = AsyncHandlerService.class.cast(handlerController.getService());
        Handler injectedHandler = handlerToRemoveController.getService().getValue();
        service.removeHandler(injectedHandler);

View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.