Danny,

I have tested with 2.2 this new facility to deploy easily in apps\james\SAR-INF\lib my 
mailets residing in my own jar: it works great!

Let me understand though the following: you say:

> The classloaders created inherit the same loader used by the 
> spoolmanager, and hence have access to all the same classes in 
> the same loader as James does. 
> This allows mailets to access the underlying Avalon services via 
> the mailet context. 
> This breaks the intended design for the v3 mailet context, which 
> should be unable to be used to get details of the context implementation. 
> 
> However this classloader seperation is not applicable to v2, so 
> the changes conform to James & mailet v2. But I would STRONGLY 
> URGE mailet developers not to access the underlying avalon 
> services directly where at all possible (or make this code easily 
> maintainable) because this access WILL be restricted in future 
> versions for security reasons.
> 
> It is our stated intention that we will improve mailet deployment 
> by supporting "mailet applications" which will run in an isolated 
> classloader space, thereby preventing access from those mailets 
> to James and other mailet applications running in the same James instance.
> Therfore in James v3 and Mailet v3 the only services available 
> will be accessed via mechanisms explicitly provided by the mailet context.

Does it mean then that the following *mailet* code would not work in *v3*:

            ...
            ComponentManager componentManager = 
(ComponentManager)getMailetContext().getAttribute(Constants.AVALON_COMPONENT_MANAGER);
            // Get the DataSourceSelector service
            DataSourceSelector datasources = 
(DataSourceSelector)componentManager.lookup(DataSourceSelector.ROLE);
            // Get the data-source required.
            DataSourceComponent datasource = 
(DataSourceComponent)datasources.select(datasourceName);
            UsersStore usersStore = 
(UsersStore)componentManager.lookup(UsersStore.ROLE);
            UsersRepository localusers = 
(UsersRepository)usersStore.getRepository("LocalUsers");
            ...
            username = localusers.getRealName(originalUsername);
            JamesUser user = (JamesUser) localusers.getUserByName(username);
            if (user.getAliasing()) {
                username = user.getAlias();
            }
            ...

because
        ComponentManager is in org.apache.avalon.framework.component,
        DataSourceComponent is in org.apache.avalon.excalibur.datasource,
        DataSourceSelector is in org.apache.avalon.cornerstone.services.datasource

and both UsersStore, UsersRepository and JamesUser are in org.apache.james.services, 
then "in James"?

Or it would be a valid code because such services come from
        getMailetContext().getAttribute(Constants.AVALON_COMPONENT_MANAGER), then from 
the mailet context?

Vincenzo



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

Reply via email to