IMO, the ideal would to be use always ClassPoolRepository and set only the factoy. This would be cleanest possible. But, since the registering of jboss-cl ClassLoaders requires an extra step, we ended up with a JBossClDelegatingClassPoolRepository.
My suggestion is to get rid of JBossClDelegatingClassPoolRepository and, instead, change the spi to something like:
public class ClassPoolRepository
{
public void setProfile(Profile profile)
}
Whereas profile would tell you both the factory and provide an extra plugin class containing any extra steps that may be required for classloader registration.
Another option would be keeping ClassPoolRepository the way it is, getting rid of JBossClDelegatingClassPoolRepository, and having the ClassPoolFactory providing a plugin class containing the extra steps required for classloader registration.