[jboss-cvs] JBossAS SVN: r85666 - in branches/Branch_5_x: tomcat/src/main/org/jboss/web/tomcat/service/management and 1 other directories.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Tue Mar 10 03:53:55 EDT 2009


Author: scott.stark at jboss.org
Date: 2009-03-10 03:53:55 -0400 (Tue, 10 Mar 2009)
New Revision: 85666

Added:
   branches/Branch_5_x/tomcat/src/main/org/jboss/web/tomcat/service/management/Host.java
   branches/Branch_5_x/tomcat/src/main/org/jboss/web/tomcat/service/management/IHost.java
Modified:
   branches/Branch_5_x/testsuite/src/main/org/jboss/test/profileservice/test/ServerManagedObjectsTestCase.java
   branches/Branch_5_x/tomcat/src/main/org/jboss/web/tomcat/service/management/BaseBean.java
   branches/Branch_5_x/tomcat/src/main/org/jboss/web/tomcat/service/management/ConnectorBean.java
   branches/Branch_5_x/tomcat/src/resources/jboss-beans.xml
   branches/Branch_5_x/tomcat/src/resources/server.xml
Log:
JBAS-5529, add a host managed object

Modified: branches/Branch_5_x/testsuite/src/main/org/jboss/test/profileservice/test/ServerManagedObjectsTestCase.java
===================================================================
--- branches/Branch_5_x/testsuite/src/main/org/jboss/test/profileservice/test/ServerManagedObjectsTestCase.java	2009-03-10 07:00:42 UTC (rev 85665)
+++ branches/Branch_5_x/testsuite/src/main/org/jboss/test/profileservice/test/ServerManagedObjectsTestCase.java	2009-03-10 07:53:55 UTC (rev 85666)
@@ -262,6 +262,26 @@
       assertTrue("currentThreadCount > 0", currentThreadCountSV.compareTo(SimpleValueSupport.wrap(0)) > 0);
       assertEquals(mc.getRunState(), RunState.RUNNING);
    }
+
+   public void testWebHost()
+      throws Exception
+   {
+      // Make a request
+      InetAddress address = InetAddress.getByName(getServerHost());
+      // Load the 
+      ManagementView mgtView = getManagementView();
+      ComponentType type = new ComponentType("MBean", "Web");
+      String name = "jboss.web:host="+address.getHostAddress()+",type=Host";
+      ManagedComponent mc = mgtView.getComponent(name, type);
+      assertNotNull(name, mc);
+      Map<String, ManagedProperty> props = mc.getProperties();
+      for(ManagedProperty mp : props.values())
+         log.info(mp.getName()+", "+mp.getValue());
+      
+      ManagedProperty currentThreadCount = mc.getProperty("aliases");
+      assertNotNull(currentThreadCount);
+      assertEquals(mc.getRunState(), RunState.RUNNING);
+   }
    
    /**
     * Obtain the ProfileService.ManagementView

Modified: branches/Branch_5_x/tomcat/src/main/org/jboss/web/tomcat/service/management/BaseBean.java
===================================================================
--- branches/Branch_5_x/tomcat/src/main/org/jboss/web/tomcat/service/management/BaseBean.java	2009-03-10 07:00:42 UTC (rev 85665)
+++ branches/Branch_5_x/tomcat/src/main/org/jboss/web/tomcat/service/management/BaseBean.java	2009-03-10 07:53:55 UTC (rev 85666)
@@ -92,6 +92,7 @@
    @ManagementObjectID
    public String getMbeanNameAsString()
    {
+      initMBeanName();
       return mbeanName.getCanonicalName();
    }
    public MBeanServer getServer()
@@ -103,6 +104,17 @@
       this.server = server;
    }
 
+   protected void initMBeanName()
+   {
+      try
+      {
+         mbeanName = new ObjectName(domain, nameProps);
+      }
+      catch(Exception e)
+      {
+         throw new IllegalStateException(e);
+      }
+   }
    protected <T> T initProxy(Class<T> clazz)
    {
       T mbeanProxy = null;

Modified: branches/Branch_5_x/tomcat/src/main/org/jboss/web/tomcat/service/management/ConnectorBean.java
===================================================================
--- branches/Branch_5_x/tomcat/src/main/org/jboss/web/tomcat/service/management/ConnectorBean.java	2009-03-10 07:00:42 UTC (rev 85665)
+++ branches/Branch_5_x/tomcat/src/main/org/jboss/web/tomcat/service/management/ConnectorBean.java	2009-03-10 07:53:55 UTC (rev 85666)
@@ -90,7 +90,7 @@
       return mbeanProxy.getrequestCount();
    }
 
-   @ManagementProperty(use=ViewUse.STATISTIC)
+   @ManagementProperty(use=ViewUse.STATISTIC, ignored=true)
    public RequestInfo[] getRequestProcessors()
    throws Exception
    {

Added: branches/Branch_5_x/tomcat/src/main/org/jboss/web/tomcat/service/management/Host.java
===================================================================
--- branches/Branch_5_x/tomcat/src/main/org/jboss/web/tomcat/service/management/Host.java	                        (rev 0)
+++ branches/Branch_5_x/tomcat/src/main/org/jboss/web/tomcat/service/management/Host.java	2009-03-10 07:53:55 UTC (rev 85666)
@@ -0,0 +1,61 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2009, Red Hat Middleware LLC, and individual contributors
+ * 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.web.tomcat.service.management;
+
+import org.jboss.managed.api.annotation.ManagementComponent;
+import org.jboss.managed.api.annotation.ManagementObject;
+import org.jboss.managed.api.annotation.ManagementProperties;
+
+/**
+ * Host managed objects
+ * 
+ * @author Scott.Stark at jboss.org
+ * @version $Revision:$
+ */
+ at ManagementObject(
+      componentType=@ManagementComponent(type = "MBean", subtype = "Web"),
+      isRuntime=true,
+      properties=ManagementProperties.EXPLICIT)
+public class Host extends BaseBean
+{
+   private IHost mbeanProxy;
+
+
+   public String[] getaliases()
+   {
+      return mbeanProxy.getaliases();
+   }
+
+   public boolean getunpackWARs()
+   {
+      return mbeanProxy.getunpackWARs();
+   }
+
+   protected void initProxy()
+   {
+      if(mbeanProxy == null)
+      {
+         // host=host1.x.com,type=Host
+         mbeanProxy = super.initProxy(IHost.class);
+      }
+   }
+}

Added: branches/Branch_5_x/tomcat/src/main/org/jboss/web/tomcat/service/management/IHost.java
===================================================================
--- branches/Branch_5_x/tomcat/src/main/org/jboss/web/tomcat/service/management/IHost.java	                        (rev 0)
+++ branches/Branch_5_x/tomcat/src/main/org/jboss/web/tomcat/service/management/IHost.java	2009-03-10 07:53:55 UTC (rev 85666)
@@ -0,0 +1,32 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2009, Red Hat Middleware LLC, and individual contributors
+ * 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.web.tomcat.service.management;
+
+/**
+ * @author Scott.Stark at jboss.org
+ * @version $Revision:$
+ */
+public interface IHost
+{
+   public boolean getunpackWARs();
+   public String[] getaliases();
+}

Modified: branches/Branch_5_x/tomcat/src/resources/jboss-beans.xml
===================================================================
--- branches/Branch_5_x/tomcat/src/resources/jboss-beans.xml	2009-03-10 07:00:42 UTC (rev 85665)
+++ branches/Branch_5_x/tomcat/src/resources/jboss-beans.xml	2009-03-10 07:53:55 UTC (rev 85666)
@@ -80,4 +80,23 @@
       <property name="address">${jboss.bind.address}</property>
       <property name="server"><inject bean="JMXKernel" property="mbeanServer"/></property>
    </bean>
+   <bean name="${jboss.bind.address}MO"
+      class="org.jboss.web.tomcat.service.management.Host">
+      <property name="domain">jboss.web</property>
+      <property name="name">${jboss.bind.address}</property>
+      <property name="nameProps">
+         <map class="java.util.Properties" keyClass="java.lang.String" valueClass="java.lang.String">
+            <entry>
+               <key>type</key>
+               <value>Host</value>
+            </entry>
+         <entry>
+            <key>host</key>
+            <value>${jboss.bind.address}</value>
+         </entry>
+         </map>
+      </property>
+   </bean>
+
+   
 </deployment>

Modified: branches/Branch_5_x/tomcat/src/resources/server.xml
===================================================================
--- branches/Branch_5_x/tomcat/src/resources/server.xml	2009-03-10 07:00:42 UTC (rev 85665)
+++ branches/Branch_5_x/tomcat/src/resources/server.xml	2009-03-10 07:53:55 UTC (rev 85666)
@@ -161,7 +161,6 @@
                 transactionManagerObjectName="jboss:service=TransactionManager" />
                 
          </Host>
-
       </Engine>
 
    </Service>




More information about the jboss-cvs-commits mailing list