Package org.jboss.msc.service

Examples of org.jboss.msc.service.ServiceTarget


    @Override
    protected void updateRuntime(final OperationContext context, final ServiceBuilder<Handler> serviceBuilder, final String name, final PeriodicRotatingFileHandlerService service, final ModelNode model) throws OperationFailedException {
        super.updateRuntime(context, serviceBuilder, name, service, model);
        final ModelNode file = FILE.resolveModelAttribute(context, model);
        if (file.isDefined()) {
            final ServiceTarget serviceTarget = context.getServiceTarget();
            final HandlerFileService fileService = new HandlerFileService(PATH.resolveModelAttribute(context, file).asString());
            final ServiceBuilder<?> fileBuilder = serviceTarget.addService(LogServices.handlerFileName(name), fileService);
            final ModelNode relativeTo = RELATIVE_TO.resolveModelAttribute(context, file);
            if (relativeTo.isDefined()) {
                fileBuilder.addDependency(AbstractPathService.pathNameOf(relativeTo.asString()), String.class, fileService.getRelativeToInjector());
            }
            fileBuilder.setInitialMode(ServiceController.Mode.ACTIVE).install();
View Full Code Here


    protected final 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.get(OP_ADDR));
        final String name = address.getLastElement().getValue();

        final ServiceTarget serviceTarget = context.getServiceTarget();
        final T service = createHandlerService(context, model);
        final ServiceBuilder<Handler> serviceBuilder = serviceTarget.addService(LogServices.handlerName(name), service);
        final ModelNode level = LEVEL.resolveModelAttribute(context, model);
        final ModelNode encoding = ENCODING.resolveModelAttribute(context, model);
        final ModelNode formatter = FORMATTER.resolveModelAttribute(context, model);
        final ModelNode filter = FILTER.resolveModelAttribute(context, model);
View Full Code Here

        if (handlerController == null) {
            throw createFailureMessage(MESSAGES.handlerNotFound(handlerName));
        }

        ServiceTarget target = context.getServiceTarget();
        LoggerHandlerService service = new LoggerHandlerService(loggerName);
        ServiceBuilder<Logger> builder = target.addService(LogServices.loggerHandlerName(loggerName, handlerName), service);
        builder.addDependency(LogServices.loggerName(loggerName));
        builder.addDependency(LogServices.handlerName(handlerName), Handler.class, service.getHandlerInjector());
        builder.addListener(verificationHandler);
        newControllers.add(builder.install());
    }
View Full Code Here

        final String name = address.getLastElement().getValue();
        final ModelNode level = LEVEL.resolveModelAttribute(context, model);
        final ModelNode useParentHandlers = USE_PARENT_HANDLERS.resolveModelAttribute(context, model);
        final ModelNode filter = FILTER.resolveModelAttribute(context, model);

        final ServiceTarget target = context.getServiceTarget();
        try {
            // Install logger service
            final LoggerService service = new LoggerService(name);
            if (level.isDefined()) service.setLevel(ModelParser.parseLevel(level));
            if (useParentHandlers.isDefined()) service.setUseParentHandlers(useParentHandlers.asBoolean());
            if (filter.isDefined()) service.setFilter(ModelParser.parseFilter(context, filter));
            newControllers.add(target.addService(LogServices.loggerName(name), service)
                    .addListener(verificationHandler)
                    .setInitialMode(ServiceController.Mode.ACTIVE)
                    .install());
        } catch (Throwable t) {
            throw new OperationFailedException(new ModelNode().set(t.getLocalizedMessage()));
View Full Code Here

        super.updateRuntime(context, serviceBuilder, name, service, model);
        final ModelNode append = APPEND.resolveModelAttribute(context, model);
        if (append.isDefined()) {
            service.setAppend(append.asBoolean());
        }
        final ServiceTarget serviceTarget = context.getServiceTarget();
        final ModelNode file = FILE.resolveModelAttribute(context, model);
        if (file.isDefined()) {
            final HandlerFileService fileService = new HandlerFileService(PATH.validateOperation(file).asString());
            final ServiceBuilder<?> fileBuilder = serviceTarget.addService(LogServices.handlerFileName(name), fileService);
            final ModelNode relativeTo = RELATIVE_TO.resolveModelAttribute(context, file);
            if (relativeTo.isDefined()) {
                fileBuilder.addDependency(AbstractPathService.pathNameOf(relativeTo.asString()), String.class, fileService.getRelativeToInjector());
            }
            fileBuilder.setInitialMode(ServiceController.Mode.ACTIVE).install();
View Full Code Here

    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 ServiceTarget serviceTarget = context.getServiceTarget();
        final HandlerFileService service = new HandlerFileService(PATH.resolveModelAttribute(context, model).asString());
        final ServiceBuilder<String> serviceBuilder = serviceTarget.addService(LogServices.handlerName(name), service);

        final ModelNode relativeTo = RELATIVE_TO.resolveModelAttribute(context, model);
        if (relativeTo.isDefined()) {
            serviceBuilder.addDependency(AbstractPathService.pathNameOf(relativeTo.asString()), String.class, service.getRelativeToInjector());
        }
View Full Code Here

    protected void performRuntime(OperationContext context, ModelNode operation, ModelNode model, ServiceVerificationHandler verificationHandler, List<ServiceController<?>> newControllers) throws OperationFailedException {
        final PathAddress address = PathAddress.pathAddress(LoggingExtension.rootLoggerPath);
        final String name = address.getLastElement().getValue();
        final ModelNode level = LEVEL.resolveModelAttribute(context, model);
        final ModelNode handlers = HANDLERS.resolveModelAttribute(context, model);
        final ServiceTarget target = context.getServiceTarget();
        try {

            final RootLoggerService service = new RootLoggerService();
            if (level.isDefined()) service.setLevel(ModelParser.parseLevel(level));
            newControllers.add(target.addService(LogServices.loggerName(name), service)
                    .addListener(verificationHandler)
                    .setInitialMode(ServiceController.Mode.ACTIVE)
                    .install());

View Full Code Here

        final String relativeTo = operation.hasDefined(CommonAttributes.RELATIVE_TO) ? RELATIVE_TO.resolveModelAttribute(context, operation).asString() : null;
        final Boolean autoDeployZip = AUTO_DEPLOY_ZIPPED.resolveModelAttribute(context, operation).asBoolean();
        final Boolean autoDeployExp = AUTO_DEPLOY_EXPLODED.resolveModelAttribute(context, operation).asBoolean();
        final Boolean autoDeployXml = AUTO_DEPLOY_XML.resolveModelAttribute(context, operation).asBoolean();
        final Long deploymentTimeout = DEPLOYMENT_TIMEOUT.resolveModelAttribute(context, operation).asLong();
        final ServiceTarget serviceTarget = context.getServiceTarget();
        DeploymentScannerService.addService(serviceTarget, name, relativeTo, path, interval, TimeUnit.MILLISECONDS,
                autoDeployZip, autoDeployExp, autoDeployXml, enabled, deploymentTimeout, newControllers, bootTimeScanner, executorService, verificationHandler);

    }
View Full Code Here

        if (coordinatorURL != null && XtsAsLogger.ROOT_LOGGER.isDebugEnabled()) {
            XtsAsLogger.ROOT_LOGGER.debugf("nodeIdentifier=%s\n", coordinatorURL);
        }


        final ServiceTarget target = context.getServiceTarget();

                // TODO eventually we should add a config service which manages the XTS configuration
                // this will allow us to include a switch enabling or disabling deployment of
                // endpoints specific to client, coordinator or participant and then deploy
                // and redeploy the relevant endpoints as needed/ the same switches can be used
                // byte the XTS service to decide whether to perfomr client, coordinator or
                // participant initialisation. we shoudl also provide config switches which
                // decide whether to initialise classes and deploy services for AT, BA or both.
                // for now we will just deploy all the endpoints and always do client, coordinator
                // and participant init for both AT and BA.

                // add an endpoint publisher service for each of the required endpoint contexts
                // specifying all the relevant URL patterns and SEI classes

                final ClassLoader loader = XTSService.class.getClassLoader();
                ServiceBuilder<Context> endpointBuilder;
                ArrayList<ServiceController<Context>> controllers = new ArrayList<ServiceController<Context>>();
                for (ContextInfo contextInfo : contextDefinitions) {
                    String contextName = contextInfo.contextPath;
                    Map<String, String> map = new HashMap<String, String>();
                    for (EndpointInfo endpointInfo : contextInfo.endpointInfo) {
                        map.put(endpointInfo.URLPattern, endpointInfo.SEIClassname);
                    }
                    endpointBuilder = EndpointPublishService.createServiceBuilder(target, contextName, loader,
                            ENDPOINT_SERVICE_HOST_NAME, map);

                    controllers.add(endpointBuilder.setInitialMode(Mode.ACTIVE)
                        .install());
                }

                // add an XTS service which depends on all the WS endpoints

                final XTSManagerService xtsService = new XTSManagerService(coordinatorURL);

                // this service needs to depend on the transaction recovery service
                // because it can only initialise XTS recovery once the transaction recovery
                // service has initialised the orb layer

                ServiceBuilder<?> xtsServiceBuilder = target.addService(XTSServices.JBOSS_XTS_MAIN, xtsService);
                xtsServiceBuilder
                        .addDependency(TxnServices.JBOSS_TXN_ARJUNA_TRANSACTION_MANAGER);

                // this service needs to depend on JBossWS Config Service to be notified of the JBoss WS config (bind address, port etc)
                xtsServiceBuilder.addDependency(WSServices.CONFIG_SERVICE, ServerConfig.class, xtsService.getWSServerConfig());

                // the service also needs to depend on the endpoint services
                for (ServiceController<Context> controller : controllers) {
                    xtsServiceBuilder.addDependency(controller.getName());
                }

                xtsServiceBuilder
                        .setInitialMode(Mode.ACTIVE)
                        .install();

                // WS-AT / JTA Transaction bridge services:

                final TxBridgeInboundRecoveryService txBridgeInboundRecoveryService = new TxBridgeInboundRecoveryService();
                ServiceBuilder<?> txBridgeInboundRecoveryServiceBuilder =
                        target.addService(XTSServices.JBOSS_XTS_TXBRIDGE_INBOUND_RECOVERY, txBridgeInboundRecoveryService);
                txBridgeInboundRecoveryServiceBuilder.addDependency(XTSServices.JBOSS_XTS_MAIN);

                txBridgeInboundRecoveryServiceBuilder.setInitialMode(Mode.ACTIVE).install();

                final TxBridgeOutboundRecoveryService txBridgeOutboundRecoveryService = new TxBridgeOutboundRecoveryService();
                ServiceBuilder<?> txBridgeOutboundRecoveryServiceBuilder =
                        target.addService(XTSServices.JBOSS_XTS_TXBRIDGE_OUTBOUND_RECOVERY, txBridgeOutboundRecoveryService);
                txBridgeOutboundRecoveryServiceBuilder.addDependency(XTSServices.JBOSS_XTS_MAIN);

                txBridgeOutboundRecoveryServiceBuilder.setInitialMode(Mode.ACTIVE).install();

    }
View Full Code Here

        ControllerInitializer controllerInitializer = additionalInit.createControllerInitializer();
        additionalInit.setupController(controllerInitializer);

        //Initialize the controller
        ServiceContainer container = ServiceContainer.Factory.create("test" + counter.incrementAndGet());
        ServiceTarget target = container.subTarget();
        ControlledProcessState processState = new ControlledProcessState(true);
        List<ModelNode> extraOps = controllerInitializer.initializeBootOperations();
        List<ModelNode> allOps = new ArrayList<ModelNode>();
        if (extraOps != null) {
            allOps.addAll(extraOps);
        }
        allOps.addAll(bootOperations);
        StringConfigurationPersister persister = new StringConfigurationPersister(allOps, testParser);
        final ExtensionRegistry controllerExtensionRegistry = cloneExtensionRegistry();
        controllerExtensionRegistry.setWriterRegistry(persister);
        ModelControllerService svc = new ModelControllerService(mainExtension, controllerInitializer, additionalInit, controllerExtensionRegistry,
                processState, persister, additionalInit.isValidateOperations());
        ServiceBuilder<ModelController> builder = target.addService(Services.JBOSS_SERVER_CONTROLLER, svc);
        builder.install();

        additionalInit.addExtraServices(target);

        //sharedState = svc.state;
View Full Code Here

TOP

Related Classes of org.jboss.msc.service.ServiceTarget

Copyright © 2018 www.massapicom. 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.