Package gri.gridp.modules

Examples of gri.gridp.modules.ModuleInfo


      elem.addContent(packageElem);
    }
  }

  public ModuleInfo readModuleInfo(Element element) {
    ModuleInfo info = new ModuleInfo();

    List children = element.getChildren();
    Element child;
    for (int i=0; i<children.size(); i++) {
      child = (Element)children.get(i);
      String name = child.getName().toLowerCase();

      if (name.equals("title"))
        info.setTitle(child.getText());
      else if (name.equals("program"))
        info.setProgram(child.getText());
      else if (name.equals("description"))
        info.setDescription(child.getText());
      else if (name.equals("package"))
        info.setPackageInfo(packageSerializer.readPackageInfo(child));
    }

    return info;
  }
View Full Code Here


    for (int i = 0; i < children.size(); i++) {
      Element child = (Element)children.get(i);
      String name = child.getName().toLowerCase();

      if (name.equals("info")) {
        ModuleInfo info = modInfoSerializer.readModuleInfo(child);
        if (info != null)
          module.setModuleInfo(info);
      }

      else if (name.equals("parameters")) {
        List parameters = paramSerializer.readList(child);
        for (int j = 0; j < parameters.size(); j++) {
          Parameter param = (Parameter)parameters.get(j);
          module.addParameter(param);
        }
      }

      else if (name.equals("outputs")) {
        List outputs = new ListSerializer(outputSerializer, "output").readList(child);
        for (int j=0; j<outputs.size(); j++)
          module.addOutput((Output)outputs.get(j));
      }

      else if (name.equals("functions")) {
        ListSerializer serializer = new ListSerializer(
            new FunctionSerializer(
                module.getParameterMap(), module.getOutputMap()),
        "function");
        List functions = serializer.readList(child);
        for (int functionIndex=0; functionIndex<functions.size(); functionIndex++) {
          Function function = (Function)functions.get(functionIndex);   
          module.addFunction(function);
        }
      }

      /*
      else if (name.equals("function")) {
    Function f = new FunctionSerializer(module.getParameterMap()).readFunction(elem);
    if (f != null)
        module.addFunction(f);
      }*/

    }

    //validate:
    if (module.getModuleInfo() == null)
      module.setModuleInfo(new ModuleInfo("unknown program"));

    //name functions:
    List functions = module.getFunctionList();
    Function func;
    for (int i=0; i<functions.size(); i++) {
View Full Code Here

    }
 
  protected TaskDescription getTaskDescription(ModuleFunction modFunc) {
    ProgramTaskDescription desc = new ProgramTaskDescription();

    ModuleInfo modInfo = modFunc.getModule().getModuleInfo();
    FunctionInfo funcInfo = modFunc.getFunction().getInfo();

    //custom name:
    String name = funcInfo.getTitle();
   
    //default name = "module (program)"
    if (name == null) {
      name = modInfo.getTitle();

      String program = modInfo.getProgram();
      if (program != null)
        name += " (" + program + ")";   
    }

    desc.setName(name);

    //description:
    String description = funcInfo.getDescription();
    if (description == null)
      description = modInfo.getDescription();
    desc.setDescription(description);

    //extended info:
    desc.setProgramName(modInfo.getProgram());
    desc.setGroup(funcInfo.getGroup());

    PackageInfo pkgInfo = modInfo.getPackageInfo();
    if (pkgInfo != null) {
      desc.setPackageName(pkgInfo.getName());
      desc.setWebsite(pkgInfo.getWebsite());
    }
View Full Code Here

TOP

Related Classes of gri.gridp.modules.ModuleInfo

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.