JBoss Portal SVN: r6044 - in trunk: security/src/main/org/jboss/portal/security/impl and 1 other directory.
by portal-commits@lists.jboss.org
Author: julien(a)jboss.com
Date: 2007-01-18 18:55:48 -0500 (Thu, 18 Jan 2007)
New Revision: 6044
Modified:
trunk/common/src/main/org/jboss/portal/common/util/CopyOnWriteRegistry.java
trunk/security/src/main/org/jboss/portal/security/impl/JBossAuthorizationDomainRegistryImpl.java
Log:
use CopyOnWriteRegistry in JBossAuthorizationDomainRegistryImpl
Modified: trunk/common/src/main/org/jboss/portal/common/util/CopyOnWriteRegistry.java
===================================================================
--- trunk/common/src/main/org/jboss/portal/common/util/CopyOnWriteRegistry.java 2007-01-18 23:53:20 UTC (rev 6043)
+++ trunk/common/src/main/org/jboss/portal/common/util/CopyOnWriteRegistry.java 2007-01-18 23:55:48 UTC (rev 6044)
@@ -26,6 +26,7 @@
import java.util.HashMap;
import java.util.Set;
import java.util.Collections;
+import java.util.Collection;
/**
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
@@ -104,7 +105,17 @@
}
/**
+ * Return the registrations.
*
+ * @return the registrations
+ */
+ public Collection getRegistrations()
+ {
+ return Collections.unmodifiableCollection(content.values());
+ }
+
+ /**
+ *
* @param key the registration key
* @return the registeted object
* @throws IllegalArgumentException if the key is null
Modified: trunk/security/src/main/org/jboss/portal/security/impl/JBossAuthorizationDomainRegistryImpl.java
===================================================================
--- trunk/security/src/main/org/jboss/portal/security/impl/JBossAuthorizationDomainRegistryImpl.java 2007-01-18 23:53:20 UTC (rev 6043)
+++ trunk/security/src/main/org/jboss/portal/security/impl/JBossAuthorizationDomainRegistryImpl.java 2007-01-18 23:55:48 UTC (rev 6044)
@@ -24,6 +24,7 @@
import org.jboss.portal.jems.as.system.AbstractJBossService;
import org.jboss.portal.security.spi.provider.AuthorizationDomain;
+import org.jboss.portal.common.util.CopyOnWriteRegistry;
import java.util.Collection;
import java.util.HashMap;
@@ -40,7 +41,7 @@
{
/** A map of permission types to stores. */
- private Map domains = new HashMap();
+ private CopyOnWriteRegistry domains = new CopyOnWriteRegistry();
public void addDomain(AuthorizationDomain domain)
{
@@ -48,17 +49,8 @@
{
throw new IllegalArgumentException("Authorization Domain is null");
}
- synchronized (this)
- {
- if (domains.containsKey(domain.getType()))
- {
- throw new IllegalArgumentException("Authorization Domain is already registered");
- }
- log.debug("Add authorization domain " + domain.getType());
- Map copy = new HashMap(domains);
- copy.put(domain.getType(), domain);
- domains = copy;
- }
+ log.debug("Add authorization domain " + domain.getType());
+ domains.register(domain.getType(), domain);
}
public void removeDomain(AuthorizationDomain domain)
@@ -67,13 +59,8 @@
{
throw new IllegalArgumentException();
}
- synchronized (this)
- {
- log.debug("Remove authorization domain " + domain.getType());
- Map copy = new HashMap(domains);
- copy.remove(domain.getType());
- domains = copy;
- }
+ log.debug("Remove authorization domain " + domain.getType());
+ domains.unregister(domain.getType());
}
public AuthorizationDomain getDomain(String domainType)
@@ -83,6 +70,6 @@
public Collection getDomains()
{
- return domains.values();
+ return domains.getRegistrations();
}
}
17 years, 5 months
JBoss Portal SVN: r6043 - trunk/core/src/main/org/jboss/portal/core/impl/model/portal.
by portal-commits@lists.jboss.org
Author: julien(a)jboss.com
Date: 2007-01-18 18:53:20 -0500 (Thu, 18 Jan 2007)
New Revision: 6043
Modified:
trunk/core/src/main/org/jboss/portal/core/impl/model/portal/AbstractPortalObjectContainer.java
Log:
use CopyOnWriteRegistry in AbstractPortalObjectContainer for the content handler registry
Modified: trunk/core/src/main/org/jboss/portal/core/impl/model/portal/AbstractPortalObjectContainer.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/impl/model/portal/AbstractPortalObjectContainer.java 2007-01-18 23:51:07 UTC (rev 6042)
+++ trunk/core/src/main/org/jboss/portal/core/impl/model/portal/AbstractPortalObjectContainer.java 2007-01-18 23:53:20 UTC (rev 6043)
@@ -40,12 +40,11 @@
import org.jboss.portal.security.spi.provider.PermissionFactory;
import org.jboss.portal.security.spi.provider.PermissionRepository;
import org.jboss.portal.security.spi.provider.SecurityConfigurationException;
+import org.jboss.portal.common.util.CopyOnWriteRegistry;
import java.util.Collection;
import java.util.HashSet;
import java.util.Set;
-import java.util.Map;
-import java.util.HashMap;
/**
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
@@ -62,7 +61,7 @@
private InstanceContainer instanceContainer;
/** . */
- private volatile Map contentHandlerRegistry;
+ private CopyOnWriteRegistry contentHandlerRegistry;
public InstanceContainer getInstanceContainer()
{
@@ -72,31 +71,12 @@
public void setInstanceContainer(InstanceContainer instanceContainer)
{
this.instanceContainer = instanceContainer;
- this.contentHandlerRegistry = new HashMap();
+ this.contentHandlerRegistry = new CopyOnWriteRegistry();
}
public void registerHandler(ContentType contentType, ContentHandler handler) throws IllegalArgumentException
{
- if (contentType == null)
- {
- throw new IllegalArgumentException();
- }
- if (handler == null)
- {
- throw new IllegalArgumentException();
- }
- synchronized(this)
- {
- if (contentHandlerRegistry.containsKey(contentType))
- {
- throw new IllegalArgumentException("Content type " + contentType + " is already registered");
- }
-
- //
- Map tmp = new HashMap(contentHandlerRegistry);
- tmp.put(contentType, handler);
- contentHandlerRegistry = tmp;
- }
+ contentHandlerRegistry.register(contentType, handler);
}
public ContentHandler getHandler(ContentType contentType)
@@ -106,22 +86,7 @@
public void unregisterHandler(ContentType contentType)
{
- if (contentType == null)
- {
- throw new IllegalArgumentException();
- }
- synchronized(this)
- {
- if (contentHandlerRegistry.containsKey(contentType) == false)
- {
- throw new IllegalArgumentException("Content type " + contentType + " is not registered");
- }
-
- //
- Map tmp = new HashMap(contentHandlerRegistry);
- tmp.remove(contentType);
- contentHandlerRegistry = tmp;
- }
+ contentHandlerRegistry.unregister(contentType);
}
public PortalObject getRootObject()
17 years, 5 months
JBoss Portal SVN: r6042 - trunk/identity/src/main/org/jboss/portal/identity.
by portal-commits@lists.jboss.org
Author: julien(a)jboss.com
Date: 2007-01-18 18:51:07 -0500 (Thu, 18 Jan 2007)
New Revision: 6042
Modified:
trunk/identity/src/main/org/jboss/portal/identity/IdentityContextImpl.java
Log:
use CopyOnWriteRegistry in IdentityContextImpl
Modified: trunk/identity/src/main/org/jboss/portal/identity/IdentityContextImpl.java
===================================================================
--- trunk/identity/src/main/org/jboss/portal/identity/IdentityContextImpl.java 2007-01-18 23:48:10 UTC (rev 6041)
+++ trunk/identity/src/main/org/jboss/portal/identity/IdentityContextImpl.java 2007-01-18 23:51:07 UTC (rev 6042)
@@ -22,12 +22,8 @@
package org.jboss.portal.identity;
import org.jboss.portal.jems.as.system.AbstractJBossService;
-import org.jboss.portal.identity.IdentityException;
-import org.jboss.portal.identity.IdentityContext;
+import org.jboss.portal.common.util.CopyOnWriteRegistry;
-import java.util.Map;
-import java.util.HashMap;
-
/**
* Keeps references to all identity related modules to enable them interactions
*
@@ -37,61 +33,27 @@
public class IdentityContextImpl extends AbstractJBossService implements IdentityContext {
//private static final org.jboss.logging.Logger log = org.jboss.logging.Logger.getLogger(IdentityContextImpl.class);
- private volatile Map registry;
+ private final CopyOnWriteRegistry registry;
public IdentityContextImpl()
{
- registry = new HashMap();
+ registry = new CopyOnWriteRegistry();
}
public void register(Object object, String name) throws IdentityException
{
- if (object == null)
- {
- throw new IllegalArgumentException("Cannot register null reference");
- }
- if (name == null)
- {
- throw new IllegalArgumentException("Cannot register object with null name");
- }
-
- synchronized(this)
- {
- if (registry.containsKey(name))
- {
- throw new IdentityException("Name: " + name + " already registered.");
- }
- if (log.isDebugEnabled()) log.debug("registering object: " + name + " ; " + object.getClass());
- Map tmp = new HashMap(registry);
- tmp.put(name, object);
- registry = tmp;
- }
+ registry.register(object, name);
+ if (log.isDebugEnabled()) log.debug("registering object: " + name + " ; " + object.getClass());
}
public void unregister(String name)
{
- if (name == null)
- {
- throw new IllegalArgumentException("Name cannot be null");
- }
- synchronized(this)
- {
- if(registry.containsKey(name))
- {
- if (log.isDebugEnabled()) log.debug("unregistering object: " + name);
- Map tmp = new HashMap(registry);
- tmp.remove(name);
- registry = tmp;
- }
- }
+ registry.unregister(name);
+ if (log.isDebugEnabled()) log.debug("unregistering object: " + name);
}
public Object getObject(String name) throws IdentityException
{
- if (name == null)
- {
- throw new IllegalArgumentException("Name cannot be null");
- }
Object o = registry.get(name);
if (o == null)
{
17 years, 5 months
JBoss Portal SVN: r6041 - in trunk: core/src/main/org/jboss/portal/core/portlet/dashboard and 3 other directories.
by portal-commits@lists.jboss.org
Author: julien(a)jboss.com
Date: 2007-01-18 18:48:10 -0500 (Thu, 18 Jan 2007)
New Revision: 6041
Added:
trunk/common/src/main/org/jboss/portal/common/util/CopyOnWriteRegistry.java
trunk/core/src/main/org/jboss/portal/core/portlet/dashboard/AbstractContentEditor.java
trunk/core/src/main/org/jboss/portal/core/portlet/dashboard/ContentEditorRegistry.java
trunk/core/src/main/org/jboss/portal/core/portlet/dashboard/ContentEditorRegistryService.java
Modified:
trunk/core/src/main/org/jboss/portal/core/portlet/dashboard/Configurator.java
trunk/core/src/main/org/jboss/portal/core/portlet/dashboard/PortletContentEditor.java
trunk/core/src/resources/portal-core-sar/META-INF/jboss-service.xml
trunk/core/src/resources/portal-core-war/WEB-INF/jboss-portlet.xml
trunk/core/src/resources/portal-core-war/WEB-INF/jsp/dashboard/editpage.jsp
Log:
- added a CopyOnWriteRegistry as I am tired to always write the same code
- added registry for content editors with editor for portlet content
Added: trunk/common/src/main/org/jboss/portal/common/util/CopyOnWriteRegistry.java
===================================================================
--- trunk/common/src/main/org/jboss/portal/common/util/CopyOnWriteRegistry.java (rev 0)
+++ trunk/common/src/main/org/jboss/portal/common/util/CopyOnWriteRegistry.java 2007-01-18 23:48:10 UTC (rev 6041)
@@ -0,0 +1,120 @@
+/******************************************************************************
+ * 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.util.Map;
+import java.util.HashMap;
+import java.util.Set;
+import java.util.Collections;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public class CopyOnWriteRegistry
+{
+
+ /** . */
+ private volatile Map content;
+
+ public CopyOnWriteRegistry()
+ {
+ content = new HashMap();
+ }
+
+ /**
+ * Register an object.
+ *
+ * @param key the registration key
+ * @param object the registered object
+ * @return true if the registration was made
+ * @throws IllegalArgumentException if the one argument is null
+ */
+ public synchronized boolean register(Object key, Object object) throws IllegalArgumentException
+ {
+ if (key == null)
+ {
+ throw new IllegalArgumentException("No null key accepted");
+ }
+ if (object == null)
+ {
+ throw new IllegalArgumentException("No null value accepted");
+ }
+ if (content.containsKey(key))
+ {
+ return false;
+ }
+ Map tmp = new HashMap(content);
+ tmp.put(key, object);
+ content = tmp;
+ return true;
+ }
+
+ /**
+ * Unregister an object.
+ *
+ * @param key the registration key
+ * @return true if the unregistration was made
+ * @throws IllegalArgumentException if the key is null
+ */
+ public synchronized boolean unregister(Object key) throws IllegalArgumentException
+ {
+ if (key == null)
+ {
+ throw new IllegalArgumentException("No null key accepted");
+ }
+ if (content.containsKey(key))
+ {
+ Map tmp = new HashMap(content);
+ tmp.remove(key);
+ content = tmp;
+ return true;
+ }
+ return false;
+ }
+
+ /**
+ * Return the known keys.
+ *
+ * @return the keys
+ */
+ public Set getKeys()
+ {
+ return Collections.unmodifiableSet(content.keySet());
+ }
+
+ /**
+ *
+ * @param key the registration key
+ * @return the registeted object
+ * @throws IllegalArgumentException if the key is null
+ */
+ public Object get(Object key) throws IllegalArgumentException
+ {
+ if (key == null)
+ {
+ throw new IllegalArgumentException("No null key accepted");
+ }
+ return content.get(key);
+ }
+}
Added: trunk/core/src/main/org/jboss/portal/core/portlet/dashboard/AbstractContentEditor.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/portlet/dashboard/AbstractContentEditor.java (rev 0)
+++ trunk/core/src/main/org/jboss/portal/core/portlet/dashboard/AbstractContentEditor.java 2007-01-18 23:48:10 UTC (rev 6041)
@@ -0,0 +1,74 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.core.portlet.dashboard;
+
+import org.jboss.portal.core.model.content.ContentType;
+import org.jboss.portal.jems.as.system.AbstractJBossService;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public abstract class AbstractContentEditor extends AbstractJBossService implements ContentEditor
+{
+
+ /** . */
+ private String contentType;
+
+ /** . */
+ private ContentType registeredContentType;
+
+ /** . */
+ private ContentEditorRegistry registry;
+
+ public String getContentType()
+ {
+ return contentType;
+ }
+
+ public void setContentType(String contentType)
+ {
+ this.contentType = contentType;
+ }
+
+ public ContentEditorRegistry getRegistry()
+ {
+ return registry;
+ }
+
+ public void setRegistry(ContentEditorRegistry registry)
+ {
+ this.registry = registry;
+ }
+
+ protected void startService() throws Exception
+ {
+ registeredContentType = ContentType.create(contentType);
+ registry.registerEditor(registeredContentType, this);
+ }
+
+ protected void stopService() throws Exception
+ {
+ registry.unregisterEditor(registeredContentType);
+ }
+}
Modified: trunk/core/src/main/org/jboss/portal/core/portlet/dashboard/Configurator.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/portlet/dashboard/Configurator.java 2007-01-18 23:00:28 UTC (rev 6040)
+++ trunk/core/src/main/org/jboss/portal/core/portlet/dashboard/Configurator.java 2007-01-18 23:48:10 UTC (rev 6041)
@@ -22,7 +22,6 @@
package org.jboss.portal.core.portlet.dashboard;
import org.jboss.logging.Logger;
-import org.jboss.portal.core.model.instance.InstanceContainer;
import org.jboss.portal.core.model.portal.Page;
import org.jboss.portal.core.model.portal.PageContainer;
import org.jboss.portal.core.model.portal.Portal;
@@ -30,6 +29,7 @@
import org.jboss.portal.core.model.portal.PortalObjectContainer;
import org.jboss.portal.core.model.portal.PortalObjectId;
import org.jboss.portal.core.model.portal.Window;
+import org.jboss.portal.core.model.content.ContentType;
import org.jboss.portal.theme.LayoutService;
import org.jboss.portal.theme.PortalLayout;
import org.jboss.portal.theme.PortalTheme;
@@ -63,31 +63,25 @@
{
private Logger log = Logger.getLogger(Configurator.class);
- private InstanceContainer instanceContainer;
-
private PortalObjectContainer portalObjectContainer;
private LayoutService layoutService;
private ThemeService themeService;
+ private ContentEditorRegistry contentEditorRegistry;
+
public void init()
throws PortletException
{
super.init();
- instanceContainer = (InstanceContainer)getPortletContext().getAttribute("InstanceContainer");
-
+ //
portalObjectContainer = (PortalObjectContainer)getPortletContext().getAttribute("PortalObjectContainer");
-
layoutService = (LayoutService)getPortletContext().getAttribute("LayoutService");
-
themeService = (ThemeService)getPortletContext().getAttribute("ThemeService");
+ contentEditorRegistry = (ContentEditorRegistry)getPortletContext().getAttribute("ContentEditorRegistry");
- if (instanceContainer == null)
- {
- throw new PortletException("No InstanceContainer found");
- }
if (portalObjectContainer == null)
{
throw new PortletException("No PortalObjectContainer found");
@@ -100,6 +94,10 @@
{
throw new PortletException("No ThemeService found");
}
+ if (contentEditorRegistry == null)
+ {
+ throw new PortletException("No ContentEditorRegistry found");
+ }
}
private PortalObjectId dashboardId = PortalObjectId.parse("/dashboard", PortalObjectId.CANONICAL_FORMAT);
@@ -129,9 +127,6 @@
page = portal.getDefaultPage();
}
- // load insances this user has access to.
- List available_instances = (List)instanceContainer.getDefinitions();
-
resp.setContentType("text/html");
try
{
@@ -186,7 +181,7 @@
PortalTheme currentTheme = themeService.getTheme(themeId, true);
// dispatch
- req.setAttribute("available_instances", available_instances);
+ req.setAttribute("registry", contentEditorRegistry);
req.setAttribute("pages", pages);
req.setAttribute("currentPage", page.getName());
req.setAttribute("layouts", layouts);
@@ -226,7 +221,7 @@
String toRegion = actionRequest.getParameter("toRegion");
AddWindowContext ctx = new AddWindowContext(page, toRegion);
- PortletContentEditor editor = new PortletContentEditor();
+ ContentEditor editor = contentEditorRegistry.getEditor(ContentType.PORTLET);
editor.add(actionRequest, ctx);
actionResponse.setRenderParameter("editPageSelect", editPage);
Added: trunk/core/src/main/org/jboss/portal/core/portlet/dashboard/ContentEditorRegistry.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/portlet/dashboard/ContentEditorRegistry.java (rev 0)
+++ trunk/core/src/main/org/jboss/portal/core/portlet/dashboard/ContentEditorRegistry.java 2007-01-18 23:48:10 UTC (rev 6041)
@@ -0,0 +1,39 @@
+/******************************************************************************
+ * 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.portlet.dashboard;
+
+import org.jboss.portal.core.model.content.ContentType;
+
+import java.util.Set;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public interface ContentEditorRegistry
+{
+ Set getRegisteredContentTypes();
+ void registerEditor(ContentType contentType, ContentEditor editor);
+ void unregisterEditor(ContentType contentType);
+ ContentEditor getEditor(ContentType contentType);
+}
Added: trunk/core/src/main/org/jboss/portal/core/portlet/dashboard/ContentEditorRegistryService.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/portlet/dashboard/ContentEditorRegistryService.java (rev 0)
+++ trunk/core/src/main/org/jboss/portal/core/portlet/dashboard/ContentEditorRegistryService.java 2007-01-18 23:48:10 UTC (rev 6041)
@@ -0,0 +1,65 @@
+/******************************************************************************
+ * 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.portlet.dashboard;
+
+import org.jboss.portal.core.model.content.ContentType;
+import org.jboss.portal.common.util.CopyOnWriteRegistry;
+import org.jboss.portal.jems.as.system.AbstractJBossService;
+
+import java.util.Set;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public class ContentEditorRegistryService extends AbstractJBossService implements ContentEditorRegistry
+{
+
+ /** . */
+ private final CopyOnWriteRegistry registry;
+
+ public ContentEditorRegistryService()
+ {
+ registry = new CopyOnWriteRegistry();
+ }
+
+ public Set getRegisteredContentTypes()
+ {
+ return registry.getKeys();
+ }
+
+ public void registerEditor(ContentType contentType, ContentEditor editor)
+ {
+ registry.register(contentType, editor);
+ }
+
+ public void unregisterEditor(ContentType contentType)
+ {
+ registry.unregister(contentType);
+ }
+
+ public ContentEditor getEditor(ContentType contentType)
+ {
+ return (ContentEditor)registry.get(contentType);
+ }
+}
Modified: trunk/core/src/main/org/jboss/portal/core/portlet/dashboard/PortletContentEditor.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/portlet/dashboard/PortletContentEditor.java 2007-01-18 23:00:28 UTC (rev 6040)
+++ trunk/core/src/main/org/jboss/portal/core/portlet/dashboard/PortletContentEditor.java 2007-01-18 23:48:10 UTC (rev 6041)
@@ -24,6 +24,7 @@
import org.jboss.portal.core.model.content.ContentType;
import org.jboss.portal.core.model.instance.Instance;
+import org.jboss.portal.core.model.instance.InstanceContainer;
import org.jboss.portal.core.impl.model.content.portlet.PortletContent;
import javax.portlet.RenderRequest;
@@ -35,12 +36,26 @@
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
* @version $Revision: 1.1 $
*/
-public class PortletContentEditor implements ContentEditor
+public class PortletContentEditor extends AbstractContentEditor
{
+ /** . */
+ private InstanceContainer instanceContainer;
+
+ public InstanceContainer getInstanceContainer()
+ {
+ return instanceContainer;
+ }
+
+ public void setInstanceContainer(InstanceContainer instanceContainer)
+ {
+ this.instanceContainer = instanceContainer;
+ }
+
public void show(RenderRequest req, PrintWriter writer)
{
- List available_instances = (List)req.getAttribute("available_instances");
+ // load insances this user has access to.
+ List available_instances = (List)instanceContainer.getDefinitions();
writer.println("<select name=\"available_instances\" multiple=\"true\" size=\"20\">\n");
for (int i = 0; i < available_instances.size(); i++)
{
Modified: trunk/core/src/resources/portal-core-sar/META-INF/jboss-service.xml
===================================================================
--- trunk/core/src/resources/portal-core-sar/META-INF/jboss-service.xml 2007-01-18 23:00:28 UTC (rev 6040)
+++ trunk/core/src/resources/portal-core-sar/META-INF/jboss-service.xml 2007-01-18 23:48:10 UTC (rev 6041)
@@ -1099,9 +1099,32 @@
xmbean-dd=""
xmbean-code="org.jboss.portal.jems.as.system.JBossServiceModelMBean">
<xmbean/>
- <depends optional-attribute-name="InterceptedDeployer">jboss.web:service=WebServer</depends>
<depends
+ optional-attribute-name="InterceptedDeployer">jboss.web:service=WebServer</depends>
+ <depends
optional-attribute-name="Deployer"
proxy-type="attribute">portal:deployer=PortalWebApp</depends>
</mbean>
+
+ <mbean
+ code="org.jboss.portal.core.portlet.dashboard.ContentEditorRegistryService"
+ name="portal:registry=ContentEditor"
+ xmbean-dd=""
+ xmbean-code="org.jboss.portal.jems.as.system.JBossServiceModelMBean">
+ <xmbean/>
+ </mbean>
+ <mbean
+ code="org.jboss.portal.core.portlet.dashboard.PortletContentEditor"
+ name="portal:service=ContentEditor,type=portlet"
+ xmbean-dd=""
+ xmbean-code="org.jboss.portal.jems.as.system.JBossServiceModelMBean">
+ <xmbean/>
+ <depends
+ optional-attribute-name="Registry"
+ proxy-type="attribute">portal:registry=ContentEditor</depends>
+ <depends
+ optional-attribute-name="InstanceContainer"
+ proxy-type="attribute">portal:container=Instance</depends>
+ <attribute name="ContentType">portlet</attribute>
+ </mbean>
</server>
Modified: trunk/core/src/resources/portal-core-war/WEB-INF/jboss-portlet.xml
===================================================================
--- trunk/core/src/resources/portal-core-war/WEB-INF/jboss-portlet.xml 2007-01-18 23:00:28 UTC (rev 6040)
+++ trunk/core/src/resources/portal-core-war/WEB-INF/jboss-portlet.xml 2007-01-18 23:48:10 UTC (rev 6041)
@@ -150,4 +150,9 @@
<service-class>org.jboss.portal.federation.FederatingPortletInvoker</service-class>
<service-ref>:service=PortletInvoker,type=Federating</service-ref>
</service>
+ <service>
+ <service-name>ContentEditorRegistry</service-name>
+ <service-class>org.jboss.portal.core.portlet.dashboard.ContentEditorRegistry</service-class>
+ <service-ref>:registry=ContentEditor</service-ref>
+ </service>
</portlet-app>
Modified: trunk/core/src/resources/portal-core-war/WEB-INF/jsp/dashboard/editpage.jsp
===================================================================
--- trunk/core/src/resources/portal-core-war/WEB-INF/jsp/dashboard/editpage.jsp 2007-01-18 23:00:28 UTC (rev 6040)
+++ trunk/core/src/resources/portal-core-war/WEB-INF/jsp/dashboard/editpage.jsp 2007-01-18 23:48:10 UTC (rev 6041)
@@ -9,8 +9,9 @@
<%@ page import="java.util.TreeSet" %>
<%@ page import="org.jboss.portal.core.model.content.ContentType" %>
<%@ page import="org.jboss.portal.core.impl.model.content.portlet.PortletContent" %>
-<%@ page import="org.jboss.portal.core.portlet.dashboard.PortletContentEditor" %>
<%@ page import="java.io.PrintWriter" %>
+<%@ page import="org.jboss.portal.core.portlet.dashboard.ContentEditorRegistry" %>
+<%@ page import="org.jboss.portal.core.portlet.dashboard.ContentEditor" %>
<%@ page language="java" extends="org.jboss.portal.core.servlet.jsp.PortalJsp" %>
<%@ taglib uri="http://java.sun.com/portlet" prefix="portlet" %>
<%@ taglib uri="/WEB-INF/portal-lib.tld" prefix="n" %>
@@ -222,7 +223,8 @@
</td>
<td class="portlet-section-body" valign="top" align="right"><b>Available Content</b><br/>
<%
- PortletContentEditor editor = new PortletContentEditor();
+ ContentEditorRegistry registry = (ContentEditorRegistry)request.getAttribute("registry");
+ ContentEditor editor = registry.getEditor(ContentType.PORTLET);
PrintWriter writer = new PrintWriter(out);
editor.show(renderRequest, writer);
writer.flush();
17 years, 5 months
JBoss Portal SVN: r6040 - in trunk/core/src: resources/portal-core-war/WEB-INF/jsp/dashboard and 1 other directory.
by portal-commits@lists.jboss.org
Author: julien(a)jboss.com
Date: 2007-01-18 18:00:28 -0500 (Thu, 18 Jan 2007)
New Revision: 6040
Added:
trunk/core/src/main/org/jboss/portal/core/portlet/dashboard/AddWindowContext.java
trunk/core/src/main/org/jboss/portal/core/portlet/dashboard/ContentEditor.java
trunk/core/src/main/org/jboss/portal/core/portlet/dashboard/PortletContentEditor.java
Removed:
trunk/core/src/resources/portal-core-war/WEB-INF/jsp/dashboard/plugin/
Modified:
trunk/core/src/main/org/jboss/portal/core/portlet/dashboard/Configurator.java
trunk/core/src/resources/portal-core-war/WEB-INF/jsp/dashboard/editpage.jsp
Log:
started content editor plugin
Added: trunk/core/src/main/org/jboss/portal/core/portlet/dashboard/AddWindowContext.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/portlet/dashboard/AddWindowContext.java (rev 0)
+++ trunk/core/src/main/org/jboss/portal/core/portlet/dashboard/AddWindowContext.java 2007-01-18 23:00:28 UTC (rev 6040)
@@ -0,0 +1,75 @@
+/******************************************************************************
+ * 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.portlet.dashboard;
+
+import org.jboss.portal.core.model.portal.Page;
+import org.jboss.portal.core.model.portal.Window;
+import org.jboss.portal.core.model.portal.DuplicatePortalObjectException;
+import org.jboss.portal.core.model.content.ContentType;
+import org.jboss.portal.core.model.content.Content;
+import org.jboss.portal.theme.ThemeConstants;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public class AddWindowContext
+{
+
+ /** . */
+ private final Page page;
+
+ /** . */
+ private final String toRegion;
+
+ public AddWindowContext(Page page, String toRegion)
+ {
+ this.page = page;
+ this.toRegion = toRegion;
+ }
+
+ public Content createWindow(ContentType contentType)
+ {
+ try
+ {
+ String windowName = "" + doWindowNaming();
+ while (page.getWindow(windowName) != null)
+ {
+ windowName = "" + doWindowNaming();
+ }
+ Window window = page.createWindow(windowName, ContentType.PORTLET);
+ window.setDeclaredProperty(ThemeConstants.PORTAL_PROP_REGION, toRegion);
+ window.setDeclaredProperty(ThemeConstants.PORTAL_PROP_ORDER, "" + Integer.MAX_VALUE);
+ return window.getContent();
+ }
+ catch (DuplicatePortalObjectException e)
+ {
+ throw new RuntimeException(e);
+ }
+ }
+
+ private int doWindowNaming()
+ {
+ return (int)(100 * Math.random());
+ }
+}
Modified: trunk/core/src/main/org/jboss/portal/core/portlet/dashboard/Configurator.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/portlet/dashboard/Configurator.java 2007-01-18 22:18:50 UTC (rev 6039)
+++ trunk/core/src/main/org/jboss/portal/core/portlet/dashboard/Configurator.java 2007-01-18 23:00:28 UTC (rev 6040)
@@ -30,8 +30,6 @@
import org.jboss.portal.core.model.portal.PortalObjectContainer;
import org.jboss.portal.core.model.portal.PortalObjectId;
import org.jboss.portal.core.model.portal.Window;
-import org.jboss.portal.core.impl.model.content.portlet.PortletContent;
-import org.jboss.portal.core.model.content.ContentType;
import org.jboss.portal.theme.LayoutService;
import org.jboss.portal.theme.PortalLayout;
import org.jboss.portal.theme.PortalTheme;
@@ -226,33 +224,11 @@
if ("copy".equals(op))
{
String toRegion = actionRequest.getParameter("toRegion");
- String[] copyInstance = actionRequest.getParameterValues("available_instances");
- try
- {
- for (int i = 0; i < copyInstance.length; i++)
- {
- String windowName = "" + doWindowNaming();
- while (page.getWindow(windowName) != null)
- {
- windowName = "" + doWindowNaming();
- }
+ AddWindowContext ctx = new AddWindowContext(page, toRegion);
+ PortletContentEditor editor = new PortletContentEditor();
+ editor.add(actionRequest, ctx);
- //
- Window window = page.createWindow(windowName, ContentType.PORTLET);
- window.setDeclaredProperty(ThemeConstants.PORTAL_PROP_REGION, toRegion);
- window.setDeclaredProperty(ThemeConstants.PORTAL_PROP_ORDER, "" + Integer.MAX_VALUE);
-
- //
- PortletContent content = (PortletContent)window.getContent();
- content.setInstanceRef(copyInstance[i]);
- }
- }
- catch (Exception e)
- {
- errorMessage = "Error adding window to region";
- log.error(errorMessage, e);
- }
actionResponse.setRenderParameter("editPageSelect", editPage);
}
else if ("remove".equals(op))
@@ -419,11 +395,6 @@
actionResponse.setRenderParameter("errorMsg", errorMessage);
}
- private int doWindowNaming()
- {
- return (int)(100 * Math.random());
- }
-
/** Returns a <Region,<Window>SortedSet>Map. */
private Map getWindows(Page page) throws Exception
{
Added: trunk/core/src/main/org/jboss/portal/core/portlet/dashboard/ContentEditor.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/portlet/dashboard/ContentEditor.java (rev 0)
+++ trunk/core/src/main/org/jboss/portal/core/portlet/dashboard/ContentEditor.java 2007-01-18 23:00:28 UTC (rev 6040)
@@ -0,0 +1,39 @@
+/******************************************************************************
+ * 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.portlet.dashboard;
+
+import javax.portlet.RenderRequest;
+import javax.portlet.ActionRequest;
+import java.io.PrintWriter;
+
+/**
+ * Content editor plugin.
+ *
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public interface ContentEditor
+{
+ void show(RenderRequest req, PrintWriter writer);
+ void add(ActionRequest req, AddWindowContext ctx);
+}
Added: trunk/core/src/main/org/jboss/portal/core/portlet/dashboard/PortletContentEditor.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/portlet/dashboard/PortletContentEditor.java (rev 0)
+++ trunk/core/src/main/org/jboss/portal/core/portlet/dashboard/PortletContentEditor.java 2007-01-18 23:00:28 UTC (rev 6040)
@@ -0,0 +1,74 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.core.portlet.dashboard;
+
+import org.jboss.portal.core.model.content.ContentType;
+import org.jboss.portal.core.model.instance.Instance;
+import org.jboss.portal.core.impl.model.content.portlet.PortletContent;
+
+import javax.portlet.RenderRequest;
+import javax.portlet.ActionRequest;
+import java.util.List;
+import java.io.PrintWriter;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public class PortletContentEditor implements ContentEditor
+{
+
+ public void show(RenderRequest req, PrintWriter writer)
+ {
+ List available_instances = (List)req.getAttribute("available_instances");
+ writer.println("<select name=\"available_instances\" multiple=\"true\" size=\"20\">\n");
+ for (int i = 0; i < available_instances.size(); i++)
+ {
+ Instance instance = (Instance)available_instances.get(i);
+ writer.println("<option value=\"");
+ writer.println(instance.getId());
+ writer.println("\">");
+ writer.println(instance.getId());
+ writer.println("</option>\n");
+ }
+ writer.println("</select>");
+ }
+
+ public void add(ActionRequest req, AddWindowContext ctx)
+ {
+ String[] copyInstance = req.getParameterValues("available_instances");
+ try
+ {
+ for (int i = 0; i < copyInstance.length; i++)
+ {
+ PortletContent content = (PortletContent)ctx.createWindow(ContentType.PORTLET);
+ content.setInstanceRef(copyInstance[i]);
+ }
+ }
+ catch (Exception e)
+ {
+// errorMessage = "Error adding window to region";
+// log.error(errorMessage, e);
+ }
+ }
+}
Modified: trunk/core/src/resources/portal-core-war/WEB-INF/jsp/dashboard/editpage.jsp
===================================================================
--- trunk/core/src/resources/portal-core-war/WEB-INF/jsp/dashboard/editpage.jsp 2007-01-18 22:18:50 UTC (rev 6039)
+++ trunk/core/src/resources/portal-core-war/WEB-INF/jsp/dashboard/editpage.jsp 2007-01-18 23:00:28 UTC (rev 6040)
@@ -9,6 +9,8 @@
<%@ page import="java.util.TreeSet" %>
<%@ page import="org.jboss.portal.core.model.content.ContentType" %>
<%@ page import="org.jboss.portal.core.impl.model.content.portlet.PortletContent" %>
+<%@ page import="org.jboss.portal.core.portlet.dashboard.PortletContentEditor" %>
+<%@ page import="java.io.PrintWriter" %>
<%@ page language="java" extends="org.jboss.portal.core.servlet.jsp.PortalJsp" %>
<%@ taglib uri="http://java.sun.com/portlet" prefix="portlet" %>
<%@ taglib uri="/WEB-INF/portal-lib.tld" prefix="n" %>
@@ -219,7 +221,12 @@
</table>
</td>
<td class="portlet-section-body" valign="top" align="right"><b>Available Content</b><br/>
- <jsp:include page="plugin/portlet/show.jsp"/>
+<%
+ PortletContentEditor editor = new PortletContentEditor();
+ PrintWriter writer = new PrintWriter(out);
+ editor.show(renderRequest, writer);
+ writer.flush();
+%>
</td>
<td>
<table>
17 years, 5 months
JBoss Portal SVN: r6039 - in trunk/core/src/resources/portal-core-war/WEB-INF/jsp/dashboard: plugin and 1 other directories.
by portal-commits@lists.jboss.org
Author: julien(a)jboss.com
Date: 2007-01-18 17:18:50 -0500 (Thu, 18 Jan 2007)
New Revision: 6039
Added:
trunk/core/src/resources/portal-core-war/WEB-INF/jsp/dashboard/plugin/
trunk/core/src/resources/portal-core-war/WEB-INF/jsp/dashboard/plugin/portlet/
trunk/core/src/resources/portal-core-war/WEB-INF/jsp/dashboard/plugin/portlet/show.jsp
Modified:
trunk/core/src/resources/portal-core-war/WEB-INF/jsp/dashboard/editpage.jsp
Log:
move instance presentation in the dashboard to a separate jsp
Modified: trunk/core/src/resources/portal-core-war/WEB-INF/jsp/dashboard/editpage.jsp
===================================================================
--- trunk/core/src/resources/portal-core-war/WEB-INF/jsp/dashboard/editpage.jsp 2007-01-18 22:03:00 UTC (rev 6038)
+++ trunk/core/src/resources/portal-core-war/WEB-INF/jsp/dashboard/editpage.jsp 2007-01-18 22:18:50 UTC (rev 6039)
@@ -1,4 +1,3 @@
-<%@ page import="org.jboss.portal.core.model.instance.Instance" %>
<%@ page import="org.jboss.portal.core.model.portal.Page" %>
<%@ page import="org.jboss.portal.core.model.portal.Window" %>
<%@ page import="org.jboss.portal.theme.PortalLayout" %>
@@ -18,7 +17,6 @@
<portlet:defineObjects/>
<%
- List available_instances = (List)request.getAttribute("available_instances");
List pages = (List)request.getAttribute("pages");
Map windowMap = (Map)request.getAttribute("windowMap");
@@ -221,18 +219,7 @@
</table>
</td>
<td class="portlet-section-body" valign="top" align="right"><b>Available Content</b><br/>
- <select name="available_instances" multiple="true" size="20">
- <%
- for (int i = 0; i < available_instances.size(); i++)
- {
- Instance instance = (Instance)available_instances.get(i);
- %>
- <option value="<%= instance.getId() %>"><%= instance.getId()%>
- </option>
- <%
- }
- %>
- </select>
+ <jsp:include page="plugin/portlet/show.jsp"/>
</td>
<td>
<table>
Added: trunk/core/src/resources/portal-core-war/WEB-INF/jsp/dashboard/plugin/portlet/show.jsp
===================================================================
--- trunk/core/src/resources/portal-core-war/WEB-INF/jsp/dashboard/plugin/portlet/show.jsp (rev 0)
+++ trunk/core/src/resources/portal-core-war/WEB-INF/jsp/dashboard/plugin/portlet/show.jsp 2007-01-18 22:18:50 UTC (rev 6039)
@@ -0,0 +1,18 @@
+<%@ page language="java" extends="org.jboss.portal.core.servlet.jsp.PortalJsp" %>
+<%@ page import="org.jboss.portal.core.model.instance.Instance" %>
+<%@ page import="java.util.List" %>
+<%@ taglib uri="http://java.sun.com/portlet" prefix="portlet" %>
+<%@ taglib uri="/WEB-INF/portal-lib.tld" prefix="n" %>
+<select name="available_instances" multiple="true" size="20">
+ <%
+ List available_instances = (List)request.getAttribute("available_instances");
+ for (int i = 0; i < available_instances.size(); i++)
+ {
+ Instance instance = (Instance)available_instances.get(i);
+ %>
+ <option value="<%= instance.getId() %>"><%= instance.getId()%>
+ </option>
+ <%
+ }
+ %>
+</select>
17 years, 5 months
JBoss Portal SVN: r6038 - in trunk/core/src/resources: portal-core-war/WEB-INF/jsp/dashboard and 1 other directory.
by portal-commits@lists.jboss.org
Author: julien(a)jboss.com
Date: 2007-01-18 17:03:00 -0500 (Thu, 18 Jan 2007)
New Revision: 6038
Modified:
trunk/core/src/resources/portal-core-sar/META-INF/jboss-service.xml
trunk/core/src/resources/portal-core-war/WEB-INF/jsp/dashboard/editpage.jsp
Log:
fixed dashboard portlet content handling
Modified: trunk/core/src/resources/portal-core-sar/META-INF/jboss-service.xml
===================================================================
--- trunk/core/src/resources/portal-core-sar/META-INF/jboss-service.xml 2007-01-18 20:23:54 UTC (rev 6037)
+++ trunk/core/src/resources/portal-core-sar/META-INF/jboss-service.xml 2007-01-18 22:03:00 UTC (rev 6038)
@@ -553,6 +553,9 @@
<depends
optional-attribute-name="Registry"
proxy-type="attribute">portal:container=PortalObject</depends>
+ <depends
+ optional-attribute-name="InstanceContainer"
+ proxy-type="attribute">portal:container=Instance</depends>
<attribute name="ContentType">portlet</attribute>
</mbean>
<mbean
Modified: trunk/core/src/resources/portal-core-war/WEB-INF/jsp/dashboard/editpage.jsp
===================================================================
--- trunk/core/src/resources/portal-core-war/WEB-INF/jsp/dashboard/editpage.jsp 2007-01-18 20:23:54 UTC (rev 6037)
+++ trunk/core/src/resources/portal-core-war/WEB-INF/jsp/dashboard/editpage.jsp 2007-01-18 22:03:00 UTC (rev 6038)
@@ -8,6 +8,8 @@
<%@ page import="java.util.List" %>
<%@ page import="java.util.Map" %>
<%@ page import="java.util.TreeSet" %>
+<%@ page import="org.jboss.portal.core.model.content.ContentType" %>
+<%@ page import="org.jboss.portal.core.impl.model.content.portlet.PortletContent" %>
<%@ page language="java" extends="org.jboss.portal.core.servlet.jsp.PortalJsp" %>
<%@ taglib uri="http://java.sun.com/portlet" prefix="portlet" %>
<%@ taglib uri="/WEB-INF/portal-lib.tld" prefix="n" %>
@@ -253,10 +255,15 @@
for (Iterator j = windows.iterator(); j.hasNext();)
{
Window window = (Window)j.next();
+ ContentType contentType = window.getContentType();
+ if (ContentType.PORTLET.equals(contentType))
+ {
+ PortletContent portletContent = (PortletContent)window.getContent();
%>
- <option value="<%= window.getName() %>"><%= window.getInstanceRef() %>
+ <option value="<%= window.getName() %>"><%= portletContent.getInstanceRef() %>
</option>
<%
+ }
}
%>
</select>
17 years, 5 months
JBoss Portal SVN: r6037 - trunk/portlet/src/main/org/jboss/portal/portlet/impl/jsr168.
by portal-commits@lists.jboss.org
Author: julien(a)jboss.com
Date: 2007-01-18 15:23:54 -0500 (Thu, 18 Jan 2007)
New Revision: 6037
Modified:
trunk/portlet/src/main/org/jboss/portal/portlet/impl/jsr168/PortletUtils.java
Log:
improved implementation of generateNamespaceFrom method
Modified: trunk/portlet/src/main/org/jboss/portal/portlet/impl/jsr168/PortletUtils.java
===================================================================
--- trunk/portlet/src/main/org/jboss/portal/portlet/impl/jsr168/PortletUtils.java 2007-01-18 19:31:56 UTC (rev 6036)
+++ trunk/portlet/src/main/org/jboss/portal/portlet/impl/jsr168/PortletUtils.java 2007-01-18 20:23:54 UTC (rev 6037)
@@ -163,11 +163,26 @@
* Generates a namespace suitable for Portlet prefixing of tokens that need to be unique in an aggregated page.
*
* @param windowId
- * @return
* @since 2.6
*/
public static String generateNamespaceFrom(String windowId)
{
- return PREFIX + Integer.toHexString(windowId.hashCode());
+ StringBuffer tmp = new StringBuffer(PREFIX.length() + windowId.length() * 2);
+ tmp.append(PREFIX);
+ for (int i = 0;i < windowId.length();i++)
+ {
+ char c = windowId.charAt(i);
+ if (Character.isLetterOrDigit(c))
+ {
+ tmp.append(c);
+ }
+ else
+ {
+ tmp.append('_');
+ tmp.append(Character.forDigit((((int)c) & 0XF0) >> 4, 16));
+ tmp.append(Character.forDigit((((int)c) & 0X0F), 16));
+ }
+ }
+ return tmp.toString();
}
}
17 years, 5 months
JBoss Portal SVN: r6036 - in trunk: wsrp/src/main/org/jboss/portal/wsrp/consumer and 1 other directories.
by portal-commits@lists.jboss.org
Author: chris.laprun(a)jboss.com
Date: 2007-01-18 14:31:56 -0500 (Thu, 18 Jan 2007)
New Revision: 6036
Modified:
trunk/portlet/src/main/org/jboss/portal/portlet/impl/jsr168/PortletUtils.java
trunk/portlet/src/main/org/jboss/portal/portlet/impl/jsr168/RenderResponseImpl.java
trunk/wsrp/src/main/org/jboss/portal/wsrp/consumer/InvocationHandler.java
trunk/wsrp/src/main/org/jboss/portal/wsrp/consumer/RenderHandler.java
trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/RequestProcessor.java
Log:
- JBPORTAL-1039: Fixed.
- Extracted namespace generation from RenderResponseImpl to PortletUtils.
Modified: trunk/portlet/src/main/org/jboss/portal/portlet/impl/jsr168/PortletUtils.java
===================================================================
--- trunk/portlet/src/main/org/jboss/portal/portlet/impl/jsr168/PortletUtils.java 2007-01-18 19:25:19 UTC (rev 6035)
+++ trunk/portlet/src/main/org/jboss/portal/portlet/impl/jsr168/PortletUtils.java 2007-01-18 19:31:56 UTC (rev 6036)
@@ -37,6 +37,8 @@
*/
public class PortletUtils
{
+ private static final String PREFIX = "jbp";
+
public static void checkRenderParameterMap(Map map)
{
if (map == null)
@@ -156,4 +158,16 @@
return new PortletMode(portletModeName);
}
}
+
+ /**
+ * Generates a namespace suitable for Portlet prefixing of tokens that need to be unique in an aggregated page.
+ *
+ * @param windowId
+ * @return
+ * @since 2.6
+ */
+ public static String generateNamespaceFrom(String windowId)
+ {
+ return PREFIX + Integer.toHexString(windowId.hashCode());
+ }
}
Modified: trunk/portlet/src/main/org/jboss/portal/portlet/impl/jsr168/RenderResponseImpl.java
===================================================================
--- trunk/portlet/src/main/org/jboss/portal/portlet/impl/jsr168/RenderResponseImpl.java 2007-01-18 19:25:19 UTC (rev 6035)
+++ trunk/portlet/src/main/org/jboss/portal/portlet/impl/jsr168/RenderResponseImpl.java 2007-01-18 19:31:56 UTC (rev 6036)
@@ -23,8 +23,8 @@
package org.jboss.portal.portlet.impl.jsr168;
import org.jboss.portal.common.MediaType;
+import org.jboss.portal.portlet.invocation.PortletInvocation;
import org.jboss.portal.portlet.invocation.RenderInvocation;
-import org.jboss.portal.portlet.invocation.PortletInvocation;
import org.jboss.portal.portlet.invocation.response.FragmentResponse;
import org.jboss.portal.portlet.invocation.response.PortletInvocationResponse;
import org.jboss.portal.server.util.HTTPStreamInfo;
@@ -137,7 +137,7 @@
if (namespace == null)
{
String windowId = invocation.getWindowContext().getId();
- namespace = "jbp" + Integer.toHexString(windowId.hashCode());
+ namespace = PortletUtils.generateNamespaceFrom(windowId);
}
return namespace;
}
@@ -154,7 +154,7 @@
public void setBufferSize(int bufferSize)
{
- if (bufferSize >- 0)
+ if (bufferSize > -0)
{
this.bufferSize = bufferSize;
}
Modified: trunk/wsrp/src/main/org/jboss/portal/wsrp/consumer/InvocationHandler.java
===================================================================
--- trunk/wsrp/src/main/org/jboss/portal/wsrp/consumer/InvocationHandler.java 2007-01-18 19:25:19 UTC (rev 6035)
+++ trunk/wsrp/src/main/org/jboss/portal/wsrp/consumer/InvocationHandler.java 2007-01-18 19:31:56 UTC (rev 6036)
@@ -25,6 +25,7 @@
import org.jboss.logging.Logger;
import org.jboss.portal.portlet.PortletInvokerException;
+import org.jboss.portal.portlet.impl.jsr168.PortletUtils;
import org.jboss.portal.portlet.invocation.PortletInvocation;
import org.jboss.portal.portlet.invocation.response.ErrorResponse;
import org.jboss.portal.portlet.invocation.response.PortletInvocationResponse;
@@ -100,7 +101,7 @@
RuntimeContext runtimeContext = getRuntimeContextFrom(request);
WindowContext windowContext = invocation.getWindowContext();
- runtimeContext.setNamespacePrefix(windowContext == null ? null : windowContext.getId());
+ runtimeContext.setNamespacePrefix(getNamespaceFrom(windowContext));
InstanceContext instanceContext = invocation.getInstanceContext();
runtimeContext.setPortletInstanceKey(instanceContext == null ? null : instanceContext.getId());
@@ -140,6 +141,11 @@
return response;
}
+ protected String getNamespaceFrom(WindowContext windowContext)
+ {
+ return windowContext == null ? null : PortletUtils.generateNamespaceFrom(windowContext.getId());
+ }
+
/**
* Deals with common error conditions.
*
Modified: trunk/wsrp/src/main/org/jboss/portal/wsrp/consumer/RenderHandler.java
===================================================================
--- trunk/wsrp/src/main/org/jboss/portal/wsrp/consumer/RenderHandler.java 2007-01-18 19:25:19 UTC (rev 6035)
+++ trunk/wsrp/src/main/org/jboss/portal/wsrp/consumer/RenderHandler.java 2007-01-18 19:31:56 UTC (rev 6036)
@@ -157,8 +157,7 @@
private String processMarkup(String markup, PortletInvocation invocation, boolean rewriteURLs)
{
// fix-me: how to deal with fragment header? => interceptor?
- String prefix = consumer.getProducerId() + SEPARATOR
- + Integer.toHexString(invocation.getWindowContext().getId().hashCode()) + SEPARATOR;
+ String prefix = getNamespaceFrom(invocation.getWindowContext()) + SEPARATOR;
markup = Tools.replace(markup, WSRPRewritingConstants.WSRP_REWRITE_TOKEN, prefix);
Modified: trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/RequestProcessor.java
===================================================================
--- trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/RequestProcessor.java 2007-01-18 19:25:19 UTC (rev 6035)
+++ trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/RequestProcessor.java 2007-01-18 19:31:56 UTC (rev 6036)
@@ -202,7 +202,7 @@
}
// get the mode
- String mode = null;
+ String mode;
try
{
mode = getMatchingOrFailFrom(markupType.getModes(), params.getMode(), PORTLET_MODE);
@@ -213,7 +213,7 @@
}
// get the window state
- String windowState = null;
+ String windowState;
try
{
windowState = getMatchingOrFailFrom(markupType.getWindowStates(), params.getWindowState(), WINDOW_STATE);
@@ -296,8 +296,6 @@
protected StateString createNavigationalState(String navigationalState)
{
- // fix-me: create opaque NS and implement an interceptor that does conversion to jboss NS
-// PortletNavigationalState navigationalState = new OpaquePortletNavigationalState(navigationalState);
if (navigationalState == null)
{
return null;
17 years, 5 months
JBoss Portal SVN: r6035 - trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/config.
by portal-commits@lists.jboss.org
Author: chris.laprun(a)jboss.com
Date: 2007-01-18 14:25:19 -0500 (Thu, 18 Jan 2007)
New Revision: 6035
Modified:
trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/config/ProducerConfigurationService.java
Log:
- Renamed enum to resources to avoid Java 5 conflict.
Modified: trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/config/ProducerConfigurationService.java
===================================================================
--- trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/config/ProducerConfigurationService.java 2007-01-18 16:44:51 UTC (rev 6034)
+++ trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/config/ProducerConfigurationService.java 2007-01-18 19:25:19 UTC (rev 6035)
@@ -72,11 +72,11 @@
}
// make sure we pick the furthest down the path in case there's several similarly named resources in the path
- Enumeration enum = Thread.currentThread().getContextClassLoader().getResources(configLocation);
+ Enumeration resources = Thread.currentThread().getContextClassLoader().getResources(configLocation);
URL configURL = null;
- while (enum.hasMoreElements())
+ while (resources.hasMoreElements())
{
- configURL = (URL)enum.nextElement();
+ configURL = (URL)resources.nextElement();
}
if (configURL == null)
17 years, 5 months