Package org.apache.xbean.spring.context

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


public class SchemaUpdater
{
  public static void main(String[] args)
  {
    FileSystemXmlApplicationContext appContext = new FileSystemXmlApplicationContext(
        "database/spring/applicationContext.xml");
   
    LocalSessionFactoryBean sessionFactory = (LocalSessionFactoryBean) appContext
        .getBean("&sessionFactory", LocalSessionFactoryBean.class);
   
    sessionFactory.updateDatabaseSchema()
 
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

   *
   * @see org.apache.servicemix.common.packaging.ServiceUnitAnalyzer#init(java.io.File)
   */
  public void init(File explodedServiceUnitRoot) {
   
    FileSystemXmlApplicationContext context = new FileSystemXmlApplicationContext(
       "file:///" + explodedServiceUnitRoot.getAbsolutePath() + "/"
            + getXBeanFile());
               
    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

                        context = new ClassPathXmlApplicationContext("servicemix.xml", processors);
                    }
                    else {
                        file = args[1];
                        System.out.println("Loading Apache ServiceMix (compatible 1.x) from file: " + file);
                        context = new FileSystemXmlApplicationContext(file, processors);
                    }
                }
                else {
                    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

    {
        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

                }
               
                List processors = new ArrayList();
                processors.add(new ClassLoaderXmlPreprocessor(new File(".")));
                System.out.println("Loading Apache ServiceMix from file: " + file);
                context = new FileSystemXmlApplicationContext(new String[] {file}, false, processors);
            }
            context.setValidating(false);
            context.refresh();
           
            SpringJBIContainer container = (SpringJBIContainer) context.getBean("jbi");           
View Full Code Here

    {
        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

                }
               
                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");
            container.onShutDown(new Runnable() {
                public void run() {
                    if (context instanceof DisposableBean) {
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());
            context.getBean("jbi");
        } catch (Exception e) {
            throw new MojoExecutionException(
                    "Unable to start the ServiceMix container", e);
View Full Code Here

        long startTime = System.currentTimeMillis();

        if ( ( args != null ) && ( args.length > 0 ) && new File( args[0] ).exists() ) // hack that takes server.xml file argument
        {
            LOG.info( "server: loading settings from ", args[0] ); //$NON-NLS-1$
            factory = new FileSystemXmlApplicationContext( new File( args[0] ).toURI().toURL().toString() );
            ldapServer = ( LdapServer ) factory.getBean( "ldapServer" ); //$NON-NLS-1$
            apacheDS = ( ApacheDS ) factory.getBean( "apacheDS" ); //$NON-NLS-1$
        }
        else
        {
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.