Examples of ResourceXmlApplicationContext


Examples of org.apache.xbean.spring.context.ResourceXmlApplicationContext

    protected ApplicationContext createApplicationContext(String uri) throws MalformedURLException {
        Resource resource = Utils.resourceFromString(uri);
        LOG.debug("Using " + resource + " from " + uri);
        try {
            return new ResourceXmlApplicationContext(resource) {
                @Override
                protected void initBeanDefinitionReader(XmlBeanDefinitionReader reader) {
                    reader.setValidating(isValidate());
                }
            };
View Full Code Here

Examples of org.apache.xbean.spring.context.ResourceXmlApplicationContext

        try {
            Thread.currentThread().setContextClassLoader(BrokerService.class.getClassLoader());
            Resource resource = Utils.resourceFromString(config);

            ResourceXmlApplicationContext ctx = new ResourceXmlApplicationContext(resource, Collections.EMPTY_LIST, null, Collections.EMPTY_LIST, false) {
                protected void initBeanDefinitionReader(XmlBeanDefinitionReader reader) {
                    reader.setValidating(false);
                }
            };

            // Handle properties in configuration
            PropertySourcesPlaceholderConfigurer configurator =
                        new PropertySourcesPlaceholderConfigurer();

            //convert dictionary to properties. Is there a better way?
            Properties props = new Properties();
            Enumeration elements = properties.keys();
            while (elements.hasMoreElements()) {
                Object key = elements.nextElement();
                props.put(key, properties.get(key));
            }

            configurator.setProperties(props);
            configurator.setIgnoreUnresolvablePlaceholders(true);

            ctx.addBeanFactoryPostProcessor(configurator);

            ctx.refresh();

            // Start the broker
            BrokerService broker = ctx.getBean(BrokerService.class);
            if (broker == null) {
                throw new ConfigurationException(null, "Broker not defined");
            }
            //TODO deal with multiple brokers
View Full Code Here

Examples of org.apache.xbean.spring.context.ResourceXmlApplicationContext

        } else if (ResourceUtils.isUrl(uri)) {
            resource = new UrlResource(uri);
        } else {
            resource = new ClassPathResource(uri);
        }
        return new ResourceXmlApplicationContext(resource);
    }
View Full Code Here

Examples of org.apache.xbean.spring.context.ResourceXmlApplicationContext

    public void afterPropertiesSet() throws Exception {
        if (config == null) {
            throw new IllegalArgumentException("config property must be set");
        }
        context = new ResourceXmlApplicationContext(config, parentContext);

        try {
            broker = (XBeanBrokerService)context.getBean("broker");
        } catch (BeansException e) {
            // ignore...
View Full Code Here

Examples of org.apache.xbean.spring.context.ResourceXmlApplicationContext

            // and perform introspection
            ClassLoader oldClassLoader = Thread.currentThread().getContextClassLoader();
            Thread.currentThread().setContextClassLoader(classLoader);
            log.debug("Loading file: " + file + " using classLoader: " + classLoader);
            try {
                AbstractXmlApplicationContext applicationContext = new ResourceXmlApplicationContext(new FileSystemResource(file), xmlPreprocessors, parentContext, beanFactoryPostProcessors, false);
                applicationContext.setDisplayName(name);
                applicationContext.setClassLoader(classLoader);

                ServiceFactory serviceFactory = new SpringConfigurationServiceFactory(applicationContext);

                log.info("Registering spring services service: " + name + " from: " + file.getAbsolutePath() + " into the Kernel");
View Full Code Here

Examples of org.apache.xbean.spring.context.ResourceXmlApplicationContext

    protected ApplicationContext createApplicationContext(String uri) throws MalformedURLException {
        Resource resource = Utils.resourceFromString(uri);
        LOG.debug("Using " + resource + " from " + uri);
        try {
            return new ResourceXmlApplicationContext(resource) {
                @Override
                protected void initBeanDefinitionReader(XmlBeanDefinitionReader reader) {
                    reader.setValidating(isValidate());
                }
            };
View Full Code Here

Examples of org.apache.xbean.spring.context.ResourceXmlApplicationContext

        try {
            Thread.currentThread().setContextClassLoader(BrokerService.class.getClassLoader());
            Resource resource = Utils.resourceFromString(config);

            ResourceXmlApplicationContext ctx = new ResourceXmlApplicationContext(resource, Collections.EMPTY_LIST, null, Collections.EMPTY_LIST, false) {
                @Override
                protected void initBeanDefinitionReader(XmlBeanDefinitionReader reader) {
                    reader.setValidating(false);
                }
            };

            // Handle properties in configuration
            PropertyPlaceholderConfigurer configurator = new PropertyPlaceholderConfigurer();

            // convert dictionary to properties. Is there a better way?
            Properties props = new Properties();
            Enumeration<?> elements = properties.keys();
            while (elements.hasMoreElements()) {
                Object key = elements.nextElement();
                props.put(key, properties.get(key));
            }

            configurator.setProperties(props);
            configurator.setIgnoreUnresolvablePlaceholders(true);

            ctx.addBeanFactoryPostProcessor(configurator);

            ctx.refresh();

            // Start the broker
            BrokerService broker = ctx.getBean(BrokerService.class);
            if (broker == null) {
                throw new ConfigurationException(null, "Broker not defined");
            }
            // TODO deal with multiple brokers
View Full Code Here

Examples of org.apache.xbean.spring.context.ResourceXmlApplicationContext

    protected ApplicationContext createApplicationContext(String uri) throws MalformedURLException {
        Resource resource = Utils.resourceFromString(uri);
        LOG.debug("Using " + resource + " from " + uri);
        try {
            return new ResourceXmlApplicationContext(resource) {
                @Override
                protected void initBeanDefinitionReader(XmlBeanDefinitionReader reader) {
                    reader.setValidating(isValidate());
                }
            };
View Full Code Here

Examples of org.apache.xbean.spring.context.ResourceXmlApplicationContext

    public void afterPropertiesSet() throws Exception {
        if (config == null) {
            throw new IllegalArgumentException("config property must be set");
        }
        context = new ResourceXmlApplicationContext(config, parentContext);

        try {
            broker = (XBeanBrokerService)context.getBean("broker");
        } catch (BeansException e) {
            // ignore...
View Full Code Here

Examples of org.apache.xbean.spring.context.ResourceXmlApplicationContext

                BrokerService.class.getClassLoader()
            });
            Thread.currentThread().setContextClassLoader(classLoader);

            Resource resource = Utils.resourceFromString(uri);
            ResourceXmlApplicationContext ctx = new ResourceXmlApplicationContext(resource) {
                @Override
                protected void initBeanDefinitionReader(XmlBeanDefinitionReader reader) {
                    reader.setValidating(false);
                }
            };

            String[] names = ctx.getBeanNamesForType(BrokerService.class);
            BrokerService broker = null;
            for (String name : names) {
                broker = ctx.getBean(name, BrokerService.class);
                if (broker != null) {
                    break;
                }
            }
            if (broker == null) {
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.