Package org.jboss.msc.service

Examples of org.jboss.msc.service.ServiceContainer


            final boolean managementSubsystemEndpoint = StreamUtils.readBoolean(initialInput);
            final byte[] asAuthKey = new byte[16];
            StreamUtils.readFully(initialInput, asAuthKey);

            // Get the host-controller server client
            final ServiceContainer container = containerFuture.get();
            final HostControllerClient client = getRequiredService(container, HostControllerConnectionService.SERVICE_NAME, HostControllerClient.class);
            // Reconnect to the host-controller
            client.reconnect(hostName, port, asAuthKey, managementSubsystemEndpoint);

        } catch (InterruptedIOException e) {
View Full Code Here


                CONFIG_LOGGER.trace(b);
            }
        }
        final ServiceTarget serviceTarget = context.getChildTarget();
        final ServiceController<?> myController = context.getController();
        final ServiceContainer container = myController.getServiceContainer();
        futureContainer = new FutureServiceContainer();

        long startTime = this.startTime;
        if (startTime == -1) {
            startTime = System.currentTimeMillis();
View Full Code Here

    @Override
    @SuppressWarnings("unchecked")
    public AsyncFuture<ServiceContainer> startup(Configuration configuration, List<ServiceActivator> extraServices) {
        try {
            ServiceContainer container = bootstrap(configuration, extraServices).get();
            ServiceController<?> controller = container.getRequiredService(Services.JBOSS_AS);
            return (AsyncFuture<ServiceContainer>) controller.getValue();
        } catch (Exception ex) {
            throw ServerMessages.MESSAGES.cannotStartServer(ex);
        }
    }
View Full Code Here

                CONFIG_LOGGER.trace(b);
            }
        }
        final ServiceTarget serviceTarget = context.getChildTarget();
        final ServiceController<?> myController = context.getController();
        final ServiceContainer serviceContainer = myController.getServiceContainer();
        futureContainer = new FutureServiceContainer();

        long startTime = this.startTime;
        if (startTime == -1) {
            startTime = System.currentTimeMillis();
View Full Code Here

        log.debugf("Starting: %s in mode %s", serviceController.getName(), serviceController.getMode());

        final Map<ServiceName, OSGiModule> pendingServices = new LinkedHashMap<ServiceName, OSGiModule>();
        try {
            final BundleManagerService bundleManager = injectedBundleManager.getValue();
            final ServiceContainer serviceContainer = serviceController.getServiceContainer();
            serviceTarget = context.getChildTarget();

            final File modulesDir = injectedEnvironment.getValue().getModulesDir();
            bundlesDir = new File(modulesDir.getPath() + "/../bundles").getCanonicalFile();
View Full Code Here

    public synchronized void start(StartContext context) throws StartException {
        ServiceController<?> controller = context.getController();
        log.debugf("Starting: %s in mode %s", controller.getName(), controller.getMode());
        try {
            ServiceContainer serviceContainer = context.getController().getServiceContainer();

            // Setup the OSGi {@link Framework} properties
            Map<String, Object> props = new HashMap<String, Object>(injectedSubsystemState.getValue().getProperties());
            setupIntegrationProperties(context, props);
View Full Code Here

     * Create a new controller with the passed in operations
     * @param bootOperations the operations
     */
    protected KernelServices installInController(AdditionalInitialization additionalInit, List<ModelNode> bootOperations) throws Exception {
        //Initialize the controller
        ServiceContainer container = ServiceContainer.Factory.create("test" + counter.incrementAndGet());
        ServiceTarget target = container.subTarget();
        ControlledProcessState processState = new ControlledProcessState(true);
        StringConfigurationPersister persister = new StringConfigurationPersister(bootOperations, TestParser.INSTANCE);
        ModelControllerService svc = new ModelControllerService(additionalInit, processState, persister);
        ServiceBuilder<ModelController> builder = target.addService(ServiceName.of("ModelController"), svc);
        builder.install();
View Full Code Here

                System.setProperty("jboss.protocol.handler.modules", "org.jboss.osgi.framework");

            // Setup the OSGi {@link Framework} properties
            Configuration config = injectedConfig.getValue();
            Map<String, Object> props = new HashMap<String, Object>(config.getProperties());
            ServiceContainer container = context.getController().getServiceContainer();
            ModuleLoader moduleLoader = injectedModuleLoader.getValue().getModuleLoader();
            Module frameworkModule = new FrameworkModuleLoader(moduleLoader, props).getFrameworkModule();
            props.put(IntegrationMode.class.getName(), IntegrationMode.CONTAINER);
            props.put(ModuleLoader.class.getName(), moduleLoader);
            props.put(ServiceContainer.class.getName(), container);
            props.put(Module.class.getName(), frameworkModule);

            // [TODO] This is a temporary workaround to configure the HTTP subsystem in OSGi
            // this will go away once the HTTP subsystem from AS implements the OSGi HTTP Service.
            props.put("org.osgi.service.http.port", "" + osgiHttpServerPortBinding.getValue().getSocketAddress().getPort());

            // Always clean the framework storage
            // [TODO] Differentiate beetween user data and persisted bundles
            props.put(Constants.FRAMEWORK_STORAGE_CLEAN, Constants.FRAMEWORK_STORAGE_CLEAN_ONFIRSTINIT);

            // Get {@link ModuleLoader} for the OSGi layer
            bundleManager = new BundleManager(props);
            ModuleManagerPlugin plugin = bundleManager.getPlugin(ModuleManagerPlugin.class);
            ModuleLoader osgiModuleLoader = plugin.getModuleLoader();

            // Register the {@link ModuleLoader} with the {@link ClassifyingModuleLoaderService}
            ServiceController<?> controller = container.getRequiredService(ClassifyingModuleLoaderService.SERVICE_NAME);
            ClassifyingModuleLoaderService moduleLoaderService = (ClassifyingModuleLoaderService) controller.getValue();
            Value<ModuleLoader> value = new ImmediateValue<ModuleLoader>(osgiModuleLoader);
            osgiModuleLoaderInjector = new ClassifyingModuleLoaderInjector(Constants.JBOSGI_PREFIX, value);
            osgiModuleLoaderInjector.inject(moduleLoaderService);
        } catch (Throwable t) {
View Full Code Here

    public synchronized void start(StartContext context) throws StartException {
        log.infof("Starting OSGi Framework");
        try {
            // Start the OSGi {@link Framework}
            final ServiceContainer serviceContainer = context.getController().getServiceContainer();
            BundleManager bundleManager = injectedBundleManager.getValue();
            framework = bundleManager.getFrameworkState();
            framework.start();

            // Register the {@link MBeanServer} as OSGi service
            BundleContext sysContext = framework.getBundleContext();
            MBeanServer mbeanServer = injectedMBeanServer.getValue();
            sysContext.registerService(MBeanServer.class.getName(), mbeanServer, null);

            // Register a {@link SynchronousBundleListener} that removes the {@link DeploymentService}
            BundleListener uninstallListener = new SynchronousBundleListener() {

                @Override
                public void bundleChanged(BundleEvent event) {
                    if (event.getType() == BundleEvent.UNINSTALLED) {
                        AbstractUserBundle userBundle;
                        try {
                            userBundle = AbstractUserBundle.assertBundleState(event.getBundle());
                        } catch (RuntimeException ex) {
                            // ignore
                            return;
                        }
                        Deployment deployment = userBundle.getDeployment();
                        ServiceName serviceName = deployment.getAttachment(ServiceName.class);
                        if (serviceName != null) {
                            ServiceController<?> controller = serviceContainer.getService(serviceName);
                            if (controller != null) {
                                controller.setMode(ServiceController.Mode.REMOVE);
                            }
                        }
                    }
View Full Code Here

     */
    public synchronized void start(StartContext context) throws StartException {

        // Get the OSGi system context
        ServiceController<?> controller = context.getController();
        ServiceContainer serviceContainer = controller.getServiceContainer();

        // Make sure the Framework does not shut down when the last bundle gets removed
        ServiceController<?> frameworkController = serviceContainer.getService(FrameworkService.SERVICE_NAME);
        frameworkController.setMode(Mode.ACTIVE);

        log.tracef("Installing deployment: %s", deployment);
        try {
            boolean autoStart = deployment.isAutoStart();
View Full Code Here

TOP

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

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.