You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@avalon.apache.org by Berin Loritsch <bl...@apache.org> on 2002/02/06 17:17:26 UTC

Manager interfaces?

I am throwing this out there for general consumption.  I have been thinking, Managers
inherently manage resources.  That means that the resources must be initialized and
disposed of properly.  Instead of forcing the class using the interface to perform
dynamic ***Manager instanceof Initializable calls, I propose to have a systemic approach
that all Managers are Initializable and Disposable.

The proposed interfaces would be:

interface Manager extends Initializable, Disposable {}

interface ActiveManager extends Manager, Suspendable {}

This provides a nice and simple interface without the user of the manager having to
check for dynamic things.  I don't want the Startable interface because it merely
confuses things.  It is either initialized or not.  This would allow me to provide
functionality like this:

ContainerManager manager = new ContainerManager( initialParams );
manager.initialize();

// do stuff

manager.dispose();
return;

If I decided to specialize ContainerManager to manage an active Container, I would
have something like this:

ActiveContainerManager manager = new ActiveContainerManager( initialParams );
manager.initialize();

// do stuff

manager.suspend();

// wait for a while

manager.resume();

// do more stuff

manager.dispose();
return;


As you can see the approach allows me to interact with the ContainerManager (the root
Manager in my system) in a consistent manner without having unnecessary casts).

Furthermore, certain managers like the CommandManager require the Suspendable interface
for those times when you really want to suspend a system.  It provides a nice and tidy
method for doing things.

The concept behind the Manager is that it should be easy to use--without too many
lifecycle methods.  Initialize and Dispose are very common in the world of managed resources.

I am open to feedback on this issue.

-- 

"They that give up essential liberty to obtain a little temporary safety
  deserve neither liberty nor safety."
                 - Benjamin Franklin


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: Manager interfaces?

Posted by Berin Loritsch <bl...@apache.org>.
Peter Donald wrote:
> +/- 0 if you intend to keep the interface in ecalibur. If not then it is 
> probably best to usemore neutral names. Maybe something like
> 
> interface Constructed extends Initializable, Disposable {}
> interface Active extends Manager, Suspendable {}


My plan was to keep them in the excalibur.system package along with the
ContainerManager.


-- 

"They that give up essential liberty to obtain a little temporary safety
  deserve neither liberty nor safety."
                 - Benjamin Franklin


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: Manager interfaces?

Posted by Peter Donald <pe...@apache.org>.
+/- 0 if you intend to keep the interface in ecalibur. If not then it is 
probably best to usemore neutral names. Maybe something like

interface Constructed extends Initializable, Disposable {}
interface Active extends Manager, Suspendable {}

On Thu, 7 Feb 2002 03:17, Berin Loritsch wrote:
> I am throwing this out there for general consumption.  I have been
> thinking, Managers inherently manage resources.  That means that the
> resources must be initialized and disposed of properly.  Instead of forcing
> the class using the interface to perform dynamic ***Manager instanceof
> Initializable calls, I propose to have a systemic approach that all
> Managers are Initializable and Disposable.
>
> The proposed interfaces would be:
>
> interface Manager extends Initializable, Disposable {}
>
> interface ActiveManager extends Manager, Suspendable {}
>
> This provides a nice and simple interface without the user of the manager
> having to check for dynamic things.  I don't want the Startable interface
> because it merely confuses things.  It is either initialized or not.  This
> would allow me to provide functionality like this:
>
> ContainerManager manager = new ContainerManager( initialParams );
> manager.initialize();
>
> // do stuff
>
> manager.dispose();
> return;
>
> If I decided to specialize ContainerManager to manage an active Container,
> I would have something like this:
>
> ActiveContainerManager manager = new ActiveContainerManager( initialParams
> ); manager.initialize();
>
> // do stuff
>
> manager.suspend();
>
> // wait for a while
>
> manager.resume();
>
> // do more stuff
>
> manager.dispose();
> return;
>
>
> As you can see the approach allows me to interact with the ContainerManager
> (the root Manager in my system) in a consistent manner without having
> unnecessary casts).
>
> Furthermore, certain managers like the CommandManager require the
> Suspendable interface for those times when you really want to suspend a
> system.  It provides a nice and tidy method for doing things.
>
> The concept behind the Manager is that it should be easy to use--without
> too many lifecycle methods.  Initialize and Dispose are very common in the
> world of managed resources.
>
> I am open to feedback on this issue.

-- 
Cheers,

Pete

"You know what a dumbshit the 'average man' on the street is? Well, by
definition, half of them are even dumber than that!"
					J.R. "Bob" Dobbs

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>