can be easily specified to the SARDeployer, or the schema can be made
available to the entity resolver via some other configuration.
*/
final URL url = Thread.currentThread().getContextClassLoader().getResource("xml/naming/");
Unmarshaller unmarshaller = UnmarshallerFactory.newInstance().newUnmarshaller();
unmarshaller.setEntityResolver(new JBossEntityResolver(){
public InputSource resolveEntity(String publicId, String systemId) throws SAXException, IOException
{
if(systemId.endsWith("custom-object-binding.xsd") ||
systemId.endsWith("jndi-binding-service_1_0.xsd"))
{
String fileName = systemId.substring(systemId.lastIndexOf('/') + 1);
URL url = Thread.currentThread().getContextClassLoader().
getResource("xml/naming/" + fileName);
return new InputSource(url.toExternalForm());
}
else
{
return super.resolveEntity(publicId, systemId);
}
}
});
JNDIBindings bindings = (JNDIBindings) unmarshaller.unmarshal(is2,
new SchemaBindingResolver(){
public String getBaseURI()
{
throw new UnsupportedOperationException("getBaseURI is not implemented.");
}