Examples of HierarchicObject


Examples of org.dmd.dmr.server.base.extended.HierarchicObject

  @Override
  public void handleObject(DmcUncheckedObject uco, String infile, int lineNumber) throws ResultException, DmcValueException {
    DmcHierarchicObjectName      fqn      = null;
    DmcHierarchicObjectName      parentFqn  = null;
    HierarchicObject   newEntry   = null;
    HierarchicObject   parentEntry  = null;
    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
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.