Package org.apache.xbean.spring.context

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


    private void startServiceMix() throws MojoExecutionException {
        ClassLoader old = Thread.currentThread().getContextClassLoader();
        try {
            Thread.currentThread().setContextClassLoader(getClassLoader());
            context = new FileSystemXmlApplicationContext("file:///"
                    + servicemixConfig.getAbsolutePath());
            container = (SpringJBIContainer) context.getBean("jbi");
        } catch (Exception e) {
            throw new MojoExecutionException(
                    "Unable to start the ServiceMix container", e);
View Full Code Here


                }
               
                List processors = new ArrayList();
                processors.add(new ClassLoaderXmlPreprocessor(new File(".")));
                System.out.println("Loading Apache ServiceMix from file: " + file);
                context = new FileSystemXmlApplicationContext(file, processors);
            }
            SpringJBIContainer container = (SpringJBIContainer) context.getBean("jbi");           
            container.onShutDown(new Runnable() {
                public void run() {
                    if (context instanceof DisposableBean) {
View Full Code Here

   * (non-Javadoc)
   *
   * @see org.apache.servicemix.common.packaging.ServiceUnitAnalyzer#init(java.io.File)
   */
  public void init(File explodedServiceUnitRoot) {
    FileSystemXmlApplicationContext context = new FileSystemXmlApplicationContext(
       new String[] { "file:///" + explodedServiceUnitRoot.getAbsolutePath() + "/" + getXBeanFile() },
           false);
        List beanFactoryPostProcessors = getBeanFactoryPostProcessors(explodedServiceUnitRoot.getAbsolutePath());
        for (Iterator iter = beanFactoryPostProcessors.iterator(); iter.hasNext();) {
            BeanFactoryPostProcessor processor = (BeanFactoryPostProcessor) iter.next();
            context.addBeanFactoryPostProcessor(processor);
        }
        context.refresh();
    for (int i = 0; i < context.getBeanDefinitionNames().length; i++) {
      Object bean = context.getBean(context.getBeanDefinitionNames()[i]);
      if (isValidEndpoint(bean)) {
        // The provides are generic while the consumes need to
        // be handled by the implementation
        Endpoint endpoint = (Endpoint) bean;
        provides.addAll(getProvides(endpoint));
View Full Code Here

                }
               
                List processors = new ArrayList();
                processors.add(new ClassLoaderXmlPreprocessor(new File(".")));
                System.out.println("Loading Apache ServiceMix from file: " + file);
                context = new FileSystemXmlApplicationContext(file, processors);
            }
            SpringJBIContainer container = (SpringJBIContainer) context.getBean("jbi");           
            container.onShutDown(new Runnable() {
                public void run() {
                    if (context instanceof DisposableBean) {
View Full Code Here

    /**
     * A factory method for creating the application context
     */
    protected AbstractXmlApplicationContext createXmlApplicationContext(String configLocation) {
        return new FileSystemXmlApplicationContext(
                new String[] {configLocation},
                false,
                xmlPreprocessors);
    }
View Full Code Here

                file = new File(baseDirectory, configurationFile);
            }
            if (file.canRead()) {
                try {
                    // configuration file is on the local file system
                    factory = new FileSystemXmlApplicationContext(file.toURL().toString());
                } catch (MalformedURLException e) {
                    throw new FatalStartupError("Error creating url for bootstrap file", e);
                }
            } else {
                // assume it is a classpath resource
View Full Code Here

                }
               
                List processors = new ArrayList();
                processors.add(new ClassLoaderXmlPreprocessor(new FileSystemRepository(new File("."))));
                System.out.println("Loading Apache ServiceMix from file: " + file);
                context = new FileSystemXmlApplicationContext(file, processors);
            }
            SpringJBIContainer container = (SpringJBIContainer) context.getBean("jbi");
            Object lock = new Object();
            container.setShutdownLock(lock);
View Full Code Here

  private void startServiceMix() throws MojoExecutionException {
        ClassLoader old = Thread.currentThread().getContextClassLoader();
    try {
            Thread.currentThread().setContextClassLoader(getClassLoader());
      context = new FileSystemXmlApplicationContext("file:///" + servicemixConfig
          .getAbsolutePath());
      container = (SpringJBIContainer) context.getBean("jbi");
    } catch (Exception e) {
      throw new MojoExecutionException(
          "Unable to start the ServiceMix container", e);
View Full Code Here

    public void testNioDatagramAcceptor() throws Exception {
        ClassLoader classLoader = this.getClass().getClassLoader();
        URL configURL = classLoader.getResource("org/apache/mina/integration/xbean/datagramAcceptor.xml");

        File configF = new File(configURL.toURI());
        ApplicationContext factory = new FileSystemXmlApplicationContext(configF.toURI().toURL().toString());

        // test default without any properties
        NioDatagramAcceptor acceptor0 = (NioDatagramAcceptor) factory.getBean("datagramAcceptor0");
        assertNotNull("acceptor0 should not be null", acceptor0);
        assertTrue(
                "Default constructor for NioDatagramAcceptor should have true value for closeOnDeactivation property",
                acceptor0.isCloseOnDeactivation());

        // test setting the port and IP for the acceptor
        NioDatagramAcceptor acceptor1 = (NioDatagramAcceptor) factory.getBean("datagramAcceptor1");
        assertNotNull("acceptor1 should not be null", acceptor1);
        assertEquals("192.168.0.1", acceptor1.getDefaultLocalAddress().getAddress().getHostAddress());
        assertEquals(110, acceptor1.getDefaultLocalAddress().getPort());

        // test creating with executor and some primitive properties
        NioDatagramAcceptor acceptor2 = (NioDatagramAcceptor) factory.getBean("datagramAcceptor2");
        assertNotNull(acceptor2);
        assertFalse(acceptor2.isCloseOnDeactivation());
        assertFalse("NioDatagramAcceptor should have false value for closeOnDeactivation property",
                acceptor2.isCloseOnDeactivation());

        // test creating with multiple addresses
        NioDatagramAcceptor acceptor3 = (NioDatagramAcceptor) factory.getBean("datagramAcceptor3");
        assertNotNull(acceptor3);
        assertEquals(3, acceptor3.getDefaultLocalAddresses().size());

        InetSocketAddress address1 = (InetSocketAddress) acceptor3.getDefaultLocalAddresses().get(0);
        assertEquals("192.168.0.1", address1.getAddress().getHostAddress());
View Full Code Here

        long startTime = System.currentTimeMillis();

        if ( args.length > 0 && new File( args[0] ).exists() ) // hack that takes server.xml file argument
        {
            LOG.info( "server: loading settings from ", args[0] );
            factory = new FileSystemXmlApplicationContext( new File( args[0] ).toURI().toURL().toString() );
            apacheDS = ( ApacheDS ) factory.getBean( "apacheDS" );
        }
        else
        {
            LOG.info( "server: using default settings ..." );
View Full Code Here

TOP

Related Classes of org.apache.xbean.spring.context.FileSystemXmlApplicationContext

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.