[jboss-svn-commits] JBoss Portal SVN: r5599 - in trunk: core/src/main/org/jboss/portal/core/management core/src/resources/portal-core-sar/META-INF portlet/src/main/org/jboss/portal/portlet/management
jboss-svn-commits at lists.jboss.org
jboss-svn-commits at lists.jboss.org
Wed Nov 8 08:14:39 EST 2006
Author: thomas.heute at jboss.com
Date: 2006-11-08 08:14:24 -0500 (Wed, 08 Nov 2006)
New Revision: 5599
Added:
trunk/core/src/main/org/jboss/portal/core/management/PortletDiscoveryService.java
trunk/core/src/main/org/jboss/portal/core/management/WSRPPortletManagement.java
trunk/core/src/main/org/jboss/portal/core/management/WSRPPortletManagementMBean.java
trunk/portlet/src/main/org/jboss/portal/portlet/management/LocalPortletManagement.java
trunk/portlet/src/main/org/jboss/portal/portlet/management/LocalPortletManagementMBean.java
Removed:
trunk/core/src/main/org/jboss/portal/core/management/InstanceContainerListenerImpl.java
trunk/core/src/main/org/jboss/portal/core/management/WSRPPortletConsumerManager.java
trunk/core/src/main/org/jboss/portal/core/management/WSRPPortletConsumerManagerMBean.java
trunk/portlet/src/main/org/jboss/portal/portlet/management/PortletContainerManager.java
trunk/portlet/src/main/org/jboss/portal/portlet/management/PortletContainerManagerMBean.java
trunk/portlet/src/main/org/jboss/portal/portlet/management/PortletContainerRegistry.java
trunk/portlet/src/main/org/jboss/portal/portlet/management/PortletContainerRegistryImpl.java
Modified:
trunk/core/src/resources/portal-core-sar/META-INF/jboss-service.xml
trunk/portlet/src/main/org/jboss/portal/portlet/management/PortletInfo.java
Log:
Simplified.
Deleted: trunk/core/src/main/org/jboss/portal/core/management/InstanceContainerListenerImpl.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/management/InstanceContainerListenerImpl.java 2006-11-08 03:19:54 UTC (rev 5598)
+++ trunk/core/src/main/org/jboss/portal/core/management/InstanceContainerListenerImpl.java 2006-11-08 13:14:24 UTC (rev 5599)
@@ -1,188 +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.core.management;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Iterator;
-import java.util.List;
-
-import javax.management.ObjectName;
-
-import org.jboss.logging.Logger;
-import org.jboss.portal.core.impl.model.instance.InstanceContainerListener;
-import org.jboss.portal.core.impl.model.instance.InstanceDefinitionImpl;
-import org.jboss.portal.core.model.instance.InstanceContainer;
-import org.jboss.portal.portlet.management.PortletContainerManagementInterceptor;
-import org.jboss.system.ServiceMBeanSupport;
-
-/**
- * Used for WSRP portlets
- *
- * @author <a href="mailto:theute at jboss.org">Thomas Heute</a>
- * @version $Revision$
- */
-public class InstanceContainerListenerImpl extends ServiceMBeanSupport implements InstanceContainerListener
-{
- private Logger log = Logger.getLogger(InstanceContainerListenerImpl.class);
-
- public static final String JMX_PREFIX = "portal.management:service=Management,type=WSRPPorletConsumer,name=";
-
- private InstanceContainer instanceContainer;
-
- private PortletContainerManagementInterceptor interceptor;
-
- private List portlets = new ArrayList();
-
- public void create()
- {
- instanceContainer.addListener(this);
- }
-
- public void destroy()
- {
- instanceContainer.removeListener(this);
- }
-
- public void start()
- {
- Collection startedPortletInstances = instanceContainer.getInstances();
- Iterator it = startedPortletInstances.iterator();
- while (it.hasNext())
- {
- InstanceDefinitionImpl portlet = (InstanceDefinitionImpl)it.next();
- String portletRef = portlet.getPortletRef();
- registerWSRPPortlet(portletRef, portlet);
- }
- }
-
- public void stop()
- {
- Iterator it = portlets.iterator();
- while (it.hasNext())
- {
- String portletRef = (String)it.next();
- try
- {
- destroyWSRPPortletConsumerManagemenentMBean(portletRef);
- }
- catch (Exception e)
- {
- e.printStackTrace();
- }
- }
- if (portlets.size() != 0)
- {
- log.error("Unable to remove all the PortletContainer manager MBeans");
- }
- }
-
- public void portletInstanceCreated(InstanceDefinitionImpl portlet)
- {
- String portletRef = portlet.getPortletRef();
- registerWSRPPortlet(portletRef, portlet);
- }
-
- public void portletInstanceDestroyed(InstanceDefinitionImpl portlet)
- {
- // The portlet instance has been destroyed, are there other instances of the same WSRP portlet ?
- if (!remainInstances(portlet.getPortletRef()))
- {
- try
- {
- destroyWSRPPortletConsumerManagemenentMBean(portlet.getPortletRef());
- }
- catch (Exception e)
- {
- e.printStackTrace();
- }
- }
-
- }
-
- private void registerWSRPPortlet(String portletRef, InstanceDefinitionImpl portlet)
- {
- String prefix = portletRef.substring(0, portletRef.indexOf("."));
- if (!prefix.equals("local") && !portlets.contains(portletRef))
- {
- try
- {
- createWSRPPortletConsumerManagemenentMBean(portletRef);
- portlets.add(portletRef);
- }
- catch (Exception e)
- {
- e.printStackTrace();
- }
- }
- }
-
- private boolean remainInstances(String portletRef)
- {
- boolean result = false;
- Collection startedPortletInstances = instanceContainer.getInstances();
- Iterator it = startedPortletInstances.iterator();
- while (it.hasNext())
- {
- InstanceDefinitionImpl portlet = (InstanceDefinitionImpl)it.next();
- String ref = portlet.getPortletRef();
- if (portletRef.equals(ref))
- {
- result = true;
- break;
- }
- }
- return result;
- }
-
- public void setInstanceContainer(InstanceContainer instanceContainer)
- {
- this.instanceContainer = instanceContainer;
- }
-
- public void setInterceptor(PortletContainerManagementInterceptor interceptor)
- {
- this.interceptor = interceptor;
- }
-
- private void createWSRPPortletConsumerManagemenentMBean(String portletRef) throws Exception
- {
- WSRPPortletConsumerManager manager = new WSRPPortletConsumerManager(portletRef, interceptor);
- ObjectName objectName = new ObjectName(getMBeanName(portletRef));
- getServer().registerMBean(manager, objectName);
- log.debug("Registered Management MBean for: " + portletRef);
- }
-
- private void destroyWSRPPortletConsumerManagemenentMBean(String portletRef) throws Exception
- {
- ObjectName objectName = new ObjectName(getMBeanName(portletRef));
- getServer().unregisterMBean(objectName);
- log.debug("Unregistered Management MBean for: " + portletRef);
- }
-
- private String getMBeanName(String portletRef)
- {
- return JMX_PREFIX + portletRef;
- }
-
-}
Added: trunk/core/src/main/org/jboss/portal/core/management/PortletDiscoveryService.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/management/PortletDiscoveryService.java 2006-11-08 03:19:54 UTC (rev 5598)
+++ trunk/core/src/main/org/jboss/portal/core/management/PortletDiscoveryService.java 2006-11-08 13:14:24 UTC (rev 5599)
@@ -0,0 +1,147 @@
+package org.jboss.portal.core.management;
+
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Map;
+
+import javax.management.ObjectName;
+
+import org.jboss.portal.federation.FederatedPortletInvoker;
+import org.jboss.portal.federation.FederatingPortletInvoker;
+import org.jboss.portal.portlet.Portlet;
+import org.jboss.portal.portlet.management.LocalPortletManagement;
+import org.jboss.portal.portlet.management.PortletContainerManagementInterceptor;
+import org.jboss.system.ServiceMBeanSupport;
+
+public class PortletDiscoveryService extends ServiceMBeanSupport
+{
+ public static final String WSRP_JMX_PREFIX = "portal.management:service=Management,type=WSRPPorlet,name=";
+ public static final String LOCAL_JMX_PREFIX = "portal.management:service=Management,type=LocalPortlet,name=";
+
+ private PortletContainerManagementInterceptor interceptor;
+
+ private FederatingPortletInvoker federatingPortletInvoker;
+
+ private Map registeredPortlets = new HashMap();
+
+ public void start()
+ {
+ try
+ {
+ processPortletDiscovery();
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace();
+ }
+ }
+
+ public void stop()
+ {
+ Iterator it = registeredPortlets.values().iterator();
+ while (it.hasNext())
+ {
+ ObjectName objectName = (ObjectName)it.next();
+ try
+ {
+ getServer().unregisterMBean(objectName);
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace();
+ }
+ }
+ if (registeredPortlets.size() != 0)
+ {
+ log.error("Unable to remove all the Portlet management MBeans");
+ }
+ }
+
+ public FederatingPortletInvoker getFederatingPortletInvoker()
+ {
+ return federatingPortletInvoker;
+ }
+
+ public void setFederatingPortletInvoker(FederatingPortletInvoker federatingPortletInvoker)
+ {
+ this.federatingPortletInvoker = federatingPortletInvoker;
+ }
+
+ public void setInterceptor(PortletContainerManagementInterceptor interceptor)
+ {
+ this.interceptor = interceptor;
+ }
+
+ public void processPortletDiscovery() throws Exception
+ {
+ Collection federatedInvokers = federatingPortletInvoker.getFederatedInvokers();
+ Iterator it = federatedInvokers.iterator();
+ while (it.hasNext())
+ {
+ FederatedPortletInvoker federatedPortletInvoker = (FederatedPortletInvoker) it.next();
+ if (federatedPortletInvoker.getId().equals("local"))
+ {
+ registerPortlets(federatedPortletInvoker.getPortlets(), false);
+ }
+ else
+ {
+ registerPortlets(federatedPortletInvoker.getPortlets(), true);
+ }
+ }
+ }
+
+ private void registerPortlets(Collection portlets, boolean wsrp)
+ {
+ Iterator it = portlets.iterator();
+ while (it.hasNext())
+ {
+ Portlet portlet = (Portlet) it.next();
+ String portletId = portlet.getContext().getId();
+ boolean used = interceptor.getPortletInfo(portletId).isUsed();
+ if ((!registeredPortlets.containsKey(portletId))&&(used))
+ {
+ try
+ {
+ ObjectName objectName = createManagementMBean(portlet, wsrp);
+ registeredPortlets.put(portletId, objectName);
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace();
+ }
+ }
+ }
+ }
+
+ private ObjectName createManagementMBean(Portlet portlet, boolean wsrp) throws Exception
+ {
+ Object management = null;
+ if (wsrp)
+ {
+ management = new WSRPPortletManagement(portlet, interceptor);
+ }
+ else
+ {
+ management = new LocalPortletManagement(portlet, interceptor);
+ }
+ ObjectName objectName = new ObjectName(getMBeanName(portlet, wsrp));
+ getServer().registerMBean(management, objectName);
+ log.debug("Registered Management MBean for: " + portlet.getContext().getId());
+ return objectName;
+ }
+
+ private String getMBeanName(Portlet portlet, boolean wsrp)
+ {
+ String id = portlet.getContext().getId();
+ if (wsrp)
+ {
+ return WSRP_JMX_PREFIX + id;
+ }
+ else
+ {
+ return LOCAL_JMX_PREFIX + id;
+ }
+ }
+
+}
Deleted: trunk/core/src/main/org/jboss/portal/core/management/WSRPPortletConsumerManager.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/management/WSRPPortletConsumerManager.java 2006-11-08 03:19:54 UTC (rev 5598)
+++ trunk/core/src/main/org/jboss/portal/core/management/WSRPPortletConsumerManager.java 2006-11-08 13:14:24 UTC (rev 5599)
@@ -1,78 +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.core.management;
-
-import org.jboss.portal.portlet.management.PortletContainerManagementInterceptor;
-
-/**
- * @author <a href="mailto:theute at jboss.org">Thomas Heute</a>
- * @version $Revision$
- */
-public class WSRPPortletConsumerManager implements WSRPPortletConsumerManagerMBean
-{
- private String portletRef;
-
- private PortletContainerManagementInterceptor interceptor;
-
- public WSRPPortletConsumerManager(String portletRef, PortletContainerManagementInterceptor interceptor)
- {
- this.portletRef = portletRef;
- this.interceptor = interceptor;
- }
-
- public String getId()
- {
- return portletRef;
- }
-
- public float getAverageRenderTime()
- {
- return interceptor.getPortletInfo(getId()).getAverageRenderTime();
- }
-
- public float getAverageActionTime()
- {
- return interceptor.getPortletInfo(getId()).getAverageActionTime();
- }
-
- public long getMaxRenderTime()
- {
- return interceptor.getPortletInfo(getId()).getMaxRenderTime();
- }
-
- public long getMaxActionTime()
- {
- return interceptor.getPortletInfo(getId()).getMaxActionTime();
- }
-
- public long getRenderRequestCount()
- {
- return interceptor.getPortletInfo(getId()).getRenderRequestCount();
- }
-
- public long getActionRequestCount()
- {
- return interceptor.getPortletInfo(getId()).getActionRequestCount();
- }
-
-}
Deleted: trunk/core/src/main/org/jboss/portal/core/management/WSRPPortletConsumerManagerMBean.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/management/WSRPPortletConsumerManagerMBean.java 2006-11-08 03:19:54 UTC (rev 5598)
+++ trunk/core/src/main/org/jboss/portal/core/management/WSRPPortletConsumerManagerMBean.java 2006-11-08 13:14:24 UTC (rev 5599)
@@ -1,42 +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.core.management;
-
-/**
- * @author <a href="mailto:theute at jboss.org">Thomas Heute</a>
- * @version $Revision$
- */
-public interface WSRPPortletConsumerManagerMBean
-{
- public float getAverageRenderTime();
-
- public float getAverageActionTime();
-
- public long getMaxRenderTime();
-
- public long getMaxActionTime();
-
- public long getRenderRequestCount();
-
- public long getActionRequestCount();
-}
Added: trunk/core/src/main/org/jboss/portal/core/management/WSRPPortletManagement.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/management/WSRPPortletManagement.java 2006-11-08 03:19:54 UTC (rev 5598)
+++ trunk/core/src/main/org/jboss/portal/core/management/WSRPPortletManagement.java 2006-11-08 13:14:24 UTC (rev 5599)
@@ -0,0 +1,88 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.core.management;
+
+import org.jboss.portal.portlet.Portlet;
+import org.jboss.portal.portlet.management.PortletContainerManagementInterceptor;
+
+/**
+ * @author <a href="mailto:theute at jboss.org">Thomas Heute</a>
+ * @version $Revision$
+ */
+public class WSRPPortletManagement implements WSRPPortletManagementMBean
+{
+ private Portlet portlet;
+
+ private PortletContainerManagementInterceptor interceptor;
+
+ public WSRPPortletManagement(Portlet portlet, PortletContainerManagementInterceptor interceptor)
+ {
+ this.portlet = portlet;
+ this.interceptor = interceptor;
+ }
+
+ public String getId()
+ {
+ return portlet.getContext().getId();
+ }
+
+ public float getAverageRenderTime()
+ {
+ return interceptor.getPortletInfo(getId()).getAverageRenderTime();
+ }
+
+ public float getAverageActionTime()
+ {
+ return interceptor.getPortletInfo(getId()).getAverageActionTime();
+ }
+
+ public long getMaxRenderTime()
+ {
+ return interceptor.getPortletInfo(getId()).getMaxRenderTime();
+ }
+
+ public long getMaxActionTime()
+ {
+ return interceptor.getPortletInfo(getId()).getMaxActionTime();
+ }
+
+ public long getRenderRequestCount()
+ {
+ return interceptor.getPortletInfo(getId()).getRenderRequestCount();
+ }
+
+ public long getActionRequestCount()
+ {
+ return interceptor.getPortletInfo(getId()).getActionRequestCount();
+ }
+
+ public long getActionErrorCount()
+ {
+ return interceptor.getPortletInfo(getId()).getActionErrorCount();
+ }
+
+ public long getRenderErrorCount()
+ {
+ return interceptor.getPortletInfo(getId()).getRenderErrorCount();
+ }
+}
Copied: trunk/core/src/main/org/jboss/portal/core/management/WSRPPortletManagementMBean.java (from rev 5589, trunk/core/src/main/org/jboss/portal/core/management/WSRPPortletConsumerManagerMBean.java)
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/management/WSRPPortletConsumerManagerMBean.java 2006-11-05 17:50:21 UTC (rev 5589)
+++ trunk/core/src/main/org/jboss/portal/core/management/WSRPPortletManagementMBean.java 2006-11-08 13:14:24 UTC (rev 5599)
@@ -0,0 +1,46 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.core.management;
+
+/**
+ * @author <a href="mailto:theute at jboss.org">Thomas Heute</a>
+ * @version $Revision$
+ */
+public interface WSRPPortletManagementMBean
+{
+ public float getAverageRenderTime();
+
+ public float getAverageActionTime();
+
+ public long getMaxRenderTime();
+
+ public long getMaxActionTime();
+
+ public long getRenderRequestCount();
+
+ public long getActionRequestCount();
+
+ public long getActionErrorCount();
+
+ public long getRenderErrorCount();
+}
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 2006-11-08 03:19:54 UTC (rev 5598)
+++ trunk/core/src/resources/portal-core-sar/META-INF/jboss-service.xml 2006-11-08 13:14:24 UTC (rev 5599)
@@ -47,37 +47,22 @@
proxy-type="attribute">portal:service=Module,type=Role</depends>
<xmbean/>
</mbean>
-
-
- <mbean
- code="org.jboss.portal.portlet.management.PortletContainerRegistryImpl"
- name="portal:service=Management,type=PortletContainerRegistry,name=Default"
- xmbean-dd=""
- xmbean-code="org.jboss.portal.jems.as.system.JBossServiceModelMBean">
- <depends
- optional-attribute-name="Registry"
- proxy-type="attribute">portal:service=WebAppRegistry</depends>
- <xmbean/>
- <depends
- optional-attribute-name="Interceptor"
- proxy-type="attribute">portal:service=ManagementInterceptor,type=Portlet,name=PortletContainer</depends>
- <xmbean/>
- </mbean>
<mbean
- code="org.jboss.portal.core.management.InstanceContainerListenerImpl"
- name="portal:service=Management,type=InstanceContainer,name=Default"
+ code="org.jboss.portal.core.management.PortletDiscoveryService"
+ name="portal:service=Management,type=PortletDiscoveryManagement,name=Default"
xmbean-dd=""
xmbean-code="org.jboss.portal.jems.as.system.JBossServiceModelMBean">
<depends
- optional-attribute-name="InstanceContainer"
- proxy-type="attribute">portal:container=Instance</depends>
- <xmbean/>
+ optional-attribute-name="FederatingPortletInvoker"
+ proxy-type="attribute">portal:service=PortletInvoker,type=Federating</depends>
<depends
optional-attribute-name="Interceptor"
proxy-type="attribute">portal:service=ManagementInterceptor,type=Portlet,name=PortletContainer</depends>
<xmbean/>
</mbean>
+
+
<!-- Server configuration service -->
<mbean
code="org.jboss.portal.server.config.ServerConfigService"
Copied: trunk/portlet/src/main/org/jboss/portal/portlet/management/LocalPortletManagement.java (from rev 5589, trunk/portlet/src/main/org/jboss/portal/portlet/management/PortletContainerManager.java)
===================================================================
--- trunk/portlet/src/main/org/jboss/portal/portlet/management/PortletContainerManager.java 2006-11-05 17:50:21 UTC (rev 5589)
+++ trunk/portlet/src/main/org/jboss/portal/portlet/management/LocalPortletManagement.java 2006-11-08 13:14:24 UTC (rev 5599)
@@ -0,0 +1,88 @@
+/******************************************************************************
+ * 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.management;
+
+import org.jboss.portal.portlet.Portlet;
+import org.jboss.portal.portlet.container.PortletContainer;
+
+/**
+ * @author <a href="mailto:theute at jboss.org">Thomas Heute</a>
+ * @version $Revision$
+ */
+public class LocalPortletManagement implements LocalPortletManagementMBean
+{
+ private Portlet portlet;
+
+ private PortletContainerManagementInterceptor interceptor;
+
+ public LocalPortletManagement(Portlet portlet, PortletContainerManagementInterceptor interceptor)
+ {
+ this.portlet = portlet;
+ this.interceptor = interceptor;
+ }
+
+ public String getId()
+ {
+ return portlet.getContext().getId();
+ }
+
+ public float getAverageRenderTime()
+ {
+ return interceptor.getPortletInfo(getId()).getAverageRenderTime();
+ }
+
+ public float getAverageActionTime()
+ {
+ return interceptor.getPortletInfo(getId()).getAverageActionTime();
+ }
+
+ public long getMaxRenderTime()
+ {
+ return interceptor.getPortletInfo(getId()).getMaxRenderTime();
+ }
+
+ public long getMaxActionTime()
+ {
+ return interceptor.getPortletInfo(getId()).getMaxActionTime();
+ }
+
+ public long getRenderRequestCount()
+ {
+ return interceptor.getPortletInfo(getId()).getRenderRequestCount();
+ }
+
+ public long getActionRequestCount()
+ {
+ return interceptor.getPortletInfo(getId()).getActionRequestCount();
+ }
+
+ public long getActionErrorCount()
+ {
+ return interceptor.getPortletInfo(getId()).getActionErrorCount();
+ }
+
+ public long getRenderErrorCount()
+ {
+ return interceptor.getPortletInfo(getId()).getRenderErrorCount();
+ }
+}
Copied: trunk/portlet/src/main/org/jboss/portal/portlet/management/LocalPortletManagementMBean.java (from rev 5589, trunk/portlet/src/main/org/jboss/portal/portlet/management/PortletContainerManagerMBean.java)
===================================================================
--- trunk/portlet/src/main/org/jboss/portal/portlet/management/PortletContainerManagerMBean.java 2006-11-05 17:50:21 UTC (rev 5589)
+++ trunk/portlet/src/main/org/jboss/portal/portlet/management/LocalPortletManagementMBean.java 2006-11-08 13:14:24 UTC (rev 5599)
@@ -0,0 +1,46 @@
+/******************************************************************************
+ * 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.management;
+
+/**
+ * @author <a href="mailto:theute at jboss.org">Thomas Heute</a>
+ * @version $Revision$
+ */
+public interface LocalPortletManagementMBean
+{
+ public float getAverageRenderTime();
+
+ public float getAverageActionTime();
+
+ public long getMaxRenderTime();
+
+ public long getMaxActionTime();
+
+ public long getRenderRequestCount();
+
+ public long getActionRequestCount();
+
+ public long getActionErrorCount();
+
+ public long getRenderErrorCount();
+}
Deleted: trunk/portlet/src/main/org/jboss/portal/portlet/management/PortletContainerManager.java
===================================================================
--- trunk/portlet/src/main/org/jboss/portal/portlet/management/PortletContainerManager.java 2006-11-08 03:19:54 UTC (rev 5598)
+++ trunk/portlet/src/main/org/jboss/portal/portlet/management/PortletContainerManager.java 2006-11-08 13:14:24 UTC (rev 5599)
@@ -1,83 +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.management;
-
-import org.jboss.portal.portlet.container.PortletContainer;
-
-/**
- * @author <a href="mailto:theute at jboss.org">Thomas Heute</a>
- * @version $Revision$
- */
-public class PortletContainerManager implements PortletContainerManagerMBean
-{
- private PortletContainer portlet;
-
- private PortletContainerManagementInterceptor interceptor;
-
- public PortletContainerManager(PortletContainer portlet, PortletContainerManagementInterceptor interceptor)
- {
- this.portlet = portlet;
- this.interceptor = interceptor;
- }
-
- public String getName()
- {
- return portlet.getName();
- }
-
- public String getId()
- {
- return "local." + portlet.getContext().getId();
- }
-
- public float getAverageRenderTime()
- {
- return interceptor.getPortletInfo(getId()).getAverageRenderTime();
- }
-
- public float getAverageActionTime()
- {
- return interceptor.getPortletInfo(getId()).getAverageActionTime();
- }
-
- public long getMaxRenderTime()
- {
- return interceptor.getPortletInfo(getId()).getMaxRenderTime();
- }
-
- public long getMaxActionTime()
- {
- return interceptor.getPortletInfo(getId()).getMaxActionTime();
- }
-
- public long getRenderRequestCount()
- {
- return interceptor.getPortletInfo(getId()).getRenderRequestCount();
- }
-
- public long getActionRequestCount()
- {
- return interceptor.getPortletInfo(getId()).getActionRequestCount();
- }
-
-}
Deleted: trunk/portlet/src/main/org/jboss/portal/portlet/management/PortletContainerManagerMBean.java
===================================================================
--- trunk/portlet/src/main/org/jboss/portal/portlet/management/PortletContainerManagerMBean.java 2006-11-08 03:19:54 UTC (rev 5598)
+++ trunk/portlet/src/main/org/jboss/portal/portlet/management/PortletContainerManagerMBean.java 2006-11-08 13:14:24 UTC (rev 5599)
@@ -1,44 +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.management;
-
-/**
- * @author <a href="mailto:theute at jboss.org">Thomas Heute</a>
- * @version $Revision$
- */
-public interface PortletContainerManagerMBean
-{
- public String getName();
-
- public float getAverageRenderTime();
-
- public float getAverageActionTime();
-
- public long getMaxRenderTime();
-
- public long getMaxActionTime();
-
- public long getRenderRequestCount();
-
- public long getActionRequestCount();
-}
Deleted: trunk/portlet/src/main/org/jboss/portal/portlet/management/PortletContainerRegistry.java
===================================================================
--- trunk/portlet/src/main/org/jboss/portal/portlet/management/PortletContainerRegistry.java 2006-11-08 03:19:54 UTC (rev 5598)
+++ trunk/portlet/src/main/org/jboss/portal/portlet/management/PortletContainerRegistry.java 2006-11-08 13:14:24 UTC (rev 5599)
@@ -1,32 +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.management;
-
-/**
- * @author <a href="mailto:theute at jboss.org">Thomas Heute</a>
- * @version $Revision$
- */
-public interface PortletContainerRegistry
-{
-
-}
Deleted: trunk/portlet/src/main/org/jboss/portal/portlet/management/PortletContainerRegistryImpl.java
===================================================================
--- trunk/portlet/src/main/org/jboss/portal/portlet/management/PortletContainerRegistryImpl.java 2006-11-08 03:19:54 UTC (rev 5598)
+++ trunk/portlet/src/main/org/jboss/portal/portlet/management/PortletContainerRegistryImpl.java 2006-11-08 13:14:24 UTC (rev 5599)
@@ -1,146 +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.management;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Iterator;
-import java.util.List;
-
-import javax.management.ObjectName;
-
-import org.jboss.logging.Logger;
-import org.jboss.portal.portlet.container.PortletApplicationRegistry;
-import org.jboss.portal.portlet.container.PortletContainer;
-import org.jboss.portal.portlet.management.PortletContainerManagementInterceptor;
-import org.jboss.portal.portlet.management.PortletContainerManager;
-import org.jboss.system.ServiceMBeanSupport;
-
-/**
- * @author <a href="mailto:theute at jboss.org">Thomas Heute</a>
- * @version $Revision$
- */
-public class PortletContainerRegistryImpl extends ServiceMBeanSupport implements PortletContainerRegistry, org.jboss.portal.portlet.container.PortletContainerRegistryListener
-{
- private final static Logger log = Logger.getLogger(PortletContainerRegistryImpl.class);
-
- public static final String JMX_PREFIX = "portal.management:service=Management,type=PortletContainer,name=";
-
- private PortletApplicationRegistry registry;
-
- private PortletContainerManagementInterceptor interceptor;
-
- private List portletContainers = new ArrayList();
-
- public void create()
- {
- registry.addListener(this);
- }
-
- public void destroy()
- {
- registry.removeListener(this);
- }
-
- public void start()
- {
- Collection startedPortletContainers = registry.getPortletContainers();
- Iterator it = startedPortletContainers.iterator();
- while (it.hasNext())
- {
- PortletContainer portlet = (PortletContainer)it.next();
- registerPortletContainer(portlet);
- }
- }
-
- public void stop()
- {
- Iterator it = portletContainers.iterator();
- while (it.hasNext())
- {
- PortletContainer portlet = (PortletContainer)it.next();
- unregisterPortletContainer(portlet);
- }
- if (portletContainers.size() != 0)
- {
- log.error("Unable to remove all the PortletContainer manager MBeans");
- }
- }
-
- public void registerPortletContainer(PortletContainer portlet)
- {
- try
- {
- createPortletContainerManagemenentMBean(portlet);
- portletContainers.add(portlet);
- }
- catch (Exception e)
- {
- e.printStackTrace();
- }
- }
-
- public void unregisterPortletContainer(PortletContainer portlet)
- {
- try
- {
- destroyPortletContainerManagemenentMBean(portlet);
- portletContainers.remove(portlet);
- }
- catch (Exception e)
- {
- e.printStackTrace();
- }
- }
-
- public void setRegistry(PortletApplicationRegistry registry)
- {
- this.registry = registry;
- }
-
- public void setInterceptor(PortletContainerManagementInterceptor interceptor)
- {
- this.interceptor = interceptor;
- }
-
- private void createPortletContainerManagemenentMBean(PortletContainer portlet) throws Exception
- {
- PortletContainerManager manager = new PortletContainerManager(portlet, interceptor);
- ObjectName objectName = new ObjectName(getMBeanName(portlet));
- getServer().registerMBean(manager, objectName);
- log.debug("Registered Management MBean for: " + portlet.getContext().getId());
- }
-
- private void destroyPortletContainerManagemenentMBean(PortletContainer portlet) throws Exception
- {
- ObjectName objectName = new ObjectName(getMBeanName(portlet));
- getServer().unregisterMBean(objectName);
- log.debug("Unegistered Management MBean for: " + portlet.getContext().getId());
- }
-
- private String getMBeanName(PortletContainer portlet)
- {
- return JMX_PREFIX + "local." + portlet.getContext().getId();
- }
-
-}
Modified: trunk/portlet/src/main/org/jboss/portal/portlet/management/PortletInfo.java
===================================================================
--- trunk/portlet/src/main/org/jboss/portal/portlet/management/PortletInfo.java 2006-11-08 03:19:54 UTC (rev 5598)
+++ trunk/portlet/src/main/org/jboss/portal/portlet/management/PortletInfo.java 2006-11-08 13:14:24 UTC (rev 5599)
@@ -136,4 +136,9 @@
actionErrorCount++;
}
}
+
+ public boolean isUsed()
+ {
+ return getActionRequestCount() + getRenderRequestCount() > 0;
+ }
}
More information about the jboss-svn-commits
mailing list