Author: chris.laprun(a)jboss.com
Date: 2009-04-24 10:12:31 -0400 (Fri, 24 Apr 2009)
New Revision: 13269
Added:
modules/jopr-plugin/trunk/portal-management/src/main/java/org/jboss/portal/management/PortletDiscovery.java
Modified:
modules/jopr-plugin/trunk/plugin/src/main/java/org/jboss/portal/jopr/PortalComponent.java
modules/jopr-plugin/trunk/plugin/src/main/java/org/jboss/portal/jopr/PortalDiscovery.java
modules/jopr-plugin/trunk/plugin/src/main/resources/META-INF/rhq-plugin.xml
modules/jopr-plugin/trunk/portal-management-service/src/main/resources/META-INF/jboss-service.xml
modules/jopr-plugin/trunk/portal-management/src/main/java/org/jboss/portal/management/PortalImpl.java
modules/jopr-plugin/trunk/portal-management/src/main/java/org/jboss/portal/management/PortletDiscoveryService.java
Log:
- Fixed deployment.
- Now properly displays the number of deployed portlets in the metrics.
Modified:
modules/jopr-plugin/trunk/plugin/src/main/java/org/jboss/portal/jopr/PortalComponent.java
===================================================================
---
modules/jopr-plugin/trunk/plugin/src/main/java/org/jboss/portal/jopr/PortalComponent.java 2009-04-24
13:49:58 UTC (rev 13268)
+++
modules/jopr-plugin/trunk/plugin/src/main/java/org/jboss/portal/jopr/PortalComponent.java 2009-04-24
14:12:31 UTC (rev 13269)
@@ -1,6 +1,6 @@
/******************************************************************************
* JBoss, a division of Red Hat *
- * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * Copyright 2009, 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. *
@@ -25,10 +25,10 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
+import org.jboss.mx.util.MBeanServerLocator;
import org.jboss.portal.jems.as.JMX;
+import org.jboss.portal.management.Portal;
import org.jboss.portal.server.Server;
-import org.jboss.portal.management.Portal;
-import org.jboss.mx.util.MBeanServerLocator;
import org.rhq.core.domain.configuration.Configuration;
import org.rhq.core.domain.measurement.AvailabilityType;
import org.rhq.core.domain.measurement.MeasurementDataNumeric;
@@ -48,9 +48,9 @@
import org.rhq.core.pluginapi.operation.OperationFacet;
import org.rhq.core.pluginapi.operation.OperationResult;
+import javax.management.MBeanServer;
+import javax.management.MalformedObjectNameException;
import javax.management.ObjectName;
-import javax.management.MalformedObjectNameException;
-import javax.management.MBeanServer;
import java.util.Set;
@@ -59,16 +59,14 @@
{
private final Log log = LogFactory.getLog(this.getClass());
- private static final int CHANGEME = 1; // TODO remove or change this
-
public static final String DUMMY_EVENT = "portal-jopr-pluginDummyEvent"; //
Same as in Plugin-Descriptor
EventContext eventContext;
private static final String PORTAL_SERVICE_SERVER =
"portal:service=Server";
private Server portalServer;
-
+
private static final String PORTAL_MANAGEMENT_SERVICE =
"portal.management:service=Management,type=Portal,name=Default";
private Portal portal;
@@ -94,13 +92,20 @@
Configuration conf = context.getPluginConfiguration();
- portalServer = (Server) JMX.getMBeanProxy(Server.class, PORTAL_SERVICE_SERVER);
+ try
+ {
+ portalServer = (Server)JMX.getMBeanProxy(Server.class, PORTAL_SERVICE_SERVER);
- portal = (Portal) JMX.getMBeanProxy(Portal.class, PORTAL_MANAGEMENT_SERVICE);
+ portal = (Portal)JMX.getMBeanProxy(Portal.class, PORTAL_MANAGEMENT_SERVICE);
+ }
+ catch (Exception e)
+ {
+ log.info("Failed to start PortalComponent: " +
e.getLocalizedMessage(), e);
+ }
- eventContext = context.getEventContext();
+ /*eventContext = context.getEventContext();
PortalEventPoller eventPoller = new PortalEventPoller();
- eventContext.registerEventPoller(eventPoller, 60);
+ eventContext.registerEventPoller(eventPoller, 60);*/
}
@@ -112,9 +117,7 @@
*/
public void stop()
{
-
-
- eventContext.unregisterEventPoller(DUMMY_EVENT);
+// eventContext.unregisterEventPoller(DUMMY_EVENT);
}
@@ -131,10 +134,9 @@
{
if (req.getName().equals("portletNumber"))
{
- MeasurementDataNumeric res = new MeasurementDataNumeric(req,
Double.valueOf(CHANGEME));
+ MeasurementDataNumeric res = new MeasurementDataNumeric(req,
(double)portal.getNbInstances());
report.addData(res);
}
- // TODO add more metrics here
}
}
@@ -156,10 +158,9 @@
{
OperationResult res = new OperationResult();
- if ("dummyOperation".equals(name))
+ if ("refreshPortletList".equals(name))
{
- // TODO implement me
-
+ System.out.println("refreshPortletList called res = " + res);
}
return res;
}
@@ -210,7 +211,7 @@
// TODO supply code to delete a child resource
}
- private static ObjectName createObjectName(String name)
+ private static ObjectName createObjectName(String name)
{
ObjectName objecName;
try
Modified:
modules/jopr-plugin/trunk/plugin/src/main/java/org/jboss/portal/jopr/PortalDiscovery.java
===================================================================
---
modules/jopr-plugin/trunk/plugin/src/main/java/org/jboss/portal/jopr/PortalDiscovery.java 2009-04-24
13:49:58 UTC (rev 13268)
+++
modules/jopr-plugin/trunk/plugin/src/main/java/org/jboss/portal/jopr/PortalDiscovery.java 2009-04-24
14:12:31 UTC (rev 13269)
@@ -1,6 +1,6 @@
/******************************************************************************
* JBoss, a division of Red Hat *
- * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * Copyright 2009, 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. *
@@ -28,20 +28,19 @@
import org.rhq.core.pluginapi.inventory.DiscoveredResourceDetails;
import org.rhq.core.pluginapi.inventory.ResourceDiscoveryComponent;
import org.rhq.core.pluginapi.inventory.ResourceDiscoveryContext;
-import org.jboss.portal.jopr.PortalComponent;
import java.util.HashSet;
import java.util.Set;
/** Discovery class */
-public class PortalDiscovery implements
ResourceDiscoveryComponent<PortalComponent>
+public class PortalDiscovery implements ResourceDiscoveryComponent
{
private final Log log = LogFactory.getLog(this.getClass());
/** Run the discovery */
- public Set<DiscoveredResourceDetails>
discoverResources(ResourceDiscoveryContext<PortalComponent> discoveryContext) throws
Exception
+ public Set<DiscoveredResourceDetails> discoverResources(ResourceDiscoveryContext
discoveryContext) throws Exception
{
Set<DiscoveredResourceDetails> discoveredResources = new
HashSet<DiscoveredResourceDetails>();
@@ -52,7 +51,7 @@
* time
*/
DiscoveredResourceDetails detail = new
DiscoveredResourceDetails(discoveryContext.getResourceType(), "Portal",
- discoveryContext.getParentResourceComponent().getVersion(),
"1.0.0.Alpha1", "Monitoring of JBoss Portal resources", null, null);
+ "JBoss Portal", "1.0.0.Alpha1", "Monitoring of JBoss
Portal resources", null, null);
// Add to return values
Modified: modules/jopr-plugin/trunk/plugin/src/main/resources/META-INF/rhq-plugin.xml
===================================================================
--- modules/jopr-plugin/trunk/plugin/src/main/resources/META-INF/rhq-plugin.xml 2009-04-24
13:49:58 UTC (rev 13268)
+++ modules/jopr-plugin/trunk/plugin/src/main/resources/META-INF/rhq-plugin.xml 2009-04-24
14:12:31 UTC (rev 13269)
@@ -1,7 +1,30 @@
<?xml version="1.0"?>
+<!--~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ ~ JBoss, a division of Red Hat ~
+ ~ Copyright 2009, 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. ~
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~-->
+
<plugin name="portal-jopr-plugin"
displayName="JBossPortalPlugin"
- package="org.jboss.portal.jopr.plugin"
+ package="org.jboss.portal.jopr"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="urn:xmlns:rhq-plugin"
xmlns:c="urn:xmlns:rhq-configuration">
Modified:
modules/jopr-plugin/trunk/portal-management/src/main/java/org/jboss/portal/management/PortalImpl.java
===================================================================
---
modules/jopr-plugin/trunk/portal-management/src/main/java/org/jboss/portal/management/PortalImpl.java 2009-04-24
13:49:58 UTC (rev 13268)
+++
modules/jopr-plugin/trunk/portal-management/src/main/java/org/jboss/portal/management/PortalImpl.java 2009-04-24
14:12:31 UTC (rev 13269)
@@ -1,6 +1,6 @@
/******************************************************************************
* JBoss, a division of Red Hat *
- * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * Copyright 2009, 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. *
@@ -38,7 +38,7 @@
{
private InstanceContainerContext containerContext;
- private PortletDiscoveryService discoveryService;
+ private PortletDiscovery discoveryService;
public int getNbInstances()
{
@@ -70,7 +70,7 @@
this.containerContext = containerContext;
}
- public void setDiscoveryService(PortletDiscoveryService discoveryService)
+ public void setDiscoveryService(PortletDiscovery discoveryService)
{
this.discoveryService = discoveryService;
}
Added:
modules/jopr-plugin/trunk/portal-management/src/main/java/org/jboss/portal/management/PortletDiscovery.java
===================================================================
---
modules/jopr-plugin/trunk/portal-management/src/main/java/org/jboss/portal/management/PortletDiscovery.java
(rev 0)
+++
modules/jopr-plugin/trunk/portal-management/src/main/java/org/jboss/portal/management/PortletDiscovery.java 2009-04-24
14:12:31 UTC (rev 13269)
@@ -0,0 +1,38 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2009, 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.management;
+
+import javax.management.ObjectName;
+import java.util.Map;
+
+/**
+ * @author <a href="mailto:chris.laprun@jboss.com">Chris
Laprun</a>
+ * @version $Revision$
+ */
+public interface PortletDiscovery
+{
+ void processPortletDiscovery() throws Exception;
+
+ Map<String, ObjectName> getRegisteredPortlets();
+}
Modified:
modules/jopr-plugin/trunk/portal-management/src/main/java/org/jboss/portal/management/PortletDiscoveryService.java
===================================================================
---
modules/jopr-plugin/trunk/portal-management/src/main/java/org/jboss/portal/management/PortletDiscoveryService.java 2009-04-24
13:49:58 UTC (rev 13268)
+++
modules/jopr-plugin/trunk/portal-management/src/main/java/org/jboss/portal/management/PortletDiscoveryService.java 2009-04-24
14:12:31 UTC (rev 13269)
@@ -1,3 +1,26 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2009, 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.management;
import org.jboss.portal.portlet.Portlet;
@@ -5,17 +28,15 @@
import org.jboss.portal.portlet.federation.FederatingPortletInvoker;
import org.jboss.portal.portlet.management.LocalPortletManagement;
import org.jboss.portal.portlet.management.PortletContainerManagementInterceptor;
-import org.jboss.portal.portlet.management.PortletInfo;
import org.jboss.system.ServiceMBeanSupport;
import javax.management.ObjectName;
import java.util.Collection;
+import java.util.Collections;
import java.util.HashMap;
-import java.util.Iterator;
import java.util.Map;
-import java.util.Collections;
-public class PortletDiscoveryService extends ServiceMBeanSupport
+public class PortletDiscoveryService extends ServiceMBeanSupport implements
PortletDiscovery
{
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=";
Modified:
modules/jopr-plugin/trunk/portal-management-service/src/main/resources/META-INF/jboss-service.xml
===================================================================
---
modules/jopr-plugin/trunk/portal-management-service/src/main/resources/META-INF/jboss-service.xml 2009-04-24
13:49:58 UTC (rev 13268)
+++
modules/jopr-plugin/trunk/portal-management-service/src/main/resources/META-INF/jboss-service.xml 2009-04-24
14:12:31 UTC (rev 13269)
@@ -1,24 +1,24 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~ 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 ~
+ ~ Copyright 2009, 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. ~
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~-->
@@ -29,7 +29,8 @@
code="org.jboss.varia.scheduler.Scheduler"
name="portal:service=Management,type=Scheduler">
<attribute
-
name="SchedulableMBean">portal:service=Management,type=PortletDiscoveryManagement,name=Default</attribute>
+
name="SchedulableMBean">portal:service=Management,type=PortletDiscoveryManagement,name=Default
+ </attribute>
<attribute
name="SchedulableMBeanMethod">processPortletDiscovery()</attribute>
<attribute name="InitialStartDate">NOW</attribute>
<attribute name="SchedulePeriod">30000</attribute>
@@ -38,12 +39,16 @@
</mbean>
<mbean
- code="org.jboss.portal.core.management.PortalImpl"
+ code="org.jboss.portal.management.PortalImpl"
name="portal.management:service=Management,type=Portal,name=Default"
xmbean-dd=""
xmbean-code="org.jboss.portal.jems.as.system.JBossServiceModelMBean">
- <depends optional-attribute-name="ContainerContext"
proxy-type="attribute">portal:service=InstanceContainerContext</depends>
- <depends optional-attribute-name="DiscoveryService"
proxy-type="attribute">portal:service=Management,type=PortletDiscoveryManagement,name=Default</depends>
+ <depends optional-attribute-name="ContainerContext"
proxy-type="attribute">
+ portal:service=InstanceContainerContext
+ </depends>
+ <depends optional-attribute-name="DiscoveryService"
proxy-type="attribute">
+ portal:service=Management,type=PortletDiscoveryManagement,name=Default
+ </depends>
<xmbean/>
</mbean>
@@ -55,16 +60,18 @@
</mbean>
<mbean
- code="org.jboss.portal.core.management.PortletDiscoveryService"
+ code="org.jboss.portal.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="FederatingPortletInvoker"
-
proxy-type="attribute">portal:service=PortletInvoker,type=Federating</depends>
+
proxy-type="attribute">portal:service=PortletInvoker,type=Federating
+ </depends>
<depends
optional-attribute-name="Interceptor"
-
proxy-type="attribute">portal:service=Interceptor,type=Portlet,name=PortletContainerManagement</depends>
+
proxy-type="attribute">portal:service=Interceptor,type=Portlet,name=PortletContainerManagement
+ </depends>
<xmbean/>
</mbean>
@@ -82,8 +89,11 @@
xmbean-code="org.jboss.portal.jems.as.system.JBossServiceModelMBean">
<xmbean/>
<depends
-
optional-attribute-name="StackFactory">portal:service=InterceptorStackFactory,type=Instance</depends>
+
optional-attribute-name="StackFactory">portal:service=InterceptorStackFactory,type=Instance
+ </depends>
<depends
-
optional-attribute-name="InterceptorName">portal:service=Interceptor,type=Portlet,name=PortletContainerManagement</depends>
+ optional-attribute-name="InterceptorName">
+ portal:service=Interceptor,type=Portlet,name=PortletContainerManagement
+ </depends>
</mbean>
</server>