JBoss Portal SVN: r7438 - docs/trunk/referenceGuide/en.
by portal-commits@lists.jboss.org
Author: julien(a)jboss.com
Date: 2007-06-15 08:11:33 -0400 (Fri, 15 Jun 2007)
New Revision: 7438
Modified:
docs/trunk/referenceGuide/en/master.xml
Log:
Start chapter about error handling configuration
Modified: docs/trunk/referenceGuide/en/master.xml
===================================================================
--- docs/trunk/referenceGuide/en/master.xml 2007-06-15 12:03:38 UTC (rev 7437)
+++ docs/trunk/referenceGuide/en/master.xml 2007-06-15 12:11:33 UTC (rev 7438)
@@ -25,8 +25,9 @@
<!ENTITY wsrp SYSTEM "modules/wsrp.xml">
<!ENTITY security SYSTEM "modules/security.xml">
<!ENTITY troubleshooting SYSTEM "modules/troubleshooting.xml">
- <!ENTITY contentIntegration SYSTEM "modules/contentIntegration.xml">
+ <!ENTITY contentintegration SYSTEM "modules/contentintegration.xml">
<!ENTITY portalapi SYSTEM "modules/portalapi.xml">
+ <!ENTITY errorhandling SYSTEM "modules/errorhandling.xml">
]>
<book lang="en">
<bookinfo>
@@ -56,22 +57,23 @@
</author>
</bookinfo>
<toc/>
- <!-- portal overview - marketing stuff --> &overview;
- <!-- comprehensive list of included features --> &featurelist;
- <!-- target audience of this document --> ⌖
- <!-- thanks for all the fish --> &acknowledgements;
+ <!-- Portal overview - marketing stuff --> &overview;
+ <!-- Comprehensive list of included features --> &featurelist;
+ <!-- Target audience of this document --> ⌖
+ <!-- Thanks for all the fish --> &acknowledgements;
<!-- Support AS, OS, DB listings --> &supported;
- <!-- installation guide --> &installation;
- <!-- configuration --> &configuration;
- <!-- upgrading and migration issues --> &migration;
- <!-- portlet tutorials --> &tutorials;
- <!-- deployment desc --> &xmldescriptors;
- <!-- understanding urls --> &urls;
- <!-- Content integration --> &contentIntegration;
+ <!-- Installation guide --> &installation;
+ <!-- Configuration --> &configuration;
+ <!-- Upgrading and migration issues --> &migration;
+ <!-- Portlet tutorials --> &tutorials;
+ <!-- Deployment desc --> &xmldescriptors;
+ <!-- Understanding urls --> &urls;
+ <!-- Error handling --> &errorhandling;
+ <!-- Content integration --> &contentintegration;
<!-- Portal API --> &portalapi;
- <!-- clustering configuration --> &clustering;
+ <!-- Clustering configuration --> &clustering;
<!-- WSRP --> &wsrp;
- <!-- security administration --> &security;
+ <!-- Security administration --> &security;
<!-- Identity --> &identity;
<!-- Authentication --> &authentication;
<!-- LDAP --> &ldap;
@@ -79,8 +81,8 @@
<!-- CMS --> &CMS;
<!-- Workflow --> &workflow;
<!-- NavTabs --> &navtabs;
- <!-- theme/layout api --> &themeandlayouts;
- <!-- ajax --> &ajax;
- <!-- troubleshooting FAQ--> &troubleshooting;
+ <!-- Theme/layout api --> &themeandlayouts;
+ <!-- Ajax --> &ajax;
+ <!-- Troubleshooting FAQ--> &troubleshooting;
</book>
18 years, 10 months
JBoss Portal SVN: r7437 - docs/trunk/referenceGuide/en/modules.
by portal-commits@lists.jboss.org
Author: julien(a)jboss.com
Date: 2007-06-15 08:03:38 -0400 (Fri, 15 Jun 2007)
New Revision: 7437
Modified:
docs/trunk/referenceGuide/en/modules/contentintegration.xml
docs/trunk/referenceGuide/en/modules/migration.xml
Log:
renaming contentIntegration to contentintegration
Modified: docs/trunk/referenceGuide/en/modules/contentintegration.xml
===================================================================
--- docs/trunk/referenceGuide/en/modules/contentintegration.xml 2007-06-15 12:02:23 UTC (rev 7436)
+++ docs/trunk/referenceGuide/en/modules/contentintegration.xml 2007-06-15 12:03:38 UTC (rev 7437)
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
-<chapter id="contentIntegration">
+<chapter id="contentintegration">
<chapterinfo>
<author>
<firstname>Julien</firstname>
Modified: docs/trunk/referenceGuide/en/modules/migration.xml
===================================================================
--- docs/trunk/referenceGuide/en/modules/migration.xml 2007-06-15 12:02:23 UTC (rev 7436)
+++ docs/trunk/referenceGuide/en/modules/migration.xml 2007-06-15 12:03:38 UTC (rev 7437)
@@ -122,7 +122,7 @@
<para>
This is probably the less trival part to do directly in database. In JBP 2.6 version the way that CMS
content is being displayed changed significantly. Please refer to
- <link linkend="contentIntegration">Content Integration</link> and <link linkend="cmsPortlet">CMS Portlet</link>
+ <link linkend="contentintegration">Content Integration</link> and <link linkend="cmsPortlet">CMS Portlet</link>
chapters for more information. Basically currently there is no need to have more than one instance of
<emphasis>CMSPortlet</emphasis> and the portlet window displays CMS content not by referring to that portlet instance
but by having proper <emphasis>content-type</emphasis> defined. In "<emphasis>default-object.xml</emphasis>
18 years, 10 months
JBoss Portal SVN: r7436 - docs/trunk/referenceGuide/en/modules.
by portal-commits@lists.jboss.org
Author: julien(a)jboss.com
Date: 2007-06-15 08:02:23 -0400 (Fri, 15 Jun 2007)
New Revision: 7436
Added:
docs/trunk/referenceGuide/en/modules/contentintegration.xml
Log:
renaming contentIntegration to contentintegration
Added: docs/trunk/referenceGuide/en/modules/contentintegration.xml
===================================================================
--- docs/trunk/referenceGuide/en/modules/contentintegration.xml (rev 0)
+++ docs/trunk/referenceGuide/en/modules/contentintegration.xml 2007-06-15 12:02:23 UTC (rev 7436)
@@ -0,0 +1,451 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<chapter id="contentIntegration">
+ <chapterinfo>
+ <author>
+ <firstname>Julien</firstname>
+ <surname>Viet</surname>
+ <email>julien @ jboss dot com</email>
+ </author>
+ </chapterinfo>
+ <title>Content Integration</title>
+ <para>Since JBoss Portal 2.6 it is possible to provide an easy integration of content within the portal. Up to the 2.4 version
+ content integration had to be done by configuring a portlet to show some content from an URI and then place that
+ portlet on a page. The new content integration capabilities allows to directly configure a page window with the content URI
+ removing the need to configure a portlet for that purpose.</para>
+ <note>We do not advocate to avoid the usage portlet preferences, we rather advocate that content configuration managed at the portal level
+ simplifies the configuration: it helps to make content a first class citizen of the portal instead of having an intermediary
+ portlet that holds the content for the portal. The portlet preferences can still be used to configure how content is displayed
+ to the user.</note>
+ <mediaobject>
+ <imageobject>
+ <imagedata align="center" fileref="images/content/before.png" format="png"/>
+ </imageobject>
+ <caption>
+ <para>The portal uses portlets to configure content</para>
+ </caption>
+ </mediaobject>
+ <mediaobject>
+ <imageobject>
+ <imagedata align="center" fileref="images/content/after.png" format="png"/>
+ </imageobject>
+ <caption>
+ <para>The portal references directly the content and use portlet to interact with content</para>
+ </caption>
+ </mediaobject>
+ <sect1>
+ <title>Window content</title>
+ <para>The content of a window is defined by
+ <itemizedlist>
+ <listitem>The content URI which is the resource that the window is pointing to. It is an arbitrary string that
+ the portal cannot interpret and is left up to the content provider to interpret.</listitem>
+ <listitem>The window content type which defines how the portal interpret the window content
+ <itemizedlist>
+ <listitem>The default content type is for portlets and has the value <emphasis>portlet</emphasis>. For that
+ content type, the content URI is the portlet instance id.</listitem>
+ <listitem>The CMS content type allows to integrate content from the CMS at the page and it has the value
+ <emphasis>cms</emphasis>. For that content type, the content URI is the CMS file path.</listitem>
+ </itemizedlist>
+ </listitem>
+ <listitem>The content parameters which is a set of additional key/value string pairs holding state that is interpreted
+ by the content provider.</listitem>
+ </itemizedlist>
+ </para>
+ <para>At runtime when the portal needs to render a window it delegates the production of markup to a content provider.
+ The portal comes with a preconfigured set of providers which handles the portlet and the cms content types. The most
+ natural way to plug a content provider in the portal is to use a JSR 168 Portlet. Based on a few carefully chosen conventions
+ it is possible to provide an efficient content integration with the benefit of using standards and without requiring
+ the usage of a proprietary API.</para>
+ </sect1>
+ <sect1>
+ <title>Content customization</title>
+ <para>Content providers must be able to allow the user or administrator to chose content from the external resource
+ it integrates in the portal in order to properly configure a portal window. A few interactions between the portal, the content
+ provider and the portal user are necessary to achieve that goal. Here again it is possible to provide content
+ customization using a JSR 168 Portlet. For that purpose two special portlet modes called
+ <emphasis>edit_content</emphasis> and <emphasis>select_content</emphasis> has been introduced. It signals to the portlet
+ that it is selecting or editing the content portion of the state of a portlet. <emphasis>select_content</emphasis> is
+ used to select a new content to put in a window while <emphasis>edit_content</emphasis> is used to modify the previously
+ defined content, often the two modes will display the same thing. The traditional edit mode is not used because the edit mode
+ is more targetted to configure how the portlet show content to the end user rather than what content it shows.</para>
+ <imageobject>
+ <imagedata align="center" fileref="images/content/cms.png" format="png"/>
+ </imageobject>
+ <caption>Example of content customization - CMS Portlet</caption>
+ </sect1>
+ <sect1>
+ <title>Content Driven Portlet</title>
+ <para>Portlet components are used to integrate content into the portal. It relies on a few conventions which allow
+ the portal and the portlet to communicate.
+ </para>
+ <sect2>
+ <title>Displaying content</title>
+ <para>At runtime the portal will call the portlet with the view mode when it displays content. It will send to the
+ portlet the information about the content to display using the render parameters. Therefore the portlet has
+ just to read the render parameters and use them to properly display the content in the portlet. The render parameters
+ values are the key/value pairs that forms the content properties and the resource URI is found under the <emphasis>uri</emphasis>
+ parameter name.</para>
+ </sect2>
+ <sect2>
+ <title>Configuring content</title>
+ <para>As explained before, the portal will call the portlet using the <emphasis>edit_content</emphasis> mode.
+ In that mode the portlet and the portal will communicate using either action or render parameters. We have two use cases
+ which are:
+ <itemizedlist>
+ <listitem>The portal needs to configure a new content item for a new window. In that use case the portal will not send special
+ render parameters to the portlet and the initial set of render parameters will be empty. The portlet can
+ then use render parameters in order to provide navigation in the content repository. For example the portlet
+ can navigate the CMS tree and store the current CMS path in the render parameters. Whenever the portlet has decided
+ to tell the portal that content has been selected by the user it needs to use an action URL with a special set of
+ parameters:
+ <itemizedlist>
+ <listitem><emphasis>content.action.select</emphasis> equals to any value</listitem>
+ <listitem><emphasis>content.uri</emphasis> equals to the content URI</listitem>
+ <listitem><emphasis>content.param.</emphasis> used as prefix to configure content parameters</listitem>
+ </itemizedlist>
+ </listitem>
+ <listitem>The second use case happens when the portal needs to edit existing content. In such situation
+ everything works as explained before except that the initial set of render parameters of the portlet
+ will be prepopulated with the content uri URI and parameters.</listitem>
+ </itemizedlist>
+ </para>
+ </sect2>
+ <sect2>
+ <title>Step by step example of a content driven portlet</title>
+ <para></para>
+ <sect3>
+ <title>The Portlet skeleton</title>
+ <para>Here is the base skeleton of the content portlet. The FSContentDrivenPortlet shows the files which are
+ in the war file in which the portlet is deployed. The arbitrary name <emphasis>filesystem</emphasis>
+ will be the content type interpreted by the portlet.
+ </para>
+ <programlisting><![CDATA[
+public class FSContentDrivenPortlet extends GenericPortlet
+{
+
+ /** The edit_content mode. */
+ public static final PortletMode EDIT_CONTENT_MODE = new PortletMode("edit_content");
+
+ /** The select_content mode. */
+ public static final PortletMode SELECT_CONTENT_MODE = new PortletMode("select_content");
+
+ ...
+
+}
+]]></programlisting>
+ </sect3>
+ <sect3>
+ <title>Overriding the dispatch method</title>
+ <para>First the <emphasis>doDispatch(RenderRequest req, RenderResponse resp)</emphasis> is overriden in order
+ to branch the requeset flow to a method that will take care of displaying the editor.</para>
+ <programlisting><![CDATA[
+protected void doDispatch(RenderRequest req, RenderResponse resp)
+ throws PortletException, PortletSecurityException, IOException
+{
+ if (EDIT_CONTENT_MODE.equals(req.getPortletMode()) || SELECT_CONTENT_MODE.equals(req.getPortletMode()))
+ {
+ doEditContent(req, resp);
+ }
+ else
+ {
+ super.doDispatch(req, resp);
+ }
+}
+]]></programlisting>
+ </sect3>
+ <sect3>
+ <title>Utilities methods</title>
+ <para>The portlet also needs a few utilities methods which take care of converting content URI to a file
+ back and forth. There is also an implementation of a file filter that keep only text files and avoid the
+ WEB-INF directory of the war file for security reasons.</para>
+ <programlisting><![CDATA[
+protected File getFile(String contentURI) throws IOException
+{
+ String realPath = getPortletContext().getRealPath(contentURI);
+ if (realPath == null)
+ {
+ throw new IOException("Cannot access war file content");
+ }
+ File file = new File(realPath);
+ if (!file.exists())
+ {
+ throw new IOException("File " + contentURI + " does not exist");
+ }
+ return file;
+}
+]]></programlisting>
+ <programlisting><![CDATA[
+ protected String getContentURI(File file) throws IOException
+ {
+ String rootPath = getPortletContext().getRealPath("/");
+ if (rootPath == null)
+ {
+ throw new IOException("Cannot access war file content");
+ }
+
+ // Make it canonical
+ rootPath = new File(rootPath).getCanonicalPath();
+
+ // Get the portion of the path that is significant for us
+ String filePath = file.getCanonicalPath();
+ return filePath.length() >=
+ rootPath.length() ? filePath.substring(rootPath.length()) : null;
+ }
+]]></programlisting>
+ <programlisting><![CDATA[
+ private final FileFilter filter = new FileFilter()
+ {
+ public boolean accept(File file)
+ {
+ String name = file.getName();
+ if (file.isDirectory())
+ {
+ return !"WEB-INF".equals(name);
+ }
+ else if (file.isFile())
+ {
+ return name.endsWith(".txt");
+ }
+ else
+ {
+ return false;
+ }
+ }
+ };
+]]></programlisting>
+ </sect3>
+ <sect3>
+ <title>The editor</title>
+ <para>The editor is probably the longest part of the portlet. It tries to stay simple though and goes directly
+ to the point.</para>
+ <imageobject>
+ <imagedata align="center" fileref="images/content/fs1.png" format="png"/>
+ </imageobject>
+ <caption>Content editor of FSContentDrivenPortlet in action</caption>
+ <programlisting><![CDATA[
+protected void doEditContent(RenderRequest req, RenderResponse resp)
+ throws PortletException, PortletSecurityException, IOException
+{
+ // Get the uri value optionally provided by the portal
+ String uri = req.getParameter("content.uri");
+
+ // Get the working directory directory
+ File workingDir;
+ if (uri != null)
+ {
+ workingDir = getFile(uri).getParentFile();
+ }
+ else
+ {
+ // Otherwise try to get the current directory we are browsing,
+ // if no current dir exist we use the root
+ String currentDir = req.getParameter("current_dir");
+ if (currentDir == null)
+ {
+ currentDir = "/";
+ }
+ workingDir = getFile(currentDir);
+ }
+
+ // Get the parent path
+ String parentPath = getContentURI(workingDir.getParentFile());
+
+ // Get the children of the selected file, we use a filter
+ // to retain only text files and avoid WEB-INF dir
+ File[] children = workingDir.listFiles(filter);
+
+ // Configure the response
+ resp.setContentType("text/html");
+ PrintWriter writer = resp.getWriter();
+
+ //
+ writer.print("Directories:<br/>");
+ writer.print("<ul>");
+ PortletURL choseDirURL = resp.createRenderURL();
+ if (parentPath != null)
+ {
+ choseDirURL.setParameter("current_dir", parentPath);
+ writer.print("<li><a href=\"" + choseDirURL + "\">..</a></li>");
+ }
+ for (int i = 0;i < children.length;i++)
+ {
+ File child = children[i];
+ if (child.isDirectory())
+ {
+ choseDirURL.setParameter("current_dir", getContentURI(child));
+ writer.print("<li><a href=\"" + choseDirURL + "\">" + child.getName() +
+ "</a></li>");
+ }
+ }
+ writer.print("</ul><br/>");
+
+ //
+ writer.print("Files:<br/>");
+ writer.print("<ul>");
+ PortletURL selectFileURL = resp.createActionURL();
+ selectFileURL.setParameter("content.action.select", "select");
+ for (int i = 0;i < children.length;i++)
+ {
+ File child = children[i];
+ if (child.isFile())
+ {
+ selectFileURL.setParameter("content.uri", getContentURI(child));
+ writer.print("<li><a href=\"" + selectFileURL + "\">" + child.getName() +
+ "</a></li>");
+ }
+ }
+ writer.print("</ul><br/>");
+
+ //
+ writer.close();
+}
+]]></programlisting>
+ </sect3>
+ <sect3>
+ <title>Viewing content at runtime</title>
+ <para>Last but not least the portlet needs to implement the <emphasis>doView(RenderRequest req, RenderResponse resp)</emphasis>
+ method in order to display the file that the portal window wants to show.</para>
+ <programlisting><![CDATA[
+protected void doView(RenderRequest req, RenderResponse resp)
+ throws PortletException, PortletSecurityException, IOException
+{
+ // Get the URI provided by the portal
+ String uri = req.getParameter("uri");
+
+ // Configure the response
+ resp.setContentType("text/html");
+ PrintWriter writer = resp.getWriter();
+
+ //
+ if (uri == null)
+ {
+ writer.print("No selected file");
+ }
+ else
+ {
+ File file = getFile(uri);
+ FileInputStream in = null;
+ try
+ {
+ in = new FileInputStream(file);
+ FileChannel channel = in.getChannel();
+ byte[] bytes = new byte[(int)channel.size()];
+ ByteBuffer buffer = ByteBuffer.wrap(bytes);
+ channel.read(buffer);
+ writer.write(new String(bytes, 0, bytes.length, "UTF8"));
+ }
+ catch (FileNotFoundException e)
+ {
+ writer.print("No such file " + uri);
+ getPortletContext().log("Cannot find file " + uri, e);
+ }
+ finally
+ {
+ if (in != null)
+ {
+ in.close();
+ }
+ }
+ }
+
+ //
+ writer.close();
+}
+]]></programlisting>
+ </sect3>
+ <sect3>
+ <title>Hooking the portlet into the portal</title>
+ <imageobject>
+ <imagedata align="center" fileref="images/content/fs2.png" format="png"/>
+ </imageobject>
+ <caption>Management portlet with <emphasis>filesystem</emphasis> content type enabled</caption>
+ <para>Finally we need to make the portal aware of the fact that the portlet can edit and interpret content. For that
+ we need a few descriptors. The <emphasis>portlet.xml</emphasis> descriptor will define our portlet, the
+ <emphasis>portlet-instances.xml</emphasis> will create a single instance of our portlet. The
+ <emphasis>web.xml</emphasis> descriptor will contain a servlet context listener that will hook the content
+ type in the portal content type registry.</para>
+ <programlisting><![CDATA[
+<?xml version="1.0" encoding="UTF-8"?>
+<portlet-app
+ xmlns="http://java.sun.com/xml/ns/portlet/portlet-app_1_0.xsd"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://java.sun.com/xml/ns/portlet/portlet-app_1_0.xsd
+ http://java.sun.com/xml/ns/portlet/portlet-app_1_0.xsd"
+ version="1.0">
+ ...
+ <portlet>
+ <description>File System Content Driven Portlet</description>
+ <portlet-name>FSContentDrivenPortlet</portlet-name>
+ <display-name>File System Content Driven Portlet</display-name>
+ <portlet-class>org.jboss.portal.core.portlet.test.FSContentDrivenPortlet</portlet-class>
+ <supports>
+ <mime-type>text/html</mime-type>
+ </supports>
+ <portlet-info>
+ <title>File Portlet</title>
+ <keywords>sample,test</keywords>
+ </portlet-info>
+ </portlet>
+ ...
+</portlet-app>
+]]></programlisting>
+ <para>The portlet.xml descriptor</para>
+ <programlisting><![CDATA[
+<deployments>
+ ...
+ <deployment>
+ <instance>
+ <instance-id>FSContentDrivenPortletInstance</instance-id>
+ <portlet-ref>FSContentDrivenPortlet</portlet-ref>
+ </instance>
+ </deployment>
+ ...
+</deployments
+]]></programlisting>
+ <para>The portlet-instances.xml descriptor</para>
+ <programlisting><![CDATA[
+<web-app>
+ ...
+ <context-param>
+ <param-name>org.jboss.portal.content_type</param-name>
+ <param-value>filesystem</param-value>
+ </context-param>
+ <context-param>
+ <param-name>org.jboss.portal.portlet_instance</param-name>
+ <param-value>FSContentDrivenPortletInstance</param-value>
+ </context-param>
+ <listener>
+ <listener-class>org.jboss.content.ContentTypeRegistration</listener-class>
+ </listener>
+ ...
+</web-app>
+]]></programlisting>
+ <para>The web.xml descriptor</para>
+ <warning>You don't need to add the listener class into your war file. As it is provided by the portal
+ it will always be available.</warning>
+ </sect3>
+ </sect2>
+ </sect1>
+ <sect1>
+ <title>Configuring window content in deployment descriptor</title>
+ <para>How to create a portlet that will enable configuration of content at runtime has been covered above, however
+ it is also possible to configure content in deployment descriptors. With our previous example it would give
+ the following snippet placed in a <emphasis>*-portal.xml</emphasis> file:
+ </para>
+ <programlisting><![CDATA[
+<window>
+<window-name>MyWindow</window-name>
+<content>
+ <content-type>filesystem</content-type>
+ <content-uri>/dir1/foo.txt</content-uri>
+</content>
+<region>center</region>
+<height>1</height>
+</window>
+]]></programlisting>
+ <imageobject>
+ <imagedata align="center" fileref="images/content/fs3.png" format="png"/>
+ </imageobject>
+ <caption>Final effect - portal window with FSContentDrivenPortlet</caption>
+ <note>How to configure CMS file this way is covered in the CMS chapter: <xref linkend="configuration-cms_content"/></note>
+ </sect1>
+</chapter>
18 years, 10 months
JBoss Portal SVN: r7435 - docs/trunk/referenceGuide/en/modules.
by portal-commits@lists.jboss.org
Author: julien(a)jboss.com
Date: 2007-06-15 08:02:00 -0400 (Fri, 15 Jun 2007)
New Revision: 7435
Removed:
docs/trunk/referenceGuide/en/modules/contentIntegration.xml
Log:
renaming contentIntegration to contentintegration
Deleted: docs/trunk/referenceGuide/en/modules/contentIntegration.xml
===================================================================
--- docs/trunk/referenceGuide/en/modules/contentIntegration.xml 2007-06-15 10:26:05 UTC (rev 7434)
+++ docs/trunk/referenceGuide/en/modules/contentIntegration.xml 2007-06-15 12:02:00 UTC (rev 7435)
@@ -1,451 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<chapter id="contentIntegration">
- <chapterinfo>
- <author>
- <firstname>Julien</firstname>
- <surname>Viet</surname>
- <email>julien @ jboss dot com</email>
- </author>
- </chapterinfo>
- <title>Content Integration</title>
- <para>Since JBoss Portal 2.6 it is possible to provide an easy integration of content within the portal. Up to the 2.4 version
- content integration had to be done by configuring a portlet to show some content from an URI and then place that
- portlet on a page. The new content integration capabilities allows to directly configure a page window with the content URI
- removing the need to configure a portlet for that purpose.</para>
- <note>We do not advocate to avoid the usage portlet preferences, we rather advocate that content configuration managed at the portal level
- simplifies the configuration: it helps to make content a first class citizen of the portal instead of having an intermediary
- portlet that holds the content for the portal. The portlet preferences can still be used to configure how content is displayed
- to the user.</note>
- <mediaobject>
- <imageobject>
- <imagedata align="center" fileref="images/content/before.png" format="png"/>
- </imageobject>
- <caption>
- <para>The portal uses portlets to configure content</para>
- </caption>
- </mediaobject>
- <mediaobject>
- <imageobject>
- <imagedata align="center" fileref="images/content/after.png" format="png"/>
- </imageobject>
- <caption>
- <para>The portal references directly the content and use portlet to interact with content</para>
- </caption>
- </mediaobject>
- <sect1>
- <title>Window content</title>
- <para>The content of a window is defined by
- <itemizedlist>
- <listitem>The content URI which is the resource that the window is pointing to. It is an arbitrary string that
- the portal cannot interpret and is left up to the content provider to interpret.</listitem>
- <listitem>The window content type which defines how the portal interpret the window content
- <itemizedlist>
- <listitem>The default content type is for portlets and has the value <emphasis>portlet</emphasis>. For that
- content type, the content URI is the portlet instance id.</listitem>
- <listitem>The CMS content type allows to integrate content from the CMS at the page and it has the value
- <emphasis>cms</emphasis>. For that content type, the content URI is the CMS file path.</listitem>
- </itemizedlist>
- </listitem>
- <listitem>The content parameters which is a set of additional key/value string pairs holding state that is interpreted
- by the content provider.</listitem>
- </itemizedlist>
- </para>
- <para>At runtime when the portal needs to render a window it delegates the production of markup to a content provider.
- The portal comes with a preconfigured set of providers which handles the portlet and the cms content types. The most
- natural way to plug a content provider in the portal is to use a JSR 168 Portlet. Based on a few carefully chosen conventions
- it is possible to provide an efficient content integration with the benefit of using standards and without requiring
- the usage of a proprietary API.</para>
- </sect1>
- <sect1>
- <title>Content customization</title>
- <para>Content providers must be able to allow the user or administrator to chose content from the external resource
- it integrates in the portal in order to properly configure a portal window. A few interactions between the portal, the content
- provider and the portal user are necessary to achieve that goal. Here again it is possible to provide content
- customization using a JSR 168 Portlet. For that purpose two special portlet modes called
- <emphasis>edit_content</emphasis> and <emphasis>select_content</emphasis> has been introduced. It signals to the portlet
- that it is selecting or editing the content portion of the state of a portlet. <emphasis>select_content</emphasis> is
- used to select a new content to put in a window while <emphasis>edit_content</emphasis> is used to modify the previously
- defined content, often the two modes will display the same thing. The traditional edit mode is not used because the edit mode
- is more targetted to configure how the portlet show content to the end user rather than what content it shows.</para>
- <imageobject>
- <imagedata align="center" fileref="images/content/cms.png" format="png"/>
- </imageobject>
- <caption>Example of content customization - CMS Portlet</caption>
- </sect1>
- <sect1>
- <title>Content Driven Portlet</title>
- <para>Portlet components are used to integrate content into the portal. It relies on a few conventions which allow
- the portal and the portlet to communicate.
- </para>
- <sect2>
- <title>Displaying content</title>
- <para>At runtime the portal will call the portlet with the view mode when it displays content. It will send to the
- portlet the information about the content to display using the render parameters. Therefore the portlet has
- just to read the render parameters and use them to properly display the content in the portlet. The render parameters
- values are the key/value pairs that forms the content properties and the resource URI is found under the <emphasis>uri</emphasis>
- parameter name.</para>
- </sect2>
- <sect2>
- <title>Configuring content</title>
- <para>As explained before, the portal will call the portlet using the <emphasis>edit_content</emphasis> mode.
- In that mode the portlet and the portal will communicate using either action or render parameters. We have two use cases
- which are:
- <itemizedlist>
- <listitem>The portal needs to configure a new content item for a new window. In that use case the portal will not send special
- render parameters to the portlet and the initial set of render parameters will be empty. The portlet can
- then use render parameters in order to provide navigation in the content repository. For example the portlet
- can navigate the CMS tree and store the current CMS path in the render parameters. Whenever the portlet has decided
- to tell the portal that content has been selected by the user it needs to use an action URL with a special set of
- parameters:
- <itemizedlist>
- <listitem><emphasis>content.action.select</emphasis> equals to any value</listitem>
- <listitem><emphasis>content.uri</emphasis> equals to the content URI</listitem>
- <listitem><emphasis>content.param.</emphasis> used as prefix to configure content parameters</listitem>
- </itemizedlist>
- </listitem>
- <listitem>The second use case happens when the portal needs to edit existing content. In such situation
- everything works as explained before except that the initial set of render parameters of the portlet
- will be prepopulated with the content uri URI and parameters.</listitem>
- </itemizedlist>
- </para>
- </sect2>
- <sect2>
- <title>Step by step example of a content driven portlet</title>
- <para></para>
- <sect3>
- <title>The Portlet skeleton</title>
- <para>Here is the base skeleton of the content portlet. The FSContentDrivenPortlet shows the files which are
- in the war file in which the portlet is deployed. The arbitrary name <emphasis>filesystem</emphasis>
- will be the content type interpreted by the portlet.
- </para>
- <programlisting><![CDATA[
-public class FSContentDrivenPortlet extends GenericPortlet
-{
-
- /** The edit_content mode. */
- public static final PortletMode EDIT_CONTENT_MODE = new PortletMode("edit_content");
-
- /** The select_content mode. */
- public static final PortletMode SELECT_CONTENT_MODE = new PortletMode("select_content");
-
- ...
-
-}
-]]></programlisting>
- </sect3>
- <sect3>
- <title>Overriding the dispatch method</title>
- <para>First the <emphasis>doDispatch(RenderRequest req, RenderResponse resp)</emphasis> is overriden in order
- to branch the requeset flow to a method that will take care of displaying the editor.</para>
- <programlisting><![CDATA[
-protected void doDispatch(RenderRequest req, RenderResponse resp)
- throws PortletException, PortletSecurityException, IOException
-{
- if (EDIT_CONTENT_MODE.equals(req.getPortletMode()) || SELECT_CONTENT_MODE.equals(req.getPortletMode()))
- {
- doEditContent(req, resp);
- }
- else
- {
- super.doDispatch(req, resp);
- }
-}
-]]></programlisting>
- </sect3>
- <sect3>
- <title>Utilities methods</title>
- <para>The portlet also needs a few utilities methods which take care of converting content URI to a file
- back and forth. There is also an implementation of a file filter that keep only text files and avoid the
- WEB-INF directory of the war file for security reasons.</para>
- <programlisting><![CDATA[
-protected File getFile(String contentURI) throws IOException
-{
- String realPath = getPortletContext().getRealPath(contentURI);
- if (realPath == null)
- {
- throw new IOException("Cannot access war file content");
- }
- File file = new File(realPath);
- if (!file.exists())
- {
- throw new IOException("File " + contentURI + " does not exist");
- }
- return file;
-}
-]]></programlisting>
- <programlisting><![CDATA[
- protected String getContentURI(File file) throws IOException
- {
- String rootPath = getPortletContext().getRealPath("/");
- if (rootPath == null)
- {
- throw new IOException("Cannot access war file content");
- }
-
- // Make it canonical
- rootPath = new File(rootPath).getCanonicalPath();
-
- // Get the portion of the path that is significant for us
- String filePath = file.getCanonicalPath();
- return filePath.length() >=
- rootPath.length() ? filePath.substring(rootPath.length()) : null;
- }
-]]></programlisting>
- <programlisting><![CDATA[
- private final FileFilter filter = new FileFilter()
- {
- public boolean accept(File file)
- {
- String name = file.getName();
- if (file.isDirectory())
- {
- return !"WEB-INF".equals(name);
- }
- else if (file.isFile())
- {
- return name.endsWith(".txt");
- }
- else
- {
- return false;
- }
- }
- };
-]]></programlisting>
- </sect3>
- <sect3>
- <title>The editor</title>
- <para>The editor is probably the longest part of the portlet. It tries to stay simple though and goes directly
- to the point.</para>
- <imageobject>
- <imagedata align="center" fileref="images/content/fs1.png" format="png"/>
- </imageobject>
- <caption>Content editor of FSContentDrivenPortlet in action</caption>
- <programlisting><![CDATA[
-protected void doEditContent(RenderRequest req, RenderResponse resp)
- throws PortletException, PortletSecurityException, IOException
-{
- // Get the uri value optionally provided by the portal
- String uri = req.getParameter("content.uri");
-
- // Get the working directory directory
- File workingDir;
- if (uri != null)
- {
- workingDir = getFile(uri).getParentFile();
- }
- else
- {
- // Otherwise try to get the current directory we are browsing,
- // if no current dir exist we use the root
- String currentDir = req.getParameter("current_dir");
- if (currentDir == null)
- {
- currentDir = "/";
- }
- workingDir = getFile(currentDir);
- }
-
- // Get the parent path
- String parentPath = getContentURI(workingDir.getParentFile());
-
- // Get the children of the selected file, we use a filter
- // to retain only text files and avoid WEB-INF dir
- File[] children = workingDir.listFiles(filter);
-
- // Configure the response
- resp.setContentType("text/html");
- PrintWriter writer = resp.getWriter();
-
- //
- writer.print("Directories:<br/>");
- writer.print("<ul>");
- PortletURL choseDirURL = resp.createRenderURL();
- if (parentPath != null)
- {
- choseDirURL.setParameter("current_dir", parentPath);
- writer.print("<li><a href=\"" + choseDirURL + "\">..</a></li>");
- }
- for (int i = 0;i < children.length;i++)
- {
- File child = children[i];
- if (child.isDirectory())
- {
- choseDirURL.setParameter("current_dir", getContentURI(child));
- writer.print("<li><a href=\"" + choseDirURL + "\">" + child.getName() +
- "</a></li>");
- }
- }
- writer.print("</ul><br/>");
-
- //
- writer.print("Files:<br/>");
- writer.print("<ul>");
- PortletURL selectFileURL = resp.createActionURL();
- selectFileURL.setParameter("content.action.select", "select");
- for (int i = 0;i < children.length;i++)
- {
- File child = children[i];
- if (child.isFile())
- {
- selectFileURL.setParameter("content.uri", getContentURI(child));
- writer.print("<li><a href=\"" + selectFileURL + "\">" + child.getName() +
- "</a></li>");
- }
- }
- writer.print("</ul><br/>");
-
- //
- writer.close();
-}
-]]></programlisting>
- </sect3>
- <sect3>
- <title>Viewing content at runtime</title>
- <para>Last but not least the portlet needs to implement the <emphasis>doView(RenderRequest req, RenderResponse resp)</emphasis>
- method in order to display the file that the portal window wants to show.</para>
- <programlisting><![CDATA[
-protected void doView(RenderRequest req, RenderResponse resp)
- throws PortletException, PortletSecurityException, IOException
-{
- // Get the URI provided by the portal
- String uri = req.getParameter("uri");
-
- // Configure the response
- resp.setContentType("text/html");
- PrintWriter writer = resp.getWriter();
-
- //
- if (uri == null)
- {
- writer.print("No selected file");
- }
- else
- {
- File file = getFile(uri);
- FileInputStream in = null;
- try
- {
- in = new FileInputStream(file);
- FileChannel channel = in.getChannel();
- byte[] bytes = new byte[(int)channel.size()];
- ByteBuffer buffer = ByteBuffer.wrap(bytes);
- channel.read(buffer);
- writer.write(new String(bytes, 0, bytes.length, "UTF8"));
- }
- catch (FileNotFoundException e)
- {
- writer.print("No such file " + uri);
- getPortletContext().log("Cannot find file " + uri, e);
- }
- finally
- {
- if (in != null)
- {
- in.close();
- }
- }
- }
-
- //
- writer.close();
-}
-]]></programlisting>
- </sect3>
- <sect3>
- <title>Hooking the portlet into the portal</title>
- <imageobject>
- <imagedata align="center" fileref="images/content/fs2.png" format="png"/>
- </imageobject>
- <caption>Management portlet with <emphasis>filesystem</emphasis> content type enabled</caption>
- <para>Finally we need to make the portal aware of the fact that the portlet can edit and interpret content. For that
- we need a few descriptors. The <emphasis>portlet.xml</emphasis> descriptor will define our portlet, the
- <emphasis>portlet-instances.xml</emphasis> will create a single instance of our portlet. The
- <emphasis>web.xml</emphasis> descriptor will contain a servlet context listener that will hook the content
- type in the portal content type registry.</para>
- <programlisting><![CDATA[
-<?xml version="1.0" encoding="UTF-8"?>
-<portlet-app
- xmlns="http://java.sun.com/xml/ns/portlet/portlet-app_1_0.xsd"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://java.sun.com/xml/ns/portlet/portlet-app_1_0.xsd
- http://java.sun.com/xml/ns/portlet/portlet-app_1_0.xsd"
- version="1.0">
- ...
- <portlet>
- <description>File System Content Driven Portlet</description>
- <portlet-name>FSContentDrivenPortlet</portlet-name>
- <display-name>File System Content Driven Portlet</display-name>
- <portlet-class>org.jboss.portal.core.portlet.test.FSContentDrivenPortlet</portlet-class>
- <supports>
- <mime-type>text/html</mime-type>
- </supports>
- <portlet-info>
- <title>File Portlet</title>
- <keywords>sample,test</keywords>
- </portlet-info>
- </portlet>
- ...
-</portlet-app>
-]]></programlisting>
- <para>The portlet.xml descriptor</para>
- <programlisting><![CDATA[
-<deployments>
- ...
- <deployment>
- <instance>
- <instance-id>FSContentDrivenPortletInstance</instance-id>
- <portlet-ref>FSContentDrivenPortlet</portlet-ref>
- </instance>
- </deployment>
- ...
-</deployments
-]]></programlisting>
- <para>The portlet-instances.xml descriptor</para>
- <programlisting><![CDATA[
-<web-app>
- ...
- <context-param>
- <param-name>org.jboss.portal.content_type</param-name>
- <param-value>filesystem</param-value>
- </context-param>
- <context-param>
- <param-name>org.jboss.portal.portlet_instance</param-name>
- <param-value>FSContentDrivenPortletInstance</param-value>
- </context-param>
- <listener>
- <listener-class>org.jboss.content.ContentTypeRegistration</listener-class>
- </listener>
- ...
-</web-app>
-]]></programlisting>
- <para>The web.xml descriptor</para>
- <warning>You don't need to add the listener class into your war file. As it is provided by the portal
- it will always be available.</warning>
- </sect3>
- </sect2>
- </sect1>
- <sect1>
- <title>Configuring window content in deployment descriptor</title>
- <para>How to create a portlet that will enable configuration of content at runtime has been covered above, however
- it is also possible to configure content in deployment descriptors. With our previous example it would give
- the following snippet placed in a <emphasis>*-portal.xml</emphasis> file:
- </para>
- <programlisting><![CDATA[
-<window>
-<window-name>MyWindow</window-name>
-<content>
- <content-type>filesystem</content-type>
- <content-uri>/dir1/foo.txt</content-uri>
-</content>
-<region>center</region>
-<height>1</height>
-</window>
-]]></programlisting>
- <imageobject>
- <imagedata align="center" fileref="images/content/fs3.png" format="png"/>
- </imageobject>
- <caption>Final effect - portal window with FSContentDrivenPortlet</caption>
- <note>How to configure CMS file this way is covered in the CMS chapter: <xref linkend="configuration-cms_content"/></note>
- </sect1>
-</chapter>
18 years, 10 months
JBoss Portal SVN: r7434 - trunk/jems/src/main/org/jboss/portal/jems/as/system.
by portal-commits@lists.jboss.org
Author: julien(a)jboss.com
Date: 2007-06-15 06:26:05 -0400 (Fri, 15 Jun 2007)
New Revision: 7434
Modified:
trunk/jems/src/main/org/jboss/portal/jems/as/system/JBossServiceModelMBean.java
Log:
JBPORTAL-1484:make JMX optimization default in portal
Modified: trunk/jems/src/main/org/jboss/portal/jems/as/system/JBossServiceModelMBean.java
===================================================================
--- trunk/jems/src/main/org/jboss/portal/jems/as/system/JBossServiceModelMBean.java 2007-06-15 10:24:24 UTC (rev 7433)
+++ trunk/jems/src/main/org/jboss/portal/jems/as/system/JBossServiceModelMBean.java 2007-06-15 10:26:05 UTC (rev 7434)
@@ -81,6 +81,9 @@
/** . */
private static final Logger log = Logger.getLogger(JBossServiceModelMBean.class);
+ /** . */
+ public static final String PORTAL_KERNEL_NO_PROXIES = "portal.kernel.no_proxies";
+
// Constructors --------------------------------------------------
/** . */
@@ -131,7 +134,7 @@
ModelMBeanInfo info = JavaBeanModelMBeanBuilder.build(resource.getClass(), pojo ? Object.class : ServiceMBeanSupport.class);
//
- this.replaceProxies = "true".equals(System.getProperty("replace.proxies"));
+ this.replaceProxies = "true".equals(System.getProperty(PORTAL_KERNEL_NO_PROXIES, "true"));
this.injector = new POJOInjector();
this.serviceMixin = new ServiceMixin(resource);
18 years, 10 months
JBoss Portal SVN: r7433 - docs/trunk/referenceGuide/en/modules.
by portal-commits@lists.jboss.org
Author: julien(a)jboss.com
Date: 2007-06-15 06:24:24 -0400 (Fri, 15 Jun 2007)
New Revision: 7433
Modified:
docs/trunk/referenceGuide/en/modules/configuration.xml
Log:
Document proxy unwrapping
Modified: docs/trunk/referenceGuide/en/modules/configuration.xml
===================================================================
--- docs/trunk/referenceGuide/en/modules/configuration.xml 2007-06-15 00:18:53 UTC (rev 7432)
+++ docs/trunk/referenceGuide/en/modules/configuration.xml 2007-06-15 10:24:24 UTC (rev 7433)
@@ -203,4 +203,20 @@
</para>
</sect2>
</sect1>
+ <sect1>
+ <title>Disabling dynamic proxy unwrapping</title>
+ <para>JBoss Portal use the JBoss Microkernel for the service infrastructure. The JBoss Microkernel provides
+ injection of services into other services, also known as wiring. Unfortunately it is only possible to inject
+ dynamic proxies that talks to the MBeanServer due to the fact the Microkernel is JMX based. The overhead
+ at runtime is minimal since the Microkernel implementation is highly optimized, however when it is used
+ with Java 5 a noticeable bottleneck appears due to the fact that the implementation
+ of the JMX API classes <emphasis>javax.management.*</emphasis> provided by the Java Platform performs synchronization. This does
+ not happen under JDK 1.4 since those classes are implemented by JBoss MX.</para>
+ <para>JBoss Portal services use a special kind of Model MBean called JBossServiceModelMBean which allows to
+ unwrap the injected dynamic proxies and replace them by the real POJO services. This allows to remove the
+ bottleneck with Java 5 and provide an extra boost of performances on JDK 1.4. By default that feature
+ is enabled but it is possible to disabled it using command line arguments.</para>
+ <programlisting><![CDATA[
+>run.sh -Dportal.kernel.no_proxies=false]]></programlisting>
+ </sect1>
</chapter>
18 years, 10 months
JBoss Portal SVN: r7432 - trunk/faces/src/main/org/jboss/portal/faces/el.
by portal-commits@lists.jboss.org
Author: julien(a)jboss.com
Date: 2007-06-14 20:18:53 -0400 (Thu, 14 Jun 2007)
New Revision: 7432
Modified:
trunk/faces/src/main/org/jboss/portal/faces/el/ClassConstantPublisherBean.java
Log:
document and test what is supported and what is not.
Modified: trunk/faces/src/main/org/jboss/portal/faces/el/ClassConstantPublisherBean.java
===================================================================
--- trunk/faces/src/main/org/jboss/portal/faces/el/ClassConstantPublisherBean.java 2007-06-15 00:07:49 UTC (rev 7431)
+++ trunk/faces/src/main/org/jboss/portal/faces/el/ClassConstantPublisherBean.java 2007-06-15 00:18:53 UTC (rev 7432)
@@ -34,8 +34,15 @@
* public and static. The properties are read only and cannot be modified. It allows to use
* constant names from expression language rather than the constant values directly.
*
- * The semantics to obtain values from a class are the same defined by the Java Language Specification.
+ * <ul>
+ * <li>Class objects of type class or interface are supported.</li>
+ * <li>Class inheritence is supported, Class object returned from <code>Class.getSuperClass()</code> is examined.</li>
+ * <li>Interface implementation is not yet supported, Class objects returned from <code>Class.getInterfaces()</code> are
+ * not examined.</li>
+ * </ul>
*
+ * todo: implement and test interfaces returned by <code>Class.getInterfaces()</code>.
+ *
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
* @version $Revision: 1.1 $
*/
18 years, 10 months
JBoss Portal SVN: r7431 - trunk/faces/src/main/org/jboss/portal/test/faces/el.
by portal-commits@lists.jboss.org
Author: julien(a)jboss.com
Date: 2007-06-14 20:07:49 -0400 (Thu, 14 Jun 2007)
New Revision: 7431
Modified:
trunk/faces/src/main/org/jboss/portal/test/faces/el/ClassConstantPublisherBeanTestCase.java
Log:
test more the ClassConstantPublisherBean
Modified: trunk/faces/src/main/org/jboss/portal/test/faces/el/ClassConstantPublisherBeanTestCase.java
===================================================================
--- trunk/faces/src/main/org/jboss/portal/test/faces/el/ClassConstantPublisherBeanTestCase.java 2007-06-15 00:05:08 UTC (rev 7430)
+++ trunk/faces/src/main/org/jboss/portal/test/faces/el/ClassConstantPublisherBeanTestCase.java 2007-06-15 00:07:49 UTC (rev 7431)
@@ -47,6 +47,13 @@
bean3.setValue("className", ClassConstant3.class.getName());
}
+ public void testMeta()
+ {
+ assertEquals(String.class, bean1.getType("className"));
+ assertNotNull(bean1.getValue("className"));
+ assertEquals(ClassConstant1.class.getName(), bean1.getValue("className").getObject());
+ }
+
public void testExtendsObject()
{
assertNull(bean1.getType("PRIVATE_1"));
18 years, 10 months
JBoss Portal SVN: r7430 - in trunk: core-admin/src/resources/portal-admin-war/WEB-INF/jsf and 1 other directories.
by portal-commits@lists.jboss.org
Author: julien(a)jboss.com
Date: 2007-06-14 20:05:08 -0400 (Thu, 14 Jun 2007)
New Revision: 7430
Modified:
trunk/core-admin/src/resources/portal-admin-war/WEB-INF/faces-config.xml
trunk/core-admin/src/resources/portal-admin-war/WEB-INF/jsf/objects.xhtml
trunk/faces/src/main/org/jboss/portal/faces/el/ClassConstantPublisherBean.java
Log:
- fix in ClassConstantPublisherBean config
- use ClassConstantPublisherBean for PortalObject constants used in the objects.xhtml
Modified: trunk/core-admin/src/resources/portal-admin-war/WEB-INF/faces-config.xml
===================================================================
--- trunk/core-admin/src/resources/portal-admin-war/WEB-INF/faces-config.xml 2007-06-14 23:44:39 UTC (rev 7429)
+++ trunk/core-admin/src/resources/portal-admin-war/WEB-INF/faces-config.xml 2007-06-15 00:05:08 UTC (rev 7430)
@@ -268,9 +268,19 @@
<property-name>domainConfigurator</property-name>
<value>#{applicationScope.AuthorizationDomainRegistry.portalobject.configurator}</value>
</managed-property>
-
</managed-bean>
+ <!-- Constants -->
+ <managed-bean>
+ <managed-bean-name>PortalObject</managed-bean-name>
+ <managed-bean-class>org.jboss.portal.faces.el.ClassConstantPublisherBean</managed-bean-class>
+ <managed-bean-scope>application</managed-bean-scope>
+ <managed-property>
+ <property-name>className</property-name>
+ <value>org.jboss.portal.core.model.portal.PortalObject</value>
+ </managed-property>
+ </managed-bean>
+
<navigation-rule>
<navigation-case>
<from-outcome>index</from-outcome>
Modified: trunk/core-admin/src/resources/portal-admin-war/WEB-INF/jsf/objects.xhtml
===================================================================
--- trunk/core-admin/src/resources/portal-admin-war/WEB-INF/jsf/objects.xhtml 2007-06-14 23:44:39 UTC (rev 7429)
+++ trunk/core-admin/src/resources/portal-admin-war/WEB-INF/jsf/objects.xhtml 2007-06-15 00:05:08 UTC (rev 7430)
@@ -5,16 +5,16 @@
xmlns:c="http://java.sun.com/jstl/core">
<c:choose>
- <c:when test="#{portalobjectmgr.selectedObject.type == 0}">
+ <c:when test="#{portalobjectmgr.selectedObject.type == PortalObject.TYPE_CONTEXT}">
<ui:include src="editContext.xhtml"/>
</c:when>
- <c:when test="#{portalobjectmgr.selectedObject.type == 1}">
+ <c:when test="#{portalobjectmgr.selectedObject.type == PortalObject.TYPE_PORTAL}">
<ui:include src="editPage.xhtml"/>
</c:when>
- <c:when test="#{portalobjectmgr.selectedObject.type == 2}">
+ <c:when test="#{portalobjectmgr.selectedObject.type == PortalObject.TYPE_PAGE}">
<ui:include src="editPage.xhtml"/>
</c:when>
- <c:when test="#{portalobjectmgr.selectedObject.type == 3}">
+ <c:when test="#{portalobjectmgr.selectedObject.type == PortalObject.TYPE_WINDOW}">
<ui:include src="editWindow.xhtml"/>
</c:when>
<c:otherwise>FIXME</c:otherwise>
Modified: trunk/faces/src/main/org/jboss/portal/faces/el/ClassConstantPublisherBean.java
===================================================================
--- trunk/faces/src/main/org/jboss/portal/faces/el/ClassConstantPublisherBean.java 2007-06-14 23:44:39 UTC (rev 7429)
+++ trunk/faces/src/main/org/jboss/portal/faces/el/ClassConstantPublisherBean.java 2007-06-15 00:05:08 UTC (rev 7430)
@@ -96,6 +96,12 @@
public Class getType(Object propertyName) throws IllegalArgumentException
{
+ if ("className".equals(propertyName))
+ {
+ return String.class;
+ }
+
+ //
Map entries = getEntries();
Object value = entries.get(propertyName);
return value != null ? value.getClass() : null;
18 years, 10 months
JBoss Portal SVN: r7429 - in trunk/common/src/main/org/jboss/portal/common: net/file and 1 other directories.
by portal-commits@lists.jboss.org
Author: bdaw
Date: 2007-06-14 19:44:39 -0400 (Thu, 14 Jun 2007)
New Revision: 7429
Modified:
trunk/common/src/main/org/jboss/portal/common/jar/JarEntryInfo.java
trunk/common/src/main/org/jboss/portal/common/net/file/FileURLNavigationProvider.java
trunk/common/src/main/org/jboss/portal/common/net/jar/JarURLNavigationProvider.java
Log:
rollback recent changes that broke portal deployment
Modified: trunk/common/src/main/org/jboss/portal/common/jar/JarEntryInfo.java
===================================================================
--- trunk/common/src/main/org/jboss/portal/common/jar/JarEntryInfo.java 2007-06-14 23:20:26 UTC (rev 7428)
+++ trunk/common/src/main/org/jboss/portal/common/jar/JarEntryInfo.java 2007-06-14 23:44:39 UTC (rev 7429)
@@ -52,12 +52,9 @@
throw new IllegalArgumentException();
}
+ //
String entryName = entry.getName();
ArrayList atoms = new ArrayList();
-
- //add the root element since this is not actually included in the jar as a entry
- atoms.add("/");
-
int previous = -1;
while (true)
{
Modified: trunk/common/src/main/org/jboss/portal/common/net/file/FileURLNavigationProvider.java
===================================================================
--- trunk/common/src/main/org/jboss/portal/common/net/file/FileURLNavigationProvider.java 2007-06-14 23:20:26 UTC (rev 7428)
+++ trunk/common/src/main/org/jboss/portal/common/net/file/FileURLNavigationProvider.java 2007-06-14 23:44:39 UTC (rev 7429)
@@ -29,7 +29,6 @@
import java.util.Arrays;
import java.net.URL;
-import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.File;
@@ -54,55 +53,48 @@
private void visit(File file, URLVisitor visitor, URLFilter filter) throws IllegalArgumentException, IOException
{
- if (!file.exists())
+ String name = file.getName();
+ if (file.isDirectory())
{
- throw new FileNotFoundException();
- }
- else
- {
- String name = file.getName();
- if (file.isDirectory())
+ if (trace)
{
- if (trace)
- {
- log.debug("entering directory" + file.getAbsolutePath());
- }
- URL url = file.toURL();
- boolean visit = filter == null || filter.acceptDir(url);
- if (visit)
- {
- visitor.startDir(url, name);
- File[] childrenFiles = file.listFiles();
- Arrays.sort(childrenFiles);
- for (int i = 0; i < childrenFiles.length; i++)
- {
- File childFile = childrenFiles[i];
- visit(childFile, visitor, filter);
- }
- visitor.endDir(file.toURL(), name);
- if (trace)
- {
- log.debug("leaving directory" + file.getAbsolutePath());
- }
- }
+ log.debug("entering directory" + file.getAbsolutePath());
}
- else
+ URL url = file.toURL();
+ boolean visit = filter == null || filter.acceptDir(url);
+ if (visit)
{
- if (trace)
+ visitor.startDir(url, name);
+ File[] childrenFiles = file.listFiles();
+ Arrays.sort(childrenFiles);
+ for (int i = 0; i < childrenFiles.length; i++)
{
- log.debug("visiting file " + file.getAbsolutePath());
+ File childFile = childrenFiles[i];
+ visit(childFile, visitor, filter);
}
- URL url = file.toURL();
- File file2 = new File(url.getFile());
- if (file.equals(file2) && filter.acceptFile(url))
+ visitor.endDir(file.toURL(), name);
+ if (trace)
{
- visitor.file(url, name);
+ log.debug("leaving directory" + file.getAbsolutePath());
}
- else if (trace)
- {
- log.debug("The file does not respect url format");
- }
}
}
+ else
+ {
+ if (trace)
+ {
+ log.debug("visiting file " + file.getAbsolutePath());
+ }
+ URL url = file.toURL();
+ File file2 = new File(url.getFile());
+ if (file.equals(file2))
+ {
+ visitor.file(url, name);
+ }
+ else if (trace)
+ {
+ log.debug("The file does not respect url format");
+ }
+ }
}
}
Modified: trunk/common/src/main/org/jboss/portal/common/net/jar/JarURLNavigationProvider.java
===================================================================
--- trunk/common/src/main/org/jboss/portal/common/net/jar/JarURLNavigationProvider.java 2007-06-14 23:20:26 UTC (rev 7428)
+++ trunk/common/src/main/org/jboss/portal/common/net/jar/JarURLNavigationProvider.java 2007-06-14 23:44:39 UTC (rev 7429)
@@ -65,27 +65,13 @@
JarFile jarFile = conn.getJarFile();
URL jarURL = conn.getJarFileURL();
JarEntry rootEntry = conn.getJarEntry();
-
- // if the URL specifies a directory without a "/" at the end
- // the entry will be found, except it won't actually exist.
- // To get around this issue, we need to check if an entry exists
- // with a "/" at the end.
- if (rootEntry != null)
+
+ //
+ if (rootEntry == null)
{
- JarEntry testDirEntry = conn.getJarFile().getJarEntry(rootEntry + "/");
- if (testDirEntry != null)
- {
- rootEntry = testDirEntry;
- }
+ throw new NotYetImplemented("The code for exact jar url has not been implemented");
}
- else
- {
- // if rootEntry == null then the url points to the root of the jar. The problem
- // is that the root of the jar doesn't actually exist in the jar.
- // We need to create a fake jar entry to mimic this behavior
- rootEntry = new JarEntry("/");
- }
-
+
// Get the root entry
JarEntryInfo rootEntryInfo = new JarEntryInfo(rootEntry);
@@ -103,15 +89,8 @@
// Only consider descendant of the root or root itself
if (entryInfo.equals(rootEntryInfo) || entryInfo.isDescendantOf(rootEntryInfo))
{
- List relPath;
// The relative path from the root
- if (rootEntryInfo.size() > 1){
- relPath = entryInfo.getNames().subList(rootEntryInfo.size() - 1, entryInfo.size());
- }
- else
- {
- relPath = entryInfo.getNames();
- }
+ List relPath = entryInfo.getNames().subList(rootEntryInfo.size() - 1, entryInfo.size());
// Enter intermediate dirs
while (stack.size() < relPath.size() - 1 && enabled)
@@ -166,10 +145,7 @@
String name = (String)relPath.get(relPath.size() - 1);
stack.push(name, false);
URL url = stack.getURL();
- if (filter.acceptFile(url))
- {
- visitor.file(url, name);
- }
+ visitor.file(url, name);
stack.pop();
}
}
18 years, 10 months