portals-jetspeed-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From shins...@apache.org
Subject svn commit: r220061 - in /portals/jetspeed-2/trunk: ./ components/header-resource/ components/header-resource/src/ components/header-resource/src/java/ components/header-resource/src/java/org/ components/header-resource/src/java/org/apache/ components/...
Date Thu, 21 Jul 2005 13:26:32 GMT
Author: shinsuke
Date: Thu Jul 21 06:26:29 2005
New Revision: 220061

URL: http://svn.apache.org/viewcvs?rev=220061&view=rev
Log:
JS2-311: added Header Resource component

Added:
    portals/jetspeed-2/trunk/components/header-resource/
    portals/jetspeed-2/trunk/components/header-resource/maven.xml   (with props)
    portals/jetspeed-2/trunk/components/header-resource/project.properties   (with props)
    portals/jetspeed-2/trunk/components/header-resource/project.xml   (with props)
    portals/jetspeed-2/trunk/components/header-resource/src/
    portals/jetspeed-2/trunk/components/header-resource/src/java/
    portals/jetspeed-2/trunk/components/header-resource/src/java/org/
    portals/jetspeed-2/trunk/components/header-resource/src/java/org/apache/
    portals/jetspeed-2/trunk/components/header-resource/src/java/org/apache/jetspeed/
    portals/jetspeed-2/trunk/components/header-resource/src/java/org/apache/jetspeed/headerresource/
    portals/jetspeed-2/trunk/components/header-resource/src/java/org/apache/jetspeed/headerresource/impl/
    portals/jetspeed-2/trunk/components/header-resource/src/java/org/apache/jetspeed/headerresource/impl/HeaderResourceFactoryImpl.java
  (with props)
    portals/jetspeed-2/trunk/components/header-resource/src/java/org/apache/jetspeed/headerresource/impl/HeaderResourceImpl.java
  (with props)
    portals/jetspeed-2/trunk/components/header-resource/xdocs/
    portals/jetspeed-2/trunk/components/header-resource/xdocs/navigation.xml   (with props)
    portals/jetspeed-2/trunk/jetspeed-api/src/java/org/apache/jetspeed/headerresource/
    portals/jetspeed-2/trunk/jetspeed-api/src/java/org/apache/jetspeed/headerresource/HeaderResource.java
  (with props)
    portals/jetspeed-2/trunk/jetspeed-api/src/java/org/apache/jetspeed/headerresource/HeaderResourceFactory.java
  (with props)
Modified:
    portals/jetspeed-2/trunk/.classpath
    portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/aggregator/impl/PageAggregatorImpl.java
    portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/aggregator/impl/PortletAggregatorImpl.java
    portals/jetspeed-2/trunk/jetspeed-api/src/java/org/apache/jetspeed/CommonPortletServices.java
    portals/jetspeed-2/trunk/jetspeed-api/src/java/org/apache/jetspeed/PortalReservedParameters.java
    portals/jetspeed-2/trunk/jetspeed-components.xml
    portals/jetspeed-2/trunk/portal-webapp/src/webapp/WEB-INF/assembly/jetspeed-services.xml
    portals/jetspeed-2/trunk/portal-webapp/src/webapp/WEB-INF/assembly/jetspeed-spring.xml
    portals/jetspeed-2/trunk/portal-webapp/src/webapp/WEB-INF/decorations/layout/html/ja/tigris/decorator-top.vm
    portals/jetspeed-2/trunk/portal-webapp/src/webapp/WEB-INF/decorations/layout/html/jetspeed/decorator-top.vm
    portals/jetspeed-2/trunk/portal-webapp/src/webapp/WEB-INF/decorations/layout/html/jscookmenu/decorator-top.vm
    portals/jetspeed-2/trunk/portal-webapp/src/webapp/WEB-INF/decorations/layout/html/simple/decorator-top.vm
    portals/jetspeed-2/trunk/portal-webapp/src/webapp/WEB-INF/decorations/layout/html/tigris/decorator-top.vm
    portals/jetspeed-2/trunk/portal-webapp/src/webapp/WEB-INF/jetspeed_macros.vm

Modified: portals/jetspeed-2/trunk/.classpath
URL: http://svn.apache.org/viewcvs/portals/jetspeed-2/trunk/.classpath?rev=220061&r1=220060&r2=220061&view=diff
==============================================================================
--- portals/jetspeed-2/trunk/.classpath (original)
+++ portals/jetspeed-2/trunk/.classpath Thu Jul 21 06:26:29 2005
@@ -10,6 +10,7 @@
 	<classpathentry excluding="**/.svn/*" kind="src" path="components/deploy-tool/src/java"/>
 	<classpathentry excluding="**/.svn/*" kind="src" path="components/file-cache/src/java"/>
 	<classpathentry excluding="**/.svn/*|log4j.properties" kind="src" path="components/file-cache/src/test"/>
+	<classpathentry excluding="**/.svn/*" kind="src" path="components/header-resource/src/java"/>
 	<classpathentry excluding="**/.svn/*" kind="src" path="components/id-generator/src/java"/>
 	<classpathentry excluding="**/.svn/*|log4j.properties" kind="src" path="components/id-generator/src/test"/>
 	<classpathentry excluding="**/.svn/*" kind="src" path="components/jetspeed/src/java"/>

Added: portals/jetspeed-2/trunk/components/header-resource/maven.xml
URL: http://svn.apache.org/viewcvs/portals/jetspeed-2/trunk/components/header-resource/maven.xml?rev=220061&view=auto
==============================================================================
--- portals/jetspeed-2/trunk/components/header-resource/maven.xml (added)
+++ portals/jetspeed-2/trunk/components/header-resource/maven.xml Thu Jul 21 06:26:29 2005
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+    Copyright 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.
+-->
+<project default="java:jar" xmlns:j="jelly:core" xmlns:define="jelly:define" xmlns:ant="jelly:ant">
+
+    <!-- Target of maven test:single test -->
+    <!--property name='testcase' value='org.apache.jetspeed.headerresource.TestHeaderResource'
/-->
+
+</project>

Propchange: portals/jetspeed-2/trunk/components/header-resource/maven.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Added: portals/jetspeed-2/trunk/components/header-resource/project.properties
URL: http://svn.apache.org/viewcvs/portals/jetspeed-2/trunk/components/header-resource/project.properties?rev=220061&view=auto
==============================================================================
--- portals/jetspeed-2/trunk/components/header-resource/project.properties (added)
+++ portals/jetspeed-2/trunk/components/header-resource/project.properties Thu Jul 21 06:26:29
2005
@@ -0,0 +1,20 @@
+# Copyright 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.
+#
+# $Id: project.properties 187000 2004-07-11 03:32:22Z paulsp $
+#
+
+maven.multiproject.type=jar
+maven.license.licenseFile=${basedir}/../../LICENSE.TXT
+

Propchange: portals/jetspeed-2/trunk/components/header-resource/project.properties
------------------------------------------------------------------------------
    svn:eol-style = native

Added: portals/jetspeed-2/trunk/components/header-resource/project.xml
URL: http://svn.apache.org/viewcvs/portals/jetspeed-2/trunk/components/header-resource/project.xml?rev=220061&view=auto
==============================================================================
--- portals/jetspeed-2/trunk/components/header-resource/project.xml (added)
+++ portals/jetspeed-2/trunk/components/header-resource/project.xml Thu Jul 21 06:26:29 2005
@@ -0,0 +1,49 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+Copyright 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.
+
+  $Id: project.xml 216242 2005-07-13 21:08:55Z weaver $
+-->
+<project>
+<extend>${basedir}/../../core-build.xml</extend>
+  <pomVersion>3</pomVersion>
+  <id>jetspeed-header-resource</id>
+  <name>Jetspeed-2 Header Resource Management</name>
+  
+  <package>org.apache.jetspeed</package>
+  <description>
+	  Jetspeed Header Resource Management
+  </description>
+  <shortDescription>Header Resource</shortDescription>
+
+  <repository>                 
+    <connection>scm:svn:http://svn.apache.org/repos/asf/portals/jetspeed-2/trunk/components/header-resource</connection>
+    <developerConnection>scm:svn:https://svn.apache.org/repos/asf/portals/jetspeed-2/trunk/components/header-resource</developerConnection>
+    <url>http://svn.apache.org/viewcvs.cgi/portals/jetspeed-2/trunk/components/header-resource/</url>
+  </repository>
+
+  <dependencies>
+    <dependency>
+      <id>jetspeed2:jetspeed-commons</id>
+      <version>${jetspeed.version}</version>
+    </dependency>
+    <dependency>
+      <id>jetspeed2:jetspeed-api</id>
+      <version>${jetspeed.version}</version>
+    </dependency>  
+  </dependencies>
+
+</project>

Propchange: portals/jetspeed-2/trunk/components/header-resource/project.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Added: portals/jetspeed-2/trunk/components/header-resource/src/java/org/apache/jetspeed/headerresource/impl/HeaderResourceFactoryImpl.java
URL: http://svn.apache.org/viewcvs/portals/jetspeed-2/trunk/components/header-resource/src/java/org/apache/jetspeed/headerresource/impl/HeaderResourceFactoryImpl.java?rev=220061&view=auto
==============================================================================
--- portals/jetspeed-2/trunk/components/header-resource/src/java/org/apache/jetspeed/headerresource/impl/HeaderResourceFactoryImpl.java
(added)
+++ portals/jetspeed-2/trunk/components/header-resource/src/java/org/apache/jetspeed/headerresource/impl/HeaderResourceFactoryImpl.java
Thu Jul 21 06:26:29 2005
@@ -0,0 +1,49 @@
+/*
+ * 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.headerresource.impl;
+
+import javax.portlet.PortletRequest;
+
+import org.apache.jetspeed.PortalReservedParameters;
+import org.apache.jetspeed.headerresource.HeaderResource;
+import org.apache.jetspeed.headerresource.HeaderResourceFactory;
+import org.apache.jetspeed.request.RequestContext;
+
+/**
+ * Default implementation for HeaderResourceFactory
+ * 
+ * @author <a href="mailto:shinsuke@yahoo.co.jp">Shinsuke Sugaya</a>
+ * @version $Id: PortalReservedParameters.java 188569 2005-05-13 13:35:18Z weaver $
+ */
+public class HeaderResourceFactoryImpl implements HeaderResourceFactory
+{
+    /* (non-Javadoc)
+     * @see org.apache.jetspeed.headerresource.impl.HeaderResourceFactory#getHeaderResouce(org.apache.jetspeed.request.RequestContext)
+     */
+    public HeaderResource getHeaderResouce(RequestContext requestContext)
+    {
+        return new HeaderResourceImpl(requestContext);
+    }
+
+    /* (non-Javadoc)
+     * @see org.apache.jetspeed.headerresource.impl.HeaderResourceFactory#getHeaderResouce(javax.portlet.PortletRequest)
+     */
+    public HeaderResource getHeaderResouce(PortletRequest request)
+    {
+        RequestContext requestContext=(RequestContext)request.getAttribute(PortalReservedParameters.REQUEST_CONTEXT_ATTRIBUTE);
+        return new HeaderResourceImpl(requestContext);
+    }
+}

Propchange: portals/jetspeed-2/trunk/components/header-resource/src/java/org/apache/jetspeed/headerresource/impl/HeaderResourceFactoryImpl.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: portals/jetspeed-2/trunk/components/header-resource/src/java/org/apache/jetspeed/headerresource/impl/HeaderResourceImpl.java
URL: http://svn.apache.org/viewcvs/portals/jetspeed-2/trunk/components/header-resource/src/java/org/apache/jetspeed/headerresource/impl/HeaderResourceImpl.java?rev=220061&view=auto
==============================================================================
--- portals/jetspeed-2/trunk/components/header-resource/src/java/org/apache/jetspeed/headerresource/impl/HeaderResourceImpl.java
(added)
+++ portals/jetspeed-2/trunk/components/header-resource/src/java/org/apache/jetspeed/headerresource/impl/HeaderResourceImpl.java
Thu Jul 21 06:26:29 2005
@@ -0,0 +1,315 @@
+/*
+ * 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.headerresource.impl;
+
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.LinkedHashSet;
+import java.util.Map;
+import java.util.Set;
+
+import org.apache.jetspeed.PortalReservedParameters;
+import org.apache.jetspeed.headerresource.HeaderResource;
+import org.apache.jetspeed.request.RequestContext;
+
+/**
+ * Default implementation for HeaderResource
+ * 
+ * @author <a href="mailto:shinsuke@yahoo.co.jp">Shinsuke Sugaya</a>
+ * @version $Id: PortalReservedParameters.java 188569 2005-05-13 13:35:18Z weaver $
+ */
+public class HeaderResourceImpl implements HeaderResource
+{
+    private RequestContext requestContext;
+
+    /**
+     * Default Constructor
+     * 
+     * @param context
+     */
+    public HeaderResourceImpl(RequestContext context)
+    {
+        requestContext = context;
+    }
+
+    /**
+     * Gets HeaderInfo set from the request.
+     * 
+     * @return
+     */
+    private Set getHeaderInfoSet()
+    {
+        Set headerInfoSet = (Set) requestContext.getAttribute(PortalReservedParameters.HEADER_RESOURCE_ATTRIBUTE);
+        if (headerInfoSet == null)
+        {
+            headerInfoSet = new LinkedHashSet();
+            requestContext.setAttribute(PortalReservedParameters.HEADER_RESOURCE_ATTRIBUTE,
headerInfoSet);
+        }
+        return headerInfoSet;
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see org.apache.jetspeed.headerresource.impl.HeaderResource#getString()
+     */
+    public String toString()
+    {
+        Set headerInfoSet = getHeaderInfoSet();
+        StringBuffer header = new StringBuffer();
+        for (Iterator ite = headerInfoSet.iterator(); ite.hasNext();)
+        {
+            header.append(((HeaderInfo) ite.next()).toString());
+            header.append("\n");
+        }
+        return header.toString();
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see org.apache.jetspeed.headerresource.impl.HeaderResource#addHeaderInfo(java.lang.String,
+     *      java.util.Map)
+     */
+    public void addHeaderInfo(String elementName, Map attributes, String text)
+    {
+        HeaderInfo headerInfo = new HeaderInfo(elementName, attributes, text);
+        if (!containsHeaderInfo(headerInfo))
+        {
+            Set headerInfoSet = getHeaderInfoSet();
+            headerInfoSet.add(headerInfo);
+        }
+    }
+
+    /**
+     * Returns true if this set contains the specified HeaderInfo.
+     * 
+     * @param headerInfo
+     * @return
+     */
+    private boolean containsHeaderInfo(HeaderInfo headerInfo)
+    {
+        Set headerInfoSet = getHeaderInfoSet();
+        for (Iterator ite = headerInfoSet.iterator(); ite.hasNext();)
+        {
+            HeaderInfo hInfo = (HeaderInfo) ite.next();
+            if (headerInfo.equals(hInfo))
+            {
+                return true;
+            }
+        }
+        return false;
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see org.apache.jetspeed.headerresource.impl.HeaderResource#addJavaScript(java.lang.String,
+     *      boolean)
+     */
+    public void addJavaScript(String path, boolean defer)
+    {
+        HashMap attrs = new HashMap();
+        attrs.put("src", path);
+        attrs.put("type", "text/javascript");
+        if (defer)
+        {
+            attrs.put("defer", "true");
+        }
+        addHeaderInfo("script", attrs, "");
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see org.apache.jetspeed.headerresource.impl.HeaderResource#addJavaScript(java.lang.String)
+     */
+    public void addJavaScript(String path)
+    {
+        addJavaScript(path, false);
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see org.apache.jetspeed.headerresource.impl.HeaderResource#addStyleSheet(java.lang.String)
+     */
+    public void addStyleSheet(String path)
+    {
+        HashMap attrs = new HashMap();
+        attrs.put("rel", "stylesheet");
+        attrs.put("href", path);
+        attrs.put("type", "text/css");
+        addHeaderInfo("link", attrs, null);
+    }
+
+    /**
+     * This class represents tag information for HeaderResouce component
+     * 
+     * @author <a href="mailto:shinsuke@yahoo.co.jp">Shinsuke Sugaya</a>
+     */
+    private class HeaderInfo
+    {
+        /**
+         * Tag's name
+         */
+        private String elementName;
+
+        /**
+         * Tag's attributes
+         */
+        private Map attributes;
+
+        /**
+         * Tag's content
+         */
+        private String text;
+
+        public HeaderInfo(String elementName)
+        {
+            this(elementName, new HashMap());
+        }
+
+        public HeaderInfo(String elementName, Map attr)
+        {
+            this(elementName, attr, null);
+        }
+
+        public HeaderInfo(String elementName, Map attr, String text)
+        {
+            setElementName(elementName);
+            setAttributes(attr);
+            setText(text);
+        }
+
+        public void addAttribute(String key, String value)
+        {
+            attributes.put(key, value);
+        }
+
+        public String toString()
+        {
+            StringBuffer buf = new StringBuffer();
+            buf.append("<");
+            buf.append(getElementName());
+            buf.append(" ");
+
+            Set keySet = getAttributes().keySet();
+            for (Iterator ite = keySet.iterator(); ite.hasNext();)
+            {
+                String key = (String) ite.next();
+                buf.append(key);
+                buf.append("=\"");
+                buf.append((String) getAttributes().get(key));
+                buf.append("\" ");
+            }
+
+            if (getText() != null)
+            {
+                buf.append(">" + getText() + "</" + getElementName() + ">");
+            }
+            else
+            {
+                buf.append("/>");
+            }
+
+            return buf.toString();
+        }
+
+        public boolean equals(Object o)
+        {
+            if (o instanceof HeaderInfo)
+            {
+                HeaderInfo headerInfo = (HeaderInfo) o;
+                if (headerInfo.getElementName().equalsIgnoreCase(getElementName())
+                        && compareString(headerInfo.getText(), getText())
+                        && headerInfo.getAttributes().equals(getAttributes()))
+                {
+                    return true;
+                }
+            }
+            return false;
+        }
+
+        private boolean compareString(String str0, String str1)
+        {
+            if (str0 == null)
+            {
+                if (str1 == null)
+                {
+                    return true;
+                }
+
+            }
+            else
+            {
+                if (str0.equals(str1))
+                {
+                    return true;
+                }
+            }
+            return false;
+        }
+
+        /**
+         * @return Returns the attributes.
+         */
+        public Map getAttributes()
+        {
+            return attributes;
+        }
+
+        /**
+         * @param attributes The attributes to set.
+         */
+        public void setAttributes(Map attributes)
+        {
+            this.attributes = attributes;
+        }
+
+        /**
+         * @return Returns the elementName.
+         */
+        public String getElementName()
+        {
+            return elementName;
+        }
+
+        /**
+         * @param elementName The elementName to set.
+         */
+        public void setElementName(String elementName)
+        {
+            this.elementName = elementName;
+        }
+
+        /**
+         * @return Returns the text.
+         */
+        public String getText()
+        {
+            return text;
+        }
+
+        /**
+         * @param text The text to set.
+         */
+        public void setText(String text)
+        {
+            this.text = text;
+        }
+    }
+}

Propchange: portals/jetspeed-2/trunk/components/header-resource/src/java/org/apache/jetspeed/headerresource/impl/HeaderResourceImpl.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: portals/jetspeed-2/trunk/components/header-resource/xdocs/navigation.xml
URL: http://svn.apache.org/viewcvs/portals/jetspeed-2/trunk/components/header-resource/xdocs/navigation.xml?rev=220061&view=auto
==============================================================================
--- portals/jetspeed-2/trunk/components/header-resource/xdocs/navigation.xml (added)
+++ portals/jetspeed-2/trunk/components/header-resource/xdocs/navigation.xml Thu Jul 21 06:26:29
2005
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<!--
+Copyright 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.
+-->
+<project>
+  <body>
+    <links>
+      <item name="Jetspeed 2" href="../../index.html"/>
+    </links>
+  </body>
+</project>

Propchange: portals/jetspeed-2/trunk/components/header-resource/xdocs/navigation.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/aggregator/impl/PageAggregatorImpl.java
URL: http://svn.apache.org/viewcvs/portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/aggregator/impl/PageAggregatorImpl.java?rev=220061&r1=220060&r2=220061&view=diff
==============================================================================
--- portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/aggregator/impl/PageAggregatorImpl.java
(original)
+++ portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/aggregator/impl/PageAggregatorImpl.java
Thu Jul 21 06:26:29 2005
@@ -17,13 +17,12 @@
 
 import java.io.IOException;
 import java.util.ArrayList;
-import java.util.HashSet;
 import java.util.Iterator;
 import java.util.List;
-import java.util.Set;
 
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
+import org.apache.jetspeed.Jetspeed;
 import org.apache.jetspeed.PortalReservedParameters;
 import org.apache.jetspeed.aggregator.ContentDispatcher;
 import org.apache.jetspeed.aggregator.FailedToRenderFragmentException;
@@ -32,6 +31,8 @@
 import org.apache.jetspeed.container.state.NavigationalState;
 import org.apache.jetspeed.contentserver.ContentFilter;
 import org.apache.jetspeed.exception.JetspeedException;
+import org.apache.jetspeed.headerresource.HeaderResource;
+import org.apache.jetspeed.headerresource.HeaderResourceFactory;
 import org.apache.jetspeed.om.page.ContentFragment;
 import org.apache.jetspeed.om.page.ContentPage;
 import org.apache.jetspeed.request.RequestContext;
@@ -218,21 +219,16 @@
 
     private void addStyle( RequestContext context, String decoratorName, String decoratorType
)
     {
-        Set cssUrls = (Set) context.getAttribute("cssUrls");
-
-        if (cssUrls == null)
-        {
-            cssUrls = new HashSet();
-            context.setAttribute("cssUrls", cssUrls);
-        }
+        HeaderResourceFactory headerResourceFactory=(HeaderResourceFactory)Jetspeed.getComponentManager().getComponent(HeaderResourceFactory.class);
+        HeaderResource headerResource=headerResourceFactory.getHeaderResouce(context);
 
         if (decoratorType.equals(ContentFragment.LAYOUT))
         {
-            cssUrls.add("content/css/styles.css");
+            headerResource.addStyleSheet("content/css/styles.css");
         }
         else
         {
-            cssUrls.add("content/" + decoratorName + "/css/styles.css");
+            headerResource.addStyleSheet("content/" + decoratorName + "/css/styles.css");
         }
     }
 

Modified: portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/aggregator/impl/PortletAggregatorImpl.java
URL: http://svn.apache.org/viewcvs/portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/aggregator/impl/PortletAggregatorImpl.java?rev=220061&r1=220060&r2=220061&view=diff
==============================================================================
--- portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/aggregator/impl/PortletAggregatorImpl.java
(original)
+++ portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/aggregator/impl/PortletAggregatorImpl.java
Thu Jul 21 06:26:29 2005
@@ -17,16 +17,17 @@
 
 import java.io.IOException;
 import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Set;
 
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
+import org.apache.jetspeed.Jetspeed;
 import org.apache.jetspeed.PortalReservedParameters;
 import org.apache.jetspeed.aggregator.ContentDispatcher;
 import org.apache.jetspeed.aggregator.PortletAggregator;
 import org.apache.jetspeed.aggregator.PortletRenderer;
 import org.apache.jetspeed.exception.JetspeedException;
+import org.apache.jetspeed.headerresource.HeaderResource;
+import org.apache.jetspeed.headerresource.HeaderResourceFactory;
 import org.apache.jetspeed.om.page.ContentFragment;
 import org.apache.jetspeed.om.page.Fragment;
 import org.apache.jetspeed.om.page.psml.ContentFragmentImpl;
@@ -85,23 +86,16 @@
     private void addStyle(RequestContext context, String decoratorName, String decoratorType)

     {
         log.debug("addStyle: decoratorName=" + decoratorName + ", decoratorType=" + decoratorType
);
-        Set cssUrls = (Set) context.getAttribute("cssUrls");
-
-        if (cssUrls == null)
-        {
-            cssUrls = new HashSet();
-            context.setAttribute("cssUrls", cssUrls);
-        }
-        
-        //cssUrls.add("/WEB-INF/decorations/" + decoratorType + "/html/" + decoratorName
+ "/css/styles.css");
+        HeaderResourceFactory headerResourceFactory=(HeaderResourceFactory)Jetspeed.getComponentManager().getComponent(HeaderResourceFactory.class);
+        HeaderResource headerResource=headerResourceFactory.getHeaderResouce(context);
         
         if(decoratorType.equals(Fragment.LAYOUT))
         {
-            cssUrls.add("content/css/styles.css");
+            headerResource.addStyleSheet("content/css/styles.css");
         }
         else
         {
-            cssUrls.add("content/"+decoratorName+"/css/styles.css");
+            headerResource.addStyleSheet("content/"+decoratorName+"/css/styles.css");
         }
     }
 }

Modified: portals/jetspeed-2/trunk/jetspeed-api/src/java/org/apache/jetspeed/CommonPortletServices.java
URL: http://svn.apache.org/viewcvs/portals/jetspeed-2/trunk/jetspeed-api/src/java/org/apache/jetspeed/CommonPortletServices.java?rev=220061&r1=220060&r2=220061&view=diff
==============================================================================
--- portals/jetspeed-2/trunk/jetspeed-api/src/java/org/apache/jetspeed/CommonPortletServices.java
(original)
+++ portals/jetspeed-2/trunk/jetspeed-api/src/java/org/apache/jetspeed/CommonPortletServices.java
Thu Jul 21 06:26:29 2005
@@ -37,4 +37,5 @@
     public final static String CPS_ENTITY_ACCESS_COMPONENT = "cps:EntityAccessor";
     public final static String CPS_ID_GENERATOR_COMPONENT = "cps:IdGenerator";
     public final static String CPS_JETSPEED_POWERTOOL_FACTORY = "cps:Powertools";
+    public final static String CPS_HEADER_RESOURCE_FACTORY = "cps:HeaderResource";
 }

Modified: portals/jetspeed-2/trunk/jetspeed-api/src/java/org/apache/jetspeed/PortalReservedParameters.java
URL: http://svn.apache.org/viewcvs/portals/jetspeed-2/trunk/jetspeed-api/src/java/org/apache/jetspeed/PortalReservedParameters.java?rev=220061&r1=220060&r2=220061&view=diff
==============================================================================
--- portals/jetspeed-2/trunk/jetspeed-api/src/java/org/apache/jetspeed/PortalReservedParameters.java
(original)
+++ portals/jetspeed-2/trunk/jetspeed-api/src/java/org/apache/jetspeed/PortalReservedParameters.java
Thu Jul 21 06:26:29 2005
@@ -45,4 +45,5 @@
     public static final String PREFERED_CHARACTERENCODING_ATTRIBUTE = "org.apache.jetspeed.prefered.characterencoding";
     public static final String CONTENT_DISPATCHER_ATTRIBUTE = "org.apache.jetspeed.ContentDispatcher";
     public static final String OVERRIDE_PORTLET_TITLE_ATTR = "org.apache.jetspeed.portlet.title";
+    public static final String HEADER_RESOURCE_ATTRIBUTE = "org.apache.jetspeed.headerresource";
 }

Added: portals/jetspeed-2/trunk/jetspeed-api/src/java/org/apache/jetspeed/headerresource/HeaderResource.java
URL: http://svn.apache.org/viewcvs/portals/jetspeed-2/trunk/jetspeed-api/src/java/org/apache/jetspeed/headerresource/HeaderResource.java?rev=220061&view=auto
==============================================================================
--- portals/jetspeed-2/trunk/jetspeed-api/src/java/org/apache/jetspeed/headerresource/HeaderResource.java
(added)
+++ portals/jetspeed-2/trunk/jetspeed-api/src/java/org/apache/jetspeed/headerresource/HeaderResource.java
Thu Jul 21 06:26:29 2005
@@ -0,0 +1,78 @@
+/*
+ * 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.headerresource;
+
+import java.util.Map;
+
+/**
+ * HeaderResource has tags information to put them into &lt;head&gt; tag.
+ * 
+ * @author <a href="mailto:shinsuke@yahoo.co.jp">Shinsuke Sugaya</a>
+ * @version $Id: PortalReservedParameters.java 188569 2005-05-13 13:35:18Z weaver $
+ */
+public interface HeaderResource
+{
+
+    /**
+     * Returns tags to put them into &lt;head&gt; tag.
+     * 
+     * @return
+     */
+    public abstract String toString();
+
+    /**
+     * Add tag information to this instance.
+     * 
+     * For example, if you want to add the following tag into &lt;head&gt;,
+     * 
+     * &lt;foo a="1" b="2"&gt;FOO FOO&lt;/foo&gt;
+     * 
+     * Java code is:
+     * 
+     * HashMap map=new HashMap();
+     * map.put("a","1");
+     * map.put("b","2");
+     * headerResouce.addHeaderInfo("foo",map,"FOO FOO");
+     * 
+     * @param elementName Tag's name
+     * @param attributes Tag's attributes
+     * @param text Tag's content
+     */
+    public abstract void addHeaderInfo(String elementName, Map attributes, String text);
+
+    /**
+     * Convenient method to add &lt;script&gt; tag with defer option.
+     * 
+     * @param path Javascript file path
+     * @param defer defer attributes for &lt;script&gt; tag.
+     */
+    public abstract void addJavaScript(String path, boolean defer);
+
+    /**
+     * Convenient method to add &lt;script&gt; tag.
+     * 
+     * @param path Javascript file path
+     */
+    public abstract void addJavaScript(String path);
+
+    /**
+     * Convenient method to add &lt;link&gt; tag.
+     * 
+     * @param path CSS file path
+     */
+    public abstract void addStyleSheet(String path);
+
+}
\ No newline at end of file

Propchange: portals/jetspeed-2/trunk/jetspeed-api/src/java/org/apache/jetspeed/headerresource/HeaderResource.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: portals/jetspeed-2/trunk/jetspeed-api/src/java/org/apache/jetspeed/headerresource/HeaderResourceFactory.java
URL: http://svn.apache.org/viewcvs/portals/jetspeed-2/trunk/jetspeed-api/src/java/org/apache/jetspeed/headerresource/HeaderResourceFactory.java?rev=220061&view=auto
==============================================================================
--- portals/jetspeed-2/trunk/jetspeed-api/src/java/org/apache/jetspeed/headerresource/HeaderResourceFactory.java
(added)
+++ portals/jetspeed-2/trunk/jetspeed-api/src/java/org/apache/jetspeed/headerresource/HeaderResourceFactory.java
Thu Jul 21 06:26:29 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.headerresource;
+
+import javax.portlet.PortletRequest;
+
+import org.apache.jetspeed.request.RequestContext;
+
+/**
+ * HeaderResourceFactory provides HeaderResource instance to manage tags, such
+ * as &lt;link&gt; and &lt;script&gt;, in &lt;head&gt; tag.
+ * 
+ * HeaderResourceFactory is defined by jetspeed-spring.xml. If you want to use
+ * customized HeaderResource, the parameter needs to be changed in
+ * jetspeed-spring.xml.
+ * 
+ * @author <a href="mailto:shinsuke@yahoo.co.jp">Shinsuke Sugaya</a>
+ * @version $Id: PortalReservedParameters.java 188569 2005-05-13 13:35:18Z weaver $
+ */
+public interface HeaderResourceFactory
+{
+
+    /**
+     * Provides HeaderResource instance from RequestContext.
+     * 
+     * @param requestContext
+     * @return
+     */
+    public abstract HeaderResource getHeaderResouce(RequestContext requestContext);
+
+    /**
+     * Provides HeaderResource instance from PortletRequest.
+     * 
+     * @param request
+     * @return
+     */
+    public abstract HeaderResource getHeaderResouce(PortletRequest request);
+
+}
\ No newline at end of file

Propchange: portals/jetspeed-2/trunk/jetspeed-api/src/java/org/apache/jetspeed/headerresource/HeaderResourceFactory.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: portals/jetspeed-2/trunk/jetspeed-components.xml
URL: http://svn.apache.org/viewcvs/portals/jetspeed-2/trunk/jetspeed-components.xml?rev=220061&r1=220060&r2=220061&view=diff
==============================================================================
--- portals/jetspeed-2/trunk/jetspeed-components.xml (original)
+++ portals/jetspeed-2/trunk/jetspeed-components.xml Thu Jul 21 06:26:29 2005
@@ -210,7 +210,17 @@
 	           <war.bundle>true</war.bundle>
 	        </properties>
 		</dependency>
-		
+		<dependency>
+			<id>jetspeed-header-resource</id>
+			<groupId>jetspeed2</groupId>
+			<version>
+				${jetspeed.version}
+			</version>
+			<properties>
+	           <war.bundle>true</war.bundle>
+	        </properties>
+		</dependency>
+
         <!-- taglib stuff -->
 		<dependency>
 			<id>jstl</id>
@@ -273,4 +283,4 @@
 		</dependency>
 	</dependencies>
 
-</project>
\ No newline at end of file
+</project>

Modified: portals/jetspeed-2/trunk/portal-webapp/src/webapp/WEB-INF/assembly/jetspeed-services.xml
URL: http://svn.apache.org/viewcvs/portals/jetspeed-2/trunk/portal-webapp/src/webapp/WEB-INF/assembly/jetspeed-services.xml?rev=220061&r1=220060&r2=220061&view=diff
==============================================================================
--- portals/jetspeed-2/trunk/portal-webapp/src/webapp/WEB-INF/assembly/jetspeed-services.xml
(original)
+++ portals/jetspeed-2/trunk/portal-webapp/src/webapp/WEB-INF/assembly/jetspeed-services.xml
Thu Jul 21 06:26:29 2005
@@ -68,6 +68,9 @@
           <entry key='Powertools'>
             <ref bean='Powertools'/>
           </entry>
+          <entry key="HeaderResource">
+            <ref bean="org.apache.jetspeed.headerresource.HeaderResourceFactory"/>
+          </entry>
   	   	</map>
   	   </constructor-arg>
   </bean>

Modified: portals/jetspeed-2/trunk/portal-webapp/src/webapp/WEB-INF/assembly/jetspeed-spring.xml
URL: http://svn.apache.org/viewcvs/portals/jetspeed-2/trunk/portal-webapp/src/webapp/WEB-INF/assembly/jetspeed-spring.xml?rev=220061&r1=220060&r2=220061&view=diff
==============================================================================
--- portals/jetspeed-2/trunk/portal-webapp/src/webapp/WEB-INF/assembly/jetspeed-spring.xml
(original)
+++ portals/jetspeed-2/trunk/portal-webapp/src/webapp/WEB-INF/assembly/jetspeed-spring.xml
Thu Jul 21 06:26:29 2005
@@ -403,5 +403,11 @@
       class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
     <property name="location"><value>file:///${applicationRoot}/WEB-INF/conf/jetspeed.properties</value></property>
   </bean>  
-  
+
+  <!-- HeaderResource Factory -->
+  <bean id="org.apache.jetspeed.headerresource.HeaderResourceFactory"
+      class="org.apache.jetspeed.headerresource.impl.HeaderResourceFactoryImpl"
+  >
+  </bean>
+
 </beans>

Modified: portals/jetspeed-2/trunk/portal-webapp/src/webapp/WEB-INF/decorations/layout/html/ja/tigris/decorator-top.vm
URL: http://svn.apache.org/viewcvs/portals/jetspeed-2/trunk/portal-webapp/src/webapp/WEB-INF/decorations/layout/html/ja/tigris/decorator-top.vm?rev=220061&r1=220060&r2=220061&view=diff
==============================================================================
--- portals/jetspeed-2/trunk/portal-webapp/src/webapp/WEB-INF/decorations/layout/html/ja/tigris/decorator-top.vm
(original)
+++ portals/jetspeed-2/trunk/portal-webapp/src/webapp/WEB-INF/decorations/layout/html/ja/tigris/decorator-top.vm
Thu Jul 21 06:26:29 2005
@@ -27,7 +27,7 @@
     <meta http-equiv="Content-type" content="text/html#if($response.characterEncoding);
charset=$response.characterEncoding#end" />
     <meta http-equiv="Content-style-type" content="text/css" />
 
-    #includeStyleSheets()
+    #includeHeaderResource()
     <title>$jetspeed.page.getTitle($preferedLocale)</title>
 
     <meta name="version" content="/* $Id$" />

Modified: portals/jetspeed-2/trunk/portal-webapp/src/webapp/WEB-INF/decorations/layout/html/jetspeed/decorator-top.vm
URL: http://svn.apache.org/viewcvs/portals/jetspeed-2/trunk/portal-webapp/src/webapp/WEB-INF/decorations/layout/html/jetspeed/decorator-top.vm?rev=220061&r1=220060&r2=220061&view=diff
==============================================================================
--- portals/jetspeed-2/trunk/portal-webapp/src/webapp/WEB-INF/decorations/layout/html/jetspeed/decorator-top.vm
(original)
+++ portals/jetspeed-2/trunk/portal-webapp/src/webapp/WEB-INF/decorations/layout/html/jetspeed/decorator-top.vm
Thu Jul 21 06:26:29 2005
@@ -24,7 +24,7 @@
 <head>
     <meta http-equiv="Content-type" content="text/html#if($response.characterEncoding);
charset=$response.characterEncoding#end" />
     <title>$jetspeed.page.getTitle($preferedLocale)</title>
-    #includeStyleSheets()
+    #includeHeaderResource()
 </head>
 <body class="${_layoutBaseCssClass}">
 

Modified: portals/jetspeed-2/trunk/portal-webapp/src/webapp/WEB-INF/decorations/layout/html/jscookmenu/decorator-top.vm
URL: http://svn.apache.org/viewcvs/portals/jetspeed-2/trunk/portal-webapp/src/webapp/WEB-INF/decorations/layout/html/jscookmenu/decorator-top.vm?rev=220061&r1=220060&r2=220061&view=diff
==============================================================================
--- portals/jetspeed-2/trunk/portal-webapp/src/webapp/WEB-INF/decorations/layout/html/jscookmenu/decorator-top.vm
(original)
+++ portals/jetspeed-2/trunk/portal-webapp/src/webapp/WEB-INF/decorations/layout/html/jscookmenu/decorator-top.vm
Thu Jul 21 06:26:29 2005
@@ -60,7 +60,7 @@
     <meta http-equiv="Content-type" content="text/html#if($response.characterEncoding);
charset=$response.characterEncoding#end" />
     <meta http-equiv="Content-style-type" content="text/css" />
 
-    #includeStyleSheets()
+    #includeHeaderResource()
     <title>$jetspeed.page.getTitle($preferedLocale)</title>
 
     <meta name="version" content="/* $Id$" />

Modified: portals/jetspeed-2/trunk/portal-webapp/src/webapp/WEB-INF/decorations/layout/html/simple/decorator-top.vm
URL: http://svn.apache.org/viewcvs/portals/jetspeed-2/trunk/portal-webapp/src/webapp/WEB-INF/decorations/layout/html/simple/decorator-top.vm?rev=220061&r1=220060&r2=220061&view=diff
==============================================================================
--- portals/jetspeed-2/trunk/portal-webapp/src/webapp/WEB-INF/decorations/layout/html/simple/decorator-top.vm
(original)
+++ portals/jetspeed-2/trunk/portal-webapp/src/webapp/WEB-INF/decorations/layout/html/simple/decorator-top.vm
Thu Jul 21 06:26:29 2005
@@ -27,7 +27,7 @@
     <meta http-equiv="Content-type" content="text/html#if($response.characterEncoding);
charset=$response.characterEncoding#end" />
     <meta http-equiv="Content-style-type" content="text/css" />
 
-    #includeStyleSheets()
+    #includeHeaderResource()
     <title>$jetspeed.page.getTitle($preferedLocale)</title>
 
     <meta name="version" content="/* $Id: decorator-top.vm,v 1.5 2004/12/03 09:10:18 taylor
Exp $" />

Modified: portals/jetspeed-2/trunk/portal-webapp/src/webapp/WEB-INF/decorations/layout/html/tigris/decorator-top.vm
URL: http://svn.apache.org/viewcvs/portals/jetspeed-2/trunk/portal-webapp/src/webapp/WEB-INF/decorations/layout/html/tigris/decorator-top.vm?rev=220061&r1=220060&r2=220061&view=diff
==============================================================================
--- portals/jetspeed-2/trunk/portal-webapp/src/webapp/WEB-INF/decorations/layout/html/tigris/decorator-top.vm
(original)
+++ portals/jetspeed-2/trunk/portal-webapp/src/webapp/WEB-INF/decorations/layout/html/tigris/decorator-top.vm
Thu Jul 21 06:26:29 2005
@@ -27,7 +27,7 @@
     <meta http-equiv="Content-type" content="text/html#if($response.characterEncoding);
charset=$response.characterEncoding#end" />
     <meta http-equiv="Content-style-type" content="text/css" />
 
-    #includeStyleSheets()
+    #includeHeaderResource()
     <title>$jetspeed.page.getTitle($preferedLocale)</title>
 
     <meta name="version" content="/* $Id$" />

Modified: portals/jetspeed-2/trunk/portal-webapp/src/webapp/WEB-INF/jetspeed_macros.vm
URL: http://svn.apache.org/viewcvs/portals/jetspeed-2/trunk/portal-webapp/src/webapp/WEB-INF/jetspeed_macros.vm?rev=220061&r1=220060&r2=220061&view=diff
==============================================================================
--- portals/jetspeed-2/trunk/portal-webapp/src/webapp/WEB-INF/jetspeed_macros.vm (original)
+++ portals/jetspeed-2/trunk/portal-webapp/src/webapp/WEB-INF/jetspeed_macros.vm Thu Jul 21
06:26:29 2005
@@ -6,9 +6,8 @@
 #end
 
 #* Adds link for all style sheets required by the layout and portlet decorations *#
-#macro (includeStyleSheets)
- #set($cssUrls = $renderRequest.getAttribute("cssUrls"))
- #foreach($cssUrl in $cssUrls)
-	<link rel="stylesheet" type="text/css" media="all" href="$response.encodeURL($cssUrl)"
/>
- #end
+#macro (includeHeaderResource)
+ #set($resourceHeaderFactory = $jetspeed.getComponent("org.apache.jetspeed.headerresource.HeaderResourceFactory"))
+ #set($resourceHeader = $resourceHeaderFactory.getHeaderResouce($JS2RequestContext))
+ $resourceHeader
 #end



---------------------------------------------------------------------
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