Hi,
I have developped a matcher that use a SourceResolver as follows
1) My class implements the import org.apache.avalon.framework.component.Composable
interface
2) I get the ComponentManager as follows
/** The component manager instance */
protected org.apache.avalon.framework.component.ComponentManager manager_;
/**
* Set the current codeComponentManager/code instance used by this
* codeComposable/code.
*/
public void compose(org.apache.avalon.framework.component.ComponentManager
aManager) throws ComponentException
{
manager_=aManager;
}
3) Then in the configure method (from the Configurable interface), I access to the
(URLFactory)SourceResolver via the component manager as follows
String config_url=foo.xml;
URLFactory url_factory = null;
Source config_source = null;
try
{
url_factory = (URLFactory)this.manager_.lookup(URLFactory.ROLE);
URLFactorySourceResolver urlResolver = new
URLFactorySourceResolver(url_factory, this.manager_);
config_source = urlResolver.resolve(config_url);
...
}
catch (Exception e)
{
throw new ConfigurationException(Cannot load configuration from +
config_url, e);
}
finally
{
this.manager_.release(url_factory);
if (config_source != null) {
config_source.recycle();
}
Does it address your problem ?
Gabriel
-Message d'origine-
De : Paul Bowler [mailto:[EMAIL PROTECTED]
Envoyé : mardi 1 juillet 2003 16:25
À : [EMAIL PROTECTED]
Objet : SourceResolver in Selector?
Anyone know how to resolve a URI within a selector?
No SourceResolver is passed to it, unlike a Transformer, and I'm trying to gain access
to a local XML file with no
luck.
Thanks,
Paul.
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]