You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tuscany.apache.org by Amindri Udugala <am...@gmail.com> on 2011/05/28 08:55:29 UTC

Adding JMX capabilities to Tuscany (patch)

---------- Forwarded message ----------
From: Amindri Udugala <am...@gmail.com>
Date: 27 May 2011 09:32
Subject: Adding JMX capabilities to Tuscany (patch)
To: Raymond Feng <en...@gmail.com>


Hi Raymond,
I have attached a zip file of the jmx module I created and the core-spi
module (in there I have created a package mgt : path
"modules/core-spi/src/main/java/org/apache/tuscany/sca/mgt").
I have fully implemented the management class only for the EndpointReference
interface so I added a new method to it named "getView()", and have
implemented the method in "EndpointReferenceImpl".  I'm hoping to add
similar methods to other classes which needs to be monitored.. (hope that
approach is ok)

Also I have a problem in accessing all the runtime objects. Please have a
look at the "JmxModuleActivator" class in the jmx module. In
"getMBeanObjects()" method I need to access all objects which are created
and assign them to Maps. Can you please help me in doing this?

I'm using IntelliJIDEA as the editor, and when I open up certain classes ,
it shows many dependency errors. Also when I imported certain classes, the
editor warned me of adding circular dependencies (I ignored these warnings)

Please have a look at this and let me know if I should change my
implementation design :)



-- 
Thanks

Amindri Udugala
University of Colombo School of Computing,
Sri Lanka.




-- 
Thanks

Amindri Udugala
University of Colombo School of Computing,
Sri Lanka.

Re: Adding JMX capabilities to Tuscany (patch)

Posted by Amindri Udugala <am...@gmail.com>.
Hi,

Thanx for your feed back. I'll go through each of these comments..
On 31 May 2011 22:17, Raymond Feng <en...@gmail.com> wrote:

> Hi, Amindri.
>
> Thanks for the patch. I have a few comments:
>
> 1) It seems that you are trying to add the "getView()" into the model such
> as Endpoint. This approach is a bit invasive. Can we achieve the same
> function using a different way?
>
> * Define a ManagementProviderExtensionPoint which collects all management
> providers for given managed entities in Tuscany runtime.
> * Define an ManagementProvider SPI like:
>
> package org.apache.tuscany.sca.management.jmx;
>
> public interface ManagementProvider<M> {
> Class<M> getModelType(); // The type of the model to be managed
> <V> V getView(M model); // The view of the given model
> }
>
> * For managed entities in Tuscany runtime, create an implementation
> of ManagementProvider and register it using
> META-INF/services/org.apache.tuscany.sca.management.jmx.ManagementProvider
>
> 2) Can the MXBeans be hierarchical in addition to the flat list? Typically
> in Tuscany, the managed entities are part of a tree. For example,
> ExtensionPointRegistry --> ExtensionPoint --> Extension, or SCA Domain -->
> Composite --> Component --> Services. Maybe the hierarchy can be represented
> using the ObjectName conventions.
>
> 3) To access the managed entities, take a look
> at org.apache.tuscany.sca.core.assembly.impl.CompositeActivatorImpl
> and org.apache.tuscany.sca.core.DefaultExtensionPointRegistry. We might need
> to expose some of the information to JMX.
>
> Thanks,
> Raymond
> *________________________________________________________________
> Raymond Feng
> rfeng@apache.org
> Apache Tuscany PMC member and committer: tuscany.apache.org
> Co-author of Tuscany SCA In Action book: www.tuscanyinaction.com
> Personal Web Site: www.enjoyjava.com
> ________________________________________________________________*
>
> On May 27, 2011, at 11:55 PM, Amindri Udugala wrote:
>
>
>
> ---------- Forwarded message ----------
> From: Amindri Udugala <am...@gmail.com>
> Date: 27 May 2011 09:32
> Subject: Adding JMX capabilities to Tuscany (patch)
> To: Raymond Feng <en...@gmail.com>
>
>
> Hi Raymond,
> I have attached a zip file of the jmx module I created and the core-spi
> module (in there I have created a package mgt : path
> "modules/core-spi/src/main/java/org/apache/tuscany/sca/mgt").
> I have fully implemented the management class only for the
> EndpointReference interface so I added a new method to it named "getView()",
> and have implemented the method in "EndpointReferenceImpl".  I'm hoping to
> add similar methods to other classes which needs to be monitored.. (hope
> that approach is ok)
>
> Also I have a problem in accessing all the runtime objects. Please have a
> look at the "JmxModuleActivator" class in the jmx module. In
> "getMBeanObjects()" method I need to access all objects which are created
> and assign them to Maps. Can you please help me in doing this?
>
> I'm using IntelliJIDEA as the editor, and when I open up certain classes ,
> it shows many dependency errors. Also when I imported certain classes, the
> editor warned me of adding circular dependencies (I ignored these warnings)
>
> Please have a look at this and let me know if I should change my
> implementation design :)
>
>
>
> --
> Thanks
>
> Amindri Udugala
> University of Colombo School of Computing,
> Sri Lanka.
>
>
>
>
> --
> Thanks
>
> Amindri Udugala
> University of Colombo School of Computing,
> Sri Lanka.
>
> <modules.zip>
>
>
>


-- 
Thanks

Amindri Udugala
University of Colombo School of Computing,
Sri Lanka.

Re: Adding JMX capabilities to Tuscany (patch)

Posted by Luciano Resende <lu...@gmail.com>.
On Tue, May 31, 2011 at 9:47 AM, Raymond Feng <en...@gmail.com> wrote:
> Hi, Amindri.
> Thanks for the patch. I have a few comments:
> 1) It seems that you are trying to add the "getView()" into the model such
> as Endpoint. This approach is a bit invasive. Can we achieve the same
> function using a different way?
> * Define a ManagementProviderExtensionPoint which collects all management
> providers for given managed entities in Tuscany runtime.
> * Define an ManagementProvider SPI like:
> package org.apache.tuscany.sca.management.jmx;
> public interface ManagementProvider<M> {
> Class<M> getModelType(); // The type of the model to be managed
> <V> V getView(M model); // The view of the given model
> }
> * For managed entities in Tuscany runtime, create an implementation
> of ManagementProvider and register it using
> META-INF/services/org.apache.tuscany.sca.management.jmx.ManagementProvider
> 2) Can the MXBeans be hierarchical in addition to the flat list? Typically
> in Tuscany, the managed entities are part of a tree. For example,
> ExtensionPointRegistry --> ExtensionPoint --> Extension, or SCA Domain -->
> Composite --> Component --> Services. Maybe the hierarchy can be represented
> using the ObjectName conventions.
> 3) To access the managed entities, take a look
> at org.apache.tuscany.sca.core.assembly.impl.CompositeActivatorImpl
> and org.apache.tuscany.sca.core.DefaultExtensionPointRegistry. We might need
> to expose some of the information to JMX.
> Thanks,
> Raymond

I also have a requirement, where, in environments where JMX and other
Management APIs are not supported, can I remove the module and
everything will still work without any dependencies on the management
APIS ? This is mainly to allow us to run Tuscany in cloud environments
such Google App Engine where management APIs are NOT whitelisted on
the sandbox environment of the application.



-- 
Luciano Resende
http://people.apache.org/~lresende
http://twitter.com/lresende1975
http://lresende.blogspot.com/

Re: Adding JMX capabilities to Tuscany (patch)

Posted by Raymond Feng <en...@gmail.com>.
Hi, Amindri.

Thanks for the patch. I have a few comments:

1) It seems that you are trying to add the "getView()" into the model such as Endpoint. This approach is a bit invasive. Can we achieve the same function using a different way?

* Define a ManagementProviderExtensionPoint which collects all management providers for given managed entities in Tuscany runtime.
* Define an ManagementProvider SPI like:

	package org.apache.tuscany.sca.management.jmx;

	public interface ManagementProvider<M> {
		Class<M> getModelType(); // The type of the model to be managed
		<V> V getView(M model); // The view of the given model
	}

* For managed entities in Tuscany runtime, create an implementation of ManagementProvider and register it using
META-INF/services/org.apache.tuscany.sca.management.jmx.ManagementProvider

2) Can the MXBeans be hierarchical in addition to the flat list? Typically in Tuscany, the managed entities are part of a tree. For example, ExtensionPointRegistry --> ExtensionPoint --> Extension, or SCA Domain --> Composite --> Component --> Services. Maybe the hierarchy can be represented using the ObjectName conventions.

3) To access the managed entities, take a look at org.apache.tuscany.sca.core.assembly.impl.CompositeActivatorImpl and org.apache.tuscany.sca.core.DefaultExtensionPointRegistry. We might need to expose some of the information to JMX.

Thanks,
Raymond
________________________________________________________________ 
Raymond Feng
rfeng@apache.org
Apache Tuscany PMC member and committer: tuscany.apache.org
Co-author of Tuscany SCA In Action book: www.tuscanyinaction.com
Personal Web Site: www.enjoyjava.com
________________________________________________________________

On May 27, 2011, at 11:55 PM, Amindri Udugala wrote:

> 
> 
> ---------- Forwarded message ----------
> From: Amindri Udugala <am...@gmail.com>
> Date: 27 May 2011 09:32
> Subject: Adding JMX capabilities to Tuscany (patch)
> To: Raymond Feng <en...@gmail.com>
> 
> 
> Hi Raymond,
> I have attached a zip file of the jmx module I created and the core-spi module (in there I have created a package mgt : path "modules/core-spi/src/main/java/org/apache/tuscany/sca/mgt"). 
> I have fully implemented the management class only for the EndpointReference interface so I added a new method to it named "getView()", and have implemented the method in "EndpointReferenceImpl".  I'm hoping to add similar methods to other classes which needs to be monitored.. (hope that approach is ok)
> 
> Also I have a problem in accessing all the runtime objects. Please have a look at the "JmxModuleActivator" class in the jmx module. In "getMBeanObjects()" method I need to access all objects which are created and assign them to Maps. Can you please help me in doing this?
> 
> I'm using IntelliJIDEA as the editor, and when I open up certain classes , it shows many dependency errors. Also when I imported certain classes, the editor warned me of adding circular dependencies (I ignored these warnings)
> 
> Please have a look at this and let me know if I should change my implementation design :)
> 
>  
> 
> -- 
> Thanks
> 
> Amindri Udugala
> University of Colombo School of Computing, 
> Sri Lanka.
> 
> 
> 
> 
> -- 
> Thanks
> 
> Amindri Udugala
> University of Colombo School of Computing, 
> Sri Lanka.
> 
> <modules.zip>