portals-jetspeed-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From wea...@apache.org
Subject cvs commit: jakarta-jetspeed-2/components/rdbms/src/test/org/apache/jetspeed/containers rdbms.container.groovy
Date Mon, 23 Feb 2004 16:43:00 GMT
weaver      2004/02/23 08:43:00

  Modified:    components/persistence/src/test/org/apache/jetspeed/components/persistence
                        TestPersistenceContainer.java
  Added:       components/rdbms/src/java/org/apache/jetspeed/containers
                        rdbms.container.groovy
               components/registry/src/java/org/apache/jetspeed/containers
                        resgistry.container.groovy
               components/persistence/src/java/org/apache/jetspeed/containers
                        persistence.container.groovy
  Removed:     components/persistence/src/test/org/apache/jetspeed/containers
                        persistence.container.groovy
               components/rdbms/src/test/org/apache/jetspeed/containers
                        rdbms.container.groovy
  Log:
  moved container definitions out test and into each components source
  tree so that we can easily build default containers by looking up
  the container script in the cp 
  example: org/apache/jetspeed/containers/mycontainer.groovy
  
  This makes building testcases that are dependent on other components
  easy by just looking up the correct script and passing into a ComponentMAnager
  or NanoContainer
  
  Revision  Changes    Path
  1.1                  jakarta-jetspeed-2/components/rdbms/src/java/org/apache/jetspeed/containers/rdbms.container.groovy
  
  Index: rdbms.container.groovy
  ===================================================================
  import org.picocontainer.defaults.DefaultPicoContainer
  import org.apache.commons.configuration.PropertiesConfiguration
  import org.apache.jetspeed.components.hsql.HSQLServerComponent
  import org.apache.jetspeed.components.jndi.JNDIComponent
  import org.apache.jetspeed.components.jndi.TyrexJNDIComponent
  import org.apache.jetspeed.components.datasource.DBCPDatasourceComponent
  import org.apache.jetspeed.components.datasource.DatasourceComponent
  import org.hsqldb.jdbcDriver
  import org.apache.commons.pool.impl.GenericObjectPool
  import org.picocontainer.Parameter
  import org.picocontainer.defaults.ConstantParameter
  import org.picocontainer.ComponentAdapter
  import org.picocontainer.defaults.ConstructorComponentAdapter
  
  // WARNING!!!!!!
  // DO NOT use {Class}.class as it appears to be broken in Groovy
  // You end getting a Class instance of the type java.lang.Class
  // instead of the requested type!  This causes AssignabilityExceptions
  // in pico.
  
  
  
  container = new DefaultPicoContainer()
  
  // This is the HSQL engine that holds the test registry
  container.registerComponentInstance(new HSQLServerComponent(9001, "sa","","../../portal/test/db/hsql/Registry",false,
true))
  
  // This JNDI component helps us publish the datasource
  Class jndiClass = Class.forName("org.apache.jetspeed.components.jndi.JNDIComponent")
  Class tyrexJndiClass = Class.forName("org.apache.jetspeed.components.jndi.TyrexJNDIComponent")
  container.registerComponentImplementation(jndiClass, tyrexJndiClass)
  
  // Create a datasource based on the HSQL server we just created
  Class dsClass = Class.forName("org.apache.jetspeed.components.datasource.DatasourceComponent")
  container.registerComponentInstance(dsClass, new DBCPDatasourceComponent("sa","", "org.hsqldb.jdbcDriver",
"jdbc:hsqldb:hsql://127.0.0.1", 5, 5000, GenericObjectPool.WHEN_EXHAUSTED_GROW, true))
  
  
  
  return container
  
  
  1.1                  jakarta-jetspeed-2/components/registry/src/java/org/apache/jetspeed/containers/resgistry.container.groovy
  
  Index: resgistry.container.groovy
  ===================================================================
  import org.picocontainer.defaults.DefaultPicoContainer
  import org.picocontainer.defaults.ConstantParameter
  import org.picocontainer.ComponentAdapter
  import org.picocontainer.defaults.ConstructorComponentAdapter
  import org.picocontainer.Parameter
  import org.picocontainer.defaults.ConstantParameter
  import org.picocontainer.defaults.ComponentParameter
  import org.hsqldb.jdbcDriver
  
  import org.apache.jetspeed.components.hsql.HSQLServerComponent
  import org.apache.jetspeed.components.hsql.HSQLServerComponent
  import org.apache.jetspeed.components.jndi.JNDIComponent
  import org.apache.jetspeed.components.jndi.TyrexJNDIComponent
  import org.apache.jetspeed.components.datasource.DBCPDatasourceComponent
  import org.apache.jetspeed.components.datasource.DatasourceComponent
  import org.apache.commons.pool.impl.GenericObjectPool
  import org.apache.jetspeed.components.persistence.store.ojb.OJBTypeIntializer
  import org.apache.jetspeed.components.persistence.store.ojb.otm.OTMStoreImpl
  import org.apache.jetspeed.components.persistence.store.impl.DefaultPersistenceStoreContainer
  import org.apache.jetspeed.components.persistence.store.PersistenceStoreContainer
  import org.apache.jetspeed.components.util.system.FSSystemResourceUtilImpl
  
  import org.apache.jetspeed.components.portletregsitry.PortletRegistryComponentImpl
  import org.apache.jetspeed.components.portletregsitry.PortletRegistryComponent
  
  
  // WARNING!!!!!!
  // DO NOT use {Class}.class as it appears to be broken in Groovy
  // You end getting a Class instance of the type java.lang.Class
  // instead of the requested type!  This causes AssignabilityExceptions
  // in pico.  You need to use Class.forName() instead.
  
  
  
  applicationRoot = Jetspeed.getRealPath("/")
  
  //
  // Resource Location Utility
  //
  FSSystemResourceUtilImpl resourceUtil = new FSSystemResourceUtilImpl(applicationRoot)
  
  // create the root container
  container = new DefaultPicoContainer()
  
  //
  // Template Locator component assembly
  //
  roots = [ applicationRoot + "/WEB-INF/templates" ]
  container.registerComponentInstance("TemplateLocator", new JetspeedTemplateLocator(roots))
  
  //
  // ID Generator
  //
  Long counterStart = 65536
  peidPrefix = "P-"
  peidSuffix = ""
  container.registerComponentInstance("IdGenerator", new JetspeedIdGenerator(counterStart,
peidPrefix, peidSuffix))
  
  //
  // Page Manager
  //
  root = applicationRoot + "/WEB-INF/pages"
  // TODO: move this into a class loader resource
  mapping = applicationRoot + "/WEB-INF/conf/page-mapping.xml"
  // TODO: modelclasses, extension, scanrate, cachesize
  container.registerComponentInstance("CastorXmlPageManager", 
                                       new CastorXmlPageManager(idgenerator, mapping, root))
  
  //
  // HSQL Server 
  //                
  
  container.registerComponentInstance(new HSQLServerComponent(9001, "sa","",applicationRoot+"WEB-INF/db/hsql/Registry",false,
true))                     
  
  
  // This JNDI component helps us publish the datasource
  Class jndiClass = Class.forName("org.apache.jetspeed.components.jndi.JNDIComponent")
  Class tyrexJndiClass = Class.forName("org.apache.jetspeed.components.jndi.TyrexJNDIComponent")
  container.registerComponentImplementation(jndiClass, tyrexJndiClass)
  
  // Create a datasource based on the HSQL server we just created
  Class dsClass = Class.forName("org.apache.jetspeed.components.datasource.DatasourceComponent")
  container.registerComponentInstance(dsClass, new DBCPDatasourceComponent("sa","", "org.hsqldb.jdbcDriver",
"jdbc:hsqldb:hsql://127.0.0.1", 5, 5000, GenericObjectPool.WHEN_EXHAUSTED_GROW, true))
  
  
  //
  // Persistence component
  //
  
  PersistenceContainer pContainer = new DefaultPersistenceStoreContainer(15000, 10000)
  
  OJBTypeIntializer ojbBootstrap = new OJBTypeIntializer(resourceUtil, "WEB-INF/conf/ojb",
"OJB.properties", null)
  
  pContainer.registerComponentInstance(ojbBootstrap)
  
  Class OTMStoreClass = Class.forName("org.apache.jetspeed.components.persistence.store.ojb.otm.OTMStoreImpl")
  ComponentAdapter ca = new ConstructorComponentAdapter("jetspeed", OTMStoreClass, new Parameter[]
{new ConstantParameter("jetspeed")})
  
  pContainer.registerComponent(ca)
  
  Class pContainerClass = Class.forName("org.apache.jetspeed.components.persistence.store.PersistenceStoreContainer")
  
  container.registerComponentInstance(pContainerClass, pContainer);
  
  //
  // Portlet Registry
  //
  
  Class registryClass = Class.forName("org.apache.jetspeed.components.portletregsitry.PortletRegistryComponent")
  Class registryImplClass = Class.forName("org.apache.jetspeed.components.portletregsitry.PortletRegistryComponentImpl")
  // Parameter[] regParams = new Parameter[] {new ComponentParameter(pContainerClass), new
ConstantParameter("jetspeed")}
  container.registerComponentImplementation(registryClass, registryImplClass, new Parameter[]
{new ComponentParameter(pContainerClass), new ConstantParameter("jetspeed")} );
  
  return container
  
  
  
  1.2       +213 -160  jakarta-jetspeed-2/components/persistence/src/test/org/apache/jetspeed/components/persistence/TestPersistenceContainer.java
  
  Index: TestPersistenceContainer.java
  ===================================================================
  RCS file: /home/cvs/jakarta-jetspeed-2/components/persistence/src/test/org/apache/jetspeed/components/persistence/TestPersistenceContainer.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- TestPersistenceContainer.java	22 Feb 2004 22:40:02 -0000	1.1
  +++ TestPersistenceContainer.java	23 Feb 2004 16:43:00 -0000	1.2
  @@ -52,20 +52,30 @@
    * <http://www.apache.org/>.
    */
   package org.apache.jetspeed.components.persistence;
  +import java.io.InputStreamReader;
  +import java.io.Reader;
  +
  +import junit.framework.Test;
  +import junit.framework.TestSuite;
   
   import org.apache.jetspeed.components.AbstractComponentAwareTestCase;
  +import org.apache.jetspeed.components.ComponentManager;
   
   /**
    * <p>
    * TestPersistenceContainer
  - * </p>
  - *  @
  + * </p>@
  + * 
    * @author <a href="mailto:weaver@apache.org">Scott T. Weaver </a>
    * @version $ $
    *  
    */
   public class TestPersistenceContainer extends AbstractComponentAwareTestCase
   {
  +    private ComponentManager persistenceCm;
  +    private ComponentManager rdbmsCm;
  +
  +
       /**
        * @param arg0
        */
  @@ -74,165 +84,184 @@
           super(arg0);
           // TODO Auto-generated constructor stub
       }
  +    public static Test suite()
  +    {
  +        // All methods starting with "test" will be executed in the test suite.
  +        return new TestSuite(TestPersistenceContainer.class);
  +    }
       
  -    
  -    
  -//    private static final String TEST_APP_1 = "test adding object";
  -//    private PersistenceStoreContainer pContainer;
  -//    private ComponentManager cm;
  -//    public static Test suite()
  -//    {
  -//        // All methods starting with "test" will be executed in the test suite.
  -//        return new DatasourceEnabledTestSuite(TestPersistenceContainer.class);
  -//    }
  -//
  -//    /**
  -//     * @param testName
  -//     */
  -//    public TestPersistenceContainer(String testName)
  -//    {
  -//        super(testName);
  -//    }
  -//    public void testStartContainer() throws Exception
  -//    {
  -//        PersistenceStoreContainer pContainer = null;
  -//        try
  -//        {
  -//            pContainer = getInstance();
  -//            PersistenceStore store = pContainer.getStoreForThread("jetspeed");
  -//            assertNotNull(store);
  -//        }
  -//        catch (RuntimeException e)
  -//        {
  -//            e.printStackTrace();
  -//            throw e;
  -//        }
  -//        finally
  -//        {
  -//            cm.killContainer();
  -//        }
  -//    }
  -//    public void testBasicPersistence() throws Exception
  -//    {
  -//        PersistenceStoreContainer pContainer = getInstance();
  -//        PersistenceStore store = pContainer.getStoreForThread("jetspeed");
  -//        assertNotNull(store);
  -//        initTestObject(store);
  -//        store.getTransaction().begin();
  -//        assertNotNull(getTestObject1(store));
  -//        store.getTransaction().commit();
  -//    }
  -//    protected PersistenceStoreContainer getInstance() throws Exception
  -//    {
  -//        if (this.pContainer == null)
  -//        {
  -//            pContainer = (PersistenceStoreContainer) cm.getRootContainer();
  -//        }
  -//        return pContainer;
  -//    }
  -//    protected void initTestObject(PersistenceStore store) throws Exception
  -//    {
  -//        try
  -//        {
  -//            store.getTransaction().begin();
  -//            MutablePortletApplication app = new PortletApplicationDefinitionImpl();
  -//            store.makePersistent(app);
  -//            app.setName(TEST_APP_1);
  -//            app.setVersion("1.0");
  -//            app.setDescription("This is a test from persistence layer");
  -//            // create a web application
  -//            MutableWebApplication wad = new WebApplicationDefinitionImpl();
  -//            wad.addDescription(getEnglishLanguage().getLocale(), "This is an english
desrcitpion");
  -//            wad.addDisplayName(getEnglishLanguage().getLocale(), "This is an english
display name");
  -//            wad.setContextRoot("/test");
  -//            app.setWebApplicationDefinition(wad);
  -//
  -//            // Create some Portlets
  -//            PortletDefinitionComposite pdc = new PortletDefinitionImpl();
  -//            pdc.setClassName("com.bogus.Class1");
  -//            pdc.setName("Portlet 1");
  -//            PortletDefinitionComposite pdc2 = new PortletDefinitionImpl();
  -//            pdc2.setClassName("com.bogus.Class2");
  -//            pdc2.setName("Portlet 2");
  -//            app.addPortletDefinition(pdc);
  -//            app.addPortletDefinition(pdc2);
  -//            store.getTransaction().commit();
  -//        }
  -//        catch (Exception e)
  -//        {
  -//            store.getTransaction().rollback();
  -//            store.close();
  -//            throw e;
  -//        }
  -//    }
  -//    protected Language getEnglishLanguage()
  -//    {
  -//        MutableLanguage lang = new LanguageImpl();
  -//        lang.setTitle("Portlet Title");
  -//        lang.setShortTitle("Portlet Short Title");
  -//        lang.setLocale(Locale.ENGLISH);
  -//        return lang;
  -//    }
  -//    protected void destroyTestObject(PersistenceStore store) throws Exception
  -//    {
  -//        try
  -//        {
  -//            store.getTransaction().begin();
  -//            Filter c = store.newFilter();
  -//            c.addEqualTo("name", TEST_APP_1);
  -//            Object query = store.newQuery(PortletApplicationDefinitionImpl.class, c);
  -//            Collection removeUs = store.getCollectionByQuery(query);
  -//            Iterator itr = removeUs.iterator();
  -//            while (itr.hasNext())
  -//            {
  -//                store.deletePersistent(itr.next());
  -//            }
  -//            store.getTransaction().commit();
  -//        }
  -//        catch (Exception e)
  -//        {
  -//            store.getTransaction().rollback();
  -//            throw e;
  -//        }
  -//    }
  -//    protected PortletApplicationDefinitionImpl getTestObject1(PersistenceStore store)
  -//    {
  -//        Filter c = store.newFilter();
  -//        c.addEqualTo("name", TEST_APP_1);
  -//        Object obj = store.getObjectByQuery(store.newQuery(PortletApplicationDefinitionImpl.class,
c));
  -//        return (PortletApplicationDefinitionImpl) obj;
  -//    }
  -//
  -//    /**
  -//     * @see junit.framework.TestCase#setUp()
  -//     */
  -//    protected void setUp() throws Exception
  -//    {
  -//        super.setUp();
  -//        Map oms = new HashMap();
  -//        oms.put("pluto.om", "../../portal/src/webapp/WEB-INF/conf/pluto.om");
  -//        if (!OMHelper.isInitialized())
  -//        {
  -//            OMHelper helper = new OMHelper(oms);
  -//            helper.start();
  -//        }
  -//        
  -//        Reader composition = new InputStreamReader(Thread.currentThread().getContextClassLoader()
  -//        .getResourceAsStream(
  -//        "org/apache/jetspeed/containers/persistence.container.groovy"));
  -//        cm = new ComponentManager(composition, ComponentManager.GROOVY);
  -//        cm.getRootContainer();
  -//        destroyTestObject(getInstance().getStore("jetspeed"));
  -//    }
  -//
  -//    /**
  -//     * @see junit.framework.TestCase#tearDown()
  -//     */
  -//    protected void tearDown() throws Exception
  -//    {
  -//        destroyTestObject(getInstance().getStore("jetspeed"));
  -//        super.tearDown();
  -//    }
  +    public void testStartContainer()
  +    {
  +        assertNotNull(rdbmsCm);
  +        assertNotNull(persistenceCm);
  +    }
  +
  +
  +
  +    //    private static final String TEST_APP_1 = "test adding object";
  +    //    private PersistenceStoreContainer pContainer;
  +    //    private ComponentManager cm;
  +    //    public static Test suite()
  +    //    {
  +    //        // All methods starting with "test" will be executed in the test suite.
  +    //        return new DatasourceEnabledTestSuite(TestPersistenceContainer.class);
  +    //    }
  +    //
  +    //    /**
  +    //     * @param testName
  +    //     */
  +    //    public TestPersistenceContainer(String testName)
  +    //    {
  +    //        super(testName);
  +    //    }
  +    //    public void testStartContainer() throws Exception
  +    //    {
  +    //        PersistenceStoreContainer pContainer = null;
  +    //        try
  +    //        {
  +    //            pContainer = getInstance();
  +    //            PersistenceStore store = pContainer.getStoreForThread("jetspeed");
  +    //            assertNotNull(store);
  +    //        }
  +    //        catch (RuntimeException e)
  +    //        {
  +    //            e.printStackTrace();
  +    //            throw e;
  +    //        }
  +    //        finally
  +    //        {
  +    //            cm.killContainer();
  +    //        }
  +    //    }
  +    //    public void testBasicPersistence() throws Exception
  +    //    {
  +    //        PersistenceStoreContainer pContainer = getInstance();
  +    //        PersistenceStore store = pContainer.getStoreForThread("jetspeed");
  +    //        assertNotNull(store);
  +    //        initTestObject(store);
  +    //        store.getTransaction().begin();
  +    //        assertNotNull(getTestObject1(store));
  +    //        store.getTransaction().commit();
  +    //    }
  +    //    protected PersistenceStoreContainer getInstance() throws Exception
  +    //    {
  +    //        if (this.pContainer == null)
  +    //        {
  +    //            pContainer = (PersistenceStoreContainer) cm.getRootContainer();
  +    //        }
  +    //        return pContainer;
  +    //    }
  +    //    protected void initTestObject(PersistenceStore store) throws Exception
  +    //    {
  +    //        try
  +    //        {
  +    //            store.getTransaction().begin();
  +    //            MutablePortletApplication app = new PortletApplicationDefinitionImpl();
  +    //            store.makePersistent(app);
  +    //            app.setName(TEST_APP_1);
  +    //            app.setVersion("1.0");
  +    //            app.setDescription("This is a test from persistence layer");
  +    //            // create a web application
  +    //            MutableWebApplication wad = new WebApplicationDefinitionImpl();
  +    //            wad.addDescription(getEnglishLanguage().getLocale(), "This is an english
  +    // desrcitpion");
  +    //            wad.addDisplayName(getEnglishLanguage().getLocale(), "This is an english
  +    // display name");
  +    //            wad.setContextRoot("/test");
  +    //            app.setWebApplicationDefinition(wad);
  +    //
  +    //            // Create some Portlets
  +    //            PortletDefinitionComposite pdc = new PortletDefinitionImpl();
  +    //            pdc.setClassName("com.bogus.Class1");
  +    //            pdc.setName("Portlet 1");
  +    //            PortletDefinitionComposite pdc2 = new PortletDefinitionImpl();
  +    //            pdc2.setClassName("com.bogus.Class2");
  +    //            pdc2.setName("Portlet 2");
  +    //            app.addPortletDefinition(pdc);
  +    //            app.addPortletDefinition(pdc2);
  +    //            store.getTransaction().commit();
  +    //        }
  +    //        catch (Exception e)
  +    //        {
  +    //            store.getTransaction().rollback();
  +    //            store.close();
  +    //            throw e;
  +    //        }
  +    //    }
  +    //    protected Language getEnglishLanguage()
  +    //    {
  +    //        MutableLanguage lang = new LanguageImpl();
  +    //        lang.setTitle("Portlet Title");
  +    //        lang.setShortTitle("Portlet Short Title");
  +    //        lang.setLocale(Locale.ENGLISH);
  +    //        return lang;
  +    //    }
  +    //    protected void destroyTestObject(PersistenceStore store) throws
  +    // Exception
  +    //    {
  +    //        try
  +    //        {
  +    //            store.getTransaction().begin();
  +    //            Filter c = store.newFilter();
  +    //            c.addEqualTo("name", TEST_APP_1);
  +    //            Object query = store.newQuery(PortletApplicationDefinitionImpl.class,
  +    // c);
  +    //            Collection removeUs = store.getCollectionByQuery(query);
  +    //            Iterator itr = removeUs.iterator();
  +    //            while (itr.hasNext())
  +    //            {
  +    //                store.deletePersistent(itr.next());
  +    //            }
  +    //            store.getTransaction().commit();
  +    //        }
  +    //        catch (Exception e)
  +    //        {
  +    //            store.getTransaction().rollback();
  +    //            throw e;
  +    //        }
  +    //    }
  +    //    protected PortletApplicationDefinitionImpl
  +    // getTestObject1(PersistenceStore store)
  +    //    {
  +    //        Filter c = store.newFilter();
  +    //        c.addEqualTo("name", TEST_APP_1);
  +    //        Object obj =
  +    // store.getObjectByQuery(store.newQuery(PortletApplicationDefinitionImpl.class,
  +    // c));
  +    //        return (PortletApplicationDefinitionImpl) obj;
  +    //    }
  +    //
  +    //    /**
  +    //     * @see junit.framework.TestCase#setUp()
  +    //     */
  +    //    protected void setUp() throws Exception
  +    //    {
  +    //        super.setUp();
  +    //        Map oms = new HashMap();
  +    //        oms.put("pluto.om", "../../portal/src/webapp/WEB-INF/conf/pluto.om");
  +    //        if (!OMHelper.isInitialized())
  +    //        {
  +    //            OMHelper helper = new OMHelper(oms);
  +    //            helper.start();
  +    //        }
  +    //        
  +    //        Reader composition = new
  +    // InputStreamReader(Thread.currentThread().getContextClassLoader()
  +    //        .getResourceAsStream(
  +    //        "org/apache/jetspeed/containers/persistence.container.groovy"));
  +    //        cm = new ComponentManager(composition, ComponentManager.GROOVY);
  +    //        cm.getRootContainer();
  +    //        destroyTestObject(getInstance().getStore("jetspeed"));
  +    //    }
  +    //
  +    //    /**
  +    //     * @see junit.framework.TestCase#tearDown()
  +    //     */
  +    //    protected void tearDown() throws Exception
  +    //    {
  +    //        destroyTestObject(getInstance().getStore("jetspeed"));
  +    //        super.tearDown();
  +    //    }
   
       //	public void testAdd2atATime() throws TransactionStateException
       //	{
  @@ -535,5 +564,29 @@
   
   
   
  +
  +    /* (non-Javadoc)
  +     * @see junit.framework.TestCase#setUp()
  +     */
  +    protected void setUp() throws Exception
  +    {
  +        super.setUp();
  +        ClassLoader cl = Thread.currentThread().getContextClassLoader();
  +        Reader rdbmsScript = new InputStreamReader(cl.getResourceAsStream("org/apache/jetspeed/containers/rdbms.container.groovy"));
  +        Reader persistenceScript = new InputStreamReader(cl.getResourceAsStream("org/apache/jetspeed/containers/persistence.container.groovy"));
  +        rdbmsCm = new ComponentManager(rdbmsScript, ComponentManager.GROOVY);
  +        persistenceCm = new ComponentManager(persistenceScript, ComponentManager.GROOVY);
  +        rdbmsCm.getRootContainer();
  +        persistenceCm.getRootContainer();
  +    }
  +
  +   
  +    protected void tearDown() throws Exception
  +    {
  +
  +        super.tearDown();
  +        rdbmsCm.killContainer();
  +        persistenceCm.killContainer();
  +    }
   
   }
  
  
  
  1.1                  jakarta-jetspeed-2/components/persistence/src/java/org/apache/jetspeed/containers/persistence.container.groovy
  
  Index: persistence.container.groovy
  ===================================================================
  import org.picocontainer.defaults.DefaultPicoContainer
  import org.picocontainer.Parameter
  import org.picocontainer.defaults.ConstantParameter
  import org.apache.jetspeed.components.persistence.store.ojb.OJBTypeIntializer
  import org.apache.jetspeed.components.persistence.store.ojb.otm.OTMStoreImpl
  import org.apache.jetspeed.components.persistence.store.impl.DefaultPersistenceStoreContainer
  import org.apache.jetspeed.components.persistence.store.PersistenceStoreContainer
  import org.apache.jetspeed.components.util.system.FSSystemResourceUtilImpl
  import org.picocontainer.ComponentAdapter
  import org.picocontainer.defaults.ConstructorComponentAdapter
  
  
  container = new DefaultPersistenceStoreContainer(15000, 10000)
  
  FSSystemResourceUtilImpl resourceUtil = new FSSystemResourceUtilImpl("../../portal/src/webapp")
  
  OJBTypeIntializer ojbBootstrap = new OJBTypeIntializer(resourceUtil, "WEB-INF/conf/ojb",
"OJB.properties", null)
  
  container.registerComponentInstance(ojbBootstrap)
  
  // Parameter[] storeParams = new Parameter[] {new ConstantParameter("jetspeed")}
  
  
  Class OTMStoreClass = Class.forName("org.apache.jetspeed.components.persistence.store.ojb.otm.OTMStoreImpl")
  ComponentAdapter ca = new ConstructorComponentAdapter("jetspeed", OTMStoreClass, new Parameter[]
{new ConstantParameter("jetspeed")})
  
  container.registerComponent(ca)
  
  
  return container
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: jetspeed-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: jetspeed-dev-help@jakarta.apache.org


Mime
View raw message