On Sun, 7 Oct 2001, James Diggans wrote:
...
> The only implementing class I can find in any of the jars for the 
> ComponentManager interface is the NamedComponentManagerImpl class ... 
> but this doesn't seem to enjoy being instantiatied w/ an empty 
> constructor. I'm nearly to the point of writing inflection code to check 
> every single class in any of the jars for some freaking method allowing 
> me to instantiate a ComponentManager ... can anyone suggest a way to do 
> this?

If you want to get a reference to the Avalon's ComponentManager, you can
do it like:
 public void init() throws MessagingException {
        try {
            ComponentManager componentManager = (ComponentManager)
                getMailetContext()
                .getAttribute(Constants.AVALON_COMPONENT_MANAGER);

And that's from mailets.

You don't instantiate the component manager created by Avalon; it's
already there, all you need to do is to use it. If you want to access the
component manager from an Avalon component, then you need to implement the
compose() method in your component; something like:

    public void compose(ComponentManager componentManager) 
        throws ComponentException {
        sourceSelector = (DataSourceSelector) componentManager
            .lookup("com.pindad.james.services.DataSourceSelector");
        // then you'd have a reference to the DataSourceSelector object -
        // which is a block - from your component
    }

But you have to make sure that your newly component is initialized (and/or
the compose() method got invoked) by the blocks that loaded by Phoenix. 
The components you can get from the (running) Avalon component manager are
those blocks (SMTP server, POP server, etc), or your own blocks (Avalon
Block is also Component). To have your own blocks get run by Phoenix,
you'd have to create ones, and setup the dependency rules; which is put
int the <classname>.xinfo, assembly.xml, server.xml (for defining the
blocks' log files). And also something you need to edit in the Manifest.mf
file; the names of the blocks Phoenix should load.

I think it would be helpful if you write more completely about what you
want with the "POP3 automation"; do you want to do it by time schedule,
remote admin, or something else.

Oki



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

Reply via email to