Package org.apache.xbean.kernel

Examples of org.apache.xbean.kernel.ServiceName


            springLoader.setKernel(kernel);
            springLoader.setBaseDir(new File(serviceUnitRootPath));
            springLoader.setXmlPreprocessors(getXmlPreProcessors(serviceUnitRootPath));
            springLoader.setBeanFactoryPostProcessors(getBeanFactoryPostProcessors(serviceUnitRootPath));
           
            ServiceName configurationName = springLoader.load(getXBeanFile());
            kernel.startService(configurationName);
            su.setConfiguration(configurationName);
            // Use SU classloader
            Thread.currentThread().setContextClassLoader(su.getConfigurationClassLoader());
            // Retrieve endpoints
View Full Code Here


            springLoader.setKernel(kernel);
            springLoader.setBaseDir(new File(serviceUnitRootPath));
            springLoader.setXmlPreprocessors(getXmlPreProcessors(serviceUnitRootPath));
            springLoader.setBeanFactoryPostProcessors(getBeanFactoryPostProcessors(serviceUnitRootPath));
           
            ServiceName configurationName = springLoader.load(getXBeanFile());
            kernel.startService(configurationName);
            su.setConfiguration(configurationName);
            // Retrieve endpoints
            List services = getServices(kernel);
            if (services == null || services.size() == 0) {
View Full Code Here

            springLoader.setKernel(kernel);
            springLoader.setBaseDir(new File(serviceUnitRootPath));
            springLoader.setXmlPreprocessors(getXmlPreProcessors(serviceUnitRootPath));
            springLoader.setBeanFactoryPostProcessors(getBeanFactoryPostProcessors(serviceUnitRootPath));
           
            ServiceName configurationName = springLoader.load(getXBeanFile());
            kernel.startService(configurationName);
            su.setConfiguration(configurationName);
            // Use SU classloader
            Thread.currentThread().setContextClassLoader(su.getConfigurationClassLoader());
            // Retrieve endpoints
View Full Code Here

            // Use Spring to create all of the beans
            Map factories = new HashMap(serviceNameIndex.size());
            for (Iterator iterator = serviceNameIndex.entrySet().iterator(); iterator.hasNext();) {
                Map.Entry entry = (Map.Entry) iterator.next();
                String beanName = (String) entry.getKey();
                ServiceName serviceName = (ServiceName) entry.getValue();

                Object bean = applicationContext.getBean(beanName);
                StaticServiceFactory serviceFactory = new StaticServiceFactory(bean, classLoader);
                factories.put(serviceName, serviceFactory);
            }
            serviceFactories = Collections.unmodifiableMap(factories);

            // register each bean with the kernel
            for (Iterator iterator = serviceFactories.entrySet().iterator(); iterator.hasNext();) {
                Map.Entry entry = (Map.Entry) iterator.next();
                ServiceName serviceName = (ServiceName) entry.getKey();
                StaticServiceFactory serviceFactory = (StaticServiceFactory) entry.getValue();
                kernel.registerService(serviceName, serviceFactory);
            }

        } catch (ServiceAlreadyExistsException e) {
View Full Code Here

    public void destroy() {
        ClassLoader oldClassLoader = Thread.currentThread().getContextClassLoader();
        Thread.currentThread().setContextClassLoader(getClassLoader(applicationContext));
        try {
            for (Iterator iterator = serviceFactories.keySet().iterator(); iterator.hasNext();) {
                ServiceName serviceName = (ServiceName) iterator.next();
                try {
                    kernel.unregisterService(serviceName);
                } catch (ServiceNotFoundException e) {
                    // Doesn't matter
                } catch (ServiceRegistrationException e) {
View Full Code Here

            Map serviceNameIndex = new HashMap(beanNames.length);
            for (int i = 0; i < beanNames.length; i++) {
                String beanName = beanNames[i];
                BeanDefinition def = registry.getBeanDefinition(beanName);
                if (!def.isAbstract()) {
                    ServiceName serviceName = new StringServiceName(beanName);
                    serviceNameIndex.put(beanName, serviceName);
                }
            }
            return serviceNameIndex;
        } else {
            String[] beanNames = applicationContext.getBeanDefinitionNames();
            Map serviceNameIndex = new HashMap(beanNames.length);
            for (int i = 0; i < beanNames.length; i++) {
                String beanName = beanNames[i];
                ServiceName serviceName = new StringServiceName(beanName);
                serviceNameIndex.put(beanName, serviceName);
            }
            return serviceNameIndex;
        }
    }
View Full Code Here

        }
        if (classLoader == null) {
            classLoader = SpringLoader.class.getClassLoader();
        }

        ServiceName serviceName = new StringServiceName("configuration:" + location);
        ServiceFactory springConfigurationServiceFactory = new SpringConfigurationServiceFactory(applicationContext);
        kernel.registerService(serviceName, springConfigurationServiceFactory);
        return serviceName;
    }
View Full Code Here

        // add owned service stop conditions
        Set ownedServices = springConfiguration.getServiceFactories().keySet();
        for (Iterator iterator = springConfiguration.getServiceFactories().entrySet().iterator(); iterator.hasNext();) {
            Map.Entry entry = (Map.Entry) iterator.next();
            ServiceName serviceName = (ServiceName) entry.getKey();
            ServiceFactory serviceFactory = (ServiceFactory) entry.getValue();
            if (ownedServices.contains(serviceName)) {
                serviceFactory.addStopCondition(configurationStopCondition.createOwnedServiceStopCondition());
            }
        }
View Full Code Here

    private void load(String location) {
        List loaders = kernel.getServices(Loader.class);
        for (Iterator iterator = loaders.iterator(); iterator.hasNext();) {
            Loader loader = (Loader) iterator.next();
            try {
                ServiceName configurationName = loader.load(location);
                if (configurationName != null) {
                    kernel.startServiceRecursive(configurationName);
                    return;
                }
            } catch (Exception e) {
View Full Code Here

                    Map.Entry entry = (Map.Entry) iterator.next();
                    String name = (String) entry.getKey();
                    Object service = entry.getValue();

                    try {
                        ServiceName serviceName = new StringServiceName(name);
                        kernel.registerService(serviceName, new StaticServiceFactory(service, classLoader));
                        kernel.startService(serviceName);
                    } catch (Exception e) {
                        throw new FatalStartupError("Unable to bind bootstrap service '" + name + "' into the kernel", e);
                    }
View Full Code Here

TOP

Related Classes of org.apache.xbean.kernel.ServiceName

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.