portals-pluto-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From e..@apache.org
Subject svn commit: r607448 [7/36] - in /portals/pluto/branches/pluto-1.1.x: ./ assembly/src/main/assembly/ assembly/src/main/resources/ maven-pluto-plugin/ maven-pluto-plugin/src/main/java/org/apache/pluto/maven/ pluto-ant-tasks/ pluto-ant-tasks/src/assemble/...
Date Sat, 29 Dec 2007 17:20:42 GMT
Modified: portals/pluto/branches/pluto-1.1.x/pluto-container/src/main/java/org/apache/pluto/internal/impl/InternalImplConverter.java
URL: http://svn.apache.org/viewvc/portals/pluto/branches/pluto-1.1.x/pluto-container/src/main/java/org/apache/pluto/internal/impl/InternalImplConverter.java?rev=607448&r1=607447&r2=607448&view=diff
==============================================================================
--- portals/pluto/branches/pluto-1.1.x/pluto-container/src/main/java/org/apache/pluto/internal/impl/InternalImplConverter.java (original)
+++ portals/pluto/branches/pluto-1.1.x/pluto-container/src/main/java/org/apache/pluto/internal/impl/InternalImplConverter.java Sat Dec 29 09:20:23 2007
@@ -1,84 +1,84 @@
-/*
+/*
  * Licensed to the Apache Software Foundation (ASF) under one or more
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The ASF licenses this file to You under the Apache License, Version 2.0
  * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.pluto.internal.impl;
-
-import org.apache.pluto.internal.InternalPortletRequest;
-import org.apache.pluto.internal.InternalPortletResponse;
-import org.apache.pluto.wrappers.PortletRequestWrapper;
-import org.apache.pluto.wrappers.PortletResponseWrapper;
-
-import javax.portlet.PortletRequest;
-import javax.portlet.PortletResponse;
-
-/**
- * Static class that provides utility methods to convert a generic
- * PortletRequest or PortletResponse object into an Internal respresentation
- * of the same object.
- */
-class InternalImplConverter {
-
-	/**
-	 * Private constructor that prevents external instantiation.
-	 */
-	private InternalImplConverter() {
-		// Do nothing.
-	}
-
-
-	// Public Static Utility Methods -------------------------------------------
-
-    /**
-     * The scary part about this is that there is not yet a
-     * PortletRequestWrapper defined by the spec.  Because of this, there's a
-     * chance someone might implement their own wrapper and we won't be able to
-     * get the real internal one!
-     * @param request the portlet request to be converted.
-     * @return the internal request.
-     */
-    public static InternalPortletRequest getInternalRequest(
-    		PortletRequest request) {
-        while (!(request instanceof InternalPortletRequest)) {
-            request = ((PortletRequestWrapper) request).getPortletRequest();
-            if (request == null) {
-                throw new IllegalStateException(
-                		"The internal portlet request cannot be found.");
-            }
-        }
-        return (InternalPortletRequest) request;
-    }
-
-    /**
-     * The scary part about this is that there is not yet a
-     * PortletRequestWrapper defined by the spec.  Because of this, there's a
-     * chance someone might implement their own wrapper and we won't be able to
-     * get the real internal one!
-     * @param response the portlet response to be converted.
-     * @return the internal response.
-     */
-    public static InternalPortletResponse getInternalResponse(
-    		PortletResponse response) {
-        while (!(response instanceof InternalPortletResponse)) {
-            response = ((PortletResponseWrapper) response).getPortletResponse();
-            if (response == null) {
-                throw new IllegalStateException(
-                		"The internal portlet response cannot be found.");
-            }
-        }
-        return (InternalPortletResponse) response;
-    }
-
-}
+ * 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.pluto.internal.impl;
+
+import org.apache.pluto.internal.InternalPortletRequest;
+import org.apache.pluto.internal.InternalPortletResponse;
+import org.apache.pluto.wrappers.PortletRequestWrapper;
+import org.apache.pluto.wrappers.PortletResponseWrapper;
+
+import javax.portlet.PortletRequest;
+import javax.portlet.PortletResponse;
+
+/**
+ * Static class that provides utility methods to convert a generic
+ * PortletRequest or PortletResponse object into an Internal respresentation
+ * of the same object.
+ */
+class InternalImplConverter {
+
+	/**
+	 * Private constructor that prevents external instantiation.
+	 */
+	private InternalImplConverter() {
+		// Do nothing.
+	}
+
+
+	// Public Static Utility Methods -------------------------------------------
+
+    /**
+     * The scary part about this is that there is not yet a
+     * PortletRequestWrapper defined by the spec.  Because of this, there's a
+     * chance someone might implement their own wrapper and we won't be able to
+     * get the real internal one!
+     * @param request the portlet request to be converted.
+     * @return the internal request.
+     */
+    public static InternalPortletRequest getInternalRequest(
+    		PortletRequest request) {
+        while (!(request instanceof InternalPortletRequest)) {
+            request = ((PortletRequestWrapper) request).getPortletRequest();
+            if (request == null) {
+                throw new IllegalStateException(
+                		"The internal portlet request cannot be found.");
+            }
+        }
+        return (InternalPortletRequest) request;
+    }
+
+    /**
+     * The scary part about this is that there is not yet a
+     * PortletRequestWrapper defined by the spec.  Because of this, there's a
+     * chance someone might implement their own wrapper and we won't be able to
+     * get the real internal one!
+     * @param response the portlet response to be converted.
+     * @return the internal response.
+     */
+    public static InternalPortletResponse getInternalResponse(
+    		PortletResponse response) {
+        while (!(response instanceof InternalPortletResponse)) {
+            response = ((PortletResponseWrapper) response).getPortletResponse();
+            if (response == null) {
+                throw new IllegalStateException(
+                		"The internal portlet response cannot be found.");
+            }
+        }
+        return (InternalPortletResponse) response;
+    }
+
+}

Propchange: portals/pluto/branches/pluto-1.1.x/pluto-container/src/main/java/org/apache/pluto/internal/impl/InternalImplConverter.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: portals/pluto/branches/pluto-1.1.x/pluto-container/src/main/java/org/apache/pluto/internal/impl/InternalPortletWindowImpl.java
URL: http://svn.apache.org/viewvc/portals/pluto/branches/pluto-1.1.x/pluto-container/src/main/java/org/apache/pluto/internal/impl/InternalPortletWindowImpl.java?rev=607448&r1=607447&r2=607448&view=diff
==============================================================================
--- portals/pluto/branches/pluto-1.1.x/pluto-container/src/main/java/org/apache/pluto/internal/impl/InternalPortletWindowImpl.java (original)
+++ portals/pluto/branches/pluto-1.1.x/pluto-container/src/main/java/org/apache/pluto/internal/impl/InternalPortletWindowImpl.java Sat Dec 29 09:20:23 2007
@@ -1,102 +1,102 @@
-/*
+/*
  * Licensed to the Apache Software Foundation (ASF) under one or more
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The ASF licenses this file to You under the Apache License, Version 2.0
  * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.pluto.internal.impl;
-
-import javax.portlet.PortletMode;
-import javax.portlet.WindowState;
-import javax.servlet.ServletContext;
-
-import org.apache.pluto.PortletWindow;
-import org.apache.pluto.PortletWindowID;
-import org.apache.pluto.internal.InternalPortletWindow;
-import org.apache.pluto.internal.PortletEntity;
-
-/**
- * Implementation of <code>InternalPortletWindow</code> interface.
- *
- */
-public class InternalPortletWindowImpl implements InternalPortletWindow {
-
-    /** The underlying portlet window instance. */
-    private final PortletWindow portletWindow;
-
-    /** The servlet context of the portlet. */
-    private final ServletContext servletContext;
-
-    /** The portlet entity associated with the portlet window. */
-    private PortletEntity entity;
-
-
-    // Constructor -------------------------------------------------------------
-
-    /**
-     * Constructs an internal portlet window that wraps a portlet window.
-     * An internal portlet window instance is created everytime when the portlet
-     * container's <code>doRender()</code> or <code>doAction()</code> method is
-     * invoked.
-     *
-     * @param context  the servlet context from which this window is
-     *        being invoked.
-     * @param portletWindow  the underlying portlet window instance.
-     */
-    public InternalPortletWindowImpl(ServletContext context,
-                             PortletWindow portletWindow) {
-        this.servletContext = context;
-        this.portletWindow = portletWindow;
-    }
-
-
-    // PortletWindow Impl ------------------------------------------------------
-
-    public String getContextPath() {
-        return portletWindow.getContextPath();
-    }
-
-    public String getPortletName() {
-        return portletWindow.getPortletName();
-    }
-
-    public WindowState getWindowState() {
-        return portletWindow.getWindowState();
-    }
-
-    public PortletMode getPortletMode() {
-        return portletWindow.getPortletMode();
-    }
-
-    public PortletWindowID getId() {
-        return portletWindow.getId();
-    }
-
-
-    // InternalPortletWindow Impl ----------------------------------------------
-
-    public ServletContext getServletContext() {
-        return servletContext;
-    }
-
-    public PortletEntity getPortletEntity() {
-        if (entity == null) {
-            entity = new PortletEntityImpl(servletContext, getPortletName());
-        }
-        return entity;
-    }
-
-    public PortletWindow getOriginalPortletWindow() {
-        return portletWindow;
-    }
-}
+ * 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.pluto.internal.impl;
+
+import javax.portlet.PortletMode;
+import javax.portlet.WindowState;
+import javax.servlet.ServletContext;
+
+import org.apache.pluto.PortletWindow;
+import org.apache.pluto.PortletWindowID;
+import org.apache.pluto.internal.InternalPortletWindow;
+import org.apache.pluto.internal.PortletEntity;
+
+/**
+ * Implementation of <code>InternalPortletWindow</code> interface.
+ *
+ */
+public class InternalPortletWindowImpl implements InternalPortletWindow {
+
+    /** The underlying portlet window instance. */
+    private final PortletWindow portletWindow;
+
+    /** The servlet context of the portlet. */
+    private final ServletContext servletContext;
+
+    /** The portlet entity associated with the portlet window. */
+    private PortletEntity entity;
+
+
+    // Constructor -------------------------------------------------------------
+
+    /**
+     * Constructs an internal portlet window that wraps a portlet window.
+     * An internal portlet window instance is created everytime when the portlet
+     * container's <code>doRender()</code> or <code>doAction()</code> method is
+     * invoked.
+     *
+     * @param context  the servlet context from which this window is
+     *        being invoked.
+     * @param portletWindow  the underlying portlet window instance.
+     */
+    public InternalPortletWindowImpl(ServletContext context,
+                             PortletWindow portletWindow) {
+        this.servletContext = context;
+        this.portletWindow = portletWindow;
+    }
+
+
+    // PortletWindow Impl ------------------------------------------------------
+
+    public String getContextPath() {
+        return portletWindow.getContextPath();
+    }
+
+    public String getPortletName() {
+        return portletWindow.getPortletName();
+    }
+
+    public WindowState getWindowState() {
+        return portletWindow.getWindowState();
+    }
+
+    public PortletMode getPortletMode() {
+        return portletWindow.getPortletMode();
+    }
+
+    public PortletWindowID getId() {
+        return portletWindow.getId();
+    }
+
+
+    // InternalPortletWindow Impl ----------------------------------------------
+
+    public ServletContext getServletContext() {
+        return servletContext;
+    }
+
+    public PortletEntity getPortletEntity() {
+        if (entity == null) {
+            entity = new PortletEntityImpl(servletContext, getPortletName());
+        }
+        return entity;
+    }
+
+    public PortletWindow getOriginalPortletWindow() {
+        return portletWindow;
+    }
+}

Propchange: portals/pluto/branches/pluto-1.1.x/pluto-container/src/main/java/org/apache/pluto/internal/impl/InternalPortletWindowImpl.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: portals/pluto/branches/pluto-1.1.x/pluto-container/src/main/java/org/apache/pluto/internal/impl/PortletConfigImpl.java
URL: http://svn.apache.org/viewvc/portals/pluto/branches/pluto-1.1.x/pluto-container/src/main/java/org/apache/pluto/internal/impl/PortletConfigImpl.java?rev=607448&r1=607447&r2=607448&view=diff
==============================================================================
--- portals/pluto/branches/pluto-1.1.x/pluto-container/src/main/java/org/apache/pluto/internal/impl/PortletConfigImpl.java (original)
+++ portals/pluto/branches/pluto-1.1.x/pluto-container/src/main/java/org/apache/pluto/internal/impl/PortletConfigImpl.java Sat Dec 29 09:20:23 2007
@@ -1,119 +1,119 @@
-/*
+/*
  * Licensed to the Apache Software Foundation (ASF) under one or more
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The ASF licenses this file to You under the Apache License, Version 2.0
  * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- * 
- *      http://www.apache.org/licenses/LICENSE-2.0
- * 
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.pluto.internal.impl;
-
-import org.apache.pluto.internal.InternalPortletConfig;
-import org.apache.pluto.descriptors.common.InitParamDD;
-import org.apache.pluto.descriptors.portlet.PortletDD;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
-import javax.portlet.PortletConfig;
-import javax.portlet.PortletContext;
-import javax.servlet.ServletConfig;
-import java.util.*;
-
-public class PortletConfigImpl implements PortletConfig, InternalPortletConfig {
-
-    private static final Log LOG = LogFactory.getLog(PortletConfigImpl.class);
-
-    /**
-     * The servlet config for which we exist.
-     */
-    private ServletConfig servletConfig;
-
-    /**
-     * The Portlet Application Context within which we exist.
-     */
-    private PortletContext portletContext;
-
-    /**
-     * The portlet descriptor.
-     */
-    protected PortletDD portletDD;
-
-    private ResourceBundleFactory bundles;
-
-    public PortletConfigImpl(ServletConfig servletConfig,
-                             PortletContext portletContext,
-                             PortletDD portletDD) {
-        this.servletConfig = servletConfig;
-        this.portletContext = portletContext;
-        this.portletDD = portletDD;
-    }
-
-    public String getPortletName() {
-        return portletDD.getPortletName();
-    }
-
-    public PortletContext getPortletContext() {
-        return portletContext;
-    }
-
-    public ResourceBundle getResourceBundle(Locale locale) {
-        if(LOG.isDebugEnabled()) {
-            LOG.debug("Resource Bundle requested: "+locale);
-        }
-        if (bundles == null) {
-            bundles = new ResourceBundleFactory(portletDD);
-        }
-        return bundles.getResourceBundle(locale);
-    }
-
-    public String getInitParameter(String name) {
-        if (name == null) {
-            throw new IllegalArgumentException("Parameter name == null");
-        }
-
-        Iterator parms = portletDD.getInitParams().iterator();
-        while(parms.hasNext()) {
-            InitParamDD param = (InitParamDD)parms.next();
-            if (param.getParamName().equals(name)) {
-                return param.getParamValue();
-            }
-        }
-        return null;
-    }
-
-    public Enumeration getInitParameterNames() {
-        return new java.util.Enumeration() {
-            private Iterator iterator =
-                new ArrayList(portletDD.getInitParams()).iterator();
-
-            public boolean hasMoreElements() {
-                return iterator.hasNext();
-            }
-
-            public Object nextElement() {
-                if (iterator.hasNext()) {
-                    return ((InitParamDD) iterator.next()).getParamName();
-                } else {
-                    return null;
-                }
-            }
-        };
-    }
-
-    public javax.servlet.ServletConfig getServletConfig() {
-        return servletConfig;
-    }
-
-    public PortletDD getPortletDefinition() {
-        return portletDD;
-    }
-
-}
+ * 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.pluto.internal.impl;
+
+import org.apache.pluto.internal.InternalPortletConfig;
+import org.apache.pluto.descriptors.common.InitParamDD;
+import org.apache.pluto.descriptors.portlet.PortletDD;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import javax.portlet.PortletConfig;
+import javax.portlet.PortletContext;
+import javax.servlet.ServletConfig;
+import java.util.*;
+
+public class PortletConfigImpl implements PortletConfig, InternalPortletConfig {
+
+    private static final Log LOG = LogFactory.getLog(PortletConfigImpl.class);
+
+    /**
+     * The servlet config for which we exist.
+     */
+    private ServletConfig servletConfig;
+
+    /**
+     * The Portlet Application Context within which we exist.
+     */
+    private PortletContext portletContext;
+
+    /**
+     * The portlet descriptor.
+     */
+    protected PortletDD portletDD;
+
+    private ResourceBundleFactory bundles;
+
+    public PortletConfigImpl(ServletConfig servletConfig,
+                             PortletContext portletContext,
+                             PortletDD portletDD) {
+        this.servletConfig = servletConfig;
+        this.portletContext = portletContext;
+        this.portletDD = portletDD;
+    }
+
+    public String getPortletName() {
+        return portletDD.getPortletName();
+    }
+
+    public PortletContext getPortletContext() {
+        return portletContext;
+    }
+
+    public ResourceBundle getResourceBundle(Locale locale) {
+        if(LOG.isDebugEnabled()) {
+            LOG.debug("Resource Bundle requested: "+locale);
+        }
+        if (bundles == null) {
+            bundles = new ResourceBundleFactory(portletDD);
+        }
+        return bundles.getResourceBundle(locale);
+    }
+
+    public String getInitParameter(String name) {
+        if (name == null) {
+            throw new IllegalArgumentException("Parameter name == null");
+        }
+
+        Iterator parms = portletDD.getInitParams().iterator();
+        while(parms.hasNext()) {
+            InitParamDD param = (InitParamDD)parms.next();
+            if (param.getParamName().equals(name)) {
+                return param.getParamValue();
+            }
+        }
+        return null;
+    }
+
+    public Enumeration getInitParameterNames() {
+        return new java.util.Enumeration() {
+            private Iterator iterator =
+                new ArrayList(portletDD.getInitParams()).iterator();
+
+            public boolean hasMoreElements() {
+                return iterator.hasNext();
+            }
+
+            public Object nextElement() {
+                if (iterator.hasNext()) {
+                    return ((InitParamDD) iterator.next()).getParamName();
+                } else {
+                    return null;
+                }
+            }
+        };
+    }
+
+    public javax.servlet.ServletConfig getServletConfig() {
+        return servletConfig;
+    }
+
+    public PortletDD getPortletDefinition() {
+        return portletDD;
+    }
+
+}

Propchange: portals/pluto/branches/pluto-1.1.x/pluto-container/src/main/java/org/apache/pluto/internal/impl/PortletConfigImpl.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: portals/pluto/branches/pluto-1.1.x/pluto-container/src/main/java/org/apache/pluto/internal/impl/PortletContextImpl.java
URL: http://svn.apache.org/viewvc/portals/pluto/branches/pluto-1.1.x/pluto-container/src/main/java/org/apache/pluto/internal/impl/PortletContextImpl.java?rev=607448&r1=607447&r2=607448&view=diff
==============================================================================
--- portals/pluto/branches/pluto-1.1.x/pluto-container/src/main/java/org/apache/pluto/internal/impl/PortletContextImpl.java (original)
+++ portals/pluto/branches/pluto-1.1.x/pluto-container/src/main/java/org/apache/pluto/internal/impl/PortletContextImpl.java Sat Dec 29 09:20:23 2007
@@ -1,280 +1,280 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.pluto.internal.impl;
-
-import java.io.InputStream;
-import java.net.MalformedURLException;
-import java.net.URL;
-import java.util.Enumeration;
-import java.util.Set;
-
-import javax.portlet.PortletContext;
-import javax.portlet.PortletRequestDispatcher;
-import javax.servlet.RequestDispatcher;
-import javax.servlet.ServletContext;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.apache.pluto.descriptors.portlet.PortletAppDD;
-import org.apache.pluto.internal.InternalPortletContext;
-
-/**
- * Pluto's Portlet Context Implementation. This class implements the
- * <code>InternalPortletContext</code> which provides container specific
- * information needed for processing.
- *
- * @version 1.1
- */
-public class PortletContextImpl
-    implements PortletContext, InternalPortletContext {
-
-    /**
-     * Logger.
-     */
-    private static final Log LOG = LogFactory.getLog(PortletContextImpl.class);
-
-
-    // Private Member Variables ------------------------------------------------
-
-    private final String applicationId;
-    private String applicationName;
-
-    private final PortletAppDD portletAppDD;
-    private final ServletContext servletContext;
-    private ClassLoader contextClassLoader;
-
-    // Constructor -------------------------------------------------------------
-
-    /**
-     * Constructs an instance.
-     *
-     * @param servletContext the servlet context in which we are contained.
-     * @param portletAppDD   the portlet application descriptor.
-     * @param portletApplicationId applicationId
-     */
-    public PortletContextImpl(String portletApplicationId,
-                              ServletContext servletContext,
-                              PortletAppDD portletAppDD) {
-        this.servletContext = servletContext;
-        this.portletAppDD = portletAppDD;
-        this.applicationId = portletApplicationId;
-        this.applicationName = servletContext.getServletContextName();
-
-        if(applicationName == null) {
-            applicationName = applicationId;
-        }
-        init();
-    }
-
-    private void init() {
-        setContextClassLoader(Thread.currentThread().getContextClassLoader());
-    }
-
-    public String getApplicationId() {
-        return applicationId;
-    }
-
-    public String getApplicationName() {
-        return applicationName;
-    }
-
-    /**
-     * ClassLoader associated with this context.
-     * @return
-     */
-    public ClassLoader getContextClassLoader() {
-        return contextClassLoader;
-    }
-
-    /**
-     * ClassLoader associated with this context.
-     * @param contextClassLoader
-     */
-    public void setContextClassLoader(ClassLoader contextClassLoader) {
-        this.contextClassLoader = contextClassLoader;
-    }
-
-    // PortletContext Impl -----------------------------------------------------
-
-    /**
-     * Retrieve the PortletContainer's server info.
-     *
-     * @return the server info in the form of <i>Server/Version</i>
-     * @see Environment#getServerInfo()
-     */
-    public String getServerInfo() {
-        return Environment.getServerInfo();
-    }
-
-    public PortletRequestDispatcher getRequestDispatcher(String path) {
-
-        if (LOG.isDebugEnabled()) {
-            LOG.debug("PortletRequestDispatcher requested: " + path);
-        }
-
-        // Check if the path name is valid. A valid path name must not be null
-        //   and must start with a slash '/' as defined by the portlet spec.
-        if (path == null || !path.startsWith("/")) {
-            if (LOG.isInfoEnabled()) {
-                LOG.info("Failed to retrieve PortletRequestDispatcher: "
-                    + "path name must begin with a slash '/'.");
-            }
-            return null;
-        }
-
-        // Extract query string which contains appended parameters.
-        String queryString = null;
-        int index = path.indexOf("?");
-        if (index > 0 && index < path.length() - 1) {
-            queryString = path.substring(index + 1);
-        }
-
-        // Construct PortletRequestDispatcher.
-        PortletRequestDispatcher portletRequestDispatcher = null;
-        try {
-            RequestDispatcher servletRequestDispatcher = servletContext
-                .getRequestDispatcher(path);
-            if (servletRequestDispatcher != null) {
-                portletRequestDispatcher = new PortletRequestDispatcherImpl(
-                    servletRequestDispatcher, queryString);
-            } else {
-                if (LOG.isInfoEnabled()) {
-                    LOG.info("No matching request dispatcher found for: " + path);
-                }
-            }
-        } catch (Exception ex) {
-            // We need to catch exception because of a Tomcat 4.x bug.
-            //   Tomcat throws an exception instead of return null if the path
-            //   was not found.
-            if (LOG.isInfoEnabled()) {
-                LOG.info("Failed to retrieve PortletRequestDispatcher: "
-                    + ex.getMessage());
-            }
-            portletRequestDispatcher = null;
-        }
-        return portletRequestDispatcher;
-    }
-
-    public PortletRequestDispatcher getNamedDispatcher(String name) {
-        RequestDispatcher dispatcher = servletContext.getNamedDispatcher(name);
-        if (dispatcher != null) {
-            return new PortletRequestDispatcherImpl(dispatcher);
-        } else {
-            if (LOG.isInfoEnabled()) {
-                LOG.info("No matching request dispatcher found for name: "
-                    + name);
-            }
-        }
-        return null;
-    }
-
-    public InputStream getResourceAsStream(String path) {
-        return servletContext.getResourceAsStream(path);
-    }
-
-    public int getMajorVersion() {
-        return Environment.getMajorSpecificationVersion();
-    }
-
-    public int getMinorVersion() {
-        return Environment.getMinorSpecificationVersion();
-    }
-
-    public String getMimeType(String file) {
-        return servletContext.getMimeType(file);
-    }
-
-    public String getRealPath(String path) {
-        return servletContext.getRealPath(path);
-    }
-
-    public Set getResourcePaths(String path) {
-        return servletContext.getResourcePaths(path);
-    }
-
-    public URL getResource(String path)
-        throws java.net.MalformedURLException {
-        if (path == null || !path.startsWith("/")) {
-            throw new MalformedURLException("path must start with a '/'");
-        }
-        return servletContext.getResource(path);
-    }
-
-    public Object getAttribute(java.lang.String name) {
-        if (name == null) {
-            throw new IllegalArgumentException("Attribute name == null");
-        }
-
-        return servletContext.getAttribute(name);
-    }
-
-    public Enumeration getAttributeNames() {
-        return servletContext.getAttributeNames();
-    }
-
-    public String getInitParameter(java.lang.String name) {
-        if (name == null) {
-            throw new IllegalArgumentException("Parameter name == null");
-        }
-
-        return servletContext.getInitParameter(name);
-    }
-
-    public Enumeration getInitParameterNames() {
-        return servletContext.getInitParameterNames();
-    }
-
-    public void log(java.lang.String msg) {
-        servletContext.log(msg);
-    }
-
-    public void log(java.lang.String message, java.lang.Throwable throwable) {
-        servletContext.log(message, throwable);
-    }
-
-    public void removeAttribute(java.lang.String name) {
-        if (name == null) {
-            throw new IllegalArgumentException("Attribute name == null");
-        }
-
-        servletContext.removeAttribute(name);
-    }
-
-    public void setAttribute(java.lang.String name, java.lang.Object object) {
-        if (name == null) {
-            throw new IllegalArgumentException("Attribute name == null");
-        }
-
-        servletContext.setAttribute(name, object);
-    }
-
-    public String getPortletContextName() {
-        return servletContext.getServletContextName();
-    }
-
-    // org.apache.pluto.core.InternalPortletContext Impl -----------------------
-
-    public ServletContext getServletContext() {
-        return servletContext;
-    }
-
-    public PortletAppDD getPortletApplicationDefinition() {
-        return portletAppDD;
-    }
-
-}
-
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.pluto.internal.impl;
+
+import java.io.InputStream;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.util.Enumeration;
+import java.util.Set;
+
+import javax.portlet.PortletContext;
+import javax.portlet.PortletRequestDispatcher;
+import javax.servlet.RequestDispatcher;
+import javax.servlet.ServletContext;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.pluto.descriptors.portlet.PortletAppDD;
+import org.apache.pluto.internal.InternalPortletContext;
+
+/**
+ * Pluto's Portlet Context Implementation. This class implements the
+ * <code>InternalPortletContext</code> which provides container specific
+ * information needed for processing.
+ *
+ * @version 1.1
+ */
+public class PortletContextImpl
+    implements PortletContext, InternalPortletContext {
+
+    /**
+     * Logger.
+     */
+    private static final Log LOG = LogFactory.getLog(PortletContextImpl.class);
+
+
+    // Private Member Variables ------------------------------------------------
+
+    private final String applicationId;
+    private String applicationName;
+
+    private final PortletAppDD portletAppDD;
+    private final ServletContext servletContext;
+    private ClassLoader contextClassLoader;
+
+    // Constructor -------------------------------------------------------------
+
+    /**
+     * Constructs an instance.
+     *
+     * @param servletContext the servlet context in which we are contained.
+     * @param portletAppDD   the portlet application descriptor.
+     * @param portletApplicationId applicationId
+     */
+    public PortletContextImpl(String portletApplicationId,
+                              ServletContext servletContext,
+                              PortletAppDD portletAppDD) {
+        this.servletContext = servletContext;
+        this.portletAppDD = portletAppDD;
+        this.applicationId = portletApplicationId;
+        this.applicationName = servletContext.getServletContextName();
+
+        if(applicationName == null) {
+            applicationName = applicationId;
+        }
+        init();
+    }
+
+    private void init() {
+        setContextClassLoader(Thread.currentThread().getContextClassLoader());
+    }
+
+    public String getApplicationId() {
+        return applicationId;
+    }
+
+    public String getApplicationName() {
+        return applicationName;
+    }
+
+    /**
+     * ClassLoader associated with this context.
+     * @return
+     */
+    public ClassLoader getContextClassLoader() {
+        return contextClassLoader;
+    }
+
+    /**
+     * ClassLoader associated with this context.
+     * @param contextClassLoader
+     */
+    public void setContextClassLoader(ClassLoader contextClassLoader) {
+        this.contextClassLoader = contextClassLoader;
+    }
+
+    // PortletContext Impl -----------------------------------------------------
+
+    /**
+     * Retrieve the PortletContainer's server info.
+     *
+     * @return the server info in the form of <i>Server/Version</i>
+     * @see Environment#getServerInfo()
+     */
+    public String getServerInfo() {
+        return Environment.getServerInfo();
+    }
+
+    public PortletRequestDispatcher getRequestDispatcher(String path) {
+
+        if (LOG.isDebugEnabled()) {
+            LOG.debug("PortletRequestDispatcher requested: " + path);
+        }
+
+        // Check if the path name is valid. A valid path name must not be null
+        //   and must start with a slash '/' as defined by the portlet spec.
+        if (path == null || !path.startsWith("/")) {
+            if (LOG.isInfoEnabled()) {
+                LOG.info("Failed to retrieve PortletRequestDispatcher: "
+                    + "path name must begin with a slash '/'.");
+            }
+            return null;
+        }
+
+        // Extract query string which contains appended parameters.
+        String queryString = null;
+        int index = path.indexOf("?");
+        if (index > 0 && index < path.length() - 1) {
+            queryString = path.substring(index + 1);
+        }
+
+        // Construct PortletRequestDispatcher.
+        PortletRequestDispatcher portletRequestDispatcher = null;
+        try {
+            RequestDispatcher servletRequestDispatcher = servletContext
+                .getRequestDispatcher(path);
+            if (servletRequestDispatcher != null) {
+                portletRequestDispatcher = new PortletRequestDispatcherImpl(
+                    servletRequestDispatcher, queryString);
+            } else {
+                if (LOG.isInfoEnabled()) {
+                    LOG.info("No matching request dispatcher found for: " + path);
+                }
+            }
+        } catch (Exception ex) {
+            // We need to catch exception because of a Tomcat 4.x bug.
+            //   Tomcat throws an exception instead of return null if the path
+            //   was not found.
+            if (LOG.isInfoEnabled()) {
+                LOG.info("Failed to retrieve PortletRequestDispatcher: "
+                    + ex.getMessage());
+            }
+            portletRequestDispatcher = null;
+        }
+        return portletRequestDispatcher;
+    }
+
+    public PortletRequestDispatcher getNamedDispatcher(String name) {
+        RequestDispatcher dispatcher = servletContext.getNamedDispatcher(name);
+        if (dispatcher != null) {
+            return new PortletRequestDispatcherImpl(dispatcher);
+        } else {
+            if (LOG.isInfoEnabled()) {
+                LOG.info("No matching request dispatcher found for name: "
+                    + name);
+            }
+        }
+        return null;
+    }
+
+    public InputStream getResourceAsStream(String path) {
+        return servletContext.getResourceAsStream(path);
+    }
+
+    public int getMajorVersion() {
+        return Environment.getMajorSpecificationVersion();
+    }
+
+    public int getMinorVersion() {
+        return Environment.getMinorSpecificationVersion();
+    }
+
+    public String getMimeType(String file) {
+        return servletContext.getMimeType(file);
+    }
+
+    public String getRealPath(String path) {
+        return servletContext.getRealPath(path);
+    }
+
+    public Set getResourcePaths(String path) {
+        return servletContext.getResourcePaths(path);
+    }
+
+    public URL getResource(String path)
+        throws java.net.MalformedURLException {
+        if (path == null || !path.startsWith("/")) {
+            throw new MalformedURLException("path must start with a '/'");
+        }
+        return servletContext.getResource(path);
+    }
+
+    public Object getAttribute(java.lang.String name) {
+        if (name == null) {
+            throw new IllegalArgumentException("Attribute name == null");
+        }
+
+        return servletContext.getAttribute(name);
+    }
+
+    public Enumeration getAttributeNames() {
+        return servletContext.getAttributeNames();
+    }
+
+    public String getInitParameter(java.lang.String name) {
+        if (name == null) {
+            throw new IllegalArgumentException("Parameter name == null");
+        }
+
+        return servletContext.getInitParameter(name);
+    }
+
+    public Enumeration getInitParameterNames() {
+        return servletContext.getInitParameterNames();
+    }
+
+    public void log(java.lang.String msg) {
+        servletContext.log(msg);
+    }
+
+    public void log(java.lang.String message, java.lang.Throwable throwable) {
+        servletContext.log(message, throwable);
+    }
+
+    public void removeAttribute(java.lang.String name) {
+        if (name == null) {
+            throw new IllegalArgumentException("Attribute name == null");
+        }
+
+        servletContext.removeAttribute(name);
+    }
+
+    public void setAttribute(java.lang.String name, java.lang.Object object) {
+        if (name == null) {
+            throw new IllegalArgumentException("Attribute name == null");
+        }
+
+        servletContext.setAttribute(name, object);
+    }
+
+    public String getPortletContextName() {
+        return servletContext.getServletContextName();
+    }
+
+    // org.apache.pluto.core.InternalPortletContext Impl -----------------------
+
+    public ServletContext getServletContext() {
+        return servletContext;
+    }
+
+    public PortletAppDD getPortletApplicationDefinition() {
+        return portletAppDD;
+    }
+
+}
+

Propchange: portals/pluto/branches/pluto-1.1.x/pluto-container/src/main/java/org/apache/pluto/internal/impl/PortletContextImpl.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: portals/pluto/branches/pluto-1.1.x/pluto-container/src/main/java/org/apache/pluto/internal/impl/PortletEntityImpl.java
URL: http://svn.apache.org/viewvc/portals/pluto/branches/pluto-1.1.x/pluto-container/src/main/java/org/apache/pluto/internal/impl/PortletEntityImpl.java?rev=607448&r1=607447&r2=607448&view=diff
==============================================================================
--- portals/pluto/branches/pluto-1.1.x/pluto-container/src/main/java/org/apache/pluto/internal/impl/PortletEntityImpl.java (original)
+++ portals/pluto/branches/pluto-1.1.x/pluto-container/src/main/java/org/apache/pluto/internal/impl/PortletEntityImpl.java Sat Dec 29 09:20:23 2007
@@ -1,201 +1,201 @@
-/*
+/*
  * Licensed to the Apache Software Foundation (ASF) under one or more
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The ASF licenses this file to You under the Apache License, Version 2.0
  * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.pluto.internal.impl;
-
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-
-import javax.portlet.PreferencesValidator;
-import javax.portlet.ValidatorException;
-import javax.servlet.ServletContext;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.apache.pluto.PortletContainerException;
-import org.apache.pluto.descriptors.portlet.PortletAppDD;
-import org.apache.pluto.descriptors.portlet.PortletDD;
-import org.apache.pluto.descriptors.portlet.PortletPreferenceDD;
-import org.apache.pluto.descriptors.portlet.PortletPreferencesDD;
-import org.apache.pluto.descriptors.servlet.ServletDD;
-import org.apache.pluto.internal.InternalPortletPreference;
-import org.apache.pluto.internal.PortletDescriptorRegistry;
-import org.apache.pluto.internal.PortletEntity;
-import org.apache.pluto.internal.PreferencesValidatorRegistry;
-
-/**
- * The PortletEntity encapsulates all data pertaining to a single portlet
- * instance.  This instance may appear zero or more times per user. The
- * PortletEntity consists of two primary peices of information, the Portlet
- * Definition as defined by the {@link PortletDD} and the Wrapping Servlet
- * information as defined by the{@link ServletDD}
- *
- */
-public class PortletEntityImpl implements PortletEntity {
-
-	/** Logger. */
-    private static final Log LOG = LogFactory.getLog(PortletEntityImpl.class);
-
-    /** URI prefix of the portlet invoker servlet. */
-    private static final String PREFIX = "/PlutoInvoker/";
-
-
-    // Private Member Variables ------------------------------------------------
-
-    /** The servlet context. */
-    private final ServletContext servletContext;
-
-    /** The portlet window. */
-    private final String portletName;
-
-    /** The cached PortletDD retrieved from the portlet descriptor registry. */
-    private PortletDD portletDefinition;
-
-    /** Default portlet preferences defined for this portlet. */
-    private InternalPortletPreference[] defaultPreferences ;
-
-
-    // Constructor -------------------------------------------------------------
-
-    PortletEntityImpl(ServletContext servletContext, String portletName) {
-        this.servletContext = servletContext;
-        this.portletName = portletName;
-    }
-
-
-    // PortletEntity Impl ------------------------------------------------------
-
-    /**
-     * Returns the URI to the controller servlet that wraps this portlet.
-     * @return the URI to the controller servlet that wraps this portlet.
-     * @deprecated
-     */
-    public String getControllerServletUri() {
-        // this method is deprecated as of pluto 1.1.2, so that
-        // we can remove it in the future.  The PortletInvokerService
-        // will be responsible for resolving the URI used to invoke
-        // the portlet.
-        return PREFIX + portletName;
-    }
-
-    /**
-     * Returns an array of default preferences of this portlet. The default
-     * preferences are retrieved from the portlet application descriptor.
-     * <p>
-     * Data retrieved from <code>portlet.xml</code> are injected into the domain
-     * object <code>PortletPreferenceDD</code>. This method converts the domain
-     * objects into <code>PortletPreference</code> objects.
-     * </p>
-     * <p>
-     * Note that if no value is bound to a given preference key,
-     * <code>PortletPreferenceDD.getValues()</code> will return an empty string
-     * list, but the value array of <code>PortletPreference</code> should be set
-     * to null (instead of an empty array).
-     * </p>
-     * <p>
-     * This method never returns null, but the values held by PortletPreference
-     * may be null.
-     * </p>
-     * @return the preference set
-     *
-     * @see org.apache.pluto.descriptors.portlet.PortletPreferenceDD
-     */
-    public InternalPortletPreference[] getDefaultPreferences() {
-        if (defaultPreferences == null) {
-            PortletDD portletDD = getPortletDefinition();
-            PortletPreferencesDD prefsDD = portletDD.getPortletPreferences();
-            if (prefsDD != null) {
-            	List prefs = new ArrayList();
-            	for (Iterator it = prefsDD.getPortletPreferences().iterator();
-            			it.hasNext(); ) {
-            		PortletPreferenceDD prefDD = (PortletPreferenceDD) it.next();
-            		String[] values = null;
-            		if (prefDD.getValues().size() > 0) {
-            			values = (String[]) prefDD.getValues().toArray(
-            					new String[prefDD.getValues().size()]);
-            		}
-            		PortletPreferenceImpl pref = new PortletPreferenceImpl(
-            				prefDD.getName(), values, prefDD.isReadOnly());
-            		prefs.add(pref);
-            	}
-            	defaultPreferences = (InternalPortletPreference[])
-            			prefs.toArray(new InternalPortletPreference[prefs.size()]);
-            }
-        }
-        return defaultPreferences;
-    }
-
-    /**
-     * Returns the portlet description. The return value cannot be NULL.
-     * @return the portlet description.
-     */
-    public PortletDD getPortletDefinition() {
-        if (portletDefinition == null) {
-            load();
-        }
-        return portletDefinition;
-    }
-
-    /**
-     * Returns the preferences validator instance for this portlet.
-     * One validator instance is created per portlet definition.
-     * @return the preferences validator instance for this portlet.
-     * @throws ValidatorException  if fail to instantiate the validator.
-     */
-    public PreferencesValidator getPreferencesValidator()
-    throws ValidatorException {
-    	PreferencesValidator validator = PreferencesValidatorRegistry
-    			.getRegistry()
-    			.getPreferencesValidator(getPortletDefinition());
-    	return validator;
-    }
-
-
-    // Private Methods ---------------------------------------------------------
-
-    /**
-     * Loads the portlet definition.
-     */
-    private void load() {
-
-    	// Retrieve the cross servlet context for the portlet.
-        ServletContext crossContext = servletContext;
-        if (LOG.isDebugEnabled()) {
-            LOG.debug("Retrieved cross context: " + crossContext);
-        }
-
-        // Load PortletAppDD and find out the portlet definition.
-        try {
-            PortletAppDD appDD = PortletDescriptorRegistry.getRegistry()
-            		.getPortletAppDD(crossContext);
-            for (Iterator it = appDD.getPortlets().iterator(); it.hasNext(); ) {
-                PortletDD portletDD = (PortletDD) it.next();
-                if (portletDD.getPortletName().equals(portletName)) {
-                	portletDefinition = portletDD;
-                	break;
-                }
-            }
-        } catch (PortletContainerException ex) {
-        	String message = "Unable to load Portlet App Deployment Descriptor:"
-        			+ ex.getMessage();
-        	LOG.error(message, ex);
-        	// FIXME: should this be a NullPointerException?
-            throw new NullPointerException(message);
-        }
-    }
-
-}
+ * 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.pluto.internal.impl;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+import javax.portlet.PreferencesValidator;
+import javax.portlet.ValidatorException;
+import javax.servlet.ServletContext;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.pluto.PortletContainerException;
+import org.apache.pluto.descriptors.portlet.PortletAppDD;
+import org.apache.pluto.descriptors.portlet.PortletDD;
+import org.apache.pluto.descriptors.portlet.PortletPreferenceDD;
+import org.apache.pluto.descriptors.portlet.PortletPreferencesDD;
+import org.apache.pluto.descriptors.servlet.ServletDD;
+import org.apache.pluto.internal.InternalPortletPreference;
+import org.apache.pluto.internal.PortletDescriptorRegistry;
+import org.apache.pluto.internal.PortletEntity;
+import org.apache.pluto.internal.PreferencesValidatorRegistry;
+
+/**
+ * The PortletEntity encapsulates all data pertaining to a single portlet
+ * instance.  This instance may appear zero or more times per user. The
+ * PortletEntity consists of two primary peices of information, the Portlet
+ * Definition as defined by the {@link PortletDD} and the Wrapping Servlet
+ * information as defined by the{@link ServletDD}
+ *
+ */
+public class PortletEntityImpl implements PortletEntity {
+
+	/** Logger. */
+    private static final Log LOG = LogFactory.getLog(PortletEntityImpl.class);
+
+    /** URI prefix of the portlet invoker servlet. */
+    private static final String PREFIX = "/PlutoInvoker/";
+
+
+    // Private Member Variables ------------------------------------------------
+
+    /** The servlet context. */
+    private final ServletContext servletContext;
+
+    /** The portlet window. */
+    private final String portletName;
+
+    /** The cached PortletDD retrieved from the portlet descriptor registry. */
+    private PortletDD portletDefinition;
+
+    /** Default portlet preferences defined for this portlet. */
+    private InternalPortletPreference[] defaultPreferences ;
+
+
+    // Constructor -------------------------------------------------------------
+
+    PortletEntityImpl(ServletContext servletContext, String portletName) {
+        this.servletContext = servletContext;
+        this.portletName = portletName;
+    }
+
+
+    // PortletEntity Impl ------------------------------------------------------
+
+    /**
+     * Returns the URI to the controller servlet that wraps this portlet.
+     * @return the URI to the controller servlet that wraps this portlet.
+     * @deprecated
+     */
+    public String getControllerServletUri() {
+        // this method is deprecated as of pluto 1.1.2, so that
+        // we can remove it in the future.  The PortletInvokerService
+        // will be responsible for resolving the URI used to invoke
+        // the portlet.
+        return PREFIX + portletName;
+    }
+
+    /**
+     * Returns an array of default preferences of this portlet. The default
+     * preferences are retrieved from the portlet application descriptor.
+     * <p>
+     * Data retrieved from <code>portlet.xml</code> are injected into the domain
+     * object <code>PortletPreferenceDD</code>. This method converts the domain
+     * objects into <code>PortletPreference</code> objects.
+     * </p>
+     * <p>
+     * Note that if no value is bound to a given preference key,
+     * <code>PortletPreferenceDD.getValues()</code> will return an empty string
+     * list, but the value array of <code>PortletPreference</code> should be set
+     * to null (instead of an empty array).
+     * </p>
+     * <p>
+     * This method never returns null, but the values held by PortletPreference
+     * may be null.
+     * </p>
+     * @return the preference set
+     *
+     * @see org.apache.pluto.descriptors.portlet.PortletPreferenceDD
+     */
+    public InternalPortletPreference[] getDefaultPreferences() {
+        if (defaultPreferences == null) {
+            PortletDD portletDD = getPortletDefinition();
+            PortletPreferencesDD prefsDD = portletDD.getPortletPreferences();
+            if (prefsDD != null) {
+            	List prefs = new ArrayList();
+            	for (Iterator it = prefsDD.getPortletPreferences().iterator();
+            			it.hasNext(); ) {
+            		PortletPreferenceDD prefDD = (PortletPreferenceDD) it.next();
+            		String[] values = null;
+            		if (prefDD.getValues().size() > 0) {
+            			values = (String[]) prefDD.getValues().toArray(
+            					new String[prefDD.getValues().size()]);
+            		}
+            		PortletPreferenceImpl pref = new PortletPreferenceImpl(
+            				prefDD.getName(), values, prefDD.isReadOnly());
+            		prefs.add(pref);
+            	}
+            	defaultPreferences = (InternalPortletPreference[])
+            			prefs.toArray(new InternalPortletPreference[prefs.size()]);
+            }
+        }
+        return defaultPreferences;
+    }
+
+    /**
+     * Returns the portlet description. The return value cannot be NULL.
+     * @return the portlet description.
+     */
+    public PortletDD getPortletDefinition() {
+        if (portletDefinition == null) {
+            load();
+        }
+        return portletDefinition;
+    }
+
+    /**
+     * Returns the preferences validator instance for this portlet.
+     * One validator instance is created per portlet definition.
+     * @return the preferences validator instance for this portlet.
+     * @throws ValidatorException  if fail to instantiate the validator.
+     */
+    public PreferencesValidator getPreferencesValidator()
+    throws ValidatorException {
+    	PreferencesValidator validator = PreferencesValidatorRegistry
+    			.getRegistry()
+    			.getPreferencesValidator(getPortletDefinition());
+    	return validator;
+    }
+
+
+    // Private Methods ---------------------------------------------------------
+
+    /**
+     * Loads the portlet definition.
+     */
+    private void load() {
+
+    	// Retrieve the cross servlet context for the portlet.
+        ServletContext crossContext = servletContext;
+        if (LOG.isDebugEnabled()) {
+            LOG.debug("Retrieved cross context: " + crossContext);
+        }
+
+        // Load PortletAppDD and find out the portlet definition.
+        try {
+            PortletAppDD appDD = PortletDescriptorRegistry.getRegistry()
+            		.getPortletAppDD(crossContext);
+            for (Iterator it = appDD.getPortlets().iterator(); it.hasNext(); ) {
+                PortletDD portletDD = (PortletDD) it.next();
+                if (portletDD.getPortletName().equals(portletName)) {
+                	portletDefinition = portletDD;
+                	break;
+                }
+            }
+        } catch (PortletContainerException ex) {
+        	String message = "Unable to load Portlet App Deployment Descriptor:"
+        			+ ex.getMessage();
+        	LOG.error(message, ex);
+        	// FIXME: should this be a NullPointerException?
+            throw new NullPointerException(message);
+        }
+    }
+
+}

Propchange: portals/pluto/branches/pluto-1.1.x/pluto-container/src/main/java/org/apache/pluto/internal/impl/PortletEntityImpl.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: portals/pluto/branches/pluto-1.1.x/pluto-container/src/main/java/org/apache/pluto/internal/impl/PortletPreferenceImpl.java
URL: http://svn.apache.org/viewvc/portals/pluto/branches/pluto-1.1.x/pluto-container/src/main/java/org/apache/pluto/internal/impl/PortletPreferenceImpl.java?rev=607448&r1=607447&r2=607448&view=diff
==============================================================================
--- portals/pluto/branches/pluto-1.1.x/pluto-container/src/main/java/org/apache/pluto/internal/impl/PortletPreferenceImpl.java (original)
+++ portals/pluto/branches/pluto-1.1.x/pluto-container/src/main/java/org/apache/pluto/internal/impl/PortletPreferenceImpl.java Sat Dec 29 09:20:23 2007
@@ -1,126 +1,126 @@
-/*
+/*
  * Licensed to the Apache Software Foundation (ASF) under one or more
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The ASF licenses this file to You under the Apache License, Version 2.0
  * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.pluto.internal.impl;
-
-import org.apache.pluto.internal.InternalPortletPreference;
-
-/**
- * TODO: javadoc
- * @version 1.0
- * @since Sep 20, 2004
- */
-public class PortletPreferenceImpl implements InternalPortletPreference {
-
-	// Private Member Variables ------------------------------------------------
-
-	/** The preference name. */
-    private String name;
-
-    /** The preference values. */
-    private String[] values;
-
-    /** Flag indicating if this preference is read-only. */
-    private boolean readOnly = false;
-
-
-    // Constructors ------------------------------------------------------------
-
-    public PortletPreferenceImpl(String name, String[] values) {
-        this.name = name;
-        this.values = values;
-        this.readOnly = false;
-    }
-
-    public PortletPreferenceImpl(String name,
-                                 String[] values,
-                                 boolean readOnly) {
-        this.name = name;
-        this.values = values;
-        this.readOnly = readOnly;
-    }
-
-    /**
-     * Private constructor that is used only within the <code>clone()</code>
-     * method.
-     * @see #clone()
-     */
-    private PortletPreferenceImpl() {
-    	// Do nothing.
-    }
-
-
-    // PortletPreference Impl --------------------------------------------------
-
-    public String getName() {
-        return name;
-    }
-
-    public void setName(String name) {
-        this.name = name;
-    }
-
-    public String[] getValues() {
-        return values;
-    }
-
-    public void setValues(String[] values) {
-        this.values = values;
-    }
-
-    public boolean isReadOnly() {
-        return readOnly;
-    }
-
-    public void setReadOnly(boolean readOnly) {
-        this.readOnly = readOnly;
-    }
-
-    public Object clone() {
-    	PortletPreferenceImpl copy = new PortletPreferenceImpl();
-    	copy.name = this.name;
-    	if (this.values != null) {
-    		copy.values = (String[]) this.values.clone();
-    	}
-    	copy.readOnly = this.readOnly;
-    	return copy;
-    }
-
-
-    // Object Methods ----------------------------------------------------------
-
-    /**
-     * Override of toString() that prints out name and values of fields.
-     * @see java.lang.Object#toString()
-     */
-    public String toString(){
-    	StringBuffer buffer = new StringBuffer();
-    	buffer.append(getClass().getName());
-    	buffer.append("[name=").append(name).append(";");
-    	if (values != null) {
-    		for (int i = 0; i < values.length; i++) {
-    			buffer.append("value[").append(i).append("]=")
-    					.append(values[i]).append(";");
-    		}
-    	} else {
-    		buffer.append("values=NULL;");
-    	}
-    	buffer.append("readOnly=").append(readOnly).append("]");
-    	return buffer.toString();
-    }
-
-}
-
+ * 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.pluto.internal.impl;
+
+import org.apache.pluto.internal.InternalPortletPreference;
+
+/**
+ * TODO: javadoc
+ * @version 1.0
+ * @since Sep 20, 2004
+ */
+public class PortletPreferenceImpl implements InternalPortletPreference {
+
+	// Private Member Variables ------------------------------------------------
+
+	/** The preference name. */
+    private String name;
+
+    /** The preference values. */
+    private String[] values;
+
+    /** Flag indicating if this preference is read-only. */
+    private boolean readOnly = false;
+
+
+    // Constructors ------------------------------------------------------------
+
+    public PortletPreferenceImpl(String name, String[] values) {
+        this.name = name;
+        this.values = values;
+        this.readOnly = false;
+    }
+
+    public PortletPreferenceImpl(String name,
+                                 String[] values,
+                                 boolean readOnly) {
+        this.name = name;
+        this.values = values;
+        this.readOnly = readOnly;
+    }
+
+    /**
+     * Private constructor that is used only within the <code>clone()</code>
+     * method.
+     * @see #clone()
+     */
+    private PortletPreferenceImpl() {
+    	// Do nothing.
+    }
+
+
+    // PortletPreference Impl --------------------------------------------------
+
+    public String getName() {
+        return name;
+    }
+
+    public void setName(String name) {
+        this.name = name;
+    }
+
+    public String[] getValues() {
+        return values;
+    }
+
+    public void setValues(String[] values) {
+        this.values = values;
+    }
+
+    public boolean isReadOnly() {
+        return readOnly;
+    }
+
+    public void setReadOnly(boolean readOnly) {
+        this.readOnly = readOnly;
+    }
+
+    public Object clone() {
+    	PortletPreferenceImpl copy = new PortletPreferenceImpl();
+    	copy.name = this.name;
+    	if (this.values != null) {
+    		copy.values = (String[]) this.values.clone();
+    	}
+    	copy.readOnly = this.readOnly;
+    	return copy;
+    }
+
+
+    // Object Methods ----------------------------------------------------------
+
+    /**
+     * Override of toString() that prints out name and values of fields.
+     * @see java.lang.Object#toString()
+     */
+    public String toString(){
+    	StringBuffer buffer = new StringBuffer();
+    	buffer.append(getClass().getName());
+    	buffer.append("[name=").append(name).append(";");
+    	if (values != null) {
+    		for (int i = 0; i < values.length; i++) {
+    			buffer.append("value[").append(i).append("]=")
+    					.append(values[i]).append(";");
+    		}
+    	} else {
+    		buffer.append("values=NULL;");
+    	}
+    	buffer.append("readOnly=").append(readOnly).append("]");
+    	return buffer.toString();
+    }
+
+}
+

Propchange: portals/pluto/branches/pluto-1.1.x/pluto-container/src/main/java/org/apache/pluto/internal/impl/PortletPreferenceImpl.java
------------------------------------------------------------------------------
    svn:eol-style = native



Mime
View raw message