-
1. Re: Disable system property replacement in a specific xml file
aloubyansky Oct 12, 2010 9:50 AM (in response to jaikiran)It can be done per SchemaBinding. E.g.
@JBossXmlSchema(replacePropertyRefs=false)
public class Root {... -
2. Re: Disable system property replacement in a specific xml file
jaikiran Oct 12, 2010 9:56 AM (in response to aloubyansky)Does that mean we can't configure it in a runtime? For example, if we wanted to disable this for ejb-jar.xml in "all" profile and allow it for ejb-jar.xml in "default" profile which share the same schema binding classes.
-
3. Re: Disable system property replacement in a specific xml file
aloubyansky Oct 12, 2010 10:20 AM (in response to jaikiran)In the AS runtime - no, we can't. There is no deployer configuration option for it.
From the XB point of view, it's a property of SchemaBinding, so it's possible. What complicates this in the AS is that SchemaBinding's aren't directly passed to the unmarshaller. Instead SchemaResolver is responsible for providing (building & caching) SchemaBinding's *during* unmarshalling and it doesn't modify their properties initialized from annotations.
A dirty workaround would be to get the resolver in the parsing deployer, ask it to resolve the SchemaBinding and change its property.
-
4. Re: Disable system property replacement in a specific xml file
aloubyansky Dec 15, 2010 8:42 AM (in response to aloubyansky)With the addition of a new property "Map<String, SchemaBindingInitializer> schemaInitializerInstances" to SchemaResolverConfig (I'd need to make another release of xb of that), this could be done by registering a SchemaBindingInitializer that would modify the properties (initialized with metadata annotations) of the just built SchemaBinding object, e.g.
{code}public class SchemaBindingPropertyInitializer implements SchemaBindingInitializer
{
private boolean replacePropertyRefs;
public boolean isReplaceProperyRefs()
{
return replacePropertyRefs;
}
public void setReplacePropertyRefs(boolean replacePropertyRefs)
{
this.replacePropertyRefs = replacePropertyRefs;
}
public SchemaBinding init(SchemaBinding schema)
{
schema.setReplacePropertyRefs(replacePropertyRefs);
return schema;
}
}{code}
Then in metadata-deployer-jboss-beans.xml we'll need to add schemaInitializerInstances property in SchemaResolverConfig like
{code:xml}<bean name="SchemaResolverConfig"
class="org.jboss.xb.binding.sunday.unmarshalling.SchemaResolverConfig">
<property name="schemaInitializerInstances">
<map keyClass="java.lang.String" valueClass="java.lang.String">
<entry>
<key>http://java.sun.com/xml/ns/javaee</key>
<value>
<bean class="org.jboss.xb.util.SchemaBindingPropertyInitializer">
<property name="replacePropertyRefs">true</property>
</bean>
</value>
</entry>
</map>
</property>
...
{code}
Note, that with this configuration every schema with target namespace javaee is going to be affected.
What do you think about this? Note, I am not sure SchemaBindingPropertyInitializer should reside in the XB codebase...