Package com.dtrules.session

Examples of com.dtrules.session.RulesDirectory


    if(pathtoDTrules != null){
      file = pathtoDTrules;
    }
   
    try {
      rd = new RulesDirectory("",file);
     
    } catch (Exception e) {
      e.printStackTrace();
    }   
   
View Full Code Here


     */
    public static void main(String args[]){
        String path = "C:\\eclipse\\workspace\\EB_POC\\new_york_EB\\xml\\";
        String file = path + "DTRules.xml";   
   
        RulesDirectory    rd      = new RulesDirectory("",file);
        RuleSet           rs      = rd.getRuleSet(RName.getRName("ebdemo"));
        RSession          session;
        try {
            OutputStream  out     = new FileOutputStream("c:\\temp\\dt.xml");
                          session = new RSession(rs);
            RulesAdminService admin   = new RulesAdminService(session, rd);
View Full Code Here

             // Allocate a RulesDirectory.  This object can contain many different Rule Sets.
             // A Rule set is a set of decision tables defined in XML,
             // the Entity Description Dictionary (the EDD, or schema) assumed by those tables, and
             // A Mapping file that maps data into this EDD.
            
             RulesDirectory rd       = new RulesDirectory(getPath(),getRulesDirectoryFile());
            
             // Select a particular rule set and create a session to load the data and evaluate
             // that data against the rules within this ruleset. 
          
             String         ruleset  = getRuleSetName();
             RName          rsName   = RName.getRName(ruleset);
             RuleSet        rs       = rd.getRuleSet(rsName);
             File           dir      = new File(getTestDirectory());
             File           files[]  = dir.listFiles();
             int            dfcnt    = 1;
            
             Date start = new Date();
View Full Code Here

        if(args.length>0){
            file = args[0];
        }
       
        try {
            RulesDirectory rd       = new RulesDirectory(path,file);
            RuleSet        rs       = rd.getRuleSet(RName.getRName("ebdemo"));
            IRSession      session  = rs.newSession();
            DTState        state    = session.getState();
            DecisionTableTypeTest test;
           
            test = new DecisionTableTypeTest(session,rs);
View Full Code Here

    public static void main(String args[]){
       
        String          file    = "c:\\eclipse\\workspace\\DTRules\\com.dtrules.testfiles\\DTRules.xml";
        IRSession       session;
        DTState         state;
        RulesDirectory  rd;
        RuleSet         rs;
       
        try {
            rd      = new RulesDirectory("",file);
            rs      = rd.getRuleSet(RName.getRName("test",true));
            session = rs.newSession();
            state   = session.getState();
        } catch (RulesException e1) {
            System.out.println("Failed to initialize the Rules Engine");
            return;
View Full Code Here

    return returnfiles;
    }
   
    public void writeDecisionTables(String tables, String fields[], boolean ascending, int limit){
        try {
            RulesDirectory    rd    = new RulesDirectory(getPath(),getRulesDirectoryFile());
            RuleSet           rs    = rd.getRuleSet(getRuleSetName());
            IRSession         s     = rs.newSession();
            RulesAdminService admin = new RulesAdminService(s);
           
            Rules2Excel r2e = new Rules2Excel();
           
View Full Code Here

             // Allocate a RulesDirectory.  This object can contain many different Rule Sets.
             // A Rule set is a set of decision tables defined in XML,
             // the Entity Description Dictionary (the EDD, or schema) assumed by those tables, and
             // A Mapping file that maps data into this EDD.
             boolean           opt   = !Trace();
             RulesDirectory rd       = new RulesDirectory(getPath(),getRulesDirectoryFile(),opt);
            
             // Select a particular rule set and create a session to load the data and evaluate
             // that data against the rules within this ruleset. 
          
             String         ruleset  = getRuleSetName();
             RName          rsName   = RName.getRName(ruleset);
             RuleSet        rs       = rd.getRuleSet(rsName);
            File           dir      = new File(getTestDirectory());
             File           files[]  = getFiles();
             int            dfcnt    = 1;
            
             if(rs == null){
View Full Code Here

    /**
     * We reset the Rules Directory after we have modified the XML used to
     * define the Rules Directory.
     */
    public void reset (){
        RulesDirectory rd = new RulesDirectory(path,rulesDirectoryXML);
        this.ruleSet = rd.getRuleSet(ruleset);
    }
View Full Code Here

            InputStream    inDTStream   = new FileInputStream(ruleSet.getFilepath()+"/"+UDTFilename);
            OutputStream   outDTStream  = new FileOutputStream(ruleSet.getFilepath()+"/"+ruleSet.getDT_XMLName());
           
            dtcompiler.compile(inDTStream, outDTStream);
                       
            RulesDirectory  rd  = new RulesDirectory(path, rulesDirectoryXML);
            RuleSet         rs  = rd.getRuleSet(RName.getRName(ruleset));
            EntityFactory   ef  = rs.newSession().getEntityFactory();
            IREntity        dt  = ef.getDecisiontables();
            Iterator<RName> idt = ef.getDecisionTableRNameIterator();
           
            while(idt.hasNext()){
                RDecisionTable t = (RDecisionTable) dt.get(idt.next());
                t.build(session.getState());
                List<IDecisionTableError> errs = t.compile();
                for (IDecisionTableError error : errs){
                    dtcompiler.logError(
                            t.getName().stringValue(),
                            t.getFilename(),
                            "validity check",
                            error.getMessage(),
                            0,
                            "In the "+error.getErrorType().name()+" row "+error.getIndex()+"\r\n"+error.getSource());
                }
                Coordinate err_RowCol = t.validate();
                if(!t.isCompiled()  || err_RowCol!=null){
                    int column = 0;
                    int row    = 0;
                    if(err_RowCol!=null){
                        row    = err_RowCol.getRow();
                        column = err_RowCol.getCol();
                    }
                    dtcompiler.logError(
                            t.getName().stringValue(),
                            t.getFilename(),
                            "validity check",
                            "Decision Table did not compile",
                            0,
                            "A problem may have been found on row "+row+" and column "+column);
                }
            }
           
            dtcompiler.printErrors(err, NumErrorsToReport);
            err.println("Total Errors Found: "+dtcompiler.getErrors().size());
            if(dtcompiler.getErrors().size() == 0){
                rd  = new RulesDirectory(path, rulesDirectoryXML);
                rs  = rd.getRuleSet(RName.getRName(ruleset));
                PrintStream btables = new PrintStream(rs.getWorkingdirectory()+"balanced.txt");
                rs.newSession().printBalancedTables(btables);
                RulesAdminService admin = new RulesAdminService(rs.newSession(),rd);
                List tables = admin.getDecisionTables(rs.getName());
                for(Object table : tables){
View Full Code Here

    trace.load(tracefile);
    trace.print();
   
    TraceNode t = trace.find(250);
   
    RulesDirectory rd = new RulesDirectory(
        System.getProperty("user.dir")+"/../sampleprojects/CHIP/", "DTRules.xml");
   
    RuleSet rs = rd.getRuleSet("CHIP");
   
    IRSession s = trace.setState(rs, t);
 
    List<IREntity> entities = trace.instancesOf("client");
   
View Full Code Here

TOP

Related Classes of com.dtrules.session.RulesDirectory

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.