portals-jetspeed-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dlest...@apache.org
Subject svn commit: r209328 [7/14] - in /portals/jetspeed-2/trunk/components/portal: src/ src/java/ src/java/org/ src/java/org/apache/ src/java/org/apache/jetspeed/ src/java/org/apache/jetspeed/aggregator/ src/java/org/apache/jetspeed/aggregator/impl/ src/java...
Date Tue, 05 Jul 2005 21:55:50 GMT
Added: portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/pipeline/valve/AbstractValve.java
URL: http://svn.apache.org/viewcvs/portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/pipeline/valve/AbstractValve.java?rev=209328&view=auto
==============================================================================
--- portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/pipeline/valve/AbstractValve.java (added)
+++ portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/pipeline/valve/AbstractValve.java Tue Jul  5 14:55:37 2005
@@ -0,0 +1,38 @@
+/*
+ * Copyright 2000-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.
+ */
+package org.apache.jetspeed.pipeline.valve;
+
+import org.apache.jetspeed.request.RequestContext;
+import org.apache.jetspeed.pipeline.PipelineException;
+
+/**
+ * Valve that can be used as the basis of Valve implementations.
+ *
+ * @author <a href="mailto:jvanzyl@apache.org">Jason van Zyl</a>
+ * @version $Id: AbstractValve.java 186726 2004-06-05 05:13:09Z taylor $
+ */
+public abstract class AbstractValve 
+    implements Valve
+{
+    public abstract void invoke(RequestContext request, ValveContext context)
+        throws PipelineException;
+
+    public void initialize()
+        throws PipelineException
+    {
+    }
+
+}
\ No newline at end of file

Added: portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/pipeline/valve/ActionValve.java
URL: http://svn.apache.org/viewcvs/portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/pipeline/valve/ActionValve.java?rev=209328&view=auto
==============================================================================
--- portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/pipeline/valve/ActionValve.java (added)
+++ portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/pipeline/valve/ActionValve.java Tue Jul  5 14:55:37 2005
@@ -0,0 +1,42 @@
+/*
+ * Copyright 2000-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.
+ */
+package org.apache.jetspeed.pipeline.valve;
+
+/**
+ * Check if PortletAction needs to be processed and process it, if
+ * required
+ *
+ * <br/>
+ * Read from the ValveContext:
+ * <ul>
+ * </ul>
+ *
+ * <br/>
+ * Written into the ValveContext:
+ * <ul>
+ * </ul>
+ *
+ * <br>
+ * Note: The primary purpose of this interface is primary for documention.
+ * 
+ * @author <a href="mailto:paul@apache.org">Paul Spencer</a>
+ * @version $Id: ActionValve.java 186726 2004-06-05 05:13:09Z taylor $
+ *
+ * @see ValveContext
+ */
+public interface ActionValve extends Valve
+{
+}

Added: portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/pipeline/valve/AggregateValve.java
URL: http://svn.apache.org/viewcvs/portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/pipeline/valve/AggregateValve.java?rev=209328&view=auto
==============================================================================
--- portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/pipeline/valve/AggregateValve.java (added)
+++ portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/pipeline/valve/AggregateValve.java Tue Jul  5 14:55:37 2005
@@ -0,0 +1,42 @@
+/*
+ * Copyright 2000-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.
+ */
+package org.apache.jetspeed.pipeline.valve;
+
+/**
+ * Invokes all Layout components in render mode to aggregate the
+ * generated contents and send result to client.
+ *
+ * <br/>
+ * Read from the ValveContext:
+ * <ul>
+ * </ul>
+ *
+ * <br/>
+ * Written into the ValveContext:
+ * <ul>
+ * </ul>
+ *
+ * <br>
+ * Note: The primary purpose of this interface is primary for documention.
+ * 
+ * @author <a href="mailto:paul@apache.org">Paul Spencer</a>
+ * @version $Id: AggregateValve.java 186726 2004-06-05 05:13:09Z taylor $
+ *
+ * @see ValveContext
+ */
+public interface AggregateValve extends Valve
+{
+}

Added: portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/pipeline/valve/CapabilityValve.java
URL: http://svn.apache.org/viewcvs/portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/pipeline/valve/CapabilityValve.java?rev=209328&view=auto
==============================================================================
--- portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/pipeline/valve/CapabilityValve.java (added)
+++ portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/pipeline/valve/CapabilityValve.java Tue Jul  5 14:55:37 2005
@@ -0,0 +1,44 @@
+/*
+ * Copyright 2000-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.
+ */
+package org.apache.jetspeed.pipeline.valve;
+
+/**
+ * Identifies the browser and add a Capability object to RequestContext
+ *
+ * <br/>
+ * Read from the ValveContext:
+ * <ul>
+ * </ul>
+ *
+ * <br/>
+ * Written into the ValveContext:
+ * <ul>
+ * <li>Capability</li>
+ * </ul>
+ *
+ * <br>
+ * Note: The primary purpose of this interface is primary for documention.
+ * 
+ * @author <a href="mailto:paul@apache.org">Paul Spencer</a>
+ * @author <a href="mailto:roger.ruttimann@earthlink.net">Roger Ruttimann</a>
+ * 
+ * @version $Id: CapabilityValve.java 186726 2004-06-05 05:13:09Z taylor $
+ *
+ * @see ValveContext
+ */
+public interface CapabilityValve extends Valve
+{
+}

Added: portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/pipeline/valve/CleanupValve.java
URL: http://svn.apache.org/viewcvs/portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/pipeline/valve/CleanupValve.java?rev=209328&view=auto
==============================================================================
--- portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/pipeline/valve/CleanupValve.java (added)
+++ portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/pipeline/valve/CleanupValve.java Tue Jul  5 14:55:37 2005
@@ -0,0 +1,42 @@
+/*
+ * Copyright 2000-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.
+ */
+package org.apache.jetspeed.pipeline.valve;
+
+/**
+ * Return all recycle objects in the ValveContext.  This includes
+ * returning poolable object.
+ *
+ * <br/>
+ * Read from the ValveContext:
+ * <ul>
+ * </ul>
+ *
+ * <br/>
+ * Written into the ValveContext:
+ * <ul>
+ * </ul>
+ *
+ * <br>
+ * Note: The primary purpose of this interface is primary for documention.
+ * 
+ * @author <a href="mailto:paul@apache.org">Paul Spencer</a>
+ * @version $Id: CleanupValve.java 186726 2004-06-05 05:13:09Z taylor $
+ *
+ * @see ValveContext
+ */
+public interface CleanupValve extends Valve
+{
+}

Added: portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/pipeline/valve/ContainerValve.java
URL: http://svn.apache.org/viewcvs/portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/pipeline/valve/ContainerValve.java?rev=209328&view=auto
==============================================================================
--- portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/pipeline/valve/ContainerValve.java (added)
+++ portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/pipeline/valve/ContainerValve.java Tue Jul  5 14:55:37 2005
@@ -0,0 +1,42 @@
+/*
+ * Copyright 2000-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.
+ */
+package org.apache.jetspeed.pipeline.valve;
+
+/**
+ * Initialize the RequestContext and session if required.
+ *
+ * <br/>
+ * Read from the ValveContext:
+ * <i>nothing</i>
+ *
+ * <br/>
+ * Written into the ValveContext:
+ * <ul>
+ * <li>RequestContext</li>
+ * <li>Session (If required)</li>
+ * </ul>
+ *
+ * <br>
+ * Note: The primary purpose of this interface is primary for documention.
+ * 
+ * @author <a href="mailto:paul@apache.org">Paul Spencer</a>
+ * @version $Id: ContainerValve.java 186726 2004-06-05 05:13:09Z taylor $
+ *
+ * @see ValveContext
+ */
+public interface ContainerValve extends Valve
+{
+}

Added: portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/pipeline/valve/ContentValve.java
URL: http://svn.apache.org/viewcvs/portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/pipeline/valve/ContentValve.java?rev=209328&view=auto
==============================================================================
--- portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/pipeline/valve/ContentValve.java (added)
+++ portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/pipeline/valve/ContentValve.java Tue Jul  5 14:55:37 2005
@@ -0,0 +1,41 @@
+/*
+ * Copyright 2000-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.
+ */
+package org.apache.jetspeed.pipeline.valve;
+
+/**
+ * Render all marked portlet and store RenderResponse in RequestContext.
+ *
+ * <br/>
+ * Read from the ValveContext:
+ * <ul>
+ * </ul>
+ *
+ * <br/>
+ * Written into the ValveContext:
+ * <ul>
+ * </ul>
+ *
+ * <br>
+ * Note: The primary purpose of this interface is primary for documention.
+ * 
+ * @author <a href="mailto:paul@apache.org">Paul Spencer</a>
+ * @version $Id: ContentValve.java 186726 2004-06-05 05:13:09Z taylor $
+ *
+ * @see ValveContext
+ */
+public interface ContentValve extends Valve
+{
+}

Added: portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/pipeline/valve/LayoutValve.java
URL: http://svn.apache.org/viewcvs/portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/pipeline/valve/LayoutValve.java?rev=209328&view=auto
==============================================================================
--- portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/pipeline/valve/LayoutValve.java (added)
+++ portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/pipeline/valve/LayoutValve.java Tue Jul  5 14:55:37 2005
@@ -0,0 +1,42 @@
+/*
+ * Copyright 2000-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.
+ */
+package org.apache.jetspeed.pipeline.valve;
+
+/**
+ * Invokes all Layout components to mark all visible elements of 
+ * the Page.
+ *
+ * <br/>
+ * Read from the ValveContext:
+ * <ul>
+ * </ul>
+ *
+ * <br/>
+ * Written into the ValveContext:
+ * <ul>
+ * </ul>
+ *
+ * <br>
+ * Note: The primary purpose of this interface is primary for documention.
+ * 
+ * @author <a href="mailto:paul@apache.org">Paul Spencer</a>
+ * @version $Id: LayoutValve.java 186726 2004-06-05 05:13:09Z taylor $
+ *
+ * @see ValveContext
+ */
+public interface LayoutValve extends Valve
+{
+}

Added: portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/pipeline/valve/LocalizationValve.java
URL: http://svn.apache.org/viewcvs/portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/pipeline/valve/LocalizationValve.java?rev=209328&view=auto
==============================================================================
--- portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/pipeline/valve/LocalizationValve.java (added)
+++ portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/pipeline/valve/LocalizationValve.java Tue Jul  5 14:55:37 2005
@@ -0,0 +1,26 @@
+/*
+ * Copyright 2000-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.
+ */
+package org.apache.jetspeed.pipeline.valve;
+
+/**
+ * LocalizationValve
+ *
+ * @author <a href="mailto:taylor@apache.org">David Sean Taylor</a>
+ * @version $Id: LocalizationValve.java 186726 2004-06-05 05:13:09Z taylor $
+ */
+public interface LocalizationValve extends Valve
+{
+}

Added: portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/pipeline/valve/LoginValidationValve.java
URL: http://svn.apache.org/viewcvs/portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/pipeline/valve/LoginValidationValve.java?rev=209328&view=auto
==============================================================================
--- portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/pipeline/valve/LoginValidationValve.java (added)
+++ portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/pipeline/valve/LoginValidationValve.java Tue Jul  5 14:55:37 2005
@@ -0,0 +1,38 @@
+/*
+ * Copyright 2000-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.
+ */
+package org.apache.jetspeed.pipeline.valve;
+
+/**
+ * Checks if a login attempt failed and determines the cause.
+ * <br/>
+ * Read from the ValveContext:
+ * <ul>
+ * </ul>
+ *
+ * <br/>
+ * Written into the ValveContext:
+ * <ul>
+ * </ul>
+ *
+ * <br>
+ * Note: The primary purpose of this interface is primary for documention.
+ * 
+ * @author <a href="mailto:ate@apache.org">Ate Douma</a>
+ * @version $Id: LoginValidationValve.java 188531 2005-04-24 12:41:43Z ate $
+ */
+public interface LoginValidationValve extends Valve
+{
+}

Added: portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/pipeline/valve/PageProfilerValve.java
URL: http://svn.apache.org/viewcvs/portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/pipeline/valve/PageProfilerValve.java?rev=209328&view=auto
==============================================================================
--- portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/pipeline/valve/PageProfilerValve.java (added)
+++ portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/pipeline/valve/PageProfilerValve.java Tue Jul  5 14:55:37 2005
@@ -0,0 +1,43 @@
+/*
+ * Copyright 2000-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.
+ */
+package org.apache.jetspeed.pipeline.valve;
+
+/**
+ * Determine the page to display and add it to the RequestContext
+ *
+ * <br/>
+ * Read from the ValveContext:
+ * <ul>
+ * </ul>
+ *
+ * <br/>
+ * Written into the ValveContext:
+ * <ul>
+ * </ul>
+ *
+ * <br>
+ * Note: The primary purpose of this interface is primary for documention.
+ * 
+ * @author <a href="mailto:paul@apache.org">Paul Spencer</a>
+ * @version $Id: PageProfilerValve.java 202098 2005-06-27 23:25:28Z taylor $
+ *
+ * @see ValveContext
+ */
+public interface PageProfilerValve extends Valve
+{
+    String PROFILE_LOCATOR_REQUEST_ATTR_KEY = "org.apache.jetspeed.profiler.ProfileLocator";
+    String PROFILE_LOCATORS_PER_PRINCIPAL = "org.apache.jetspeed.profiler.ProfileLocatorsPrincipal";
+}

Added: portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/pipeline/valve/PasswordCredentialValve.java
URL: http://svn.apache.org/viewcvs/portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/pipeline/valve/PasswordCredentialValve.java?rev=209328&view=auto
==============================================================================
--- portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/pipeline/valve/PasswordCredentialValve.java (added)
+++ portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/pipeline/valve/PasswordCredentialValve.java Tue Jul  5 14:55:37 2005
@@ -0,0 +1,41 @@
+/*
+ * Copyright 2000-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.
+ */
+package org.apache.jetspeed.pipeline.valve;
+
+/**
+ * Checks the PasswordCredential (only once) after a User is logged in
+ * and redirects to a Change Password page if necessary.
+ * <br/>
+ * Read from the ValveContext:
+ * <ul>
+ * </ul>
+ *
+ * <br/>
+ * Written into the ValveContext:
+ * <ul>
+ * </ul>
+ *
+ * <br>
+ * Note: The primary purpose of this interface is primary for documention.
+ * 
+ * @author <a href="mailto:ate@apache.org">Ate Douma</a>
+ * @version $Id: PasswordCredentialValve.java 187979 2004-11-25 02:25:59Z ate $
+ * 
+ * @see PasswordCredentialContext
+ */
+public interface PasswordCredentialValve extends Valve
+{
+}

Added: portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/pipeline/valve/SecurityValve.java
URL: http://svn.apache.org/viewcvs/portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/pipeline/valve/SecurityValve.java?rev=209328&view=auto
==============================================================================
--- portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/pipeline/valve/SecurityValve.java (added)
+++ portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/pipeline/valve/SecurityValve.java Tue Jul  5 14:55:37 2005
@@ -0,0 +1,42 @@
+/*
+ * Copyright 2000-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.
+ */
+package org.apache.jetspeed.pipeline.valve;
+
+/**
+ * Authenticates the User or redirects to Login if necessary, add
+ * authenticated Subject to RequestContext
+ *
+ * <br/>
+ * Read from the ValveContext:
+ * <ul>
+ * </ul>
+ *
+ * <br/>
+ * Written into the ValveContext:
+ * <ul>
+ * </ul>
+ *
+ * <br>
+ * Note: The primary purpose of this interface is primary for documention.
+ * 
+ * @author <a href="mailto:taylor@apache.org">David Sean Taylor</a>
+ * @version $Id: SecurityValve.java 186726 2004-06-05 05:13:09Z taylor $
+ * 
+ * @see ValveContext
+ */
+public interface SecurityValve extends Valve
+{
+}

Added: portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/pipeline/valve/UserProfilerValve.java
URL: http://svn.apache.org/viewcvs/portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/pipeline/valve/UserProfilerValve.java?rev=209328&view=auto
==============================================================================
--- portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/pipeline/valve/UserProfilerValve.java (added)
+++ portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/pipeline/valve/UserProfilerValve.java Tue Jul  5 14:55:37 2005
@@ -0,0 +1,42 @@
+/*
+ * Copyright 2000-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.
+ */
+package org.apache.jetspeed.pipeline.valve;
+
+/**
+ * Authenticates the User or redirects to Login if necessary, add
+ * authenticated User to RequestContext
+ *
+ * <br/>
+ * Read from the ValveContext:
+ * <ul>
+ * </ul>
+ *
+ * <br/>
+ * Written into the ValveContext:
+ * <ul>
+ * </ul>
+ *
+ * <br>
+ * Note: The primary purpose of this interface is primary for documention.
+ * 
+ * @author <a href="mailto:paul@apache.org">Paul Spencer</a>
+ * @version $Id: UserProfilerValve.java 186726 2004-06-05 05:13:09Z taylor $
+ *
+ * @see ValveContext
+ */
+public interface UserProfilerValve extends Valve
+{
+}

Added: portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/pipeline/valve/Valve.java
URL: http://svn.apache.org/viewcvs/portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/pipeline/valve/Valve.java?rev=209328&view=auto
==============================================================================
--- portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/pipeline/valve/Valve.java (added)
+++ portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/pipeline/valve/Valve.java Tue Jul  5 14:55:37 2005
@@ -0,0 +1,44 @@
+/*
+ * Copyright 2000-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.
+ */
+package org.apache.jetspeed.pipeline.valve;
+
+import org.apache.jetspeed.request.RequestContext;
+import org.apache.jetspeed.pipeline.PipelineException;
+
+/**
+ * NOTE: This class will be deprecated once we merge with Summit
+ *
+ * General valve interface.  The actual valve interface(s) should be 
+ * extended by the implementing class.
+ *
+ * @author <a href="mailto:david@bluesunrise.com">David Sean Taylor</a>
+ * @version $Id: Valve.java 186726 2004-06-05 05:13:09Z taylor $
+ *
+ * @see org.apache.jetspeed.pipeline.JetspeedPipeline
+ * @see org.apache.jetspeed.pipeline.Pipeline
+ */
+public interface Valve
+{
+    public void invoke(RequestContext request, ValveContext context)
+        throws PipelineException;
+
+    /**
+     * Initialize the valve before using in a pipeline.
+     */
+    public void initialize()
+        throws PipelineException;
+
+}
\ No newline at end of file

Added: portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/pipeline/valve/ValveContext.java
URL: http://svn.apache.org/viewcvs/portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/pipeline/valve/ValveContext.java?rev=209328&view=auto
==============================================================================
--- portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/pipeline/valve/ValveContext.java (added)
+++ portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/pipeline/valve/ValveContext.java Tue Jul  5 14:55:37 2005
@@ -0,0 +1,52 @@
+/*
+ * Copyright 2000-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.
+ */
+
+package org.apache.jetspeed.pipeline.valve;
+
+import org.apache.jetspeed.request.RequestContext;
+import org.apache.jetspeed.pipeline.PipelineException;
+
+/**
+ * NOTE: This class will be deprecated once we merge with Summit
+ *
+ *
+ * @author <a href="mailto:david@bluesunrise.com">David Sean Taylor</a>
+ * @version $Id: ValveContext.java 186726 2004-06-05 05:13:09Z taylor $
+ */
+public interface ValveContext
+{
+    /**
+     * <p>Cause the <code>invoke()</code> method of the next Valve
+     * that is part of the Pipeline currently being processed (if any)
+     * to be executed, passing on the specified request and response
+     * objects plus this <code>ValveContext</code> instance.
+     * Exceptions thrown by a subsequently executed Valve will be
+     * passed on to our caller.</p>
+     *
+     * <p>If there are no more Valves to be executed, execution of
+     * this method will result in a no op.</p>
+     *
+     * @param data The run-time information, including the servlet
+     * request and response we are processing.
+     *
+     * @exception IOException Thrown by a subsequent Valve.
+     * @exception SummitException Thrown by a subsequent Valve.
+     * @exception SummitException No further Valves configured in the
+     * Pipeline currently being processed.
+     */
+    public void invokeNext(RequestContext request)
+        throws PipelineException;
+}

Added: portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/pipeline/valve/impl/ActionValveImpl.java
URL: http://svn.apache.org/viewcvs/portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/pipeline/valve/impl/ActionValveImpl.java?rev=209328&view=auto
==============================================================================
--- portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/pipeline/valve/impl/ActionValveImpl.java (added)
+++ portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/pipeline/valve/impl/ActionValveImpl.java Tue Jul  5 14:55:37 2005
@@ -0,0 +1,132 @@
+/*
+ * Copyright 2000-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.
+ */
+package org.apache.jetspeed.pipeline.valve.impl;
+
+import java.io.IOException;
+
+import javax.portlet.PortletException;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.jetspeed.PortalReservedParameters;
+import org.apache.jetspeed.pipeline.PipelineException;
+import org.apache.jetspeed.pipeline.valve.AbstractValve;
+import org.apache.jetspeed.pipeline.valve.ActionValve;
+import org.apache.jetspeed.pipeline.valve.ValveContext;
+import org.apache.jetspeed.request.RequestContext;
+import org.apache.pluto.PortletContainer;
+import org.apache.pluto.PortletContainerException;
+import org.apache.pluto.om.window.PortletWindow;
+
+/**
+ * <p>
+ * ActionValveImpl
+ * </p>
+ * 
+ * Default implementation of the ActionValve interface.  Expects to be
+ * called after the ContainerValve has set up the appropriate action window
+ * within the request context.  This should come before ANY rendering takes
+ * place.
+ * 
+ * @author <a href="mailto:weaver@apache.org">Scott T. Weaver</a>
+ * @version $Id: ActionValveImpl.java 188147 2005-01-04 16:19:42Z weaver $
+ *
+ */
+public class ActionValveImpl extends AbstractValve implements ActionValve
+{
+
+    private static final Log log = LogFactory.getLog(ActionValveImpl.class);
+    private PortletContainer container;
+    
+    public ActionValveImpl(PortletContainer container)
+    {
+        this.container = container;
+    }
+
+    /**
+     * @see org.apache.jetspeed.pipeline.valve.Valve#invoke(org.apache.jetspeed.request.RequestContext, org.apache.jetspeed.pipeline.valve.ValveContext)
+     */
+    public void invoke(RequestContext request, ValveContext context) throws PipelineException
+    {     
+        boolean responseCommitted = false;
+        try
+        {            
+            PortletWindow actionWindow = request.getActionWindow();
+            if (actionWindow != null)
+            {
+                HttpServletResponse response = request.getResponseForWindow(actionWindow);
+                HttpServletRequest requestForWindow = request.getRequestForWindow(actionWindow);
+                requestForWindow.setAttribute(PortalReservedParameters.REQUEST_CONTEXT_ATTRIBUTE, request);
+                container.processPortletAction(
+                    actionWindow,
+                    requestForWindow,
+                    response);
+                // The container redirects the client after PortletAction processing
+                // so there is no need to continue the pipeline
+                responseCommitted = response.isCommitted();
+                request.setAttribute(PortalReservedParameters.PIPELINE, null); // clear the pipeline
+            }
+        }
+        catch (PortletContainerException e)
+        {
+            log.fatal("Unable to retrieve portlet container!", e);
+            throw new PipelineException("Unable to retrieve portlet container!", e);
+        }
+        catch (PortletException e)
+        {
+            log.warn("Unexpected PortletException in ActionValveImpl", e);
+            //  throw new PipelineException("Unexpected PortletException in ActionValveImpl", e);
+
+        }
+        catch (IOException e)
+        {
+            log.error("Unexpected IOException in ActionValveImpl", e);
+            // throw new PipelineException("Unexpected IOException in ActionValveImpl", e);
+        }
+        catch (IllegalStateException e)
+        {
+            log.error("Illegal State Exception. Response was written to in Action Phase", e);
+            responseCommitted = true;
+        }
+        finally
+        {
+            // Check if an action was processed and if its response has been committed
+            // (Pluto will redirect the client after PorletAction processing)
+            if ( responseCommitted )
+            {
+                log.info("Action processed and response committed (pipeline processing stopped)");
+            }
+            else
+            {
+                // Pass control to the next Valve in the Pipeline
+                context.invokeNext(request);
+            }
+        }
+
+    }
+
+    /**
+     * @see java.lang.Object#toString()
+     */
+    public String toString()
+    {
+        // TODO Auto-generated method stub
+        return "ActionValveImpl";
+    }
+
+}

Added: portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/pipeline/valve/impl/CleanupValveImpl.java
URL: http://svn.apache.org/viewcvs/portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/pipeline/valve/impl/CleanupValveImpl.java?rev=209328&view=auto
==============================================================================
--- portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/pipeline/valve/impl/CleanupValveImpl.java (added)
+++ portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/pipeline/valve/impl/CleanupValveImpl.java Tue Jul  5 14:55:37 2005
@@ -0,0 +1,97 @@
+/*
+ * Copyright 2000-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.
+ */
+package org.apache.jetspeed.pipeline.valve.impl;
+
+import java.util.Stack;
+
+import javax.servlet.RequestDispatcher;
+import javax.servlet.http.HttpServletRequest;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.jetspeed.pipeline.PipelineException;
+import org.apache.jetspeed.pipeline.valve.AbstractValve;
+import org.apache.jetspeed.pipeline.valve.CleanupValve;
+import org.apache.jetspeed.pipeline.valve.ValveContext;
+import org.apache.jetspeed.request.RequestContext;
+
+/**
+ * <p>
+ * CleanupValveImpl
+ * </p>
+ * 
+ * All this valve does right now is look for JSP pages that were
+ * pushed onto the <code>org.apache.jetspeed.renderStack</code>
+ * request attribute, and attempts to includde them.
+ * 
+ * @author <a href="mailto:weaver@apache.org">Scott T. Weaver</a>
+ * @version $Id: CleanupValveImpl.java 187906 2004-11-07 18:43:35Z taylor $
+ *
+ */
+public class CleanupValveImpl extends AbstractValve implements CleanupValve
+{
+
+    public static final String RENDER_STACK_ATTR = "org.apache.jetspeed.renderStack";
+
+    private static final Log log = LogFactory.getLog(CleanupValveImpl.class);
+
+    
+    public CleanupValveImpl()
+    {
+    }
+
+    /**
+     * @see org.apache.jetspeed.pipeline.valve.Valve#invoke(org.apache.jetspeed.request.RequestContext, org.apache.jetspeed.pipeline.valve.ValveContext)
+     */
+    public void invoke(RequestContext request, ValveContext context) throws PipelineException
+    {
+
+        // Complete any renderings that are on the rendering stack 
+
+        // TODO: we should abstract the rendering as we will
+        // want to eventually support other types of templates
+        // other than JSPs.
+        HttpServletRequest httpRequest = request.getRequest();
+        Stack renderStack = (Stack) httpRequest.getAttribute(RENDER_STACK_ATTR);
+        String fragment = null;
+        try
+        {
+            if (renderStack != null)
+            {
+                while (!renderStack.empty())
+                {
+                    fragment = (String) renderStack.pop();
+                    RequestDispatcher rd = httpRequest.getRequestDispatcher(fragment);
+                    rd.include(httpRequest, request.getResponse());
+                }
+            }
+        }
+        catch (Exception e)
+        {
+            log.error("CleanupValveImpl: failed while trying to render fragment " + fragment);
+            log.error("CleanupValveImpl: Unable to complete all renderings", e);
+        }        
+    }
+    
+    /**
+     * @see java.lang.Object#toString()
+     */
+    public String toString()
+    {
+        return "CleanupValveImpl";
+    }
+
+}

Added: portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/pipeline/valve/impl/VerySimpleLayoutValveImpl.java
URL: http://svn.apache.org/viewcvs/portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/pipeline/valve/impl/VerySimpleLayoutValveImpl.java?rev=209328&view=auto
==============================================================================
--- portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/pipeline/valve/impl/VerySimpleLayoutValveImpl.java (added)
+++ portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/pipeline/valve/impl/VerySimpleLayoutValveImpl.java Tue Jul  5 14:55:37 2005
@@ -0,0 +1,121 @@
+/*
+ * Copyright 2000-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.
+ */
+package org.apache.jetspeed.pipeline.valve.impl;
+
+import java.io.IOException;
+import java.io.PrintWriter;
+import java.util.Stack;
+
+import javax.servlet.RequestDispatcher;
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServletRequest;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.jetspeed.pipeline.PipelineException;
+import org.apache.jetspeed.pipeline.valve.AbstractValve;
+import org.apache.jetspeed.pipeline.valve.LayoutValve;
+import org.apache.jetspeed.pipeline.valve.ValveContext;
+import org.apache.jetspeed.request.RequestContext;
+
+/**
+ * <p>
+ * VerySimpleLayoutValveImpl
+ * </p>
+ * 
+ * Like the descriptions said this is a <b><i>very</i></b> simple
+ * layout valve and should not be used in production.
+ * 
+ * 
+ * @author <a href="mailto:weaver@apache.org">Scott T. Weaver</a>
+ * @version $Id: VerySimpleLayoutValveImpl.java 185962 2004-03-08 01:03:33Z jford $
+ *
+ */
+public class VerySimpleLayoutValveImpl extends AbstractValve implements LayoutValve
+{
+    private static final Log log = LogFactory.getLog(VerySimpleLayoutValveImpl.class);
+
+    /**
+     * @see org.apache.jetspeed.pipeline.valve.Valve#invoke(org.apache.jetspeed.request.RequestContext, org.apache.jetspeed.pipeline.valve.ValveContext)
+     */
+    public void invoke(RequestContext request, ValveContext context) throws PipelineException
+    {
+        try
+        {
+            log.info("Invoking the VerySimpleLayoutValve...");
+            HttpServletRequest httpRequest = request.getRequest();
+            RequestDispatcher rd = httpRequest.getRequestDispatcher("/pages/SimpleLayoutHeader.jsp");
+            rd.include(httpRequest, request.getResponse());
+
+            Stack renderStack = (Stack) httpRequest.getAttribute(CleanupValveImpl.RENDER_STACK_ATTR);
+            if (renderStack == null)
+            {
+                renderStack = new Stack();
+                httpRequest.setAttribute(CleanupValveImpl.RENDER_STACK_ATTR, renderStack);
+            }
+            renderStack.push("/pages/SimpleLayoutFooter.jsp");
+
+        }
+        catch (Exception e)
+        {
+            try
+            {
+                log.error("VerySimpleLayout: Unable to include layout header.  Layout not processed", e);
+                PrintWriter pw = request.getResponse().getWriter();
+                pw.write("VerySimpleLayoutFailed failed to include servlet resources. (details below) <br/>");
+                pw.write("Exception: " + e.getClass().getName() + " <br/>");
+                pw.write("Message: " + e.getMessage() + " <br/>");
+                writeStackTrace(e.getStackTrace(), pw);
+
+                if (e instanceof ServletException && ((ServletException) e).getRootCause() != null)
+                {
+                    Throwable rootCause = ((ServletException) e).getRootCause();
+                    pw.write("Root Cause: " + rootCause.getClass().getName() + " <br/>");
+                    pw.write("Message: " + rootCause.getMessage() + " <br/>");
+                    writeStackTrace(rootCause.getStackTrace(), pw);
+                }
+            }
+            catch (IOException e1)
+            {
+                // don't worry
+            }
+
+        }
+        finally
+        {
+            context.invokeNext(request);
+        }
+
+    }
+
+    /**
+     * @see java.lang.Object#toString()
+     */
+    public String toString()
+    {
+        return "VerySimpleLayoutValveImpl";
+    }
+
+    protected static final void writeStackTrace(StackTraceElement[] traceArray, PrintWriter pw)
+    {
+        pw.write("<p>Stack Trace: </p>");
+        for (int i = 0; i < traceArray.length; i++)
+        {
+            pw.write("&nbsp;&nbsp;&nbsp;" + traceArray[i].toString() + "<br />");
+        }
+    }
+
+}

Added: portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/profiler/impl/ProfilerValveImpl.java
URL: http://svn.apache.org/viewcvs/portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/profiler/impl/ProfilerValveImpl.java?rev=209328&view=auto
==============================================================================
--- portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/profiler/impl/ProfilerValveImpl.java (added)
+++ portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/profiler/impl/ProfilerValveImpl.java Tue Jul  5 14:55:37 2005
@@ -0,0 +1,183 @@
+/*
+ * Copyright 2000-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.
+ */
+package org.apache.jetspeed.profiler.impl;
+
+import java.io.IOException;
+import java.security.Principal;
+import java.util.HashMap;
+import java.util.Map;
+
+import javax.security.auth.Subject;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.jetspeed.om.page.psml.ContentPageImpl;
+import org.apache.jetspeed.page.PageManager;
+import org.apache.jetspeed.page.document.NodeNotFoundException;
+import org.apache.jetspeed.pipeline.PipelineException;
+import org.apache.jetspeed.pipeline.valve.AbstractValve;
+import org.apache.jetspeed.pipeline.valve.PageProfilerValve;
+import org.apache.jetspeed.pipeline.valve.ValveContext;
+import org.apache.jetspeed.profiler.ProfileLocator;
+import org.apache.jetspeed.profiler.ProfiledPageContext;
+import org.apache.jetspeed.profiler.Profiler;
+import org.apache.jetspeed.profiler.ProfilerException;
+import org.apache.jetspeed.request.RequestContext;
+import org.apache.jetspeed.security.SecurityHelper;
+import org.apache.jetspeed.security.UserPrincipal;
+
+/**
+ * ProfilerValveImpl
+ * 
+ * @author <a href="mailto:taylor@apache.org">David Sean Taylor </a>
+ * @version $Id: ProfilerValveImpl.java 202324 2005-06-29 07:12:27Z taylor $
+ */
+public class ProfilerValveImpl extends AbstractValve implements PageProfilerValve
+{
+    protected Log log = LogFactory.getLog(ProfilerValveImpl.class);   
+
+    public static final String PROFILED_PAGE_CONTEXT_ATTR_KEY = "org.apache.jetspeed.profiledPageContext";
+
+    private Profiler profiler;
+    private PageManager pageManager;
+   
+
+    public ProfilerValveImpl( Profiler profiler, PageManager pageManager )
+    {
+        this.profiler = profiler;
+        this.pageManager = pageManager;
+    }
+    
+ 
+    /*
+     * (non-Javadoc)
+     * 
+     * @see org.apache.jetspeed.pipeline.valve.Valve#invoke(org.apache.jetspeed.request.RequestContext,
+     *      org.apache.jetspeed.pipeline.valve.ValveContext)
+     */
+    public void invoke( RequestContext request, ValveContext context ) throws PipelineException
+    {
+        try
+        {
+            // get profiler locators for request subject/principal using the profiler
+            Subject subject = request.getSubject();
+            if (subject == null)
+            {
+                throw new ProfilerException("Missing subject for request: " + request.getPath());
+            }            
+            Principal principal = SecurityHelper.getBestPrincipal(subject, UserPrincipal.class);
+            if (principal == null)
+            {
+                throw new ProfilerException("Missing principal for request: " + request.getPath());
+            }
+            
+            Map locators = null;
+            String locatorName = (String)request.getAttribute(PROFILE_LOCATOR_REQUEST_ATTR_KEY);
+            if ( locatorName != null )
+            {
+                ProfileLocator locator = profiler.getProfile(request,locatorName);
+                if ( locator != null )
+                {
+                    locators = new HashMap();
+                    locators.put(ProfileLocator.PAGE_LOCATOR, locator);
+                }
+            }
+            
+            if ( locators ==  null )
+            {
+                // get all locators for the current user
+                locators = profiler.getProfileLocators(request, principal);
+            }
+
+            if (locators.size() == 0)
+            {
+                locators = profiler.getDefaultProfileLocators(request);                
+            }
+            
+            if (locators.size() == 0)
+            {
+                locators.put(ProfileLocator.PAGE_LOCATOR, profiler.getProfile(request, ProfileLocator.PAGE_LOCATOR));
+            }
+            
+            // get profiled page context using the profiler and page manager
+            ProfiledPageContext profiledPageContext = profiler.createProfiledPageContext(locators);
+            pageManager.computeProfiledPageContext(profiledPageContext);
+            if (profiledPageContext.getPage() == null)
+            {
+                throw new NodeNotFoundException("Unable to profile request: " + request.getPath());
+            }
+            
+            // set request page and profile locator
+            request.setPage(new ContentPageImpl(profiledPageContext.getPage()));
+            request.setProfileLocators(profiledPageContext.getLocators());
+
+            // return profiled page context in request attribute
+            HttpServletRequest httpRequest = request.getRequest();
+            httpRequest.setAttribute(PROFILED_PAGE_CONTEXT_ATTR_KEY, profiledPageContext);
+
+            // continue
+            context.invokeNext(request);
+        }
+        catch (SecurityException se)
+        {
+            if (request.getRequest().getUserPrincipal() == null &&
+                request.getPath() != null &&
+                !request.getPath().equals("/"))
+            {
+                try 
+                {
+                    request.getResponse().sendRedirect(request.getRequest().getContextPath());
+                }
+                catch (IOException ioe){}
+                return;
+            }
+            log.error(se.getMessage(), se);
+            try
+            {                
+                request.getResponse().sendError(HttpServletResponse.SC_FORBIDDEN, se.getMessage());
+            }
+            catch (IOException ioe)
+            {
+                log.error("Failed to invoke HttpServletReponse.sendError: " + ioe.getMessage(), ioe);
+            }
+        }
+        catch (NodeNotFoundException nnfe)
+        {
+            log.error(nnfe.getMessage(), nnfe);
+            try
+            {
+                request.getResponse().sendError(HttpServletResponse.SC_NOT_FOUND, nnfe.getMessage());
+            }
+            catch (IOException ioe)
+            {
+                log.error("Failed to invoke HttpServletReponse.sendError: " + ioe.getMessage(), ioe);
+            }
+        }
+        catch (Exception e)
+        {
+            log.error("Exception in request pipeline: " + e.getMessage(), e);
+            throw new PipelineException(e.toString(), e);
+        }
+    }
+
+    public String toString()
+    {
+        return "ProfilerValve";
+    }
+
+}

Added: portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/request/JetspeedRequestContext.java
URL: http://svn.apache.org/viewcvs/portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/request/JetspeedRequestContext.java?rev=209328&view=auto
==============================================================================
--- portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/request/JetspeedRequestContext.java (added)
+++ portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/request/JetspeedRequestContext.java Tue Jul  5 14:55:37 2005
@@ -0,0 +1,569 @@
+/*
+ * Copyright 2000-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.
+ */
+package org.apache.jetspeed.request;
+
+import java.util.ArrayList;
+import java.util.Enumeration;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.LinkedHashMap;
+import java.util.List;
+import java.util.Locale;
+import java.util.Map;
+import java.util.WeakHashMap;
+
+import javax.security.auth.Subject;
+import javax.servlet.ServletConfig;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.apache.jetspeed.Jetspeed;
+import org.apache.jetspeed.PortalReservedParameters;
+import org.apache.jetspeed.aggregator.ContentDispatcher;
+import org.apache.jetspeed.aggregator.ContentDispatcherCtrl;
+import org.apache.jetspeed.capabilities.CapabilityMap;
+import org.apache.jetspeed.container.url.PortalURL;
+import org.apache.jetspeed.engine.servlet.ServletRequestFactory;
+import org.apache.jetspeed.engine.servlet.ServletResponseFactory;
+import org.apache.jetspeed.om.common.MutableLanguage;
+import org.apache.jetspeed.om.impl.LanguageImpl;
+import org.apache.jetspeed.om.page.ContentPage;
+import org.apache.jetspeed.om.page.Fragment;
+import org.apache.jetspeed.userinfo.UserInfoManager;
+import org.apache.pluto.om.common.Language;
+import org.apache.pluto.om.common.LanguageSet;
+import org.apache.pluto.om.common.ObjectID;
+import org.apache.pluto.om.portlet.PortletDefinition;
+import org.apache.pluto.om.window.PortletWindow;
+
+/**
+ * Jetspeed Request Context is associated with each portal request. The request
+ * holds the contextual information shared amongst components in the portal,
+ * accessed through a common valve pipeline.
+ * 
+ * @author <a href="mailto:david@bluesunrise.com">David Sean Taylor </a>
+ * @version $Id: JetspeedRequestContext.java,v 1.19 2004/05/25 01:37:12 taylor
+ *          Exp $
+ */
+public class JetspeedRequestContext implements RequestContext
+{
+    private static final String ACTION_ERROR_ATTR = "org.apache.jetspeed.action.error:";
+    private HttpServletRequest request;
+    private HttpServletResponse response;
+    private ServletConfig config;
+    private Map locators;
+    private ContentPage page;
+    private PortletDefinition portletDefinition;
+    private Subject subject;
+    private Locale locale;
+    private ContentDispatcher dispatcher;
+
+    private CapabilityMap capabilityMap;
+    private String mimeType;
+    private String mediaType;
+    private PortalURL url;
+    private PortletWindow actionWindow;
+    private String encoding;
+    private String requestPath = null;
+    /** The user info manager. */
+    private UserInfoManager userInfoMgr;
+    private Map requestsForWindows;
+    private Map responsesForWindows;
+    
+    private Fragment rootFragment;
+    private Map fragments;
+    
+    /**
+     * Create a new Request Context
+     * 
+     * @param pc
+     * @param request
+     * @param response
+     * @param config
+     */
+    public JetspeedRequestContext( HttpServletRequest request, HttpServletResponse response, ServletConfig config,
+            UserInfoManager userInfoMgr )
+    {
+        this.request = request;
+        this.response = response;
+        this.config = config;
+        this.userInfoMgr = userInfoMgr;
+        this.requestsForWindows = new HashMap();
+        this.responsesForWindows = new HashMap();
+        this.fragments = new LinkedHashMap();
+
+        // set context in Request for later use
+        if (null != this.request)
+        {
+            this.request.setAttribute(PortalReservedParameters.REQUEST_CONTEXT_ATTRIBUTE, this);
+        }
+    }
+
+
+    public HttpServletRequest getRequest()
+    {
+        return request;
+    }
+
+    public HttpServletResponse getResponse()
+    {
+        return response;
+    }
+
+    public ServletConfig getConfig()
+    {
+        return config;
+    }
+
+    public Map getProfileLocators()
+    {
+        return locators;
+    }
+
+    public void setProfileLocators( Map locators )
+    {
+        this.locators = locators;
+    }
+
+    public ContentPage getPage()
+    {
+        return this.page;
+    }
+
+    public void setPage( ContentPage page )
+    {
+        this.page = page;
+    }
+
+    public PortletDefinition getPortletDefinition()
+    {
+        return portletDefinition;
+    }
+
+    public void setPortletDefinition( PortletDefinition portletDefinition )
+    {
+        this.portletDefinition = portletDefinition;
+    }
+
+    public ContentDispatcher getContentDispatcher()
+    {
+        return dispatcher;
+    }
+
+    public void setContentDispatcher( ContentDispatcher dispatcher )
+    {
+        this.dispatcher = dispatcher;
+    }
+
+    /**
+     * get the Capability Map
+     *  
+     */
+    public CapabilityMap getCapabilityMap()
+    {
+        return this.capabilityMap;
+    }
+
+    /**
+     * Set the Mimetype. Used by the CapabilityValve
+     * 
+     * @param mimeType
+     */
+    public void setMimeType( String mimeType )
+    {
+        this.mimeType = mimeType;
+    }
+
+    /**
+     * get the mimeType for the request
+     *  
+     */
+    public String getMimeType()
+    {
+        return this.mimeType;
+    }
+
+    /**
+     * Set the mediaType. Used by the CapabilityValve
+     * 
+     * @param mediaType
+     */
+    public void setMediaType( String mediaType )
+    {
+        this.mediaType = mediaType;
+    }
+
+    /**
+     * get the Media Type
+     *  
+     */
+    public String getMediaType()
+    {
+        return this.mediaType;
+    }
+
+    /**
+     * Get the target Portlet Action Window
+     * 
+     * @return PortletWindow The target portlet window
+     */
+    public PortletWindow getActionWindow()
+    {
+        return actionWindow;
+    }
+
+    /**
+     * Sets the target Portlet Action Window
+     * 
+     * @param window
+     */
+    public void setActionWindow( PortletWindow portletWindow )
+    {
+        this.actionWindow = portletWindow;
+    }
+
+
+    /**
+     * Set the capabilityMap. Used by the CapabilityValve
+     * 
+     * @param capabilityMap
+     */
+    public void setCapabilityMap( CapabilityMap map )
+    {
+        this.capabilityMap = map;
+    }
+
+    /**
+     * get the character encoding
+     * 
+     *  
+     */
+    public String getCharacterEncoding()
+    {
+        return this.encoding;
+    }
+
+    /**
+     * set character encoding
+     * 
+     * @param enc
+     */
+    public void setCharacterEncoding( String enc )
+    {
+        String preferedEnc = (String) request.getSession().getAttribute(PortalReservedParameters.PREFERED_CHARACTERENCODING_ATTRIBUTE);
+
+        if (preferedEnc == null || !enc.equals(preferedEnc))
+        {
+            request.setAttribute(PortalReservedParameters.PREFERED_CHARACTERENCODING_ATTRIBUTE, enc);
+        }
+
+        this.encoding = enc;
+    }
+
+    /**
+     * <p>
+     * getRequestForWindow
+     * </p>
+     * 
+     * @see org.apache.jetspeed.request.RequestContext#getRequestForWindow(org.apache.pluto.om.window.PortletWindow)
+     * @param window
+     * @return
+     */
+    public HttpServletRequest getRequestForWindow( PortletWindow window )
+    {
+        if (!requestsForWindows.containsKey(window.getId()))
+        {
+            ServletRequestFactory reqFac = (ServletRequestFactory) Jetspeed.getEngine().getFactory(
+                    javax.servlet.http.HttpServletRequest.class);
+            HttpServletRequest requestWrapper = reqFac.getServletRequest(request, window);
+            requestsForWindows.put(window.getId(), requestWrapper);
+            return requestWrapper;
+        }
+        else
+        {
+            return (HttpServletRequest) requestsForWindows.get(window.getId());
+        }
+
+    }
+
+    /**
+     * <p>
+     * getResponseForWindow
+     * </p>
+     * 
+     * @see org.apache.jetspeed.request.RequestContext#getResponseForWindow(org.apache.pluto.om.window.PortletWindow)
+     * @param window
+     * @return
+     */
+    public HttpServletResponse getResponseForWindow( PortletWindow window )
+    {
+        HttpServletResponse wrappedResponse = null;
+
+        if (!responsesForWindows.containsKey(window.getId()))
+        {
+            if (getContentDispatcher() != null)
+            {
+                wrappedResponse = ((ContentDispatcherCtrl) getContentDispatcher()).getResponseForWindow(window, this);
+            }
+            else
+            {
+                ServletResponseFactory rspFac = (ServletResponseFactory) Jetspeed.getEngine().getFactory(
+                        HttpServletResponse.class);
+                wrappedResponse = rspFac.getServletResponse(this.response);
+
+            }
+
+            responsesForWindows.put(window.getId(), wrappedResponse);
+            return wrappedResponse;
+
+        }
+        else
+        {
+            return (HttpServletResponse) responsesForWindows.get(window.getId());
+        }
+    }
+
+    /**
+     * @see org.apache.jetspeed.request.RequestContext#getSubject()
+     */
+    public Subject getSubject()
+    {
+        return this.subject;
+    }
+
+    /**
+     * @see org.apache.jetspeed.request.RequestContext#setSubject(javax.security.auth.Subject)
+     */
+    public void setSubject( Subject subject )
+    {
+        this.subject = subject;
+    }
+
+    /**
+     * @see org.apache.jetspeed.request.RequestContext#getLocale()
+     */
+    public Locale getLocale()
+    {
+        return this.locale;
+    }
+
+    /**
+     * @see org.apache.jetspeed.request.RequestContext#setLocale(java.util.Locale)
+     */
+    public void setLocale( Locale locale )
+    {
+        Locale preferedLocale = (Locale) request.getSession().getAttribute(PortalReservedParameters.PREFERED_LOCALE_ATTRIBUTE);
+
+        if (preferedLocale == null || !locale.equals(preferedLocale))
+        {
+            request.getSession().setAttribute(PortalReservedParameters.PREFERED_LANGUAGE_ATTRIBUTE, new WeakHashMap());
+            request.getSession().setAttribute(PortalReservedParameters.PREFERED_LOCALE_ATTRIBUTE, locale);
+            request.setAttribute(PortalReservedParameters.PREFERED_LOCALE_ATTRIBUTE, locale);
+        }
+
+        this.locale = locale;
+    }
+
+    /**
+     * @see org.apache.jetspeed.request.RequestContext#getRequestParameter(java.lang.String)
+     */
+    public String getRequestParameter( String key )
+    {
+        return request.getParameter(key);
+    }
+
+    /**
+     * @see org.apache.jetspeed.request.RequestContext#getParameterMap()
+     */
+    public Map getParameterMap()
+    {
+        return request.getParameterMap();
+    }
+
+    /**
+     * @see org.apache.jetspeed.request.RequestContext#getRequestAttribute(java.lang.String)
+     */
+    public Object getRequestAttribute( String key )
+    {
+        return request.getAttribute(key);
+    }
+
+    /**
+     * @see org.apache.jetspeed.request.RequestContext#getSessionAttribute(java.lang.String)
+     */
+    public Object getSessionAttribute( String key )
+    {
+        return request.getSession().getAttribute(key);
+    }
+
+    /**
+     * @see org.apache.jetspeed.request.RequestContext#setSessionAttribute(java.lang.String,
+     *      java.lang.Object)
+     */
+    public void setSessionAttribute( String key, Object value )
+    {
+        request.getSession().setAttribute(key, value);
+    }
+
+    /**
+     * @see org.apache.jetspeed.request.RequestContext#setAttribute(java.lang.String,
+     *      java.lang.Object)
+     */
+    public void setAttribute( String key, Object value )
+    {
+        request.setAttribute(key, value);
+    }
+
+    /**
+     * @see org.apache.jetspeed.request.RequestContext#getAttribute(java.lang.String)
+     */
+    public Object getAttribute( String key )
+    {
+        return request.getAttribute(key);
+    }
+
+    /**
+     * @see org.apache.jetspeed.request.RequestContext#getPath()
+     */
+    public String getPath()
+    {
+        if (this.requestPath == null)
+        {
+            this.requestPath = getPortalURL().getPath();
+        }
+        return this.requestPath;
+    }
+    
+    public void setPortalURL(PortalURL url)
+    {
+        if ( this.url != null )
+            throw new IllegalStateException("PortalURL already set");
+        if ( url == null )
+            throw new IllegalArgumentException("PortalURL may not be nullified");
+        this.url = url;
+    }
+
+    public PortalURL getPortalURL()
+    {
+        return url;
+    }
+
+    /**
+     * @see org.apache.jetspeed.request.RequestContext#getUserInfoMap(org.apache.pluto.om.common.ObjectID)
+     */
+    public Map getUserInfoMap( ObjectID oid )
+    {
+        return userInfoMgr.getUserInfoMap(oid, this);
+    }
+
+    /**
+     * 
+     * <p>
+     * getPreferedLanguage
+     * </p>
+     * 
+     * @see org.apache.jetspeed.request.RequestContext#getPreferedLanguage(org.apache.pluto.om.portlet.PortletDefinition)
+     * @param portlet
+     * @return
+     */
+    public Language getPreferedLanguage( PortletDefinition portlet )
+    {
+        // TODO cannot get a proper Language when changing a locale by Locale
+        // Selector
+        // HttpSession session = request.getSession();
+        // Map languageMap = (Map)
+        // session.getAttribute(PREFERED_LANGUAGE_SESSION_KEY);
+        // Language language = (Language) languageMap.get(portlet);
+        // if(language != null)
+        // {
+        //     return language;
+        // }
+        LanguageSet languageSet = portlet.getLanguageSet();
+        Language language = languageSet.get(locale);
+
+        Enumeration locales = request.getLocales();
+        while (locales.hasMoreElements() && language == null)
+        {
+            Locale aLocale = (Locale) locales.nextElement();
+            language = languageSet.get(aLocale);
+        }
+
+        Iterator langItr = languageSet.iterator();
+        if (langItr.hasNext() && language == null)
+        {
+            language = (Language) langItr.next();
+        }
+        
+        if (language == null)
+        {
+            language = languageSet.get(languageSet.getDefaultLocale());
+        }
+
+        if (language == null)
+        {
+            MutableLanguage languageCtl = new LanguageImpl();
+            languageCtl.setLocale(locale);
+            languageCtl.setShortTitle(portlet.getName());
+            languageCtl.setTitle(portlet.getName());
+            language = languageCtl;
+        }
+
+        // languageMap.put(portlet, language);
+        return language;
+    }
+
+    /**
+     * <p>
+     * setPath
+     * </p>
+     * 
+     * @see org.apache.jetspeed.request.RequestContext#setPath(java.lang.String)
+     * @param path
+     */
+    public void setPath( String path )
+    {
+        this.requestPath = path;
+    }
+
+
+    /* (non-Javadoc)
+     * @see org.apache.jetspeed.request.RequestContext#getActionFailure()
+     */
+    public Throwable popActionFailure(PortletWindow window)
+    {
+
+        String key = ACTION_ERROR_ATTR + window.getId();
+        Throwable t = (Throwable) request.getSession().getAttribute(key);
+        request.getSession().removeAttribute(key);
+        return t;
+
+    }
+
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see org.apache.jetspeed.request.RequestContext#setActionFailed(java.lang.Throwable)
+     */
+    public void setActionFailure(PortletWindow window, Throwable actionFailure)
+    {
+        setSessionAttribute(ACTION_ERROR_ATTR + window.getId(),
+                actionFailure);
+
+    }
+    
+
+}

Added: portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/request/JetspeedRequestContextComponent.java
URL: http://svn.apache.org/viewcvs/portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/request/JetspeedRequestContextComponent.java?rev=209328&view=auto
==============================================================================
--- portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/request/JetspeedRequestContextComponent.java (added)
+++ portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/request/JetspeedRequestContextComponent.java Tue Jul  5 14:55:37 2005
@@ -0,0 +1,129 @@
+/*
+ * 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.
+ */
+package org.apache.jetspeed.request;
+
+import java.lang.reflect.Constructor;
+
+import javax.servlet.ServletConfig;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import org.apache.jetspeed.PortalReservedParameters;
+import org.apache.jetspeed.userinfo.UserInfoManager;
+
+/**
+ * JetspeedRequestContextComponent
+ *
+ * @author <a href="mailto:taylor@apache.org">David Sean Taylor</a>
+ * @version $Id: JetspeedRequestContextComponent.java 188436 2005-03-23 22:54:30Z ate $
+ */
+public class JetspeedRequestContextComponent implements RequestContextComponent
+{
+    private String contextClassName = null;
+    private Class contextClass = null;
+    /** The user info manager. */
+    private UserInfoManager userInfoMgr;
+    private ThreadLocal tlRequestContext = new ThreadLocal();
+
+    private final static Log log = LogFactory.getLog(JetspeedRequestContextComponent.class);
+
+    public JetspeedRequestContextComponent(String contextClassName)
+    {
+    }
+
+    public JetspeedRequestContextComponent(String contextClassName, 
+                                           UserInfoManager userInfoMgr)
+    {
+        this.contextClassName = contextClassName;
+        this.userInfoMgr = userInfoMgr;
+    }
+
+    public RequestContext create(HttpServletRequest req, HttpServletResponse resp, ServletConfig config)
+    {
+        RequestContext context = null;
+
+        try
+        {
+            if (null == contextClass)
+            {
+                contextClass = Class.forName(contextClassName);
+            }
+
+            // TODO: we could use a pooled object implementation here
+            Constructor constructor =
+                contextClass.getConstructor(
+                    new Class[] {
+                        HttpServletRequest.class,
+                        HttpServletResponse.class,
+                        ServletConfig.class,
+                        UserInfoManager.class});
+            context = (RequestContext) constructor.newInstance(new Object[] { req, resp, config, userInfoMgr});
+
+        }
+        catch (Exception e)
+        {
+            String msg = "JetspeedRequestContextComponent: Failed to create a Class object for RequestContext: " + e.toString();
+            log.error(msg);
+        }
+
+        tlRequestContext.set(context);
+        
+        return context;
+    }
+
+    public void release(RequestContext context)
+    {
+        tlRequestContext.set(null);
+    }
+
+    /**
+     * The servlet request can always get you back to the Request Context if you need it
+     * This static accessor provides this capability
+     *
+     * @param request
+     * @return RequestContext
+     */
+    public RequestContext getRequestContext(HttpServletRequest request)
+    {
+        RequestContext rc = (RequestContext) request.getAttribute(PortalReservedParameters.REQUEST_CONTEXT_ATTRIBUTE);
+        if(rc != null)
+        {
+            return rc;
+        }
+        else
+        {
+            throw new IllegalStateException("Cannot call getRequestContext(HttpServletRequest request) before it has been created and set for this thread.");
+        }
+    }
+    
+    public RequestContext getRequestContext()
+    {
+        RequestContext rc =  (RequestContext) tlRequestContext.get();        
+        
+        if(rc != null)
+        {
+            return rc;
+        }
+        else
+        {
+            throw new IllegalStateException("Cannot call getRequestContext() before it has been created and set for this thread.");
+        }
+    }
+
+}

Added: portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/security/impl/AbstractSecurityValve.java
URL: http://svn.apache.org/viewcvs/portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/security/impl/AbstractSecurityValve.java?rev=209328&view=auto
==============================================================================
--- portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/security/impl/AbstractSecurityValve.java (added)
+++ portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/security/impl/AbstractSecurityValve.java Tue Jul  5 14:55:37 2005
@@ -0,0 +1,133 @@
+/*
+ * Created on Nov 30, 2004
+ *
+ * TODO To change the template for this generated file go to
+ * Window - Preferences - Java - Code Generation - Code and Comments
+ */
+package org.apache.jetspeed.security.impl;
+
+import java.security.Principal;
+import java.security.PrivilegedAction;
+
+import javax.security.auth.Subject;
+
+import org.apache.jetspeed.PortalReservedParameters;
+import org.apache.jetspeed.pipeline.PipelineException;
+import org.apache.jetspeed.pipeline.valve.AbstractValve;
+import org.apache.jetspeed.pipeline.valve.SecurityValve;
+import org.apache.jetspeed.pipeline.valve.ValveContext;
+import org.apache.jetspeed.request.RequestContext;
+
+/**
+ * <p>
+ * AbstractSecurityValve
+ * </p>
+ * <p>
+ *
+ * </p>
+ * @author <a href="mailto:weaver@apache.org">Scott T. Weaver</a>
+ * @version $Id: AbstractSecurityValve.java 188330 2005-02-10 21:09:18Z taylor $
+ *
+ */
+public abstract class AbstractSecurityValve extends AbstractValve implements SecurityValve
+{
+    /**
+     * 
+     * <p>
+     * getSubject
+     * </p>
+     *  Should build and return a <code>javax.security.Subject</code>
+     * @param request
+     * @return Subject
+     */
+    protected abstract Subject getSubject(RequestContext request) throws Exception;
+    
+    /**
+     * 
+     * <p>
+     * getUserPrincipal
+     * </p>
+     * Should build and return a <code>java.security.Principal</code> that represents the user name
+     * the Subject returned from <code>getSubject()</code> 
+     * @param request
+     * @return Principal
+     * @throws Exception
+     */
+    protected abstract Principal getUserPrincipal(RequestContext request) throws Exception;
+    
+    /**
+     * 
+     * <p>
+     * getSubjectFromSession
+     * </p>
+     * 
+     * @param request
+     * @return javax.security.Subject or <code>null</code> if there is no servlet session attribute defined
+     * for the key <code>org.apache.jetspeed.PortalReservedParameters.SESSION_KEY_SUBJECT</code>.
+     */
+    protected final Subject getSubjectFromSession(RequestContext request) throws Exception
+    {
+        return (Subject) request.getRequest().getSession().getAttribute(PortalReservedParameters.SESSION_KEY_SUBJECT);
+    }
+
+    /**
+     * <p>
+     * invoke
+     * </p>
+     * 
+     * <p>
+     * Uses <code>getSubject()</code> to call <code>ValveContext.invokeNext()</code> via 
+     * <code>Subject.doAsPrivileged()</code>.  This method also takes care of setting the value of
+     * the <code>RequestContext.subject</code> property and the session attribute 
+     * <code>org.apache.jetspeed.PortalReservedParameters.SESSION_KEY_SUBJECT</code>
+     * </p>
+     *
+     * @see org.apache.jetspeed.pipeline.valve.Valve#invoke(org.apache.jetspeed.request.RequestContext, org.apache.jetspeed.pipeline.valve.ValveContext)
+     * @param request
+     * @param context
+     * @throws PipelineException if the is an error encountered during any security operations.
+     */
+    public void invoke( RequestContext request, ValveContext context ) throws PipelineException
+    {
+            // initialize/validate security subject
+            Subject subject;
+            try
+            {
+                subject = getSubject(request);
+            }
+            catch (Exception e1)
+            {
+               throw new PipelineException(e1.getMessage(), e1);
+            }
+            request.getRequest().getSession().setAttribute(PortalReservedParameters.SESSION_KEY_SUBJECT, subject);            
+            
+            // set request context subject
+            request.setSubject(subject);
+            
+            // Pass control to the next Valve in the Pipeline and execute under
+            // the current subject
+            final ValveContext vc = context;
+            final RequestContext rc = request;            
+            PipelineException pe = (PipelineException) Subject.doAsPrivileged(subject, new PrivilegedAction()
+            {
+                public Object run() 
+                {
+                     try
+                    {
+                        vc.invokeNext(rc);                 
+                        return null;
+                    }
+                    catch (PipelineException e)
+                    {
+                        return e;
+                    }                    
+                }
+            }, null);
+            
+            if(pe != null)
+            {
+                throw pe;
+            }       
+    
+    }
+}

Added: portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/security/impl/LoginValidationValveImpl.java
URL: http://svn.apache.org/viewcvs/portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/security/impl/LoginValidationValveImpl.java?rev=209328&view=auto
==============================================================================
--- portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/security/impl/LoginValidationValveImpl.java (added)
+++ portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/security/impl/LoginValidationValveImpl.java Tue Jul  5 14:55:37 2005
@@ -0,0 +1,123 @@
+/*
+ * Copyright 2000-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.
+ */
+package org.apache.jetspeed.security.impl;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.jetspeed.Jetspeed;
+import org.apache.jetspeed.login.LoginConstants;
+import org.apache.jetspeed.pipeline.PipelineException;
+import org.apache.jetspeed.pipeline.valve.AbstractValve;
+import org.apache.jetspeed.pipeline.valve.ValveContext;
+import org.apache.jetspeed.request.RequestContext;
+import org.apache.jetspeed.security.PasswordCredential;
+import org.apache.jetspeed.security.SecurityException;
+import org.apache.jetspeed.security.SecurityHelper;
+import org.apache.jetspeed.security.User;
+import org.apache.jetspeed.security.UserManager;
+import org.apache.jetspeed.security.UserPrincipal;
+
+/**
+ * LoginValidationValve
+ *
+ * @author <a href="mailto:ate@apache.org">Ate Douma</a>
+ * @version $Id: LoginValidationValveImpl.java 188605 2005-05-24 16:02:26Z ate $
+ */
+public class LoginValidationValveImpl extends AbstractValve implements org.apache.jetspeed.pipeline.valve.LoginValidationValve
+{
+    private static final Log log = LogFactory.getLog(LoginValidationValveImpl.class);
+    
+    // This value should be in sync with that of InternalPasswordCredentialStateHandlingInterceptor (if used)
+    // to make any sense.
+    // Providing value < 2 will disable the LoginConstants.ERROR_FINAL_LOGIN_ATTEMPT warning 
+    private int maxNumberOfAuthenticationFailures;
+    
+    public LoginValidationValveImpl(int maxNumberOfAuthenticationFailures)
+    {
+        this.maxNumberOfAuthenticationFailures = maxNumberOfAuthenticationFailures;
+    }
+
+    /**
+     * @see org.apache.jetspeed.pipeline.valve.Valve#invoke(org.apache.jetspeed.request.RequestContext, org.apache.jetspeed.pipeline.valve.ValveContext)
+     */
+    public void invoke(RequestContext request, ValveContext context) throws PipelineException
+    {
+        try
+        {
+            if ( request.getRequest().getUserPrincipal() == null )
+            {
+                if ( request.getSessionAttribute(LoginConstants.RETRYCOUNT) != null )
+                {
+                    // we have a login attempt failure
+                    String userName = (String)request.getSessionAttribute(LoginConstants.USERNAME);
+                    if ( userName != null )
+                    {
+                        UserManager um = (UserManager)Jetspeed.getComponentManager().getComponent(UserManager.class);
+                        if ( um != null )
+                        {
+                            User user = null;
+                            try
+                            {
+                                user = um.getUser(userName);
+                                UserPrincipal userPrincipal = (UserPrincipal)SecurityHelper.getPrincipal(user.getSubject(), UserPrincipal.class);
+                                if ( !userPrincipal.isEnabled() )
+                                {
+                                    request.setSessionAttribute(LoginConstants.ERRORCODE, LoginConstants.ERROR_USER_DISABLED);
+                                }
+                                else
+                                {
+                                    PasswordCredential pwdCredential = SecurityHelper.getPasswordCredential(user.getSubject());
+                                    if ( pwdCredential == null || !pwdCredential.isEnabled() )
+                                    {
+                                        request.setSessionAttribute(LoginConstants.ERRORCODE, LoginConstants.ERROR_CREDENTIAL_DISABLED);
+                                    }
+                                    else if ( maxNumberOfAuthenticationFailures > 1 && pwdCredential.getAuthenticationFailures() == maxNumberOfAuthenticationFailures -1  )
+                                    {
+                                        request.setSessionAttribute(LoginConstants.ERRORCODE, LoginConstants.ERROR_FINAL_LOGIN_ATTEMPT);
+                                    }
+                                    else
+                                    {
+                                        request.setSessionAttribute(LoginConstants.ERRORCODE, LoginConstants.ERROR_INVALID_PASSWORD);
+                                    }
+                                }
+                            }
+                            catch (SecurityException sex)
+                            {
+                                request.setSessionAttribute(LoginConstants.ERRORCODE, LoginConstants.ERROR_UNKNOWN_USER);
+                            }
+                        }
+                    }
+                    else
+                    {
+                        request.setSessionAttribute(LoginConstants.ERRORCODE, LoginConstants.ERROR_UNKNOWN_USER);
+                    }
+                }
+            }
+            context.invokeNext(request);
+        }
+        catch (Exception e)
+        {
+            log.error("Exception in request pipeline: " + e.getMessage(), e);
+            throw new PipelineException(e.toString(), e);
+        }
+    }
+
+    public String toString()
+    {
+        return "LoginValidationValve";
+    }
+
+}



---------------------------------------------------------------------
To unsubscribe, e-mail: jetspeed-dev-unsubscribe@portals.apache.org
For additional commands, e-mail: jetspeed-dev-help@portals.apache.org


Mime
View raw message