cocoon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cziege...@apache.org
Subject svn commit: r605714 - in /cocoon/trunk/blocks/cocoon-portal: cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/impl/ cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/spring/ cocoon-portal-impl/src/main/resources/org/apache/cocoon/porta...
Date Wed, 19 Dec 2007 21:44:15 GMT
Author: cziegeler
Date: Wed Dec 19 13:44:14 2007
New Revision: 605714

URL: http://svn.apache.org/viewvc?rev=605714&view=rev
Log:
Migrate portal service from avalon to spring
Separate Spring related code into own package
Fix spring portal schema
Correct configuration

Added:
    cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/spring/SpringPortalService.java
  (with props)
Modified:
    cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/impl/PortalServiceImpl.java
    cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/resources/org/apache/cocoon/portal/cocoon-portal-components.xml
    cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/resources/org/apache/cocoon/portal/portal.roles
    cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/resources/org/apache/cocoon/portal/spring/schema/cocoon-portal-1.0.xsd
    cocoon/trunk/blocks/cocoon-portal/cocoon-portal-sample/src/main/resources/COB-INF/config/avalon/cocoon-portal-sample.xconf
    cocoon/trunk/blocks/cocoon-portal/cocoon-portal-sample/src/main/resources/COB-INF/config/spring/cocoon-portal-sample-components.xml
    cocoon/trunk/blocks/cocoon-portal/cocoon-portal-sample/src/main/resources/COB-INF/config/spring/coplet-types.xml
    cocoon/trunk/blocks/cocoon-portal/cocoon-portal-sample/src/main/resources/COB-INF/config/spring/layout-types.xml

Modified: cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/impl/PortalServiceImpl.java
URL: http://svn.apache.org/viewvc/cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/impl/PortalServiceImpl.java?rev=605714&r1=605713&r2=605714&view=diff
==============================================================================
--- cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/impl/PortalServiceImpl.java
(original)
+++ cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/impl/PortalServiceImpl.java
Wed Dec 19 13:44:14 2007
@@ -16,29 +16,17 @@
  */
 package org.apache.cocoon.portal.impl;
 
-import java.io.IOException;
 import java.util.ArrayList;
 import java.util.Collections;
-import java.util.Iterator;
 import java.util.List;
-import java.util.Map;
+import java.util.Properties;
 
 import javax.servlet.ServletContext;
 
-import org.apache.avalon.framework.activity.Disposable;
-import org.apache.avalon.framework.configuration.Configurable;
-import org.apache.avalon.framework.configuration.Configuration;
-import org.apache.avalon.framework.configuration.ConfigurationException;
-import org.apache.avalon.framework.service.ServiceException;
-import org.apache.avalon.framework.service.ServiceManager;
-import org.apache.avalon.framework.service.Serviceable;
-import org.apache.avalon.framework.thread.ThreadSafe;
-import org.apache.cocoon.portal.PortalRuntimeException;
 import org.apache.cocoon.portal.PortalService;
 import org.apache.cocoon.portal.RequestContext;
 import org.apache.cocoon.portal.event.EventConverter;
 import org.apache.cocoon.portal.event.EventManager;
-import org.apache.cocoon.portal.om.SkinDescription;
 import org.apache.cocoon.portal.profile.ProfileManager;
 import org.apache.cocoon.portal.services.CopletFactory;
 import org.apache.cocoon.portal.services.LayoutFactory;
@@ -48,11 +36,8 @@
 import org.apache.cocoon.portal.services.VariableResolver;
 import org.apache.cocoon.portal.services.VariableResolver.CompiledExpression;
 import org.apache.cocoon.portal.spi.RequestContextProvider;
-import org.apache.cocoon.util.AbstractLogEnabled;
-import org.apache.excalibur.source.Source;
-import org.apache.excalibur.source.SourceResolver;
-import org.apache.excalibur.source.TraversableSource;
-import org.springframework.web.context.ServletContextAware;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
 
 /**
  * Default implementation of a portal service using a session to store
@@ -61,32 +46,17 @@
  * @version $Id$
  */
 public class PortalServiceImpl
-    extends AbstractLogEnabled
-    implements Serviceable,
-                ThreadSafe,
-                PortalService,
-                ServletContextAware,
-                Disposable,
-                Configurable {
-
-    /** Parameter map for the context protocol. */
-    protected static final Map CONTEXT_PARAMETERS = Collections.singletonMap("force-traversable",
Boolean.TRUE);
+    implements PortalService {
 
     /** The servlet context. */
     protected ServletContext servletContext;
 
-    /** The service locator. */
-    protected ServiceManager manager;
-
     /** The list of skins. */
     protected List skinList = new ArrayList();
 
     /** The name of the portal. */
     protected String portalName;
 
-    /** The portal configuration. */
-    protected Configuration configuration;
-
     /** The profile manager. */
     protected ProfileManager profileManager;
 
@@ -111,12 +81,21 @@
     /** The request context provider. */
     protected RequestContextProvider requestContextProvider;
 
-    /**
-     * @see org.apache.avalon.framework.service.Serviceable#service(org.apache.avalon.framework.service.ServiceManager)
-     */
-    public void service(ServiceManager serviceManager) throws ServiceException {
-        this.manager = serviceManager;
-        this.requestContextProvider = (RequestContextProvider)this.manager.lookup(RequestContextProvider.class.getName());
+    /** The event converter. */
+    protected EventConverter eventConverter;
+
+    /** Configuration. */
+    protected Properties configuration;
+
+    /** By default we use the logger for this class. */
+    private Log logger = LogFactory.getLog(getClass());
+
+    public Log getLogger() {
+        return this.logger;
+    }
+
+    public void setLogger(Log l) {
+        this.logger = l;
     }
 
     /**
@@ -127,12 +106,11 @@
     }
 
     /**
-     * @see org.springframework.web.context.ServletContextAware#setServletContext(javax.servlet.ServletContext)
+     * Set the portal name.
+     * @param name The name of the portal.
      */
-    public void setServletContext(ServletContext context) {
-        this.servletContext = context;
-        // add the portal service to the servlet context
-        this.servletContext.setAttribute(PortalService.class.getName(), this);
+    public void setPortalName(String name) {
+        this.portalName = name;
     }
 
     /**
@@ -143,93 +121,18 @@
         if ( this.servletContext != null ) {
             this.servletContext.removeAttribute(PortalService.class.getName());
         }
-        if ( this.manager != null ) {
-            this.manager.release(this.profileManager);
-            this.profileManager = null;
-            this.manager.release(this.linkService);
-            this.linkService = null;
-            this.manager.release(this.copletFactory);
-            this.copletFactory = null;
-            this.manager.release(this.layoutFactory);
-            this.layoutFactory = null;
-            this.manager.release(this.eventManager);
-            this.eventManager = null;
-            this.manager.release(this.portalManager);
-            this.portalManager = null;
-            this.manager.release(this.userService);
-            this.userService = null;
-            this.manager.release(this.requestContextProvider);
-            this.requestContextProvider = null;
-            this.manager = null;
-        }
     }
 
-    /**
-     * @see org.apache.avalon.framework.configuration.Configurable#configure(org.apache.avalon.framework.configuration.Configuration)
-     */
-    public void configure(Configuration config) throws ConfigurationException {
-        final Configuration portal = config.getChild("portal", false);
-        if ( portal == null ) {
-            throw new ConfigurationException("No portal configured.", config);
-        }
-        this.portalName = portal.getAttribute("name");
-        this.configuration = portal.getChild("configuration");
-        this.configureSkins(this.getConfiguration(org.apache.cocoon.portal.Constants.CONFIGURATION_SKINS_PATH,
-                                                  org.apache.cocoon.portal.Constants.DEFAULT_CONFIGURATION_SKINS_PATH),
-                            this.getConfiguration(org.apache.cocoon.portal.Constants.CONFIGURATION_SKINS_PATH,
null) != null);
-    }
-
-    protected void configureSkins(String directory, boolean check)
-    throws ConfigurationException {
-        SourceResolver resolver = null;
-        Source dir = null;
-        try {
-            resolver = (SourceResolver)this.manager.lookup(SourceResolver.ROLE);
-            dir = resolver.resolveURI(directory, null, CONTEXT_PARAMETERS);
-            if ( !dir.exists() ) {
-                if ( check ) {
-                    throw new ConfigurationException("Skin directory does not exist: '" +
directory + "'.");
-                }
-                this.getLogger().warn("No skin directory found at location '" + directory
+ "'.");
-                return;
-            }
-            if ( dir instanceof TraversableSource ) {
-                final Iterator children = ((TraversableSource)dir).getChildren().iterator();
-                while ( children.hasNext() ) {
-                    final Source s = (Source)children.next();
-                    try {
-                        this.configureSkin(s);
-                    } finally {
-                        resolver.release(s);
-                    }
-                }
-            } else {
-                throw new ConfigurationException("Skin configuration must point to a directory,
'" + dir.getURI() + "' is not a directory.'");
-            }
-        } catch (IOException ioe) {
-            throw new ConfigurationException("Unable to read configurations from " + directory);
-        } catch (ServiceException e) {
-            throw new ConfigurationException("Unable to get source resolver.");
-        } finally {
-            if ( resolver != null ) {
-                resolver.release(dir);
-                this.manager.release(resolver);
-            }
+    public void setSkinDescriptions(List skins) {
+        if ( skins == null ) {
+            this.skinList = Collections.EMPTY_LIST;
+        } else {
+            this.skinList = new ArrayList(skins);
         }
     }
 
-    protected void configureSkin(Source directory) {
-        String uri = directory.getURI();
-        if ( uri.endsWith("/") ) {
-            uri = uri.substring(0, uri.length()-1);
-        }
-        int pos = uri.lastIndexOf('/');
-        final String skinName = uri.substring(pos+1);
-        final SkinDescription desc = new SkinDescription();
-        desc.setName(skinName);
-        desc.setBasePath(directory.getURI());
-        desc.setThumbnailPath(directory.getURI() + '/' + "images/thumb.jpg");
-        this.skinList.add(desc);
+    public void setConfiguration(Properties props) {
+        this.configuration = props;
     }
 
     /**
@@ -243,7 +146,14 @@
      * @see org.apache.cocoon.portal.PortalService#getConfiguration(java.lang.String, java.lang.String)
      */
     public String getConfiguration(String key, String defaultValue) {
-        return this.configuration.getChild(key).getValue(defaultValue);
+        String result = null;
+        if ( this.configuration != null ) {
+            result = this.configuration.getProperty(key);
+        }
+        if ( result == null ) {
+            result = defaultValue;
+        }
+        return defaultValue;
     }
 
     /**
@@ -257,20 +167,17 @@
      * @see org.apache.cocoon.portal.PortalService#getConfigurationAsBoolean(java.lang.String,
boolean)
      */
     public boolean getConfigurationAsBoolean(String key, boolean defaultValue) {
-        return this.configuration.getChild(key).getValueAsBoolean(defaultValue);
+        final String value = this.getConfiguration(key);
+        if ( value == null ) {
+            return defaultValue;
+        }
+        return Boolean.valueOf(value).booleanValue();
     }
 
     /**
      * @see org.apache.cocoon.portal.PortalService#getLinkService()
      */
     public LinkService getLinkService() {
-        if ( null == this.linkService ) {
-            try {
-                this.linkService = (LinkService)this.manager.lookup( LinkService.class.getName()
);
-            } catch (ServiceException e) {
-                throw new PortalRuntimeException("Unable to lookup link service.", e);
-            }
-        }
         return this.linkService;
     }
 
@@ -278,13 +185,6 @@
      * @see org.apache.cocoon.portal.PortalService#getProfileManager()
      */
     public ProfileManager getProfileManager() {
-        if ( null == this.profileManager ) {
-            try {
-                this.profileManager = (ProfileManager)this.manager.lookup( ProfileManager.class.getName()
);
-            } catch (ServiceException e) {
-                throw new PortalRuntimeException("Unable to lookup profile manager.", e);
-            }
-        }
         return this.profileManager;
     }
 
@@ -292,13 +192,6 @@
      * @see org.apache.cocoon.portal.PortalService#getEventManager()
      */
     public EventManager getEventManager() {
-        if ( null == this.eventManager ) {
-            try {
-                this.eventManager = (EventManager)this.manager.lookup( EventManager.class.getName()
);
-            } catch (ServiceException e) {
-                throw new PortalRuntimeException("Unable to lookup event manager.", e);
-            }
-        }
         return this.eventManager;
     }
 
@@ -306,13 +199,6 @@
      * @see org.apache.cocoon.portal.PortalService#getCopletFactory()
      */
     public CopletFactory getCopletFactory() {
-        if ( null == this.copletFactory ) {
-            try {
-                this.copletFactory = (CopletFactory)this.manager.lookup( CopletFactory.class.getName()
);
-            } catch (ServiceException e) {
-                throw new PortalRuntimeException("Unable to lookup coplet factory.", e);
-            }
-        }
         return this.copletFactory;
     }
 
@@ -320,13 +206,6 @@
      * @see org.apache.cocoon.portal.PortalService#getLayoutFactory()
      */
     public LayoutFactory getLayoutFactory() {
-        if ( null == this.layoutFactory ) {
-            try {
-                this.layoutFactory = (LayoutFactory)this.manager.lookup( LayoutFactory.class.getName()
);
-            } catch (ServiceException e) {
-                throw new PortalRuntimeException("Unable to lookup layout factory.", e);
-            }
-        }
         return this.layoutFactory;
     }
 
@@ -334,13 +213,6 @@
      * @see org.apache.cocoon.portal.PortalService#getPortalManager()
      */
     public PortalManager getPortalManager() {
-        if ( null == this.portalManager ) {
-            try {
-                this.portalManager = (PortalManager)this.manager.lookup( PortalManager.class.getName()
);
-            } catch (ServiceException e) {
-                throw new PortalRuntimeException("Unable to lookup portal manager.", e);
-            }
-        }
         return this.portalManager;
     }
 
@@ -348,13 +220,6 @@
      * @see org.apache.cocoon.portal.PortalService#getUserService()
      */
     public UserService getUserService() {
-        if ( this.userService == null ) {
-            try {
-                this.userService = (UserService)this.manager.lookup(UserService.class.getName());
-            } catch (ServiceException e) {
-                throw new PortalRuntimeException("Unable to lookup user service.", e);
-            }
-        }
         return this.userService;
     }
 
@@ -362,11 +227,7 @@
      * @see org.apache.cocoon.portal.PortalService#getEventConverter()
      */
     public EventConverter getEventConverter() {
-        try {
-            return (EventConverter)this.manager.lookup(EventConverter.class.getName());
-        } catch (ServiceException e) {
-            throw new PortalRuntimeException("Unable to lookup event converter.", e);
-        }
+        return this.eventConverter;
     }
 
     /**

Added: cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/spring/SpringPortalService.java
URL: http://svn.apache.org/viewvc/cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/spring/SpringPortalService.java?rev=605714&view=auto
==============================================================================
--- cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/spring/SpringPortalService.java
(added)
+++ cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/spring/SpringPortalService.java
Wed Dec 19 13:44:14 2007
@@ -0,0 +1,64 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.
+ */
+package org.apache.cocoon.portal.spring;
+
+import javax.servlet.ServletContext;
+
+import org.apache.cocoon.portal.PortalService;
+import org.apache.cocoon.portal.event.EventConverter;
+import org.apache.cocoon.portal.event.EventManager;
+import org.apache.cocoon.portal.impl.PortalServiceImpl;
+import org.apache.cocoon.portal.profile.ProfileManager;
+import org.apache.cocoon.portal.services.CopletFactory;
+import org.apache.cocoon.portal.services.LayoutFactory;
+import org.apache.cocoon.portal.services.LinkService;
+import org.apache.cocoon.portal.services.PortalManager;
+import org.apache.cocoon.portal.services.UserService;
+import org.apache.cocoon.portal.spi.RequestContextProvider;
+import org.springframework.beans.BeansException;
+import org.springframework.context.ApplicationContext;
+import org.springframework.context.ApplicationContextAware;
+
+/**
+ * This extensions of the {@link PortalServiceImpl} uses Spring
+ * to resolve the dependencies.
+ *
+ * @version $Id$
+ */
+public class SpringPortalService
+    extends PortalServiceImpl
+    implements ApplicationContextAware {
+
+    /**
+     * @see org.springframework.context.ApplicationContextAware#setApplicationContext(org.springframework.context.ApplicationContext)
+     */
+    public void setApplicationContext(ApplicationContext appContext)
+    throws BeansException {
+        this.requestContextProvider = (RequestContextProvider) appContext.getBean(RequestContextProvider.class.getName());
+        this.servletContext = (ServletContext)appContext.getBean(ServletContext.class.getName());
+        // add the portal service to the servlet context
+        this.servletContext.setAttribute(PortalService.class.getName(), this);
+        this.profileManager = (ProfileManager)appContext.getBean(ProfileManager.class.getName());
+        this.linkService = (LinkService)appContext.getBean( LinkService.class.getName() );
+        this.eventManager = (EventManager)appContext.getBean( EventManager.class.getName()
);
+        this.copletFactory = (CopletFactory)appContext.getBean( CopletFactory.class.getName()
);
+        this.layoutFactory = (LayoutFactory)appContext.getBean( LayoutFactory.class.getName()
);
+        this.portalManager = (PortalManager)appContext.getBean( PortalManager.class.getName()
);
+        this.userService = (UserService)appContext.getBean(UserService.class.getName());
+        this.eventConverter = (EventConverter)appContext.getBean(EventConverter.class.getName());
+    }
+}

Propchange: cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/spring/SpringPortalService.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/spring/SpringPortalService.java
------------------------------------------------------------------------------
    svn:keywords = author date id revision url

Modified: cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/resources/org/apache/cocoon/portal/cocoon-portal-components.xml
URL: http://svn.apache.org/viewvc/cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/resources/org/apache/cocoon/portal/cocoon-portal-components.xml?rev=605714&r1=605713&r2=605714&view=diff
==============================================================================
--- cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/resources/org/apache/cocoon/portal/cocoon-portal-components.xml
(original)
+++ cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/resources/org/apache/cocoon/portal/cocoon-portal-components.xml
Wed Dec 19 13:44:14 2007
@@ -31,6 +31,14 @@
                            http://cocoon.apache.org/schema/configurator http://cocoon.apache.org/schema/configurator/cocoon-configurator-1.0.1.xsd">
 
   <!--+
+      | Spring Bean Post Processors:
+      +-->
+    <bean name="org.apache.cocoon.portal.spring.ReceiverBeanPostProcessor"
+          class="org.apache.cocoon.portal.spring.ReceiverBeanPostProcessor"/>
+    <bean name="org.apache.cocoon.portal.spring.RegistrationBeanPostProcessor"
+          class="org.apache.cocoon.portal.spring.RegistrationBeanPostProcessor"/>
+
+  <!--+
       | Abstract Bean used as a base for nearly all beans
       |
       +-->
@@ -285,4 +293,5 @@
       +-->
     <configurator:bean-map id="org.apache.cocoon.portal.om.LayoutTypeMap"
                            type="org.apache.cocoon.portal.om.LayoutType"/>
+
 </beans>

Modified: cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/resources/org/apache/cocoon/portal/portal.roles
URL: http://svn.apache.org/viewvc/cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/resources/org/apache/cocoon/portal/portal.roles?rev=605714&r1=605713&r2=605714&view=diff
==============================================================================
--- cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/resources/org/apache/cocoon/portal/portal.roles
(original)
+++ cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/resources/org/apache/cocoon/portal/portal.roles
Wed Dec 19 13:44:14 2007
@@ -18,14 +18,6 @@
 <!-- @version $Id$ -->
 <role-list>
   <!--+
-      | Spring Bean Post Processors:
-      +-->
-    <role name="org.apache.cocoon.portal.spring.ReceiverBeanPostProcessor"
-          default-class="org.apache.cocoon.portal.spring.ReceiverBeanPostProcessor"/>
-    <role name="org.apache.cocoon.portal.spring.RegistrationBeanPostProcessor"
-          default-class="org.apache.cocoon.portal.spring.RegistrationBeanPostProcessor"/>
-
-  <!--+
       | Coplet and Layout Source.
       |
       +-->
@@ -33,15 +25,6 @@
           default-class="org.apache.cocoon.portal.source.CopletSourceFactory"/>
     <role name="org.apache.excalibur.source.SourceFactory/layout"
           default-class="org.apache.cocoon.portal.source.LayoutSourceFactory"/>
-
-
-  <!--+
-      | Portal Service.
-      |
-      +-->
-    <role name="org.apache.cocoon.portal.PortalService"
-          default-class="org.apache.cocoon.portal.impl.PortalServiceImpl"
-          shorthand="portal-service"/>
 
   <!--+
       | Deployment Manager

Modified: cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/resources/org/apache/cocoon/portal/spring/schema/cocoon-portal-1.0.xsd
URL: http://svn.apache.org/viewvc/cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/resources/org/apache/cocoon/portal/spring/schema/cocoon-portal-1.0.xsd?rev=605714&r1=605713&r2=605714&view=diff
==============================================================================
--- cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/resources/org/apache/cocoon/portal/spring/schema/cocoon-portal-1.0.xsd
(original)
+++ cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/resources/org/apache/cocoon/portal/spring/schema/cocoon-portal-1.0.xsd
Wed Dec 19 13:44:14 2007
@@ -81,12 +81,7 @@
   <xsd:element name="layout-type">
     <xsd:complexType>
       <xsd:sequence>
-        <xsd:element name="renderer" minOccurs="1" maxOccurs="unbounded">
-          <xsd:complexType>
-            <xsd:attribute name="ref" type="xsd:string" use="optional"/>
-            <xsd:attribute name="type" type="xsd:string" use="optional"/>
-          </xsd:complexType>
-        </xsd:element>
+        <xsd:element ref="renderer" minOccurs="1" maxOccurs="unbounded"/>
       </xsd:sequence>
       <xsd:attribute name="id" type="xsd:ID" use="required"/>
       <xsd:attribute name="layoutClass" type="xsd:string" use="required"/>
@@ -96,25 +91,36 @@
     </xsd:complexType>
   </xsd:element>
   
+  <xsd:element name="renderer">
+    <xsd:complexType>
+      <xsd:attribute name="ref" type="xsd:string" use="optional"/>
+      <xsd:attribute name="type" type="xsd:string" use="optional"/>
+    </xsd:complexType>
+  </xsd:element>
+
   <xsd:element name="coplet-type">
     <xsd:complexType>
       <xsd:sequence>
-        <xsd:element name="coplet-adapter" minOccurs="1" maxOccurs="1">
-          <xsd:complexType>
-            <xsd:attribute name="ref" type="xsd:string" use="optional"/>
-            <xsd:attribute name="type" type="xsd:string" use="optional"/>
-          </xsd:complexType>
-        </xsd:element>
-        <xsd:element name="configuration" minOccurs="0" maxOccurs="unbounded">
-          <xsd:complexType>
-            <xsd:attribute name="name" type="xsd:string" use="required"/>
-            <xsd:attribute name="value" type="xsd:string" use="required"/>
-            <xsd:attribute name="type" type="xsd:string" use="optional"/>
-          </xsd:complexType>
-        </xsd:element>
+        <xsd:element ref="coplet-adapter" minOccurs="1" maxOccurs="1"/>
+        <xsd:element ref="configuration" minOccurs="0" maxOccurs="unbounded"/>
       </xsd:sequence>
       <xsd:attribute name="id" type="xsd:ID" use="optional"/>
       <xsd:attribute name="name" type="xsd:string" use="optional"/>
+    </xsd:complexType>
+  </xsd:element>
+
+  <xsd:element name="coplet-adapter">
+    <xsd:complexType>
+      <xsd:attribute name="ref" type="xsd:string" use="optional"/>
+      <xsd:attribute name="type" type="xsd:string" use="optional"/>
+    </xsd:complexType>
+  </xsd:element>
+
+  <xsd:element name="configuration">
+    <xsd:complexType>
+      <xsd:attribute name="name" type="xsd:string" use="required"/>
+      <xsd:attribute name="value" type="xsd:string" use="required"/>
+      <xsd:attribute name="type" type="xsd:string" use="optional"/>
     </xsd:complexType>
   </xsd:element>
 </xsd:schema>

Modified: cocoon/trunk/blocks/cocoon-portal/cocoon-portal-sample/src/main/resources/COB-INF/config/avalon/cocoon-portal-sample.xconf
URL: http://svn.apache.org/viewvc/cocoon/trunk/blocks/cocoon-portal/cocoon-portal-sample/src/main/resources/COB-INF/config/avalon/cocoon-portal-sample.xconf?rev=605714&r1=605713&r2=605714&view=diff
==============================================================================
--- cocoon/trunk/blocks/cocoon-portal/cocoon-portal-sample/src/main/resources/COB-INF/config/avalon/cocoon-portal-sample.xconf
(original)
+++ cocoon/trunk/blocks/cocoon-portal/cocoon-portal-sample/src/main/resources/COB-INF/config/avalon/cocoon-portal-sample.xconf
Wed Dec 19 13:44:14 2007
@@ -44,18 +44,6 @@
   <!-- We use Castor for persisting/mapping the profiles to XML: -->
   <include src="resource://org/apache/cocoon/portal/persistence/castor/portal-castor.roles"/>
 
-  <portal-service>
-    <portal name="portal">
-      <!-- Configuration: -->
-      <configuration>
-        <!-- The directory where all possible skins are stored. -->
-        <skins-path>skins</skins-path>
-        <!-- Whether the portal should use ajax or not -->
-        <use-ajax>false</use-ajax>
-      </configuration>
-    </portal>
-  </portal-service>
-
   <!--+
       | Deployment Manager.
       +-->

Modified: cocoon/trunk/blocks/cocoon-portal/cocoon-portal-sample/src/main/resources/COB-INF/config/spring/cocoon-portal-sample-components.xml
URL: http://svn.apache.org/viewvc/cocoon/trunk/blocks/cocoon-portal/cocoon-portal-sample/src/main/resources/COB-INF/config/spring/cocoon-portal-sample-components.xml?rev=605714&r1=605713&r2=605714&view=diff
==============================================================================
--- cocoon/trunk/blocks/cocoon-portal/cocoon-portal-sample/src/main/resources/COB-INF/config/spring/cocoon-portal-sample-components.xml
(original)
+++ cocoon/trunk/blocks/cocoon-portal/cocoon-portal-sample/src/main/resources/COB-INF/config/spring/cocoon-portal-sample-components.xml
Wed Dec 19 13:44:14 2007
@@ -27,6 +27,18 @@
                            http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-2.0.xsd
                            http://cocoon.apache.org/schema/portal http://cocoon.apache.org/schema/portal/cocoon-portal-1.0.xsd">
 
+  <!--+
+      |                       THIS IS A SAMPLE PORTAL
+      |
+      | It demonstrates several features of the portal engine,
+      | so it's neither configured for *your* environment nor
+      | optimized for production. If you use the portal for your
+      | own projects make sure that you remove all unused stuff
+      | from the configuration and that you configure the remaining
+      | components properly. However, the best way is to start your
+      | portal project from scratch!
+      +-->
+
   <!-- Include sitemap default beans -->
   <import resource="classpath:org/apache/cocoon/portal/sitemap/cocoon-portal-sitemap-components.xml"/>
 
@@ -107,5 +119,42 @@
     <portal:profile-manager-aspects id="org.apache.cocoon.portal.profile.ProfileManager.aspects">
       <!-- Add your aspects here -->
     </portal:profile-manager-aspects>
+
+  <!--+
+      | Portal Service.
+      |
+      +-->
+    <bean name="org.apache.cocoon.portal.PortalService"
+          class="org.apache.cocoon.portal.spring.SpringPortalService"
+          scope="singleton">
+      <!-- Configuration: -->
+      <property name="portalName" value="portal"/>
+      <!-- The available skins -->
+      <property name="skinDescriptions">
+        <list>
+          <bean class="org.apache.cocoon.portal.om.SkinDescription">
+            <property name="name" value="basic"/>
+            <property name="basePath" value="skins/basic"/>
+            <property name="thumbnailPath" value="skins/basic/images/thumb.jpg"/>
+          </bean>
+          <bean class="org.apache.cocoon.portal.om.SkinDescription">
+            <property name="name" value="common"/>
+            <property name="basePath" value="skins/common"/>
+            <property name="thumbnailPath" value="skins/common/images/thumb.jpg"/>
+          </bean>
+          <bean class="org.apache.cocoon.portal.om.SkinDescription">
+            <property name="name" value="modern"/>
+            <property name="basePath" value="skins/modern"/>
+            <property name="thumbnailPath" value="skins/modern/images/thumb.jpg"/>
+          </bean>
+        </list>
+      </property>
+      <property name="configuration">
+        <value>
+          <!-- Whether the portal should use ajax or not -->
+          use-ajax=false
+        </value>
+      </property>
+    </bean>
 
 </beans>

Modified: cocoon/trunk/blocks/cocoon-portal/cocoon-portal-sample/src/main/resources/COB-INF/config/spring/coplet-types.xml
URL: http://svn.apache.org/viewvc/cocoon/trunk/blocks/cocoon-portal/cocoon-portal-sample/src/main/resources/COB-INF/config/spring/coplet-types.xml?rev=605714&r1=605713&r2=605714&view=diff
==============================================================================
--- cocoon/trunk/blocks/cocoon-portal/cocoon-portal-sample/src/main/resources/COB-INF/config/spring/coplet-types.xml
(original)
+++ cocoon/trunk/blocks/cocoon-portal/cocoon-portal-sample/src/main/resources/COB-INF/config/spring/coplet-types.xml
Wed Dec 19 13:44:14 2007
@@ -33,15 +33,15 @@
     
     <portal:coplet-type id="portlet">
       <portal:coplet-adapter type="portlet"/>
-      <portal:configuration key="buffer" type="boolean" value="true"/>
-      <portal:configuration key="full-screen" type="boolean" value="false"/>
-      <portal:configuration key="handle-sizing" type="boolean" value="true"/>
+      <portal:configuration name="buffer" type="boolean" value="true"/>
+      <portal:configuration name="full-screen" type="boolean" value="false"/>
+      <portal:configuration name="handle-sizing" type="boolean" value="true"/>
     </portal:coplet-type>
 
 <!-- 
     <portal:coplet-type id="wsrp">
       <portal:coplet-adapter type="wsrp"/>
-      <portal:configuration key="buffer" type="boolean" value="true"/>
+      <portal:configuration name="buffer" type="boolean" value="true"/>
     </portal:coplet-type>
  -->
 </beans>

Modified: cocoon/trunk/blocks/cocoon-portal/cocoon-portal-sample/src/main/resources/COB-INF/config/spring/layout-types.xml
URL: http://svn.apache.org/viewvc/cocoon/trunk/blocks/cocoon-portal/cocoon-portal-sample/src/main/resources/COB-INF/config/spring/layout-types.xml?rev=605714&r1=605713&r2=605714&view=diff
==============================================================================
--- cocoon/trunk/blocks/cocoon-portal/cocoon-portal-sample/src/main/resources/COB-INF/config/spring/layout-types.xml
(original)
+++ cocoon/trunk/blocks/cocoon-portal/cocoon-portal-sample/src/main/resources/COB-INF/config/spring/layout-types.xml
Wed Dec 19 13:44:14 2007
@@ -36,19 +36,19 @@
     </portal:layout-type>
 
     <portal:layout-type id="tab" layoutClass="org.apache.cocoon.portal.om.CompositeLayout"
-                        itemClassName="org.apache.cocoon.portal.om.NamedItem"
+                        itemClass="org.apache.cocoon.portal.om.NamedItem"
                         createLayoutId="true" defaultIsStatic="true">
       <portal:renderer type="tab"/>
     </portal:layout-type>
 
     <portal:layout-type id="rawtab" layoutClass="org.apache.cocoon.portal.om.CompositeLayout"
-                        itemClassName="org.apache.cocoon.portal.om.NamedItem"
+                        itemClass="org.apache.cocoon.portal.om.NamedItem"
                         createLayoutId="true" defaultIsStatic="true">
       <portal:renderer type="rawtab"/>
     </portal:layout-type>
 
     <portal:layout-type id="linktab" layoutClass="org.apache.cocoon.portal.om.CompositeLayout"
-                        itemClassName="org.apache.cocoon.portal.om.NamedItem"
+                        itemClass="org.apache.cocoon.portal.om.NamedItem"
                         createLayoutId="true" defaultIsStatic="true">
       <portal:renderer type="linktab"/>
     </portal:layout-type>



Mime
View raw message