niclas      2004/05/07 09:52:36

  Modified:    facilities/jmx/test/conf block.xml
               facilities/jmx/test/src/java/org/apache/avalon/playground/jmxtest
                        JMXTestComponent.java JMXTestComponentMBean.java
  Log:
  More patches from Cameron Fieber.
  
  Revision  Changes    Path
  1.3       +12 -1     avalon-components/facilities/jmx/test/conf/block.xml
  
  Index: block.xml
  ===================================================================
  RCS file: /home/cvs/avalon-components/facilities/jmx/test/conf/block.xml,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- block.xml 6 May 2004 19:42:15 -0000       1.2
  +++ block.xml 7 May 2004 16:52:36 -0000       1.3
  @@ -11,7 +11,18 @@
       </classpath>
     </classloader>
    
  -  <include name="mx4j" id="avalon-jmx:avalon-jmx-mx4j" version="1.0.dev-0"/>
  +  <include name="mx4j" id="avalon-jmx:avalon-jmx-mx4j" version="1.0.dev-0">
  +    <target path="registry">
  +      <configuration>
  +        <enable-rmi-adaptor>
  +          true
  +        </enable-rmi-adaptor>
  +        <rmi-naming-factory>
  +          com.sun.jndi.rmi.registry.RegistryContextFactory
  +        </rmi-naming-factory>
  +      </configuration>
  +    </target>
  +  </include>
    
     <component name="test"  
class="org.apache.avalon.playground.jmxtest.JMXTestComponent"/>
    
  
  
  
  1.3       +137 -64   
avalon-components/facilities/jmx/test/src/java/org/apache/avalon/playground/jmxtest/JMXTestComponent.java
  
  Index: JMXTestComponent.java
  ===================================================================
  RCS file: 
/home/cvs/avalon-components/facilities/jmx/test/src/java/org/apache/avalon/playground/jmxtest/JMXTestComponent.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- JMXTestComponent.java     8 Apr 2004 08:35:16 -0000       1.2
  +++ JMXTestComponent.java     7 May 2004 16:52:36 -0000       1.3
  @@ -1,64 +1,137 @@
  -/*
  - * Copyright 2004 Apache Software Foundation
  - * Licensed  under the  Apache License,  Version 2.0  (the "License");
  - * you may not use  this file  except in  compliance with the License.
  - * You may obtain a copy of the License at
  - *
  - *   http://www.apache.org/licenses/LICENSE-2.0
  - *
  - * Unless required by applicable law or agreed to in writing, software
  - * distributed  under the  License is distributed on an "AS IS" BASIS,
  - * WITHOUT  WARRANTIES OR CONDITIONS  OF ANY KIND, either  express  or
  - * implied.
  - *
  - * See the License for the specific language governing permissions and
  - * limitations under the License.
  - */
  -package org.apache.avalon.playground.jmxtest;
  -
  -import org.apache.avalon.framework.activity.Initializable;
  -import org.apache.avalon.framework.activity.Startable;
  -import org.apache.avalon.framework.logger.AbstractLogEnabled;
  -
  -/**
  - * @author <a href="mailto:dev@avalon.apache.org";>Avalon Development Team</a>
  - * @version $Revision$
  - *
  - * @avalon.component name="JMXTestComponent" lifestyle="singleton"
  - * @avalon.service type="org.apache.avalon.playground.jmxtest.JMXTestService"
  - * @avalon.service 
type="org.apache.avalon.playground.jmxtest.JMXTestComponentMBean"
  - */
  -public class JMXTestComponent extends AbstractLogEnabled implements 
JMXTestService, Initializable,
  -    Startable, JMXTestComponentMBean
  -{
  -    private int numberOfServiceInvokes = 0;
  -
  -    public void initialize()
  -    {
  -        getLogger().info( "JMXTextComponent initialized instance: " + 
System.identityHashCode( this ) );
  -    }
  -
  -    public void start()
  -    {
  -        getLogger().info( "JMXTextComponent started instance: " + 
System.identityHashCode( this ) );
  -    }
  -
  -    public void stop()
  -    {
  -        getLogger().info( "JMXTextComponent stopped instance: " + 
System.identityHashCode( this ) );
  -    }
  -
  -    public void serviceMethod()
  -    {
  -        getLogger().info( "serviceMethod was invoked on instance: " + 
System.identityHashCode( this ) );
  -        numberOfServiceInvokes++;
  -    }
  -
  -    public int getNumberOfServiceInvokes()
  -    {
  -        getLogger().info( "getNumberOfServiceInvokes was invoked on 
instance: "
  -                          + System.identityHashCode( this ) );
  -        return numberOfServiceInvokes;
  -    }
  -
  -}
  +/*
  + * Copyright 2004 Apache Software Foundation
  + * Licensed  under the  Apache License,  Version 2.0  (the "License");
  + * you may not use  this file  except in  compliance with the License.
  + * You may obtain a copy of the License at
  + *
  + *   http://www.apache.org/licenses/LICENSE-2.0
  + *
  + * Unless required by applicable law or agreed to in writing, software
  + * distributed  under the  License is distributed on an "AS IS" BASIS,
  + * WITHOUT  WARRANTIES OR CONDITIONS  OF ANY KIND, either  express  or
  + * implied.
  + *
  + * See the License for the specific language governing permissions and
  + * limitations under the License.
  + */
  +package org.apache.avalon.playground.jmxtest;
  +
  +import org.apache.avalon.framework.activity.Initializable;
  +import org.apache.avalon.framework.activity.Startable;
  +import org.apache.avalon.framework.logger.AbstractLogEnabled;
  +
  +/**
  + * @author <a href="mailto:dev@avalon.apache.org";>Avalon Development Team</a>
  + * @version $Revision$
  + *
  + * @avalon.component name="JMXTestComponent" lifestyle="singleton"
  + * @avalon.service type="org.apache.avalon.playground.jmxtest.JMXTestService"
  + */
  +public class JMXTestComponent extends AbstractLogEnabled implements 
JMXTestService, Initializable,
  +    Startable, JMXTestComponentMBean
  +{
  +    private int numberOfServiceInvokes = 0;
  +    
  +    private int numberOfJmxMethodInvokes = 0;
  +
  +    private int numberOfJmxAttributeReads = 0;
  +
  +    private int mutableProperty = 0;
  +
  +    public void initialize()
  +    {
  +        getLogger().info( "JMXTextComponent initialized instance: " + 
System.identityHashCode( this ) );
  +    }
  +
  +    public void start()
  +    {
  +        getLogger().info( "JMXTextComponent started instance: " + 
System.identityHashCode( this ) );
  +    }
  +
  +    public void stop()
  +    {
  +        getLogger().info( "JMXTextComponent stopped instance: " + 
System.identityHashCode( this ) );
  +    }
  +
  +    public void serviceMethod()
  +    {
  +        getLogger().info( "serviceMethod was invoked on instance: " + 
System.identityHashCode( this ) );
  +        numberOfServiceInvokes++;
  +    }
  +
  +    //JMXTestComponentMBean:
  +    public int getNumberOfServiceInvokes()
  +    {
  +        getLogger().info( "getNumberOfServiceInvokes was invoked on 
instance: "
  +                          + System.identityHashCode( this ) );
  +        numberOfJmxAttributeReads++;
  +        return numberOfServiceInvokes;
  +    }
  +
  +    public int getNumberOfJmxAttributeReads()
  +    {
  +        getLogger().info( "getNumberOfJmxAttributeReads was invoked on 
instance: "
  +                          + System.identityHashCode( this ) );
  +        numberOfJmxAttributeReads++;
  +        return numberOfJmxAttributeReads;
  +    }
  +
  +    public int getNumberOfJmxMethodInvokes()
  +    {
  +        numberOfJmxAttributeReads++;
  +        return numberOfJmxMethodInvokes;
  +    }
  +
  +    public int getMutableProperty()
  +    {
  +        getLogger().info( "getMutableProperty was invoked on instance: "
  +                          + System.identityHashCode( this ) );
  +        numberOfJmxAttributeReads++;
  +        return mutableProperty;
  +    }
  +
  +    public void setMutableProperty(int mutableProperty)
  +    {
  +        getLogger().info( "setMutableProperty was invoked on instance: "
  +                          + System.identityHashCode( this ) );
  +        this.mutableProperty = mutableProperty;
  +    }
  +
  +    public String invokeMethodWithReturn()
  +    {
  +        final String message = "invokeMethodWithReturn was invoked on 
instance: "
  +                               + System.identityHashCode( this )
  +                               + " at: " + System.currentTimeMillis();
  +        numberOfJmxMethodInvokes++;
  +        getLogger().info( message );
  +        return message;
  +    }
  +
  +    public void invokeMethodNoReturn()
  +    {
  +        getLogger().info( "invokeMethodNoReturn was invoked on instance: "
  +                          + System.identityHashCode( this ) );
  +        numberOfJmxMethodInvokes++;
  +    }
  +
  +    public void invokeMethodWithArgs(String arg1, int arg2)
  +    {
  +        getLogger().info( "invokeMethodWithArgs was invoked on instance: "
  +                          + System.identityHashCode( this )
  +                          + " with arg1: " + arg1
  +                          + ", arg2: " + arg2 );
  +        numberOfJmxMethodInvokes++;
  +    }
  +
  +    public String invokeMethodWithArgsAndReturn(String arg1, int arg2)
  +    {
  +        final String message = "invokeMethodWithArgsAndReturn was invoked on 
instance: "
  +                               + System.identityHashCode( this )
  +                               + " with arg1: " + arg1
  +                               + ", arg2: " + arg2 
  +                               + " at: " + System.currentTimeMillis();
  +        getLogger().info( message );
  +        numberOfJmxMethodInvokes++;
  +        return message;
  +    }
  +}
  
  
  
  1.2       +42 -26    
avalon-components/facilities/jmx/test/src/java/org/apache/avalon/playground/jmxtest/JMXTestComponentMBean.java
  
  Index: JMXTestComponentMBean.java
  ===================================================================
  RCS file: 
/home/cvs/avalon-components/facilities/jmx/test/src/java/org/apache/avalon/playground/jmxtest/JMXTestComponentMBean.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- JMXTestComponentMBean.java        4 Apr 2004 15:00:58 -0000       1.1
  +++ JMXTestComponentMBean.java        7 May 2004 16:52:36 -0000       1.2
  @@ -1,26 +1,42 @@
  -/*
  - * Copyright 2004 Apache Software Foundation
  - * Licensed  under the  Apache License,  Version 2.0  (the "License");
  - * you may not use  this file  except in  compliance with the License.
  - * You may obtain a copy of the License at
  - *
  - *   http://www.apache.org/licenses/LICENSE-2.0
  - *
  - * Unless required by applicable law or agreed to in writing, software
  - * distributed  under the  License is distributed on an "AS IS" BASIS,
  - * WITHOUT  WARRANTIES OR CONDITIONS  OF ANY KIND, either  express  or
  - * implied.
  - *
  - * See the License for the specific language governing permissions and
  - * limitations under the License.
  - */
  -package org.apache.avalon.playground.jmxtest;
  -
  -/**
  - * @author <a href="mailto:dev@avalon.apache.org";>Avalon Development Team</a>
  - * @version $Revision$
  - */
  -public interface JMXTestComponentMBean
  -{
  -    int getNumberOfServiceInvokes();
  -}
  +/*
  + * Copyright 2004 Apache Software Foundation
  + * Licensed  under the  Apache License,  Version 2.0  (the "License");
  + * you may not use  this file  except in  compliance with the License.
  + * You may obtain a copy of the License at
  + *
  + *   http://www.apache.org/licenses/LICENSE-2.0
  + *
  + * Unless required by applicable law or agreed to in writing, software
  + * distributed  under the  License is distributed on an "AS IS" BASIS,
  + * WITHOUT  WARRANTIES OR CONDITIONS  OF ANY KIND, either  express  or
  + * implied.
  + *
  + * See the License for the specific language governing permissions and
  + * limitations under the License.
  + */
  +package org.apache.avalon.playground.jmxtest;
  +
  +/**
  + * @author <a href="mailto:dev@avalon.apache.org";>Avalon Development Team</a>
  + * @version $Revision$
  + */
  +public interface JMXTestComponentMBean
  +{
  +    int getNumberOfServiceInvokes();
  +
  +    int getNumberOfJmxAttributeReads();
  +
  +    int getNumberOfJmxMethodInvokes();
  +
  +    int getMutableProperty();
  +
  +    void setMutableProperty(int mutableProperty);
  +
  +    String invokeMethodWithReturn();
  +
  +    void invokeMethodNoReturn();
  +
  +    void invokeMethodWithArgs(String arg1, int arg2);
  +    
  +    String invokeMethodWithArgsAndReturn(String arg1, int arg2);
  +}
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to