Author: julien(a)jboss.com
Date: 2007-03-13 12:32:18 -0400 (Tue, 13 Mar 2007)
New Revision: 6653
Added:
trunk/common/src/main/org/jboss/portal/common/util/CLResourceLoader.java
trunk/common/src/main/org/jboss/portal/common/util/ResourceLoader.java
trunk/faces/src/main/org/jboss/portal/faces/portlet/
trunk/faces/src/main/org/jboss/portal/faces/portlet/BridgeInfo.java
trunk/faces/src/main/org/jboss/portal/faces/portlet/BridgePortletConfig.java
trunk/faces/src/main/org/jboss/portal/faces/portlet/JSFMetaBridgePortlet.java
Removed:
trunk/common/src/main/org/jboss/portal/common/util/CLLoader.java
trunk/common/src/main/org/jboss/portal/common/util/Loader.java
Modified:
trunk/cms/src/main/org/jboss/portal/test/cms/JackrabbitTestCase.java
trunk/cms/src/main/org/jboss/portal/test/cms/commands/AbstractCommandTestCase.java
trunk/common/src/main/org/jboss/portal/common/logging/LoaderRepositorySelector.java
trunk/core-admin/build.xml
trunk/core-admin/src/resources/portal-admin-war/WEB-INF/portlet.xml
trunk/core-admin/src/resources/portal-admin-war/WEB-INF/web.xml
trunk/core/build.xml
trunk/faces/build.xml
trunk/jems/src/main/org/jboss/portal/jems/hibernate/SessionFactoryBinder.java
trunk/server/src/main/org/jboss/portal/server/config/ServerConfigService.java
trunk/theme/src/main/org/jboss/portal/test/theme/TestLayoutServiceImpl.java
trunk/theme/src/main/org/jboss/portal/test/theme/TestThemeServiceImpl.java
trunk/theme/src/main/org/jboss/portal/test/theme/render/TestRenderedMarkup.java
Log:
- JSF meta bridge portlet which allow to run with Sun RI or myfaces JSF implementation.
Modified: trunk/cms/src/main/org/jboss/portal/test/cms/JackrabbitTestCase.java
===================================================================
--- trunk/cms/src/main/org/jboss/portal/test/cms/JackrabbitTestCase.java 2007-03-13
13:19:38 UTC (rev 6652)
+++ trunk/cms/src/main/org/jboss/portal/test/cms/JackrabbitTestCase.java 2007-03-13
16:32:18 UTC (rev 6653)
@@ -28,7 +28,7 @@
import org.apache.jackrabbit.name.QName;
import org.jboss.portal.cms.impl.jcr.jackrabbit.JackrabbitJCRService;
import org.jboss.portal.cms.util.RepositoryUtil;
-import org.jboss.portal.common.util.CLLoader;
+import org.jboss.portal.common.util.CLResourceLoader;
import org.jboss.portal.common.util.LoaderResource;
import javax.jcr.Node;
@@ -36,7 +36,6 @@
import javax.jcr.Session;
import javax.jcr.Workspace;
import javax.jcr.nodetype.NodeTypeManager;
-import java.util.Map;
/**
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
@@ -56,7 +55,7 @@
super.setUp();
// Load config
- LoaderResource res = new CLLoader().getResource("jcr/repository.xml");
+ LoaderResource res = new
CLResourceLoader().getResource("jcr/repository.xml");
String config = res.asString();
jcr = new JackrabbitJCRService();
Modified:
trunk/cms/src/main/org/jboss/portal/test/cms/commands/AbstractCommandTestCase.java
===================================================================
---
trunk/cms/src/main/org/jboss/portal/test/cms/commands/AbstractCommandTestCase.java 2007-03-13
13:19:38 UTC (rev 6652)
+++
trunk/cms/src/main/org/jboss/portal/test/cms/commands/AbstractCommandTestCase.java 2007-03-13
16:32:18 UTC (rev 6653)
@@ -23,14 +23,13 @@
package org.jboss.portal.test.cms.commands;
import org.jboss.portal.cms.impl.jcr.JCRCMS;
-import org.jboss.portal.common.util.CLLoader;
+import org.jboss.portal.common.util.CLResourceLoader;
import org.jboss.portal.common.util.LoaderResource;
import org.jboss.portal.common.util.XML;
import org.jboss.portal.test.cms.AbstractCMSTestCase;
import org.w3c.dom.Document;
import java.util.Locale;
-import java.util.Map;
/*
* Created on Sep 18, 2006
@@ -55,7 +54,7 @@
{
super.setUp();
- LoaderResource res = new CLLoader().getResource("jcr/repository.xml");
+ LoaderResource res = new
CLResourceLoader().getResource("jcr/repository.xml");
Document config =
res.asDocument(XML.getDocumentBuilderFactory().newDocumentBuilder());
service = new JCRCMS();
Modified:
trunk/common/src/main/org/jboss/portal/common/logging/LoaderRepositorySelector.java
===================================================================
---
trunk/common/src/main/org/jboss/portal/common/logging/LoaderRepositorySelector.java 2007-03-13
13:19:38 UTC (rev 6652)
+++
trunk/common/src/main/org/jboss/portal/common/logging/LoaderRepositorySelector.java 2007-03-13
16:32:18 UTC (rev 6653)
@@ -30,7 +30,7 @@
import org.apache.log4j.spi.RepositorySelector;
import org.apache.log4j.spi.RootCategory;
import org.apache.log4j.xml.DOMConfigurator;
-import org.jboss.portal.common.util.Loader;
+import org.jboss.portal.common.util.ResourceLoader;
import org.jboss.portal.common.util.Tools;
import org.w3c.dom.Document;
@@ -62,7 +62,7 @@
/**
* Register with this repository selector.
*/
- public static synchronized void register(ClassLoader classloader, Loader loader,
String pathToLog4jFile)
+ public static synchronized void register(ClassLoader classloader, ResourceLoader
loader, String pathToLog4jFile)
{
if (classloader == null)
{
Deleted: trunk/common/src/main/org/jboss/portal/common/util/CLLoader.java
===================================================================
--- trunk/common/src/main/org/jboss/portal/common/util/CLLoader.java 2007-03-13 13:19:38
UTC (rev 6652)
+++ trunk/common/src/main/org/jboss/portal/common/util/CLLoader.java 2007-03-13 16:32:18
UTC (rev 6653)
@@ -1,104 +0,0 @@
-/******************************************************************************
- * JBoss, a division of Red Hat *
- * Copyright 2006, Red Hat Middleware, LLC, and individual *
- * contributors as indicated by the @authors tag. See the *
- * copyright.txt in the distribution for a full listing of *
- * individual contributors. *
- * *
- * This is free software; you can redistribute it and/or modify it *
- * under the terms of the GNU Lesser General Public License as *
- * published by the Free Software Foundation; either version 2.1 of *
- * the License, or (at your option) any later version. *
- * *
- * This software is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
- * Lesser General Public License for more details. *
- * *
- * You should have received a copy of the GNU Lesser General Public *
- * License along with this software; if not, write to the Free *
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
- * 02110-1301 USA, or see the FSF site:
http://www.fsf.org. *
- ******************************************************************************/
-package org.jboss.portal.common.util;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.net.URL;
-
-/**
- * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
- * @version $Revision$
- */
-public class CLLoader implements Loader
-{
-
- private final ClassLoader loader;
-
- public CLLoader(ClassLoader loader)
- {
- if (loader == null)
- {
- throw new IllegalArgumentException("No classloader provided");
- }
- this.loader = loader;
- }
-
- public CLLoader()
- {
- this(Thread.currentThread().getContextClassLoader());
- }
-
- public InputStream load(String location)
- {
- return loader.getResourceAsStream(location);
- }
-
- public LoaderResource getResource(String location)
- {
- if (location == null)
- {
- throw new IllegalArgumentException("Location is null");
- }
- URL url = loader.getResource(location);
- return new URLResource(location, url);
- }
-
- private static class URLResource extends LoaderResource
- {
-
- private final URL url;
-
- public URLResource(String location, URL url)
- {
- super(location);
- this.url = url;
- }
-
- public boolean exists()
- {
- return URLTools.exists(url);
- }
-
- public InputStream asInputStream() throws IllegalStateException
- {
- if (!exists())
- {
- throw new IllegalStateException("Resource " + location + "
does not exist");
- }
- try
- {
- return url.openStream();
- }
- catch (IOException e)
- {
- throw new IllegalStateException("Cannot open resource stream " +
location);
- }
- }
-
- public String toString()
- {
- return "Resource[" + location + "," + url + "]";
- }
- }
-}
Copied: trunk/common/src/main/org/jboss/portal/common/util/CLResourceLoader.java (from rev
6642, trunk/common/src/main/org/jboss/portal/common/util/CLLoader.java)
===================================================================
--- trunk/common/src/main/org/jboss/portal/common/util/CLResourceLoader.java
(rev 0)
+++ trunk/common/src/main/org/jboss/portal/common/util/CLResourceLoader.java 2007-03-13
16:32:18 UTC (rev 6653)
@@ -0,0 +1,104 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.common.util;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.URL;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision$
+ */
+public class CLResourceLoader implements ResourceLoader
+{
+
+ private final ClassLoader loader;
+
+ public CLResourceLoader(ClassLoader loader)
+ {
+ if (loader == null)
+ {
+ throw new IllegalArgumentException("No classloader provided");
+ }
+ this.loader = loader;
+ }
+
+ public CLResourceLoader()
+ {
+ this(Thread.currentThread().getContextClassLoader());
+ }
+
+ public InputStream load(String location)
+ {
+ return loader.getResourceAsStream(location);
+ }
+
+ public LoaderResource getResource(String location)
+ {
+ if (location == null)
+ {
+ throw new IllegalArgumentException("Location is null");
+ }
+ URL url = loader.getResource(location);
+ return new URLResource(location, url);
+ }
+
+ private static class URLResource extends LoaderResource
+ {
+
+ private final URL url;
+
+ public URLResource(String location, URL url)
+ {
+ super(location);
+ this.url = url;
+ }
+
+ public boolean exists()
+ {
+ return URLTools.exists(url);
+ }
+
+ public InputStream asInputStream() throws IllegalStateException
+ {
+ if (!exists())
+ {
+ throw new IllegalStateException("Resource " + location + "
does not exist");
+ }
+ try
+ {
+ return url.openStream();
+ }
+ catch (IOException e)
+ {
+ throw new IllegalStateException("Cannot open resource stream " +
location);
+ }
+ }
+
+ public String toString()
+ {
+ return "Resource[" + location + "," + url + "]";
+ }
+ }
+}
Property changes on:
trunk/common/src/main/org/jboss/portal/common/util/CLResourceLoader.java
___________________________________________________________________
Name: svn:executable
+ *
Name: svn:keywords
+ Author Date Id Revision
Name: svn:eol-style
+ native
Deleted: trunk/common/src/main/org/jboss/portal/common/util/Loader.java
===================================================================
--- trunk/common/src/main/org/jboss/portal/common/util/Loader.java 2007-03-13 13:19:38 UTC
(rev 6652)
+++ trunk/common/src/main/org/jboss/portal/common/util/Loader.java 2007-03-13 16:32:18 UTC
(rev 6653)
@@ -1,49 +0,0 @@
-/******************************************************************************
- * JBoss, a division of Red Hat *
- * Copyright 2006, Red Hat Middleware, LLC, and individual *
- * contributors as indicated by the @authors tag. See the *
- * copyright.txt in the distribution for a full listing of *
- * individual contributors. *
- * *
- * This is free software; you can redistribute it and/or modify it *
- * under the terms of the GNU Lesser General Public License as *
- * published by the Free Software Foundation; either version 2.1 of *
- * the License, or (at your option) any later version. *
- * *
- * This software is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
- * Lesser General Public License for more details. *
- * *
- * You should have received a copy of the GNU Lesser General Public *
- * License along with this software; if not, write to the Free *
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
- * 02110-1301 USA, or see the FSF site:
http://www.fsf.org. *
- ******************************************************************************/
-package org.jboss.portal.common.util;
-
-import java.io.InputStream;
-
-/**
- * A generic interface which define loading capabilities.
- * The name format must follow the regular expression : ^(/[-a-zA-Z0-9_\.]+)+$
- *
- * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
- * @version $Revision$
- */
-public interface Loader
-{
-
- /** Helper to validate name. */
- String REGEX_NAME_VALIDATOR = "^(/[-a-zA-Z0-9_\\.]+)+$";
-
- /**
- * Returns an InputStream or null if not found.
- */
- InputStream load(String location);
-
- /**
- *
- */
- LoaderResource getResource(String location);
-}
Copied: trunk/common/src/main/org/jboss/portal/common/util/ResourceLoader.java (from rev
6642, trunk/common/src/main/org/jboss/portal/common/util/Loader.java)
===================================================================
--- trunk/common/src/main/org/jboss/portal/common/util/ResourceLoader.java
(rev 0)
+++ trunk/common/src/main/org/jboss/portal/common/util/ResourceLoader.java 2007-03-13
16:32:18 UTC (rev 6653)
@@ -0,0 +1,49 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.common.util;
+
+import java.io.InputStream;
+
+/**
+ * A generic interface which define loading capabilities of resources.
+ * The name format must follow the regular expression : ^(/[-a-zA-Z0-9_\.]+)+$
+ *
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision$
+ */
+public interface ResourceLoader
+{
+
+ /** Helper to validate name. */
+ String REGEX_NAME_VALIDATOR = "^(/[-a-zA-Z0-9_\\.]+)+$";
+
+ /**
+ * Returns an InputStream or null if not found.
+ */
+ InputStream load(String location);
+
+ /**
+ *
+ */
+ LoaderResource getResource(String location);
+}
Property changes on:
trunk/common/src/main/org/jboss/portal/common/util/ResourceLoader.java
___________________________________________________________________
Name: svn:executable
+ *
Name: svn:keywords
+ Author Date Id Revision
Name: svn:eol-style
+ native
Modified: trunk/core/build.xml
===================================================================
--- trunk/core/build.xml 2007-03-13 13:19:38 UTC (rev 6652)
+++ trunk/core/build.xml 2007-03-13 16:32:18 UTC (rev 6653)
@@ -337,12 +337,6 @@
<fileset dir="${apache.fileupload.lib}"
includes="commons-fileupload.jar"/>
<fileset dir="${jakarta.io.lib}"
includes="commons-io.jar"/>
<fileset dir="${portals.bridges.lib}"
includes="portals-bridges-common.jar"/>
-
- <!-- For JSF -->
- <fileset dir="../core-admin/src/etc/sun-jsf"
includes="jsf-example.jar"/>
- <fileset dir="${apache.lang.lib}"
includes="commons-lang-2.0.jar"/>
- <fileset dir="${facelets.facelets.lib}"
includes="jsf-facelets.jar"/>
- <fileset dir="${el.el.lib}"
includes="el-api.jar,el-ri.jar"/>
</copy>
<!--dtd-->
Modified: trunk/core-admin/build.xml
===================================================================
--- trunk/core-admin/build.xml 2007-03-13 13:19:38 UTC (rev 6652)
+++ trunk/core-admin/build.xml 2007-03-13 16:32:18 UTC (rev 6653)
@@ -196,7 +196,16 @@
</copy>
<copy todir="${build.resources}/portal-admin.sar/lib">
<fileset dir="${build.lib}"
includes="portal-core-admin-lib.jar"/>
+ <!--<fileset dir="."
includes="jsf-portlet.jar"/>-->
+
+ <!-- For JSF -->
+ <fileset dir="../core-admin/src/etc/sun-jsf"
includes="jsf-example.jar"/>
+ <!--<fileset dir="${apache.lang.lib}"
includes="commons-lang-2.0.jar"/>-->
+ <fileset dir="${facelets.facelets.lib}"
includes="jsf-facelets.jar"/>
+ <fileset dir="${el.el.lib}"
includes="el-api.jar,el-ri.jar"/>
</copy>
+
+
<copy
todir="${build.resources}/portal-admin.sar/portal-admin.war">
<fileset dir="${build.resources}/portal-admin-war"/>
<fileset dir="${source.bin}/portal-admin-war"/>
Modified: trunk/core-admin/src/resources/portal-admin-war/WEB-INF/portlet.xml
===================================================================
--- trunk/core-admin/src/resources/portal-admin-war/WEB-INF/portlet.xml 2007-03-13
13:19:38 UTC (rev 6652)
+++ trunk/core-admin/src/resources/portal-admin-war/WEB-INF/portlet.xml 2007-03-13
16:32:18 UTC (rev 6653)
@@ -31,9 +31,9 @@
<description>Administration Portlet</description>
<portlet-name>AdminPortlet</portlet-name>
<display-name>Administration Portlet</display-name>
-
<portlet-class>org.apache.myfaces.portlet.MyFacesGenericPortlet</portlet-class>
+
<portlet-class>org.jboss.portal.faces.portlet.JSFMetaBridgePortlet</portlet-class>
<init-param>
- <name>default-view</name>
+ <name>VIEW</name>
<value>/WEB-INF/jsf/objects.xhtml</value>
</init-param>
<expiration-cache>-1</expiration-cache>
Modified: trunk/core-admin/src/resources/portal-admin-war/WEB-INF/web.xml
===================================================================
--- trunk/core-admin/src/resources/portal-admin-war/WEB-INF/web.xml 2007-03-13 13:19:38
UTC (rev 6652)
+++ trunk/core-admin/src/resources/portal-admin-war/WEB-INF/web.xml 2007-03-13 16:32:18
UTC (rev 6653)
@@ -27,6 +27,8 @@
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee
http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"
version="2.4">
+
+ <!-- MyFaces specific configuration -->
<context-param>
<param-name>org.apache.myfaces.ALLOW_JAVASCRIPT</param-name>
<param-value>true</param-value>
@@ -47,6 +49,8 @@
<param-name>org.apache.myfaces.PRETTY_HTML</param-name>
<param-value>true</param-value>
</context-param>
+
+ <!-- Facelet configuration -->
<context-param>
<param-name>facelets.DEVELOPMENT</param-name>
<param-value>false</param-value>
@@ -59,6 +63,8 @@
<param-name>facelets.LIBRARIES</param-name>
<param-value>/WEB-INF/portal.taglib.xml</param-value>
</context-param>
+
+ <!-- JSF configuration -->
<context-param>
<param-name>javax.faces.DEFAULT_SUFFIX</param-name>
<param-value>.xhtml</param-value>
@@ -67,6 +73,15 @@
<param-name>javax.faces.STATE_SAVING_METHOD</param-name>
<param-value>server</param-value>
</context-param>
+
+ <!-- -->
+ <servlet>
+ <servlet-name>Faces Servlet</servlet-name>
+ <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
+ <load-on-startup>1</load-on-startup>
+ </servlet>
+
+ <!-- -->
<listener>
<listener-class>org.apache.myfaces.webapp.StartupServletContextListener</listener-class>
</listener>
Modified: trunk/faces/build.xml
===================================================================
--- trunk/faces/build.xml 2007-03-13 13:19:38 UTC (rev 6652)
+++ trunk/faces/build.xml 2007-03-13 16:32:18 UTC (rev 6653)
@@ -100,6 +100,7 @@
<!-- Configure modules -->
<call target="configure-modules"/>
<path id="dependentmodule.classpath">
+ <path refid="jboss.portlet-api.classpath"/>
<path refid="jboss.portal-common.classpath"/>
</path>
Added: trunk/faces/src/main/org/jboss/portal/faces/portlet/BridgeInfo.java
===================================================================
--- trunk/faces/src/main/org/jboss/portal/faces/portlet/BridgeInfo.java
(rev 0)
+++ trunk/faces/src/main/org/jboss/portal/faces/portlet/BridgeInfo.java 2007-03-13
16:32:18 UTC (rev 6653)
@@ -0,0 +1,74 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.faces.portlet;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public class BridgeInfo
+{
+
+ /** . */
+ static final BridgeInfo SUN_JSF = new BridgeInfo(
+ "jsfportletbridge",
+ "com.sun.faces.portlet.FacesPortlet",
+ "com.sun.faces.portlet.INIT_VIEW");
+
+ /** . */
+ static final BridgeInfo MYFACES_JSF = new BridgeInfo(
+ "myfaces",
+ "org.apache.myfaces.portlet.MyFacesGenericPortlet",
+ "default-view");
+
+ /** . */
+ private final String name;
+
+ /** . */
+ private final String portletClassName;
+
+ /** . */
+ private final String initParamViewName;
+
+ public BridgeInfo(String name, String portletClassName, String initParamViewName)
+ {
+ this.name = name;
+ this.portletClassName = portletClassName;
+ this.initParamViewName = initParamViewName;
+ }
+
+ public String getName()
+ {
+ return name;
+ }
+
+ public String getPortletClassName()
+ {
+ return portletClassName;
+ }
+
+ public String getInitParamViewName()
+ {
+ return initParamViewName;
+ }
+}
Added: trunk/faces/src/main/org/jboss/portal/faces/portlet/BridgePortletConfig.java
===================================================================
--- trunk/faces/src/main/org/jboss/portal/faces/portlet/BridgePortletConfig.java
(rev 0)
+++
trunk/faces/src/main/org/jboss/portal/faces/portlet/BridgePortletConfig.java 2007-03-13
16:32:18 UTC (rev 6653)
@@ -0,0 +1,91 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.faces.portlet;
+
+import org.jboss.portal.common.util.Tools;
+
+import javax.portlet.PortletConfig;
+import javax.portlet.PortletContext;
+import java.util.ResourceBundle;
+import java.util.Locale;
+import java.util.Enumeration;
+import java.util.List;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public class BridgePortletConfig implements PortletConfig
+{
+
+ /** . */
+ private final PortletConfig delegate;
+
+ /** . */
+ private final BridgeInfo bridgeInfo;
+
+ public BridgePortletConfig(PortletConfig delegate, BridgeInfo bridgeInfo)
+ {
+ this.delegate = delegate;
+ this.bridgeInfo = bridgeInfo;
+ }
+
+ public String getPortletName()
+ {
+ return delegate.getPortletName();
+ }
+
+ public PortletContext getPortletContext()
+ {
+ return delegate.getPortletContext();
+ }
+
+ public ResourceBundle getResourceBundle(Locale locale)
+ {
+ return delegate.getResourceBundle(locale);
+ }
+
+ public String getInitParameter(String name) throws IllegalArgumentException
+ {
+ if (name == null)
+ {
+ throw new IllegalArgumentException();
+ }
+
+ //
+ if (bridgeInfo.getInitParamViewName().equals(name))
+ {
+ return delegate.getInitParameter("VIEW");
+ }
+
+ //
+ return delegate.getInitParameter(name);
+ }
+
+ public Enumeration getInitParameterNames()
+ {
+ List names = Tools.toList(delegate.getInitParameterNames());
+ names.add(bridgeInfo.getInitParamViewName());
+ return Tools.toEnumeration(names.iterator());
+ }
+}
Added: trunk/faces/src/main/org/jboss/portal/faces/portlet/JSFMetaBridgePortlet.java
===================================================================
--- trunk/faces/src/main/org/jboss/portal/faces/portlet/JSFMetaBridgePortlet.java
(rev 0)
+++
trunk/faces/src/main/org/jboss/portal/faces/portlet/JSFMetaBridgePortlet.java 2007-03-13
16:32:18 UTC (rev 6653)
@@ -0,0 +1,113 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.faces.portlet;
+
+import org.apache.log4j.Logger;
+
+import javax.portlet.Portlet;
+import javax.portlet.PortletConfig;
+import javax.portlet.PortletException;
+import javax.portlet.ActionRequest;
+import javax.portlet.ActionResponse;
+import javax.portlet.PortletSecurityException;
+import javax.portlet.RenderRequest;
+import javax.portlet.RenderResponse;
+import javax.faces.FactoryFinder;
+import java.io.IOException;
+
+/**
+ * JSF portlet which works with every JSF implementation existing on my radar.
+ *
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public class JSFMetaBridgePortlet implements Portlet
+{
+
+ /** . */
+ private static final Logger log = Logger.getLogger(JSFMetaBridgePortlet.class);
+
+ /** . */
+ private Portlet bridge;
+
+ public void init(PortletConfig config) throws PortletException
+ {
+ BridgeInfo bridgeInfo;
+ String className =
FactoryFinder.getFactory(FactoryFinder.APPLICATION_FACTORY).getClass().getName();
+ if
("com.sun.faces.application.ApplicationFactoryImpl".equals(className))
+ {
+ bridgeInfo = BridgeInfo.SUN_JSF;
+ }
+ else if
("org.apache.myfaces.application.ApplicationFactoryImpl".equals(className))
+ {
+ bridgeInfo = BridgeInfo.MYFACES_JSF;
+ }
+ else
+ {
+ throw new PortletException("No bridge detected for application factory
" + className);
+ }
+
+ //
+ log.debug("Detected JSF bridge " + bridgeInfo.getName());
+
+ //
+ try
+ {
+ Class bridgeClass =
Thread.currentThread().getContextClassLoader().loadClass(bridgeInfo.getPortletClassName());
+ log.debug("Obtain bridge class " + bridgeClass.getName());
+ bridge = (Portlet)bridgeClass.newInstance();
+ }
+ catch (ClassNotFoundException e)
+ {
+ log.error("Bridge class not available " +
bridgeInfo.getPortletClassName(), e);
+ }
+ catch (IllegalAccessException e)
+ {
+ log.error("Bridge class not accessible", e);
+ }
+ catch (InstantiationException e)
+ {
+ log.error("Bridge class not instantiable", e);
+ }
+
+ //
+ PortletConfig bridgeConfig = new BridgePortletConfig(config, bridgeInfo);
+ bridge.init(bridgeConfig);
+ }
+
+ public void processAction(ActionRequest request, ActionResponse response) throws
PortletException, PortletSecurityException, IOException
+ {
+ bridge.processAction(request, response);
+ }
+
+ public void render(RenderRequest request, RenderResponse response) throws
PortletException, PortletSecurityException, IOException
+ {
+ bridge.render(request, response);
+ }
+
+ public void destroy()
+ {
+ bridge.destroy();
+ bridge = null;
+ }
+}
Modified: trunk/jems/src/main/org/jboss/portal/jems/hibernate/SessionFactoryBinder.java
===================================================================
---
trunk/jems/src/main/org/jboss/portal/jems/hibernate/SessionFactoryBinder.java 2007-03-13
13:19:38 UTC (rev 6652)
+++
trunk/jems/src/main/org/jboss/portal/jems/hibernate/SessionFactoryBinder.java 2007-03-13
16:32:18 UTC (rev 6653)
@@ -33,8 +33,7 @@
import org.hibernate.metadata.ClassMetadata;
import org.hibernate.tool.hbm2ddl.SchemaExport;
import org.hibernate.tool.hbm2ddl.SchemaUpdate;
-import org.hibernate.dialect.Dialect;
-import org.jboss.portal.common.util.CLLoader;
+import org.jboss.portal.common.util.CLResourceLoader;
import org.jboss.portal.common.util.LoaderResource;
import org.jboss.portal.common.util.Tools;
import org.jboss.portal.common.util.URLTools;
@@ -185,7 +184,7 @@
//
if (setupLocation != null)
{
- setupResource = new CLLoader().getResource(setupLocation);
+ setupResource = new CLResourceLoader().getResource(setupLocation);
}
// Perform configuration
Modified: trunk/server/src/main/org/jboss/portal/server/config/ServerConfigService.java
===================================================================
---
trunk/server/src/main/org/jboss/portal/server/config/ServerConfigService.java 2007-03-13
13:19:38 UTC (rev 6652)
+++
trunk/server/src/main/org/jboss/portal/server/config/ServerConfigService.java 2007-03-13
16:32:18 UTC (rev 6653)
@@ -22,7 +22,7 @@
******************************************************************************/
package org.jboss.portal.server.config;
-import org.jboss.portal.common.util.CLLoader;
+import org.jboss.portal.common.util.CLResourceLoader;
import org.jboss.portal.common.util.LoaderResource;
import org.jboss.portal.jems.as.system.AbstractJBossService;
@@ -108,7 +108,7 @@
protected void createService() throws Exception
{
- configResource = new CLLoader().getResource(configLocation);
+ configResource = new CLResourceLoader().getResource(configLocation);
if (configResource.exists())
{
properties.clear();
Modified: trunk/theme/src/main/org/jboss/portal/test/theme/TestLayoutServiceImpl.java
===================================================================
--- trunk/theme/src/main/org/jboss/portal/test/theme/TestLayoutServiceImpl.java 2007-03-13
13:19:38 UTC (rev 6652)
+++ trunk/theme/src/main/org/jboss/portal/test/theme/TestLayoutServiceImpl.java 2007-03-13
16:32:18 UTC (rev 6653)
@@ -24,7 +24,7 @@
import junit.framework.TestCase;
import org.jboss.portal.common.MediaType;
-import org.jboss.portal.common.util.CLLoader;
+import org.jboss.portal.common.util.CLResourceLoader;
import org.jboss.portal.common.util.LoaderResource;
import org.jboss.portal.theme.LayoutException;
import org.jboss.portal.theme.PortalLayout;
@@ -75,7 +75,7 @@
runtimeContext = TestHelper.createRuntimeContext();
- LoaderResource res = new
CLLoader().getResource("xml/portal-layouts.xml");
+ LoaderResource res = new
CLResourceLoader().getResource("xml/portal-layouts.xml");
assertNotNull("Layout xml could not be loaded", res);
Unmarshaller unmarshaller = null;
unmarshaller = UnmarshallerFactory.newInstance().newUnmarshaller();
@@ -87,7 +87,7 @@
layoutService.addLayout(runtimeContext, layoutMD);
}
- res = new CLLoader().getResource("xml/portal-renderSet.xml");
+ res = new CLResourceLoader().getResource("xml/portal-renderSet.xml");
unmarshaller = UnmarshallerFactory.newInstance().newUnmarshaller();
renderSets = (List)unmarshaller.unmarshal(res.asInputStream(), new
RenderSetMetaDataFactory(), null);
for (Iterator i = renderSets.iterator(); i.hasNext();)
Modified: trunk/theme/src/main/org/jboss/portal/test/theme/TestThemeServiceImpl.java
===================================================================
--- trunk/theme/src/main/org/jboss/portal/test/theme/TestThemeServiceImpl.java 2007-03-13
13:19:38 UTC (rev 6652)
+++ trunk/theme/src/main/org/jboss/portal/test/theme/TestThemeServiceImpl.java 2007-03-13
16:32:18 UTC (rev 6653)
@@ -23,7 +23,7 @@
package org.jboss.portal.test.theme;
import junit.framework.TestCase;
-import org.jboss.portal.common.util.CLLoader;
+import org.jboss.portal.common.util.CLResourceLoader;
import org.jboss.portal.common.util.LoaderResource;
import org.jboss.portal.theme.PortalTheme;
import org.jboss.portal.theme.RuntimeContext;
@@ -57,7 +57,7 @@
themeService = new ThemeServiceImpl();
runtimeContext = TestHelper.createRuntimeContext();
- LoaderResource res = new
CLLoader().getResource("xml/portal-themes.xml");
+ LoaderResource res = new
CLResourceLoader().getResource("xml/portal-themes.xml");
Unmarshaller unmarshaller = UnmarshallerFactory.newInstance().newUnmarshaller();
themes = (List)unmarshaller.unmarshal(res.asInputStream(), new
PortalThemeMetaDataFactory(), null);
Modified: trunk/theme/src/main/org/jboss/portal/test/theme/render/TestRenderedMarkup.java
===================================================================
---
trunk/theme/src/main/org/jboss/portal/test/theme/render/TestRenderedMarkup.java 2007-03-13
13:19:38 UTC (rev 6652)
+++
trunk/theme/src/main/org/jboss/portal/test/theme/render/TestRenderedMarkup.java 2007-03-13
16:32:18 UTC (rev 6653)
@@ -23,7 +23,7 @@
import junit.framework.TestCase;
import org.jboss.portal.common.MediaType;
-import org.jboss.portal.common.util.CLLoader;
+import org.jboss.portal.common.util.CLResourceLoader;
import org.jboss.portal.common.util.LoaderResource;
import org.jboss.portal.server.ServerRequest;
import org.jboss.portal.server.util.HTTPStreamInfo;
@@ -90,7 +90,7 @@
layoutService = new LayoutServiceImpl();
runtimeContext = TestHelper.createRuntimeContext();
- LoaderResource res = new
CLLoader().getResource("xml/portal-layouts.xml");
+ LoaderResource res = new
CLResourceLoader().getResource("xml/portal-layouts.xml");
Unmarshaller unmarshaller = UnmarshallerFactory.newInstance().newUnmarshaller();
List portalLayouts = (List)unmarshaller.unmarshal(res.asInputStream(), new
PortalLayoutMetaDataFactory(), null);
@@ -101,7 +101,7 @@
}
layout = layoutService.getLayout("generic", true);
- res = new CLLoader().getResource("xml/portal-renderSet.xml");
+ res = new CLResourceLoader().getResource("xml/portal-renderSet.xml");
unmarshaller = UnmarshallerFactory.newInstance().newUnmarshaller();
List renderSets = (List)unmarshaller.unmarshal(res.asInputStream(), new
RenderSetMetaDataFactory(), null);
for (Iterator i = renderSets.iterator(); i.hasNext();)
@@ -111,7 +111,7 @@
}
renderSet = layoutService.getRenderSet("divRenderer", MediaType.HTML);
- res = new CLLoader().getResource("xml/portal-themes.xml");
+ res = new CLResourceLoader().getResource("xml/portal-themes.xml");
unmarshaller = UnmarshallerFactory.newInstance().newUnmarshaller();
List themes = (List)unmarshaller.unmarshal(res.asInputStream(), new
PortalThemeMetaDataFactory(), null);