JBoss Portal SVN: r6565 - trunk/core-admin/src/resources/portal-admin-war/WEB-INF/jsf.
by portal-commits@lists.jboss.org
Author: julien(a)jboss.com
Date: 2007-03-06 16:58:35 -0500 (Tue, 06 Mar 2007)
New Revision: 6565
Modified:
trunk/core-admin/src/resources/portal-admin-war/WEB-INF/jsf/editWindow.xhtml
Log:
enable the editor on the window edit page
Modified: trunk/core-admin/src/resources/portal-admin-war/WEB-INF/jsf/editWindow.xhtml
===================================================================
--- trunk/core-admin/src/resources/portal-admin-war/WEB-INF/jsf/editWindow.xhtml 2007-03-06 21:52:37 UTC (rev 6564)
+++ trunk/core-admin/src/resources/portal-admin-war/WEB-INF/jsf/editWindow.xhtml 2007-03-06 21:58:35 UTC (rev 6565)
@@ -13,18 +13,13 @@
<div>
<jbp:portlet
instanceId="#{portalobjectmgr.selectedContentEditorInstance}"
- renderParameters="#{portalobjectmgr.renderParameters}"/>
+ renderParameters="#{portalobjectmgr.renderParameters}"
+ supportedModes="edit_content"
+ supportedWindowStates="normal"
+ initialMode="edit_content"
+ initialWindowState="normal"/>
</div>
- <!-- -->
- <h:form id="window_form">
- <ct:content
- contentType="#{portalobjectmgr.selectedContentType}"
- contentURI="#{portalobjectmgr.selectedContentURI}"
- submitFunction="document.window_form.submit()"/>
- <h:commandButton value="Update" action="#{assignContentToWindowAction.execute}" styleClass="portlet-form-button"/>
- </h:form>
-
</ui:define>
</ui:composition>
17 years, 4 months
JBoss Portal SVN: r6564 - trunk/core/src/bin/portal-core-war/themes/renaissance.
by portal-commits@lists.jboss.org
Author: thomas.heute(a)jboss.com
Date: 2007-03-06 16:52:37 -0500 (Tue, 06 Mar 2007)
New Revision: 6564
Modified:
trunk/core/src/bin/portal-core-war/themes/renaissance/portal_style.css
Log:
Fix: Columns in user portlet search results are not aligned correctly. [JBPORTAL-1308]
Modified: trunk/core/src/bin/portal-core-war/themes/renaissance/portal_style.css
===================================================================
--- trunk/core/src/bin/portal-core-war/themes/renaissance/portal_style.css 2007-03-06 21:50:33 UTC (rev 6563)
+++ trunk/core/src/bin/portal-core-war/themes/renaissance/portal_style.css 2007-03-06 21:52:37 UTC (rev 6564)
@@ -1036,7 +1036,6 @@
/* Text in every other row in the table */
.portlet-table-alternate {
- padding: 3px 5px;
background-color: #E6E8E5;
border-bottom: 1px solid #d5d5d5;
}
17 years, 4 months
JBoss Portal SVN: r6563 - in trunk: core-cms/src/main/org/jboss/portal/core/cms and 3 other directories.
by portal-commits@lists.jboss.org
Author: julien(a)jboss.com
Date: 2007-03-06 16:50:33 -0500 (Tue, 06 Mar 2007)
New Revision: 6563
Added:
trunk/core/src/main/org/jboss/portal/core/impl/model/portal/content/GenericPortletContentRenderer.java
Modified:
trunk/core-cms/src/main/org/jboss/portal/core/cms/CMSConstants.java
trunk/core-cms/src/main/org/jboss/portal/core/cms/CMSObjectCommandFactory.java
trunk/core-cms/src/main/org/jboss/portal/core/cms/content/CMSContentRenderer.java
trunk/core-cms/src/main/org/jboss/portal/core/cms/ui/CMSPortlet.java
trunk/core-cms/src/resources/portal-cms-sar/META-INF/jboss-service.xml
trunk/core/src/main/org/jboss/portal/core/impl/model/portal/content/PortletContentRenderer.java
Log:
generify the portlet integration for content viewing
Added: trunk/core/src/main/org/jboss/portal/core/impl/model/portal/content/GenericPortletContentRenderer.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/impl/model/portal/content/GenericPortletContentRenderer.java (rev 0)
+++ trunk/core/src/main/org/jboss/portal/core/impl/model/portal/content/GenericPortletContentRenderer.java 2007-03-06 21:50:33 UTC (rev 6563)
@@ -0,0 +1,131 @@
+/******************************************************************************
+ * 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.core.impl.model.portal.content;
+
+import org.jboss.portal.core.model.instance.Instance;
+import org.jboss.portal.core.model.instance.InstanceContainer;
+import org.jboss.portal.core.model.portal.command.RenderWindowCommand;
+import org.jboss.portal.core.model.portal.Window;
+import org.jboss.portal.core.model.portal.PortalObjectId;
+import org.jboss.portal.core.model.content.Content;
+import org.jboss.portal.core.controller.ControllerContext;
+import org.jboss.portal.portlet.PortletParametersStateString;
+import org.jboss.portal.Mode;
+import org.jboss.portal.theme.page.WindowResult;
+import org.jboss.portal.theme.navigation.WindowNavigationalState;
+
+import java.util.Map;
+import java.util.HashMap;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public class GenericPortletContentRenderer extends PortletContentRenderer
+{
+
+ /** . */
+ public static final Mode VIEW_CONTENT_MODE = new Mode("view_content");
+
+ /** . */
+ private String instanceName;
+
+ /** . */
+ private boolean decorateContent;
+
+ public String getInstanceName()
+ {
+ return instanceName;
+ }
+
+ public void setInstanceName(String instanceName)
+ {
+ this.instanceName = instanceName;
+ }
+
+ public boolean isDecorateContent()
+ {
+ return decorateContent;
+ }
+
+ public void setDecorateContent(boolean decorateContent)
+ {
+ this.decorateContent = decorateContent;
+ }
+
+ protected Instance findInstance(RenderWindowCommand cmd)
+ {
+ ControllerContext context = cmd.getControllerContext();
+ InstanceContainer container = context.getController().getInstanceContainer();
+ return container.getDefinition(instanceName);
+ }
+
+ public Object renderWindow(RenderWindowCommand cmd) throws Exception
+ {
+ ControllerContext context = cmd.getControllerContext();
+ Window window = cmd.getWindow();
+ PortalObjectId windowId = window.getId();
+
+ // Initialize the navigational state with the URI when needed
+ PortletParametersStateString navigationalState = (PortletParametersStateString)context.getAttribute(RenderWindowCommand.NAVIGATIONAL_STATE_SCOPE, windowId);
+ if (navigationalState == null)
+ {
+ Content content = window.getContent();
+ String uri = content.getURI();
+ navigationalState = new PortletParametersStateString();
+ navigationalState.setValue("uri", uri);
+ context.setAttribute(RenderWindowCommand.NAVIGATIONAL_STATE_SCOPE, windowId, navigationalState);
+ }
+
+ // Set the view content mode
+ String navStateKey = windowId + "_window";
+ WindowNavigationalState windowNavState = (WindowNavigationalState)context.getAttribute(RenderWindowCommand.NAVIGATIONAL_STATE_SCOPE, navStateKey);
+ if (windowNavState == null)
+ {
+ windowNavState = new WindowNavigationalState();
+ context.setAttribute(RenderWindowCommand.NAVIGATIONAL_STATE_SCOPE, navStateKey, windowNavState);
+ }
+ windowNavState.setMode(VIEW_CONTENT_MODE);
+
+ //
+ Object o = super.renderWindow(cmd);
+
+ //
+ if (o instanceof WindowResult && decorateContent == false)
+ {
+ WindowResult result = (WindowResult)o;
+
+ //
+ Map props = new HashMap(result.getWindowProperties());
+ props.put("theme.windowRendererId", "emptyRenderer");
+ props.put("theme.decorationRendererId", "emptyRenderer");
+ props.put("theme.portletRendererId", "emptyRenderer");
+
+ //
+ result.setWindowProperties(props);
+ }
+
+ //
+ return o;
+ }
+}
Modified: trunk/core/src/main/org/jboss/portal/core/impl/model/portal/content/PortletContentRenderer.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/impl/model/portal/content/PortletContentRenderer.java 2007-03-06 21:46:32 UTC (rev 6562)
+++ trunk/core/src/main/org/jboss/portal/core/impl/model/portal/content/PortletContentRenderer.java 2007-03-06 21:50:33 UTC (rev 6563)
@@ -106,6 +106,11 @@
return customizationManager.getInstance(window, user);
}
+ protected PortletInvocationResponse invoke(Instance instance, PortletInvocation invocation) throws PortletInvokerException
+ {
+ return instance.invoke(invocation);
+ }
+
public Object renderWindow(RenderWindowCommand cmd) throws Exception
{
Window window = cmd.getWindow();
@@ -114,28 +119,21 @@
ServerConfig cfg = context.getServerInvocation().getRequest().getServer().getConfig();
PortalObjectId windowId = window.getId();
StateString navigationalState = (StateString)context.getAttribute(RenderWindowCommand.NAVIGATIONAL_STATE_SCOPE, windowId);
-
- // Get mode and window state
String navStateKey = windowId + "_window";
WindowNavigationalState windowNavState = (WindowNavigationalState)context.getAttribute(RenderWindowCommand.NAVIGATIONAL_STATE_SCOPE, navStateKey);
+
+ //
if (windowNavState == null)
{
windowNavState = new WindowNavigationalState();
context.setAttribute(RenderWindowCommand.NAVIGATIONAL_STATE_SCOPE, navStateKey, windowNavState);
}
+
+ //
Mode mode = windowNavState.getMode();
WindowState windowState = windowNavState.getWindowState();
//
- RenderInvocation invocation = PortletInvocationFactory.createRender(
- context,
- mode,
- windowState,
- navigationalState,
- window,
- portal);
-
- //
String windowTitle;
String contentChars;
String headerChars = null;
@@ -164,12 +162,20 @@
throw new ResourceNotFoundException(ref);
}
+ // Create invocation
+ RenderInvocation invocation = PortletInvocationFactory.createRender(
+ context,
+ mode,
+ windowState,
+ navigationalState,
+ window,
+ portal);
+
//
PortletInvocationResponse response;
try
{
- before(cmd, invocation);
- response = instance.invoke(invocation);
+ response = invoke(instance, invocation);
}
catch (PortletInvokerException e)
{
@@ -186,10 +192,6 @@
throw new ControllerException(e);
}
}
- finally
- {
- after(cmd, invocation);
- }
//
if (response instanceof FragmentResponse)
@@ -343,14 +345,6 @@
return null;
}
- protected void before(RenderWindowCommand cmd, PortletInvocation invocation)
- {
- }
-
- protected void after(RenderWindowCommand cmd, PortletInvocation invocation)
- {
- }
-
/**
* Create the action URLs for the allowed window states of the rendered portlet window and add them to the provided
* actionMap.
Modified: trunk/core-cms/src/main/org/jboss/portal/core/cms/CMSConstants.java
===================================================================
--- trunk/core-cms/src/main/org/jboss/portal/core/cms/CMSConstants.java 2007-03-06 21:46:32 UTC (rev 6562)
+++ trunk/core-cms/src/main/org/jboss/portal/core/cms/CMSConstants.java 2007-03-06 21:50:33 UTC (rev 6563)
@@ -28,11 +28,5 @@
*/
public class CMSConstants
{
- /**
- * Property name for the server config which designates the value of the default window reference for the
- * CMS integration by the command mapper.
- */
- public static final String DEFAULT_CMS_WINDOW_REF_CONFIG_PROPERTY_NAME = "cms.default_window_ref";
-
public static final String SEARCH_ID = "CMS";
}
Modified: trunk/core-cms/src/main/org/jboss/portal/core/cms/CMSObjectCommandFactory.java
===================================================================
--- trunk/core-cms/src/main/org/jboss/portal/core/cms/CMSObjectCommandFactory.java 2007-03-06 21:46:32 UTC (rev 6562)
+++ trunk/core-cms/src/main/org/jboss/portal/core/cms/CMSObjectCommandFactory.java 2007-03-06 21:50:33 UTC (rev 6563)
@@ -60,6 +60,11 @@
/** . */
protected ServerConfig serverConfig;
+ public PortalObjectId getTargetWindowId()
+ {
+ return targetWindowId;
+ }
+
public CMS getCMSService()
{
return CMSService;
@@ -94,9 +99,6 @@
{
targetWindowId = PortalObjectId.parse(targetWindowRef, PortalObjectId.LEGACY_FORMAT);
- // Update the config from the configuration
- serverConfig.setProperty(CMSConstants.DEFAULT_CMS_WINDOW_REF_CONFIG_PROPERTY_NAME, targetWindowRef);
-
//
super.startService();
}
Modified: trunk/core-cms/src/main/org/jboss/portal/core/cms/content/CMSContentRenderer.java
===================================================================
--- trunk/core-cms/src/main/org/jboss/portal/core/cms/content/CMSContentRenderer.java 2007-03-06 21:46:32 UTC (rev 6562)
+++ trunk/core-cms/src/main/org/jboss/portal/core/cms/content/CMSContentRenderer.java 2007-03-06 21:50:33 UTC (rev 6563)
@@ -22,98 +22,69 @@
******************************************************************************/
package org.jboss.portal.core.cms.content;
-import org.jboss.portal.core.impl.model.portal.content.PortletContentRenderer;
-import org.jboss.portal.core.model.instance.Instance;
-import org.jboss.portal.core.model.instance.InstanceContainer;
-import org.jboss.portal.core.model.portal.Window;
-import org.jboss.portal.core.model.portal.PortalObjectId;
+import org.jboss.portal.core.impl.model.portal.content.GenericPortletContentRenderer;
import org.jboss.portal.core.model.portal.command.RenderWindowCommand;
-import org.jboss.portal.core.cms.CMSConstants;
-import org.jboss.portal.core.cms.ui.CMSPortlet;
-import org.jboss.portal.core.controller.ControllerContext;
-import org.jboss.portal.portlet.PortletParametersStateString;
-import org.jboss.portal.portlet.invocation.PortletInvocation;
-import org.jboss.portal.server.config.ServerConfig;
-import org.jboss.portal.theme.page.WindowResult;
+import org.jboss.portal.core.model.portal.PortalObjectId;
-import java.util.HashMap;
-import java.util.Map;
+import javax.management.ObjectName;
/**
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
* @version $Revision: 1.1 $
*/
-public class CMSContentRenderer extends PortletContentRenderer
+public class CMSContentRenderer extends GenericPortletContentRenderer
{
- protected Instance findInstance(RenderWindowCommand cmd)
+ /** . */
+ private static final ThreadLocal useGlobalURLLocal = new ThreadLocal();
+
+ public static boolean useGlobalURL()
{
- ControllerContext context = cmd.getControllerContext();
+ return Boolean.TRUE.equals(useGlobalURLLocal.get());
+ }
- // The window
- Window window = cmd.getWindow();
- PortalObjectId windowId = window.getId();
+ /** . */
+ private PortalObjectId targetWindowId;
- //
- CMSContent content = (CMSContent)window.getContent();
- String uri = content.getURI();
+ /** . */
+ private ObjectName commandFactory;
- // Initialize the navigational state with the URI when needed
- PortletParametersStateString navigationalState = (PortletParametersStateString)context.getAttribute(RenderWindowCommand.NAVIGATIONAL_STATE_SCOPE, windowId);
- if (navigationalState == null)
- {
- navigationalState = new PortletParametersStateString();
- navigationalState.setValue("path", uri);
- context.setAttribute(RenderWindowCommand.NAVIGATIONAL_STATE_SCOPE, windowId, navigationalState);
- }
+ public ObjectName getCommandFactory()
+ {
+ return commandFactory;
+ }
- // Make that configurable
- InstanceContainer container = context.getController().getInstanceContainer();
- return container.getDefinition("CMSPortletInstance");
+ public void setCommandFactory(ObjectName commandFactory)
+ {
+ this.commandFactory = commandFactory;
}
- protected void before(RenderWindowCommand cmd, PortletInvocation invocation)
+ protected void startService() throws Exception
{
- // Find out if we are invoking the content portlet
- ServerConfig cfg = cmd.getControllerContext().getServerInvocation().getRequest().getServer().getConfig();
+ targetWindowId = (PortalObjectId)server.getAttribute(commandFactory, "TargetWindowId");
//
- Window window = cmd.getWindow();
-
- // Set the request property for it
- String windowRef = cfg.getProperty(CMSConstants.DEFAULT_CMS_WINDOW_REF_CONFIG_PROPERTY_NAME);
- if (window.getId().toString(PortalObjectId.LEGACY_FORMAT).equals(windowRef))
- {
- invocation.setAttribute(PortletInvocation.REQUEST_PROPERTIES_SCOPE, CMSPortlet.REQUEST_PROPERTY_USE_GLOBAL_URLS, "true");
- }
+ super.startService();
}
- protected void after(RenderWindowCommand cmd, PortletInvocation invocation)
- {
- // Cleanup request property
- invocation.removeAttribute(PortletInvocation.REQUEST_PROPERTIES_SCOPE, CMSPortlet.REQUEST_PROPERTY_USE_GLOBAL_URLS);
- }
-
public Object renderWindow(RenderWindowCommand cmd) throws Exception
{
- Object o = super.renderWindow(cmd);
-
- //
- if (o instanceof WindowResult)
+ try
{
- WindowResult result = (WindowResult)o;
+ PortalObjectId windowId = cmd.getWindow().getId();
//
- Map props = new HashMap(result.getWindowProperties());
- props.put("theme.windowRendererId", "emptyRenderer");
- props.put("theme.decorationRendererId", "emptyRenderer");
- props.put("theme.portletRendererId", "emptyRenderer");
+ if (windowId.equals(targetWindowId))
+ {
+ useGlobalURLLocal.set(Boolean.TRUE);
+ }
//
- result.setWindowProperties(props);
+ return super.renderWindow(cmd);
}
-
- //
- return o;
+ finally
+ {
+ useGlobalURLLocal.set(null);
+ }
}
}
Modified: trunk/core-cms/src/main/org/jboss/portal/core/cms/ui/CMSPortlet.java
===================================================================
--- trunk/core-cms/src/main/org/jboss/portal/core/cms/ui/CMSPortlet.java 2007-03-06 21:46:32 UTC (rev 6562)
+++ trunk/core-cms/src/main/org/jboss/portal/core/cms/ui/CMSPortlet.java 2007-03-06 21:50:33 UTC (rev 6563)
@@ -37,6 +37,7 @@
import javax.portlet.PortletURL;
import javax.portlet.RenderRequest;
import javax.portlet.RenderResponse;
+import javax.portlet.PortletMode;
import org.apache.log4j.Logger;
import org.jboss.portal.cms.CMS;
@@ -130,9 +131,6 @@
/** . */
private CMS CMSService;
-
- /** . */
- private String indexpage;
public void init() throws PortletException
{
@@ -159,8 +157,42 @@
}
}
- public void doView(RenderRequest req, RenderResponse resp) throws PortletException, PortletSecurityException, IOException
+
+ protected void doDispatch(RenderRequest req, RenderResponse resp) throws PortletException, PortletSecurityException, IOException
{
+ PortletMode portletMode = req.getPortletMode();
+ if ("view_content".equals(portletMode.toString()))
+ {
+ doViewContent(req, resp);
+ }
+ else
+ {
+ super.doDispatch(req, resp);
+ }
+ }
+
+ protected void doViewContent(RenderRequest req, RenderResponse resp) throws PortletException, PortletSecurityException, IOException
+ {
+ String path = req.getParameter(RENDER_PARAMETER_PATH);
+ if (path != null)
+ {
+ display(req, resp, path);
+ }
+ else
+ {
+ doView(req, resp);
+ }
+ }
+
+ protected void doView(RenderRequest req, RenderResponse resp) throws PortletException, PortletSecurityException, IOException
+ {
+ PortletPreferences prefs = req.getPreferences();
+ String indexpage = prefs.getValue("indexpage", "/default/index.html");
+ display(req, resp, indexpage);
+ }
+
+ private void display(RenderRequest req, RenderResponse resp, String path) throws PortletException, PortletSecurityException, IOException
+ {
String useGlobalURLs = req.getProperty(REQUEST_PROPERTY_USE_GLOBAL_URLS);
URLFactory textURLFactory = null;
if ("true".equals(useGlobalURLs))
@@ -175,41 +207,19 @@
URLFactory resourceURLFactory = new GlobalURLFactory(((JBossRenderRequest)req).getControllerContext());
//
- String path;
- path = req.getParameter(RENDER_PARAMETER_PATH);
- if (path == null)
- {
- PortletPreferences prefs = req.getPreferences();
- indexpage = prefs.getValue("indexpage", "/default/index.html");
- }
-
- //
try
{
// Get the file from the CMS, localized.
- Command fileGet;
- File file;
- if (path == null)
+ Command fileGet = CMSService.getCommandFactory().createFileGetCommand(path, req.getLocale());
+ File file = (File)CMSService.execute(fileGet);
+
+ //
+ if (file == null)
{
- fileGet = CMSService.getCommandFactory().createFileGetCommand(indexpage, req.getLocale());
+ fileGet = CMSService.getCommandFactory().createFileGetCommand(path, new Locale(CMSService.getDefaultLocale()));
file = (File)CMSService.execute(fileGet);
- if (file == null)
- {
- fileGet = CMSService.getCommandFactory().createFileGetCommand(indexpage, new Locale(CMSService.getDefaultLocale()));
- file = (File)CMSService.execute(fileGet);
- }
}
- else
- {
- fileGet = CMSService.getCommandFactory().createFileGetCommand(path, req.getLocale());
- file = (File)CMSService.execute(fileGet);
- if (file == null)
- {
- fileGet = CMSService.getCommandFactory().createFileGetCommand(path, new Locale(CMSService.getDefaultLocale()));
- file = (File)CMSService.execute(fileGet);
- }
- }
// Translate links to resources.
String sHTML = null;
Modified: trunk/core-cms/src/resources/portal-cms-sar/META-INF/jboss-service.xml
===================================================================
--- trunk/core-cms/src/resources/portal-cms-sar/META-INF/jboss-service.xml 2007-03-06 21:46:32 UTC (rev 6562)
+++ trunk/core-cms/src/resources/portal-cms-sar/META-INF/jboss-service.xml 2007-03-06 21:50:33 UTC (rev 6563)
@@ -702,9 +702,12 @@
xmbean-code="org.jboss.portal.jems.as.system.JBossServiceModelMBean">
<xmbean/>
<attribute name="ContentType">cms</attribute>
+ <attribute name="DecorateContent">false</attribute>
+ <attribute name="InstanceName">CMSPortletInstance</attribute>
<depends
optional-attribute-name="Registry"
proxy-type="attribute">portal:service=ContentRendererRegistry</depends>
+ <depends optional-attribute-name="CommandFactory">portal:commandFactory=CMSObject</depends>
</mbean>
<!-- Content handler integration -->
17 years, 4 months
JBoss Portal SVN: r6562 - in tags/JBoss_Portal_2_6_0_BETA1: core-cms/src/resources/portal-cms-sar/META-INF and 1 other directory.
by portal-commits@lists.jboss.org
Author: thomas.heute(a)jboss.com
Date: 2007-03-06 16:46:32 -0500 (Tue, 06 Mar 2007)
New Revision: 6562
Modified:
tags/JBoss_Portal_2_6_0_BETA1/cms/src/resources/test/jcr/fs-repository.xml
tags/JBoss_Portal_2_6_0_BETA1/cms/src/resources/test/jcr/repository.xml
tags/JBoss_Portal_2_6_0_BETA1/core-cms/src/resources/portal-cms-sar/META-INF/jboss-service.xml
Log:
Fix: CMS won't start with older versions of Sun JDK 1.4 [JBPORTAL-1304]
Modified: tags/JBoss_Portal_2_6_0_BETA1/cms/src/resources/test/jcr/fs-repository.xml
===================================================================
--- tags/JBoss_Portal_2_6_0_BETA1/cms/src/resources/test/jcr/fs-repository.xml 2007-03-06 20:58:52 UTC (rev 6561)
+++ tags/JBoss_Portal_2_6_0_BETA1/cms/src/resources/test/jcr/fs-repository.xml 2007-03-06 21:46:32 UTC (rev 6562)
@@ -41,15 +41,7 @@
</FileSystem>
<SearchIndex class="org.apache.jackrabbit.core.query.lucene.SearchIndex">
<param name="path" value="${wsp.home}/index"/>
- <param name="textFilterClasses" value="
- org.apache.jackrabbit.core.query.MsExcelTextFilter,
- org.apache.jackrabbit.core.query.MsPowerPointTextFilter,
- org.apache.jackrabbit.core.query.MsWordTextFilter,
- org.apache.jackrabbit.core.query.PdfTextFilter,
- org.apache.jackrabbit.core.query.HTMLTextFilter,
- org.apache.jackrabbit.core.query.XMLTextFilter,
- org.apache.jackrabbit.core.query.RTFTextFilter,
- org.apache.jackrabbit.core.query.OpenOfficeTextFilter" />
+ <param name="textFilterClasses" value="org.apache.jackrabbit.core.query.HTMLTextFilter" />
<param name="useCompoundFile" value="true"/>
<param name="minMergeDocs" value="100"/>
<param name="volatileIdleTime" value="3"/>
Modified: tags/JBoss_Portal_2_6_0_BETA1/cms/src/resources/test/jcr/repository.xml
===================================================================
--- tags/JBoss_Portal_2_6_0_BETA1/cms/src/resources/test/jcr/repository.xml 2007-03-06 20:58:52 UTC (rev 6561)
+++ tags/JBoss_Portal_2_6_0_BETA1/cms/src/resources/test/jcr/repository.xml 2007-03-06 21:46:32 UTC (rev 6562)
@@ -77,15 +77,7 @@
<SearchIndex class="org.apache.jackrabbit.core.query.lucene.SearchIndex">
<param name="path" value="${wsp.home}/index"/>
- <param name="textFilterClasses" value="
- org.apache.jackrabbit.core.query.MsExcelTextFilter,
- org.apache.jackrabbit.core.query.MsPowerPointTextFilter,
- org.apache.jackrabbit.core.query.MsWordTextFilter,
- org.apache.jackrabbit.core.query.PdfTextFilter,
- org.apache.jackrabbit.core.query.HTMLTextFilter,
- org.apache.jackrabbit.core.query.XMLTextFilter,
- org.apache.jackrabbit.core.query.RTFTextFilter,
- org.apache.jackrabbit.core.query.OpenOfficeTextFilter" />
+ <param name="textFilterClasses" value="org.apache.jackrabbit.core.query.HTMLTextFilter" />
<param name="useCompoundFile" value="true"/>
<param name="minMergeDocs" value="100"/>
<param name="volatileIdleTime" value="3"/>
@@ -131,4 +123,4 @@
<!-- XMLPersistenceManager: uses FileSystem for storage -->
<!--<PersistenceManager class="org.apache.jackrabbit.core.state.xml.XMLPersistenceManager"/>-->
</Versioning>
- </Repository>
\ No newline at end of file
+ </Repository>
Modified: tags/JBoss_Portal_2_6_0_BETA1/core-cms/src/resources/portal-cms-sar/META-INF/jboss-service.xml
===================================================================
--- tags/JBoss_Portal_2_6_0_BETA1/core-cms/src/resources/portal-cms-sar/META-INF/jboss-service.xml 2007-03-06 20:58:52 UTC (rev 6561)
+++ tags/JBoss_Portal_2_6_0_BETA1/core-cms/src/resources/portal-cms-sar/META-INF/jboss-service.xml 2007-03-06 21:46:32 UTC (rev 6562)
@@ -125,15 +125,7 @@
<SearchIndex class="org.apache.jackrabbit.core.query.lucene.SearchIndex">
<param name="path" value="${wsp.home}/index"/>
- <param name="textFilterClasses" value="
- org.apache.jackrabbit.core.query.MsExcelTextFilter,
- org.apache.jackrabbit.core.query.MsPowerPointTextFilter,
- org.apache.jackrabbit.core.query.MsWordTextFilter,
- org.apache.jackrabbit.core.query.PdfTextFilter,
- org.apache.jackrabbit.core.query.HTMLTextFilter,
- org.apache.jackrabbit.core.query.XMLTextFilter,
- org.apache.jackrabbit.core.query.RTFTextFilter,
- org.apache.jackrabbit.core.query.OpenOfficeTextFilter" />
+ <param name="textFilterClasses" value="org.apache.jackrabbit.core.query.HTMLTextFilter" />
<param name="useCompoundFile" value="true"/>
<param name="minMergeDocs" value="100"/>
<param name="volatileIdleTime" value="3"/>
17 years, 4 months
JBoss Portal SVN: r6561 - in trunk: core-cms/src/resources/portal-cms-sar/META-INF and 1 other directory.
by portal-commits@lists.jboss.org
Author: thomas.heute(a)jboss.com
Date: 2007-03-06 15:58:52 -0500 (Tue, 06 Mar 2007)
New Revision: 6561
Modified:
trunk/cms/src/resources/test/jcr/fs-repository.xml
trunk/cms/src/resources/test/jcr/repository.xml
trunk/core-cms/src/resources/portal-cms-sar/META-INF/jboss-service.xml
Log:
Reduced the size of "textFilterClasses" due to a bug in Sun JVM < 1.4.2_13 [JBPORTAL-1304]
Modified: trunk/cms/src/resources/test/jcr/fs-repository.xml
===================================================================
--- trunk/cms/src/resources/test/jcr/fs-repository.xml 2007-03-06 19:42:58 UTC (rev 6560)
+++ trunk/cms/src/resources/test/jcr/fs-repository.xml 2007-03-06 20:58:52 UTC (rev 6561)
@@ -41,15 +41,7 @@
</FileSystem>
<SearchIndex class="org.apache.jackrabbit.core.query.lucene.SearchIndex">
<param name="path" value="${wsp.home}/index"/>
- <param name="textFilterClasses" value="
- org.apache.jackrabbit.core.query.MsExcelTextFilter,
- org.apache.jackrabbit.core.query.MsPowerPointTextFilter,
- org.apache.jackrabbit.core.query.MsWordTextFilter,
- org.apache.jackrabbit.core.query.PdfTextFilter,
- org.apache.jackrabbit.core.query.HTMLTextFilter,
- org.apache.jackrabbit.core.query.XMLTextFilter,
- org.apache.jackrabbit.core.query.RTFTextFilter,
- org.apache.jackrabbit.core.query.OpenOfficeTextFilter" />
+ <param name="textFilterClasses" value="org.apache.jackrabbit.core.query.HTMLTextFilter" />
<param name="useCompoundFile" value="true"/>
<param name="minMergeDocs" value="100"/>
<param name="volatileIdleTime" value="3"/>
Modified: trunk/cms/src/resources/test/jcr/repository.xml
===================================================================
--- trunk/cms/src/resources/test/jcr/repository.xml 2007-03-06 19:42:58 UTC (rev 6560)
+++ trunk/cms/src/resources/test/jcr/repository.xml 2007-03-06 20:58:52 UTC (rev 6561)
@@ -77,15 +77,7 @@
<SearchIndex class="org.apache.jackrabbit.core.query.lucene.SearchIndex">
<param name="path" value="${wsp.home}/index"/>
- <param name="textFilterClasses" value="
- org.apache.jackrabbit.core.query.MsExcelTextFilter,
- org.apache.jackrabbit.core.query.MsPowerPointTextFilter,
- org.apache.jackrabbit.core.query.MsWordTextFilter,
- org.apache.jackrabbit.core.query.PdfTextFilter,
- org.apache.jackrabbit.core.query.HTMLTextFilter,
- org.apache.jackrabbit.core.query.XMLTextFilter,
- org.apache.jackrabbit.core.query.RTFTextFilter,
- org.apache.jackrabbit.core.query.OpenOfficeTextFilter" />
+ <param name="textFilterClasses" value="org.apache.jackrabbit.core.query.HTMLTextFilter" />
<param name="useCompoundFile" value="true"/>
<param name="minMergeDocs" value="100"/>
<param name="volatileIdleTime" value="3"/>
Modified: trunk/core-cms/src/resources/portal-cms-sar/META-INF/jboss-service.xml
===================================================================
--- trunk/core-cms/src/resources/portal-cms-sar/META-INF/jboss-service.xml 2007-03-06 19:42:58 UTC (rev 6560)
+++ trunk/core-cms/src/resources/portal-cms-sar/META-INF/jboss-service.xml 2007-03-06 20:58:52 UTC (rev 6561)
@@ -125,15 +125,7 @@
<SearchIndex class="org.apache.jackrabbit.core.query.lucene.SearchIndex">
<param name="path" value="${wsp.home}/index"/>
- <param name="textFilterClasses" value="
- org.apache.jackrabbit.core.query.MsExcelTextFilter,
- org.apache.jackrabbit.core.query.MsPowerPointTextFilter,
- org.apache.jackrabbit.core.query.MsWordTextFilter,
- org.apache.jackrabbit.core.query.PdfTextFilter,
- org.apache.jackrabbit.core.query.HTMLTextFilter,
- org.apache.jackrabbit.core.query.XMLTextFilter,
- org.apache.jackrabbit.core.query.RTFTextFilter,
- org.apache.jackrabbit.core.query.OpenOfficeTextFilter" />
+ <param name="textFilterClasses" value="org.apache.jackrabbit.core.query.HTMLTextFilter" />
<param name="useCompoundFile" value="true"/>
<param name="minMergeDocs" value="100"/>
<param name="volatileIdleTime" value="3"/>
17 years, 4 months
JBoss Portal SVN: r6560 - trunk/common/src/main/org/jboss/portal/common/util.
by portal-commits@lists.jboss.org
Author: chris.laprun(a)jboss.com
Date: 2007-03-06 14:42:58 -0500 (Tue, 06 Mar 2007)
New Revision: 6560
Modified:
trunk/common/src/main/org/jboss/portal/common/util/URLTools.java
Log:
Minor clean-ups.
Modified: trunk/common/src/main/org/jboss/portal/common/util/URLTools.java
===================================================================
--- trunk/common/src/main/org/jboss/portal/common/util/URLTools.java 2007-03-06 19:38:56 UTC (rev 6559)
+++ trunk/common/src/main/org/jboss/portal/common/util/URLTools.java 2007-03-06 19:42:58 UTC (rev 6560)
@@ -53,6 +53,11 @@
return isNetworkURL(url) || url.startsWith(FILE_PREFIX);
}
+ /**
+ * @param url
+ * @return
+ * @since 2.4.2
+ */
public static boolean isNetworkURL(String url)
{
if (url == null || url.length() == 0)
@@ -182,7 +187,7 @@
try
{
URL url = new URL(urlAsString);
- return exists((URL)url);
+ return exists(url);
}
catch (MalformedURLException e)
{
@@ -299,6 +304,7 @@
}
}
+ /** @since 2.4.2 */
public abstract static class URLReplacementGenerator
{
public abstract String getReplacementFor(int currentIndex, URLMatch currentMatch);
@@ -319,6 +325,12 @@
}
}
+ /**
+ * @param url
+ * @param newPort
+ * @return
+ * @since 2.4.2
+ */
public static String replaceServerPortInURL(String url, int newPort)
{
if (!isNetworkURL(url))
17 years, 4 months
JBoss Portal SVN: r6559 - branches/JBoss_Portal_Branch_2_4/common/src/main/org/jboss/portal/common/util.
by portal-commits@lists.jboss.org
Author: chris.laprun(a)jboss.com
Date: 2007-03-06 14:38:56 -0500 (Tue, 06 Mar 2007)
New Revision: 6559
Added:
branches/JBoss_Portal_Branch_2_4/common/src/main/org/jboss/portal/common/util/URLStreamOpeningThread.java
Modified:
branches/JBoss_Portal_Branch_2_4/common/src/main/org/jboss/portal/common/util/URLTools.java
Log:
- JBPORTAL-1279: Backported to 2.4
Added: branches/JBoss_Portal_Branch_2_4/common/src/main/org/jboss/portal/common/util/URLStreamOpeningThread.java
===================================================================
--- branches/JBoss_Portal_Branch_2_4/common/src/main/org/jboss/portal/common/util/URLStreamOpeningThread.java (rev 0)
+++ branches/JBoss_Portal_Branch_2_4/common/src/main/org/jboss/portal/common/util/URLStreamOpeningThread.java 2007-03-06 19:38:56 UTC (rev 6559)
@@ -0,0 +1,90 @@
+/*
+* 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;
+
+/**
+ * A class that opens an InputStream to a URL in a thread so that it doesn't block normal operations and can be timed
+ * out if needed.
+ *
+ * @author <a href="mailto:chris.laprun@jboss.com">Chris Laprun</a>
+ * @version $Revision$
+ * @since 2.4.2
+ */
+public class URLStreamOpeningThread extends Thread
+{
+ volatile private URL url;
+
+ /** */
+ private InputStream inputStream;
+
+ /** Exception in the event a connection error occurs */
+ private IOException exception = null;
+
+ public URLStreamOpeningThread(URL url)
+ {
+ ParameterValidation.throwIllegalArgExceptionIfNull(url, "URL");
+
+ this.url = url;
+ }
+
+ public void run()
+ {
+ try
+ {
+ inputStream = url.openStream();
+ if (inputStream == null)
+ {
+ throw new IllegalArgumentException("Cannot open stream from [" + url + "]");
+ }
+ }
+ catch (IOException e)
+ {
+ exception = e;
+ }
+ }
+
+ public boolean isConnected()
+ {
+ return inputStream != null;
+ }
+
+ public boolean isError()
+ {
+ return exception != null;
+ }
+
+ public InputStream getInputStream()
+ {
+ return inputStream;
+ }
+
+ public IOException getException()
+ {
+ return exception;
+ }
+}
Property changes on: branches/JBoss_Portal_Branch_2_4/common/src/main/org/jboss/portal/common/util/URLStreamOpeningThread.java
___________________________________________________________________
Name: svn:keywords
+ Author Date Id Revision
Name: svn:eol-style
+ native
Modified: branches/JBoss_Portal_Branch_2_4/common/src/main/org/jboss/portal/common/util/URLTools.java
===================================================================
--- branches/JBoss_Portal_Branch_2_4/common/src/main/org/jboss/portal/common/util/URLTools.java 2007-03-06 19:01:39 UTC (rev 6558)
+++ branches/JBoss_Portal_Branch_2_4/common/src/main/org/jboss/portal/common/util/URLTools.java 2007-03-06 19:38:56 UTC (rev 6559)
@@ -20,12 +20,11 @@
* 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.io.UnsupportedEncodingException;
+import java.net.MalformedURLException;
+import java.net.URL;
import java.net.URLDecoder;
import java.net.URLEncoder;
import java.util.ArrayList;
@@ -41,19 +40,35 @@
public class URLTools
{
public static final String RE_EMAIL_VALIDATION = "^([a-zA-Z0-9]+(([\\.\\-\\_]?[a-zA-Z0-9]+)+)?)\\(a)(([a-zA-Z0-9]+[\\.\\-\\_])+[a-zA-Z]{2,4})$";
- private static final Pattern LINK = Pattern.compile("(?:href|action|src)\\s*=\\s*('|\")\\s*([^'\"]*)\\s*('|\")",
+ private static final Pattern LINK = Pattern.compile("(?:href|action|src|location)\\s*=\\s*('|\")\\s*([^'\"]*)\\s*('|\")",
Pattern.CASE_INSENSITIVE);
public static final String HTTP_PREFIX = "http://";
public static final String HTTPS_PREFIX = "https://";
+ public static final String FTP_PREFIX = "ftp://";
public static final String FILE_PREFIX = "/";
public static boolean isURLAbsolute(String url)
{
- return url.startsWith(HTTP_PREFIX) || url.startsWith(HTTPS_PREFIX) || url.startsWith(FILE_PREFIX);
+ return isNetworkURL(url) || url.startsWith(FILE_PREFIX);
}
/**
+ * @param url
+ * @return
+ * @since 2.4.2
+ */
+ public static boolean isNetworkURL(String url)
+ {
+ if (url == null || url.length() == 0)
+ {
+ return false;
+ }
+
+ return url.startsWith(HTTP_PREFIX) || url.startsWith(HTTPS_PREFIX) || url.startsWith(FTP_PREFIX);
+ }
+
+ /**
* Enforces that the given URL is absolute
*
* @param url the String representation of the URL to be checked
@@ -97,28 +112,89 @@
return address != null && Pattern.matches(RE_EMAIL_VALIDATION, address);
}
- public static boolean exists(java.net.URL url)
+ /**
+ * Determines that the specified URL corresponds to an existing resource by trying to open a stream from it. Same as
+ * <code>exists(url, 1000)</code>
+ *
+ * @param url
+ * @return
+ */
+ public static boolean exists(URL url)
{
- if (url == null)
- {
- throw new IllegalArgumentException("No null urls allowed");
- }
- InputStream in = null;
+ ParameterValidation.throwIllegalArgExceptionIfNull(url, "URL");
+
+ return exists(url, 1000);
+ }
+
+ /**
+ * Determines if the specified URL corresponds to an existing resource by trying to open a stream from it. The
+ * connection attempt is made from a different thread on which we wait for the specified amount of time before timing
+ * out.
+ *
+ * @param url the URL to be tested
+ * @param waitForMillis the number of milliseconds to wait before timing out, 0 meaning never timing out.
+ * @return
+ * @since 2.4.2
+ */
+ public static boolean exists(URL url, long waitForMillis)
+ {
+ URLStreamOpeningThread thread = new URLStreamOpeningThread(url);
+ thread.start();
+
try
{
- in = url.openStream();
- return true;
+ // Wait for the thread to finish but don't wait longer than the specified time
+ thread.join(waitForMillis);
+
+ if (thread.isAlive())
+ {
+ // Timeout occurred; thread has not finished
+ throw new RuntimeException("Couldn't connect to " + url + " within " + waitForMillis / 1000
+ + " seconds. Check your connection parameters or the URL.");
+ }
+ else
+ {
+ // Finished
+ return thread.isConnected() && !thread.isError();
+ }
}
- catch (IOException e)
+ catch (InterruptedException e)
{
- return false;
+ // Thread was interrupted
+ throw new RuntimeException("Connection thread to " + url + " was interrupted!", e);
}
finally
{
- Tools.safeClose(in);
+ Tools.safeClose(thread.getInputStream());
}
}
+ /**
+ * @param urlAsString
+ * @param allowNull <code>true</code> if passing <code>null</code> will be ignored and just return
+ * <code>false</code>, <code>false</code> to throw an {@link IllegalArgumentException} is the
+ * given URL is <code>null</code>.
+ * @return
+ * @since 2.4.2
+ */
+ public static boolean exists(String urlAsString, boolean allowNull)
+ {
+ if (!allowNull)
+ {
+ ParameterValidation.throwIllegalArgExceptionIfNullOrEmpty(urlAsString, "URL", null);
+ }
+
+ try
+ {
+ URL url = new URL(urlAsString);
+ return exists(url);
+ }
+ catch (MalformedURLException e)
+ {
+ return false;
+ }
+ }
+
public static URLMatch[] extractURLsFrom(String markup)
{
// todo: will need to re-write without regex after 2.4
@@ -232,4 +308,55 @@
{
public abstract String getReplacementFor(int currentIndex, URLMatch currentMatch);
}
+
+ /** @since 2.4.2 */
+ public static class PortReplacementGenerator extends URLReplacementGenerator
+ {
+ private int replacementPort;
+
+ public PortReplacementGenerator(int replacementPort)
+ {
+ this.replacementPort = replacementPort;
+ }
+
+ public String getReplacementFor(int currentIndex, URLMatch currentMatch)
+ {
+ return replaceServerPortInURL(currentMatch.getURLAsString(), replacementPort);
+ }
+ }
+
+ /**
+ * @param url
+ * @param newPort
+ * @return
+ * @since 2.4.2
+ */
+ public static String replaceServerPortInURL(String url, int newPort)
+ {
+ if (!isNetworkURL(url))
+ {
+ return url;
+ }
+
+ StringBuffer buf = new StringBuffer(url);
+ int afterProtocol = url.indexOf("://") + 3;
+ int beforePort = url.indexOf(':', afterProtocol);
+ int afterPort;
+
+ if (beforePort != -1)
+ {
+ afterPort = url.indexOf('/', beforePort);
+ buf.delete(beforePort + 1, afterPort);
+ buf.insert(beforePort + 1, newPort);
+ }
+ else
+ {
+ // port number was not present
+ afterPort = url.indexOf('/', afterProtocol);
+ buf.insert(afterPort, ":" + newPort);
+ }
+
+ return buf.toString();
+ }
+
}
17 years, 4 months
JBoss Portal SVN: r6558 - in trunk: wsrp/src/main/org/jboss/portal/wsrp/services and 1 other directory.
by portal-commits@lists.jboss.org
Author: chris.laprun(a)jboss.com
Date: 2007-03-06 14:01:39 -0500 (Tue, 06 Mar 2007)
New Revision: 6558
Added:
trunk/common/src/main/org/jboss/portal/common/util/URLStreamOpeningThread.java
Modified:
trunk/common/src/main/org/jboss/portal/common/util/URLTools.java
trunk/wsrp/src/main/org/jboss/portal/wsrp/services/RemoteSOAPInvokerServiceFactory.java
Log:
JBPORTAL-1279:
- Extracted URLStreamOpeningThread to its own class and moved it to common.
- URLTools.exists uses URLStreamOpeningThread with a default timeout of 1s.
- URLTools.exists(URL, long) to control timeout.
Added: trunk/common/src/main/org/jboss/portal/common/util/URLStreamOpeningThread.java
===================================================================
--- trunk/common/src/main/org/jboss/portal/common/util/URLStreamOpeningThread.java (rev 0)
+++ trunk/common/src/main/org/jboss/portal/common/util/URLStreamOpeningThread.java 2007-03-06 19:01:39 UTC (rev 6558)
@@ -0,0 +1,90 @@
+/*
+* 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;
+
+/**
+ * A class that opens an InputStream to a URL in a thread so that it doesn't block normal operations and can be timed
+ * out if needed.
+ *
+ * @author <a href="mailto:chris.laprun@jboss.com">Chris Laprun</a>
+ * @version $Revision$
+ * @since 2.4.2
+ */
+public class URLStreamOpeningThread extends Thread
+{
+ volatile private URL url;
+
+ /** */
+ private InputStream inputStream;
+
+ /** Exception in the event a connection error occurs */
+ private IOException exception = null;
+
+ public URLStreamOpeningThread(URL url)
+ {
+ ParameterValidation.throwIllegalArgExceptionIfNull(url, "URL");
+
+ this.url = url;
+ }
+
+ public void run()
+ {
+ try
+ {
+ inputStream = url.openStream();
+ if (inputStream == null)
+ {
+ throw new IllegalArgumentException("Cannot open stream from [" + url + "]");
+ }
+ }
+ catch (IOException e)
+ {
+ exception = e;
+ }
+ }
+
+ public boolean isConnected()
+ {
+ return inputStream != null;
+ }
+
+ public boolean isError()
+ {
+ return exception != null;
+ }
+
+ public InputStream getInputStream()
+ {
+ return inputStream;
+ }
+
+ public IOException getException()
+ {
+ return exception;
+ }
+}
Property changes on: trunk/common/src/main/org/jboss/portal/common/util/URLStreamOpeningThread.java
___________________________________________________________________
Name: svn:keywords
+ Author Date Id Revision
Name: svn:eol-style
+ native
Modified: trunk/common/src/main/org/jboss/portal/common/util/URLTools.java
===================================================================
--- trunk/common/src/main/org/jboss/portal/common/util/URLTools.java 2007-03-06 18:15:10 UTC (rev 6557)
+++ trunk/common/src/main/org/jboss/portal/common/util/URLTools.java 2007-03-06 19:01:39 UTC (rev 6558)
@@ -22,8 +22,6 @@
******************************************************************************/
package org.jboss.portal.common.util;
-import java.io.IOException;
-import java.io.InputStream;
import java.io.UnsupportedEncodingException;
import java.net.MalformedURLException;
import java.net.URL;
@@ -110,9 +108,8 @@
}
/**
- * Determines that the specified URL corresponds to an existing resource by trying to open a stream from it. NOTE:
- * This is a potentially blocking method since by default there is no timeout on the connection... See
- * http://jira.jboss.com/jira/browse/JBPORTAL-1279
+ * Determines that the specified URL corresponds to an existing resource by trying to open a stream from it. Same as
+ * <code>exists(url, 1000)</code>
*
* @param url
* @return
@@ -121,19 +118,49 @@
{
ParameterValidation.throwIllegalArgExceptionIfNull(url, "URL");
- InputStream in = null;
+ return exists(url, 1000);
+ }
+
+ /**
+ * Determines if the specified URL corresponds to an existing resource by trying to open a stream from it. The
+ * connection attempt is made from a different thread on which we wait for the specified amount of time before timing
+ * out.
+ *
+ * @param url the URL to be tested
+ * @param waitForMillis the number of milliseconds to wait before timing out, 0 meaning never timing out.
+ * @return
+ * @since 2.4.2
+ */
+ public static boolean exists(URL url, long waitForMillis)
+ {
+ URLStreamOpeningThread thread = new URLStreamOpeningThread(url);
+ thread.start();
+
try
{
- in = url.openStream();
- return true;
+ // Wait for the thread to finish but don't wait longer than the specified time
+ thread.join(waitForMillis);
+
+ if (thread.isAlive())
+ {
+ // Timeout occurred; thread has not finished
+ throw new RuntimeException("Couldn't connect to " + url + " within " + waitForMillis / 1000
+ + " seconds. Check your connection parameters or the URL.");
+ }
+ else
+ {
+ // Finished
+ return thread.isConnected() && !thread.isError();
+ }
}
- catch (IOException e)
+ catch (InterruptedException e)
{
- return false;
+ // Thread was interrupted
+ throw new RuntimeException("Connection thread to " + url + " was interrupted!", e);
}
finally
{
- Tools.safeClose(in);
+ Tools.safeClose(thread.getInputStream());
}
}
@@ -143,7 +170,7 @@
* <code>false</code>, <code>false</code> to throw an {@link IllegalArgumentException} is the
* given URL is <code>null</code>.
* @return
- * @since 2.6
+ * @since 2.4.2
*/
public static boolean exists(String urlAsString, boolean allowNull)
{
@@ -155,7 +182,7 @@
try
{
URL url = new URL(urlAsString);
- return exists(url);
+ return exists((URL)url);
}
catch (MalformedURLException e)
{
Modified: trunk/wsrp/src/main/org/jboss/portal/wsrp/services/RemoteSOAPInvokerServiceFactory.java
===================================================================
--- trunk/wsrp/src/main/org/jboss/portal/wsrp/services/RemoteSOAPInvokerServiceFactory.java 2007-03-06 18:15:10 UTC (rev 6557)
+++ trunk/wsrp/src/main/org/jboss/portal/wsrp/services/RemoteSOAPInvokerServiceFactory.java 2007-03-06 19:01:39 UTC (rev 6558)
@@ -26,6 +26,7 @@
import org.jboss.logging.Logger;
import org.jboss.portal.common.util.ParameterValidation;
import org.jboss.portal.common.util.Tools;
+import org.jboss.portal.common.util.URLStreamOpeningThread;
import org.xml.sax.InputSource;
import javax.wsdl.Definition;
@@ -184,60 +185,6 @@
}
- static class URLStreamOpeningThread extends Thread
- {
- volatile private URL url;
-
- /** */
- private InputStream inputStream;
-
- /** Exception in the event a connection error occurs */
- private IOException exception = null;
-
- public URLStreamOpeningThread(URL url)
- {
- ParameterValidation.throwIllegalArgExceptionIfNull(url, "URL");
-
- this.url = url;
- }
-
- public void run()
- {
- try
- {
- inputStream = url.openStream();
- if (inputStream == null)
- {
- throw new IllegalArgumentException("Cannot open stream from [" + url + "]");
- }
- }
- catch (IOException e)
- {
- exception = e;
- }
- }
-
- public boolean isConnected()
- {
- return inputStream != null;
- }
-
- public boolean isError()
- {
- return exception != null;
- }
-
- public InputStream getInputStream()
- {
- return inputStream;
- }
-
- public IOException getException()
- {
- return exception;
- }
- }
-
/** A WSDLLocator that can handle wsdl imports */
public static class WSDLLocatorImpl implements WSDLLocator
{
@@ -268,7 +215,8 @@
if (thread.isAlive())
{
// Timeout occurred; thread has not finished
- // todo: do we need clean up here?
+ // todo: do we need more clean up here?
+ Tools.safeClose(thread.getInputStream());
throw new RuntimeException("Couldn't connect to " + wsdlURL + " within " + delayMillis / 1000
+ " seconds. Check your connection parameters or the URL.");
}
17 years, 4 months
JBoss Portal SVN: r6557 - in trunk/wsrp/src/main/org/jboss/portal/wsrp: deployment and 1 other directories.
by portal-commits@lists.jboss.org
Author: chris.laprun(a)jboss.com
Date: 2007-03-06 13:15:10 -0500 (Tue, 06 Mar 2007)
New Revision: 6557
Modified:
trunk/wsrp/src/main/org/jboss/portal/wsrp/consumer/ConsumerRegistry.java
trunk/wsrp/src/main/org/jboss/portal/wsrp/consumer/ConsumerRegistryService.java
trunk/wsrp/src/main/org/jboss/portal/wsrp/consumer/ProducerInfo.java
trunk/wsrp/src/main/org/jboss/portal/wsrp/consumer/WSRPConsumerImpl.java
trunk/wsrp/src/main/org/jboss/portal/wsrp/deployment/WSRPDeploymentFactory.java
trunk/wsrp/src/main/org/jboss/portal/wsrp/services/RemoteSOAPInvokerServiceFactory.java
Log:
- Better management of consumer activation.
- ConsumerRegistry.activateConsumerWith now only activates the consumer if the associated ServiceFactory is available.
- Properly set the registry on ProducerInfo after being loaded from DB.
- JBPORTAL-1279: clean up and prepare for extraction of URLStreamOpeningThread to common to be used in URLTools.exists as well.
Modified: trunk/wsrp/src/main/org/jboss/portal/wsrp/consumer/ConsumerRegistry.java
===================================================================
--- trunk/wsrp/src/main/org/jboss/portal/wsrp/consumer/ConsumerRegistry.java 2007-03-06 17:04:55 UTC (rev 6556)
+++ trunk/wsrp/src/main/org/jboss/portal/wsrp/consumer/ConsumerRegistry.java 2007-03-06 18:15:10 UTC (rev 6557)
@@ -44,6 +44,13 @@
void persistConsumer(WSRPConsumer consumer);
+ /**
+ * Activates the consumer associated with the specified identifier if and only if access to the remote producer is
+ * properly setup (i.e. the associated service factory MUST be available).
+ *
+ * @param id the identifier of the consumer to be activated
+ * @throws ConsumerException
+ */
void activateConsumerWith(String id) throws ConsumerException;
void updateProducerInfo(ProducerInfo producerInfo);
Modified: trunk/wsrp/src/main/org/jboss/portal/wsrp/consumer/ConsumerRegistryService.java
===================================================================
--- trunk/wsrp/src/main/org/jboss/portal/wsrp/consumer/ConsumerRegistryService.java 2007-03-06 17:04:55 UTC (rev 6556)
+++ trunk/wsrp/src/main/org/jboss/portal/wsrp/consumer/ConsumerRegistryService.java 2007-03-06 18:15:10 UTC (rev 6557)
@@ -130,6 +130,10 @@
while (producerInfos.hasNext())
{
producerInfo = (ProducerInfo)producerInfos.next();
+
+ // need to set the registry after loading from DB since registry is not persisted.
+ producerInfo.setRegistry(this);
+
createConsumerFrom(producerInfo);
activateConsumerWith(producerInfo.getId());
}
@@ -177,12 +181,8 @@
throw new ConsumerException("Couldn't start Consumer service '" + id + "'", e);
}
- // mark the consumer as active
- ProducerInfo info = consumer.getProducerInfo();
- info.setActive(true);
-
// update ProducerInfo
- updateProducerInfo(info);
+ updateProducerInfo(service.getConsumer().getProducerInfo());
}
}
Modified: trunk/wsrp/src/main/org/jboss/portal/wsrp/consumer/ProducerInfo.java
===================================================================
--- trunk/wsrp/src/main/org/jboss/portal/wsrp/consumer/ProducerInfo.java 2007-03-06 17:04:55 UTC (rev 6556)
+++ trunk/wsrp/src/main/org/jboss/portal/wsrp/consumer/ProducerInfo.java 2007-03-06 18:15:10 UTC (rev 6557)
@@ -204,6 +204,11 @@
// update DB
if (justRefreshed)
{
+ if (!isActive())
+ {
+ setActive(true);
+ }
+
registry.updateProducerInfo(this);
}
@@ -247,6 +252,7 @@
if (registrationContext == null)
{
+ setActive(false);
throw new PortletInvokerException("Received null response after registration from producer '" + persistentId + "'");
}
@@ -256,6 +262,7 @@
catch (Exception e)
{
persistentRegistrationInfo.resetRegistration();
+ setActive(false);
throw new PortletInvokerException("Couldn't register with producer '" + persistentId + "'", e);
}
@@ -266,6 +273,7 @@
else
{
log.info("Consumer is not ready to be registered with producer because of missing or invalid registration information.");
+ setActive(false);
throw new PortletInvokerException("Consumer is not ready to be registered with producer because of missing or invalid registration information.");
}
}
@@ -503,6 +511,11 @@
catch (Exception e)
{
log.debug("Caught Exception in getServiceDescription:\n", e);
+
+ // de-activate
+ setActive(false);
+ registry.updateProducerInfo(this);
+
Throwable cause = e.getCause();
throw new InvokerUnavailableException("Problem getting service description for producer "
+ persistentId, cause == null ? e : cause);
Modified: trunk/wsrp/src/main/org/jboss/portal/wsrp/consumer/WSRPConsumerImpl.java
===================================================================
--- trunk/wsrp/src/main/org/jboss/portal/wsrp/consumer/WSRPConsumerImpl.java 2007-03-06 17:04:55 UTC (rev 6556)
+++ trunk/wsrp/src/main/org/jboss/portal/wsrp/consumer/WSRPConsumerImpl.java 2007-03-06 18:15:10 UTC (rev 6557)
@@ -457,11 +457,14 @@
protected void startService() throws Exception
{
super.startService();
- getServiceFactory().start();
+ ServiceFactory factory = getServiceFactory();
+ factory.start();
+ producerInfo.setActive(factory.isAvailable());
}
protected void stopService() throws Exception
{
+ producerInfo.setActive(false);
getServiceFactory().stop();
super.stopService();
}
Modified: trunk/wsrp/src/main/org/jboss/portal/wsrp/deployment/WSRPDeploymentFactory.java
===================================================================
--- trunk/wsrp/src/main/org/jboss/portal/wsrp/deployment/WSRPDeploymentFactory.java 2007-03-06 17:04:55 UTC (rev 6556)
+++ trunk/wsrp/src/main/org/jboss/portal/wsrp/deployment/WSRPDeploymentFactory.java 2007-03-06 18:15:10 UTC (rev 6557)
@@ -272,6 +272,8 @@
}
+ ProducerInfo info = service.getConsumer().getProducerInfo();
+
String message;
if (service.getConsumer().getServiceFactory().isAvailable())
{
@@ -282,10 +284,11 @@
{
message = "There was a problem initializing the WSRP interface for producer '"
+ service.getId() + "'. The consumer will NOT be available.";
+ info.setActive(false);
}
// update the producer info once the whole information is known
- consumerRegistry.updateProducerInfo(service.getConsumer().getProducerInfo());
+ consumerRegistry.updateProducerInfo(info);
log.info(message);
}
Modified: trunk/wsrp/src/main/org/jboss/portal/wsrp/services/RemoteSOAPInvokerServiceFactory.java
===================================================================
--- trunk/wsrp/src/main/org/jboss/portal/wsrp/services/RemoteSOAPInvokerServiceFactory.java 2007-03-06 17:04:55 UTC (rev 6556)
+++ trunk/wsrp/src/main/org/jboss/portal/wsrp/services/RemoteSOAPInvokerServiceFactory.java 2007-03-06 18:15:10 UTC (rev 6557)
@@ -184,32 +184,32 @@
}
- static class URLThread extends Thread
+ static class URLStreamOpeningThread extends Thread
{
volatile private URL url;
- private InputSource inputSource;
+
+ /** */
+ private InputStream inputStream;
+
/** Exception in the event a connection error occurs */
private IOException exception = null;
- // Connect to the specified host and port number
- public URLThread(URL wsdlFile)
+ public URLStreamOpeningThread(URL url)
{
- ParameterValidation.throwIllegalArgExceptionIfNull(wsdlFile, "WSDL URL");
+ ParameterValidation.throwIllegalArgExceptionIfNull(url, "URL");
- this.url = wsdlFile;
+ this.url = url;
}
public void run()
{
try
{
- InputStream is = Tools.safeBufferedWrapper(url.openStream());
- if (is == null)
+ inputStream = url.openStream();
+ if (inputStream == null)
{
- throw new IllegalArgumentException("Cannot obtain wsdl from [" + url + "]");
+ throw new IllegalArgumentException("Cannot open stream from [" + url + "]");
}
-
- inputSource = new InputSource(is);
}
catch (IOException e)
{
@@ -219,32 +219,17 @@
public boolean isConnected()
{
- if (inputSource == null)
- {
- return false;
- }
- else
- {
- return true;
- }
+ return inputStream != null;
}
public boolean isError()
{
- if (exception == null)
- {
- return false;
- }
- else
- {
- return true;
- }
+ return exception != null;
}
-
- public InputSource getInputSource()
+ public InputStream getInputStream()
{
- return inputSource;
+ return inputStream;
}
public IOException getException()
@@ -271,11 +256,10 @@
{
log.info("getBaseInputSource [wsdlUrl=" + wsdlURL + "]");
- URLThread thread = new URLThread(wsdlURL);
+ URLStreamOpeningThread thread = new URLStreamOpeningThread(wsdlURL);
thread.start();
- // Wait for the thread to finish but don't wait longer than a
- // specified time
+ // Wait for the thread to finish but don't wait longer than the specified time
long delayMillis = 1000;
try
{
@@ -293,7 +277,8 @@
// Finished
if (thread.isConnected() && !thread.isError())
{
- return thread.getInputSource();
+ InputStream is = Tools.safeBufferedWrapper(thread.getInputStream());
+ return new InputSource(is);
}
else
{
@@ -307,38 +292,6 @@
// Thread was interrupted
throw new RuntimeException("Parsing thread was interrupted!", e);
}
-
- /*// use 1 second time outs and remember previous values
- String connectTimeOut = System.setProperty("sun.net.client.defaultConnectTimeout", "1000");
- String readTimeOut = System.setProperty("sun.net.client.defaultReadTimeout", "1000");
-
- try
- {
- InputStream is = Tools.safeBufferedWrapper(wsdlURL.openStream());
- if (is == null)
- {
- throw new IllegalArgumentException("Cannot obtain wsdl from [" + wsdlURL + "]");
- }
-
- return new InputSource(is);
- }
- catch (IOException e)
- {
- throw new RuntimeException("Cannot access wsdl from [" + wsdlURL + "], " + e.getMessage());
- }
- finally
- {
- // restore time outs
- if (connectTimeOut != null)
- {
- System.setProperty("sun.net.client.defaultConnectTimeout", connectTimeOut);
- }
-
- if (readTimeOut != null)
- {
- System.setProperty("sun.net.client.defaultReadTimeout", readTimeOut);
- }
- }*/
}
public String getBaseURI()
17 years, 4 months
JBoss Portal SVN: r6556 - in trunk/core-cms/src: resources/portal-cms-war/WEB-INF and 2 other directories.
by portal-commits@lists.jboss.org
Author: thomas.heute(a)jboss.com
Date: 2007-03-06 12:04:55 -0500 (Tue, 06 Mar 2007)
New Revision: 6556
Added:
trunk/core-cms/src/main/org/jboss/portal/core/cms/ui/admin/CMSContentEditorPortlet.java
trunk/core-cms/src/main/org/jboss/portal/core/cms/ui/admin/CMSEditorConstants.java
trunk/core-cms/src/resources/portal-cms-war/WEB-INF/jsp/cms/editor/
trunk/core-cms/src/resources/portal-cms-war/WEB-INF/jsp/cms/editor/main.jsp
Modified:
trunk/core-cms/src/resources/portal-cms-war/WEB-INF/portlet-instances.xml
trunk/core-cms/src/resources/portal-cms-war/WEB-INF/portlet.xml
Log:
CMS Content Editor
Added: trunk/core-cms/src/main/org/jboss/portal/core/cms/ui/admin/CMSContentEditorPortlet.java
===================================================================
--- trunk/core-cms/src/main/org/jboss/portal/core/cms/ui/admin/CMSContentEditorPortlet.java (rev 0)
+++ trunk/core-cms/src/main/org/jboss/portal/core/cms/ui/admin/CMSContentEditorPortlet.java 2007-03-06 17:04:55 UTC (rev 6556)
@@ -0,0 +1,99 @@
+/******************************************************************************
+ * 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.core.cms.ui.admin;
+
+import java.io.IOException;
+import java.util.List;
+
+import javax.portlet.ActionRequest;
+import javax.portlet.ActionResponse;
+import javax.portlet.GenericPortlet;
+import javax.portlet.PortletException;
+import javax.portlet.PortletSecurityException;
+import javax.portlet.RenderRequest;
+import javax.portlet.RenderResponse;
+
+import org.jboss.portal.cms.CMS;
+import org.jboss.portal.cms.Command;
+import org.jboss.portal.cms.model.Folder;
+import org.jboss.portal.core.admin.ui.content.ContentEditors;
+import org.jboss.portal.core.model.content.ContentType;
+
+/**
+ * @author <a href="mailto:theute@jboss.org">Thomas Heute</a>
+ * @version $Revision$
+ */
+public class CMSContentEditorPortlet extends GenericPortlet
+{
+
+ private CMS cmsService;
+
+
+ public void init() throws PortletException
+ {
+ cmsService = (CMS)getPortletContext().getAttribute("CMS");
+ ContentEditors.getInstance().registerEditor(ContentType.CMS, "CMSContentEditorInstance");
+ }
+
+ public void processAction(ActionRequest req, ActionResponse resp) throws PortletException, PortletSecurityException, IOException
+ {
+ String uri = req.getParameter("uri");
+ String path = req.getParameter("path");
+ if (uri != null)
+ {
+ resp.setRenderParameter("uri", uri);
+ }
+ if (path != null)
+ {
+ resp.setRenderParameter("path", path);
+ }
+ }
+
+ public void render(RenderRequest req, RenderResponse resp) throws PortletException, PortletSecurityException, IOException
+ {
+ resp.setContentType("text/html");
+
+ String sPath = req.getParameter("path");
+ if (sPath == null)
+ {
+ sPath = "/";
+ }
+
+ Command listCMD = cmsService.getCommandFactory().createFolderGetListCommand(sPath);
+ Folder mainFolder = (Folder)cmsService.execute(listCMD);
+ List folders = mainFolder.getFolders();
+ List files = mainFolder.getFiles();
+
+ resp.setContentType("text/html");
+ req.setAttribute("folders", folders);
+ req.setAttribute("files", files);
+ req.setAttribute("currpath", sPath);
+
+
+ javax.portlet.PortletRequestDispatcher prd = getPortletContext().getRequestDispatcher(CMSEditorConstants.CMS_EDITOR_JSP_PATH + "/main.jsp");
+ prd.include(req, resp);
+
+ }
+
+
+}
Added: trunk/core-cms/src/main/org/jboss/portal/core/cms/ui/admin/CMSEditorConstants.java
===================================================================
--- trunk/core-cms/src/main/org/jboss/portal/core/cms/ui/admin/CMSEditorConstants.java (rev 0)
+++ trunk/core-cms/src/main/org/jboss/portal/core/cms/ui/admin/CMSEditorConstants.java 2007-03-06 17:04:55 UTC (rev 6556)
@@ -0,0 +1,34 @@
+/******************************************************************************
+ * 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.core.cms.ui.admin;
+
+/**
+ * @author <a href="mailto:theute@jboss.org">Thomas Heute</a>
+ * @version $Revision$
+ */
+public class CMSEditorConstants
+{
+ /** Our path to jsp pages * */
+ public static final String CMS_EDITOR_JSP_PATH = "/WEB-INF/jsp/cms/editor";
+
+}
Added: trunk/core-cms/src/resources/portal-cms-war/WEB-INF/jsp/cms/editor/main.jsp
===================================================================
--- trunk/core-cms/src/resources/portal-cms-war/WEB-INF/jsp/cms/editor/main.jsp (rev 0)
+++ trunk/core-cms/src/resources/portal-cms-war/WEB-INF/jsp/cms/editor/main.jsp 2007-03-06 17:04:55 UTC (rev 6556)
@@ -0,0 +1,127 @@
+<%@ page import="org.jboss.portal.cms.model.File" %>
+<%@ page import="org.jboss.portal.cms.model.Folder" %>
+<%@ page import="org.jboss.portal.core.cms.ui.admin.CMSAdminConstants" %>
+<%@ page import="java.text.Format" %>
+<%@ page import="java.text.SimpleDateFormat" %>
+<%@ page import="java.util.List" %>
+<%@ page import="java.util.StringTokenizer" %>
+<%@ page language="java" extends="org.jboss.portal.core.servlet.jsp.PortalJsp" %>
+<%@ taglib uri="/WEB-INF/portal-lib.tld" prefix="n" %>
+<%@ taglib uri="http://java.sun.com/portlet" prefix="portlet" %>
+<%@ page isELIgnored="false" %>
+
+<portlet:defineObjects/>
+
+<%
+ String sCurrPath = (String)request.getAttribute("currpath");
+ List folders = (List)request.getAttribute("folders");
+ List files = (List)request.getAttribute("files");
+ String uri = (String)renderRequest.getParameter("uri");
+%>
+
+<!-- Currently browsing -->
+Browsing: <a href="<portlet:renderURL>
+<portlet:param name="op" value="<%= CMSAdminConstants.OP_MAIN %>"/>
+<portlet:param name="path" value="/"/>
+ </portlet:renderURL>">Home</a>
+<%
+ StringTokenizer parser = new StringTokenizer(sCurrPath, "/");
+ String sPathBuilder = "";
+ while (parser.hasMoreTokens())
+ {
+ String sPathChunk = parser.nextToken();
+ sPathBuilder += "/" + sPathChunk;
+ if (parser.hasMoreTokens())
+ {
+%>
+> <a href="
+<portlet:renderURL>
+ <portlet:param name="op" value="<%= CMSAdminConstants.OP_MAIN %>"/>
+ <portlet:param name="path" value="<%= sPathBuilder %>"/>
+</portlet:renderURL>
+"><%= sPathChunk %>
+</a>
+<%
+}
+else
+{
+%>
+> <%= sPathChunk %>
+<%
+ }
+ }
+%>
+
+<br/><br/>
+
+<%
+
+ if (folders.size() > 0 || files.size() > 0)
+ {
+
+%>
+
+<table width="100%" border="0" cellspacing="2" cellpadding="2">
+<tr>
+ <td class="portlet-section-header">${n:i18n("CMS_NAME")}</td>
+</tr>
+
+<%
+ if (folders.size() > 0)
+ {
+ for (int i = 0; i < folders.size(); i++)
+ {
+ Folder folder = (Folder)folders.get(i);
+%>
+<tr onmouseover="this.className='portlet-section-alternate';" onmouseout="this.className='portlet-section-body';">
+ <td><img
+ src="<%= renderRequest.getContextPath() + CMSAdminConstants.DEFAULT_IMAGES_PATH%>/folder.gif"
+ alt="${n:i18n("CMS_FOLDER")}"
+ border="0"> <a href="<portlet:renderURL>
+ <portlet:param name="op" value="<%= CMSAdminConstants.OP_MAIN %>"/>
+ <portlet:param name="path" value="<%= folder.getBasePath() %>"/>
+ </portlet:renderURL>"><%=
+ folder.getBasePath().substring(folder.getBasePath().lastIndexOf("/") + 1, folder.getBasePath().length()) %>
+ </a>
+ </td>
+</tr>
+<%
+ }
+ }
+%>
+<%
+ if (files.size() > 0)
+ {
+ for (int j = 0; j < files.size(); j++)
+ {
+ File file = (File)files.get(j);
+
+ if ((uri!=null) && (uri.equals(file.getBasePath())))
+ {
+ out.println("<tr class=\"portlet-section-selected\">");
+ }
+ else
+ {
+ out.println("<tr onmouseover=\"this.className='portlet-section-alternate';\" onmouseout=\"this.className='portlet-section-body';\">");
+ }
+%>
+ <td><img src="<%= renderRequest.getContextPath() + CMSAdminConstants.DEFAULT_IMAGES_PATH%>/file.gif"
+ alt="${n:i18n("CMS_FILE")}"
+ border="0"> <a href="<portlet:actionURL>
+ <portlet:param name="uri" value="<%= file.getBasePath() %>"/>
+ <portlet:param name="path" value="<%= sCurrPath %>"/>
+ </portlet:actionURL>"><%=
+ file.getBasePath().substring(file.getBasePath().lastIndexOf("/") + 1, file.getBasePath().length()) %>
+ </a>
+ </td>
+</tr>
+<%
+ }
+ }
+%>
+</table>
+<%
+
+ }
+
+%>
Property changes on: trunk/core-cms/src/resources/portal-cms-war/WEB-INF/jsp/cms/editor/main.jsp
___________________________________________________________________
Name: svn:executable
+ *
Modified: trunk/core-cms/src/resources/portal-cms-war/WEB-INF/portlet-instances.xml
===================================================================
--- trunk/core-cms/src/resources/portal-cms-war/WEB-INF/portlet-instances.xml 2007-03-06 16:51:17 UTC (rev 6555)
+++ trunk/core-cms/src/resources/portal-cms-war/WEB-INF/portlet-instances.xml 2007-03-06 17:04:55 UTC (rev 6556)
@@ -47,4 +47,10 @@
</instance>
</deployment>
+ <deployment>
+ <instance>
+ <instance-id>CMSContentEditorInstance</instance-id>
+ <portlet-ref>CMSContentEditorPortlet</portlet-ref>
+ </instance>
+ </deployment>
</deployments>
\ No newline at end of file
Modified: trunk/core-cms/src/resources/portal-cms-war/WEB-INF/portlet.xml
===================================================================
--- trunk/core-cms/src/resources/portal-cms-war/WEB-INF/portlet.xml 2007-03-06 16:51:17 UTC (rev 6555)
+++ trunk/core-cms/src/resources/portal-cms-war/WEB-INF/portlet.xml 2007-03-06 17:04:55 UTC (rev 6556)
@@ -68,4 +68,24 @@
<title>CMS Administration</title>
</portlet-info>
</portlet>
+
+ <portlet>
+ <description>CMS Content Editor</description>
+ <portlet-name>CMSContentEditorPortlet</portlet-name>
+ <display-name>CMS Content Editort</display-name>
+
+ <portlet-class>org.jboss.portal.core.cms.ui.admin.CMSContentEditorPortlet</portlet-class>
+ <supports>
+ <mime-type>text/html</mime-type>
+ <portlet-mode>VIEW</portlet-mode>
+ </supports>
+ <supported-locale>en</supported-locale>
+ <supported-locale>fr</supported-locale>
+ <supported-locale>es</supported-locale>
+ <resource-bundle>Resource</resource-bundle>
+ <portlet-info>
+ <title>CMS Content Type</title>
+ </portlet-info>
+ </portlet>
+
</portlet-app>
17 years, 4 months