cocoon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cziege...@apache.org
Subject svn commit: r367589 - in /cocoon/branches/BRANCH_2_1_X: ./ src/blocks/portal/java/org/apache/cocoon/portal/pluto/factory/ src/blocks/portal/java/org/apache/cocoon/portal/pluto/services/factory/
Date Tue, 10 Jan 2006 12:49:45 GMT
Author: cziegeler
Date: Tue Jan 10 04:49:33 2006
New Revision: 367589

URL: http://svn.apache.org/viewcvs?rev=367589&view=rev
Log:
Provide user name to portlets.

Added:
    cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/pluto/factory/ActionRequestFactoryImpl.java
  (with props)
    cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/pluto/factory/ActionRequestImpl.java
  (with props)
    cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/pluto/factory/RenderRequestFactoryImpl.java
  (with props)
    cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/pluto/factory/RenderRequestImpl.java
  (with props)
Modified:
    cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/pluto/services/factory/FactoryManagerServiceImpl.java
    cocoon/branches/BRANCH_2_1_X/status.xml

Added: cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/pluto/factory/ActionRequestFactoryImpl.java
URL: http://svn.apache.org/viewcvs/cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/pluto/factory/ActionRequestFactoryImpl.java?rev=367589&view=auto
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/pluto/factory/ActionRequestFactoryImpl.java
(added)
+++ cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/pluto/factory/ActionRequestFactoryImpl.java
Tue Jan 10 04:49:33 2006
@@ -0,0 +1,73 @@
+/*
+ * Copyright 2004-2005 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.factory;
+
+import javax.portlet.ActionRequest;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.apache.avalon.framework.activity.Disposable;
+import org.apache.avalon.framework.service.ServiceException;
+import org.apache.avalon.framework.service.ServiceManager;
+import org.apache.avalon.framework.service.Serviceable;
+import org.apache.cocoon.portal.PortalService;
+import org.apache.pluto.factory.ActionRequestFactory;
+import org.apache.pluto.om.window.PortletWindow;
+
+/**
+ * Implementation for the render request factory.
+ *
+ * @version $Id$
+ */
+public class ActionRequestFactoryImpl
+    extends AbstractFactory
+    implements ActionRequestFactory, Serviceable, Disposable {
+
+    /** The service manager. */
+    protected ServiceManager manager;
+
+    /** The portal service. */
+    protected PortalService portalService;
+
+    /**
+     * @see org.apache.avalon.framework.activity.Disposable#dispose()
+     */
+    public void dispose() {
+        if ( this.manager != null ) {
+            this.manager.release(this.portalService);
+            this.portalService = null;
+            this.manager = null;
+        }
+    }
+
+    /**
+     * @see org.apache.avalon.framework.service.Serviceable#service(org.apache.avalon.framework.service.ServiceManager)
+     */
+    public void service(ServiceManager manager) throws ServiceException {
+        this.manager = manager;
+        this.portalService = (PortalService)this.manager.lookup(PortalService.ROLE);
+    }
+
+    /**
+     * @see org.apache.pluto.factory.ActionRequestFactory#getActionRequest(org.apache.pluto.om.window.PortletWindow,
javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)
+     */
+    public ActionRequest getActionRequest(PortletWindow       portletWindow,
+                                          HttpServletRequest  servletRequest,
+                                          HttpServletResponse servletResponse) {
+        ActionRequest actionRequest = new ActionRequestImpl(portletWindow, servletRequest,
this.portalService.getComponentManager().getProfileManager().getUser());
+        return actionRequest;
+    }
+}

Propchange: cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/pluto/factory/ActionRequestFactoryImpl.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/pluto/factory/ActionRequestFactoryImpl.java
------------------------------------------------------------------------------
    svn:keywords = Id

Added: cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/pluto/factory/ActionRequestImpl.java
URL: http://svn.apache.org/viewcvs/cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/pluto/factory/ActionRequestImpl.java?rev=367589&view=auto
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/pluto/factory/ActionRequestImpl.java
(added)
+++ cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/pluto/factory/ActionRequestImpl.java
Tue Jan 10 04:49:33 2006
@@ -0,0 +1,55 @@
+/*
+ * Copyright 2005 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.factory;
+
+import javax.servlet.http.HttpServletRequest;
+
+import org.apache.cocoon.portal.profile.PortalUser;
+import org.apache.pluto.om.window.PortletWindow;
+
+/**
+ * Implementation for the action request object.
+ *
+ * @version $Id$
+ */
+public class ActionRequestImpl
+    extends org.apache.pluto.core.impl.ActionRequestImpl {
+
+    /** The portal user. */
+    protected final PortalUser user;
+
+    public ActionRequestImpl(PortletWindow window, HttpServletRequest req, PortalUser user)
{
+        super(window, req);
+        this.user = user;
+    }
+
+    /**
+     * @see org.apache.pluto.core.impl.PortletRequestImpl#getRemoteUser()
+     */
+    public String getRemoteUser() {
+        return this.user.getUserName();
+    }
+
+    /**
+     * @see org.apache.pluto.core.impl.PortletRequestImpl#isUserInRole(java.lang.String)
+     */
+    public boolean isUserInRole(String role) {
+        if ( this.user.isUserInRole(role) ) {
+            return true;
+        }
+        return super.isUserInRole(role);
+    }
+}

Propchange: cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/pluto/factory/ActionRequestImpl.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/pluto/factory/ActionRequestImpl.java
------------------------------------------------------------------------------
    svn:keywords = Id

Added: cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/pluto/factory/RenderRequestFactoryImpl.java
URL: http://svn.apache.org/viewcvs/cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/pluto/factory/RenderRequestFactoryImpl.java?rev=367589&view=auto
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/pluto/factory/RenderRequestFactoryImpl.java
(added)
+++ cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/pluto/factory/RenderRequestFactoryImpl.java
Tue Jan 10 04:49:33 2006
@@ -0,0 +1,75 @@
+/*
+ * Copyright 2004-2005 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.factory;
+
+import javax.portlet.RenderRequest;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.apache.avalon.framework.activity.Disposable;
+import org.apache.avalon.framework.service.ServiceException;
+import org.apache.avalon.framework.service.ServiceManager;
+import org.apache.avalon.framework.service.Serviceable;
+import org.apache.cocoon.portal.PortalService;
+import org.apache.pluto.factory.RenderRequestFactory;
+import org.apache.pluto.om.window.PortletWindow;
+
+/**
+ * Implementation for the render request factory.
+ *
+ * @version $Id$
+ */
+public class RenderRequestFactoryImpl
+    extends AbstractFactory
+    implements RenderRequestFactory, Serviceable, Disposable {
+
+    /** The service manager. */
+    protected ServiceManager manager;
+
+    /** The portal service. */
+    protected PortalService portalService;
+
+    /**
+     * @see org.apache.avalon.framework.activity.Disposable#dispose()
+     */
+    public void dispose() {
+        if ( this.manager != null ) {
+            this.manager.release(this.portalService);
+            this.portalService = null;
+            this.manager = null;
+        }
+    }
+
+    /**
+     * @see org.apache.avalon.framework.service.Serviceable#service(org.apache.avalon.framework.service.ServiceManager)
+     */
+    public void service(ServiceManager manager) throws ServiceException {
+        this.manager = manager;
+        this.portalService = (PortalService)this.manager.lookup(PortalService.ROLE);
+    }
+
+    /**
+     * @see org.apache.pluto.factory.RenderRequestFactory#getRenderRequest(org.apache.pluto.om.window.PortletWindow,
javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)
+     */
+    public RenderRequest getRenderRequest(PortletWindow       portletWindow,
+                                          HttpServletRequest  servletRequest,
+                                          HttpServletResponse servletResponse) {
+        RenderRequest renderRequest = new RenderRequestImpl( portletWindow,
+                                                             servletRequest,
+                                                             this.portalService.getComponentManager().getProfileManager().getUser());
+        return renderRequest;
+    }
+}

Propchange: cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/pluto/factory/RenderRequestFactoryImpl.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/pluto/factory/RenderRequestFactoryImpl.java
------------------------------------------------------------------------------
    svn:keywords = Id

Added: cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/pluto/factory/RenderRequestImpl.java
URL: http://svn.apache.org/viewcvs/cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/pluto/factory/RenderRequestImpl.java?rev=367589&view=auto
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/pluto/factory/RenderRequestImpl.java
(added)
+++ cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/pluto/factory/RenderRequestImpl.java
Tue Jan 10 04:49:33 2006
@@ -0,0 +1,55 @@
+/*
+ * Copyright 2005 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.factory;
+
+import javax.servlet.http.HttpServletRequest;
+
+import org.apache.cocoon.portal.profile.PortalUser;
+import org.apache.pluto.om.window.PortletWindow;
+
+/**
+ * Implementation for the render request object.
+ *
+ * @version $Id$
+ */
+public class RenderRequestImpl
+    extends org.apache.pluto.core.impl.RenderRequestImpl {
+
+    /** The portal user. */
+    protected final PortalUser user;
+
+    public RenderRequestImpl(PortletWindow window, HttpServletRequest req, PortalUser user)
{
+        super(window, req);
+        this.user = user;
+    }
+
+    /**
+     * @see org.apache.pluto.core.impl.PortletRequestImpl#getRemoteUser()
+     */
+    public String getRemoteUser() {
+        return this.user.getUserName();
+    }
+
+    /**
+     * @see org.apache.pluto.core.impl.PortletRequestImpl#isUserInRole(java.lang.String)
+     */
+    public boolean isUserInRole(String role) {
+        if ( this.user.isUserInRole(role) ) {
+            return true;
+        }
+        return super.isUserInRole(role);
+    }
+}

Propchange: cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/pluto/factory/RenderRequestImpl.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/pluto/factory/RenderRequestImpl.java
------------------------------------------------------------------------------
    svn:keywords = Id

Modified: cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/pluto/services/factory/FactoryManagerServiceImpl.java
URL: http://svn.apache.org/viewcvs/cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/pluto/services/factory/FactoryManagerServiceImpl.java?rev=367589&r1=367588&r2=367589&view=diff
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/pluto/services/factory/FactoryManagerServiceImpl.java
(original)
+++ cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/pluto/services/factory/FactoryManagerServiceImpl.java
Tue Jan 10 04:49:33 2006
@@ -43,21 +43,21 @@
 import org.apache.avalon.framework.service.ServiceException;
 import org.apache.avalon.framework.service.ServiceManager;
 import org.apache.avalon.framework.service.Serviceable;
+import org.apache.cocoon.portal.pluto.factory.ActionRequestFactoryImpl;
 import org.apache.cocoon.portal.pluto.factory.ControllerFactoryImpl;
 import org.apache.cocoon.portal.pluto.factory.ObjectIDFactoryImpl;
 import org.apache.cocoon.portal.pluto.factory.PortletInvokerFactoryImpl;
 import org.apache.cocoon.portal.pluto.factory.PortletPreferencesFactoryImpl;
+import org.apache.cocoon.portal.pluto.factory.RenderRequestFactoryImpl;
 import org.apache.cocoon.servlet.CocoonServlet;
 import org.apache.pluto.factory.Factory;
 import org.apache.pluto.factory.ObjectIDFactory;
-import org.apache.pluto.factory.impl.ActionRequestFactoryImpl;
 import org.apache.pluto.factory.impl.ActionResponseFactoryImpl;
 import org.apache.pluto.factory.impl.PortalContextFactoryImpl;
 import org.apache.pluto.factory.impl.PortletConfigFactoryImpl;
 import org.apache.pluto.factory.impl.PortletContextFactoryImpl;
 import org.apache.pluto.factory.impl.PortletSessionFactoryImpl;
 import org.apache.pluto.factory.impl.PortletURLFactoryImpl;
-import org.apache.pluto.factory.impl.RenderRequestFactoryImpl;
 import org.apache.pluto.factory.impl.RenderResponseFactoryImpl;
 import org.apache.pluto.invoker.PortletInvoker;
 import org.apache.pluto.om.ControllerFactory;

Modified: cocoon/branches/BRANCH_2_1_X/status.xml
URL: http://svn.apache.org/viewcvs/cocoon/branches/BRANCH_2_1_X/status.xml?rev=367589&r1=367588&r2=367589&view=diff
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/status.xml (original)
+++ cocoon/branches/BRANCH_2_1_X/status.xml Tue Jan 10 04:49:33 2006
@@ -179,6 +179,9 @@
   <release version="@version@" date="@date@">
 -->
   <release version="2.1.9" date="TBD">
+   <action dev="CZ" type="add">
+      Portal Block: Provide user name to portlets.
+    </action> 
    <action dev="CZ" type="fix">
       Portal Block: Make wsrp event adapter thread safe, fix error in disposing wsrp
                     producer and update portals bridges to 1.0.



Mime
View raw message