Examples of FileSystemXmlApplicationContext


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

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

   * (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

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

                }
               
                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

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

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

    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

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

    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

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

        {
            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

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] ); //$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

Examples of org.springframework.context.support.FileSystemXmlApplicationContext

public class PropertyPlaceholderTest extends TestCase {

    public void test() throws Throwable {
        System.setProperty("port2", "3333");
       
        FileSystemXmlApplicationContext ctx = new FileSystemXmlApplicationContext(
                "src/test/resources/spring-config/config-property-placeholder.xml");

        DefaultFtpServer server = (DefaultFtpServer) ctx.getBean("server");

        assertEquals(2222, server.getListener("listener0").getPort());
        assertEquals(3333, server.getListener("listener1").getPort());
    }
View Full Code Here

Examples of org.springframework.context.support.FileSystemXmlApplicationContext

   // FileSystemXmlApplicationContext appCtx =
     //   new FileSystemXmlApplicationContext("file:" + springFile.getAbsolutePath());
    //return (Collection<FacetHandler<?>>) appCtx.getBean("handlers");
   
    Set<Entry<Class<?>,Object>> entries = workArea.map.entrySet();
      FileSystemXmlApplicationContext appCtx = new FileSystemXmlApplicationContext();
      for (Entry<Class<?>,Object> entry : entries){
      Object obj = entry.getValue();
      if (obj instanceof ClassLoader){
        appCtx.setClassLoader((ClassLoader)obj);
          break;
      }
    }
   
      String absolutePath = file.getAbsolutePath();
      String partOne = absolutePath.substring(0, absolutePath.lastIndexOf("/"));
      String partTwo = URLEncoder.encode(absolutePath.substring(absolutePath.lastIndexOf("/") + 1), "UTF-8");
      absolutePath = partOne + "/" + partTwo;
     
      File springFile = new File(new File(absolutePath), SPRING_CONFIG);
      appCtx.setConfigLocation("file:" + springFile.getAbsolutePath());
      appCtx.refresh();
     
      return (Collection<FacetHandler<?>>) appCtx.getBean("handlers");

  }
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.