Package org.dmd.util.exceptions

Examples of org.dmd.util.exceptions.ResultException


   
    objName = obj.getSV("ruleName") + "Data";
   
    cd = sm.isClass(obj.getConstructionClass());
    if (cd == null){
      ResultException ex = new ResultException();
      ex.addError("Unknown rule data class: \n" + obj.toOIF());
      throw(ex);
    }
   
//    if (cd.getClassType() == ClassTypeEnum.EXTENSIBLE){
//      DebugInfo.debug("DmoCompactSchemaFormatter.setAttributeValues() " + cd.getName() + " is extensible");
//    }
   
    Iterator<String> attributeNames = obj.getAttributeNames();
    while(attributeNames.hasNext()){
      NamedStringArray attr = obj.get(attributeNames.next());
      attrName = attr.getName();
      if (attrName == null){
        DebugInfo.debugWithTrace("Attr name null");
        continue;
      }
      attrDef  = sm.isAttribute(attrName);
     
      if (attrDef == null){
        ResultException ex = new ResultException();
        ex.addError("Unknown attribute: " + attrName);
        ex.result.lastResult().fileName(obj.getSV(MetaDMSAG.__file.name));
        ex.result.lastResult().lineNumber(obj.lineNumber);
        throw(ex);
      }
     
View Full Code Here


  public void handleObject(DmcUncheckedObject uco, String infile, int lineNumber) throws ResultException, DmcValueException {
   
    try {
      theConfig = (DmgConfigDMO) factory.createObject(uco);
    } catch (ClassNotFoundException e) {
      ResultException ex = new ResultException();
      ex.addError(e.getMessage());
      ex.result.lastResult().moreMessages(DebugInfo.extractTheStack(e));
      throw(ex);
    }
   
    System.out.println("\nRead: " + infile);
View Full Code Here

    public void setParentObject(HierarchicObject p, boolean buildFQN) throws ResultException, DmcValueException {
      AttributeDefinitionDMW   naAD     = LDAPClassAUX.getNamingAttribute(this.getConstructionClass());
        DmcAttribute<?>     nameAttr    = core.get(naAD.getDmdID());
       
        if (nameAttr == null){
          ResultException ex = new ResultException();
          ex.addError("Missing value for naming attribute: " + naAD.getName());
          throw(ex);
        }
       
//      DmcObjectNameIF  naAttr = (DmcObjectNameIF) nameAttr.getSV();
       
        if ( (p != null) && (p.getFQN() == null)){
          // The parent hasn't been properly initialized
          ResultException ex = new ResultException();
          ex.addErrorWithStack("The object being set as the parent hasn't been properly initialized. Ensure that its setParentObject() function has been called.",DebugInfo.getCurrentStack());
          throw(ex);
        }
       
      parent = p;
     
View Full Code Here

    public void resetParent(HierarchicObject newParent) throws ResultException, DmcValueException {
      AttributeDefinitionDMW naAD = LDAPClassAUX.getNamingAttribute(this.getConstructionClass());
        DmcAttribute<?>   nameAttr  = core.get(naAD.getDmdID());
       
        if (nameAttr == null){
          ResultException ex = new ResultException();
          ex.addError("Missing value for naming attribute: " + naAD.getName());
          throw(ex);
        }

//        DmcObjectNameIF  naAttr = (DmcObjectNameIF) nameAttr.getSV();
View Full Code Here

  public String getRepositoryID() throws ResultException {
    if (repositoryID == null){
        AttributeDefinitionDMW naAD = LDAPClassAUX.getNamingAttribute(this.getConstructionClass());
          DmcAttribute<?>   nameAttr  = core.get(naAD.getName().getNameString());
          if (nameAttr == null){
            ResultException ex = new ResultException();
            ex.addError("Missing value for naming attribute: " + naAD.getName());
            throw(ex);
          }

          DmcObjectNameIF  naAttr = (DmcObjectNameIF) nameAttr.getSV();
         
View Full Code Here

//          LDAPClassAUX.addAux(def);
        }
       
        // It's persistent, it should have a naming attribute
        if (LDAPClassAUXDMO.getNamingAttribute(def.getDmcObject()) == null){
          ResultException ex = new ResultException();
          ex.addError("The " + def.getName() + " class has the LDAPClassAUX extension but doesn't specify a namingAttribute.");
          ex.setLocationInfo(def.getFile(), def.getLineNumber());
          throw(ex);
        }
      }
//      }
    }
View Full Code Here

    if (payAttention){
      // We have the aux class, so we should have the prefix
      ldapIdPrefix = LDAPSchemaAUX.getLdapIdPrefix(sd);
     
      if (ldapIdPrefix == null){
        ResultException ex = new ResultException();
        ex.addError("The " + sd.getName() + " schema has the LDAPSchemaAUX extension but doesn't specify the ldapIdPrefix attribute.");
        ex.setLocationInfo(sd.getFile(), 0);
        throw(ex);
      }
    }
    else{
      // One other check to perform - if someone has specified the LDAPSchemaExtension
      // but forgot to add the LDAPSchemaAUX, we'll remind them
      Iterator<String> extList = sd.getSchemaExtension();
      if (extList != null){
        while(extList.hasNext()){
          if (extList.next().equals("org.dmd.dmr.server.ldap.util.LDAPSchemaExtension")){
            ResultException ex = new ResultException();
            ex.addError("The " + sd.getName() + " schema specifies the LDAPSchemaExtension but doesn't have the LDAPSchemaAUX class.");
            ex.result.lastResult().moreMessages("You must decorate the SchemaDefinition with LDAPSchemaAUX and specify the ldapIdPrefix.");
            ex.setLocationInfo(sd.getFile(), 0);
            throw(ex);
          }
        }
      }
    }
View Full Code Here

   
    return(root);
  }
 
  void resolveReferences() throws ResultException {
    ResultException  errors  = null;
   
    for(HierarchicObject ho : loadedObjects){
      try {
//        ho.resolveReferences(schema, this);
        ho.resolveReferences(this);
      } catch (DmcValueExceptionSet e) {
        if (errors == null)
          errors = new ResultException();
       
        errors.addError("Couldn't resolve references in object: " + " " + ho.getName());
        errors.setLocationInfo(ho.getFile(), ho.getLineNumber());
       
        for(DmcValueException dve : e.getExceptions()){
          errors.moreMessages(dve.getMessage());
        }
       
      }
    }
   
View Full Code Here

    HierarchicObject   currObj   = null;
   
    try {
      currObj = (HierarchicObject) factory.createWrapper(uco);
    } catch (ClassNotFoundException e) {
      ResultException ex = new ResultException("Unknown object class: " + uco.classes.get(0));
      ex.result.lastResult().fileName(infile);
      ex.result.lastResult().lineNumber(lineNumber);
      throw(ex);
    }
    catch (ResultException ex){
      ex.setLocationInfo(infile, lineNumber);
      throw(ex);
    }
   
    currObj.setLineNumber(lineNumber);
    currObj.setFile(infile);

    if (currObj.getFQN() == null){
      ResultException ex = new ResultException();
      ex.addError("Missing FQN for object.");
      ex.setLocationInfo(currObj.getFile(), currObj.getLineNumber());
      throw(ex);
    }
   
    fqn = currObj.getFQN();
   
    if (currObj.getFQN().getParentName() != null)
      parentFqn = currObj.getFQN().getParentName();
   
    if (parentFqn == null){
      if (root == null){
        root = currObj;
        root.setParentObject(null);
       
        keyMap.put(fqn,root);
      }
      else{
        // The only time that parent should be null is when we're dealing with the
        // root object - otherwise, it's an error
        ResultException ex = new ResultException();
        ex.addError("Missing parent for object:" + fqn);
        ex.setLocationInfo(currObj.getFile(), currObj.getLineNumber());
        throw(ex);
      }
    }
    else{
      if (keyMap.get(fqn) == null){
        parentEntry = keyMap.get(parentFqn);
     
        if (parentEntry == null){
          ResultException ex = new ResultException();
          ex.addError("Missing parent: " + parentFqn + " for object: " + fqn);
          ex.setLocationInfo(currObj.getFile(), currObj.getLineNumber());
          throw(ex);
        }
        else{
          newEntry = currObj;
          newEntry.setParentObject(parentEntry);
         
          keyMap.put(fqn, newEntry);
        }
      }
      else{
        ResultException ex = new ResultException();
        ex.addError("Duplicate fqn: " + fqn);
        ex.setLocationInfo(currObj.getFile(), currObj.getLineNumber());
        throw(ex);
      }
   
      System.out.println("HierarchyParser read:\n" + newEntry.getFQN());
    }
View Full Code Here

      if (cd.getIsNamedBy() != null){
        AttributeDefinition isNamedBy = cd.getIsNamedBy();
        String nameAttributeType = isNamedBy.getType().getPrimitiveType();
       
        if (nameAttributeType == null){
          ResultException ex = new ResultException("Naming attribute for class " + cd.getName() + " must be a complex type.");
          ex.result.lastResult().moreMessages("Check the type of attribute " + isNamedBy.getName().getNameString());
          ex.result.lastResult().fileName(isNamedBy.getFile());
          ex.result.lastResult().lineNumber(isNamedBy.getLineNumber());
          throw(ex);
        }
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.