--- [EMAIL PROTECTED] wrote:
> 
> Turbine <[EMAIL PROTECTED]> wrote:
> 
> With this implementation, you wouldn't need to
> hard-code initializations for the Turbine scheduler
> or
> OPaL in the init method.  You could also take care
> of
> destroying services.
> 
> Does the manager initialize the actor itself or is
> the initialization done by an explicit call to the
> actor?  In the case of the scheduler it's thread
> needs to be started automatically at Turbine init().
> 
> dave   
> 
> 
Dave, Cocoon's Manager class has this code:

  public Object create(String name, Configurations
conf) throws RuntimeException {
        try {
            Object object =
Class.forName(name).newInstance();

            if ((object instanceof Configurable) &&
(conf != null)) {
                ((Configurable) object).init(conf);
            }
            
So, the manager creates an instance of the object and,
if the object implements Configurable, the manager
calls its init method.

In cocoon, the manager has the following method:

void setRole(String name, Object actor)

So, subsequently, you can retrieve the object from the
manager with:

Object getRole(String name)

To know which classes (services) to load from
configuration, you could use something like the code
in cocoon's Router class which follows:

Configurations types = conf.getConfigurations("type");
        Enumeration e = types.keys();
        while (e.hasMoreElements()) {
            String type = (String) e.nextElement();
            String name = (String) types.get(type);
            objects.put(type, factory.create(name,
conf));
        }
        
In the above, maybe replace "type" with "service", and

objects and factory with a service manager class.

Is this clear?

If there's more interest, I'll code something for
Turbine services.  It shouldn't require much code.

- george

__________________________________________________
Do You Yahoo!?
Talk to your friends online with Yahoo! Messenger.
http://im.yahoo.com


------------------------------------------------------------
To subscribe:        [EMAIL PROTECTED]
To unsubscribe:      [EMAIL PROTECTED]
Problems?:           [EMAIL PROTECTED]

Reply via email to