Examples of ResultException


Examples of org.dmd.util.exceptions.ResultException

    DmcUncheckedObject attributeDef = attributeDefs.get(attrname);
    String typeName = attributeDef.getSV("type");
    boolean isObjREF = false;

    if (typeName == null) {
      ResultException ex = new ResultException();
      ex.addError("No type specified for attribute: " + attrname);
      ex.result.lastResult().lineNumber(attributeDef.lineNumber);
      throw (ex);
    }

    DmcUncheckedObject typeDef = typeDefs.get(typeName);

    // If we can't find this as a type def, look for it as an enum def
    if (typeDef == null) {
      typeDef = enumDefs.get(typeName);
    }

    // Or, look for it as a class - it may be a reference
    if (typeDef == null) {
      typeDef = classDefs.get(typeName);
      if (typeDef != null)
        ;
      isObjREF = true;
    }

    if (typeDef == null) {
      ResultException ex = new ResultException();
      ex.addError("Unknown type: " + typeName + " for attribute: "
          + attrname);
      ex.result.lastResult().lineNumber(attributeDef.lineNumber);
      throw (ex);
    }
View Full Code Here

Examples of org.dmd.util.exceptions.ResultException

    DmcUncheckedObject attributeDef = attributeDefs.get(attrname);
    String typeName = attributeDef.getSV("type");
    boolean isObjREF = false;

    if (typeName == null) {
      ResultException ex = new ResultException();
      ex.addError("No type specified for attribute: " + attrname);
      ex.result.lastResult().lineNumber(attributeDef.lineNumber);
      throw (ex);
    }

    DmcUncheckedObject typeDef = typeDefs.get(typeName);

    // If we can't find this as a type def, look for it as an enum def
    if (typeDef == null) {
      typeDef = enumDefs.get(typeName);
    }

    // Or, look for it as a class - it may be a reference
    if (typeDef == null) {
      typeDef = classDefs.get(typeName);
      if (typeDef != null)
        isObjREF = true;
    }

    if (typeDef == null) {
      ResultException ex = new ResultException();
      ex.addError("Unknown type: " + typeName + " for attribute: "
          + attrname);
      ex.result.lastResult().lineNumber(attributeDef.lineNumber);
      throw (ex);
    }
View Full Code Here

Examples of org.dmd.util.exceptions.ResultException

    // Write the attribute access functions
    for (String attrname : atlist) {
      DmcUncheckedObject attrdef = attributeDefs.get(attrname);
      if (attrdef == null) {
        ResultException ex = new ResultException();
        ex.addError("Unknown attribute: " + attrname);
        throw (ex);
      }
      if (isEnumAttribute(attrdef)) {
        rc = true;
        break;
View Full Code Here

Examples of org.dmd.util.exceptions.ResultException

    DmcObject      dmo  = null;
    ClassDefinition    cd  = null;
    AttributeDefinition  ad  = null;
   
    if ((cd = schema.isClass((String)uco.classes.get(0))) == null){
          ResultException ex = new ResultException();
            ex.result.addResult(Result.ERROR,"Unknown class: " + uco.classes.get(0));
            throw(ex);
    }
   
//    DebugInfo.debug(uco.toOIF(15));
   
    dmo = cd.newDMOInstance();
   
    // Add the object class
    DmcTypeClassDefinitionREFMV cref = new DmcTypeClassDefinitionREFMV();
    cref.add(cd.getObjectName());
   
    dmo.add(DmcObject.__objectClass, cref);
   
    // And add any auxiliary classes if we have them
    for(int i=1; i<uco.classes.size(); i++){
      if ((cd = schema.isClass((String)uco.classes.get(i))) == null){
            ResultException ex = new ResultException();
              ex.result.addResult(Result.ERROR,"Unknown class: " + uco.classes.get(i));
              throw(ex);
      }
      cref.add(cd.getObjectName());
      dmo.add("objectClass", cref);
    }
   
    Iterator<String> names = uco.getAttributeNames();
    while(names.hasNext()){
      String n = names.next();
      ad = schema.adef(n);
     
      if (ad == null){
            ResultException ex = new ResultException();
              ex.result.addResult(Result.ERROR,"Unknown attribute: " + n);
              throw(ex);
      }
     
      DmcAttributeInfo ai = dmo.getAttributeInfo(n);
View Full Code Here

Examples of org.dmd.util.exceptions.ResultException

       
        for(String cname: categories){
          DmcUncheckedObject category = ruleCategoryDefs.get(cname);
         
          if (category == null){
            ResultException ex = new ResultException("Unknown rule category: " + cname);
            throw(ex);
          }
         
          String categoryID = category.getSV("ruleCategoryID");
          categoryInit.append("            categories.add(" + categoryID + ");\n");
View Full Code Here

Examples of org.dmd.util.exceptions.ResultException

    dumpAutoTester(sm, sd, gendir, context);
  }

  void dumpAutoTester(SchemaManager sm, SchemaDefinition sd, String gendir, OperationalContextEnum context) throws ResultException {
    String genpackage = sd.getSchemaPackage() + ".generated.rulesdmo";
    ResultException  ex = null;
   
    for(RuleDefinition rd : sd.getRuleDefinitionList()){
      if (context == OperationalContextEnum.DMO){
        // Skip full java rules if we're generating for the DMO context
        if (!rd.isDMOCompliant())
          continue;
      }
      else{
        if (rd.isDMOCompliant())
          continue;
      }
     
      try {
        @SuppressWarnings("unused")
        Class<?>  ruleClass = Class.forName(rd.getRuleDefinitionImport());
      } catch (ClassNotFoundException e) {
        if (ex == null)
          ex = new ResultException();
        ex.addError("You must create a rule implementation class: " + rd.getRuleDefinitionImport());
        ex.result.lastResult().moreMessages("It must extend " + genpackage + "." + rd.getName() + "BaseImpl");
      }
    }
   
    if (ex != null)
View Full Code Here

Examples of org.dmd.util.exceptions.ResultException

          dumpAUX(cd, auxwdir);
        }
        else
         
          if (cd.getJavaClass() == null){
            ResultException ex = new ResultException();
            ex.addError("The " + cd.getName() + " class must define the javaClass attribute to facilitate wrapper creation.");
            ex.result.lastResult().fileName(cd.getFile());
            ex.result.lastResult().lineNumber(cd.getLineNumber());
            throw(ex);
          }
         
View Full Code Here

Examples of org.dmd.util.exceptions.ResultException

      while(cdefs.hasNext()){
        ClassDefinition cd = cdefs.next();
        cd.adjustJavaClass();
       
        if (cd.getDMWPackage() == null){
          ResultException ex = new ResultException();
          ex.addError("The " + cd.getDefinedIn().getName() + " schema must define the dmwPackage attribute to facilitate wrapper creation.");
          ex.result.lastResult().fileName(cd.getDefinedIn().getFile());
          throw(ex);
        }
       
        if (cd.getClassType() == ClassTypeEnum.AUXILIARY){
          dumpAUX(cd, auxwdir);
        }
        else
         
          if (cd.getJavaClass() == null){
            ResultException ex = new ResultException();
            ex.addError("The " + cd.getName() + " class must define the javaClass attribute to facilitate wrapper creation.");
            ex.result.lastResult().fileName(cd.getFile());
            ex.result.lastResult().lineNumber(cd.getLineNumber());
            throw(ex);
          }
         
View Full Code Here

Examples of org.dmd.util.exceptions.ResultException

                                // Trim the attribute name and leading spaces
                                attrVal.delete(0,attrName.length());
                                if (attrVal.length() == 0){
                                // We have a missing token value
                                ResultException ex = new ResultException();
                                ex.addError("No value for attribute: " + attrName);
                                ex.setLocationInfo(fileName, in.getLineNumber());
                                throw(ex);
                                }
                                while(attrVal.charAt(0) == ' '){
                                    attrVal.delete(0,1);
                                }
                            }
                        }
                    }
                    else{
                        if (uco != null){
                            // We have a blank line which means we've reached the end of an object - pass off
                            // the current object for processing
                            inObject = false;

                            // Tack on the last attribute
                            if (attrName != null){
                                val = attrVal.toString().trim();
                               
                              if (preserveNL.get(attrName) != null)
                                val = val.replaceAll("\n", "\\\\n");
                             
                                uco.addValue(attrName,new String(val));
                            }

                            try{
                              handler.handleObject(uco,fn, in.getLineNumber());
                            }
                            catch(ResultException ex){
//                              DebugInfo.debug(ex.toString());
                             
                              // If this is the first exception, just hang on to it - we may
                              // wind up adding to it later. Otherwise, just append the results
                              // to our existing exception.
                              if (exG == null)
                                exG = ex;
                              else
                                exG.result.addResults(ex.result);
                             
                              if (exG.result.worst() == Result.FATAL){
                                uco = null;
                                break;
                              }
                             
                                if (allowedErrorsV == -1){
                                    // Couldn't care less about errors! Just go merrily on our way.
                                }
                                else if ((allowedErrorsV == 0) && (exG.result.errors() > 0)){
                                    // Couldn't allow errors - let's bail
                                    uco = null;
                                    break;
                                }
                                else if (exG.result.errors() >= allowedErrorsV){
                                    // We've reached the limits of our patience
                                    uco = null;
                                    break;
                                }

                            }

                            // Reset our object and go on for the next one
                            uco = null;
                        }
                    }
                }

                lastLine = in.getLineNumber();
            }
            in.close();
        }
        catch (IOException e) {
          if (exG == null)
            exG = new ResultException();
         
            exG.result.addResult(Result.FATAL,e.toString());
            exG.result.lastResult().moreMessages("Occurred while reading file: " + fileName);
            uco = null;
        }
View Full Code Here

Examples of org.dmd.util.exceptions.ResultException

          parseObject(input, index, basic);
          wantEndCurly = true;
        }
        else{
          // ERROR Expecting {
          ResultException ex = new ResultException();
          ex.addError("Expecting opening bracket for object.");
          throw(ex);
        }
      }
      else if (wantEndCurly){
        eatWhiteSpace(input, index, "end bracket for object");
       
        if (input.charAt(index.intValue()) == '}'){
          // This should be the last character, if not, we have extraneous stuff - and, because
          // we trimmed the string at the beginning of the process, we know that there's not
          // just whitespace there.
          if ( (input.length()-1) != index.intValue()){
            // ERROR extraneous stuff
            ResultException ex = new ResultException();
            ex.addError("Extraneous characters after object.");
            throw(ex);
          }
         
          // Set this so that we know we were terminated properly
          wantEndCurly = false;
        }
        else{
          // ERROR Expecting }
          ResultException ex = new ResultException();
          ex.addError("Expecting closing bracket for object.");
          throw(ex);
        }
      }
    }
   
   
   
//    // If there were no objects, that's an error too
//    if (objects.size() == 0){
//      // ERROR no objects
//    }
   
    if (wantEndCurly){
      // ERROR: We're missing the end curly brace
      ResultException ex = new ResultException();
      ex.addError("Closing bracket missing.");
      throw(ex);
    }
   
    return(basic);
   
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.