Package org.dmd.util.exceptions

Examples of org.dmd.util.exceptions.ResultException


    // Grab the string between the quotes
    rc = input.substring(quote1+1,quote2);
   
    // If it's empty, pitch a fit
    if (rc.length() == 0){
      ResultException ex = new ResultException();
      ex.addError("Empty string while trying to parse " + message + " at index: " + index.intValue() + " in input string: " + input);
      throw(ex);
    }
   
    index.set(quote2 + 1);
   
View Full Code Here


   * @param message
   * @return
   */
  private int indexOf(String instr, String substr, int after, String message) throws ResultException {
    if (after >= instr.length()){
      ResultException ex = new ResultException();
      ex.addError("Ran out of input while trying to find: " + substr + "  at offset: " + after + "  in input string: " + instr );
      throw(ex);
    }
   
    int rc = instr.indexOf(substr,after);
   
    if (rc == -1){
      ResultException ex = new ResultException();
      ex.addError(message + instr);
      throw(ex);
    }
   
    return(rc);
  }
View Full Code Here

   */
  public void findConfigs() throws ResultException, IOException {
    debugMessage("Finding configs:\n\n" + getSearchInfo() + "\n");
   
    if (suffixes.size() == 0){
      ResultException ex = new ResultException("You must specify at least one suffix to hunt for using the addSuffix() method");
      throw(ex);
    }
   
    for(String d : sourceDirs)
      findConfigsRecursive(new File(d));
View Full Code Here

          }
        }
      }
    }
    else{
      ResultException ex = new ResultException();
      ex.addError("Specified source directory doesn't exist: " + dir.getCanonicalPath());
      throw(ex);
    }
  }
View Full Code Here

 
  public void addVersion(ConfigLocation newVersion) throws ResultException {
    if (name == null)
      name = newVersion.getConfigName();
    else if (!name.equals(newVersion.getConfigName())){
      ResultException ex = new ResultException("Name mismatch for ConfigVersion.");
      ex.result.lastResult().moreMessages(DebugInfo.getCurrentStack());
      throw(ex);
    }
   
    ConfigLocation existing = versions.get(newVersion.getVersion());
     
    if (existing == null){
      versions.put(newVersion.getVersion(),newVersion);
    }
    else{
      if ( (existing.getJarFilename() != null) && (newVersion.getJarFilename() != null)){
        // Some trickiness here. If we're grabbing stuff from jars, we might have jars
        // where one jar prefix is a substring of another jar e.g. dark-matter-mvw and
        // dark-matter-mvwgxt. We'll wind up parsing dark-matter-mvwgxt twice, so we
        // what to be able to ignore cases where the jar names are equal
        if (existing.getJarFilename().equals(newVersion.getJarFilename()))
          return;
       
        // We may include the same jar from two different paths, so if the jar file names
        // match, we ignore the new one.
        if (existing.getJustJarFilename().equals(newVersion.getJustJarFilename()))
          return;
      }
     
      // We have a clashing version
      ResultException ex = new ResultException("Clashing versions for the " + name + " configuration file.");
      ex.result.lastResult().moreMessages("Originally from: " + existing.getFileName());
      if (existing.getJarFilename() != null)
        ex.result.lastResult().moreMessages("              in .jar: " + existing.getJarFilename());
      ex.result.lastResult().moreMessages("Clashing version from: " + newVersion.getFileName());
      if (newVersion.getJarFilename() != null)
View Full Code Here

    if (refs != null){
      while(refs.hasNext()){
        String ref = refs.next();
        ConfigVersion cv = finder.getConfig(ref);
        if (cv == null){
          ResultException ex = new ResultException();
          ex.addError("MVW config not found: " + ref);
          ex.setLocationInfo(currentModule.getFile(), currentModule.getLineNumber());
          throw(ex);
        }
       
//        DebugInfo.debug("parseConfigInternal()\n\n" + cv.getLatestVersion().toString());
       
View Full Code Here

    MvwDefinition definition = null;
   
    try {
      definition = (MvwDefinition) 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);
    }
    catch(DmcValueException e){
      ResultException ex = new ResultException();
      ex.addError(e.getMessage());
      if (e.getAttributeName() != null)
        ex.result.lastResult().moreMessages("Attribute: " + e.getAttributeName());
      ex.setLocationInfo(infile, lineNumber);
      throw(ex);
    }
   
    definition.setLineNumber(lineNumber);
    definition.setFile(infile);
View Full Code Here

      }
     
      if (controller.isCentralRPCErrorHandler()){
        if (centralRpcErrorHandler != null){
          ResultException ex = new ResultException();
          ex.addError("Multiple controllers are specified as the central RPC error handler.");
          ex.result.lastResult().moreMessages(centralRpcErrorHandler.getControllerName() + " in " + centralRpcErrorHandler.getDefinedInModule().getFile() + " at line " + centralRpcErrorHandler.getDefinedInModule().getLineNumber());
          ex.result.lastResult().moreMessages(controller.getControllerName() + " in " + controller.getDefinedInModule().getFile() + " at line " + controller.getDefinedInModule().getLineNumber());
          throw(ex);
        }
        centralRpcErrorHandler = controller;
      }
      if (controller.isCentralDMPErrorHandler()){
        if (centralDmpErrorHandler != null){
          ResultException ex = new ResultException();
          ex.addError("Multiple controllers are specified as the central DMP error handler.");
          ex.result.lastResult().moreMessages(centralDmpErrorHandler.getControllerName() + " in " + centralDmpErrorHandler.getDefinedInModule().getFile() + " at line " + centralDmpErrorHandler.getDefinedInModule().getLineNumber());
          ex.result.lastResult().moreMessages(controller.getControllerName() + " in " + controller.getDefinedInModule().getFile() + " at line " + controller.getDefinedInModule().getLineNumber());
          throw(ex);
        }
        centralDmpErrorHandler = controller;
      }
      if (controller.isCentralAsyncErrorHandler()){
        if (centralAsyncErrorHandler != null){
          ResultException ex = new ResultException();
          ex.addError("Multiple controllers are specified as the central asynchronous code loading error handler.");
          ex.result.lastResult().moreMessages(centralAsyncErrorHandler.getControllerName() + " in " + centralAsyncErrorHandler.getDefinedInModule().getFile() + " at line " + centralDmpErrorHandler.getDefinedInModule().getLineNumber());
          ex.result.lastResult().moreMessages(controller.getControllerName() + " in " + controller.getDefinedInModule().getFile() + " at line " + controller.getDefinedInModule().getLineNumber());
          throw(ex);
        }
        centralAsyncErrorHandler = controller;
        centralAsyncErrorHandlerRCI = controllerRCI;
//       
//        // We will fill in the details of the predefined place holder context item - defined in the mvw module
//        RunContextItemCollection rcic = contexts.get(controllerRCI.getContextImpl());
//        RunContextItem rci = rcic.getItem("centralAsyncErrorHandler");
//
//        // The construction is just the assignment of the controller to this item
//        rci.setConstruction(controllerRCI.getItemName());
//
//        int order = controllerRCI.getItemOrder() + 1;
//        rci.setItemOrder(order);
       
      }
    }
    else if (def instanceof Presenter){
      Presenter presenter = (Presenter) def;
//      presenter.getDMO().addUsesRunContextItem("eventBus");
      presenters.put(def.getCamelCaseName(), presenter);
      components.put(def.getCamelCaseName(), presenter);
     
      // All Presenters are available for access from the run context. They are created on demand.
      RunContextItem rci = new RunContextItem();
      rci.setAutoCreated(true);
      RunContextItemCollection rcic = contexts.get(rci.getContextImpl());
     
      rci.setItemName(presenter.getPresenterName().getNameString() + "RCI");
      rci.setDescription("The auto generated run context item for the " + presenter.getPresenterName());
     
      if (presenter.getSubpackage() == null)
        rci.setUseClass(currentModule.getGenPackage() + ".extended." + presenter.getPresenterName());
      else
        rci.setUseClass(currentModule.getGenPackage() + ".extended." + presenter.getSubpackage() + "." + presenter.getPresenterName());
       
      if (presenter.usesRunContext()){
        if (presenter.isCodeSplit())
          rci.setConstruction("new " + presenter.getPresenterName() + "(thisContext)");
        else
          rci.setConstruction("new " + presenter.getPresenterName() + "(this)");
      }
      else
        rci.setConstruction("new " + presenter.getPresenterName() + "()");
     
      rci.setDefinedInModule(presenter.getDefinedInModule());
     
      rci.setPresenter(presenter);
     
      if (rcic == null){
        rcic = new RunContextItemCollection(rci.getContextImpl());
        contexts.put(rci.getContextImpl(), rcic);
      }
      rcic.addItem(rci);
     
      // Add the item to its module
      rci.getDefinedInModule().addRunContextItem(rci);
     
      // We make it so that the presenter instance is created as required
      rci.setCreateOnDemand(true);
      rci.setSingleton(presenter.isSingleton());
     
      // Tell the presenter its item
      presenter.setRunContextItem(rci);
     
      // Also add to our full set of definitions
      allDefs.put(rci.getItemName(), rci);
     
    }
    else if (def instanceof Activity){
      Activity activity = (Activity) def;
//      if (activity.getHandlesEventHasValue())
//        activity.getDMO().addUsesRunContextItem("eventBus");
//      if (activity.getFiresEventHasValue())
//        activity.getDMO().addUsesRunContextItem("eventBus");
      activities.put(def.getCamelCaseName(), activity);
      components.put(def.getCamelCaseName(), activity);
    }
    else if (def instanceof View){
      View view = (View) def;
      views.put(def.getCamelCaseName(), view);
     
      if (view.requiresEventBus()){
        view.getDMO().addUsesRunContextItem("eventBus");
      }
     
      // All Views are available for access from the run context. They are created on demand.
      RunContextItem rci = new RunContextItem();
      rci.setAutoCreated(true);
      RunContextItemCollection rcic = contexts.get(rci.getContextImpl());
     
      rci.setItemName(view.getViewName().getNameString() + "RCI");
      rci.setDescription("The auto generated run context item for the " + view.getViewName());
     
      if (view.getSubpackage() == null)
        rci.setUseClass(currentModule.getGenPackage() + ".extended." + view.getViewName());
      else
        rci.setUseClass(currentModule.getGenPackage() + ".extended." + view.getSubpackage() + "." + view.getViewName());
       
      if (view.getUsesRunContextItemHasValue()){
        if (view.isCodeSplit())
          rci.setConstruction("new " + view.getViewName() + "(presenter, thisContext)");
        else
          rci.setConstruction("new " + view.getViewName() + "(presenter, this)");
      }
      else
        rci.setConstruction("new " + view.getViewName() + "(presenter)");

//      // BIG NOTE: we don't specify the arguments to the constructor, this will depend on figuring
//      // out if the component needs run context items. We determine this in the RunContextItem.
//      rci.setConstruction("new " + view.getViewName());
     
     
      // NOTE: in addition to setting the construction mechanism, we also set the view
      // on the context item so that it knows how to create the on demand method that takes
      // the View's presenter.
      rci.setView(view);
      rci.setDefinedInModule(view.getDefinedInModule());
     
      if (rcic == null){
        rcic = new RunContextItemCollection(rci.getContextImpl());
        contexts.put(rci.getContextImpl(), rcic);
      }
      rcic.addItem(rci);
     
      // Add the item to its module
      rci.getDefinedInModule().addRunContextItem(rci);
     
      // We make it so that the view instance is created as required
      rci.setCreateOnDemand(true);
//      rci.setTheOne(view.isTheOne());
     
      // Tell the view its item
      view.setRunContextItem(rci);

    }
    else if (def instanceof Event){
      events.put(def.getCamelCaseName(), (Event) def);
    }
    else if (def instanceof Place){
      places.put(def.getCamelCaseName(), (Place) def);
    }
    else if (def instanceof SubPlace){
      subPlaces.put(def.getCamelCaseName(), (SubPlace) def);
    }
    else if (def instanceof EnumMappingGenerator){
      enumGenerators.put(def.getCamelCaseName(), (EnumMappingGenerator) def);
    }
    else if (def instanceof RunContextItem){
      RunContextItem rci = (RunContextItem) def;
      RunContextItemCollection rcic = contexts.get(rci.getContextImpl());
     
      if (rcic == null){
        rcic = new RunContextItemCollection(rci.getContextImpl());
        contexts.put(rci.getContextImpl(), rcic);
      }
      rcic.addItem(rci);
     
      // Add the item to its module
      rci.getDefinedInModule().addRunContextItem(rci);
    }
    else if (def instanceof I18NConfig){
      I18NConfig i18n = (I18NConfig) def;
      RunContextItemCollection rcic = contexts.get(i18n.getContextImpl());
     
      if (rcic == null){
        rcic = new RunContextItemCollection(i18n.getContextImpl());
        contexts.put(i18n.getContextImpl(), rcic);
      }
      rcic.addItem(i18n);
     
      // Add the item to its module
      i18n.getDefinedInModule().addRunContextItem(i18n);
    }
    else if (def instanceof MenuBar){
      MenuBar menu = (MenuBar) def;
      menuBars.put(menu.getCamelCaseName(), menu);
      menuElements.put(menu.getCamelCaseName(), menu);
    }
    else if (def instanceof SubMenu){
      SubMenu menu = (SubMenu) def;
      subMenus.put(menu.getCamelCaseName(), menu);
      menuElements.put(menu.getCamelCaseName(), menu);
    }
    else if (def instanceof MenuItem){
      MenuItem item = (MenuItem) def;
      menuItems.put(item.getCamelCaseName(), item);
      menuElements.put(item.getCamelCaseName(), item);
    }
    else if (def instanceof Separator){
      Separator sep = (Separator) def;
      separators.put(sep.getCamelCaseName(), sep);
      menuElements.put(sep.getCamelCaseName(), sep);
    }
    else if (def instanceof ActionBinding){
      ActionBinding action = (ActionBinding) def;
      actions.put(action.getCamelCaseName(), action);
    }
    else if (def instanceof MenuImplementationConfig){
      if (menuImplementation == null){
        menuImplementation = (MenuImplementationConfig) def;
       
        // The menu factory specified by the menu implementation is added
        // as a run context item.
        RunContextItem rci = new RunContextItem();
        rci.setAutoCreated(true);
        RunContextItemCollection rcic = contexts.get(rci.getContextImpl());
       
        rci.setItemName("menuFactory");
        rci.setDescription("The auto generated run context item for the generic menuFactory; this was created because a MenuImplementationConfig was provided by the " + menuImplementation.getDefinedInModule().getModuleName() + " module");

        rci.setUseClass("org.dmd.mvw.client.mvwmenus.base.MvwMenuFactory");
        rci.setItemOrder(16);
         
        // We use the class specified in the menu implementation config to
        // create the construction call.
        rci.setConstruction("new " + menuImplementation.getUseClass() + "()");
        rci.setDefinedInModule(menuImplementation.getDefinedInModule());
       
        if (rcic == null){
          rcic = new RunContextItemCollection(rci.getContextImpl());
          contexts.put(rci.getContextImpl(), rcic);
        }
        rcic.addItem(rci);
       
        // Add the item to its module
        rci.getDefinedInModule().addRunContextItem(rci);
       
        menuFactoryRCI = rci;
      }
      else{
        MenuImplementationConfig config = (MenuImplementationConfig) def;
        ResultException ex = new ResultException();
        ex.addError("Multiple menu implementations are specified as part of your loaded modules; only one menu implementation can be used.");
        ex.result.lastResult().moreMessages("Menus from " + menuImplementation.getConfigName() + " defined in module " + menuImplementation.getDefinedInModule().getModuleName());
        ex.result.lastResult().moreMessages("Menus from " + config.getConfigName() + " defined in module " + config.getDefinedInModule().getModuleName());
        throw(ex);
      }
    }
View Full Code Here

      }
    }
  }
 
  public void resolveDefinitions() throws ResultException, DmcValueException {
    ResultException errors = null;
   
    if (needMvwComms){
      key.setNameString("mvwcomms");
      if (modules.get(key) == null){
        ResultException ex = new ResultException();
        ex.addError("One or more of your components specify that they send Dark Matter Protocol messages, but you haven't loaded the mvwcomms module.");
        throw(ex);
      }
    }
   
    for(MvwDefinition def : allDefs.values()){
      try {
        def.resolveReferences(this);
      } catch (DmcValueExceptionSet e) {
        if (errors == null)
          errors = new ResultException();
       
        errors.addError("Couldn't resolve references in object: " + " " + def.getCamelCaseName());
        errors.setLocationInfo(def.getFile(), def.getLineNumber());
       
        for(DmcValueException dve : e.getExceptions()){
          errors.moreMessages(dve.getMessage());
        }
      }
    }
   
//    for(Place place: places.values()){
//      Activity activity = place.getRunsActivity();
//      if (activity.getPlace() == null){
//        activity.setPlace(place);
//      }
//      else{
//        ResultException ex = new ResultException();
//        ex.addError("Multiple places are attempting to run the same Activity: " + activity.getActivityName());
//        Place p = activity.getPlace();
//        ex.result.lastResult().moreMessages(p.getPlaceName() + " defined in " + p.getDefinedInModule().getModuleName());
//        ex.result.lastResult().moreMessages(place.getPlaceName() + " defined in " + place.getDefinedInModule().getModuleName());
//        throw(ex);
//      }
//    }
   
    // Try to create the back association between Actions and their implementors
    for(Controller controller: controllers.values()){     
      if (controller.getImplementsActionHasValue()){
        for(ActionBinding action: controller.getImplementsActionIterable()){
          if (action.getImplementedBy() == null)
            action.setImplementedBy(controller);
          else{
            if (errors == null)
              errors = new ResultException();
           
            Component existing = action.getImplementedBy();
            errors.addError("Multiple components implement the " + action.getActionBindingName() + " action.");
            errors.result.lastResult().moreMessages(existing.getComponentName() + " in file " + existing.getFile() + ":" + existing.getLineNumber());
            errors.result.lastResult().moreMessages(controller.getComponentName() + " in file " + controller.getFile() + ":" + controller.getLineNumber());
          }
        }
       
        // We also verify that the module in which the component is defined depends on
        // the mvwmenus module, since we need the MenuController to be injected into
        // Component to allow for registration of the actions
        if (!controller.getDefinedInModule().dependsOnModuleContains("mvwmenus")){
          if (errors == null)
            errors = new ResultException();
         
          errors.addError("The " + controller.getDefinedInModule().getModuleName() + " module must depend on the mvwmenus module.");
          errors.result.lastResult().moreMessages(controller.getDefinedInModule().getFile());
        }
        else{
          // We have the mvwmenus module, so indicate that the component uses the menu controller
          key.setNameString("MenuControllerRCI");
          RunContextItemCollection rcic = contexts.get("Default");
          RunContextItem rci = rcic.getItem("MenuControllerRCI");
          controller.addUsesRunContextItem(rci);
        }
      }
    }
   
    // And ensure that all actions are implemented
    for(ActionBinding action: actions.values()){
      if (action.getImplementedBy() == null){
        if (errors == null)
          errors = new ResultException();
       
        errors.addError("The " + action.getActionBindingName() + " action is not implemented by any Controller, Presenter or Activity.");
      }
    }
   
    if (application != null){
      if (centralAsyncErrorHandler != null){
        DebugInfo.debug("CHANGING THE PLACEHOLDER");
                  // We will fill in the details of the predefined place holder context item - defined in the mvw module
        RunContextItemCollection rcic = contexts.get(centralAsyncErrorHandlerRCI.getContextImpl());
        RunContextItem rci = rcic.getItem("centralAsyncErrorHandler");
         
        // The construction is just the assignment of the controller to this item
        rci.setConstruction(centralAsyncErrorHandlerRCI.getItemName());

        int order = centralAsyncErrorHandlerRCI.getItemOrder() + 1;
        rci.setItemOrder(order);
      }
               
      // We're generating the application, so some additional checking is required
      if (menuBars.size() > 0){
        // We have menu related functionality, so the application must specify a
        // menu implementation
        if (application.getMenuImplementation() == null){
          if (errors == null)
            errors = new ResultException();
         
          errors.addError("The " + application.getAppName() + " uses menu functionality and you must set the menuImplementation.");
        }
       
        try{
          menuImplementation.validateImplementations(menuElements);
        }
        catch(ResultException ex){
          if (errors == null)
            errors = ex;
          else
            errors.result.addResults(ex.result);
        }
       
        // We create a run context item for the menu builder that we'll generate.
        // It will be instantiated after all other components are initialized.
        // All Presenters are available for access from the run context. They are created on demand.
        RunContextItem rci = new RunContextItem();
        rci.setAutoCreated(true);
        RunContextItemCollection rcic = contexts.get(rci.getContextImpl());
       
        rci.setItemName("menuBuilder");
        rci.setItemOrder(200);
        rci.setUseClass(application.getDefinedInModule().getGenPackage() + ".generated.mvw." + application.getAppName() + "MenuBuilder");
        rci.setConstruction("new " + application.getAppName() + "MenuBuilder" + "(this)");
        rci.setDefinedInModule(application.getDefinedInModule());
       
        if (rcic == null){
          rcic = new RunContextItemCollection(rci.getContextImpl());
          contexts.put(rci.getContextImpl(), rcic);
        }
        rcic.addItem(rci);
       
        // Add the item to its module
        rci.getDefinedInModule().addRunContextItem(rci);

       
        // Some additional checking to allow the use of display labels from I18N resources
        for(MenuElementDefinitionDMW def: menuElements.values()){
          try{
            if (def instanceof MenuItem){
              MenuItem item = (MenuItem) def;
                item.initLabelInfo(defaultContext);
            }
            else if (def instanceof SubMenu){
              SubMenu submenu = (SubMenu) def;
              submenu.initLabelInfo(defaultContext);
            }
          }
          catch(ResultException ex){
            if (errors == null)
              errors = ex;
            else
              errors.result.addResults(ex.result);
          }
        }
       
      }
    }
   
    if (formBindings.size() > 0){
      for(FormBindingDefinition fbd: formBindings.values()){
        // We only do this checking if we're generated code for the
        // binding definition's module. Otherwise, in autogen mode
        // we will get multiple errors.
        if (fbd.getDefinedInModule() == codeGenModule){
          for(EditField field: fbd.getEditFieldIterable()){
            key.setNameString(field.getFieldEditor());
            FieldEditorDefinition fed = fieldEditors.get(key);
           
            if (fed == null){
              if (errors == null)
                errors = new ResultException();
             
              errors.addError("Unknown FieldEditorDefinition reference: " + field.getFieldEditor());
              errors.result.lastResult().fileName(fbd.getFile());
              errors.result.lastResult().lineNumber(fbd.getLineNumber());
            }
            else
              field.setEditorDef(fed);
           
            AttributeDefinition  def = readSchemas.adef(field.getAttribute());
            if (def == null){
              if (errors == null)
                errors = new ResultException();
             
              errors.addError("Unknown attribute reference: " + field.getAttribute());
              errors.result.lastResult().fileName(fbd.getFile());
              errors.result.lastResult().lineNumber(fbd.getLineNumber());
            }
            else{
              field.setAttrDef(def);
             
              if (fbd.isStrictlyChecked()){
                ClassDefinition cd = (ClassDefinition) fbd.getEditObject();
                if (cd.hasAttribute(def.getName().getNameString()) == null){
                  if (errors == null)
                    errors = new ResultException();
                 
                  errors.addError("Attribute: " + field.getAttribute() + " is not an attribute of editObject: " + cd.getName());
                  errors.result.lastResult().fileName(fbd.getFile());
                  errors.result.lastResult().lineNumber(fbd.getLineNumber());
                }
              }
            }
           
          }
        }
      }
    }
   
    if (enumMappings.size() > 0){
      for(EnumMapping mapping: enumMappings.values()){
        if (mapping.getDefinedInModule() == codeGenModule){
          EnumDefinition ed = readSchemas.isEnum(mapping.getEnumName());
          if (ed == null){
            if (errors == null)
              errors = new ResultException();
           
            errors.addError(mapping.getEnumName() + " is not a known enum type.");
            errors.result.lastResult().fileName(mapping.getFile());
            errors.result.lastResult().lineNumber(mapping.getLineNumber());
          }
          else{
            mapping.setEnumDef(ed);
         
            EnumValue ev = ed.getEnumValue(mapping.getUnsetValue());
            if (ev == null){
              if (errors == null)
                errors = new ResultException();
             
              errors.addError(mapping.getUnsetValue() + " is not a valid member of enum: " + ed.getName());
              errors.result.lastResult().fileName(mapping.getFile());
              errors.result.lastResult().lineNumber(mapping.getLineNumber());
             
            }
          }
        }
      }
    }
   
    if (components.size() > 0){
      for(Component component: components.values()){
        if (component.getSendsRequestHasValue()){
          if (readSchemas.isSchema("dmp") == null){
            DmpSchemaAG dmp = new DmpSchemaAG();
            readSchemas.manageSchema(dmp);
          }
         
          component.getDMO().addUsesRunContextItem("commsController");
          needMvwComms = true;
          // Try to resolve reference to the request being sent and set the
          // import information
          for(RequestTypeWithOptions rq: component.getSendsRequestIterable()){
            String request = rq.getRequestType() + "Request";
            String response = rq.getRequestType() + "Response";
            ClassDefinition cd = readSchemas.cdef(request);
            if (cd == null){
              ResultException ex = new ResultException();
              ex.addError("Unknown request type: " + request);
              ex.result.lastResult().lineNumber(component.getLineNumber());
              ex.result.lastResult().fileName(component.getFile());
              throw(ex);
            }
            rq.setRequestImport(cd.getDmoImport());
           
            cd = readSchemas.cdef(response);
            if (cd == null){
              ResultException ex = new ResultException();
              ex.addError("Unknown response type: " + response);
              ex.result.lastResult().lineNumber(component.getLineNumber());
              ex.result.lastResult().fileName(component.getFile());
              throw(ex);
            }
            rq.setResponseImport(cd.getDmoImport());
           
            if (rq.isUsingClassInfo()){
              cd = readSchemas.cdef(rq.getClassName());
              if (cd == null){
                ResultException ex = new ResultException();
                ex.addError("Unknown class: " + rq.getClassName() + " in " + rq.getRequestType() + "Request spec");
                ex.result.lastResult().lineNumber(component.getLineNumber());
                ex.result.lastResult().fileName(component.getFile());
                throw(ex);
              }
              rq.setClassImport(cd.getDmoImport());
             
              if (rq.getRequestType().equals("Set") || rq.getRequestType().equals("Delete")){
                if (cd.getIsNamedBy() == null){
                  ResultException ex = new ResultException();
                  ex.addError(rq.getRequestType() + "Requests are only applicable to named objects.");
                  ex.result.lastResult().lineNumber(component.getLineNumber());
                  ex.result.lastResult().fileName(component.getFile());
                  throw(ex);
                }
              }
View Full Code Here

    for(ActionBinding action: actions.values()){
      action.initCodeGenInfo();
    }
   
    if ((application != null) && needAsyncErrorHandler && (centralAsyncErrorHandler == null)){
      ResultException ex = new ResultException();
      ex.addError("One or more elements make use of code splitting, but no Controller is defined as the centralAsyncErrorHandler.");
      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.