Package com.dtrules.infrastructure

Examples of com.dtrules.infrastructure.RulesException


        }
        try {
            double v = Double.parseDouble(s);
            return v;
        } catch (NumberFormatException e) {
            throw new RulesException("Conversion Error","RDouble.getDoubleValue()","Could not covert the string '"+s+"' to a double: "+e.getMessage());
        }
    }
View Full Code Here


    public Class getDefaultCompiler() throws RulesException {
      if(defaultCompiler == null){
        try{
          defaultCompiler = (Class<ICompiler>)Class.forName("com.dtrules.compiler.el.EL");
        }catch(ClassNotFoundException e){
          throw new RulesException(
              "undefined",
              "Rules Engine Initiation",
              "Could not find the default DTRules compiler: com.dtrules.compiler.el.EL");
        }
      }
View Full Code Here

              }else if (tag.equals("entryPoint")){
                  entryPoint = null;
              }else if (tag.equals("decisionTable")){
                  String table = body.trim();
                  if(table==null){
                      throw new RulesException("undefined", "LoadDirectory",
                              "The Decisiontable '"+body+"' is not defined in the" +
                              " ruleset '"+currentset.getName());
                  }
                  currentset.entrypoints.put(entryPoint, table);
              }else if (tag.equals("entity")){
                  String entity = body.trim();
                  if(entity == null){
                      throw new RulesException("undefined", "LoadDirectory",
                                "The Entity '"+body+"' is not defined in the" +
                                " ruleset '"+currentset.getName());
                  }
                  List<String> entities = currentset.contexts.get(entryPoint);
                  if(entities == null){
View Full Code Here

     * @throws RulesException
     */
    public IRObject get(int index) throws RulesException{
      uncache();
      if(index<0 || index>= array.size()){
            throw new RulesException("Undefined","RArray","Index out of bounds");
      }
      return (IRObject) array.get(index);
    }
View Full Code Here

      }else{
          try{
           obj.execute(state);
          }catch(ConcurrentModificationException e){
             String ps = generatePostfix(cnt);
             RulesException re = new RulesException("access error",array.get(cnt).postFix(),e.toString()+"\r\n"+
                 "This happens generally when you have attempted to modify an array\r\n "+
                 "which is in the context because you are iterating over its contents\r\n"+
                 "with a ForAll operator."+
                 "");
             re.setPostfix(ps);
             throw re;
          }catch(RuntimeException e){
             String ps = generatePostfix(cnt);
             RulesException re = new RulesException("runtime error","RArray",e.toString());
             re.setPostfix(ps);
             throw re;
          }catch(RulesException e){
             String ps = generatePostfix(cnt);
             e.setPostfix(ps);
             throw e;
View Full Code Here

           
            if(mapfilename != null){
                mapStream = openfile(mapfilename);
            }
            if(mapStream==null){
                throw new RulesException("undefined", "getAutoDataMapDef()",
                        "The mapping '"+name+"' is undefined");
            }
           
            AutoDataMapDef admd = new AutoDataMapDef();
            admd.configure(mapStream);
View Full Code Here

                        int    numhld  = state.getNumberInSection();
                        state.setCurrentTableSection("Action",num);
                        state.evaluate(v);
                        state.setCurrentTableSection(section, numhld);
                        if(d!=state.ddepth()){
                            throw new RulesException("data stack unbalanced","ANode Execute","Action "+(num+1)+" in table "+dtable.getDtname());
                        }
                    state.traceTagEnd();
                }
            }else{
                for(IRObject v : action){
                    num = inum.next().intValue();
                    String section = state.getCurrentTableSection();
                    int    numhld  = state.getNumberInSection();
                    state.setCurrentTableSection("Action",num);
                    state.evaluate(v);
                    state.setCurrentTableSection(section, numhld);
               
            }
        } catch (RulesException e) {
            boolean first = e.isFirstAction();
            if(state.testState(DTState.TRACE)){
                if(first){
                    state.traceInfo("Error_Detected",null);
                }
                state.traceTagEnd();
            }
            e.setSection("Action",num+1);
            e.setFormal(dtable.getActions()[num]);
            throw e;
        } catch (Exception e){
            RulesException re = new RulesException(e.getClass().getName(), e.getStackTrace()[0].getClassName(), e.getMessage());
            re.isFirstAction(); /** Just so we note that this is the first action */
            if(state.testState(DTState.TRACE)){
                state.traceInfo("Error_Detected",null);
                state.traceTagEnd();
            }
            re.setSection("Action",num+1);
            re.setFormal(dtable.getActions()[num]);
            throw re;
        }


        if(state.testState(DTState.TRACE)){
View Full Code Here

            }else if (_body.equalsIgnoreCase("all")){
                dt.setType(RDecisionTable.Type.ALL);
            }else if (_body.equalsIgnoreCase("balanced")){
                dt.setType(RDecisionTable.Type.BALANCED);
            }else {
                throw new RulesException("Invalid","Decision Table Load","Bad Decision Table type Encountered: '"+_body+"'");
            }
    }   
    }
View Full Code Here

            }
            e.setSection("Condition",conditionNumber+1);
            e.setFormal(dtable.getConditions()[conditionNumber]);
            throw e;
        } catch (Exception e){
            RulesException re = new RulesException(e.getClass().getName(), e.getStackTrace()[0].getClassName(), e.getMessage());
            re.isFirstAction()// Avoids a bogus "first action"
            if(state.testState(DTState.TRACE)){
                state.traceTagEnd();
                state.traceInfo("result", "v", "ERROR",null);
                state.traceTagEnd();
            }
            re.setSection("Condition",conditionNumber+1);
            re.setFormal(dtable.getConditions()[conditionNumber]);
            throw re;
        }

        if(result){
            iftrue.execute(state);
View Full Code Here

      state.popframe();
     
      if(estk!= state.edepth() ||
         dstk!= state.ddepth() ||
         cstk!= state.cdepth() ){
          throw new RulesException("Stacks Not balanced","DecisionTables",
          "Error while executing table: "+getName().stringValue() +"\n" +
           (estk!= state.edepth() ? "Entity Stack before  "+estk+" after "+state.edepth()+"\n":"")+
           (dstk!= state.ddepth() ? "Data Stack before    "+dstk+" after "+state.ddepth()+"\n":"")+
           (cstk!= state.cdepth() ? "Control Stack before "+cstk+" after "+state.cdepth()+"\n":""));
      }
View Full Code Here

TOP

Related Classes of com.dtrules.infrastructure.RulesException

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.