I need the mapping for a wizard.
In fact if I execute the methode below before the
addPackageFromDrl(drlReader, dslReader) I have problems.
private DSLMapping generateDslMapping(Reader dslReader)
{
DSLMappingFile dslMappingFile = new DSLMappingFile();
try
{
dslMappingFile.parseAndLoad(dslReader);
}
catch (IOException e)
{
throw new DroolsRuleAppException(e);
}
return dslMappingFile.getMapping();
}
Kris Verlaenen wrote:
This is not Drools-related but rather a generic Java problem.
You should read the Java API of the Reader class.
A reader remembers the last position it used to read out data.
So if you try to use the same reader twice, the second time it will be
empty,
as it will already be at the end of the file.
You could try to reset the reader to the start of the file, however,
this method is not supported by all implementations of Reader.
It is unclear why you are building your own dslMappingFile however.
The builder will do all that for you if you just use
builder.addPackageFromDrl(drlReader, dslReader);
Kris
----- Original Message -----
From: "hypnosat7" <ablarbi(a)yahoo.fr>
To: <rules-users(a)lists.jboss.org>
Sent: Monday, August 13, 2007 12:53 PM
Subject: Re: [rules-users] expander mappings empty !
>
> But why the expand methode in DrlParser.parse(final String source, final
> Reader dsl) can't build the expander with an inputStreamReader on a used
> ressource ?
> And If I use two FileReader on the same dsl file it work's
>
> example :
>
> dslReader = new
> InputStreamReader(getClass().getResourceAsStream(dslSource));
> ...
> DSLMappingFile dslMappingFile = new DSLMappingFile();
> dslMappingFile.parseAndLoad(dslReader);
> ...
> builder.addPackageFromDrl(drlReader, dslReader);
>
> the package built is invalid because the mappings property in the
> expander
> is empty
>
> Any explaination to this ?
> thanks
>
>
>
>
> hypnosat7 wrote:
>>
>>
>> In fact I used the dsl Reader before to build a DefaultDslMapping. So
>> the
>> problem is fixed
>>
>>
>> hypnosat7 wrote:
>>>
>>> Hi,
>>> I have an error when I try to buil a package using a dsl Reader :
>>> org.drools.lang.ExpanderException@983d95[16,1]: unknown:16:1 Unexpected
>>> token 'une'
>>>
>>> I try to debug it with eclipse and I find no mappings in the variable
>>> "expander"
>>>
>>> final String expanded = expander.expand( source );
>>>
>>> I'ts in the method DrlParser.parse(final String source, final Reader
>>> dsl)
>>> throws DroolsParserException
>>>
>>> So what can be the problem
>>>
>>
>>
>
> --
> View this message in context:
>
http://www.nabble.com/expander-mappings-empty-%21-tf4260034.html#a12124221
> Sent from the drools - user mailing list archive at
Nabble.com.
>
> _______________________________________________
> rules-users mailing list
> rules-users(a)lists.jboss.org
>
https://lists.jboss.org/mailman/listinfo/rules-users
_______________________________________________
rules-users mailing list
rules-users(a)lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users