[Design the new POJO MicroContainer] - Re: Generated Classes not found if they do not match any of
by kabir.khan@jboss.com
I have modified classloading-vfs/src/test/resources/org/jboss/test/classloading/vfs/metadata/Common.xml to set up the in/uncallbacks (I can move this somewhere else if you're not happy with that):
| <bean name="ClassLoading" class="org.jboss.classloading.spi.dependency.ClassLoading">
| <incallback method="addModule" state="Configured"/>
| <uncallback method="removeModule" state="Configured"/>
| <incallback method="addGlobalCapabilitiesProvider" state="Configured"/>
| <uncallback method="removeGlobalCapabilitiesProvider" state="Configured"/>
| </bean>
|
My test-specific classloading-vfs/src/test/resources/org/jboss/test/classloading/vfs/metadata/test/GeneratedClassesUnitTestCase.xml
| <?xml version="1.0" encoding="UTF-8"?>
| <deployment xmlns="urn:jboss:bean-deployer:2.0">
|
| <bean name="MockGlobalCapabilitiesProvider" class="org.jboss.test.classloading.vfs.metadata.support.MockGlobalCapabilitiesProvider">
| <property name="GlobalCapabilities">
| <capabilities xmlns="urn:jboss:classloading:1.0"> <!-- line 6 -->
| <package name="newpackage"/>
| </capabilities>
| </property>
| </bean>
| </deployment>
|
fails to parse with the exception:
| org.jboss.xb.binding.JBossXBRuntimeException: {urn:jboss:classloading:1.0}capabilities not found as a child of {urn:jboss:bean-deployer:2.0}property
|
If I try to modify Common.xml to add classloading:1.0 there:
| <bean name="SchemaResolverConfig" class="org.jboss.xb.binding.sunday.unmarshalling.SchemaResolverConfig">
| <property name="bindingClasses">
| <map keyClass="java.lang.String" valueClass="java.lang.String">
| <entry>
| <key>urn:jboss:classloader:1.0</key>
| <value>org.jboss.classloading.spi.vfs.metadata.VFSClassLoaderFactory10</value>
| </entry>
| <entry>
| <key>urn:jboss:classloading:1.0</key>
| <value>org.jboss.classloading.spi.metadata.ClassLoadingMetaData10</value>
| </entry>
| </map>
| </property>
| </bean>
|
I get
| org.jboss.xb.binding.JBossXBException: Failed to parse source: file:/Users/kabir/sourcecontrol/jboss-cl/trunk/subversion/classloading-vfs/target/tests-classes/org/jboss/test/classloading/vfs/metadata/test/GeneratedClassesUnitTestCase.xml@6,56
|
The nested exception is
| org.jboss.xb.binding.JBossXBRuntimeException: {urn:jboss:classloading:1.0}capabilities not found as a child of {urn:jboss:bean-deployer:2.0}property
|
I then noticed that 'capabilities' is spelt wrong in CapabilitiesMetaData, and tried this in my test, but that gives me
| "org.jboss.xb.binding.JBossXBRuntimeException: {urn:jboss:classloading:1.0}capabilties not found as a child of {urn:jboss:bean-deployer:2.0}property"
| with and without classloading:1.0 in Common.xml's SchemaResolverConfig.
|
View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4216724#4216724
Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4216724
17 years, 1 month
[Design the new POJO MicroContainer] - Re: Generated Classes not found if they do not match any of
by adrian@jboss.org
"kabir.khan(a)jboss.com" wrote : Then the plan is to use the global capabilities provider in Module when determining the capabilities.
|
There's no need to add extra state to the Module. Its shared information.
You should just delegate to the domain which will in turn delegate to the ClassLoading.
That way we can also have "Global capabilities" at the domain level in future if we want.
They can be package private methods.
In Module.java
| /**
| * Get the capabilities.
| *
| * @return the capabilities.
| */
| public List<Capability> getCapabilities()
| {
| // Have we already worked this out?
| if (capabilities != null)
| return capabilities;
|
| // Are there any configured ones?
| List<Capability> capabilities = determineCapabilities();
|
| // Use the defaults
| if (capabilities == null)
| capabilities = defaultCapabilities();
|
| HERE!!!!
|
| // Merge in the global capabilities
| capabilities = getDomain().mergeGlobalCapabilities(capabilites); // Which does classloading.mergeGlobalCapabilies(capabilities)
|
| // Cache it
| this.capabilities = capabilities;
| return capabilities;
| }
|
View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4216650#4216650
Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4216650
17 years, 1 month
[Design the new POJO MicroContainer] - Re: Generated Classes not found if they do not match any of
by kabir.khan@jboss.com
I'm trying to wrap this up now
"adrian(a)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
17 years, 1 month