portals-jetspeed-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tay...@apache.org
Subject cvs commit: jakarta-jetspeed/webapp/WEB-INF/conf/assembly jetspeed.groovy
Date Sat, 26 Jun 2004 01:38:49 GMT
taylor      2004/06/25 18:38:49

  Added:       webapp/WEB-INF/conf/assembly jetspeed.groovy
  Log:
  J2 component assembly script (this is broken right now, need to sync with Thursday's refactorings)
  
  CVS: ----------------------------------------------------------------------
  CVS: PR:
  CVS:   If this change addresses a PR in the problem report tracking
  CVS:   database, then enter the PR number(s) here.
  CVS: Obtained from:
  CVS:   If this change has been taken from another system, such as NCSA,
  CVS:   then name the system in this line, otherwise delete it.
  CVS: Submitted by:
  CVS:   If this code has been contributed to Apache by someone else; i.e.,
  CVS:   they sent us a patch or a new module, then include their name/email
  CVS:   address here. If this is your work then delete this line.
  CVS: Reviewed by:
  CVS:   If we are doing pre-commit code reviews and someone else has
  CVS:   reviewed your changes, include their name(s) here.
  CVS:   If you have not had it reviewed then delete this line.
  
  Revision  Changes    Path
  1.1                  jakarta-jetspeed/webapp/WEB-INF/conf/assembly/jetspeed.groovy
  
  Index: jetspeed.groovy
  ===================================================================
  /*
   * Copyright 2000-2001,2004 The Apache Software Foundation.
   * 
   * Licensed under the Apache License, Version 2.0 (the "License");
   * you may not use this file except in compliance with the License.
   * You may obtain a copy of the License at
   * 
   *      http://www.apache.org/licenses/LICENSE-2.0
   * 
   * Unless required by applicable law or agreed to in writing, software
   * distributed under the License is distributed on an "AS IS" BASIS,
   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   * See the License for the specific language governing permissions and
   * limitations under the License.
   */
  import org.picocontainer.defaults.DefaultPicoContainer
  import org.picocontainer.defaults.ConstantParameter
  import org.picocontainer.ComponentAdapter
  import org.picocontainer.defaults.ConstructorComponentAdapter
  import org.picocontainer.defaults.CachingComponentAdapter
  import org.picocontainer.Parameter
  import org.picocontainer.defaults.ComponentParameter
  import org.apache.jetspeed.components.adapters.InterceptorAdapter
  import org.apache.jetspeed.components.adapters.ThreadLocalDelegationStrategy
  import org.apache.jetspeed.components.ComponentAssemblyTestCase
  import org.apache.jetspeed.idgenerator.JetspeedIdGenerator
  import org.apache.jetspeed.Jetspeed
  import org.apache.jetspeed.components.persistence.store.PersistenceStoreContainer
  import org.apache.jetspeed.components.persistence.store.ojb.pb.PBStore
  import org.apache.jetspeed.components.util.system.FSSystemResourceUtilImpl
  import org.apache.jetspeed.container.window.PortletWindowAccessor
  import org.apache.jetspeed.container.window.impl.PortletWindowAccessorImpl
  import org.apache.jetspeed.components.portletentity.PortletEntityAccessComponent
  import org.apache.jetspeed.components.portletregistry.PortletRegistryComponent
  
  import org.apache.jetspeed.capabilities.Capabilities
  import org.apache.jetspeed.capabilities.impl.JetspeedCapabilities
  
  import org.apache.jetspeed.aggregator.PageAggregator
  import org.apache.jetspeed.aggregator.impl.PageAggregatorImpl
  import org.apache.jetspeed.aggregator.PortletAggregator
  import org.apache.jetspeed.aggregator.impl.PortletAggregatorImpl
  import org.apache.jetspeed.aggregator.PortletRenderer
  import org.apache.jetspeed.aggregator.impl.PortletRendererImpl
  import org.apache.jetspeed.request.RequestContextComponent
  import org.apache.jetspeed.request.JetspeedRequestContextComponent
  import org.apache.jetspeed.container.session.NavigationalStateComponent
  import org.apache.jetspeed.container.session.impl.JetspeedNavigationalStateComponent
  import org.apache.jetspeed.prefs.impl.PreferencesProviderImpl
  import org.apache.jetspeed.security.impl.SecurityProviderImpl
  
  // JNDI and Datasource Implementations
  import org.apache.jetspeed.components.jndi.JNDIComponent
  import org.apache.jetspeed.components.jndi.TyrexJNDIComponent
  import org.apache.jetspeed.components.datasource.DatasourceComponent
  import org.apache.jetspeed.components.datasource.BoundDBCPDatasourceComponent
  
  // Commons Pooling 
  import org.apache.commons.pool.impl.GenericObjectPool
  
  // Persistence Store
  import org.apache.jetspeed.components.persistence.store.ojb.pb.PBStore
  import org.apache.jetspeed.components.persistence.store.PersistenceStore
  
  // Portlet Registry and Entity
  import org.apache.jetspeed.components.portletregistry.PortletRegistryComponentImpl
  import org.apache.jetspeed.components.portletregistry.PortletRegistryComponent
  import org.apache.jetspeed.components.portletentity.PortletEntityAccessComponent
  import org.apache.jetspeed.components.portletentity.PortletEntityAccessComponentImpl
  
  // Preferences
  import org.apache.jetspeed.prefs.PropertyManager
  import org.apache.jetspeed.prefs.impl.PropertyManagerImpl
  import org.apache.jetspeed.prefs.PreferencesProvider
  import org.apache.jetspeed.prefs.impl.PreferencesProviderImpl
  import org.apache.jetspeed.om.preference.impl.PrefsPreference
  
  // Security
  import org.apache.jetspeed.security.SecurityProvider
  import org.apache.jetspeed.security.impl.SecurityProviderImpl
  import org.apache.jetspeed.security.impl.RdbmsPolicy
  import org.apache.jetspeed.security.UserManager
  import org.apache.jetspeed.security.impl.UserManagerImpl
  import org.apache.jetspeed.security.GroupManager
  import org.apache.jetspeed.security.impl.GroupManagerImpl
  import org.apache.jetspeed.security.RoleManager
  import org.apache.jetspeed.security.impl.RoleManagerImpl
  import org.apache.jetspeed.security.PermissionManager
  import org.apache.jetspeed.security.impl.PermissionManagerImpl
  
  //User Info
  import org.apache.jetspeed.security.UserManager
  import org.apache.jetspeed.userinfo.UserInfoManager
  import org.apache.jetspeed.userinfo.impl.UserInfoManagerImpl
  
  // Portlet Container
  import org.apache.pluto.PortletContainer
  import org.apache.pluto.PortletContainerImpl
  import org.apache.jetspeed.container.PortletContainerWrapper
  import org.apache.jetspeed.container.JetspeedPortletContainerWrapper
  
  import org.apache.jetspeed.services.PortletServices
  import org.apache.jetspeed.services.JetspeedPortletServices
  
  import org.apache.jetspeed.om.common.portlet.MutablePortletEntity
  import org.apache.jetspeed.om.common.portlet.PortletDefinitionComposite
  
         
  /* *********************************************************
   *  U T I L I T Y   C L O S U R E S                        *
   * *********************************************************/
   
   // This creates a single component instance per thread
   makeThreadLocalAdapter = 
  { 
    key, clazz, parameters | return new CachingComponentAdapter(
                    new InterceptorAdapter( 
                     new ConstructorComponentAdapter(key, clazz, parameters),
                     ThreadLocalDelegationStrategy
                     )
                   )
  }
  
  // Shorthand for creating a ConstantParameter
  cstParam = { key | return  new ConstantParameter(key) }
  
  // Shorthand for creating a ComponentParameter
  cmpParam = { key | return  new ComponentParameter(key) }
  
  // Closure to perform easy building of Parameter[]
  doParams = 
  {
      paramList |  paramArray = new Parameter[paramList.size()]
                         i = 0
                         for(param in paramList)
                        {
                           paramArray[i]   =  param                    
                           i++
                        }
                        return paramArray
  }
                     
   
   /* ******************************************************* */
  
  ClassLoader cl = Thread.currentThread().getContextClassLoader()
  
  
  applicationRoot = Jetspeed.getRealPath("/")
  
  //
  // Resource Location Utility
  //
  FSSystemResourceUtilImpl resourceUtil = new FSSystemResourceUtilImpl(applicationRoot)
  
  // create the root container
  container = new DefaultPicoContainer()
  
  
  /* **********************************************************
   *  ID Generator                                                                       
       *
   * ******************************************************** */
  Long counterStart = 65536
  peidPrefix = "P-"
  peidSuffix = ""
  idgenerator = new JetspeedIdGenerator(counterStart, peidPrefix, peidSuffix)
  container.registerComponentInstance("IdGenerator", idgenerator)
  
  
  /* **********************************************************
   *  JNDI and Pooled Datasource                                                        *
   * ******************************************************** */
   
  if(Boolean.getBoolean("portal.use.internal.jndi"))
  {
     container.registerComponentInstance(JNDIComponent, new TyrexJNDIComponent()) 
  
     url = System.getProperty("org.apache.jetspeed.database.url")  
     driver = System.getProperty("org.apache.jetspeed.database.driver")
     user = System.getProperty("org.apache.jetspeed.database.user")
     password = System.getProperty("org.apache.jetspeed.database.password")
  
     container.registerComponentInstance(DatasourceComponent, 
                new BoundDBCPDatasourceComponent(
                      user, 
                      password, 
                      driver, 
                      url, 
                      20, 
                      5000, 
                      GenericObjectPool.WHEN_EXHAUSTED_GROW, 
                      true, 
                      "jetspeed", 
                      container.getComponentInstance(JNDIComponent))
                 )
  }
  
  
  /* **********************************************************
   * Persistence Store: as a thread safe per thread component *
   * ******************************************************** */
  
  container.registerComponent(makeThreadLocalAdapter(PersistenceStore, PBStore,  new Parameter[]{new
ConstantParameter("jetspeed")}))
  
  
  /* **********************************************************
   *  Porlet Registry                                         *
   * ******************************************************** */
   container.registerComponentImplementation(
                              PortletRegistryComponent, 
                              PortletRegistryComponentImpl, 
                              doParams([cmpParam(PersistenceStore)])
  )
  
  /* **********************************************************
   *  Portlet Entity                                          *
   * ******************************************************** */
  container.registerComponentImplementation(
                             PortletEntityAccessComponent, 
                             PortletEntityAccessComponentImpl,
                             doParams([cmpParam(PersistenceStore), cmpParam(PortletRegistryComponent)])
  )
  /* **********************************************************
   *  Capabilities                                            *
   * ******************************************************** */
  container.registerComponentImplementation(
                        Capabilities, 
                        JetspeedCapabilities, 
                        doParams([cmpParam(PersistenceStore)])
  )
  
  /* *************************************************************
   *  Preferences  & Properites (java.util.prefs implemnetation) *
   * *************************************************************/
  container.registerComponentImplementation(
  	                      PropertyManager, 
  	                      PropertyManagerImpl, 
  	                      doParams([cmpParam(PersistenceStore)])
  )
  	
  openNodes = PrefsPreference.DEFAULT_OPEN_NODES
  container.registerComponentImplementation(
                         PreferencesProvider, 
                         PreferencesProviderImpl, 
                         doParams([cmpParam(PersistenceStore), 
                                          cstParam("org.apache.jetspeed.prefs.impl.PreferencesFactoryImpl"),
                                          cstParam(false)]
                                         )	
  )	
  
  
  /* **********************************************************
   *  Security                                                                           
          *
   * ******************************************************** */
  container.registerComponentImplementation(
                       UserManager, 
                       UserManagerImpl, 
                       doParams([cmpParam(PersistenceStore)])
  )
  
  container.registerComponentImplementation(
                      GroupManager, 
                      GroupManagerImpl, 
                      doParams([cmpParam(PersistenceStore)])
  )
  
  container.registerComponentImplementation(
                        RoleManager, 
                        RoleManagerImpl,
                        doParams([cmpParam(PersistenceStore)])
  )
  
  container.registerComponentImplementation(
                        PermissionManager, 
                        PermissionManagerImpl, 
                        doParams([cmpParam(PersistenceStore)])
  )
  
  container.registerComponentImplementation(
                        RdbmsPolicy, 
                        RdbmsPolicy, 
                        doParams([cmpParam(PermissionManager)])
  )
  
  container.registerComponentImplementation(
                        SecurityProvider, 
                        SecurityProviderImpl, 
                        doParams([cstParam("login.conf"), cmpParam(RdbmsPolicy), cmpParam(UserManager)])
  )
  
  
  // Instantiate the Preferences provider.
  container.getComponentInstanceOfType(PreferencesProviderImpl)
  
  // Instantiate the Security provider.
  container.getComponentInstanceOfType(SecurityProviderImpl)
  
  /* **********************************************************
   *  User Info                                                                          
          *
   * ******************************************************** */
  container.registerComponentImplementation(
                        UserInfoManager, 
                        UserInfoManagerImpl, 
                        doParams([cmpParam(UserManager), cmpParam(PortletRegistryComponent)])
  )
  
  /* **********************************************************
   *   Navigational State component                                                    *
   * ******************************************************** */
  // navigationKeys: prefix, action, mode, state, renderparam, pid, prev_mode, prev_state,
key_delim
  // navigationKeys = "_,ac,md,st,rp,pid,pm,ps,:"
  // navigationKeys = "_,a,m,s,r,i,pm,ps,:"
  
  container.registerComponentInstance("navigationKeys", "_,a,m,s,r,i,pm,ps,:")
  
  // navStateClass = "org.apache.jetspeed.container.session.impl.PathNavigationalState"
  // navStateClass = "org.apache.jetspeed.container.session.impl.SessionNavigationalState"
  
  container.registerComponentInstance("navStateClass", "org.apache.jetspeed.container.session.impl.SessionNavigationalState")
  
  // urlClass = "org.apache.jetspeed.container.url.impl.SessionPortalURL"
  // urlClass = "org.apache.jetspeed.container.url.impl.PathPortalURL"
  
  container.registerComponentInstance("urlClass", "org.apache.jetspeed.container.url.impl.SessionPortalURL")
  
  container.registerComponentImplementation(
                       NavigationalStateComponent, 
                       JetspeedNavigationalStateComponent,
                       doParams([cmpParam("navStateClass"), cmpParam("urlClass"), cmpParam("navigationKeys")])
  )
  
  /* **********************************************************
   *  Request Context component                                                        *
   * ******************************************************** */
  requestContextClass = "org.apache.jetspeed.request.JetspeedRequestContext"
  container.registerComponentImplementation(
                        RequestContextComponent, 
                        JetspeedRequestContextComponent, 
                        doParams([
                                         cmpParam(NavigationalStateComponent), 
                                         cstParam(requestContextClass), 
                                         cmpParam(UserInfoManager)
                                       ])
  )
  
  
  /* **********************************************************
   *  Portlet Window component                                                          *
   * ******************************************************** */
  container.registerComponentImplementation(
                        PortletWindowAccessor, 
                        PortletWindowAccessorImpl, 
                        doParams([cmpParam(PortletEntityAccessComponent), cmpParam(PortletRegistryComponent)])
  )
  
  /* **********************************************************
   *  Portlet Container                                                                  
      *
   * ******************************************************** */
  container.registerComponentInstance("Pluto", new PortletContainerImpl())
  
  container.registerComponentImplementation(
                        PortletContainer, 
                        JetspeedPortletContainerWrapper,
                        doParams([cmpParam("Pluto")])
  )
  
  /* **********************************************************
   *  Portlet Container                                                                  
      *
   * ******************************************************** */
  container.registerComponentImplementation(
                        PortletRenderer, 
                        PortletRendererImpl,
                        doParams([cmpParam(PortletContainer), cmpParam(PortletWindowAccessor)])
  )
  
  /* **********************************************************
   *  Aggregation                                                                        
       *
   * ******************************************************** */
  container.registerComponentImplementation(
                        PageAggregator, 
                        PageAggregatorImpl,
                        doParams([cmpParam(PortletRenderer), cstParam(PageAggregatorImpl.STRATEGY_SEQUENTIAL)])
  )
   
  container.registerComponentImplementation(
                        PortletAggregator, 
                        PortletAggregatorImpl,
                        doParams([cmpParam(PortletRenderer)])
  )
  
  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