[rules-users] KnowledgeAgent

Esteban Aliverti esteban.aliverti at gmail.com
Tue Mar 2 07:39:58 EST 2010


David, you are right. That is the best approach I can imagine. Indeed, that
is the way used by KnowledgeAgent's unit tests.

                String xml = "";
xml += "<change-set xmlns='http://drools.org/drools-5.0/change-set'";
 xml += "    xmlns:xs='http://www.w3.org/2001/XMLSchema-instance'";
xml += "    xs:schemaLocation='http://drools.org/drools-5.0/change-setdrools-change-set-5.0.xsd'
>";
 xml += "    <add> ";
xml += "        <resource source='http://localhost:9000/rule1.drl'
type='DRL' />";
 xml += "        <resource source='http://localhost:9000/rule2.drl'
type='DRL' />";
 xml += "    </add> ";
xml += "</change-set>";
 File fxml = fileManager.newFile("changeset.xml");
Writer output = new BufferedWriter(new FileWriter(fxml));
 output.write(xml);
output.close();



 kagent.applyChangeSet(ResourceFactory.newUrlResource(fxml.toURI().toURL()));

best,

On Tue, Mar 2, 2010 at 8:56 AM, david_nabble <
david.drools_user_list at schmithuesen.net> wrote:

>
> Hi!
>
> I had the same problem: My solution was:
>
> 1) Generate a ChangSet (XML Document) with the URL(s)
> 2) write it to a temporary File (java.io.File.createTempFile).
> 3) Create a UrlResource out of this File
>
> Alternative:
> 2)  write it to a Stream
> 3) Create a InputStreamResource
>
> As far as i know, the API has no possibility to create a ChangeSet without
> generating some xml.
> I don't know if it is possible to instantiate ChangeSetImpl Class. I guess
> it might work, but ChangeSetImpl can change in future: The ChangeSet
> Interface does not have any classes for setting added resources.
>
> Dave
> --
> View this message in context:
> http://n3.nabble.com/KnowledgeAgent-tp422687p423834.html
> Sent from the Drools - User mailing list archive at Nabble.com.
> _______________________________________________
> rules-users mailing list
> rules-users at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
>



-- 
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Esteban Aliverti
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/rules-users/attachments/20100302/0312c339/attachment.html 


More information about the rules-users mailing list