You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@cocoon.apache.org by cz...@apache.org on 2006/08/06 19:52:44 UTC

svn commit: r429164 - in /cocoon/trunk/blocks/cocoon-portal/cocoon-portal-portlet-newimpl/src/main/java/org/apache/cocoon/portal/pluto: ContainerServicesImpl.java PortalContextImpl.java PortalStartup.java

Author: cziegeler
Date: Sun Aug  6 10:52:35 2006
New Revision: 429164

URL: http://svn.apache.org/viewvc?rev=429164&view=rev
Log:
Start implementation

Added:
    cocoon/trunk/blocks/cocoon-portal/cocoon-portal-portlet-newimpl/src/main/java/org/apache/cocoon/portal/pluto/ContainerServicesImpl.java   (with props)
    cocoon/trunk/blocks/cocoon-portal/cocoon-portal-portlet-newimpl/src/main/java/org/apache/cocoon/portal/pluto/PortalContextImpl.java   (with props)
Modified:
    cocoon/trunk/blocks/cocoon-portal/cocoon-portal-portlet-newimpl/src/main/java/org/apache/cocoon/portal/pluto/PortalStartup.java

Added: cocoon/trunk/blocks/cocoon-portal/cocoon-portal-portlet-newimpl/src/main/java/org/apache/cocoon/portal/pluto/ContainerServicesImpl.java
URL: http://svn.apache.org/viewvc/cocoon/trunk/blocks/cocoon-portal/cocoon-portal-portlet-newimpl/src/main/java/org/apache/cocoon/portal/pluto/ContainerServicesImpl.java?rev=429164&view=auto
==============================================================================
--- cocoon/trunk/blocks/cocoon-portal/cocoon-portal-portlet-newimpl/src/main/java/org/apache/cocoon/portal/pluto/ContainerServicesImpl.java (added)
+++ cocoon/trunk/blocks/cocoon-portal/cocoon-portal-portlet-newimpl/src/main/java/org/apache/cocoon/portal/pluto/ContainerServicesImpl.java Sun Aug  6 10:52:35 2006
@@ -0,0 +1,78 @@
+/*
+ * Copyright 2006 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.
+ */
+package org.apache.cocoon.portal.pluto;
+
+import javax.portlet.PortalContext;
+
+import org.apache.avalon.framework.logger.AbstractLogEnabled;
+import org.apache.pluto.OptionalContainerServices;
+import org.apache.pluto.RequiredContainerServices;
+import org.apache.pluto.internal.InternalPortletWindow;
+import org.apache.pluto.spi.PortalCallbackService;
+import org.apache.pluto.spi.optional.PortletEnvironmentService;
+import org.apache.pluto.spi.optional.PortletInvokerService;
+import org.apache.pluto.spi.optional.PortletPreferencesService;
+
+/**
+ * 
+ * @version $Id$
+ *
+ */
+public class ContainerServicesImpl
+    extends AbstractLogEnabled
+    implements RequiredContainerServices, OptionalContainerServices {
+
+    protected PortalContext portalContext = new PortalContextImpl();
+
+    /**
+     * @see org.apache.pluto.RequiredContainerServices#getPortalCallbackService()
+     */
+    public PortalCallbackService getPortalCallbackService() {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    /**
+     * @see org.apache.pluto.RequiredContainerServices#getPortalContext()
+     */
+    public PortalContext getPortalContext() {
+        return this.portalContext;
+    }
+
+    /**
+     * @see org.apache.pluto.OptionalContainerServices#getPortletEnvironmentService()
+     */
+    public PortletEnvironmentService getPortletEnvironmentService() {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    /**
+     * @see org.apache.pluto.OptionalContainerServices#getPortletInvokerService(org.apache.pluto.internal.InternalPortletWindow)
+     */
+    public PortletInvokerService getPortletInvokerService(InternalPortletWindow arg0) {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    /**
+     * @see org.apache.pluto.OptionalContainerServices#getPortletPreferencesService()
+     */
+    public PortletPreferencesService getPortletPreferencesService() {
+        // TODO Auto-generated method stub
+        return null;
+    }
+}

Propchange: cocoon/trunk/blocks/cocoon-portal/cocoon-portal-portlet-newimpl/src/main/java/org/apache/cocoon/portal/pluto/ContainerServicesImpl.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: cocoon/trunk/blocks/cocoon-portal/cocoon-portal-portlet-newimpl/src/main/java/org/apache/cocoon/portal/pluto/ContainerServicesImpl.java
------------------------------------------------------------------------------
    svn:keywords = Id

Added: cocoon/trunk/blocks/cocoon-portal/cocoon-portal-portlet-newimpl/src/main/java/org/apache/cocoon/portal/pluto/PortalContextImpl.java
URL: http://svn.apache.org/viewvc/cocoon/trunk/blocks/cocoon-portal/cocoon-portal-portlet-newimpl/src/main/java/org/apache/cocoon/portal/pluto/PortalContextImpl.java?rev=429164&view=auto
==============================================================================
--- cocoon/trunk/blocks/cocoon-portal/cocoon-portal-portlet-newimpl/src/main/java/org/apache/cocoon/portal/pluto/PortalContextImpl.java (added)
+++ cocoon/trunk/blocks/cocoon-portal/cocoon-portal-portlet-newimpl/src/main/java/org/apache/cocoon/portal/pluto/PortalContextImpl.java Sun Aug  6 10:52:35 2006
@@ -0,0 +1,91 @@
+/*
+ * Copyright 2006 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.
+ */
+package org.apache.cocoon.portal.pluto;
+
+import java.util.ArrayList;
+import java.util.Enumeration;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import javax.portlet.PortalContext;
+import javax.portlet.PortletMode;
+
+import org.apache.avalon.framework.logger.AbstractLogEnabled;
+import org.apache.cocoon.Constants;
+import org.apache.commons.collections.iterators.IteratorEnumeration;
+
+/**
+ * 
+ * @version $Id$
+ *
+ */
+public class PortalContextImpl
+    extends AbstractLogEnabled
+    implements PortalContext {
+
+    protected String versionInfo = "Apache Cocoon/" + Constants.VERSION;
+
+    protected final Map properties = new HashMap();
+
+    protected final List portletModes = new ArrayList();
+
+    protected final List windowStates = new ArrayList();
+
+    public PortalContextImpl() {
+        this.portletModes.add(new PortletMode("view"));
+        this.portletModes.add(new PortletMode("edit"));
+        this.portletModes.add(new PortletMode("help"));
+        this.portletModes.add(new PortletMode("config"));
+    }
+    /**
+     * @see javax.portlet.PortalContext#getPortalInfo()
+     */
+    public String getPortalInfo() {
+        return this.versionInfo;
+    }
+
+    /**
+     * @see javax.portlet.PortalContext#getProperty(java.lang.String)
+     */
+    public String getProperty(String name) {
+        if (name == null) {
+            throw new IllegalArgumentException("Property name == null");
+        }
+        return (String)this.properties.get(name);
+    }
+
+    /**
+     * @see javax.portlet.PortalContext#getPropertyNames()
+     */
+    public Enumeration getPropertyNames() {
+        return new IteratorEnumeration(this.properties.keySet().iterator());
+    }
+
+    /**
+     * @see javax.portlet.PortalContext#getSupportedPortletModes()
+     */
+    public Enumeration getSupportedPortletModes() {
+        return new IteratorEnumeration(this.portletModes.iterator());
+    }
+
+    /**
+     * @see javax.portlet.PortalContext#getSupportedWindowStates()
+     */
+    public Enumeration getSupportedWindowStates() {
+        return new IteratorEnumeration(this.windowStates.iterator());
+    }
+}

Propchange: cocoon/trunk/blocks/cocoon-portal/cocoon-portal-portlet-newimpl/src/main/java/org/apache/cocoon/portal/pluto/PortalContextImpl.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: cocoon/trunk/blocks/cocoon-portal/cocoon-portal-portlet-newimpl/src/main/java/org/apache/cocoon/portal/pluto/PortalContextImpl.java
------------------------------------------------------------------------------
    svn:keywords = Id

Modified: cocoon/trunk/blocks/cocoon-portal/cocoon-portal-portlet-newimpl/src/main/java/org/apache/cocoon/portal/pluto/PortalStartup.java
URL: http://svn.apache.org/viewvc/cocoon/trunk/blocks/cocoon-portal/cocoon-portal-portlet-newimpl/src/main/java/org/apache/cocoon/portal/pluto/PortalStartup.java?rev=429164&r1=429163&r2=429164&view=diff
==============================================================================
--- cocoon/trunk/blocks/cocoon-portal/cocoon-portal-portlet-newimpl/src/main/java/org/apache/cocoon/portal/pluto/PortalStartup.java (original)
+++ cocoon/trunk/blocks/cocoon-portal/cocoon-portal-portlet-newimpl/src/main/java/org/apache/cocoon/portal/pluto/PortalStartup.java Sun Aug  6 10:52:35 2006
@@ -16,16 +16,12 @@
 package org.apache.cocoon.portal.pluto;
 
 import org.apache.avalon.framework.logger.AbstractLogEnabled;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
 import org.apache.pluto.PortletContainer;
 import org.apache.pluto.PortletContainerException;
 import org.apache.pluto.PortletContainerFactory;
 import org.springframework.web.context.ServletContextAware;
 
 import javax.servlet.ServletContext;
-import javax.servlet.ServletContextEvent;
-import javax.servlet.ServletContextListener;
 
 /**
  * @version $Id$
@@ -62,36 +58,20 @@
             this.getLogger().info("********** Pluto Portal Driver Shut Down **********\n\n");
         }
     }
-    
+
     /**
      * Initializes the portlet container. This method constructs and initializes
      * the portlet container, and saves it to the servlet context scope.
      * @param servletContext  the servlet context.
      */
     private void initContainer() {
-        
-    	// Retrieve the driver configuration from servlet context.
-    	//DriverConfiguration driverConfig = (DriverConfiguration)
-        //		servletContext.getAttribute(DRIVER_CONFIG_KEY);
-        
         try {
-        	
-        	// Create portal context.
-            if (this.getLogger().isDebugEnabled()) {
-           //     this.getLogger().debug("Creating portal context ["
-           //     		+ driverConfig.getPortalName() + "/"
-           //             + driverConfig.getPortalVersion() + "]...");
-            }
-           // PortalContextImpl portalContext =
-           // 		new PortalContextImpl(driverConfig);
-            
             // Create container services.
             if (this.getLogger().isDebugEnabled()) {
                 this.getLogger().debug("Creating container services...");
             }
-          //  ContainerServicesImpl containerServices =
-          //  		new ContainerServicesImpl(portalContext, driverConfig);
-            
+            ContainerServicesImpl containerServices = new ContainerServicesImpl();
+
             // Create portlet container.
             if (this.getLogger().isDebugEnabled()) {
                 this.getLogger().debug("Creating portlet container...");
@@ -100,29 +80,26 @@
          		PortletContainerFactory.getInstance();
             PortletContainer container = factory.createContainer(
                     this.uniqueContainerName,
-                    null,
-                    null);
-            
+                    containerServices,
+                    containerServices);
+
             // Initialize portlet container.
             if (this.getLogger().isDebugEnabled()) {
                 this.getLogger().debug("Initializing portlet container...");
             }
             container.init(servletContext);
-            
+
             // Save portlet container to the servlet context scope.
-            servletContext.setAttribute(CONTAINER_KEY, container);
+            this.servletContext.setAttribute(CONTAINER_KEY, container);
             if (this.getLogger().isInfoEnabled()) {
                 this.getLogger().info("Pluto portlet container started.");
             }
-            
+
         } catch (PortletContainerException ex) {
             this.getLogger().error("Unable to start up portlet container: "
             		+ ex.getMessage(), ex);
         }
     }
-    
-    
-    // Private Destruction Methods ---------------------------------------------
     
     /**
      * Destroyes the portlet container and removes it from servlet context.