[jboss-dev-forums] [Design the new POJO MicroContainer] - Re: Generated Classes not found if they do not match any of

kabir.khan@jboss.com do-not-reply at jboss.com
Tue Mar 10 11:33:38 EDT 2009


I'm trying to wrap this up now
"adrian at jboss.org" wrote : 
  | I'm sure Ales would want to do something more complicated 
  | but more dynamic and pluggable such as defining a
  | 
  |   | public interface GlobalCapabilitiesProvider
  |   | {
  |   |    Capabilities getCapabilities()
  |   | }
  |   | 
I'm experimenting with such a provider added to the ClassLoading bean with in/uncallbacks. What to do with it once set?

I envision something like:

  | public class ClassLoading
  | {
  |    private final Set<GlobalCapabilitiesProvider> globalCapabilitiesProviders = new ConcurrentSet<GlobalCapabilitiesProvider>();
  | 
  |    //Incallback
  |    public void addGlobalCapabilitiesProvider(GlobalCapabilitiesProvider provider)
  |    {
  |       if (provider == null)
  |          throw new IllegalArgumentException("Null global capabilities provider");
  |       
  |       globalCapabilitiesProviders.add(provider);
  |    }
  |    
  |    //Uncallback
  |    public void removeGlobalCapabilitiesProvider(GlobalCapabilitiesProvider provider)
  |    {
  |       if (provider == null)
  |          throw new IllegalArgumentException("Null global capabilities provider");
  |       
  |       globalCapabilitiesProviders.remove(provider);
  |    }
  |    ...
  |    public void addModule(Module module)
  |    {
  |       if (module == null)
  |          throw new IllegalArgumentException("Null module");
  | 
  |       //New line      
  |       module.setGlobalCapabilitiesProviders(globalCapabilitiesProviders);
  |       
  |       String domainName = module.getDeterminedDomainName();
  |       boolean parentFirst = module.isJ2seClassLoadingCompliance();
  |       String parentDomainName = module.getDeterminedParentDomainName();
  |       Domain domain = getDomain(domainName, parentDomainName, parentFirst);
  |       domain.addModule(module);
  |    }
  | }
  | 
  | public abstract class Module extends NameAndVersionSupport
  | {
  |    ...
  |    /**
  |     * Set the global capabilities providers
  |     * @param provider The provider list
  |     */
  |    void setGlobalCapabilitiesProviders(List<GlobalCapabilitiesProvider> providers)
  |    {
  |       globalCapabilitiesProviders = providers;
  |    }
  |    
  |    /**
  |     * Get the global capabilities providers
  |     * @return The providers
  |     */
  |    protected List<GlobalCapabilitiesProvider> getGlobalCapabilitiesProvider()
  |    {
  |       return globalCapabilitiesProviders;
  |    }
  | }
  | 
Then the plan is to use the global capabilities provider in Module when determining the capabilities. 



View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4216624#4216624

Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4216624



More information about the jboss-dev-forums mailing list