Package org.apache.jetspeed.components

Examples of org.apache.jetspeed.components.SpringComponentManager


        if ((baseDir == null) || (baseDir.length() == 0))
        {
            baseDir = System.getProperty("user.dir");
        }
        final String appRoot = baseDir+"/target/test-classes/webapp";
        scm = new SpringComponentManager(beanDefinitionFilter, bootConfigurations, configurations, appRoot, false);
        scm.start();

        // access page manager
        pageManager = (PageManager)scm.getComponent("pageManager");
       
View Full Code Here


        String[] appConfigs =  new String[] {assemblyDir+"/*"+assemblyFileExtension, assemblyDir+"/override/*"+assemblyFileExtension};
        ServletContext servletContext = servletConfig.getServletContext();
        JetspeedBeanDefinitionFilter filter = new JetspeedBeanDefinitionFilter("file:"+springFilterProperties.getAbsolutePath(), springFilterKey);
        Properties initProperties = new Properties();
        initProperties.put(JETSPEED_PROPERTIES_PATH_KEY, configuration.getString(JETSPEED_PROPERTIES_PATH_KEY));
        SpringComponentManager cm = new SpringComponentManager(filter, bootConfigs, appConfigs, servletContext, appRoot, initProperties);     
       
        return cm;       
    }
View Full Code Here

     * setup Spring context as part of test setup
     */
    protected void setUp() throws Exception
    {       
        super.setUp();
        scm = new SpringComponentManager(getBeanDefinitionFilter(), getBootConfigurations(), getConfigurations(), getBaseDir()+"target/test-classes/webapp", getInitProperties(), false);
        scm.start();
      new JetspeedActions(getSupportedPortletModes(), getSupportedWindowStates());
    }
View Full Code Here

        String[] appConfigs =
        { //"src/webapp/WEB-INF/assembly/layout-api.xml",
                "src/test/assembly/test-layout-api.xml"};
       
               
        cm = new SpringComponentManager(null, bootConfigs, appConfigs, servletContent, ".");
        cm.start();
        valve = (LayoutValve) cm.getComponent("layoutValve");
    }
View Full Code Here

                "src/test/assembly/test-layout-constraints-api.xml",
                "src/test/assembly/page-manager.xml",
                "src/test/assembly/cache-test.xml"};
       
               
        cm = new SpringComponentManager(null, bootConfigs, appConfigs, servletContent, getBaseDir());
        cm.start();
        valve = (LayoutValve) cm.getComponent("layoutValve");
        pageManager = (PageManager) cm.getComponent("pageManager");
    }
View Full Code Here

                "src/test/assembly/page-manager.xml",
                "src/test/assembly/jetspeed-restful-services.xml",
                "src/test/assembly/cache-test.xml"};
       
               
        cm = new SpringComponentManager(null, bootConfigs, appConfigs, servletContent, getBaseDir());
        cm.addComponent("javax.servlet.ServletConfig", servletConfig);
        cm.start();
        valve = (LayoutValve) cm.getComponent("layoutValve");
        pageManager = (PageManager) cm.getComponent("pageManager");
        assertNotNull(pageManager);
View Full Code Here

   
   
    public void importFiles(Logger logger, String applicationRootPath, String categories, String filterPropertiesFileName, Properties initProperties, String[] seedFiles) throws SerializerException
    {       
        ClassLoader contextClassLoader = Thread.currentThread().getContextClassLoader();
        SpringComponentManager scm = null;
        try
        {
            JetspeedBeanDefinitionFilter filter = null;
           
            if (filterPropertiesFileName != null)
            {
                filter = new JetspeedBeanDefinitionFilter("file:"+filterPropertiesFileName, categories);
            }
            else
            {
                filter = new JetspeedBeanDefinitionFilter(categories);
            }
           
            String assemblyRootPath = "file:"+applicationRootPath+"/WEB-INF/assembly";
            String[] bootConfig = {assemblyRootPath+"/boot/*.xml"};
            String[] appConfig = { assemblyRootPath+"/*.xml", assemblyRootPath+"/override/*.xml" };                      
           
            ClassLoader extendedClassLoader = contextClassLoader;
            File webInfClasses = new File(applicationRootPath, "WEB-INF/classes");
            if (webInfClasses.exists())
            {
                extendedClassLoader = new URLClassLoader(new URL[]{webInfClasses.toURL()}, contextClassLoader);
            }
            Thread.currentThread().setContextClassLoader(extendedClassLoader);
           
            scm = new SpringComponentManager(filter, bootConfig, appConfig, applicationRootPath, initProperties, true);
            scm.start();
            Configuration config = (Configuration)scm.getComponent("portal_configuration");
            if (config != null)
            {
              new JetspeedActions(config.getStringArray(PortalConfigurationConstants.SUPPORTED_PORTLET_MODES), config.getStringArray(PortalConfigurationConstants.SUPPORTED_WINDOW_STATES));
            }
            JetspeedSerializer serializer = (JetspeedSerializer)scm.getComponent(JetspeedSerializer.class.getName());
            HashMap settings = new HashMap();
            settings.put(JetspeedSerializer.KEY_LOGGER, logger);
            if (seedFiles != null)
            {
                for (int i = 0; i < seedFiles.length; i++)
                {
                    serializer.importData(seedFiles[i], settings);
                }
            }
        }
        catch (Exception e)
        {
            e.printStackTrace();
            logger.error(e.getMessage(),e);
            if (e instanceof SerializerException)
            {
                throw (SerializerException)e;
            }
            throw new SerializerException(SerializerException.IMPORT_ERROR.create(e.getMessage()));
        }
        finally
        {
            Thread.currentThread().setContextClassLoader(contextClassLoader);
            if (scm != null)
            {
                scm.stop();
            }
        }
    }
View Full Code Here

    }
   
    public void export(Logger logger, String applicationRootPath, String categories, String filterPropertiesFileName, Properties initProperties, String exportFile, String exportName) throws SerializerException
    {
        ClassLoader contextClassLoader = Thread.currentThread().getContextClassLoader();
        SpringComponentManager scm = null;
        try
        {
            JetspeedBeanDefinitionFilter filter = null;
           
            if (filterPropertiesFileName != null)
            {
                filter = new JetspeedBeanDefinitionFilter("file:"+filterPropertiesFileName, categories);
            }
            else
            {
                filter = new JetspeedBeanDefinitionFilter(categories);
            }
           
            String assemblyRootPath = "file:"+applicationRootPath+"/WEB-INF/assembly";
            String[] bootConfig = {assemblyRootPath+"/boot/*.xml"};
            String[] appConfig = { assemblyRootPath+"/*.xml", assemblyRootPath+"/override/*.xml" };
           
            ClassLoader extendedClassLoader = contextClassLoader;
            File webInfClasses = new File(applicationRootPath, "WEB-INF/classes");
            if (webInfClasses.exists())
            {
                extendedClassLoader = new URLClassLoader(new URL[]{webInfClasses.toURL()}, contextClassLoader);
            }
            Thread.currentThread().setContextClassLoader(extendedClassLoader);
           
            scm = new SpringComponentManager(filter, bootConfig, appConfig, applicationRootPath, true);
            scm.start();
            Configuration config = (Configuration)scm.getComponent("portal_configuration");
            if (config != null)
            {
              new JetspeedActions(config.getStringArray(PortalConfigurationConstants.SUPPORTED_PORTLET_MODES), config.getStringArray(PortalConfigurationConstants.SUPPORTED_WINDOW_STATES));
            }           
            JetspeedSerializer serializer = (JetspeedSerializer)scm.getComponent(JetspeedSerializer.class.getName());
            HashMap settings = new HashMap();
            settings.put(JetspeedSerializer.KEY_LOGGER, logger);
            if (exportFile != null)
            {
                if (exportName == null)
                {
                    exportName = JetspeedSerializer.DEFAULT_TAG_SNAPSHOT_NAME;
                }
                serializer.exportData(exportName, exportFile, settings);
            }
            scm.stop();
        }
        catch (Exception e)
        {
            if (e instanceof SerializerException)
            {
                throw (SerializerException)e;
            }
            logger.error(e.getMessage(),e);
            throw new SerializerException(SerializerException.EXPORT_ERROR.create(e.getMessage()));
        }
        finally
        {
            Thread.currentThread().setContextClassLoader(contextClassLoader);
            if (scm != null)
            {
                scm.stop();
            }
        }
    }
View Full Code Here

TOP

Related Classes of org.apache.jetspeed.components.SpringComponentManager

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.