Package org.apache.xbean.spring.context

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


        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] );
            factory = new FileSystemXmlApplicationContext( new File( args[0] ).toURI().toURL().toString() );
            ldapServer = ( LdapServer ) factory.getBean( "ldapServer" );
            apacheDS = ( ApacheDS ) factory.getBean( "apacheDS" );
        }
        else
        {
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 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 testSpringServerDefault() throws Exception {
        ClassLoader classLoader = this.getClass().getClassLoader();
        URL configURL = classLoader.getResource( "server.xml" );

        File configF = new File( configURL.toURI() );
        ApplicationContext factory = new FileSystemXmlApplicationContext( configF.toURI().toURL().toString() );
        ApacheDS apacheDS = ( ApacheDS ) factory.getBean( "apacheDS" );
        File workingDirFile = new File( configF.getParentFile(), "work" );
        apacheDS.getDirectoryService().setWorkingDirectory( workingDirFile );
    }
View Full Code Here

    public void testSpringServerAuthenticatorInAuthenticationInterceptor() throws Exception {
        ClassLoader classLoader = this.getClass().getClassLoader();
        URL configURL = classLoader.getResource( "serverAuthenticatorInAuthenticationInterceptor.xml" );

        File configF = new File( configURL.toURI() );
        ApplicationContext factory = new FileSystemXmlApplicationContext( configF.toURI().toURL().toString() );
        ApacheDS apacheDS = ( ApacheDS ) factory.getBean( "apacheDS" );
        File workingDirFile = new File( configF.getParentFile(), "work" );
        apacheDS.getDirectoryService().setWorkingDirectory( workingDirFile );
       
        List<Interceptor> interceptors = apacheDS.getDirectoryService().getInterceptors();
       
View Full Code Here

        {
            ClassLoader classLoader = this.getClass().getClassLoader();
            URL configURL = classLoader.getResource( "serverJdbmPartition.xml" );
   
            File configF = new File( configURL.toURI() );
            ApplicationContext factory = new FileSystemXmlApplicationContext( configF.toURI().toURL().toString() );
            ApacheDS apacheDS = ( ApacheDS ) factory.getBean( "apacheDS" );
            File workingDirFile = new File( configF.getParentFile(), "work" );
            apacheDS.getDirectoryService().setWorkingDirectory( workingDirFile );
           
            // Now, launch the server, and check that the ObjectClass index has been created in OS' tmp directory
            apacheDS.startup();
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

    user.setEmail(args[2]);
    user.setRootAdmin(true);
   
    try
    {
      FileSystemXmlApplicationContext appContext = new FileSystemXmlApplicationContext(
          "database/spring/applicationContext.xml");

      UserProvider userProvider = (UserProvider) appContext.getBean("userProvider", UserProvider.class);
      userProvider.insertUser(user);     
    }
    catch (Exception e)
    {
      e.printStackTrace();
View Full Code Here

public class SchemaExporter
{
  public static void main(String[] args)
  {
    FileSystemXmlApplicationContext appContext = new FileSystemXmlApplicationContext(
      "database/spring/applicationContext.xml");

    LocalSessionFactoryBean sessionFactory = (LocalSessionFactoryBean) appContext
      .getBean("&sessionFactory", LocalSessionFactoryBean.class);

    sessionFactory.createDatabaseSchema();
 
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.