Package org.dmd.util.exceptions

Examples of org.dmd.util.exceptions.ResultException


  }
 
  public void addItem(RunContextItem rci) throws ResultException{
    RunContextItem existing = byName.get(rci.getItemName().getNameString());
    if (existing != null){
      ResultException ex = new ResultException();
      ex.addError("Clashing run context item name: " + rci.getItemName());
      ex.result.lastResult().moreMessages("Originally defined in module: " + existing.getDefinedInModule().getModuleName());
      ex.result.lastResult().moreMessages("Redefined in module: " + rci.getDefinedInModule().getModuleName());
      throw(ex);
    }
    byName.put(rci.getItemName().getNameString(), rci);
View Full Code Here


      if (classDefs.get(objClass) != null) {
        DebugInfo.debug("HAVE A RULE INSTANCE");
        ruleInstances.add(obj);
        return;
      } else {
        ResultException ex = new ResultException("No name for object: "
            + objClass);
        ex.result.lastResult().lineNumber(obj.lineNumber);
        throw (ex);
      }
    }

    if (objClass.equals("TypeDefinition")) {
      typeDefs.put(name, obj);
      origOrderTypes.add(name);
    } else if (objClass.equals("EnumDefinition")) {
      enumDefs.put(name, obj);
      origOrderEnums.add(name);
    } else if (objClass.equals("AttributeDefinition")) {
      attributeDefs.put(name, obj);
      origOrderAttrs.add(name);

      String designatedNameAttribute = obj
          .getSV("designatedNameAttribute");
      String designatedFilterAttribute = obj
          .getSV("designatedFilterAttribute");
      if (designatedNameAttribute != null) {
        String type = obj.getSV("type");

        DmcUncheckedObject typeDef = typeDefs.get(type);

        typeDef.addValue("nameAttributeDef", name);

        // DebugInfo.debug("\n" + typeDef.toOIF(15));
      }
      if (designatedFilterAttribute != null) {
        String type = obj.getSV("type");

        DmcUncheckedObject typeDef = typeDefs.get(type);

        typeDef.addValue("filterAttributeDef", name);

        // DebugInfo.debug("\n" + typeDef.toOIF(15));
      }
    } else if (objClass.equals("ClassDefinition")) {
      classDefs.put(name, obj);
      origOrderClasses.add(name);
    } else if (objClass.equals("ComplexTypeDefinition")) {
      complexTypeDefs.put(name, obj);
      origOrderComplexTypes.add(name);
    } else if (objClass.equals("AttributeValidatorDefinition")) {
      avDefs.put(name, obj);
      origOrderAVDs.add(name);
    } else if (objClass.equals("ObjectValidatorDefinition")) {
      ovDefs.put(name, obj);
      origOrderOVDs.add(name);
    } else if (objClass.equals("RuleDefinition")) {
      ruleDefs.put(name, obj);
      origOrderRules.add(name);
      createClassDefForRuleDef(obj);
    } else if (objClass.equals("RuleCategory")) {
      ruleCategoryDefs.put(name, obj);
      origOrderCategories.add(name);
    } else {
      ResultException ex = new ResultException(
          "Unknown definition type: " + objClass);
      ex.result.lastResult().lineNumber(obj.lineNumber);
    }

    allDefs.put(name, obj);
View Full Code Here

    for (String enumValName : al) {
      EnumValue ev = new EnumValue(enumValName);

      if (byId.get(ev.getId()) != null) {
        ResultException ex = new ResultException();
        ex.addError("Duplicate enum id: " + ev.getId());
        ex.result.lastResult().lineNumber(enumObj.lineNumber);
        throw (ex);
      }
      byId.put(ev.getId(), ev);

      if (byName.get(ev.getName()) != null) {
        ResultException ex = new ResultException();
        ex.addError("Duplicate enum name: " + ev.getName());
        ex.result.lastResult().lineNumber(enumObj.lineNumber);
        throw (ex);
      }
      byName.put(ev.getName(), ev);
    }
View Full Code Here

        multiValued = false;
        isReference = false;
        isEnumType = false;

        if (attrDef == null) {
          ResultException ex = new ResultException();
          ex.addError("Unknown attribute: " + attrName);
          ex.result.lastResult().fileName("metaSchema.dms");
          ex.result.lastResult().lineNumber(obj.lineNumber);
          throw (ex);
        }
View Full Code Here

            // its javaClass
            // as the base class
            DmcUncheckedObject bc = classDefs.get(derivedFrom);

            if (bc == null) {
              ResultException ex = new ResultException();
              ex.addError("Unknown base class: " + derivedFrom
                  + " for class: " + cn);
              ex.result.lastResult().lineNumber(go.lineNumber);
              throw (ex);
            }
            baseClass = bc.getSV("javaClass");
View Full Code Here

            // its javaClass
            // as the base class
            DmcUncheckedObject bc = classDefs.get(derivedFrom);

            if (bc == null) {
              ResultException ex = new ResultException();
              ex.addError("Unknown base class: " + derivedFrom
                  + " for class: " + cn);
              ex.result.lastResult().lineNumber(go.lineNumber);
              throw (ex);
            }
View Full Code Here

    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

    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

    // 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

    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

TOP

Related Classes of org.dmd.util.exceptions.ResultException

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.