Examples of ResultException


Examples of org.dmd.util.exceptions.ResultException

    Class<?>   ruleClass   = null;
   
    try {
      ruleClass = Class.forName(this.getRuleDefinitionImport());
    } catch (ClassNotFoundException e) {
          ResultException ex = new ResultException();
          ex.result.addResult(Result.FATAL,"Couldn't load Java class: " + this.getRuleDefinitionImport());
          ex.result.lastResult().moreMessages(DebugInfo.getCurrentStack());
          throw(ex);
    }

        try{
            rc = (RuleIF) ruleClass.newInstance();
        }
        catch(Exception e){
          ResultException ex = new ResultException();
          ex.result.addResult(Result.FATAL,"Couldn't instantiate Java class: " + this.getRuleDefinitionImport());
          ex.result.lastResult().moreMessages("This may be because the class doesn't have a constructor that takes no arguments.");
          ex.result.lastResult().moreMessages(DebugInfo.getCurrentStack());
          throw(ex);
        }
View Full Code Here

Examples of org.dmd.util.exceptions.ResultException

      else if (def instanceof ComplexTypeDefinition)
        this.addComplexTypeDefList((ComplexTypeDefinition) def);
      else if (def instanceof RuleDefinition)
        this.addRuleDefinitionList((RuleDefinition)def);
        else{
          ResultException ex = new ResultException();
          ex.addError("The specified object is not a DMD object: \n" + def.toOIF());
          throw(ex);
        }
    }
View Full Code Here

Examples of org.dmd.util.exceptions.ResultException

   
    public void addParsedRule(DmcUncheckedObject uco) throws ResultException, DmcValueException {
      String ruleName = uco.getSV("ruleName");
     
      if (ruleName == null){
        ResultException ex = new ResultException();
        ex.addError("The specified rule instance doesn't have a ruleName: \n" + uco.toOIF());
        throw(ex);
      }
     
      if (parsedRules == null)
        parsedRules = new TreeMap<RuleName, DmcUncheckedObject>();
     
      RuleName rn = new RuleName(ruleName);
     
      DmcUncheckedObject existing = parsedRules.get(rn);
     
      if (existing != null){
        ResultException ex = new ResultException();
        ex.addError("Clashing ruleNames: \n\n" + existing.toOIF() + "\n" + uco.toOIF());
        throw(ex);
      }
     
      parsedRules.put(rn, uco);
    }
View Full Code Here

Examples of org.dmd.util.exceptions.ResultException

//          String ext = extList.next();
                try{
                  extclass = Class.forName(ext);
                }
                catch(Exception e){
                  ResultException ex = new ResultException();
                  ex.result.addResult(Result.FATAL,"Couldn't load schemaExtension class: " + ext);
                    ex.result.lastResult().moreMessages(e.getMessage());
                    ex.result.lastResult().moreMessages(DebugInfo.extractTheStack(e));
                    throw(ex);
                }

                int lastDot = ext.lastIndexOf(".");
                String className = ext.substring(lastDot + 1);
               
                if (extensions.get(className) == null){
                  SchemaExtensionIF extInstance = null;
                  // We don't have the extension yet, try to instantiate it
                    try{
                      extInstance = (SchemaExtensionIF) extclass.newInstance();
                    }
                    catch(Exception e){
                      ResultException ex = new ResultException();
                      ex.result.addResult(Result.FATAL,"Couldn't instantiate Java class: " + ext);
                      ex.result.lastResult().moreMessages("This may be because the class doesn't have a constructor that takes no arguments.");
                      ex.result.lastResult().moreMessages("Or it may be that the class doesn't implement the SchemaExtensionIF interface.");
                      throw(ex);
                    }
View Full Code Here

Examples of org.dmd.util.exceptions.ResultException

       
                try{
                  schemaClass = Class.forName(schemaClassName);
                }
                catch(Exception e){
                  ResultException ex = new ResultException();
                  ex.result.addResult(Result.FATAL,"Couldn't load generated schema class: " + schemaClassName);
                    ex.result.lastResult().moreMessages(e.getMessage());
                    ex.result.lastResult().moreMessages(DebugInfo.extractTheStack(e));
                    throw(ex);
                }

                try{
                  depSchema = (SchemaDefinition) schemaClass.newInstance();
                }
                catch(Exception e){
                  ResultException ex = new ResultException();
                  ex.result.addResult(Result.FATAL,"Couldn't instantiate Java class: " + schemaClassName);
                  ex.result.lastResult().moreMessages("This may be because the class doesn't have a constructor that takes no arguments.");
                  ex.result.lastResult().moreMessages("Or it may be that the class isn't derived from SchemaDefinition.");
                  throw(ex);
                }
View Full Code Here

Examples of org.dmd.util.exceptions.ResultException

     */
    void addSchema(SchemaDefinition sd) throws ResultException, DmcValueException {
        currentSchema = sd;

        if (checkAndAdd(sd.getObjectName(),sd,schemaDefs) == false){
          ResultException ex = new ResultException();
          ex.addError(clashMsg(sd.getObjectName(),sd,schemaDefs,"schema names"));
            currentSchema = null;
          throw(ex);
        }
        if (checkAndAdd(sd.getObjectName(),sd,allDefs) == false){
          ResultException ex = new ResultException();
          ex.addError(clashMsg(sd.getObjectName(),sd,allDefs,"definition names"));
            currentSchema = null;
          throw(ex);
        }

        if (sd.getObjectName().getNameString().length() > longestSchemaName)
View Full Code Here

Examples of org.dmd.util.exceptions.ResultException

     * @throws DmcValueException
     * @throws DmcValueExceptionSet
     */
    void addComplexType(ComplexTypeDefinition ctd) throws ResultException, DmcValueException {
        if (checkAndAdd(ctd.getObjectName(),ctd,complexTypeDefs) == false){
          ResultException ex = new ResultException();
          ex.addError(clashMsg(ctd.getObjectName(),ctd,complexTypeDefs,"complex type names"));
          throw(ex);
        }
       
        TypeDefinition td  = new TypeDefinition();
        td.setInternallyGenerated(true);
View Full Code Here

Examples of org.dmd.util.exceptions.ResultException

     * @throws DmcValueException
     * @throws DmcValueExceptionSet
     */
    void addExtendedReferenceType(ExtendedReferenceTypeDefinition ertd) throws ResultException, DmcValueException {
        if (checkAndAdd(ertd.getObjectName(),ertd,extendedReferenceTypeDefs) == false){
          ResultException ex = new ResultException();
          ex.addError(clashMsg(ertd.getObjectName(),ertd,extendedReferenceTypeDefs,"extended reference type names"));
          throw(ex);
        }
       
        TypeDefinition td  = new TypeDefinition();
        td.setInternallyGenerated(true);
View Full Code Here

Examples of org.dmd.util.exceptions.ResultException

     * @throws DmcValueException
     * @throws DmcValueExceptionSet
     */
    void addSlice(SliceDefinition sd) throws ResultException, DmcValueException {
        if (checkAndAdd(sd.getObjectName(),sd,sliceDefs) == false){
          ResultException ex = new ResultException();
          ex.addError(clashMsg(sd.getObjectName(),sd,sliceDefs,"slice names"));
          throw(ex);
        }
        if (checkAndAdd(sd.getObjectName(),sd,allDefs) == false){
          ResultException ex = new ResultException();
          ex.addError(clashMsg(sd.getObjectName(),sd,allDefs,"definition names"));
            throw(ex);
        }
    }
View Full Code Here

Examples of org.dmd.util.exceptions.ResultException

     * @throws DmcValueException
     * @throws DmcValueExceptionSet
     */
    void addRuleCategory(RuleCategory rc) throws ResultException, DmcValueException {
        if (checkAndAdd(rc.getObjectName(),rc,ruleCategoryDefs) == false){
          ResultException ex = new ResultException();
          ex.addError(clashMsg(rc.getObjectName(),rc,ruleCategoryDefs,"rule categories"));
          throw(ex);
        }
        if (checkAndAdd(rc.getObjectName(),rc,allDefs) == false){
          ResultException ex = new ResultException();
          ex.addError(clashMsg(rc.getObjectName(),rc,allDefs,"definition names"));
            throw(ex);
        }
       
        if (performIDChecks){
          // Bump up the rule category ID by the amount of schemaBaseID
          int base = rc.getDefinedIn().getSchemaBaseID();
          int range = rc.getDefinedIn().getSchemaIDRange();
          int current = rc.getRuleCategoryID();
         
          if (current >= range){
            ResultException ex = new ResultException("Number of rule categories exceeds schema ID range: " + rc.getName());
            throw(ex);         
          }
         
          rc.setRuleCategoryID(base + current);
        }

        if (ruleCategoriesByID.get(rc.getRuleCategoryID()) != null){
          ResultException ex = new ResultException();
          ex.addError(clashMsg(rc.getRuleCategoryID(),rc,ruleCategoriesByID,"ruleCategoryID"));
          throw(ex);       
        }
    }
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.