001: /******************************************************************************
002: * JBoss, a division of Red Hat *
003: * Copyright 2006, Red Hat Middleware, LLC, and individual *
004: * contributors as indicated by the @authors tag. See the *
005: * copyright.txt in the distribution for a full listing of *
006: * individual contributors. *
007: * *
008: * This is free software; you can redistribute it and/or modify it *
009: * under the terms of the GNU Lesser General Public License as *
010: * published by the Free Software Foundation; either version 2.1 of *
011: * the License, or (at your option) any later version. *
012: * *
013: * This software is distributed in the hope that it will be useful, *
014: * but WITHOUT ANY WARRANTY; without even the implied warranty of *
015: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
016: * Lesser General Public License for more details. *
017: * *
018: * You should have received a copy of the GNU Lesser General Public *
019: * License along with this software; if not, write to the Free *
020: * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
021: * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
022: ******************************************************************************/package org.jboss.portlet;
023:
024: import org.jboss.portal.api.node.PortalNode;
025: import org.jboss.portal.core.aspects.controller.node.Navigation;
026: import org.jboss.portal.core.controller.ControllerContext;
027: import org.jboss.portal.core.controller.portlet.ControllerUserContext;
028: import org.jboss.portal.identity.User;
029: import org.jboss.portal.portlet.impl.jsr168.api.ActionRequestImpl;
030: import org.jboss.portal.portlet.invocation.ActionInvocation;
031: import org.jboss.portal.portlet.invocation.PortletInvocation;
032: import org.jboss.portlet.util.Parameters;
033:
034: import javax.portlet.PortletPreferences;
035:
036: /**
037: * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
038: * @version $Revision: 8786 $
039: */
040: public class JBossActionRequest extends ActionRequestImpl {
041:
042: /** The parameters. */
043: private Parameters blah;
044:
045: /** . */
046: private ControllerContext controllerContext;
047:
048: public JBossActionRequest(ActionInvocation invocation) {
049: super (invocation);
050:
051: //
052: this .controllerContext = (ControllerContext) invocation
053: .getAttribute(PortletInvocation.INVOCATION_SCOPE,
054: "controller_context");
055: this .blah = null;
056: }
057:
058: public ControllerContext getControllerContext() {
059: if (controllerContext == null) {
060: throw new IllegalStateException("No controller context");
061: }
062: return controllerContext;
063: }
064:
065: public PortalNode getPortalNode() {
066: return Navigation.getCurrentNode();
067: }
068:
069: /** Returns the current authenticated user or null if the user is not authenticated */
070: public User getUser() {
071: if (userContext instanceof ControllerUserContext) {
072: return ((ControllerUserContext) userContext).getUser();
073: } else {
074: return null;
075: }
076: }
077:
078: public Parameters getParameters() {
079: if (blah == null) {
080: blah = new Parameters(getParameterMap());
081: }
082: return blah;
083: }
084:
085: protected PortletPreferences createPreferences() {
086: // Component container = instance.getComponent();
087: // ProxyPreferenceSetPlugin plugin = (ProxyPreferenceSetPlugin)container.getPlugin("PROXY");
088: // if (plugin != null)
089: // {
090: // PreferencesValidator validator = container.getPreferencesValidator();
091: // ProxyInfo proxyCtor = container.getPreferenceProxyConstructor();
092: // return new JBossPortletPreferences(
093: // propertySets,
094: // validator,
095: // PortletPreferencesImpl.RENDER,
096: // proxyCtor);
097: // }
098: return null;
099: }
100: }
|