[rules-users] Can SolverFactory receive the plain xml? [Planner]

André Fróes arfmoraes at gmail.com
Tue Jan 22 14:17:58 EST 2013


Can it be done for the drl file pointed at xml file? Instead of pass the
path to drl file, the drl content?

here's what i've done to use the xml by java over the cloudcomputing
example:

--------------------

String t = "<?xml version=\"1.0\"
encoding=\"UTF-8\"?><solver><solutionClass>org.drools.planner.examples.cloudbalancing.domain.CloudBalance</solutionClass><planningEntityClass>org.drools.planner.examples.cloudbalancing.domain.CloudProcess</planningEntityClass><scoreDirectorFactory><scoreDefinitionType>HARD_AND_SOFT</scoreDefinitionType><scoreDrl>/org/drools/planner/examples/cloudbalancing/solver/cloudBalancingScoreRules.drl</scoreDrl></scoreDirectorFactory><termination><maximumSecondsSpend>120</maximumSecondsSpend></termination><constructionHeuristic><constructionHeuristicType>FIRST_FIT_DECREASING</constructionHeuristicType><constructionHeuristicPickEarlyType>FIRST_LAST_STEP_SCORE_EQUAL_OR_IMPROVING</constructionHeuristicPickEarlyType></constructionHeuristic><localSearch><acceptor><planningEntityTabuSize>7</planningEntityTabuSize></acceptor><forager><minimalAcceptedSelection>1000</minimalAcceptedSelection></forager></localSearch></solver>";

    byte b[] = t.getBytes();
    ByteArrayInputStream bt = new ByteArrayInputStream(b);
        SolverFactory solverFactory = new XmlSolverFactory().configure(bt);
        Solver solver = solverFactory.buildSolver();
---------------------

cloudBalancingScoreRules.drl is the file I want to get from database as
text and apply it to the xml. Is it possible to do inside this
configuration or will I have to implement a xml file pointing it everytime?



2013/1/22 Geoffrey De Smet <ge0ffrey.spam at gmail.com>

>  Use a ByteArrayInputStream based on that String
> and give it to:
> org.drools.planner.config.XmlSolverFactory#configure(InputStream)
>
> Op 22-01-13 15:51, André Fróes schreef:
>
> Can I provide the plain xml code to a SolverFactory?
>
>  SolverFactory solverFactory = new XmlSolverFactory(<<xmlHere>>);
>
>  I know that I can provide the path to a config file.
>
>
> _______________________________________________
> rules-users mailing listrules-users at lists.jboss.orghttps://lists.jboss.org/mailman/listinfo/rules-users
>
>
>
> _______________________________________________
> rules-users mailing list
> rules-users at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/rules-users/attachments/20130122/537fc031/attachment.html 


More information about the rules-users mailing list