JBoss Portal SVN: r6735 - trunk/portlet/src/main/org/jboss/portal/portlet/impl/container.
by portal-commits@lists.jboss.org
Author: julien(a)jboss.com
Date: 2007-03-18 21:50:24 -0400 (Sun, 18 Mar 2007)
New Revision: 6735
Modified:
trunk/portlet/src/main/org/jboss/portal/portlet/impl/container/PortletApplicationContextImpl.java
Log:
if jboss app md does not exist, do not use it.
Modified: trunk/portlet/src/main/org/jboss/portal/portlet/impl/container/PortletApplicationContextImpl.java
===================================================================
--- trunk/portlet/src/main/org/jboss/portal/portlet/impl/container/PortletApplicationContextImpl.java 2007-03-19 01:09:46 UTC (rev 6734)
+++ trunk/portlet/src/main/org/jboss/portal/portlet/impl/container/PortletApplicationContextImpl.java 2007-03-19 01:50:24 UTC (rev 6735)
@@ -103,9 +103,18 @@
for (Iterator i = portletAppMD.getPortlets().iterator();i.hasNext();)
{
PortletMetaData portletMD = (PortletMetaData)i.next();
- PortletContainerImpl container = new PortletContainerImpl(portletMD, (JBossPortletMetaData)jbossAppMD.getPortlets().get(portletMD.getName()));
//
+ JBossPortletMetaData jBossPortletMD = null;
+ if (jBossPortletMD != null)
+ {
+ jBossPortletMD = (JBossPortletMetaData)jbossAppMD.getPortlets().get(portletMD.getName());
+ }
+
+ //
+ PortletContainerImpl container = new PortletContainerImpl(portletMD, jBossPortletMD);
+
+ //
container.setApplication(portletApp);
portletApp.addContainer(container);
17 years, 6 months
JBoss Portal SVN: r6734 - trunk/core/src/main/org/jboss/portal/core/impl/model/instance.
by portal-commits@lists.jboss.org
Author: julien(a)jboss.com
Date: 2007-03-18 21:09:46 -0400 (Sun, 18 Mar 2007)
New Revision: 6734
Modified:
trunk/core/src/main/org/jboss/portal/core/impl/model/instance/InstanceContextImpl.java
Log:
better impl of InstanceContext.getId() in case of a customization
Modified: trunk/core/src/main/org/jboss/portal/core/impl/model/instance/InstanceContextImpl.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/impl/model/instance/InstanceContextImpl.java 2007-03-19 00:38:40 UTC (rev 6733)
+++ trunk/core/src/main/org/jboss/portal/core/impl/model/instance/InstanceContextImpl.java 2007-03-19 01:09:46 UTC (rev 6734)
@@ -23,6 +23,8 @@
package org.jboss.portal.core.impl.model.instance;
import org.jboss.portal.core.model.instance.Instance;
+import org.jboss.portal.core.model.instance.InstanceDefinition;
+import org.jboss.portal.core.model.instance.InstanceCustomization;
import org.jboss.portal.portlet.PortletContext;
import org.jboss.portal.portlet.StateEvent;
import org.jboss.portal.portlet.spi.InstanceContext;
@@ -59,7 +61,16 @@
public String getId()
{
- return instance.getId();
+ if (instance instanceof InstanceDefinition)
+ {
+ return instance.getId();
+ }
+ else
+ {
+ InstanceCustomization cust = (InstanceCustomization)instance;
+ InstanceDefinition def = cust.getDefinition();
+ return def.getId() + "." + cust.getId();
+ }
}
public AccessMode getAccessMode()
17 years, 6 months
JBoss Portal SVN: r6733 - in trunk: portlet and 11 other directories.
by portal-commits@lists.jboss.org
Author: julien(a)jboss.com
Date: 2007-03-18 20:38:40 -0400 (Sun, 18 Mar 2007)
New Revision: 6733
Added:
trunk/portlet/src/main/org/jboss/portal/portlet/impl/container/
trunk/portlet/src/main/org/jboss/portal/portlet/impl/container/PortletApplicationContextImpl.java
trunk/portlet/src/main/org/jboss/portal/portlet/impl/container/PortletApplicationRegistryImpl.java
Removed:
trunk/portlet-server/src/main/org/jboss/portal/portlet/deployment/jboss/PortletContainerAdapter.java
trunk/portlet/src/main/org/jboss/portal/portlet/container/PortletApplicationContextImpl.java
trunk/portlet/src/main/org/jboss/portal/portlet/container/PortletApplicationRegistryImpl.java
Modified:
trunk/core/src/resources/portal-core-sar/META-INF/jboss-service.xml
trunk/portlet-server/build.xml
trunk/portlet-server/src/main/org/jboss/portal/portlet/deployment/jboss/PortletAppDeployment.java
trunk/portlet-server/src/resources/tck-sar/META-INF/jboss-service.xml
trunk/portlet-server/src/resources/test-sar/META-INF/jboss-service.xml
trunk/portlet-server/src/resources/test/info/test-info-sar/META-INF/jboss-service.xml
trunk/portlet/build.xml
trunk/portlet/src/main/org/jboss/portal/portlet/aspects/portlet/ValveInterceptor.java
trunk/portlet/src/main/org/jboss/portal/portlet/container/PortletApplication.java
trunk/portlet/src/main/org/jboss/portal/portlet/container/PortletApplicationContext.java
trunk/portlet/src/main/org/jboss/portal/portlet/container/PortletContainer.java
trunk/portlet/src/main/org/jboss/portal/portlet/impl/jsr168/PortletApplicationImpl.java
trunk/portlet/src/main/org/jboss/portal/portlet/impl/jsr168/PortletContainerImpl.java
trunk/wsrp/src/resources/tests/test-wsrp-producer-sar/META-INF/jboss-service.xml
Log:
portlet app / container lifecycle cleanup and simplifications
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-03-18 23:25:36 UTC (rev 6732)
+++ trunk/core/src/resources/portal-core-sar/META-INF/jboss-service.xml 2007-03-19 00:38:40 UTC (rev 6733)
@@ -505,7 +505,7 @@
<!-- Registries -->
<mbean
- code="org.jboss.portal.portlet.container.PortletApplicationRegistryImpl"
+ code="org.jboss.portal.portlet.impl.container.PortletApplicationRegistryImpl"
name="portal:service=WebAppRegistry"
xmbean-dd=""
xmbean-code="org.jboss.portal.jems.as.system.JBossServiceModelMBean">
Modified: trunk/portlet/build.xml
===================================================================
--- trunk/portlet/build.xml 2007-03-18 23:25:36 UTC (rev 6732)
+++ trunk/portlet/build.xml 2007-03-19 00:38:40 UTC (rev 6733)
@@ -90,7 +90,6 @@
<path id="library.classpath">
<path refid="dom4j.dom4j.classpath"/>
<path refid="jboss.jbossxb.classpath"/>
- <path refid="jboss.microcontainer.classpath"/>
<path refid="jboss.serialization.classpath"/>
<path refid="oswego.concurrent.classpath"/>
<path refid="apache.httpclient.classpath"/>
Modified: trunk/portlet/src/main/org/jboss/portal/portlet/aspects/portlet/ValveInterceptor.java
===================================================================
--- trunk/portlet/src/main/org/jboss/portal/portlet/aspects/portlet/ValveInterceptor.java 2007-03-18 23:25:36 UTC (rev 6732)
+++ trunk/portlet/src/main/org/jboss/portal/portlet/aspects/portlet/ValveInterceptor.java 2007-03-19 00:38:40 UTC (rev 6733)
@@ -26,6 +26,8 @@
import org.jboss.portal.common.invocation.InvocationException;
import org.jboss.portal.portlet.impl.jsr168.PortletApplicationImpl;
import org.jboss.portal.portlet.container.PortletContainer;
+import org.jboss.portal.portlet.container.PortletApplication;
+import org.jboss.portal.portlet.container.PortletApplicationContext;
import org.jboss.portal.portlet.impl.jsr168.info.ContainerPortletInfo;
import org.jboss.portal.portlet.invocation.PortletInterceptor;
import org.jboss.portal.portlet.invocation.PortletInvocation;
@@ -70,8 +72,9 @@
// This call will wait until all the current threads have exited the component valve.
// Perhaps this should be done asynchronously as it may lead to a long delay ?
// It could be made parametrizable too, so the deployer can choose what mode is preferable
- PortletApplicationImpl pwa = (PortletApplicationImpl)container.getApplication();
- pwa.stop(container.getId());
+ PortletApplication application = container.getApplication();
+ PortletApplicationContext applicationContext = application.getContext();
+ applicationContext.stopPortletContainer(container.getId());
}
//
Modified: trunk/portlet/src/main/org/jboss/portal/portlet/container/PortletApplication.java
===================================================================
--- trunk/portlet/src/main/org/jboss/portal/portlet/container/PortletApplication.java 2007-03-18 23:25:36 UTC (rev 6732)
+++ trunk/portlet/src/main/org/jboss/portal/portlet/container/PortletApplication.java 2007-03-19 00:38:40 UTC (rev 6733)
@@ -43,4 +43,16 @@
/** Return the porlet application context. */
PortletApplicationContext getContext();
+
+ /**
+ * Starts the application only. It does not take care of starting its components.
+ *
+ * @throws Exception any exception preventing the start
+ */
+ void start() throws Exception;
+
+ /**
+ * Stops the application only. It does not take care of stopping its components.
+ */
+ void stop();
}
Modified: trunk/portlet/src/main/org/jboss/portal/portlet/container/PortletApplicationContext.java
===================================================================
--- trunk/portlet/src/main/org/jboss/portal/portlet/container/PortletApplicationContext.java 2007-03-18 23:25:36 UTC (rev 6732)
+++ trunk/portlet/src/main/org/jboss/portal/portlet/container/PortletApplicationContext.java 2007-03-19 00:38:40 UTC (rev 6733)
@@ -25,7 +25,9 @@
import javax.servlet.ServletContext;
/**
- * The context for a portlet application.
+ * The context provided to a portlet application. For now it manages the application external resources
+ * such as the servlet context and the application classloader. It manages also the life cycle of the
+ * application and its components.
*
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
* @version $Revision$
@@ -47,18 +49,26 @@
ClassLoader getClassLoader();
/**
- * Attempt to start a portlet.
+ * Start the portlet application and its components.
+ */
+ void startPortletApplication() throws Exception;
+
+ /**
+ * Stop the portlet application and its components.
+ */
+ void stopPortletApplication();
+
+ /**
+ * Start a portlet container.
*
- * @param portletName the portlet name
- * @throws Exception any exception that prevents the portlet to start
+ * @param portletName the container name
*/
- void startPortlet(String portletName) throws Exception;
+ void startPortletContainer(String portletName) throws Exception;
/**
- * Stop the portlet.
+ * Stop a portlet container.
*
- * @param portletName the portlet name
- * @throws Exception any exception that may occur during the portlet stop
+ * @param portletName the container name
*/
- public void stopPortlet(String portletName) throws Exception;
+ void stopPortletContainer(String portletName);
}
Deleted: trunk/portlet/src/main/org/jboss/portal/portlet/container/PortletApplicationContextImpl.java
===================================================================
--- trunk/portlet/src/main/org/jboss/portal/portlet/container/PortletApplicationContextImpl.java 2007-03-18 23:25:36 UTC (rev 6732)
+++ trunk/portlet/src/main/org/jboss/portal/portlet/container/PortletApplicationContextImpl.java 2007-03-19 00:38:40 UTC (rev 6733)
@@ -1,185 +0,0 @@
-/******************************************************************************
- * JBoss, a division of Red Hat *
- * Copyright 2006, Red Hat Middleware, LLC, and individual *
- * contributors as indicated by the @authors tag. See the *
- * copyright.txt in the distribution for a full listing of *
- * individual contributors. *
- * *
- * This is free software; you can redistribute it and/or modify it *
- * under the terms of the GNU Lesser General Public License as *
- * published by the Free Software Foundation; either version 2.1 of *
- * the License, or (at your option) any later version. *
- * *
- * This software is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
- * Lesser General Public License for more details. *
- * *
- * You should have received a copy of the GNU Lesser General Public *
- * License along with this software; if not, write to the Free *
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
- ******************************************************************************/
-package org.jboss.portal.portlet.container;
-
-import org.jboss.dependency.spi.ControllerContext;
-import org.jboss.dependency.spi.ControllerState;
-import org.jboss.kernel.Kernel;
-import org.jboss.kernel.spi.dependency.KernelController;
-import org.jboss.kernel.spi.dependency.KernelControllerContext;
-import org.jboss.kernel.spi.dependency.KernelControllerContextAware;
-import org.jboss.portal.portlet.impl.jsr168.APIFactory;
-import org.jboss.portal.portlet.impl.jsr168.PortletApplicationImpl;
-import org.jboss.portal.portlet.impl.jsr168.metadata.PortletApplicationMetaData;
-import org.jboss.portal.portlet.metadata.JBossApplicationMetaData;
-
-import javax.servlet.ServletContext;
-
-/**
- * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
- * @version $Revision$
- */
-public class PortletApplicationContextImpl implements PortletApplicationContext, KernelControllerContextAware
-{
-
- /** . */
- private PortletApplicationRegistry registry;
-
- /** . */
- private APIFactory apiFactory;
-
- /** . */
- private PortletApplicationMetaData portletAppMD;
-
- /** . */
- private JBossApplicationMetaData jbossAppMD;
-
- /** . */
- private PortletApplicationImpl portletApp;
-
- /** . */
- private KernelControllerContext kernelControllerContext;
-
- /** . */
- private ServletContext servletContext;
-
- /** . */
- private ClassLoader classLoader;
-
- public PortletApplicationContextImpl(
- PortletApplicationRegistry registry,
- APIFactory apiFactory,
- PortletApplicationMetaData portletAppMD,
- JBossApplicationMetaData jbossAppMD,
- ServletContext servletContext,
- ClassLoader classLoader)
- {
- this.registry = registry;
- this.apiFactory = apiFactory;
- this.portletAppMD = portletAppMD;
- this.jbossAppMD = jbossAppMD;
- this.servletContext = servletContext;
- this.classLoader = classLoader;
- }
-
- public void start() throws Exception
- {
- portletApp = new PortletApplicationImpl(portletAppMD, jbossAppMD, this);
- PortletApplicationRegistrationContext registrationContext = registry.registerPortletApplication(portletApp);
-
- //
- portletApp.setRegistrationContext(registrationContext);
- portletApp.setAPIFactory(apiFactory);
- portletApp.create();
- portletApp.start();
- }
-
- public void stop()
- {
- registry.unregisterPortletApplication(portletApp);
- portletApp.stop();
- portletApp.destroy();
-
- //
- portletApp.setRegistrationContext(null);
- portletApp = null;
- }
-
- public PortletApplicationImpl getPortletApplication()
- {
- return portletApp;
- }
-
- // PortletApplicationContext implementation *************************************************************************
-
- public ServletContext getServletContext()
- {
- return servletContext;
- }
-
- public ClassLoader getClassLoader()
- {
- return classLoader;
- }
-
- public void startPortlet(String portletName) throws Exception
- {
- Kernel kernel = kernelControllerContext.getKernel();
- KernelController controller = kernel.getController();
- ControllerContext context = controller.getInstalledContext("portal:container=Portlet,id=" + portletAppMD.getId() + "." + portletName);
- if (context == null)
- {
- throw new IllegalArgumentException("Portlet container " + portletName + " does not exist");
- }
- try
- {
- controller.change(context, ControllerState.INSTALLED);
- }
- catch (Throwable throwable)
- {
- if (throwable instanceof Exception)
- {
- throw(Exception)throwable;
- }
- else if (throwable instanceof Error)
- {
- throw(Error)throwable;
- }
- else
- {
- throw new Error("Unexpected throwable", throwable);
- }
- }
- }
-
- public void stopPortlet(String portletName) throws Exception
- {
- Kernel kernel = kernelControllerContext.getKernel();
- KernelController controller = kernel.getController();
- ControllerContext context = controller.getInstalledContext("portal:container=Portlet,id=" + portletAppMD.getId() + "." + portletName);
- if (context == null)
- {
- throw new IllegalArgumentException("Portlet container " + portletName + " does not exist");
- }
- try
- {
- controller.change(context, ControllerState.CONFIGURED);
- }
- catch (Throwable throwable)
- {
- throwable.printStackTrace();
- }
- }
-
- // Kernel object implementation *************************************************************************************
-
- public void setKernelControllerContext(KernelControllerContext context) throws Exception
- {
- this.kernelControllerContext = context;
- }
-
- public void unsetKernelControllerContext(KernelControllerContext context) throws Exception
- {
- this.kernelControllerContext = null;
- }
-}
Deleted: trunk/portlet/src/main/org/jboss/portal/portlet/container/PortletApplicationRegistryImpl.java
===================================================================
--- trunk/portlet/src/main/org/jboss/portal/portlet/container/PortletApplicationRegistryImpl.java 2007-03-18 23:25:36 UTC (rev 6732)
+++ trunk/portlet/src/main/org/jboss/portal/portlet/container/PortletApplicationRegistryImpl.java 2007-03-19 00:38:40 UTC (rev 6733)
@@ -1,247 +0,0 @@
-/******************************************************************************
- * JBoss, a division of Red Hat *
- * Copyright 2006, Red Hat Middleware, LLC, and individual *
- * contributors as indicated by the @authors tag. See the *
- * copyright.txt in the distribution for a full listing of *
- * individual contributors. *
- * *
- * This is free software; you can redistribute it and/or modify it *
- * under the terms of the GNU Lesser General Public License as *
- * published by the Free Software Foundation; either version 2.1 of *
- * the License, or (at your option) any later version. *
- * *
- * This software is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
- * Lesser General Public License for more details. *
- * *
- * You should have received a copy of the GNU Lesser General Public *
- * License along with this software; if not, write to the Free *
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
- ******************************************************************************/
-package org.jboss.portal.portlet.container;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-
-/**
- * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
- * @author <a href="mailto:theute@jboss.org">Thomas Heute</a>
- * @version $Revision$
- */
-public class PortletApplicationRegistryImpl implements PortletApplicationRegistry
-{
-
- /** . */
- private Map portletApplications = new HashMap();
-
- /** . */
- private Map portletContainers = new HashMap();
-
- /** . */
- private List listeners = new ArrayList();
-
- public PortletApplicationRegistrationContext registerPortletApplication(PortletApplication portletApplication)
- {
- if (portletApplication == null)
- {
- throw new IllegalArgumentException("No null portlet app accepted");
- }
- synchronized (this)
- {
- if (portletApplications.containsKey(portletApplication.getId()))
- {
- throw new IllegalArgumentException("This portlet app is already registered");
- }
- PortletApplicationRegistrationContext ctx = new PortletApplicationRegistrationContextImpl(portletApplication);
- Map webAppsCopy = new HashMap(portletApplications);
- webAppsCopy.put(portletApplication.getId(), portletApplication);
- portletApplications = webAppsCopy;
- return ctx;
- }
- }
-
- public void unregisterPortletApplication(PortletApplication portletApplication)
- {
- if (portletApplication == null)
- {
- throw new IllegalArgumentException("No null portlet app accepted");
- }
- synchronized (this)
- {
- if (!portletApplications.containsKey(portletApplication.getId()))
- {
- throw new IllegalArgumentException("This portlet app does not exist here");
- }
- Map webAppsCopy = new HashMap(portletApplications);
- webAppsCopy.remove(portletApplication.getId());
- portletApplications = webAppsCopy;
- }
- }
-
- public Collection getPortletApplications()
- {
- return Collections.unmodifiableCollection(portletApplications.values());
- }
-
- public PortletApplication getPortletApplication(String id)
- {
- return (PortletApplication)portletApplications.get(id);
- }
-
- public void addListener(PortletApplicationRegistryListener listener)
- {
- if (listener == null)
- {
- throw new IllegalArgumentException("No null listener accepted");
- }
- else
- {
- synchronized (this)
- {
- listeners.add(listener);
- }
- }
- }
-
- public void removeListener(PortletApplicationRegistryListener listener)
- {
- if (listener == null)
- {
- throw new IllegalArgumentException("No null listener accepted");
- }
- else
- {
- synchronized (this)
- {
- listeners.remove(listener);
- }
- }
- }
-
- private void raiseRegisterPortletContainerEvent(PortletContainer portlet)
- {
- Iterator it = listeners.iterator();
- while (it.hasNext())
- {
- PortletApplicationRegistryListener listener = (PortletApplicationRegistryListener)it.next();
- listener.portletContainerRegistered(portlet);
- }
- }
-
- private void raiseUnregisterPortletContainerEvent(PortletContainer portlet)
- {
- Iterator it = listeners.iterator();
- while (it.hasNext())
- {
- PortletApplicationRegistryListener listener = (PortletApplicationRegistryListener)it.next();
- listener.portletContainerUnregistered(portlet);
- }
- }
-
- private static class ContainerKey
- {
- /** . */
- private final String applicationId;
-
- /** . */
- private final String containerId;
-
- public ContainerKey(PortletContainer container)
- {
- this.applicationId = container.getApplication().getId();
- this.containerId = container.getId();
- }
-
- public boolean equals(Object obj)
- {
- if (obj == this)
- {
- return true;
- }
- if (obj instanceof ContainerKey)
- {
- ContainerKey that = (ContainerKey)obj;
- return applicationId.equals(that.applicationId) && containerId.equals(containerId);
- }
- return false;
- }
-
- public int hashCode()
- {
- return applicationId.hashCode() & containerId.hashCode();
- }
- }
-
- private class PortletApplicationRegistrationContextImpl implements PortletApplicationRegistrationContext
- {
-
- /** . */
- private PortletApplication portletApplication;
-
- /** . */
- private boolean active;
-
- public PortletApplicationRegistrationContextImpl(PortletApplication portletApplication)
- {
- this.portletApplication = portletApplication;
- this.active = true;
- }
-
- public void registerPortlet(PortletContainer portletContainer)
- {
- if (portletContainer == null)
- {
- throw new IllegalArgumentException("No null portlet accepted");
- }
- if (portletContainer.getApplication() != portletApplication)
- {
- throw new IllegalArgumentException("The container does not belong to the application owning the registration");
- }
- if (!active)
- {
- throw new IllegalStateException("Not anymore active");
- }
- synchronized (this)
- {
- Map componentsCopy = new HashMap(portletContainers);
- componentsCopy.put(new ContainerKey(portletContainer), portletContainer);
- portletContainers = componentsCopy;
-
- //
- raiseRegisterPortletContainerEvent(portletContainer);
- }
- }
-
- public void unregisterPortlet(PortletContainer portletContainer)
- {
- if (portletContainer == null)
- {
- throw new IllegalArgumentException("No null portlet accepted");
- }
- if (portletContainer.getApplication() != portletApplication)
- {
- throw new IllegalArgumentException("The container does not belong to the application owning the registration");
- }
- if (!active)
- {
- throw new IllegalStateException("Not anymore active");
- }
- synchronized (this)
- {
- Map componentsCopy = new HashMap(portletContainers);
- componentsCopy.remove(portletContainer);
- portletContainers = componentsCopy;
- raiseUnregisterPortletContainerEvent(portletContainer);
- }
- }
-
- }
-
-}
Modified: trunk/portlet/src/main/org/jboss/portal/portlet/container/PortletContainer.java
===================================================================
--- trunk/portlet/src/main/org/jboss/portal/portlet/container/PortletContainer.java 2007-03-18 23:25:36 UTC (rev 6732)
+++ trunk/portlet/src/main/org/jboss/portal/portlet/container/PortletContainer.java 2007-03-19 00:38:40 UTC (rev 6733)
@@ -38,19 +38,50 @@
public interface PortletContainer
{
+ /**
+ * Return the portlet container id, unique within the context of the parent application.
+ *
+ * @return the id
+ */
+ String getId();
+
+ /**
+ * Returns the runtime meta data of the container.
+ *
+ * @return the info
+ */
PortletInfo getInfo();
- String getId();
-
JBossPortletMetaData getJBossMetaData();
- boolean isStarted();
-
ContentTypes getContentTypes();
+ /**
+ * Return the portlet application of this container.
+ *
+ * @return the application
+ */
PortletApplication getApplication();
+ /**
+ *
+ */
Valve getValve();
+ /**
+ *
+ */
PortletInvocationResponse dispatch(PortletInvocation invocation) throws PortletInvokerException, InvocationException;
+
+ /**
+ * Starts the portlet container.
+ *
+ * @throws Exception any exception preventing the start
+ */
+ void start() throws Exception;
+
+ /**
+ * Stops the portlet container.
+ */
+ void stop();
}
Added: trunk/portlet/src/main/org/jboss/portal/portlet/impl/container/PortletApplicationContextImpl.java
===================================================================
--- trunk/portlet/src/main/org/jboss/portal/portlet/impl/container/PortletApplicationContextImpl.java (rev 0)
+++ trunk/portlet/src/main/org/jboss/portal/portlet/impl/container/PortletApplicationContextImpl.java 2007-03-19 00:38:40 UTC (rev 6733)
@@ -0,0 +1,177 @@
+/******************************************************************************
+ * 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.portlet.impl.container;
+
+import org.jboss.portal.portlet.impl.jsr168.APIFactory;
+import org.jboss.portal.portlet.impl.jsr168.PortletApplicationImpl;
+import org.jboss.portal.portlet.impl.jsr168.PortletContainerImpl;
+import org.jboss.portal.portlet.impl.jsr168.metadata.PortletApplicationMetaData;
+import org.jboss.portal.portlet.impl.jsr168.metadata.PortletMetaData;
+import org.jboss.portal.portlet.metadata.JBossApplicationMetaData;
+import org.jboss.portal.portlet.metadata.JBossPortletMetaData;
+import org.jboss.portal.portlet.container.PortletApplicationContext;
+import org.jboss.portal.portlet.container.PortletApplicationRegistry;
+import org.jboss.portal.portlet.container.PortletApplicationRegistrationContext;
+import org.jboss.portal.portlet.container.PortletContainer;
+
+import javax.servlet.ServletContext;
+import java.util.Iterator;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 6697 $
+ */
+public class PortletApplicationContextImpl implements PortletApplicationContext
+{
+
+ /** . */
+ private PortletApplicationRegistry registry;
+
+ /** . */
+ private APIFactory apiFactory;
+
+ /** . */
+ private PortletApplicationMetaData portletAppMD;
+
+ /** . */
+ private JBossApplicationMetaData jbossAppMD;
+
+ /** . */
+ private PortletApplicationImpl portletApp;
+
+ /** . */
+ private ServletContext servletContext;
+
+ /** . */
+ private ClassLoader classLoader;
+
+ /** . */
+ private PortletApplicationRegistrationContext registrationContext;
+
+ public PortletApplicationContextImpl(
+ PortletApplicationRegistry registry,
+ APIFactory apiFactory,
+ PortletApplicationMetaData portletAppMD,
+ JBossApplicationMetaData jbossAppMD,
+ ServletContext servletContext,
+ ClassLoader classLoader)
+ {
+ this.registry = registry;
+ this.apiFactory = apiFactory;
+ this.portletAppMD = portletAppMD;
+ this.jbossAppMD = jbossAppMD;
+ this.servletContext = servletContext;
+ this.classLoader = classLoader;
+ }
+
+ public PortletApplicationImpl getPortletApplication()
+ {
+ return portletApp;
+ }
+
+ // PortletApplicationContext implementation *************************************************************************
+
+ public void startPortletApplication() throws Exception
+ {
+ portletApp = new PortletApplicationImpl(portletAppMD, jbossAppMD, this, apiFactory);
+ portletApp.start();
+
+ //
+ registrationContext = registry.registerPortletApplication(portletApp);
+
+ //
+ for (Iterator i = portletAppMD.getPortlets().iterator();i.hasNext();)
+ {
+ PortletMetaData portletMD = (PortletMetaData)i.next();
+ PortletContainerImpl container = new PortletContainerImpl(portletMD, (JBossPortletMetaData)jbossAppMD.getPortlets().get(portletMD.getName()));
+
+ //
+ container.setApplication(portletApp);
+ portletApp.addContainer(container);
+
+ //
+ try
+ {
+ container.start();
+ registrationContext.registerPortlet(container);
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace();
+ }
+ }
+ }
+
+ public void stopPortletApplication()
+ {
+ for (Iterator i = portletApp.getPortletContainers().iterator();i.hasNext();)
+ {
+ PortletContainerImpl container = (PortletContainerImpl)i.next();
+ try
+ {
+ registrationContext.unregisterPortlet(container);
+ container.stop();
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace();
+ }
+
+ //
+ portletApp.removeContainer(container);
+ container.setApplication(null);
+ }
+
+ //
+ registry.unregisterPortletApplication(portletApp);
+ portletApp.stop();
+
+ //
+ portletApp = null;
+ registrationContext = null;
+ }
+
+ public void startPortletContainer(String portletName) throws Exception
+ {
+ PortletContainer container = portletApp.getPortletContainer(portletName);
+ container.start();
+ registrationContext.registerPortlet(container);
+ }
+
+ public void stopPortletContainer(String portletName)
+ {
+ PortletContainer container = portletApp.getPortletContainer(portletName);
+ registrationContext.unregisterPortlet(container);
+ container.stop();
+ }
+
+ public ServletContext getServletContext()
+ {
+ return servletContext;
+ }
+
+ public ClassLoader getClassLoader()
+ {
+ return classLoader;
+ }
+}
Property changes on: trunk/portlet/src/main/org/jboss/portal/portlet/impl/container/PortletApplicationContextImpl.java
___________________________________________________________________
Name: svn:executable
+ *
Added: trunk/portlet/src/main/org/jboss/portal/portlet/impl/container/PortletApplicationRegistryImpl.java
===================================================================
--- trunk/portlet/src/main/org/jboss/portal/portlet/impl/container/PortletApplicationRegistryImpl.java (rev 0)
+++ trunk/portlet/src/main/org/jboss/portal/portlet/impl/container/PortletApplicationRegistryImpl.java 2007-03-19 00:38:40 UTC (rev 6733)
@@ -0,0 +1,253 @@
+/******************************************************************************
+ * 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.portlet.impl.container;
+
+import org.jboss.portal.portlet.container.PortletApplicationRegistry;
+import org.jboss.portal.portlet.container.PortletApplicationRegistrationContext;
+import org.jboss.portal.portlet.container.PortletApplication;
+import org.jboss.portal.portlet.container.PortletApplicationRegistryListener;
+import org.jboss.portal.portlet.container.PortletContainer;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @author <a href="mailto:theute@jboss.org">Thomas Heute</a>
+ * @version $Revision: 6720 $
+ */
+public class PortletApplicationRegistryImpl implements PortletApplicationRegistry
+{
+
+ /** . */
+ private Map portletApplications = new HashMap();
+
+ /** . */
+ private Map portletContainers = new HashMap();
+
+ /** . */
+ private List listeners = new ArrayList();
+
+ public PortletApplicationRegistrationContext registerPortletApplication(PortletApplication portletApplication)
+ {
+ if (portletApplication == null)
+ {
+ throw new IllegalArgumentException("No null portlet app accepted");
+ }
+ synchronized (this)
+ {
+ if (portletApplications.containsKey(portletApplication.getId()))
+ {
+ throw new IllegalArgumentException("This portlet app is already registered");
+ }
+ PortletApplicationRegistrationContext ctx = new PortletApplicationRegistrationContextImpl(portletApplication);
+ Map webAppsCopy = new HashMap(portletApplications);
+ webAppsCopy.put(portletApplication.getId(), portletApplication);
+ portletApplications = webAppsCopy;
+ return ctx;
+ }
+ }
+
+ public void unregisterPortletApplication(PortletApplication portletApplication)
+ {
+ if (portletApplication == null)
+ {
+ throw new IllegalArgumentException("No null portlet app accepted");
+ }
+ synchronized (this)
+ {
+ if (!portletApplications.containsKey(portletApplication.getId()))
+ {
+ throw new IllegalArgumentException("This portlet app does not exist here");
+ }
+ Map webAppsCopy = new HashMap(portletApplications);
+ webAppsCopy.remove(portletApplication.getId());
+ portletApplications = webAppsCopy;
+ }
+ }
+
+ public Collection getPortletApplications()
+ {
+ return Collections.unmodifiableCollection(portletApplications.values());
+ }
+
+ public PortletApplication getPortletApplication(String id)
+ {
+ return (PortletApplication)portletApplications.get(id);
+ }
+
+ public void addListener(PortletApplicationRegistryListener listener)
+ {
+ if (listener == null)
+ {
+ throw new IllegalArgumentException("No null listener accepted");
+ }
+ else
+ {
+ synchronized (this)
+ {
+ listeners.add(listener);
+ }
+ }
+ }
+
+ public void removeListener(PortletApplicationRegistryListener listener)
+ {
+ if (listener == null)
+ {
+ throw new IllegalArgumentException("No null listener accepted");
+ }
+ else
+ {
+ synchronized (this)
+ {
+ listeners.remove(listener);
+ }
+ }
+ }
+
+ private void raiseRegisterPortletContainerEvent(PortletContainer portlet)
+ {
+ Iterator it = listeners.iterator();
+ while (it.hasNext())
+ {
+ PortletApplicationRegistryListener listener = (PortletApplicationRegistryListener)it.next();
+ listener.portletContainerRegistered(portlet);
+ }
+ }
+
+ private void raiseUnregisterPortletContainerEvent(PortletContainer portlet)
+ {
+ Iterator it = listeners.iterator();
+ while (it.hasNext())
+ {
+ PortletApplicationRegistryListener listener = (PortletApplicationRegistryListener)it.next();
+ listener.portletContainerUnregistered(portlet);
+ }
+ }
+
+ private static class ContainerKey
+ {
+ /** . */
+ private final String applicationId;
+
+ /** . */
+ private final String containerId;
+
+ public ContainerKey(PortletContainer container)
+ {
+ this.applicationId = container.getApplication().getId();
+ this.containerId = container.getId();
+ }
+
+ public boolean equals(Object obj)
+ {
+ if (obj == this)
+ {
+ return true;
+ }
+ if (obj instanceof ContainerKey)
+ {
+ ContainerKey that = (ContainerKey)obj;
+ return applicationId.equals(that.applicationId) && containerId.equals(containerId);
+ }
+ return false;
+ }
+
+ public int hashCode()
+ {
+ return applicationId.hashCode() & containerId.hashCode();
+ }
+ }
+
+ private class PortletApplicationRegistrationContextImpl implements PortletApplicationRegistrationContext
+ {
+
+ /** . */
+ private PortletApplication portletApplication;
+
+ /** . */
+ private boolean active;
+
+ public PortletApplicationRegistrationContextImpl(PortletApplication portletApplication)
+ {
+ this.portletApplication = portletApplication;
+ this.active = true;
+ }
+
+ public void registerPortlet(PortletContainer portletContainer)
+ {
+ if (portletContainer == null)
+ {
+ throw new IllegalArgumentException("No null portlet accepted");
+ }
+ if (portletContainer.getApplication() != portletApplication)
+ {
+ throw new IllegalArgumentException("The container does not belong to the application owning the registration");
+ }
+ if (!active)
+ {
+ throw new IllegalStateException("Not anymore active");
+ }
+ synchronized (this)
+ {
+ Map componentsCopy = new HashMap(portletContainers);
+ componentsCopy.put(new ContainerKey(portletContainer), portletContainer);
+ portletContainers = componentsCopy;
+
+ //
+ raiseRegisterPortletContainerEvent(portletContainer);
+ }
+ }
+
+ public void unregisterPortlet(PortletContainer portletContainer)
+ {
+ if (portletContainer == null)
+ {
+ throw new IllegalArgumentException("No null portlet accepted");
+ }
+ if (portletContainer.getApplication() != portletApplication)
+ {
+ throw new IllegalArgumentException("The container does not belong to the application owning the registration");
+ }
+ if (!active)
+ {
+ throw new IllegalStateException("Not anymore active");
+ }
+ synchronized (this)
+ {
+ Map componentsCopy = new HashMap(portletContainers);
+ componentsCopy.remove(portletContainer);
+ portletContainers = componentsCopy;
+ raiseUnregisterPortletContainerEvent(portletContainer);
+ }
+ }
+
+ }
+
+}
Property changes on: trunk/portlet/src/main/org/jboss/portal/portlet/impl/container/PortletApplicationRegistryImpl.java
___________________________________________________________________
Name: svn:executable
+ *
Modified: trunk/portlet/src/main/org/jboss/portal/portlet/impl/jsr168/PortletApplicationImpl.java
===================================================================
--- trunk/portlet/src/main/org/jboss/portal/portlet/impl/jsr168/PortletApplicationImpl.java 2007-03-18 23:25:36 UTC (rev 6732)
+++ trunk/portlet/src/main/org/jboss/portal/portlet/impl/jsr168/PortletApplicationImpl.java 2007-03-19 00:38:40 UTC (rev 6733)
@@ -27,7 +27,6 @@
import org.jboss.portal.portlet.metadata.JBossApplicationMetaData;
import org.jboss.portal.portlet.container.PortletApplication;
import org.jboss.portal.portlet.container.PortletApplicationContext;
-import org.jboss.portal.portlet.container.PortletApplicationRegistrationContext;
import org.jboss.portal.portlet.container.PortletContainer;
import javax.portlet.PortletContext;
@@ -70,16 +69,15 @@
/** . */
protected APIFactory apiFactory;
- /** . */
- protected PortletApplicationRegistrationContext registrationContext;
-
public PortletApplicationImpl(
PortletApplicationMetaData metaData,
JBossApplicationMetaData jbossMetaData,
- PortletApplicationContext context)
+ PortletApplicationContext context,
+ APIFactory apiFactory)
{
this.metaData = metaData;
this.jbossMetaData = jbossMetaData;
+ this.apiFactory = apiFactory;
this.portlets = new LinkedHashMap();
this.context = context;
}
@@ -89,26 +87,11 @@
return metaData.getId();
}
- public PortletApplicationRegistrationContext getRegistrationContext()
- {
- return registrationContext;
- }
-
- public void setRegistrationContext(PortletApplicationRegistrationContext registrationContext)
- {
- this.registrationContext = registrationContext;
- }
-
public APIFactory getAPIFactory()
{
return apiFactory;
}
- public void setAPIFactory(APIFactory apiFactory)
- {
- this.apiFactory = apiFactory;
- }
-
public PortletApplicationMetaData getMetaData()
{
return metaData;
@@ -122,21 +105,15 @@
public void addContainer(PortletContainer container)
{
portlets.put(container.getId(), container);
- registrationContext.registerPortlet(container);
}
public void removeContainer(PortletContainer container)
{
- registrationContext.unregisterPortlet(container);
portlets.remove(container.getId());
}
//
- public void create() throws Exception
- {
- }
-
public void start() throws Exception
{
version = metaData.getVersion();
@@ -153,10 +130,6 @@
portletContext = null;
}
- public void destroy()
- {
- }
-
public String getVersion()
{
return version;
@@ -177,16 +150,6 @@
return windowStates;
}
- public void start(String portletName) throws Exception
- {
- context.startPortlet(portletName);
- }
-
- public void stop(String portletName) throws Exception
- {
- context.stopPortlet(portletName);
- }
-
// WebApp implementation ********************************************************************************************
public Set getPortletContainers()
Modified: trunk/portlet/src/main/org/jboss/portal/portlet/impl/jsr168/PortletContainerImpl.java
===================================================================
--- trunk/portlet/src/main/org/jboss/portal/portlet/impl/jsr168/PortletContainerImpl.java 2007-03-18 23:25:36 UTC (rev 6732)
+++ trunk/portlet/src/main/org/jboss/portal/portlet/impl/jsr168/PortletContainerImpl.java 2007-03-19 00:38:40 UTC (rev 6733)
@@ -121,9 +121,8 @@
*/
protected PreferencesValidator preferencesValidator;
- public PortletContainerImpl(PortletApplicationImpl application, PortletMetaData metaData, JBossPortletMetaData jbossMetaData)
+ public PortletContainerImpl(PortletMetaData metaData, JBossPortletMetaData jbossMetaData)
{
- this.application = application;
this.metaData = metaData;
this.jbossMetaData = jbossMetaData;
this.valve = new Valve();
@@ -251,9 +250,6 @@
// Let invocation flow in
valve.open();
-
- // Register
- // webApp.addContainer(this);
}
catch (IllegalAccessException e)
{
@@ -283,9 +279,6 @@
public void stop()
{
- //
- // webApp.removeContainer(this);
-
// Wait at most 60 seconds before all invocations are done
log.debug("Trying to close the valve");
boolean done = valve.closing(60000);
@@ -346,6 +339,11 @@
return application;
}
+ public void setApplication(PortletApplicationImpl application)
+ {
+ this.application = application;
+ }
+
public Valve getValve()
{
return valve;
Modified: trunk/portlet-server/build.xml
===================================================================
--- trunk/portlet-server/build.xml 2007-03-18 23:25:36 UTC (rev 6732)
+++ trunk/portlet-server/build.xml 2007-03-19 00:38:40 UTC (rev 6733)
@@ -90,7 +90,6 @@
<path id="library.classpath">
<path refid="dom4j.dom4j.classpath"/>
<path refid="jboss.jbossxb.classpath"/>
- <path refid="jboss.microcontainer.classpath"/>
<path refid="jboss.serialization.classpath"/>
<path refid="oswego.concurrent.classpath"/>
<path refid="apache.httpclient.classpath"/>
Modified: trunk/portlet-server/src/main/org/jboss/portal/portlet/deployment/jboss/PortletAppDeployment.java
===================================================================
--- trunk/portlet-server/src/main/org/jboss/portal/portlet/deployment/jboss/PortletAppDeployment.java 2007-03-18 23:25:36 UTC (rev 6732)
+++ trunk/portlet-server/src/main/org/jboss/portal/portlet/deployment/jboss/PortletAppDeployment.java 2007-03-19 00:38:40 UTC (rev 6733)
@@ -22,26 +22,15 @@
******************************************************************************/
package org.jboss.portal.portlet.deployment.jboss;
-import org.jboss.beans.metadata.plugins.AbstractBeanMetaData;
-import org.jboss.beans.metadata.plugins.AbstractConstructorMetaData;
-import org.jboss.beans.metadata.plugins.AbstractDependencyMetaData;
-import org.jboss.beans.metadata.plugins.AbstractDependencyValueMetaData;
-import org.jboss.beans.metadata.plugins.AbstractParameterMetaData;
-import org.jboss.beans.metadata.plugins.AbstractPropertyMetaData;
import org.jboss.deployment.DeploymentException;
-import org.jboss.kernel.Kernel;
-import org.jboss.kernel.plugins.bootstrap.basic.BasicBootstrap;
import org.jboss.portal.common.util.Tools;
import org.jboss.portal.common.xml.NullEntityResolver;
-import org.jboss.portal.portlet.container.PortletApplicationContextImpl;
-import org.jboss.portal.portlet.container.PortletApplicationRegistry;
+import org.jboss.portal.portlet.impl.container.PortletApplicationContextImpl;
import org.jboss.portal.portlet.deployment.JBossApplicationMetaDataFactory;
import org.jboss.portal.portlet.deployment.PortletApplicationMetaDataFactory;
import org.jboss.portal.portlet.deployment.ValueTrimmingFilter;
-import org.jboss.portal.portlet.impl.jsr168.APIFactory;
import org.jboss.portal.portlet.impl.jsr168.metadata.PortletApplicationMetaData;
import org.jboss.portal.portlet.impl.jsr168.metadata.PortletMetaData;
-import org.jboss.portal.portlet.deployment.jboss.PortletContainerAdapter;
import org.jboss.portal.portlet.metadata.JBossApplicationMetaData;
import org.jboss.portal.portlet.metadata.JBossPortletMetaData;
import org.jboss.portal.portlet.metadata.PolicyPermissionMetaData;
@@ -63,10 +52,8 @@
import java.io.IOException;
import java.io.InputStream;
import java.net.URL;
-import java.util.ArrayList;
import java.util.HashSet;
import java.util.Iterator;
-import java.util.List;
import java.util.Map;
import java.util.Set;
@@ -90,11 +77,8 @@
protected PortletAppDeploymentFactory factory;
/** . */
- protected Kernel kernel;
+ protected PortletApplicationContextImpl portletApplicationContext;
- /** . */
- protected List beans;
-
public PortletAppDeployment(URL url, PortalWebApp pwa, MBeanServer mbeanServer, PortletAppDeploymentFactory factory)
{
super(url, pwa, mbeanServer);
@@ -106,23 +90,8 @@
importTLD();
//
- beans = new ArrayList();
-
- //
try
{
- BasicBootstrap bootstrap = new BasicBootstrap();
- bootstrap.run();
- kernel = bootstrap.getKernel();
- }
- catch (Exception e)
- {
- throw new DeploymentException(e);
- }
-
- //
- try
- {
portletAppMD = buildPortletApplicationMetaData();
jbossAppMD = buildJBossApplicationMetaData();
@@ -170,62 +139,17 @@
{
try
{
- // Controller meta data
- AbstractBeanMetaData webAppBMD = new AbstractBeanMetaData(
- "portal:container=WebApp,id=" + portletAppMD.getId(),
- PortletApplicationContextImpl.class.getName());
+ portletApplicationContext = new PortletApplicationContextImpl(
+ factory.getWebAppRegistry(),
+ factory.getAPIFactory(),
+ portletAppMD,
+ jbossAppMD,
+ pwa.getServletContext(),
+ pwa.getClassLoader()
+ );
- // Constructor
- AbstractConstructorMetaData webAppCMD = new AbstractConstructorMetaData();
- List webAppParamsCMD = new ArrayList();
- webAppParamsCMD.add(new AbstractParameterMetaData(PortletApplicationRegistry.class.getName(), factory.getWebAppRegistry()));
- webAppParamsCMD.add(new AbstractParameterMetaData(APIFactory.class.getName(), factory.getAPIFactory()));
- webAppParamsCMD.add(new AbstractParameterMetaData(portletAppMD));
- webAppParamsCMD.add(new AbstractParameterMetaData(JBossApplicationMetaData.class.getName(), jbossAppMD));
- webAppParamsCMD.add(new AbstractParameterMetaData(ServletContext.class.getName(), pwa.getServletContext()));
- webAppParamsCMD.add(new AbstractParameterMetaData(ClassLoader.class.getName(), pwa.getClassLoader()));
- webAppCMD.setParameters(webAppParamsCMD);
- webAppBMD.setConstructor(webAppCMD);
-
- // Installation
- beans.add(webAppBMD);
- kernel.getController().install(webAppBMD);
-
// Install portlet containers
- for (Iterator i = portletAppMD.getPortlets().iterator(); i.hasNext();)
- {
- PortletMetaData portletMD = (PortletMetaData)i.next();
-
- // Get specific dd meta data
- JBossPortletMetaData jbossPortletMD = (JBossPortletMetaData)jbossAppMD.getPortlets().get(portletMD.getName());
-
- // Controller meta data
- AbstractBeanMetaData containerBMD = new AbstractBeanMetaData(
- "portal:container=Portlet,id=" + portletAppMD.getId() + "." + portletMD.getName(),
- PortletContainerAdapter.class.getName());
-
- // Constructor
- AbstractConstructorMetaData containerCMD = new AbstractConstructorMetaData();
- List containerParamsCMD = new ArrayList();
- containerParamsCMD.add(new AbstractParameterMetaData(portletMD));
- containerParamsCMD.add(new AbstractParameterMetaData(JBossPortletMetaData.class.getName(), jbossPortletMD));
- containerCMD.setParameters(containerParamsCMD);
- containerBMD.setConstructor(containerCMD);
-
- // Properties
- HashSet containerProps = new HashSet();
- containerProps.add(new AbstractPropertyMetaData("portletWebAppAdapter", new AbstractDependencyValueMetaData(webAppBMD.getName())));
- containerBMD.setProperties(containerProps);
-
- // Dependencies
- HashSet portletContainerDmds = new HashSet();
- portletContainerDmds.add(new AbstractDependencyMetaData(webAppBMD.getName()));
- containerBMD.setDemands(portletContainerDmds);
-
- // Installation
- beans.add(containerBMD);
- kernel.getController().install(containerBMD);
- }
+ portletApplicationContext.startPortletApplication();
}
catch (Throwable e)
{
@@ -311,11 +235,7 @@
public void destroy() throws DeploymentException
{
- for (int i = beans.size() - 1; i >= 0; i--)
- {
- AbstractBeanMetaData bmd = (AbstractBeanMetaData)beans.get(i);
- kernel.getController().uninstall(bmd.getName());
- }
+ portletApplicationContext.stopPortletApplication();
}
/** Import the portlet jsp tag TLD in the deployed application. */
Deleted: trunk/portlet-server/src/main/org/jboss/portal/portlet/deployment/jboss/PortletContainerAdapter.java
===================================================================
--- trunk/portlet-server/src/main/org/jboss/portal/portlet/deployment/jboss/PortletContainerAdapter.java 2007-03-18 23:25:36 UTC (rev 6732)
+++ trunk/portlet-server/src/main/org/jboss/portal/portlet/deployment/jboss/PortletContainerAdapter.java 2007-03-19 00:38:40 UTC (rev 6733)
@@ -1,89 +0,0 @@
-/******************************************************************************
- * JBoss, a division of Red Hat *
- * Copyright 2006, Red Hat Middleware, LLC, and individual *
- * contributors as indicated by the @authors tag. See the *
- * copyright.txt in the distribution for a full listing of *
- * individual contributors. *
- * *
- * This is free software; you can redistribute it and/or modify it *
- * under the terms of the GNU Lesser General Public License as *
- * published by the Free Software Foundation; either version 2.1 of *
- * the License, or (at your option) any later version. *
- * *
- * This software is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
- * Lesser General Public License for more details. *
- * *
- * You should have received a copy of the GNU Lesser General Public *
- * License along with this software; if not, write to the Free *
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
- ******************************************************************************/
-package org.jboss.portal.portlet.deployment.jboss;
-
-import org.jboss.portal.portlet.impl.jsr168.metadata.PortletMetaData;
-import org.jboss.portal.portlet.impl.jsr168.PortletContainerImpl;
-import org.jboss.portal.portlet.impl.jsr168.PortletApplicationImpl;
-import org.jboss.portal.portlet.metadata.JBossPortletMetaData;
-import org.jboss.portal.portlet.container.PortletApplicationContextImpl;
-import org.jboss.portal.portlet.container.PortletContainer;
-
-/**
- * Adapt the life cycle of micro container to the portlet container impl.
- *
- * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
- * @version $Revision: 6700 $
- */
-public class PortletContainerAdapter
-{
-
- /** . */
- private PortletMetaData portletMD;
-
- /** . */
- private JBossPortletMetaData jbossPortletMD;
-
- /** . */
- private PortletApplicationContextImpl portletApplicationContext;
-
- /** . */
- private PortletContainerImpl portletContainer;
-
- public PortletContainerAdapter(PortletMetaData portletMD, JBossPortletMetaData jbossPortletMD)
- {
- this.portletMD = portletMD;
- this.jbossPortletMD = jbossPortletMD;
- }
-
- public PortletApplicationContextImpl getPortletApplicationContext()
- {
- return portletApplicationContext;
- }
-
- public void setPortletWebAppAdapter(PortletApplicationContextImpl portletApplicationContext)
- {
- this.portletApplicationContext = portletApplicationContext;
- }
-
- public PortletContainer getPortletContainer()
- {
- return portletContainer;
- }
-
- public void start() throws Exception
- {
- PortletApplicationImpl portletApp = portletApplicationContext.getPortletApplication();
- portletContainer = new PortletContainerImpl(portletApp, portletMD, jbossPortletMD);
- portletContainer.start();
- portletApp.addContainer(portletContainer);
- }
-
- public void stop()
- {
- PortletApplicationImpl portletApp = portletApplicationContext.getPortletApplication();
- portletApp.removeContainer(portletContainer);
- portletContainer.stop();
- portletContainer = null;
- }
-}
Modified: trunk/portlet-server/src/resources/tck-sar/META-INF/jboss-service.xml
===================================================================
--- trunk/portlet-server/src/resources/tck-sar/META-INF/jboss-service.xml 2007-03-18 23:25:36 UTC (rev 6732)
+++ trunk/portlet-server/src/resources/tck-sar/META-INF/jboss-service.xml 2007-03-19 00:38:40 UTC (rev 6733)
@@ -143,7 +143,7 @@
<!-- Webapp registry -->
<mbean
- code="org.jboss.portal.portlet.container.PortletApplicationRegistryImpl"
+ code="org.jboss.portal.portlet.impl.container.PortletApplicationRegistryImpl"
name="portal:service=WebAppRegistry"
xmbean-dd=""
xmbean-code="org.jboss.portal.jems.as.system.JBossServiceModelMBean">
Modified: trunk/portlet-server/src/resources/test/info/test-info-sar/META-INF/jboss-service.xml
===================================================================
--- trunk/portlet-server/src/resources/test/info/test-info-sar/META-INF/jboss-service.xml 2007-03-18 23:25:36 UTC (rev 6732)
+++ trunk/portlet-server/src/resources/test/info/test-info-sar/META-INF/jboss-service.xml 2007-03-19 00:38:40 UTC (rev 6733)
@@ -84,7 +84,7 @@
<!-- Webapp registry -->
<mbean
- code="org.jboss.portal.portlet.container.PortletApplicationRegistryImpl"
+ code="org.jboss.portal.portlet.impl.container.PortletApplicationRegistryImpl"
name="portal:service=WebAppRegistry"
xmbean-dd=""
xmbean-code="org.jboss.portal.jems.as.system.JBossServiceModelMBean">
Modified: trunk/portlet-server/src/resources/test-sar/META-INF/jboss-service.xml
===================================================================
--- trunk/portlet-server/src/resources/test-sar/META-INF/jboss-service.xml 2007-03-18 23:25:36 UTC (rev 6732)
+++ trunk/portlet-server/src/resources/test-sar/META-INF/jboss-service.xml 2007-03-19 00:38:40 UTC (rev 6733)
@@ -190,7 +190,7 @@
<!-- Webapp registry -->
<mbean
- code="org.jboss.portal.portlet.container.PortletApplicationRegistryImpl"
+ code="org.jboss.portal.portlet.impl.container.PortletApplicationRegistryImpl"
name="portal:service=WebAppRegistry"
xmbean-dd=""
xmbean-code="org.jboss.portal.jems.as.system.JBossServiceModelMBean">
Modified: trunk/wsrp/src/resources/tests/test-wsrp-producer-sar/META-INF/jboss-service.xml
===================================================================
--- trunk/wsrp/src/resources/tests/test-wsrp-producer-sar/META-INF/jboss-service.xml 2007-03-18 23:25:36 UTC (rev 6732)
+++ trunk/wsrp/src/resources/tests/test-wsrp-producer-sar/META-INF/jboss-service.xml 2007-03-19 00:38:40 UTC (rev 6733)
@@ -55,7 +55,7 @@
<!-- Webapp registry -->
<mbean
- code="org.jboss.portal.portlet.container.PortletApplicationRegistryImpl"
+ code="org.jboss.portal.portlet.impl.container.PortletApplicationRegistryImpl"
name="portal:service=WebAppRegistry"
xmbean-dd=""
xmbean-code="org.jboss.portal.jems.as.system.JBossServiceModelMBean">
17 years, 6 months
JBoss Portal SVN: r6732 - in trunk/wsrp/src/main/org/jboss/portal: test/wsrp/v1/consumer/behaviors and 2 other directories.
by portal-commits@lists.jboss.org
Author: chris.laprun(a)jboss.com
Date: 2007-03-18 19:25:36 -0400 (Sun, 18 Mar 2007)
New Revision: 6732
Added:
trunk/wsrp/src/main/org/jboss/portal/wsrp/WSRPExceptionFactory.java
Modified:
trunk/wsrp/src/main/org/jboss/portal/test/wsrp/framework/BehaviorRegistry.java
trunk/wsrp/src/main/org/jboss/portal/test/wsrp/v1/consumer/behaviors/BasicPortletManagementBehavior.java
trunk/wsrp/src/main/org/jboss/portal/test/wsrp/v1/consumer/behaviors/DestroyClonesPortletManagementBehavior.java
trunk/wsrp/src/main/org/jboss/portal/wsrp/WSRPUtils.java
trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/ActionRequestProcessor.java
trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/MarkupHandler.java
trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/PortletManagementHandler.java
trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/RegistrationHandler.java
trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/RequestProcessor.java
trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/ServiceDescriptionHandler.java
trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/WSRPProducerImpl.java
Log:
JBPORTAL-1167:
- Extracted exception related methods from WSRPUtils to new WSRPExceptionFactory.
- Started implementing better Exception creation.
Modified: trunk/wsrp/src/main/org/jboss/portal/test/wsrp/framework/BehaviorRegistry.java
===================================================================
--- trunk/wsrp/src/main/org/jboss/portal/test/wsrp/framework/BehaviorRegistry.java 2007-03-18 23:12:54 UTC (rev 6731)
+++ trunk/wsrp/src/main/org/jboss/portal/test/wsrp/framework/BehaviorRegistry.java 2007-03-18 23:25:36 UTC (rev 6732)
@@ -23,7 +23,7 @@
package org.jboss.portal.test.wsrp.framework;
-import org.jboss.portal.wsrp.WSRPUtils;
+import org.jboss.portal.wsrp.WSRPExceptionFactory;
import org.jboss.portal.wsrp.core.InvalidHandleFault;
import java.util.HashMap;
@@ -65,7 +65,7 @@
{
return (MarkupBehavior)behaviors.get(handle);
}
- throw (InvalidHandleFault)WSRPUtils.createFaultFrom(InvalidHandleFault.class,
+ throw (InvalidHandleFault)WSRPExceptionFactory.createFaultFrom(InvalidHandleFault.class,
new IllegalArgumentException("There is no registered MarkupBehavior for handle '" + handle + "'"));
}
Modified: trunk/wsrp/src/main/org/jboss/portal/test/wsrp/v1/consumer/behaviors/BasicPortletManagementBehavior.java
===================================================================
--- trunk/wsrp/src/main/org/jboss/portal/test/wsrp/v1/consumer/behaviors/BasicPortletManagementBehavior.java 2007-03-18 23:12:54 UTC (rev 6731)
+++ trunk/wsrp/src/main/org/jboss/portal/test/wsrp/v1/consumer/behaviors/BasicPortletManagementBehavior.java 2007-03-18 23:25:36 UTC (rev 6732)
@@ -26,8 +26,8 @@
import org.jboss.portal.test.wsrp.framework.BehaviorRegistry;
import org.jboss.portal.test.wsrp.framework.MarkupBehavior;
import org.jboss.portal.test.wsrp.framework.PortletManagementBehavior;
+import org.jboss.portal.wsrp.WSRPExceptionFactory;
import org.jboss.portal.wsrp.WSRPTypeFactory;
-import org.jboss.portal.wsrp.WSRPUtils;
import org.jboss.portal.wsrp.core.AccessDeniedFault;
import org.jboss.portal.wsrp.core.ClonePortlet;
import org.jboss.portal.wsrp.core.DestroyFailed;
@@ -76,12 +76,12 @@
OperationFailedFault, InvalidHandleFault, InvalidRegistrationFault, InconsistentParametersFault,
MissingParametersFault, RemoteException
{
- WSRPUtils.throwOperationFailedFaultIfValueIsMissing(clonePortlet, "ClonePortlet");
+ WSRPExceptionFactory.throwOperationFailedFaultIfValueIsMissing(clonePortlet, "ClonePortlet");
String handle = getHandleFrom(clonePortlet.getPortletContext(), "ClonePortlet");
if (!BasicMarkupBehavior.PORTLET_HANDLE.equals(handle))
{
- throw (InvalidHandleFault)WSRPUtils.createFaultFrom(InvalidHandleFault.class, null);
+ throw (InvalidHandleFault)WSRPExceptionFactory.createFaultFrom(InvalidHandleFault.class, null);
}
return WSRPTypeFactory.createPortletContext(CLONED_HANDLE);
@@ -92,7 +92,7 @@
throws AccessDeniedFault, InvalidHandleFault, InvalidUserCategoryFault, InconsistentParametersFault,
MissingParametersFault, InvalidRegistrationFault, OperationFailedFault, RemoteException
{
- WSRPUtils.throwOperationFailedFaultIfValueIsMissing(getPortletDescription, "GetPortletDescription");
+ WSRPExceptionFactory.throwOperationFailedFaultIfValueIsMissing(getPortletDescription, "GetPortletDescription");
String handle = getHandleFrom(getPortletDescription.getPortletContext(), "GetPortletDescription");
// need to fake that the clone exists... so remove suffix to get the description of the POP
@@ -117,7 +117,7 @@
public PropertyList getPortletProperties(GetPortletProperties getPortletProperties) throws InvalidHandleFault, MissingParametersFault, InvalidRegistrationFault, AccessDeniedFault, OperationFailedFault, InconsistentParametersFault, InvalidUserCategoryFault, RemoteException
{
- WSRPUtils.throwOperationFailedFaultIfValueIsMissing(getPortletProperties, "GetPortletProperties");
+ WSRPExceptionFactory.throwOperationFailedFaultIfValueIsMissing(getPortletProperties, "GetPortletProperties");
String handle = getHandleFrom(getPortletProperties.getPortletContext(), "GetPortletProperties");
PropertyList result = WSRPTypeFactory.createPropertyList();
if (BasicMarkupBehavior.PORTLET_HANDLE.equals(handle))
@@ -137,7 +137,7 @@
}
else
{
- throw (InvalidHandleFault)WSRPUtils.createFaultFrom(InvalidHandleFault.class,
+ throw (InvalidHandleFault)WSRPExceptionFactory.createFaultFrom(InvalidHandleFault.class,
new IllegalArgumentException("Unknown handle '" + handle + "'"));
}
@@ -150,12 +150,12 @@
InvalidHandleFault, MissingParametersFault, InconsistentParametersFault, InvalidUserCategoryFault,
AccessDeniedFault, InvalidRegistrationFault, RemoteException
{
- WSRPUtils.throwOperationFailedFaultIfValueIsMissing(setPortletProperties, "SetPortletProperties");
+ WSRPExceptionFactory.throwOperationFailedFaultIfValueIsMissing(setPortletProperties, "SetPortletProperties");
String handle = getHandleFrom(setPortletProperties.getPortletContext(), "SetPortletProperties");
if (!(CLONED_HANDLE).equals(handle))
{
- throw WSRPUtils.createOperationFailedFault(new IllegalArgumentException("Cannot modify portlet '" + handle + "'"));
+ throw WSRPExceptionFactory.createOperationFailedFault(new IllegalArgumentException("Cannot modify portlet '" + handle + "'"));
}
return setPortletProperties.getPortletContext();
@@ -163,12 +163,12 @@
private String getHandleFrom(PortletContext portletContext, String context) throws MissingParametersFault, InvalidHandleFault
{
- WSRPUtils.throwMissingParametersFaultIfValueIsMissing(portletContext, "portlet context", context);
+ WSRPExceptionFactory.throwMissingParametersFaultIfValueIsMissing(portletContext, "portlet context", context);
String handle = portletContext.getPortletHandle();
- WSRPUtils.throwMissingParametersFaultIfValueIsMissing(handle, "portlet handle", "PortletContext");
+ WSRPExceptionFactory.throwMissingParametersFaultIfValueIsMissing(handle, "portlet handle", "PortletContext");
if (handle.length() == 0)
{
- throw (InvalidHandleFault)WSRPUtils.createFaultFrom(InvalidHandleFault.class, null);
+ throw (InvalidHandleFault)WSRPExceptionFactory.createFaultFrom(InvalidHandleFault.class, null);
}
return handle;
@@ -177,12 +177,12 @@
public DestroyPortletsResponse destroyPortlets(DestroyPortlets destroyPortlets) throws InconsistentParametersFault, MissingParametersFault, InvalidRegistrationFault, OperationFailedFault, RemoteException
{
- WSRPUtils.throwOperationFailedFaultIfValueIsMissing(destroyPortlets, "DestroyPortlets");
+ WSRPExceptionFactory.throwOperationFailedFaultIfValueIsMissing(destroyPortlets, "DestroyPortlets");
String[] handles = destroyPortlets.getPortletHandles();
- WSRPUtils.throwMissingParametersFaultIfValueIsMissing(handles, "portlet handles", "DestroyPortlets");
+ WSRPExceptionFactory.throwMissingParametersFaultIfValueIsMissing(handles, "portlet handles", "DestroyPortlets");
if (handles.length == 0)
{
- WSRPUtils.throwMissingParametersFaultIfValueIsMissing(handles, "portlet handles", "DestroyPortlets");
+ WSRPExceptionFactory.throwMissingParametersFaultIfValueIsMissing(handles, "portlet handles", "DestroyPortlets");
}
List failures = new ArrayList();
Modified: trunk/wsrp/src/main/org/jboss/portal/test/wsrp/v1/consumer/behaviors/DestroyClonesPortletManagementBehavior.java
===================================================================
--- trunk/wsrp/src/main/org/jboss/portal/test/wsrp/v1/consumer/behaviors/DestroyClonesPortletManagementBehavior.java 2007-03-18 23:12:54 UTC (rev 6731)
+++ trunk/wsrp/src/main/org/jboss/portal/test/wsrp/v1/consumer/behaviors/DestroyClonesPortletManagementBehavior.java 2007-03-18 23:25:36 UTC (rev 6732)
@@ -24,7 +24,7 @@
package org.jboss.portal.test.wsrp.v1.consumer.behaviors;
import org.jboss.portal.test.wsrp.framework.BehaviorRegistry;
-import org.jboss.portal.wsrp.WSRPUtils;
+import org.jboss.portal.wsrp.WSRPExceptionFactory;
import org.jboss.portal.wsrp.core.AccessDeniedFault;
import org.jboss.portal.wsrp.core.GetPortletDescription;
import org.jboss.portal.wsrp.core.InconsistentParametersFault;
@@ -66,7 +66,7 @@
}
else
{
- throw (InvalidHandleFault)WSRPUtils.createFaultFrom(InvalidHandleFault.class,
+ throw (InvalidHandleFault)WSRPExceptionFactory.createFaultFrom(InvalidHandleFault.class,
new IllegalArgumentException("Invalid portlet handle: "
+ getPortletDescription.getPortletContext().getPortletHandle()));
}
Added: trunk/wsrp/src/main/org/jboss/portal/wsrp/WSRPExceptionFactory.java
===================================================================
--- trunk/wsrp/src/main/org/jboss/portal/wsrp/WSRPExceptionFactory.java (rev 0)
+++ trunk/wsrp/src/main/org/jboss/portal/wsrp/WSRPExceptionFactory.java 2007-03-18 23:25:36 UTC (rev 6732)
@@ -0,0 +1,140 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2007, 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.wsrp;
+
+import org.jboss.portal.wsrp.core.Fault;
+import org.jboss.portal.wsrp.core.MissingParametersFault;
+import org.jboss.portal.wsrp.core.OperationFailedFault;
+import org.jboss.portal.wsrp.servlet.ServletAccess;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.xml.namespace.QName;
+import javax.xml.rpc.soap.SOAPFaultException;
+import javax.xml.soap.Detail;
+import javax.xml.soap.SOAPException;
+import javax.xml.soap.SOAPFactory;
+
+/**
+ * @author <a href="mailto:chris.laprun@jboss.com">Chris Laprun</a>
+ * @version $Revision$
+ * @since 2.6
+ */
+public class WSRPExceptionFactory
+{
+
+ private static final String NS = "urn:oasis:names:tc:wsrp:c1:types";
+
+ public static final String ACCESS_DENIED = "AccessDenied";
+ public static final String INCONSISTENT_PARAMETERS = "InconsistentParameters";
+ public static final String INVALID_REGISTRATION = "InvalidRegistration";
+ public static final String INVALID_COOKIE = "InvalidCookie";
+ public static final String INVALID_HANDLE = "InvalidHandle";
+ public static final String INVALID_SESSION = "InvalidSession";
+ public static final String INVALID_USER_CATEGORY = "InvalidUserCategory";
+ public static final String MISSING_PARAMETERS = "MissingParameters";
+ public static final String OPERATION_FAILED = "OperationFailed";
+ public static final String PORTLET_STATE_CHANGE_REQUIRED = "PortletStateChangeRequired";
+ public static final String UNSUPPORTED_LOCALE = "UnsupportedLocale";
+ public static final String UNSUPPORTED_MIME_TYPE = "UnsupportedMimeType";
+ public static final String UNSUPPORTED_MODE = "UnsupportedMode";
+ public static final String UNSUPPORTED_WINDOW_STATE = "UnsupportedWindowState";
+
+
+ /**
+ * Create a new OperationFailedFault based on the specified cause.
+ *
+ * @param cause the cause why the operation failed
+ * @return a new OperationFailedFault based on the specified cause.
+ */
+ public static OperationFailedFault createOperationFailedFault(Throwable cause)
+ {
+ return (OperationFailedFault)createFaultFrom(OperationFailedFault.class, cause);
+ }
+
+ public static Fault createFaultFrom(Class faultClass, Throwable cause)
+ {
+ Fault fault = null;
+ try
+ {
+ fault = (Fault)faultClass.newInstance();
+ fault.initCause(cause);
+ }
+ catch (Exception e)
+ {
+ // shouldn't happen
+ e.printStackTrace();
+ }
+ return fault;
+ }
+
+ public static void throwMissingParametersFaultIfValueIsMissing(Object valueToCheck, String valueName, String context)
+ throws MissingParametersFault
+ {
+ if (valueToCheck == null)
+ {
+ throw (MissingParametersFault)
+ createFaultFrom(MissingParametersFault.class, new NullPointerException("Missing required " + valueName
+ + (context != null ? " in " + context : "")));
+ }
+ }
+
+ public static void throwOperationFailedFaultIfValueIsMissing(Object valueToCheck, String valueName)
+ throws OperationFailedFault
+ {
+ if (valueToCheck == null)
+ {
+ throw (OperationFailedFault)
+ createFaultFrom(OperationFailedFault.class, new NullPointerException("Missing required " + valueName));
+ }
+ }
+
+
+ public static SOAPFaultException throwSOAPFaultException(String errorCode, String message, Exception cause)
+ {
+ throw createSOAPFaultException(errorCode, message, cause);
+ }
+
+ private static SOAPFaultException createSOAPFaultException(String errorCode, String message, Exception cause)
+ {
+ Detail detail = null;
+ if (cause != null)
+ {
+ try
+ {
+ detail = SOAPFactory.newInstance().createDetail();
+ detail.addChildElement("cause").addTextNode(cause.getLocalizedMessage());
+ }
+ catch (SOAPException e)
+ {
+ e.printStackTrace();
+ }
+ }
+
+ HttpServletRequest req = ServletAccess.getRequest();
+ String actor = req.getScheme() + "://" + req.getServerName() + ":" + req.getServerPort() + "/" + req.getServletPath();
+
+
+ return new SOAPFaultException(new QName(NS, errorCode), message, actor, detail);
+ }
+}
\ No newline at end of file
Property changes on: trunk/wsrp/src/main/org/jboss/portal/wsrp/WSRPExceptionFactory.java
___________________________________________________________________
Name: svn:keywords
+ Author Date Id Revision
Name: svn:eol-style
+ native
Modified: trunk/wsrp/src/main/org/jboss/portal/wsrp/WSRPUtils.java
===================================================================
--- trunk/wsrp/src/main/org/jboss/portal/wsrp/WSRPUtils.java 2007-03-18 23:12:54 UTC (rev 6731)
+++ trunk/wsrp/src/main/org/jboss/portal/wsrp/WSRPUtils.java 2007-03-18 23:25:36 UTC (rev 6732)
@@ -32,10 +32,7 @@
import org.jboss.portal.portlet.PortletURL;
import org.jboss.portal.portlet.RenderURL;
import org.jboss.portal.portlet.state.AccessMode;
-import org.jboss.portal.wsrp.core.Fault;
-import org.jboss.portal.wsrp.core.MissingParametersFault;
import org.jboss.portal.wsrp.core.ModelDescription;
-import org.jboss.portal.wsrp.core.OperationFailedFault;
import org.jboss.portal.wsrp.core.PropertyDescription;
import org.jboss.portal.wsrp.core.StateChange;
import org.jboss.portal.wsrp.registration.LocalizedString;
@@ -251,54 +248,6 @@
}
/**
- * Create a new OperationFailedFault based on the specified cause.
- *
- * @param cause the cause why the operation failed
- * @return a new OperationFailedFault based on the specified cause.
- */
- public static OperationFailedFault createOperationFailedFault(Throwable cause)
- {
- return (OperationFailedFault)createFaultFrom(OperationFailedFault.class, cause);
- }
-
- public static Fault createFaultFrom(Class faultClass, Throwable cause)
- {
- Fault fault = null;
- try
- {
- fault = (Fault)faultClass.newInstance();
- fault.initCause(cause);
- }
- catch (Exception e)
- {
- // shouldn't happen
- e.printStackTrace();
- }
- return fault;
- }
-
- public static void throwMissingParametersFaultIfValueIsMissing(Object valueToCheck, String valueName, String context)
- throws MissingParametersFault
- {
- if (valueToCheck == null)
- {
- throw (MissingParametersFault)
- createFaultFrom(MissingParametersFault.class, new NullPointerException("Missing required " + valueName
- + (context != null ? " in " + context : "")));
- }
- }
-
- public static void throwOperationFailedFaultIfValueIsMissing(Object valueToCheck, String valueName)
- throws OperationFailedFault
- {
- if (valueToCheck == null)
- {
- throw (OperationFailedFault)
- createFaultFrom(OperationFailedFault.class, new NullPointerException("Missing required " + valueName));
- }
- }
-
- /**
* @param registrationInfo
* @return
* @since 2.6
Modified: trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/ActionRequestProcessor.java
===================================================================
--- trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/ActionRequestProcessor.java 2007-03-18 23:12:54 UTC (rev 6731)
+++ trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/ActionRequestProcessor.java 2007-03-18 23:25:36 UTC (rev 6732)
@@ -23,6 +23,7 @@
package org.jboss.portal.wsrp.producer;
+import org.jboss.portal.common.util.MarkupInfo;
import org.jboss.portal.portlet.PortletParameters;
import org.jboss.portal.portlet.StateString;
import org.jboss.portal.portlet.invocation.ActionInvocation;
@@ -34,8 +35,7 @@
import org.jboss.portal.portlet.spi.UserContext;
import org.jboss.portal.portlet.spi.WindowContext;
import org.jboss.portal.portlet.state.AccessMode;
-import org.jboss.portal.common.util.ContentInfo;
-import org.jboss.portal.common.util.MarkupInfo;
+import org.jboss.portal.wsrp.WSRPExceptionFactory;
import org.jboss.portal.wsrp.WSRPTypeFactory;
import org.jboss.portal.wsrp.WSRPUtils;
import org.jboss.portal.wsrp.core.InteractionParams;
@@ -112,7 +112,7 @@
AccessMode getAccessMode() throws MissingParametersFault
{
StateChange stateChange = interactionParams.getPortletStateChange();
- WSRPUtils.throwMissingParametersFaultIfValueIsMissing(stateChange, "portletStateChange", "InteractionParams");
+ WSRPExceptionFactory.throwMissingParametersFaultIfValueIsMissing(stateChange, "portletStateChange", "InteractionParams");
return WSRPUtils.getAccessModeFromStateChange(stateChange);
}
Modified: trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/MarkupHandler.java
===================================================================
--- trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/MarkupHandler.java 2007-03-18 23:12:54 UTC (rev 6731)
+++ trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/MarkupHandler.java 2007-03-18 23:25:36 UTC (rev 6732)
@@ -31,7 +31,7 @@
import org.jboss.portal.portlet.invocation.response.PortletInvocationResponse;
import org.jboss.portal.portlet.invocation.response.RenderResponse;
import org.jboss.portal.portlet.state.producer.PortletStateChangeRequiredException;
-import org.jboss.portal.wsrp.WSRPUtils;
+import org.jboss.portal.wsrp.WSRPExceptionFactory;
import org.jboss.portal.wsrp.core.AccessDeniedFault;
import org.jboss.portal.wsrp.core.BlockingInteractionResponse;
import org.jboss.portal.wsrp.core.GetMarkup;
@@ -88,7 +88,7 @@
OperationFailedFault, MissingParametersFault, InvalidUserCategoryFault, InvalidRegistrationFault,
UnsupportedMimeTypeFault, RemoteException
{
- WSRPUtils.throwOperationFailedFaultIfValueIsMissing(getMarkup, GET_MARKUP);
+ WSRPExceptionFactory.throwOperationFailedFaultIfValueIsMissing(getMarkup, GET_MARKUP);
RequestProcessor requestProcessor = new RenderRequestProcessor(producer, getMarkup);
@@ -101,7 +101,7 @@
}
catch (PortletInvokerException e)
{
- throw WSRPUtils.createOperationFailedFault(e);
+ throw WSRPExceptionFactory.createOperationFailedFault(e);
}
checkForError(response);
@@ -115,15 +115,15 @@
InvalidRegistrationFault, MissingParametersFault, InvalidUserCategoryFault, InconsistentParametersFault,
InvalidHandleFault, InvalidCookieFault, RemoteException
{
- WSRPUtils.throwOperationFailedFaultIfValueIsMissing(performBlockingInteraction, PBI);
+ WSRPExceptionFactory.throwOperationFailedFaultIfValueIsMissing(performBlockingInteraction, PBI);
final InteractionParams interactionParams = performBlockingInteraction.getInteractionParams();
- WSRPUtils.throwMissingParametersFaultIfValueIsMissing(interactionParams, "InteractionParams", PBI);
+ WSRPExceptionFactory.throwMissingParametersFaultIfValueIsMissing(interactionParams, "InteractionParams", PBI);
// fix-me: upload contexts are not supported, fail fast!
UploadContext[] uploadContexts = interactionParams.getUploadContexts();
if (uploadContexts != null)
{
- throw WSRPUtils.createOperationFailedFault(new UnsupportedOperationException("UploadContexts are not currently supported."));
+ throw WSRPExceptionFactory.createOperationFailedFault(new UnsupportedOperationException("UploadContexts are not currently supported."));
}
@@ -138,11 +138,11 @@
}
catch (PortletStateChangeRequiredException e)
{
- throw (PortletStateChangeRequiredFault)WSRPUtils.createFaultFrom(PortletStateChangeRequiredFault.class, e);
+ throw (PortletStateChangeRequiredFault)WSRPExceptionFactory.createFaultFrom(PortletStateChangeRequiredFault.class, e);
}
catch (PortletInvokerException e)
{
- throw WSRPUtils.createOperationFailedFault(e);
+ throw WSRPExceptionFactory.createOperationFailedFault(e);
}
checkForError(response);
@@ -161,7 +161,7 @@
public ReturnAny initCookie(InitCookie initCookie)
throws AccessDeniedFault, OperationFailedFault, InvalidRegistrationFault, RemoteException
{
- WSRPUtils.throwOperationFailedFaultIfValueIsMissing(initCookie, "InitCookie");
+ WSRPExceptionFactory.throwOperationFailedFaultIfValueIsMissing(initCookie, "InitCookie");
producer.checkRegistration(initCookie.getRegistrationContext());
// Force HTTP session creation... this is required for BEA Weblogic version < 9.2.
@@ -174,7 +174,7 @@
static void throwOperationFaultOnSessionOperation() throws OperationFailedFault
{
- throw WSRPUtils.createOperationFailedFault(new IllegalArgumentException("JBoss Portal's Producer manages " +
+ throw WSRPExceptionFactory.createOperationFailedFault(new IllegalArgumentException("JBoss Portal's Producer manages " +
"sessions completely on the server side, passing or trying to release sessionIDs is therefore an error."));
}
@@ -187,12 +187,12 @@
Throwable throwable = errorResult.getThrowable();
if (throwable instanceof PortletModeException)
{
- throw (UnsupportedModeFault)WSRPUtils.createFaultFrom(UnsupportedModeFault.class,
+ throw (UnsupportedModeFault)WSRPExceptionFactory.createFaultFrom(UnsupportedModeFault.class,
new IllegalArgumentException("Unsupported mode: " + ((PortletModeException)throwable).getMode()));
}
if (throwable instanceof WindowStateException)
{
- throw (UnsupportedWindowStateFault)WSRPUtils.createFaultFrom(UnsupportedWindowStateFault.class,
+ throw (UnsupportedWindowStateFault)WSRPExceptionFactory.createFaultFrom(UnsupportedWindowStateFault.class,
new IllegalArgumentException("Unsupported window state: " + ((WindowStateException)throwable).getState()));
}
// todo: deal with other exceptions
@@ -203,13 +203,13 @@
}
// we're not sure what happened so throw an OperationFailedFault
- throw WSRPUtils.createOperationFailedFault(throwable);
+ throw WSRPExceptionFactory.createOperationFailedFault(throwable);
}
else
if (!(response instanceof HTTPRedirectionResponse || response instanceof FragmentResponse || response instanceof RenderResponse))
{
- throw WSRPUtils.createOperationFailedFault(new IllegalArgumentException("Unsupported result type: "
+ throw WSRPExceptionFactory.createOperationFailedFault(new IllegalArgumentException("Unsupported result type: "
+ response.getClass().getName()));
}
}
Modified: trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/PortletManagementHandler.java
===================================================================
--- trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/PortletManagementHandler.java 2007-03-18 23:12:54 UTC (rev 6731)
+++ trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/PortletManagementHandler.java 2007-03-18 23:25:36 UTC (rev 6732)
@@ -40,6 +40,7 @@
import org.jboss.portal.portlet.state.PropertyChange;
import org.jboss.portal.portlet.state.PropertyMap;
import org.jboss.portal.wsrp.WSRPConstants;
+import org.jboss.portal.wsrp.WSRPExceptionFactory;
import org.jboss.portal.wsrp.WSRPTypeFactory;
import org.jboss.portal.wsrp.WSRPUtils;
import org.jboss.portal.wsrp.core.AccessDeniedFault;
@@ -98,11 +99,11 @@
throws AccessDeniedFault, InvalidHandleFault, InvalidUserCategoryFault, InconsistentParametersFault,
MissingParametersFault, InvalidRegistrationFault, OperationFailedFault, RemoteException
{
- WSRPUtils.throwOperationFailedFaultIfValueIsMissing(getPortletDescription, GET_PORTLET_DESCRIPTION);
+ WSRPExceptionFactory.throwOperationFailedFaultIfValueIsMissing(getPortletDescription, GET_PORTLET_DESCRIPTION);
producer.checkRegistration(getPortletDescription.getRegistrationContext());
PortletContext portletContext = getPortletDescription.getPortletContext();
- WSRPUtils.throwMissingParametersFaultIfValueIsMissing(portletContext, PORTLET_CONTEXT, GET_PORTLET_DESCRIPTION);
+ WSRPExceptionFactory.throwMissingParametersFaultIfValueIsMissing(portletContext, PORTLET_CONTEXT, GET_PORTLET_DESCRIPTION);
UserContext userContext = getPortletDescription.getUserContext();
checkUserAuthorization(userContext);
@@ -114,10 +115,10 @@
throws MissingParametersFault, InconsistentParametersFault, InvalidUserCategoryFault, InvalidRegistrationFault,
AccessDeniedFault, InvalidHandleFault, OperationFailedFault, RemoteException
{
- WSRPUtils.throwOperationFailedFaultIfValueIsMissing(getPortletPropertyDescription, GET_PORTLET_PROPERTY_DESCRIPTION);
+ WSRPExceptionFactory.throwOperationFailedFaultIfValueIsMissing(getPortletPropertyDescription, GET_PORTLET_PROPERTY_DESCRIPTION);
PortletContext portletContext = getPortletPropertyDescription.getPortletContext();
- WSRPUtils.throwMissingParametersFaultIfValueIsMissing(portletContext, PORTLET_CONTEXT, GET_PORTLET_PROPERTY_DESCRIPTION);
+ WSRPExceptionFactory.throwMissingParametersFaultIfValueIsMissing(portletContext, PORTLET_CONTEXT, GET_PORTLET_PROPERTY_DESCRIPTION);
producer.checkRegistration(getPortletPropertyDescription.getRegistrationContext());
@@ -159,10 +160,10 @@
OperationFailedFault, InvalidHandleFault, InvalidRegistrationFault, InconsistentParametersFault,
MissingParametersFault, RemoteException
{
- WSRPUtils.throwOperationFailedFaultIfValueIsMissing(clonePortlet, "ClonePortlet");
+ WSRPExceptionFactory.throwOperationFailedFaultIfValueIsMissing(clonePortlet, "ClonePortlet");
PortletContext portletContext = clonePortlet.getPortletContext();
- WSRPUtils.throwMissingParametersFaultIfValueIsMissing(portletContext, "PortletContext", "ClonePortlet");
+ WSRPExceptionFactory.throwMissingParametersFaultIfValueIsMissing(portletContext, "PortletContext", "ClonePortlet");
producer.checkRegistration(clonePortlet.getRegistrationContext());
@@ -177,25 +178,25 @@
}
catch (NoSuchPortletException e)
{
- throw (InvalidHandleFault)WSRPUtils.createFaultFrom(InvalidHandleFault.class, e);
+ throw (InvalidHandleFault)WSRPExceptionFactory.createFaultFrom(InvalidHandleFault.class, e);
}
catch (InvalidPortletIdException e)
{
- throw (InvalidHandleFault)WSRPUtils.createFaultFrom(InvalidHandleFault.class, e);
+ throw (InvalidHandleFault)WSRPExceptionFactory.createFaultFrom(InvalidHandleFault.class, e);
}
catch (PortletInvokerException e)
{
- throw WSRPUtils.createOperationFailedFault(e);
+ throw WSRPExceptionFactory.createOperationFailedFault(e);
}
}
public DestroyPortletsResponse destroyPortlets(DestroyPortlets destroyPortlets) throws InconsistentParametersFault,
MissingParametersFault, InvalidRegistrationFault, OperationFailedFault, RemoteException
{
- WSRPUtils.throwOperationFailedFaultIfValueIsMissing(destroyPortlets, "DestroyPortlets");
+ WSRPExceptionFactory.throwOperationFailedFaultIfValueIsMissing(destroyPortlets, "DestroyPortlets");
String[] handles = destroyPortlets.getPortletHandles();
- WSRPUtils.throwMissingParametersFaultIfValueIsMissing(handles, "portlet handles to be destroyed", "DestroyPortlets");
+ WSRPExceptionFactory.throwMissingParametersFaultIfValueIsMissing(handles, "portlet handles to be destroyed", "DestroyPortlets");
producer.checkRegistration(destroyPortlets.getRegistrationContext());
@@ -229,7 +230,7 @@
}
catch (PortletInvokerException e)
{
- throw WSRPUtils.createOperationFailedFault(e);
+ throw WSRPExceptionFactory.createOperationFailedFault(e);
}
}
@@ -237,13 +238,13 @@
InvalidHandleFault, MissingParametersFault, InconsistentParametersFault, InvalidUserCategoryFault,
AccessDeniedFault, InvalidRegistrationFault, RemoteException
{
- WSRPUtils.throwOperationFailedFaultIfValueIsMissing(setPortletProperties, "SetPortletProperties");
+ WSRPExceptionFactory.throwOperationFailedFaultIfValueIsMissing(setPortletProperties, "SetPortletProperties");
PortletContext portletContext = setPortletProperties.getPortletContext();
- WSRPUtils.throwMissingParametersFaultIfValueIsMissing(portletContext, "PortletContext", "SetPortletProperties");
+ WSRPExceptionFactory.throwMissingParametersFaultIfValueIsMissing(portletContext, "PortletContext", "SetPortletProperties");
PropertyList propertyList = setPortletProperties.getPropertyList();
- WSRPUtils.throwMissingParametersFaultIfValueIsMissing(propertyList, "PropertyList", "SetPortletProperties");
+ WSRPExceptionFactory.throwMissingParametersFaultIfValueIsMissing(propertyList, "PropertyList", "SetPortletProperties");
producer.checkRegistration(setPortletProperties.getRegistrationContext());
@@ -298,15 +299,15 @@
}
catch (NoSuchPortletException e)
{
- throw (InvalidHandleFault)WSRPUtils.createFaultFrom(InvalidHandleFault.class, e);
+ throw (InvalidHandleFault)WSRPExceptionFactory.createFaultFrom(InvalidHandleFault.class, e);
}
catch (InvalidPortletIdException e)
{
- throw (InconsistentParametersFault)WSRPUtils.createFaultFrom(InconsistentParametersFault.class, e);
+ throw (InconsistentParametersFault)WSRPExceptionFactory.createFaultFrom(InconsistentParametersFault.class, e);
}
catch (PortletInvokerException e)
{
- throw WSRPUtils.createOperationFailedFault(e);
+ throw WSRPExceptionFactory.createOperationFailedFault(e);
}
}
@@ -317,10 +318,10 @@
MissingParametersFault, InvalidRegistrationFault, AccessDeniedFault, OperationFailedFault,
InconsistentParametersFault, InvalidUserCategoryFault, RemoteException
{
- WSRPUtils.throwOperationFailedFaultIfValueIsMissing(getPortletProperties, GET_PORTLET_PROPERTIES);
+ WSRPExceptionFactory.throwOperationFailedFaultIfValueIsMissing(getPortletProperties, GET_PORTLET_PROPERTIES);
PortletContext portletContext = getPortletProperties.getPortletContext();
- WSRPUtils.throwMissingParametersFaultIfValueIsMissing(portletContext, PORTLET_CONTEXT, GET_PORTLET_PROPERTIES);
+ WSRPExceptionFactory.throwMissingParametersFaultIfValueIsMissing(portletContext, PORTLET_CONTEXT, GET_PORTLET_PROPERTIES);
producer.checkRegistration(getPortletProperties.getRegistrationContext());
@@ -378,7 +379,7 @@
}
catch (PortletInvokerException e)
{
- throw (InvalidHandleFault)WSRPUtils.createFaultFrom(InvalidHandleFault.class, e);
+ throw (InvalidHandleFault)WSRPExceptionFactory.createFaultFrom(InvalidHandleFault.class, e);
}
}
@@ -430,7 +431,7 @@
}
catch (PortletInvokerException e)
{
- throw (InvalidHandleFault)WSRPUtils.createFaultFrom(InvalidHandleFault.class, e);
+ throw (InvalidHandleFault)WSRPExceptionFactory.createFaultFrom(InvalidHandleFault.class, e);
}
return portlet;
}
Modified: trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/RegistrationHandler.java
===================================================================
--- trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/RegistrationHandler.java 2007-03-18 23:12:54 UTC (rev 6731)
+++ trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/RegistrationHandler.java 2007-03-18 23:25:36 UTC (rev 6732)
@@ -33,6 +33,7 @@
import org.jboss.portal.registration.RegistrationLocal;
import org.jboss.portal.registration.RegistrationStatus;
import org.jboss.portal.registration.RegistrationUtils;
+import org.jboss.portal.wsrp.WSRPExceptionFactory;
import org.jboss.portal.wsrp.WSRPTypeFactory;
import org.jboss.portal.wsrp.WSRPUtils;
import org.jboss.portal.wsrp.core.InvalidRegistrationFault;
@@ -73,12 +74,12 @@
public RegistrationContext register(RegistrationData registrationData) throws MissingParametersFault, OperationFailedFault,
RemoteException
{
- WSRPUtils.throwOperationFailedFaultIfValueIsMissing(registrationData, "RegistrationData");
+ WSRPExceptionFactory.throwOperationFailedFaultIfValueIsMissing(registrationData, "RegistrationData");
String consumerName = registrationData.getConsumerName();
- WSRPUtils.throwMissingParametersFaultIfValueIsMissing(consumerName, "consumer name", "RegistrationData");
+ WSRPExceptionFactory.throwMissingParametersFaultIfValueIsMissing(consumerName, "consumer name", "RegistrationData");
String consumerAgent = registrationData.getConsumerAgent();
- WSRPUtils.throwMissingParametersFaultIfValueIsMissing(consumerAgent, "consumer agent", "RegistrationData");
+ WSRPExceptionFactory.throwMissingParametersFaultIfValueIsMissing(consumerAgent, "consumer agent", "RegistrationData");
Registration registration;
try
@@ -94,7 +95,7 @@
catch (Exception e)
{
log.debug(e);
- throw WSRPUtils.createOperationFailedFault(e);
+ throw WSRPExceptionFactory.createOperationFailedFault(e);
}
RegistrationContext registrationContext = WSRPTypeFactory.createRegistrationContext(registration.getId());
@@ -148,7 +149,7 @@
public ReturnAny deregister(RegistrationContext deregister) throws OperationFailedFault, InvalidRegistrationFault,
RemoteException
{
- WSRPUtils.throwOperationFailedFaultIfValueIsMissing(deregister, "RegistrationContext");
+ WSRPExceptionFactory.throwOperationFailedFaultIfValueIsMissing(deregister, "RegistrationContext");
String registrationHandle = deregister.getRegistrationHandle();
if (ParameterValidation.isNullOrEmpty(registrationHandle))
@@ -171,7 +172,7 @@
catch (RegistrationException e)
{
log.debug(e);
- throw WSRPUtils.createOperationFailedFault(e);
+ throw WSRPExceptionFactory.createOperationFailedFault(e);
}
return new ReturnAny();
@@ -180,10 +181,10 @@
public RegistrationState modifyRegistration(ModifyRegistration modifyRegistration) throws MissingParametersFault,
OperationFailedFault, InvalidRegistrationFault, RemoteException
{
- WSRPUtils.throwOperationFailedFaultIfValueIsMissing(modifyRegistration, "ModifyRegistration");
+ WSRPExceptionFactory.throwOperationFailedFaultIfValueIsMissing(modifyRegistration, "ModifyRegistration");
RegistrationContext registrationContext = modifyRegistration.getRegistrationContext();
- WSRPUtils.throwMissingParametersFaultIfValueIsMissing(registrationContext, "RegistrationContext", "ModifyRegistration");
+ WSRPExceptionFactory.throwMissingParametersFaultIfValueIsMissing(registrationContext, "RegistrationContext", "ModifyRegistration");
String registrationHandle = registrationContext.getRegistrationHandle();
if (ParameterValidation.isNullOrEmpty(registrationHandle))
{
@@ -191,13 +192,13 @@
}
RegistrationData registrationData = modifyRegistration.getRegistrationData();
- WSRPUtils.throwMissingParametersFaultIfValueIsMissing(registrationData, "RegistrationData", "ModifyRegistration");
+ WSRPExceptionFactory.throwMissingParametersFaultIfValueIsMissing(registrationData, "RegistrationData", "ModifyRegistration");
String consumerName = registrationData.getConsumerName();
- WSRPUtils.throwMissingParametersFaultIfValueIsMissing(consumerName, "consumer name", "RegistrationData");
+ WSRPExceptionFactory.throwMissingParametersFaultIfValueIsMissing(consumerName, "consumer name", "RegistrationData");
String consumerAgent = registrationData.getConsumerAgent();
- WSRPUtils.throwMissingParametersFaultIfValueIsMissing(consumerAgent, "consumer agent", "RegistrationData");
+ WSRPExceptionFactory.throwMissingParametersFaultIfValueIsMissing(consumerAgent, "consumer agent", "RegistrationData");
log.debug("Attempting to modify registration with handle '" + registrationHandle + "'");
try
@@ -214,7 +215,7 @@
catch (RegistrationException e)
{
log.debug(e);
- throw WSRPUtils.createOperationFailedFault(e);
+ throw WSRPExceptionFactory.createOperationFailedFault(e);
}
@@ -233,7 +234,7 @@
}
String regHandle = registrationContext.getRegistrationHandle();
- WSRPUtils.throwOperationFailedFaultIfValueIsMissing(regHandle, "registration handle");
+ WSRPExceptionFactory.throwOperationFailedFaultIfValueIsMissing(regHandle, "registration handle");
Registration reg;
try
@@ -242,7 +243,7 @@
}
catch (RegistrationException e)
{
- throw WSRPUtils.createOperationFailedFault(e);
+ throw WSRPExceptionFactory.createOperationFailedFault(e);
}
if (reg == null)
@@ -273,7 +274,7 @@
private boolean throwInvalidRegistrationFault(String message) throws InvalidRegistrationFault
{
- throw (InvalidRegistrationFault)WSRPUtils.createFaultFrom(InvalidRegistrationFault.class,
+ throw (InvalidRegistrationFault)WSRPExceptionFactory.createFaultFrom(InvalidRegistrationFault.class,
new Exception("Invalid registration: " + message));
}
Modified: trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/RequestProcessor.java
===================================================================
--- trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/RequestProcessor.java 2007-03-18 23:12:54 UTC (rev 6731)
+++ trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/RequestProcessor.java 2007-03-18 23:25:36 UTC (rev 6732)
@@ -23,9 +23,9 @@
package org.jboss.portal.wsrp.producer;
+import org.jboss.portal.common.util.MarkupInfo;
import org.jboss.portal.common.util.MediaType;
import org.jboss.portal.common.util.Tools;
-import org.jboss.portal.common.util.MarkupInfo;
import org.jboss.portal.portlet.OpaqueStateString;
import org.jboss.portal.portlet.Portlet;
import org.jboss.portal.portlet.PortletInvokerException;
@@ -37,8 +37,10 @@
import org.jboss.portal.portlet.spi.UserContext;
import org.jboss.portal.portlet.spi.WindowContext;
import org.jboss.portal.portlet.state.AccessMode;
+import org.jboss.portal.server.PortalConstants;
import org.jboss.portal.wsrp.UserContextConverter;
import org.jboss.portal.wsrp.WSRPConstants;
+import org.jboss.portal.wsrp.WSRPExceptionFactory;
import org.jboss.portal.wsrp.WSRPUtils;
import org.jboss.portal.wsrp.core.InvalidHandleFault;
import org.jboss.portal.wsrp.core.InvalidRegistrationFault;
@@ -53,7 +55,6 @@
import org.jboss.portal.wsrp.core.UnsupportedMimeTypeFault;
import org.jboss.portal.wsrp.core.UnsupportedModeFault;
import org.jboss.portal.wsrp.core.UnsupportedWindowStateFault;
-import org.jboss.portal.server.PortalConstants;
import javax.activation.MimeTypeParseException;
import java.security.Principal;
@@ -93,17 +94,17 @@
// get session information and deal with it
final RuntimeContext runtimeContext = getRuntimeContext();
- WSRPUtils.throwMissingParametersFaultIfValueIsMissing(runtimeContext, "RuntimeContext", getContextName());
+ WSRPExceptionFactory.throwMissingParametersFaultIfValueIsMissing(runtimeContext, "RuntimeContext", getContextName());
checkForSessionIDs(runtimeContext);
// get markup parameters
final MarkupParams params = getMarkupParams();
- WSRPUtils.throwMissingParametersFaultIfValueIsMissing(params, "MarkupParams", getContextName());
+ WSRPExceptionFactory.throwMissingParametersFaultIfValueIsMissing(params, "MarkupParams", getContextName());
// get portlet handle
PortletContext wsrpPC = getPortletContext();
- WSRPUtils.throwMissingParametersFaultIfValueIsMissing(wsrpPC, "PortletContext", getContextName());
+ WSRPExceptionFactory.throwMissingParametersFaultIfValueIsMissing(wsrpPC, "PortletContext", getContextName());
org.jboss.portal.portlet.PortletContext portletContext = WSRPUtils.convertToPortalPortletContext(wsrpPC);
// retrieve the portlet
@@ -113,7 +114,7 @@
}
catch (PortletInvokerException e)
{
- throw WSRPUtils.createOperationFailedFault(e);
+ throw WSRPExceptionFactory.createOperationFailedFault(e);
}
// get portlet description for the desired portlet...
@@ -121,7 +122,7 @@
portletDescription = producer.getPortletDescription(portlet, desiredLocales);
if (Boolean.TRUE.equals(portletDescription.getUsesMethodGet()))
{
- throw WSRPUtils.createOperationFailedFault(
+ throw WSRPExceptionFactory.createOperationFailedFault(
new UnsupportedOperationException("Portlets using GET method in forms are not currently supported."));
}
MarkupType[] markupTypes = portletDescription.getMarkupTypes();
@@ -199,7 +200,7 @@
// no MIME type was found: error!
if (markupType == null)
{
- throw (UnsupportedMimeTypeFault)WSRPUtils.createFaultFrom(UnsupportedMimeTypeFault.class,
+ throw (UnsupportedMimeTypeFault)WSRPExceptionFactory.createFaultFrom(UnsupportedMimeTypeFault.class,
new IllegalArgumentException("None of the specified MIME types are supported by this Portlet."));
}
@@ -211,7 +212,7 @@
}
catch (IllegalArgumentException e)
{
- throw (UnsupportedModeFault)WSRPUtils.createFaultFrom(UnsupportedModeFault.class, e);
+ throw (UnsupportedModeFault)WSRPExceptionFactory.createFaultFrom(UnsupportedModeFault.class, e);
}
// get the window state
@@ -222,7 +223,7 @@
}
catch (IllegalArgumentException e)
{
- throw (UnsupportedWindowStateFault)WSRPUtils.createFaultFrom(UnsupportedWindowStateFault.class, e);
+ throw (UnsupportedWindowStateFault)WSRPExceptionFactory.createFaultFrom(UnsupportedWindowStateFault.class, e);
}
// get the character set
@@ -283,7 +284,7 @@
{
if (wsrpUserContext != null)
{
- WSRPUtils.throwMissingParametersFaultIfValueIsMissing(wsrpUserContext.getUserContextKey(), "User Context Key", "UserContext");
+ WSRPExceptionFactory.throwMissingParametersFaultIfValueIsMissing(wsrpUserContext.getUserContextKey(), "User Context Key", "UserContext");
}
}
@@ -400,7 +401,7 @@
}
catch (MimeTypeParseException e)
{
- throw (UnsupportedMimeTypeFault)WSRPUtils.createFaultFrom(UnsupportedMimeTypeFault.class, e);
+ throw (UnsupportedMimeTypeFault)WSRPExceptionFactory.createFaultFrom(UnsupportedMimeTypeFault.class, e);
}
return markupInfo;
}
Modified: trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/ServiceDescriptionHandler.java
===================================================================
--- trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/ServiceDescriptionHandler.java 2007-03-18 23:12:54 UTC (rev 6731)
+++ trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/ServiceDescriptionHandler.java 2007-03-18 23:25:36 UTC (rev 6732)
@@ -33,6 +33,7 @@
import org.jboss.portal.portlet.info.ModeInfo;
import org.jboss.portal.portlet.info.PortletInfo;
import org.jboss.portal.portlet.info.WindowStateInfo;
+import org.jboss.portal.wsrp.WSRPExceptionFactory;
import org.jboss.portal.wsrp.WSRPTypeFactory;
import org.jboss.portal.wsrp.WSRPUtils;
import org.jboss.portal.wsrp.core.CookieProtocol;
@@ -78,7 +79,7 @@
public ServiceDescription getServiceDescription(GetServiceDescription gs)
throws InvalidRegistrationFault, OperationFailedFault, RemoteException
{
- WSRPUtils.throwOperationFailedFaultIfValueIsMissing(gs, "GetServiceDescription");
+ WSRPExceptionFactory.throwOperationFailedFaultIfValueIsMissing(gs, "GetServiceDescription");
if (!producer.isRegistrationValid(gs.getRegistrationContext()))
{
@@ -124,7 +125,7 @@
}
catch (PortletInvokerException e)
{
- throw WSRPUtils.createOperationFailedFault(e);
+ throw WSRPExceptionFactory.createOperationFailedFault(e);
}
return getPortletDescription(portlet, desiredLocales);
}
Modified: trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/WSRPProducerImpl.java
===================================================================
--- trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/WSRPProducerImpl.java 2007-03-18 23:12:54 UTC (rev 6731)
+++ trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/WSRPProducerImpl.java 2007-03-18 23:25:36 UTC (rev 6732)
@@ -32,8 +32,8 @@
import org.jboss.portal.portlet.info.PortletInfo;
import org.jboss.portal.registration.RegistrationManager;
import org.jboss.portal.wsrp.ResponseDebugFactory;
+import org.jboss.portal.wsrp.WSRPExceptionFactory;
import org.jboss.portal.wsrp.WSRPProducer;
-import org.jboss.portal.wsrp.WSRPUtils;
import org.jboss.portal.wsrp.core.AccessDeniedFault;
import org.jboss.portal.wsrp.core.BlockingInteractionResponse;
import org.jboss.portal.wsrp.core.ClonePortlet;
@@ -384,12 +384,12 @@
}
catch (NoSuchPortletException e)
{
- throw (InvalidHandleFault)WSRPUtils.createFaultFrom(InvalidHandleFault.class,
+ throw (InvalidHandleFault)WSRPExceptionFactory.createFaultFrom(InvalidHandleFault.class,
new IllegalArgumentException("Couldn't find portlet with handle '" + portletContext.getId() + "'"));
}
if (!isRemotable(portlet))
{
- throw (InvalidHandleFault)WSRPUtils.createFaultFrom(InvalidHandleFault.class,
+ throw (InvalidHandleFault)WSRPExceptionFactory.createFaultFrom(InvalidHandleFault.class,
new IllegalArgumentException("Portlet '" + portletContext.getId() + "' is not remotely available."));
}
@@ -442,7 +442,7 @@
{
IllegalArgumentException cause = new IllegalArgumentException(registrationContext + " is not a valid registration.");
log.debug(cause);
- throw (InvalidRegistrationFault)WSRPUtils.createFaultFrom(InvalidRegistrationFault.class,
+ throw (InvalidRegistrationFault)WSRPExceptionFactory.createFaultFrom(InvalidRegistrationFault.class,
cause);
}
}
17 years, 6 months
JBoss Portal SVN: r6731 - in trunk: wsrp/src/main/org/jboss/portal/wsrp and 1 other directory.
by portal-commits@lists.jboss.org
Author: chris.laprun(a)jboss.com
Date: 2007-03-18 19:12:54 -0400 (Sun, 18 Mar 2007)
New Revision: 6731
Modified:
trunk/api/src/main/org/jboss/portal/Mode.java
trunk/api/src/main/org/jboss/portal/WindowState.java
trunk/wsrp/src/main/org/jboss/portal/wsrp/WSRPTypeFactory.java
Log:
- JBPORTAL-1322: Fixed, the problem was that WindowState (and Mode, though it doesn't matter) was converting to lowercase the passed String so created a case preserving version of factory methods.
Modified: trunk/api/src/main/org/jboss/portal/Mode.java
===================================================================
--- trunk/api/src/main/org/jboss/portal/Mode.java 2007-03-18 01:32:54 UTC (rev 6730)
+++ trunk/api/src/main/org/jboss/portal/Mode.java 2007-03-18 23:12:54 UTC (rev 6731)
@@ -52,13 +52,24 @@
public Mode(String name)
{
+ this(name, false);
+ }
+
+ /**
+ * @param name
+ * @param preserveCase
+ * @since 2.6
+ */
+ private Mode(String name, boolean preserveCase)
+ {
if (name == null)
{
throw new IllegalArgumentException("Mode cannot be null");
}
- this.name = name.toLowerCase(Locale.ENGLISH);
+ this.name = (preserveCase ? name : name.toLowerCase(Locale.ENGLISH));
}
+
public boolean equals(Object o)
{
if (o == this)
@@ -107,27 +118,38 @@
}
}
- public static Mode create(String s)
+ public static Mode create(String name)
{
- if (Mode.VIEW.name.equals(s))
+ return create(name, false);
+ }
+
+ /**
+ * @param name
+ * @param preserveCase
+ * @return
+ * @since 2.6
+ */
+ public static Mode create(String name, boolean preserveCase)
+ {
+ if (Mode.VIEW.name.equals(name))
{
return Mode.VIEW;
}
- else if (Mode.EDIT.name.equals(s))
+ else if (Mode.EDIT.name.equals(name))
{
return Mode.EDIT;
}
- else if (Mode.HELP.name.equals(s))
+ else if (Mode.HELP.name.equals(name))
{
return Mode.HELP;
}
- else if (Mode.EDIT_DEFAULTS.name.equals(s))
+ else if (Mode.EDIT_DEFAULTS.name.equals(name))
{
return Mode.VIEW;
}
else
{
- return new Mode(s);
+ return new Mode(name, preserveCase);
}
}
}
Modified: trunk/api/src/main/org/jboss/portal/WindowState.java
===================================================================
--- trunk/api/src/main/org/jboss/portal/WindowState.java 2007-03-18 01:32:54 UTC (rev 6730)
+++ trunk/api/src/main/org/jboss/portal/WindowState.java 2007-03-18 23:12:54 UTC (rev 6731)
@@ -49,11 +49,22 @@
public WindowState(String name)
{
+ this(name, false);
+ }
+
+ /**
+ * @param name
+ * @param preserveCase
+ * @since 2.6
+ */
+ private WindowState(String name, boolean preserveCase)
+ {
if (name == null)
{
throw new IllegalArgumentException("Window state name cannot be null");
}
- this.name = name.toLowerCase(Locale.ENGLISH);
+
+ this.name = (preserveCase ? name : name.toLowerCase(Locale.ENGLISH));
}
public boolean equals(Object o)
@@ -100,23 +111,28 @@
}
}
- public static WindowState create(String s)
+ public static WindowState create(String name)
{
- if (WindowState.NORMAL.name.equals(s))
+ return create(name, false);
+ }
+
+ public static WindowState create(String name, boolean preserveCase)
+ {
+ if (WindowState.NORMAL.name.equals(name))
{
return WindowState.NORMAL;
}
- else if (WindowState.MINIMIZED.name.equals(s))
+ else if (WindowState.MINIMIZED.name.equals(name))
{
return WindowState.MINIMIZED;
}
- else if (WindowState.MAXIMIZED.name.equals(s))
+ else if (WindowState.MAXIMIZED.name.equals(name))
{
return WindowState.MAXIMIZED;
}
else
{
- return new WindowState(s);
+ return new WindowState(name, preserveCase);
}
}
}
Modified: trunk/wsrp/src/main/org/jboss/portal/wsrp/WSRPTypeFactory.java
===================================================================
--- trunk/wsrp/src/main/org/jboss/portal/wsrp/WSRPTypeFactory.java 2007-03-18 01:32:54 UTC (rev 6730)
+++ trunk/wsrp/src/main/org/jboss/portal/wsrp/WSRPTypeFactory.java 2007-03-18 23:12:54 UTC (rev 6731)
@@ -573,12 +573,12 @@
public Mode getMode()
{
- return Mode.create(WSRPRewritingConstants.REWRITE_PARAMETER_OPEN + WSRPRewritingConstants.MODE + WSRPRewritingConstants.REWRITE_PARAMETER_CLOSE);
+ return Mode.create(WSRPRewritingConstants.REWRITE_PARAMETER_OPEN + WSRPRewritingConstants.MODE + WSRPRewritingConstants.REWRITE_PARAMETER_CLOSE, true);
}
public WindowState getWindowState()
{
- return WindowState.create(WSRPRewritingConstants.REWRITE_PARAMETER_OPEN + WSRPRewritingConstants.WINDOW_STATE + WSRPRewritingConstants.REWRITE_PARAMETER_CLOSE);
+ return WindowState.create(WSRPRewritingConstants.REWRITE_PARAMETER_OPEN + WSRPRewritingConstants.WINDOW_STATE + WSRPRewritingConstants.REWRITE_PARAMETER_CLOSE, true);
}
};
@@ -591,12 +591,12 @@
public Mode getMode()
{
- return Mode.create(WSRPRewritingConstants.REWRITE_PARAMETER_OPEN + WSRPRewritingConstants.MODE + WSRPRewritingConstants.REWRITE_PARAMETER_CLOSE);
+ return Mode.create(WSRPRewritingConstants.REWRITE_PARAMETER_OPEN + WSRPRewritingConstants.MODE + WSRPRewritingConstants.REWRITE_PARAMETER_CLOSE, true);
}
public WindowState getWindowState()
{
- return WindowState.create(WSRPRewritingConstants.REWRITE_PARAMETER_OPEN + WSRPRewritingConstants.WINDOW_STATE + WSRPRewritingConstants.REWRITE_PARAMETER_CLOSE);
+ return WindowState.create(WSRPRewritingConstants.REWRITE_PARAMETER_OPEN + WSRPRewritingConstants.WINDOW_STATE + WSRPRewritingConstants.REWRITE_PARAMETER_CLOSE, true);
}
};
17 years, 6 months
JBoss Portal SVN: r6730 - in trunk: wsrp/src/main/org/jboss/portal/wsrp/consumer/portlet/info and 1 other directory.
by portal-commits@lists.jboss.org
Author: chris.laprun(a)jboss.com
Date: 2007-03-17 21:32:54 -0400 (Sat, 17 Mar 2007)
New Revision: 6730
Modified:
trunk/core-admin/src/main/org/jboss/portal/core/admin/ui/PortletManagerBean.java
trunk/wsrp/src/main/org/jboss/portal/wsrp/consumer/portlet/info/WSRPPortletInfo.java
Log:
- Wrap retrieval of preferences in try-catch block... should be improved by using a message in case an error occurs.
- Check for null on return getPortletProperties (Oracle's producer returns null).
Modified: trunk/core-admin/src/main/org/jboss/portal/core/admin/ui/PortletManagerBean.java
===================================================================
--- trunk/core-admin/src/main/org/jboss/portal/core/admin/ui/PortletManagerBean.java 2007-03-18 01:30:33 UTC (rev 6729)
+++ trunk/core-admin/src/main/org/jboss/portal/core/admin/ui/PortletManagerBean.java 2007-03-18 01:32:54 UTC (rev 6730)
@@ -22,17 +22,6 @@
******************************************************************************/
package org.jboss.portal.core.admin.ui;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.Comparator;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-
-import javax.faces.context.FacesContext;
-import javax.faces.model.SelectItem;
-
import org.jboss.logging.Logger;
import org.jboss.portal.core.model.instance.InstanceContainer;
import org.jboss.portal.identity.RoleModule;
@@ -48,6 +37,16 @@
import org.jboss.portal.security.AuthorizationDomainRegistry;
import org.jboss.portal.security.spi.provider.DomainConfigurator;
+import javax.faces.context.FacesContext;
+import javax.faces.model.SelectItem;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.Comparator;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+
/**
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
* @author <a href="mailto:boleslaw dot dawidowicz at jboss.org">Boleslaw Dawidowicz</a>
@@ -235,7 +234,16 @@
if (portlet != null)
{
// Get preferences info
- PreferencesInfo prefsInfo = portlet.getInfo().getPreferences();
+ PreferencesInfo prefsInfo = null;
+ try
+ {
+ prefsInfo = portlet.getInfo().getPreferences();
+ }
+ catch (Exception e)
+ {
+ // todo: show a message?
+ log.info("Couldn't retrieve preferences for portlet " + portlet.getContext().getId(), e);
+ }
// If the portlet has preferences info then we display them
if (prefsInfo != null)
@@ -275,7 +283,7 @@
List portlets = getPortlets();
// Compute upper bound
- int to = Math.min(selectedFrom + 10, portlets.size());
+ int to = Math.min(selectedFrom + paginationSize, portlets.size());
// Range
return portlets.subList(selectedFrom, to);
@@ -331,13 +339,13 @@
//
selectedPortletInvokerId = portlet.getFederatedId();
-
+
// Get sorted portlets
List portlets = new ArrayList(getSelectedPortletInvoker().getPortlets());
Collections.sort(portlets, comparator);
// Find the portlet index in the list
- for (int i = 0;i < portlets.size();i++)
+ for (int i = 0; i < portlets.size(); i++)
{
Portlet current = (Portlet)portlets.get(i);
if (portlet.getContext().getId().equals(current.getContext().getId()))
Modified: trunk/wsrp/src/main/org/jboss/portal/wsrp/consumer/portlet/info/WSRPPortletInfo.java
===================================================================
--- trunk/wsrp/src/main/org/jboss/portal/wsrp/consumer/portlet/info/WSRPPortletInfo.java 2007-03-18 01:30:33 UTC (rev 6729)
+++ trunk/wsrp/src/main/org/jboss/portal/wsrp/consumer/portlet/info/WSRPPortletInfo.java 2007-03-18 01:32:54 UTC (rev 6730)
@@ -130,28 +130,33 @@
if (prefInfo == null)
{
PortletPropertyDescriptionResponse propertyDescs = originatingProducer.getPropertyDescriptionsFor(portletHandle);
- ModelDescription modelDesc = propertyDescs.getModelDescription();
- Map prefInfos;
- if (modelDesc != null)
+ Map prefInfos = null;
+
+ if (propertyDescs != null)
{
- PropertyDescription[] descs = modelDesc.getPropertyDescriptions();
- if (descs != null)
+ ModelDescription modelDesc = propertyDescs.getModelDescription();
+ if (modelDesc != null)
{
- prefInfos = new HashMap(descs.length);
- for (int i = 0; i < descs.length; i++)
+ PropertyDescription[] descs = modelDesc.getPropertyDescriptions();
+ if (descs != null)
{
- PropertyDescription desc = descs[i];
- String key = desc.getName();
- prefInfos.put(key, new WSRPPreferenceInfo(key, createPortalLocalizedStringFrom(desc.getLabel()),
- createPortalLocalizedStringFrom(desc.getHint())));
+ prefInfos = new HashMap(descs.length);
+ for (int i = 0; i < descs.length; i++)
+ {
+ PropertyDescription desc = descs[i];
+ String key = desc.getName();
+ prefInfos.put(key, new WSRPPreferenceInfo(key, createPortalLocalizedStringFrom(desc.getLabel()),
+ createPortalLocalizedStringFrom(desc.getHint())));
+ }
}
+ else
+ {
+ prefInfos = Collections.EMPTY_MAP;
+ }
}
- else
- {
- prefInfos = Collections.EMPTY_MAP;
- }
}
- else
+
+ if (prefInfos == null)
{
prefInfos = Collections.EMPTY_MAP;
}
17 years, 6 months
JBoss Portal SVN: r6729 - in trunk/core-admin/src: resources/portal-admin-war/WEB-INF/jsf and 1 other directories.
by portal-commits@lists.jboss.org
Author: chris.laprun(a)jboss.com
Date: 2007-03-17 21:30:33 -0400 (Sat, 17 Mar 2007)
New Revision: 6729
Modified:
trunk/core-admin/src/bin/portal-admin-war/style.css
trunk/core-admin/src/resources/portal-admin-war/WEB-INF/jsf/instances.xhtml
trunk/core-admin/src/resources/portal-admin-war/WEB-INF/jsf/portlets.xhtml
trunk/core-admin/src/resources/portal-admin-war/WEB-INF/jsf/wizard/selectPortlet.xhtml
Log:
- Fixed off by one error in pagination.
- Display "Unnamed" if no name was provided for the portlet in the wizard (this is the case with Oracle's public producer...).
- Add portlet description as title in td for the portlet selection (hovering above the link will display it).
- Improved highlighting of selected in pagination.
Modified: trunk/core-admin/src/bin/portal-admin-war/style.css
===================================================================
--- trunk/core-admin/src/bin/portal-admin-war/style.css 2007-03-18 00:50:12 UTC (rev 6728)
+++ trunk/core-admin/src/bin/portal-admin-war/style.css 2007-03-18 01:30:33 UTC (rev 6729)
@@ -33,6 +33,9 @@
.admin-ui ul.pagination li.selected {
font-weight: bold;
+ background-color: #eef;
+ border: 1px solid black;
+ border-bottom: 3px solid black;
}
.pagination a, .pagination a:visited, .pagination a:hover {
@@ -59,11 +62,11 @@
margin-left: 5px;
border: 1px solid #777;
border-bottom: none;
- background-color: #EEEEFF;
+ background-color: #eef;
}
.admin-ui ul.topnav li a:hover {
- background-color: #CCCCFF;
+ background-color: #ccf;
}
.admin-ui ul.topnav li#currentTab a {
Modified: trunk/core-admin/src/resources/portal-admin-war/WEB-INF/jsf/instances.xhtml
===================================================================
--- trunk/core-admin/src/resources/portal-admin-war/WEB-INF/jsf/instances.xhtml 2007-03-18 00:50:12 UTC (rev 6728)
+++ trunk/core-admin/src/resources/portal-admin-war/WEB-INF/jsf/instances.xhtml 2007-03-18 01:30:33 UTC (rev 6729)
@@ -8,103 +8,106 @@
<ui:composition template="instancesTemplate.xhtml">
- <ui:define name="content">
+ <ui:define name="content">
- <h:form>
+ <h:form>
- <table id="instancesTable2" width="100%">
- <thead class="portlet-section-header">
- <tr>
- <th>Id</th>
- <th>Actions</th>
- </tr>
- </thead>
- <tbody>
- <c:forEach items="#{instancemgr.selectedInstances}" var="instance" varStatus="status">
- <tr class="#{instance.id == instancemgr.selectedId ? 'portlet-section-selected' : (status.index % 2 == 0 ? 'portlet-section-body' : 'portlet-section-alternate')}">
- <td>
- <h:commandLink action="#{instancemgr.selectInstance}">
- <h:outputText value="#{instance.id}"/>
- <f:param name="id" value="#{instance.id}"/>
- <f:param name="plugin" value="info"/>
- </h:commandLink>
- </td>
- <td>
- <h:commandLink action="#{instancemgr.selectInstance}">
- <h:outputText value="Preferences"/>
- <f:param name="id" value="#{instance.id}"/>
- <f:param name="plugin" value="preferences"/>
- </h:commandLink> | <h:commandLink action="#{instancemgr.selectInstance}">
- <h:outputText value="Security"/>
- <f:param name="id" value="#{instance.id}"/>
- <f:param name="plugin" value="security"/>
- </h:commandLink> | <h:commandLink action="#{instancemgr.deleteInstance}">
- <h:outputText value="Destroy"/>
- <f:param name="id" value="#{instance.id}"/>
- </h:commandLink>
- </td>
- </tr>
- </c:forEach>
- </tbody>
- </table>
- <ul class="pagination">
- <c:forEach begin="0" end="#{instancemgr.instanceCount}" step="#{instancemgr.paginationSize}" var="index">
- <li class="#{index == instancemgr.selectedFrom ? 'selected' : ''}">
- <h:commandLink action="#{instancemgr.selectFrom}"><f:param name="from" value="#{index}"/><h:outputText value="#{index}"/></h:commandLink>
- </li>
- </c:forEach>
- </ul>
+ <table id="instancesTable2" width="100%">
+ <thead class="portlet-section-header">
+ <tr>
+ <th>Id</th>
+ <th>Actions</th>
+ </tr>
+ </thead>
+ <tbody>
+ <c:forEach items="#{instancemgr.selectedInstances}" var="instance" varStatus="status">
+ <tr
+ class="#{instance.id == instancemgr.selectedId ? 'portlet-section-selected' : (status.index % 2 == 0 ? 'portlet-section-body' : 'portlet-section-alternate')}">
+ <td>
+ <h:commandLink action="#{instancemgr.selectInstance}">
+ <h:outputText value="#{instance.id}"/>
+ <f:param name="id" value="#{instance.id}"/>
+ <f:param name="plugin" value="info"/>
+ </h:commandLink>
+ </td>
+ <td>
+ <h:commandLink action="#{instancemgr.selectInstance}">
+ <h:outputText value="Preferences"/>
+ <f:param name="id" value="#{instance.id}"/>
+ <f:param name="plugin" value="preferences"/>
+ </h:commandLink> | <h:commandLink action="#{instancemgr.selectInstance}">
+ <h:outputText value="Security"/>
+ <f:param name="id" value="#{instance.id}"/>
+ <f:param name="plugin" value="security"/>
+ </h:commandLink> | <h:commandLink action="#{instancemgr.deleteInstance}">
+ <h:outputText value="Destroy"/>
+ <f:param name="id" value="#{instance.id}"/>
+ </h:commandLink>
+ </td>
+ </tr>
+ </c:forEach>
+ </tbody>
+ </table>
+ <ul class="pagination">
+ <c:forEach begin="0" end="#{instancemgr.instanceCount - 1}" step="#{instancemgr.paginationSize}"
+ var="index">
+ <li class="#{index == instancemgr.selectedFrom ? 'selected' : ''}">
+ <h:commandLink action="#{instancemgr.selectFrom}"><f:param name="from" value="#{index}"/><h:outputText
+ value="#{index}"/></h:commandLink>
+ </li>
+ </c:forEach>
+ </ul>
- </h:form>
+ </h:form>
- <c:if test="#{instancemgr.selectedPlugin != null}">
-
- <hr/>
+ <c:if test="#{instancemgr.selectedPlugin != null}">
- <c:if test="#{instancemgr.selectedPlugin == 'info'}">
- <c:choose>
- <c:when test="#{instancemgr.selectedInstance.portlet != null}">
- <h3>Portlet details
- </h3>
- <h:form>
- <h:commandLink
- action="#{portletmgr.selectPortlet}">
- <f:param name="id" value="#{instancemgr.selectedInstance.portlet.context.id}"/>
- <f:param name="plugin" value="manager"/>
- Show
- </h:commandLink> the associated portlet
- </h:form>
- <ui:include src="common/showPortletDetails.xhtml">
- <ui:param name="portlet" value="#{instancemgr.selectedInstance.portlet}"/>
- </ui:include>
- </c:when>
- <c:otherwise>
- <h3>Portlet details</h3>
- The associated portlet is not available
- </c:otherwise>
- </c:choose>
- </c:if>
+ <hr/>
- <c:if test="#{instancemgr.selectedPlugin == 'preferences'}">
- <h3>Editing preferences of #{instancemgr.selectedInstance.id}: </h3>
- <ui:include src="common/editPreferences.xhtml">
- <ui:param name="prefs" value="#{instancemgr.selectedPrefs}"/>
- </ui:include>
- <h:form style="text-align:center;padding: 1em 0 1em 0">
- <h:commandButton value="Save" action="#{instancemgr.updatePrefs}" styleClass="portlet-form-button"/>
- <h:commandButton value="Cancel" action="#{instancemgr.cancelPrefs}" styleClass="portlet-form-button"/>
- </h:form>
- </c:if>
-
- <c:if test="#{instancemgr.selectedPlugin == 'security'}">
- <h3>Editing security of #{instancemgr.selectedInstance.id}: </h3>
- <ui:include src="common/editSecurity.xhtml">
- <ui:param name="auth" value="#{instancemgr.auth}"/>
- </ui:include>
- </c:if>
+ <c:if test="#{instancemgr.selectedPlugin == 'info'}">
+ <c:choose>
+ <c:when test="#{instancemgr.selectedInstance.portlet != null}">
+ <h3>Portlet details
+ </h3>
+ <h:form>
+ <h:commandLink
+ action="#{portletmgr.selectPortlet}">
+ <f:param name="id" value="#{instancemgr.selectedInstance.portlet.context.id}"/>
+ <f:param name="plugin" value="manager"/>
+ Show
+ </h:commandLink> the associated portlet
+ </h:form>
+ <ui:include src="common/showPortletDetails.xhtml">
+ <ui:param name="portlet" value="#{instancemgr.selectedInstance.portlet}"/>
+ </ui:include>
+ </c:when>
+ <c:otherwise>
+ <h3>Portlet details</h3>
+ The associated portlet is not available
+ </c:otherwise>
+ </c:choose>
+ </c:if>
- </c:if>
+ <c:if test="#{instancemgr.selectedPlugin == 'preferences'}">
+ <h3>Editing preferences of #{instancemgr.selectedInstance.id}: </h3>
+ <ui:include src="common/editPreferences.xhtml">
+ <ui:param name="prefs" value="#{instancemgr.selectedPrefs}"/>
+ </ui:include>
+ <h:form style="text-align:center;padding: 1em 0 1em 0">
+ <h:commandButton value="Save" action="#{instancemgr.updatePrefs}" styleClass="portlet-form-button"/>
+ <h:commandButton value="Cancel" action="#{instancemgr.cancelPrefs}" styleClass="portlet-form-button"/>
+ </h:form>
+ </c:if>
-</ui:define>
+ <c:if test="#{instancemgr.selectedPlugin == 'security'}">
+ <h3>Editing security of #{instancemgr.selectedInstance.id}: </h3>
+ <ui:include src="common/editSecurity.xhtml">
+ <ui:param name="auth" value="#{instancemgr.auth}"/>
+ </ui:include>
+ </c:if>
+
+ </c:if>
+
+ </ui:define>
</ui:composition>
</div>
Modified: trunk/core-admin/src/resources/portal-admin-war/WEB-INF/jsf/portlets.xhtml
===================================================================
--- trunk/core-admin/src/resources/portal-admin-war/WEB-INF/jsf/portlets.xhtml 2007-03-18 00:50:12 UTC (rev 6728)
+++ trunk/core-admin/src/resources/portal-admin-war/WEB-INF/jsf/portlets.xhtml 2007-03-18 01:30:33 UTC (rev 6729)
@@ -1,90 +1,94 @@
<div
- xmlns="http://www.w3.org/1999/xhtml"
- xmlns:ui="http://java.sun.com/jsf/facelets"
- xmlns:h="http://java.sun.com/jsf/html"
- xmlns:f="http://java.sun.com/jsf/core"
- xmlns:jbp="http://www.jboss.com/portal"
- xmlns:c="http://java.sun.com/jstl/core"
- xmlns:pfc="http://www.jboss.com/portal/facelet/common">
+ xmlns="http://www.w3.org/1999/xhtml"
+ xmlns:ui="http://java.sun.com/jsf/facelets"
+ xmlns:h="http://java.sun.com/jsf/html"
+ xmlns:f="http://java.sun.com/jsf/core"
+ xmlns:jbp="http://www.jboss.com/portal"
+ xmlns:c="http://java.sun.com/jstl/core"
+ xmlns:pfc="http://www.jboss.com/portal/facelet/common">
-<ui:composition template="portletsTemplate.xhtml">
+ <ui:composition template="portletsTemplate.xhtml">
- <ui:define name="content">
-
- <h:form>
- <h:outputLabel for="menu">
- <h:outputText value="Portlet provider: " styleClass="portlet-form-field-label"/>
- </h:outputLabel>
- <h:selectOneMenu id="menu" styleClass="portlet-form-field" value="#{portletmgr.selectedPortletInvokerId}">
- <f:selectItems value="#{portletmgr.portletInvokerItems}"/>
- </h:selectOneMenu>
- <h:commandButton value="Change" styleClass="portlet-form-button"/>
- </h:form>
+ <ui:define name="content">
- <h:form>
- <table width="100%">
- <thead class="portlet-section-header">
- <tr>
- <th>Id</th>
- <th>Name</th>
- <th>Remote</th>
- <th>Remotable</th>
- <th>Actions</th>
- </tr>
- </thead>
- <tbody>
- <c:forEach items="#{portletmgr.selectedPortlets}" var="portlet" varStatus="status">
- <tr class="#{portlet.context.id == portletmgr.selectedPortlet.context.id ? 'portlet-section-selected' : (status.index % 2 == 0 ? 'portlet-section-body' : 'portlet-section-alternate')}">
- <td>
- <h:commandLink
- action="#{portletmgr.selectPortlet}">
- <f:param name="id" value="#{portlet.context.id}"/>
- <f:param name="plugin" value="manager"/>
- #{portlet.context.id}
- </h:commandLink>
- </td>
- <td>#{portlet.name.value}</td>
- <td><h:selectBooleanCheckbox disabled="true" value="#{portlet.remote}"/></td>
- <td><h:selectBooleanCheckbox disabled="true" value="#{portlet.remotable}"/></td>
- <td>
- <h:commandLink action="#{portletmgr.selectPortlet}">
- <f:param name="id" value="#{portlet.context.id}"/>
- <f:param name="plugin" value="manager"/>
- Info
- </h:commandLink> | <h:commandLink action="#{portletmgr.selectPortlet}">
- <f:param name="id" value="#{portlet.context.id}"/>
- <f:param name="plugin" value="preferences"/>
- Preferences
- </h:commandLink>
- </td>
- </tr>
- </c:forEach>
- </tbody>
- </table>
- <ul class="pagination">
- <c:forEach begin="0" end="#{portletmgr.portletCount}" step="#{portletmgr.paginationSize}" var="index">
- <li class="#{index == portletmgr.selectedFrom ? 'selected' : ''}">
- <h:commandLink action="#{portletmgr.selectFrom}"><f:param name="from" value="#{index}"/><h:outputText value="#{index}"/></h:commandLink>
- </li>
- </c:forEach>
- </ul>
- </h:form>
+ <h:form>
+ <h:outputLabel for="menu">
+ <h:outputText value="Portlet provider: " styleClass="portlet-form-field-label"/>
+ </h:outputLabel>
+ <h:selectOneMenu id="menu" styleClass="portlet-form-field" value="#{portletmgr.selectedPortletInvokerId}">
+ <f:selectItems value="#{portletmgr.portletInvokerItems}"/>
+ </h:selectOneMenu>
+ <h:commandButton value="Change" styleClass="portlet-form-button"/>
+ </h:form>
- <c:if test="#{portletmgr.selectedPortlet != null}">
- <c:if test="#{portletmgr.selectedPlugin == 'manager'}">
- <hr/>
- <h3>Portlet details</h3>
- <ui:include src="showPortletInfo.xhtml"/>
- </c:if>
- <c:if test="#{portletmgr.selectedPlugin == 'preferences'}">
- <hr/>
- <h3>Portlet preferences</h3>
- <ui:include src="common/editPreferences.xhtml">
- <ui:param name="prefs" value="#{portletmgr.selectedPreferences}"/>
- </ui:include>
- </c:if>
- </c:if>
+ <h:form>
+ <table width="100%">
+ <thead class="portlet-section-header">
+ <tr>
+ <th>Id</th>
+ <th>Name</th>
+ <th>Remote</th>
+ <th>Remotable</th>
+ <th>Actions</th>
+ </tr>
+ </thead>
+ <tbody>
+ <c:forEach items="#{portletmgr.selectedPortlets}" var="portlet" varStatus="status">
+ <tr
+ class="#{portlet.context.id == portletmgr.selectedPortlet.context.id ? 'portlet-section-selected' : (status.index % 2 == 0 ? 'portlet-section-body' : 'portlet-section-alternate')}">
+ <td>
+ <h:commandLink
+ action="#{portletmgr.selectPortlet}">
+ <f:param name="id" value="#{portlet.context.id}"/>
+ <f:param name="plugin" value="manager"/>
+ #{portlet.context.id}
+ </h:commandLink>
+ </td>
+ <td>#{portlet.name.value}</td>
+ <td><h:selectBooleanCheckbox disabled="true" value="#{portlet.remote}"/></td>
+ <td><h:selectBooleanCheckbox disabled="true" value="#{portlet.remotable}"/></td>
+ <td>
+ <h:commandLink action="#{portletmgr.selectPortlet}">
+ <f:param name="id" value="#{portlet.context.id}"/>
+ <f:param name="plugin" value="manager"/>
+ Info
+ </h:commandLink> | <h:commandLink action="#{portletmgr.selectPortlet}">
+ <f:param name="id" value="#{portlet.context.id}"/>
+ <f:param name="plugin" value="preferences"/>
+ Preferences
+ </h:commandLink>
+ </td>
+ </tr>
+ </c:forEach>
+ </tbody>
+ </table>
+ <ul class="pagination">
+ <c:forEach begin="0" end="#{portletmgr.portletCount - 1}" step="#{portletmgr.paginationSize}"
+ var="index">
+ <li class="#{index == portletmgr.selectedFrom ? 'selected' : ''}">
+ <h:commandLink action="#{portletmgr.selectFrom}"><f:param name="from"
+ value="#{index}"/><h:outputText
+ value="#{index}"/></h:commandLink>
+ </li>
+ </c:forEach>
+ </ul>
+ </h:form>
- </ui:define>
-</ui:composition>
+ <c:if test="#{portletmgr.selectedPortlet != null}">
+ <c:if test="#{portletmgr.selectedPlugin == 'manager'}">
+ <hr/>
+ <h3>Portlet details</h3>
+ <ui:include src="showPortletInfo.xhtml"/>
+ </c:if>
+ <c:if test="#{portletmgr.selectedPlugin == 'preferences'}">
+ <hr/>
+ <h3>Portlet preferences</h3>
+ <ui:include src="common/editPreferences.xhtml">
+ <ui:param name="prefs" value="#{portletmgr.selectedPreferences}"/>
+ </ui:include>
+ </c:if>
+ </c:if>
+
+ </ui:define>
+ </ui:composition>
</div>
Modified: trunk/core-admin/src/resources/portal-admin-war/WEB-INF/jsf/wizard/selectPortlet.xhtml
===================================================================
--- trunk/core-admin/src/resources/portal-admin-war/WEB-INF/jsf/wizard/selectPortlet.xhtml 2007-03-18 00:50:12 UTC (rev 6728)
+++ trunk/core-admin/src/resources/portal-admin-war/WEB-INF/jsf/wizard/selectPortlet.xhtml 2007-03-18 01:30:33 UTC (rev 6729)
@@ -4,46 +4,52 @@
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:c="http://java.sun.com/jstl/core">
- <ui:composition template="newWindowTpl.xhtml">
+ <ui:composition template="newWindowTpl.xhtml">
<ui:define name="content">
- <h:form>
- <h:outputLabel for="menu">
- <h:outputText value="Portlet provider: " styleClass="portlet-form-field-label"/>
- </h:outputLabel>
- <h:selectOneMenu id="menu" styleClass="portlet-form-field" value="#{portletmgr.selectedPortletInvokerId}">
- <f:selectItems value="#{portletmgr.portletInvokerItems}"/>
- </h:selectOneMenu>
- <h:commandButton value="Change" styleClass="portlet-form-button"/>
- </h:form>
+ <h:form>
+ <h:outputLabel for="menu">
+ <h:outputText value="Portlet provider: " styleClass="portlet-form-field-label"/>
+ </h:outputLabel>
+ <h:selectOneMenu id="menu" styleClass="portlet-form-field" value="#{portletmgr.selectedPortletInvokerId}">
+ <f:selectItems value="#{portletmgr.portletInvokerItems}"/>
+ </h:selectOneMenu>
+ <h:commandButton value="Change" styleClass="portlet-form-button"/>
+ </h:form>
- <h:form>
- <table width="100%">
- <thead class="portlet-section-header">
- <tr>
- <th>Name</th>
- </tr>
- </thead>
- <tbody>
- <c:forEach items="#{portletmgr.selectedPortlets}" var="portlet" varStatus="status">
- <tr class="#{portlet.context.id == newWindowWizard.selectedPortletId ? 'portlet-section-selected' : (status.index % 2 == 0 ? 'portlet-section-body' : 'portlet-section-alternate')}">
- <td><h:commandLink action="#{newWindowWizard.selectPortlet}">
- <h:outputText>#{portlet.name.value}</h:outputText>
- <f:param name="id" value="#{portlet.context.id}"/>
- <f:param name="portletInvokerId" value="#{portletmgr.selectedPortletInvokerId}"/>
- </h:commandLink></td>
- </tr>
- </c:forEach>
- </tbody>
- </table>
- <ul class="pagination">
- <c:forEach begin="0" end="#{portletmgr.portletCount}" step="#{portletmgr.paginationSize}" var="index">
- <li class="#{index == portletmgr.selectedFrom ? 'selected' : ''}">
- <h:commandLink action="#{portletmgr.selectFrom}"><f:param name="from" value="#{index}"/><h:outputText value="#{index}"/></h:commandLink>
- </li>
- </c:forEach>
- </ul>
- </h:form>
+ <h:form>
+ <table width="100%">
+ <thead class="portlet-section-header">
+ <tr>
+ <th>Name</th>
+ </tr>
+ </thead>
+ <tbody>
+ <c:forEach items="#{portletmgr.selectedPortlets}" var="portlet" varStatus="status">
+ <tr
+ class="#{portlet.context.id == newWindowWizard.selectedPortletId ? 'portlet-section-selected' : (status.index % 2 == 0 ? 'portlet-section-body' : 'portlet-section-alternate')}">
+ <td title="#{portlet.description.value}">
+ <h:commandLink action="#{newWindowWizard.selectPortlet}">
+ <h:outputText>#{!empty portlet.name.value ? portlet.name.value : "Unnamed"}</h:outputText>
+ <f:param name="id" value="#{portlet.context.id}"/>
+ <f:param name="portletInvokerId" value="#{portletmgr.selectedPortletInvokerId}"/>
+ </h:commandLink></td>
+ </tr>
+ </c:forEach>
+ </tbody>
+ </table>
+ <ul class="pagination">
+ <c:forEach begin="0" end="#{portletmgr.portletCount - 1}" step="#{portletmgr.paginationSize}"
+ var="index">
+ <li class="#{index == portletmgr.selectedFrom ? 'selected' : ''}">
+ <h:commandLink action="#{portletmgr.selectFrom}">
+ <f:param name="from" value="#{index}"/>
+ <h:outputText value="#{index}"/>
+ </h:commandLink>
+ </li>
+ </c:forEach>
+ </ul>
+ </h:form>
</ui:define>
- </ui:composition>
+ </ui:composition>
</div>
\ No newline at end of file
17 years, 6 months
JBoss Portal SVN: r6728 - in trunk: cms/src/main/org/jboss/portal/cms/impl/jcr and 12 other directories.
by portal-commits@lists.jboss.org
Author: julien(a)jboss.com
Date: 2007-03-17 20:50:12 -0400 (Sat, 17 Mar 2007)
New Revision: 6728
Added:
trunk/jems/src/main/org/jboss/portal/jems/as/JMX.java
trunk/jems/src/main/org/jboss/portal/jems/as/JNDI.java
Removed:
trunk/common/src/main/org/jboss/portal/common/util/JMX.java
trunk/common/src/main/org/jboss/portal/common/util/JNDI.java
Modified:
trunk/cms/src/main/org/jboss/portal/cms/impl/cache/CMSTreeCacheServiceImpl.java
trunk/cms/src/main/org/jboss/portal/cms/impl/jcr/JCRCMS.java
trunk/cms/src/main/org/jboss/portal/cms/security/AuthorizationManagerImpl.java
trunk/common/build.xml
trunk/common/src/main/org/jboss/portal/common/net/file/FileURLNavigationProvider.java
trunk/common/src/main/org/jboss/portal/common/util/LoaderResource.java
trunk/common/src/main/org/jboss/portal/common/util/LocalizedString.java
trunk/identity/src/main/org/jboss/portal/identity/IdentityServiceControllerImpl.java
trunk/identity/src/main/org/jboss/portal/identity/config/SimpleConfigurationImpl.java
trunk/identity/src/main/org/jboss/portal/identity/ldap/LDAPConnectionContext.java
trunk/identity/src/main/org/jboss/portal/identity/service/IdentityModuleService.java
trunk/jems/src/main/org/jboss/portal/jems/as/system/LifeCycleAdapter.java
trunk/workflow/src/main/org/jboss/portal/workflow/cms/ApprovePublishImpl.java
trunk/wsrp/src/main/org/jboss/portal/wsrp/endpoints/WSRPBaseEndpoint.java
Log:
moved classes from common package depending on jboss as libs to the JEMS package
Modified: trunk/cms/src/main/org/jboss/portal/cms/impl/cache/CMSTreeCacheServiceImpl.java
===================================================================
--- trunk/cms/src/main/org/jboss/portal/cms/impl/cache/CMSTreeCacheServiceImpl.java 2007-03-18 00:31:41 UTC (rev 6727)
+++ trunk/cms/src/main/org/jboss/portal/cms/impl/cache/CMSTreeCacheServiceImpl.java 2007-03-18 00:50:12 UTC (rev 6728)
@@ -28,7 +28,7 @@
import org.jboss.portal.cms.impl.CMSCacheException;
import org.jboss.portal.cms.impl.CMSTreeCacheService;
import org.jboss.portal.cms.model.File;
-import org.jboss.portal.common.util.JNDI;
+import org.jboss.portal.jems.as.JNDI;
import org.jboss.portal.jems.as.system.AbstractJBossService;
import java.util.Locale;
Modified: trunk/cms/src/main/org/jboss/portal/cms/impl/jcr/JCRCMS.java
===================================================================
--- trunk/cms/src/main/org/jboss/portal/cms/impl/jcr/JCRCMS.java 2007-03-18 00:31:41 UTC (rev 6727)
+++ trunk/cms/src/main/org/jboss/portal/cms/impl/jcr/JCRCMS.java 2007-03-18 00:50:12 UTC (rev 6728)
@@ -46,7 +46,7 @@
import org.jboss.portal.common.net.URLVisitor;
import org.jboss.portal.common.util.Tools;
import org.jboss.portal.common.util.XML;
-import org.jboss.portal.common.util.JNDI;
+import org.jboss.portal.jems.as.JNDI;
import org.jboss.portal.identity.User;
import org.jboss.portal.identity.UserModule;
import org.jboss.portal.identity.IdentityServiceController;
Modified: trunk/cms/src/main/org/jboss/portal/cms/security/AuthorizationManagerImpl.java
===================================================================
--- trunk/cms/src/main/org/jboss/portal/cms/security/AuthorizationManagerImpl.java 2007-03-18 00:31:41 UTC (rev 6727)
+++ trunk/cms/src/main/org/jboss/portal/cms/security/AuthorizationManagerImpl.java 2007-03-18 00:50:12 UTC (rev 6728)
@@ -25,13 +25,13 @@
import javax.security.auth.Subject;
import org.jboss.portal.jems.as.system.AbstractJBossService;
+import org.jboss.portal.jems.as.JNDI;
import org.jboss.portal.security.PortalPermission;
import org.jboss.portal.security.PortalSecurityException;
import org.jboss.portal.security.spi.auth.PortalAuthorizationManager;
import org.jboss.portal.cms.impl.jcr.command.ACLEnforcer;
-import org.jboss.portal.common.util.JNDI;
/**
* Created on : Jan 23, 2007
Modified: trunk/common/build.xml
===================================================================
--- trunk/common/build.xml 2007-03-18 00:31:41 UTC (rev 6727)
+++ trunk/common/build.xml 2007-03-18 00:50:12 UTC (rev 6728)
@@ -64,11 +64,17 @@
<!-- Configure thirdparty libraries -->
&libraries;
+
+ <path id="jbossas_restriction">
+ <pathelement location="${jbossas/core.libs.lib}/jboss-jmx.jar"/>
+ <pathelement location="${jbossas/core.libs.lib}/jboss-j2ee.jar"/>
+ </path>
+
<path id="library.classpath">
<path refid="sun.jaf.classpath"/>
<path refid="sun.servlet.classpath"/>
<path refid="oswego.concurrent.classpath"/>
- <path refid="jbossas/core.libs.classpath"/>
+ <path refid="jbossas_restriction"/>
<path refid="apache.ant.classpath"/>
<path refid="apache.log4j.classpath"/>
<path refid="jboss.test.classpath"/>
Modified: trunk/common/src/main/org/jboss/portal/common/net/file/FileURLNavigationProvider.java
===================================================================
--- trunk/common/src/main/org/jboss/portal/common/net/file/FileURLNavigationProvider.java 2007-03-18 00:31:41 UTC (rev 6727)
+++ trunk/common/src/main/org/jboss/portal/common/net/file/FileURLNavigationProvider.java 2007-03-18 00:50:12 UTC (rev 6728)
@@ -24,7 +24,7 @@
import org.jboss.portal.common.net.URLNavigationProvider;
import org.jboss.portal.common.net.URLVisitor;
-import org.jboss.logging.Logger;
+import org.apache.log4j.Logger;
import java.util.Arrays;
import java.net.URL;
@@ -42,7 +42,7 @@
private Logger log = Logger.getLogger(FileURLNavigationProvider.class);
/** Trace. */
- private boolean trace = log.isTraceEnabled();
+ private boolean trace = log.isDebugEnabled();
public void visit(URL url, URLVisitor visitor) throws IllegalArgumentException, IOException
{
@@ -57,7 +57,7 @@
{
if (trace)
{
- log.trace("entering directory" + file.getAbsolutePath());
+ log.debug("entering directory" + file.getAbsolutePath());
}
visitor.startDir(file.toURL(), name);
File[] childrenFiles = file.listFiles();
@@ -70,14 +70,14 @@
visitor.endDir(file.toURL(), name);
if (trace)
{
- log.trace("leaving directory" + file.getAbsolutePath());
+ log.debug("leaving directory" + file.getAbsolutePath());
}
}
else
{
if (trace)
{
- log.trace("visiting file " + file.getAbsolutePath());
+ log.debug("visiting file " + file.getAbsolutePath());
}
URL url = file.toURL();
File file2 = new File(url.getFile());
@@ -87,7 +87,7 @@
}
else if (trace)
{
- log.trace("The file does not respect url format");
+ log.debug("The file does not respect url format");
}
}
}
Deleted: trunk/common/src/main/org/jboss/portal/common/util/JMX.java
===================================================================
--- trunk/common/src/main/org/jboss/portal/common/util/JMX.java 2007-03-18 00:31:41 UTC (rev 6727)
+++ trunk/common/src/main/org/jboss/portal/common/util/JMX.java 2007-03-18 00:50:12 UTC (rev 6728)
@@ -1,199 +0,0 @@
-/******************************************************************************
- * JBoss, a division of Red Hat *
- * Copyright 2006, Red Hat Middleware, LLC, and individual *
- * contributors as indicated by the @authors tag. See the *
- * copyright.txt in the distribution for a full listing of *
- * individual contributors. *
- * *
- * This is free software; you can redistribute it and/or modify it *
- * under the terms of the GNU Lesser General Public License as *
- * published by the Free Software Foundation; either version 2.1 of *
- * the License, or (at your option) any later version. *
- * *
- * This software is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
- * Lesser General Public License for more details. *
- * *
- * You should have received a copy of the GNU Lesser General Public *
- * License along with this software; if not, write to the Free *
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
- ******************************************************************************/
-package org.jboss.portal.common.util;
-
-import org.apache.log4j.Logger;
-import org.jboss.mx.util.MBeanProxy;
-import org.jboss.mx.util.MBeanProxyCreationException;
-import org.jboss.mx.util.MBeanServerLocator;
-import org.jboss.mx.util.ObjectNameConverter;
-
-import javax.management.InstanceNotFoundException;
-import javax.management.ListenerNotFoundException;
-import javax.management.MBeanRegistrationException;
-import javax.management.MBeanServer;
-import javax.management.MalformedObjectNameException;
-import javax.management.NotificationFilter;
-import javax.management.NotificationListener;
-import javax.management.ObjectName;
-import java.util.Comparator;
-import java.util.Hashtable;
-import java.util.Properties;
-
-/**
- * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
- * @version $Revision$
- */
-public final class JMX
-{
-
- private static final Logger log = Logger.getLogger(JMX.class);
-
- public static ObjectName extend(ObjectName name, Properties keyProperties)
- {
- try
- {
- Hashtable table = name.getKeyPropertyList();
- table.putAll(keyProperties);
- return ObjectNameConverter.convert(name.getDomain(), table);
- }
- catch (MalformedObjectNameException e)
- {
- log.error("", e);
- throw new RuntimeException();
- }
- }
-
- /**
- * ObjectName comparator based on canonical name lexicography.
- */
- public static Comparator OBJECT_NAME_COMPARATOR = new Comparator()
- {
- public int compare(Object o1, Object o2)
- {
- ObjectName n1 = (ObjectName)o1;
- ObjectName n2 = (ObjectName)o2;
- return n1.getCanonicalName().compareTo(n2.getCanonicalName());
- }
- };
-
- public static void safeUnregister(MBeanServer server, ObjectName name)
- {
- if (server != null)
- {
- if (name != null)
- {
- try
- {
- server.unregisterMBean(name);
- }
- catch (InstanceNotFoundException e)
- {
- log.error("MBean " + name + " nto here");
- }
- catch (MBeanRegistrationException e)
- {
- log.error("MBean threw an exception during unregistration", e.getTargetException());
- }
- }
- else
- {
- log.error("Cannot unregister a null MBean");
- }
- }
- else
- {
- log.error("Cannot unregister with a null MBeanServer");
- }
- }
-
- /**
- * Retrieves the MBeanProxy associated with the given class and name from the specified MBeanServer.
- *
- * @param clazz the interface implemented by the MBean which is to be retrieved
- * @param name the MBean's ObjectName
- * @param server the MBeanServer from which to retrieve the MBeanProxy
- * @return a MBeanProxy for the specified MBean if it exists
- * @throws RuntimeException if the MBean couldn't be retrieved
- */
- public static Object getMBeanProxy(Class clazz, ObjectName name, MBeanServer server)
- {
- try
- {
- return MBeanProxy.get(clazz, name, server);
- }
- catch (MBeanProxyCreationException e)
- {
- String message = "Couldn't retrieve '" + name.getCanonicalName() + "' MBean with class " + clazz.getName();
- log.error(message, e);
- throw new RuntimeException(message, e);
- }
- }
-
- /**
- * Retrieves the MBeanProxy associated with the given class and name from the JBoss microkernel as returned by
- * <code>MBeanServerLocator.locateJBoss()</code>.
- *
- * @param clazz the interface implemented by the MBean which is to be retrieved
- * @param name a String representation of the MBean's ObjectName
- * @return a MBeanProxy for the specified MBean if it exists
- * @throws IllegalArgumentException if the given name is not a valid ObjectName
- * @throws RuntimeException if the MBean couldn't be retrieved
- * @see #getMBeanProxy(Class, javax.management.ObjectName, javax.management.MBeanServer)
- * @since 2.4
- */
- public static Object getMBeanProxy(Class clazz, String name)
- {
- ObjectName objecName;
- try
- {
- objecName = new ObjectName(name);
- }
- catch (MalformedObjectNameException e)
- {
- throw new IllegalArgumentException("'" + name + "' is not a valid ObjectName");
- }
- MBeanServer server = MBeanServerLocator.locateJBoss();
- return getMBeanProxy(clazz, objecName, server);
- }
-
- public static boolean addNotificationListener(
- MBeanServer server,
- ObjectName name,
- NotificationListener listener,
- NotificationFilter filter,
- Object handback)
- {
- try
- {
- server.addNotificationListener(name, listener, filter, handback);
- return true;
- }
- catch (InstanceNotFoundException e)
- {
- return false;
- }
- }
-
- public static boolean removeNotificationListener(
- MBeanServer server,
- ObjectName name,
- NotificationListener listener)
- {
- try
- {
- server.removeNotificationListener(name, listener);
- return true;
- }
- catch (InstanceNotFoundException e)
- {
- log.error("Cannot remove notification listener", e);
- return false;
- }
- catch (ListenerNotFoundException e)
- {
- log.error("Cannot remove notification listener", e);
- return false;
- }
- }
-}
Deleted: trunk/common/src/main/org/jboss/portal/common/util/JNDI.java
===================================================================
--- trunk/common/src/main/org/jboss/portal/common/util/JNDI.java 2007-03-18 00:31:41 UTC (rev 6727)
+++ trunk/common/src/main/org/jboss/portal/common/util/JNDI.java 2007-03-18 00:50:12 UTC (rev 6728)
@@ -1,126 +0,0 @@
-/******************************************************************************
- * JBoss, a division of Red Hat *
- * Copyright 2006, Red Hat Middleware, LLC, and individual *
- * contributors as indicated by the @authors tag. See the *
- * copyright.txt in the distribution for a full listing of *
- * individual contributors. *
- * *
- * This is free software; you can redistribute it and/or modify it *
- * under the terms of the GNU Lesser General Public License as *
- * published by the Free Software Foundation; either version 2.1 of *
- * the License, or (at your option) any later version. *
- * *
- * This software is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
- * Lesser General Public License for more details. *
- * *
- * You should have received a copy of the GNU Lesser General Public *
- * License along with this software; if not, write to the Free *
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
- ******************************************************************************/
-package org.jboss.portal.common.util;
-
-import org.jboss.util.naming.NonSerializableFactory;
-
-import javax.naming.CompositeName;
-import javax.naming.NameNotFoundException;
-import javax.naming.NamingException;
-
-/**
- * Various JNDI stuff.
- *
- * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
- * @version $Revision$
- */
-public class JNDI
-{
-
- /**
- * Encapsulate JNDI binding operation into one single class, hidding non usefull JNDI complexity.
- * It has been designed to fit with service life cycle.
- *
- * <code>
- *
- * private String jndiName;
- * private JNDI.Binding jndiBinding;
- *
- * public void startService() throws Exception
- * {
- * ...
- * if (this.jndiName != null)
- * {
- * jndiBinding = new JNDI.Binding(jndiName, this);
- * jndiBinding.bind();
- * }
- * ...
- * }
- *
- * public void stopService() throws Exception
- * {
- * ...
- * if (jndiBinding != null)
- * {
- * jndiBinding.unbind();
- * jndiBinding = null;
- * }
- * ...
- * }
- * </code>
- */
- public static class Binding
- {
-
- /** . */
- private final String jndiName;
-
- /** . */
- private String unbindJNDIName;
-
- /** . */
- private Object o;
-
- public Binding(String jndiName, Object o)
- {
- if (jndiName == null)
- {
- throw new IllegalArgumentException("No JNDI name provided");
- }
- if (o == null)
- {
- throw new IllegalArgumentException("No object to bind for JNDI name " + jndiName);
- }
- this.jndiName = jndiName;
- this.o = o;
- }
-
- /**
- * Attempt to perform binding.
- *
- * @throws NamingException on failure
- */
- public void bind() throws NamingException
- {
- NonSerializableFactory.rebind(new CompositeName(jndiName), o, true);
- unbindJNDIName = jndiName;
- }
-
- /**
- * Unbinds in a safe manner.
- */
- public void unbind()
- {
- if (unbindJNDIName != null)
- {
- try
- {
- NonSerializableFactory.unbind(unbindJNDIName);
- }
- catch (NameNotFoundException ignore)
- {
- }
- }
- }
- }
-}
Modified: trunk/common/src/main/org/jboss/portal/common/util/LoaderResource.java
===================================================================
--- trunk/common/src/main/org/jboss/portal/common/util/LoaderResource.java 2007-03-18 00:31:41 UTC (rev 6727)
+++ trunk/common/src/main/org/jboss/portal/common/util/LoaderResource.java 2007-03-18 00:50:12 UTC (rev 6728)
@@ -22,17 +22,15 @@
******************************************************************************/
package org.jboss.portal.common.util;
-import org.jboss.logging.Logger;
import org.w3c.dom.Document;
-import org.w3c.dom.Element;
import org.xml.sax.SAXException;
+import org.apache.log4j.Logger;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.ParserConfigurationException;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.InputStream;
-import java.util.Iterator;
import java.util.Properties;
/**
Modified: trunk/common/src/main/org/jboss/portal/common/util/LocalizedString.java
===================================================================
--- trunk/common/src/main/org/jboss/portal/common/util/LocalizedString.java 2007-03-18 00:31:41 UTC (rev 6727)
+++ trunk/common/src/main/org/jboss/portal/common/util/LocalizedString.java 2007-03-18 00:50:12 UTC (rev 6728)
@@ -22,7 +22,7 @@
******************************************************************************/
package org.jboss.portal.common.util;
-import org.jboss.logging.Logger;
+import org.apache.log4j.Logger;
import java.util.Collections;
import java.util.HashMap;
@@ -297,9 +297,9 @@
}
catch (IllegalArgumentException e)
{
- if (log.isTraceEnabled())
+ if (log.isDebugEnabled())
{
- log.warn("Invalid desired locale " + desiredLocale);
+ log.debug("Invalid desired locale " + desiredLocale);
}
}
}
Modified: trunk/identity/src/main/org/jboss/portal/identity/IdentityServiceControllerImpl.java
===================================================================
--- trunk/identity/src/main/org/jboss/portal/identity/IdentityServiceControllerImpl.java 2007-03-18 00:31:41 UTC (rev 6727)
+++ trunk/identity/src/main/org/jboss/portal/identity/IdentityServiceControllerImpl.java 2007-03-18 00:50:12 UTC (rev 6728)
@@ -23,7 +23,7 @@
import org.jboss.portal.jems.as.system.AbstractJBossService;
import org.jboss.portal.jems.as.system.JBossServiceModelMBean;
-import org.jboss.portal.common.util.JNDI;
+import org.jboss.portal.jems.as.JNDI;
import org.jboss.portal.identity.IdentityException;
import org.jboss.portal.identity.IdentityContext;
import org.jboss.portal.identity.IdentityContextImpl;
Modified: trunk/identity/src/main/org/jboss/portal/identity/config/SimpleConfigurationImpl.java
===================================================================
--- trunk/identity/src/main/org/jboss/portal/identity/config/SimpleConfigurationImpl.java 2007-03-18 00:31:41 UTC (rev 6727)
+++ trunk/identity/src/main/org/jboss/portal/identity/config/SimpleConfigurationImpl.java 2007-03-18 00:50:12 UTC (rev 6728)
@@ -21,7 +21,7 @@
*/
package org.jboss.portal.identity.config;
-import org.jboss.portal.common.util.JNDI;
+import org.jboss.portal.jems.as.JNDI;
import org.jboss.portal.identity.IdentityConfiguration;
import org.jboss.portal.identity.IdentityContext;
import org.jboss.portal.jems.as.system.AbstractJBossService;
Modified: trunk/identity/src/main/org/jboss/portal/identity/ldap/LDAPConnectionContext.java
===================================================================
--- trunk/identity/src/main/org/jboss/portal/identity/ldap/LDAPConnectionContext.java 2007-03-18 00:31:41 UTC (rev 6727)
+++ trunk/identity/src/main/org/jboss/portal/identity/ldap/LDAPConnectionContext.java 2007-03-18 00:50:12 UTC (rev 6728)
@@ -25,14 +25,13 @@
import org.jboss.portal.jems.as.system.AbstractJBossService;
import org.jboss.portal.identity.service.IdentityModuleService;
import org.jboss.portal.identity.IdentityException;
-import org.jboss.portal.common.util.JNDI;
+import org.jboss.portal.jems.as.JNDI;
import javax.naming.Context;
import javax.naming.NamingException;
import javax.naming.InitialContext;
import javax.naming.ldap.InitialLdapContext;
import java.util.Hashtable;
-import java.util.Map;
/**
* Keeps configuration of connection to LDAP server
Modified: trunk/identity/src/main/org/jboss/portal/identity/service/IdentityModuleService.java
===================================================================
--- trunk/identity/src/main/org/jboss/portal/identity/service/IdentityModuleService.java 2007-03-18 00:31:41 UTC (rev 6727)
+++ trunk/identity/src/main/org/jboss/portal/identity/service/IdentityModuleService.java 2007-03-18 00:50:12 UTC (rev 6728)
@@ -23,7 +23,7 @@
import org.jboss.portal.identity.IdentityContext;
import org.jboss.portal.identity.IdentityConfiguration;
-import org.jboss.portal.common.util.JNDI;
+import org.jboss.portal.jems.as.JNDI;
import org.jboss.portal.identity.IdentityException;
import org.jboss.portal.identity.event.IdentityEventBroadcaster;
import org.jboss.portal.jems.as.system.AbstractJBossService;
Copied: trunk/jems/src/main/org/jboss/portal/jems/as/JMX.java (from rev 6720, trunk/common/src/main/org/jboss/portal/common/util/JMX.java)
===================================================================
--- trunk/jems/src/main/org/jboss/portal/jems/as/JMX.java (rev 0)
+++ trunk/jems/src/main/org/jboss/portal/jems/as/JMX.java 2007-03-18 00:50:12 UTC (rev 6728)
@@ -0,0 +1,199 @@
+/******************************************************************************
+ * 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.jems.as;
+
+import org.apache.log4j.Logger;
+import org.jboss.mx.util.MBeanProxy;
+import org.jboss.mx.util.MBeanProxyCreationException;
+import org.jboss.mx.util.MBeanServerLocator;
+import org.jboss.mx.util.ObjectNameConverter;
+
+import javax.management.InstanceNotFoundException;
+import javax.management.ListenerNotFoundException;
+import javax.management.MBeanRegistrationException;
+import javax.management.MBeanServer;
+import javax.management.MalformedObjectNameException;
+import javax.management.NotificationFilter;
+import javax.management.NotificationListener;
+import javax.management.ObjectName;
+import java.util.Comparator;
+import java.util.Hashtable;
+import java.util.Properties;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision$
+ */
+public final class JMX
+{
+
+ private static final Logger log = Logger.getLogger(JMX.class);
+
+ public static ObjectName extend(ObjectName name, Properties keyProperties)
+ {
+ try
+ {
+ Hashtable table = name.getKeyPropertyList();
+ table.putAll(keyProperties);
+ return ObjectNameConverter.convert(name.getDomain(), table);
+ }
+ catch (MalformedObjectNameException e)
+ {
+ log.error("", e);
+ throw new RuntimeException();
+ }
+ }
+
+ /**
+ * ObjectName comparator based on canonical name lexicography.
+ */
+ public static Comparator OBJECT_NAME_COMPARATOR = new Comparator()
+ {
+ public int compare(Object o1, Object o2)
+ {
+ ObjectName n1 = (ObjectName)o1;
+ ObjectName n2 = (ObjectName)o2;
+ return n1.getCanonicalName().compareTo(n2.getCanonicalName());
+ }
+ };
+
+ public static void safeUnregister(MBeanServer server, ObjectName name)
+ {
+ if (server != null)
+ {
+ if (name != null)
+ {
+ try
+ {
+ server.unregisterMBean(name);
+ }
+ catch (InstanceNotFoundException e)
+ {
+ log.error("MBean " + name + " nto here");
+ }
+ catch (MBeanRegistrationException e)
+ {
+ log.error("MBean threw an exception during unregistration", e.getTargetException());
+ }
+ }
+ else
+ {
+ log.error("Cannot unregister a null MBean");
+ }
+ }
+ else
+ {
+ log.error("Cannot unregister with a null MBeanServer");
+ }
+ }
+
+ /**
+ * Retrieves the MBeanProxy associated with the given class and name from the specified MBeanServer.
+ *
+ * @param clazz the interface implemented by the MBean which is to be retrieved
+ * @param name the MBean's ObjectName
+ * @param server the MBeanServer from which to retrieve the MBeanProxy
+ * @return a MBeanProxy for the specified MBean if it exists
+ * @throws RuntimeException if the MBean couldn't be retrieved
+ */
+ public static Object getMBeanProxy(Class clazz, ObjectName name, MBeanServer server)
+ {
+ try
+ {
+ return MBeanProxy.get(clazz, name, server);
+ }
+ catch (MBeanProxyCreationException e)
+ {
+ String message = "Couldn't retrieve '" + name.getCanonicalName() + "' MBean with class " + clazz.getName();
+ log.error(message, e);
+ throw new RuntimeException(message, e);
+ }
+ }
+
+ /**
+ * Retrieves the MBeanProxy associated with the given class and name from the JBoss microkernel as returned by
+ * <code>MBeanServerLocator.locateJBoss()</code>.
+ *
+ * @param clazz the interface implemented by the MBean which is to be retrieved
+ * @param name a String representation of the MBean's ObjectName
+ * @return a MBeanProxy for the specified MBean if it exists
+ * @throws IllegalArgumentException if the given name is not a valid ObjectName
+ * @throws RuntimeException if the MBean couldn't be retrieved
+ * @see #getMBeanProxy(Class, javax.management.ObjectName, javax.management.MBeanServer)
+ * @since 2.4
+ */
+ public static Object getMBeanProxy(Class clazz, String name)
+ {
+ ObjectName objecName;
+ try
+ {
+ objecName = new ObjectName(name);
+ }
+ catch (MalformedObjectNameException e)
+ {
+ throw new IllegalArgumentException("'" + name + "' is not a valid ObjectName");
+ }
+ MBeanServer server = MBeanServerLocator.locateJBoss();
+ return getMBeanProxy(clazz, objecName, server);
+ }
+
+ public static boolean addNotificationListener(
+ MBeanServer server,
+ ObjectName name,
+ NotificationListener listener,
+ NotificationFilter filter,
+ Object handback)
+ {
+ try
+ {
+ server.addNotificationListener(name, listener, filter, handback);
+ return true;
+ }
+ catch (InstanceNotFoundException e)
+ {
+ return false;
+ }
+ }
+
+ public static boolean removeNotificationListener(
+ MBeanServer server,
+ ObjectName name,
+ NotificationListener listener)
+ {
+ try
+ {
+ server.removeNotificationListener(name, listener);
+ return true;
+ }
+ catch (InstanceNotFoundException e)
+ {
+ log.error("Cannot remove notification listener", e);
+ return false;
+ }
+ catch (ListenerNotFoundException e)
+ {
+ log.error("Cannot remove notification listener", e);
+ return false;
+ }
+ }
+}
Property changes on: trunk/jems/src/main/org/jboss/portal/jems/as/JMX.java
___________________________________________________________________
Name: svn:executable
+ *
Name: svn:keywords
+ Author Date Id Revision
Name: svn:eol-style
+ native
Copied: trunk/jems/src/main/org/jboss/portal/jems/as/JNDI.java (from rev 6720, trunk/common/src/main/org/jboss/portal/common/util/JNDI.java)
===================================================================
--- trunk/jems/src/main/org/jboss/portal/jems/as/JNDI.java (rev 0)
+++ trunk/jems/src/main/org/jboss/portal/jems/as/JNDI.java 2007-03-18 00:50:12 UTC (rev 6728)
@@ -0,0 +1,126 @@
+/******************************************************************************
+ * 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.jems.as;
+
+import org.jboss.util.naming.NonSerializableFactory;
+
+import javax.naming.CompositeName;
+import javax.naming.NameNotFoundException;
+import javax.naming.NamingException;
+
+/**
+ * Various JNDI stuff.
+ *
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision$
+ */
+public class JNDI
+{
+
+ /**
+ * Encapsulate JNDI binding operation into one single class, hidding non usefull JNDI complexity.
+ * It has been designed to fit with service life cycle.
+ *
+ * <code>
+ *
+ * private String jndiName;
+ * private JNDI.Binding jndiBinding;
+ *
+ * public void startService() throws Exception
+ * {
+ * ...
+ * if (this.jndiName != null)
+ * {
+ * jndiBinding = new JNDI.Binding(jndiName, this);
+ * jndiBinding.bind();
+ * }
+ * ...
+ * }
+ *
+ * public void stopService() throws Exception
+ * {
+ * ...
+ * if (jndiBinding != null)
+ * {
+ * jndiBinding.unbind();
+ * jndiBinding = null;
+ * }
+ * ...
+ * }
+ * </code>
+ */
+ public static class Binding
+ {
+
+ /** . */
+ private final String jndiName;
+
+ /** . */
+ private String unbindJNDIName;
+
+ /** . */
+ private Object o;
+
+ public Binding(String jndiName, Object o)
+ {
+ if (jndiName == null)
+ {
+ throw new IllegalArgumentException("No JNDI name provided");
+ }
+ if (o == null)
+ {
+ throw new IllegalArgumentException("No object to bind for JNDI name " + jndiName);
+ }
+ this.jndiName = jndiName;
+ this.o = o;
+ }
+
+ /**
+ * Attempt to perform binding.
+ *
+ * @throws NamingException on failure
+ */
+ public void bind() throws NamingException
+ {
+ NonSerializableFactory.rebind(new CompositeName(jndiName), o, true);
+ unbindJNDIName = jndiName;
+ }
+
+ /**
+ * Unbinds in a safe manner.
+ */
+ public void unbind()
+ {
+ if (unbindJNDIName != null)
+ {
+ try
+ {
+ NonSerializableFactory.unbind(unbindJNDIName);
+ }
+ catch (NameNotFoundException ignore)
+ {
+ }
+ }
+ }
+ }
+}
Property changes on: trunk/jems/src/main/org/jboss/portal/jems/as/JNDI.java
___________________________________________________________________
Name: svn:executable
+ *
Name: svn:keywords
+ Author Date Id Revision
Name: svn:eol-style
+ native
Modified: trunk/jems/src/main/org/jboss/portal/jems/as/system/LifeCycleAdapter.java
===================================================================
--- trunk/jems/src/main/org/jboss/portal/jems/as/system/LifeCycleAdapter.java 2007-03-18 00:31:41 UTC (rev 6727)
+++ trunk/jems/src/main/org/jboss/portal/jems/as/system/LifeCycleAdapter.java 2007-03-18 00:50:12 UTC (rev 6728)
@@ -26,7 +26,7 @@
import org.jboss.mx.util.MBeanProxy;
import org.jboss.mx.util.MBeanProxyCreationException;
import org.jboss.mx.util.ObjectNameFactory;
-import org.jboss.portal.common.util.JMX;
+import org.jboss.portal.jems.as.JMX;
import org.jboss.system.ServiceController;
import org.jboss.system.ServiceControllerMBean;
import org.jboss.system.ServiceMBean;
Modified: trunk/workflow/src/main/org/jboss/portal/workflow/cms/ApprovePublishImpl.java
===================================================================
--- trunk/workflow/src/main/org/jboss/portal/workflow/cms/ApprovePublishImpl.java 2007-03-18 00:31:41 UTC (rev 6727)
+++ trunk/workflow/src/main/org/jboss/portal/workflow/cms/ApprovePublishImpl.java 2007-03-18 00:50:12 UTC (rev 6728)
@@ -35,7 +35,7 @@
import org.apache.log4j.Logger;
-import org.jboss.portal.common.util.JNDI;
+import org.jboss.portal.jems.as.JNDI;
import org.jboss.portal.common.util.Tools;
import org.jbpm.JbpmContext;
Modified: trunk/wsrp/src/main/org/jboss/portal/wsrp/endpoints/WSRPBaseEndpoint.java
===================================================================
--- trunk/wsrp/src/main/org/jboss/portal/wsrp/endpoints/WSRPBaseEndpoint.java 2007-03-18 00:31:41 UTC (rev 6727)
+++ trunk/wsrp/src/main/org/jboss/portal/wsrp/endpoints/WSRPBaseEndpoint.java 2007-03-18 00:50:12 UTC (rev 6728)
@@ -23,7 +23,7 @@
package org.jboss.portal.wsrp.endpoints;
-import org.jboss.portal.common.util.JMX;
+import org.jboss.portal.jems.as.JMX;
import org.jboss.portal.wsrp.WSRPConstants;
import org.jboss.portal.wsrp.WSRPProducer;
17 years, 6 months
JBoss Portal SVN: r6727 - trunk/core-admin/src/resources/portal-admin-war/WEB-INF/jsf/common.
by portal-commits@lists.jboss.org
Author: julien(a)jboss.com
Date: 2007-03-17 20:31:41 -0400 (Sat, 17 Mar 2007)
New Revision: 6727
Modified:
trunk/core-admin/src/resources/portal-admin-war/WEB-INF/jsf/common/editPageLayout.xhtml
Log:
put in page layout editor input and select in form even if they are never actionned. Being in a form they will never participate in the decode phase
Modified: trunk/core-admin/src/resources/portal-admin-war/WEB-INF/jsf/common/editPageLayout.xhtml
===================================================================
--- trunk/core-admin/src/resources/portal-admin-war/WEB-INF/jsf/common/editPageLayout.xhtml 2007-03-17 18:47:52 UTC (rev 6726)
+++ trunk/core-admin/src/resources/portal-admin-war/WEB-INF/jsf/common/editPageLayout.xhtml 2007-03-18 00:31:41 UTC (rev 6727)
@@ -111,9 +111,11 @@
<span class="portlet-form-field-label">Window Name:</span>
</td>
<td class="widget">
- <h:inputText id="windowName" value="#{assignWindowsAction.windowName}"
- styleClass="portlet-form-input-field"/>
- <h:message for="windowName" errorClass="portlet-msg-error"/>
+ <h:form id="windowForm">
+ <h:inputText id="windowName" value="#{assignWindowsAction.windowName}"
+ styleClass="portlet-form-input-field"/>
+ <h:message for="windowName" errorClass="portlet-msg-error"/>
+ </h:form>
</td>
</tr>
<tr>
@@ -121,10 +123,12 @@
<span class="portlet-form-field-label">Target Region:</span>
</td>
<td class="widget">
- <h:selectOneMenu id="targetRegion" styleClass="portlet-form-input-field">
- <f:selectItems value="#{pageManager.regionItems}"/>
- </h:selectOneMenu>
- <h:message for="targetRegion" errorClass="portlet-msg-error"/>
+ <h:form id="regionForm">
+ <h:selectOneMenu id="targetRegion" styleClass="portlet-form-input-field">
+ <f:selectItems value="#{pageManager.regionItems}"/>
+ </h:selectOneMenu>
+ <h:message for="targetRegion" errorClass="portlet-msg-error"/>
+ </h:form>
</td>
</tr>
<tr>
@@ -140,7 +144,7 @@
supportedWindowStates="normal"
initialMode="edit_content"
initialWindowState="normal"
- onClick="url.setParameter('windowName', document.getElementById('windowName').value).setParameter('targetRegion', document.getElementById('targetRegion').value);"/>
+ onClick="url.setParameter('windowName', document.getElementById('windowForm:windowName').value).setParameter('targetRegion', document.getElementById('regionForm:targetRegion').value);"/>
</div>
</td>
</tr>
17 years, 6 months
JBoss Portal SVN: r6726 - in trunk/wsrp/src/main/org/jboss/portal: wsrp and 2 other directories.
by portal-commits@lists.jboss.org
Author: chris.laprun(a)jboss.com
Date: 2007-03-17 14:47:52 -0400 (Sat, 17 Mar 2007)
New Revision: 6726
Modified:
trunk/wsrp/src/main/org/jboss/portal/test/wsrp/framework/support/MockWSRPConsumer.java
trunk/wsrp/src/main/org/jboss/portal/wsrp/WSRPConsumer.java
trunk/wsrp/src/main/org/jboss/portal/wsrp/consumer/ConsumerRegistryService.java
trunk/wsrp/src/main/org/jboss/portal/wsrp/consumer/WSRPConsumerImpl.java
trunk/wsrp/src/main/org/jboss/portal/wsrp/services/AbstractSOAPServiceFactory.java
Log:
- Properly start and stop Consumers.
- Separated starting and activation concepts since the Consumer service can be stopped but the Consumer should stay marked as active in the DB.
Modified: trunk/wsrp/src/main/org/jboss/portal/test/wsrp/framework/support/MockWSRPConsumer.java
===================================================================
--- trunk/wsrp/src/main/org/jboss/portal/test/wsrp/framework/support/MockWSRPConsumer.java 2007-03-17 14:34:52 UTC (rev 6725)
+++ trunk/wsrp/src/main/org/jboss/portal/test/wsrp/framework/support/MockWSRPConsumer.java 2007-03-17 18:47:52 UTC (rev 6726)
@@ -95,6 +95,14 @@
{
}
+ public void activate() throws Exception
+ {
+ }
+
+ public void deactivate() throws Exception
+ {
+ }
+
public Set getPortlets() throws PortletInvokerException
{
return null;
Modified: trunk/wsrp/src/main/org/jboss/portal/wsrp/WSRPConsumer.java
===================================================================
--- trunk/wsrp/src/main/org/jboss/portal/wsrp/WSRPConsumer.java 2007-03-17 14:34:52 UTC (rev 6725)
+++ trunk/wsrp/src/main/org/jboss/portal/wsrp/WSRPConsumer.java 2007-03-17 18:47:52 UTC (rev 6726)
@@ -105,4 +105,8 @@
* @since 2.6
*/
void releaseSession(String sessionId) throws PortletInvokerException;
+
+ void activate() throws Exception;
+
+ void deactivate() throws Exception;
}
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-17 14:34:52 UTC (rev 6725)
+++ trunk/wsrp/src/main/org/jboss/portal/wsrp/consumer/ConsumerRegistryService.java 2007-03-17 18:47:52 UTC (rev 6726)
@@ -59,6 +59,7 @@
private String sessionFactoryJNDIName;
private RegistrationInfo nullRegistration;
+ private static final String CONSUMER_WITH_ID = "Consumer with id '";
public FederatingPortletInvoker getFederatingPortletInvoker()
{
@@ -71,7 +72,7 @@
if (getConsumer(id) != null)
{
- throw new ConsumerException("A Consumer with id '" + id + "' already exists!");
+ throw new ConsumerException(CONSUMER_WITH_ID + id + "' already exists!");
}
@@ -94,6 +95,7 @@
throw new ConsumerException("Couldn't create Consumer '" + id + "'", e);
}
+ log.info(CONSUMER_WITH_ID + id + "' created");
return createConsumerFrom(info);
}
@@ -211,6 +213,14 @@
protected void stopService() throws Exception
{
sessionFactory = null;
+
+ for (Iterator consumersIt = consumers.values().iterator(); consumersIt.hasNext();)
+ {
+ WSRPConsumer consumer = (WSRPConsumer)consumersIt.next();
+ federatingPortletInvoker.unregisterInvoker(consumer.getProducerId());
+ consumer.stop();
+ }
+
consumers.clear();
consumers = null;
}
@@ -239,7 +249,7 @@
if (consumer == null)
{
- throw new ConsumerException("Consumer with id '" + id + "' doesn't exist!");
+ throw new ConsumerException(CONSUMER_WITH_ID + id + "' doesn't exist!");
}
try
@@ -247,15 +257,19 @@
if (register)
{
consumer.getProducerInfo().register();
+
+ log.info(CONSUMER_WITH_ID + id + "' registered");
}
else
{
consumer.getProducerInfo().deregister();
+
+ log.info(CONSUMER_WITH_ID + id + "' deregistered");
}
}
catch (PortletInvokerException e)
{
- throw new ConsumerException("Couldn't " + (register ? "register" : "deregister") + " Consumer '" + id + "'", e);
+ throw new ConsumerException("Couldn't " + (register ? "register" : "deregister") + CONSUMER_WITH_ID + id + "'", e);
}
}
@@ -271,13 +285,16 @@
if (consumer == null)
{
- throw new IllegalArgumentException("Consumer with id '" + id + "' doesn't exist!");
+ throw new IllegalArgumentException(CONSUMER_WITH_ID + id + "' doesn't exist!");
}
WSRPConsumerService service = new WSRPConsumerService();
service.setConsumer(consumer);
service.setFederatingPortletInvoker(federatingPortletInvoker);
service.start();
+ consumer.activate();
+
+ log.info(CONSUMER_WITH_ID + id + "' activated");
}
else
{
@@ -289,7 +306,9 @@
{
consumer = (WSRPConsumer)invoker;
federatingPortletInvoker.unregisterInvoker(id);
- consumer.stop();
+ consumer.deactivate();
+
+ log.info(CONSUMER_WITH_ID + id + "' deactivated");
}
else
{
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-17 14:34:52 UTC (rev 6725)
+++ trunk/wsrp/src/main/org/jboss/portal/wsrp/consumer/WSRPConsumerImpl.java 2007-03-17 18:47:52 UTC (rev 6726)
@@ -116,6 +116,7 @@
/** The set of supported user scopes */
private Set supportedUserScopes = WSRP_DEFAULT_USER_SCOPE; // todo: make it possible to support different user scopes
+ private transient boolean started;
public WSRPConsumerImpl()
{
@@ -456,21 +457,41 @@
return sessionHandler.getProducerSessionInformation(session);
}
+
+ public void activate() throws Exception
+ {
+ if (!started)
+ {
+ startService();
+ }
+ producerInfo.setActive(getServiceFactory().isAvailable());
+ }
+
+ public void deactivate() throws Exception
+ {
+ producerInfo.setActive(false);
+ if (started)
+ {
+ stopService();
+ }
+ }
+
// Service implementation *******************************************************************************************
protected void startService() throws Exception
{
super.startService();
- ServiceFactory factory = getServiceFactory();
- factory.start();
- producerInfo.setActive(factory.isAvailable());
+ getServiceFactory().start();
+ started = true;
+ log.info("Consumer with id '" + getProducerId() + "' started");
}
protected void stopService() throws Exception
{
- producerInfo.setActive(false);
getServiceFactory().stop();
super.stopService();
+ started = false;
+ log.info("Consumer with id '" + getProducerId() + "' stopped");
}
// Web services access **********************************************************************************************
Modified: trunk/wsrp/src/main/org/jboss/portal/wsrp/services/AbstractSOAPServiceFactory.java
===================================================================
--- trunk/wsrp/src/main/org/jboss/portal/wsrp/services/AbstractSOAPServiceFactory.java 2007-03-17 14:34:52 UTC (rev 6725)
+++ trunk/wsrp/src/main/org/jboss/portal/wsrp/services/AbstractSOAPServiceFactory.java 2007-03-17 18:47:52 UTC (rev 6726)
@@ -88,7 +88,7 @@
}
}
- // Get the stub from the service, remember that the stub itself is not threasafe
+ // Get the stub from the service, remember that the stub itself is not threadsafe
// and must be customized for every request to this method.
if (service != null)
{
17 years, 6 months