avalon-phoenix-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Alexis Agahi <a...@users.sourceforge.net>
Subject Re: MBean suffixed classes
Date Tue, 13 Aug 2002 06:48:20 GMT
Paul Hammant wrote:
> Huw, Peter, Folks,
> 
> I have to say I dislike the MBean suffix for JMX enabled beans.  In fact 
> it is my principle objection to JMX (yes I know it is anal).

I agree



> Would it be possible to generate them?
> 
> Consider that a simple Service could be :
> 
>  interface MyThing {
>      /** @phoenix:manage-me */
>      void hello();
>  }
> 
> And its class could be :
> 
>  class MyThingImpl implements MyImpl, Startable {
>      public MyThingImpl() {
>      }
>      public void start() {}
>      public void stop() {}
>     // etc.
>  }
> 
> Perhaps, we could use xdoclet to make :
> 
>  interface MyThingMBean {
>      void hello();
>  }
> 
> And :
> 
>  class MyThingImplMBean extends MyThingImpl implements MyThingMBean {
>  }
> 
> Thus we could hide the MBean stuff.  This could either be done as part 
> of the regular Ant compile target, or be done at runtime by Phoenix 
> using BCEL.


Lets face it, java need a preprocessor ;)
remember, the good old #define 0 ;))


> It would also be possible to model some nice things like a state machine 
> for blocks.  For example start() and stop() hint at a state change. BCEL 
> could generate
> 
>  class GeneratedBlockNNNN extends MyThingImpl {
>      boolean blockStarted;
>      public void start() {
>        super.start();
>        blockStarted = true;
>      }
>      public void stop() {
>        super.stop();
>        blockStarted = false;
>      }
>      public isStarted() {
>        return blockStarted;
>      }
>  }
> 
> It would be useful for the BeanShell enabled kernel which can traverse 
> objects without constraint.



BCEL or ant are good.

Just to suggest another way, I would propose that a componant 
could implement an interface, let say "Managable" that require a 
method such as getManagedMethod() returning all managed method.

class MyThingImpl implements MyImpl, Managable {

	void Hello(){
	}

	... getManagedMethod(){
		something.add( ... "Hello"... )
		return something;
	}
}

so this could maybe validated at compile time.


Also some componant implementing some interface such as Startable 
or Configurable (or whatever) could be managed "defacto".

As you suggested, Startable could have start/stop managed.
Configurable componant could have its configuration writable thru 
JMX (ok this is not obvious considering the configuration hierarchy).
And so


--
To unsubscribe, e-mail:   <mailto:avalon-phoenix-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:avalon-phoenix-dev-help@jakarta.apache.org>


Mime
View raw message