예제 #1
0
 private void copyAttributes() {
   List<Group> groups = new ArrayList<Group>();
   List<Artifact> artifacts = new ArrayList<Artifact>();
   List<Action> actions = new ArrayList<Action>();
   for (Attribute attr : cspec.getAttributes()) {
     if (attr instanceof Action) actions.add((Action) attr);
     else if (attr instanceof Group) groups.add((Group) attr);
     else if (!(attr instanceof ActionAttribute)) artifacts.add((Artifact) attr);
   }
   copyArtifacts(artifacts);
   copyGroups(groups);
   copyActions(actions);
 }
예제 #2
0
  private void copyDependencies() {
    List<ComponentRequest> deps = cspec.getDependencies();
    if (deps.isEmpty()) return;
    IDependenciesType dt = ICSpecXMLFactory.eINSTANCE.createDependenciesType();
    xmlSpec.getDependencies().add(dt);

    for (ComponentRequest dep : deps) {
      IComponentRequest xmlDep = ICSpecXMLFactory.eINSTANCE.createComponentRequest();
      xmlDep.setName(dep.getId());
      xmlDep.setComponentType(dep.getType());
      xmlDep.setRange(dep.getRange());
      xmlDep.setFilter(dep.getFilter());
      dt.getDependency().add(xmlDep);
    }
  }
예제 #3
0
 public IComponentSpec exportCSpec(CSpec cspc) {
   cspec = cspc;
   xmlSpec = (ComponentSpecImpl) ICSpecXMLFactory.eINSTANCE.createComponentSpec();
   xmlSpec.setName(cspc.getId());
   xmlSpec.setComponentType(cspc.getType());
   xmlSpec.setVersion(cspc.getVersion());
   xmlSpec.setDocumentation(cspc.getDocumentation());
   xmlSpec.setFilter(cspc.getFilter());
   xmlSpec.setShortDesc(cspc.getShortDesc());
   xmlSpec.setProjectInfo(cspc.getProjectInfo());
   copyDependencies();
   copyGenerators();
   copyAttributes();
   return xmlSpec;
 }
예제 #4
0
  private void copyGenerators() {
    List<Generator> generators = cspec.getGenerators();
    if (generators.isEmpty()) return;

    IGeneratorsType gt = ICSpecXMLFactory.eINSTANCE.createGeneratorsType();
    xmlSpec.getGenerators().add(gt);
    for (Generator generator : generators) {
      IGenerator xmlGen = ICSpecXMLFactory.eINSTANCE.createGenerator();
      ComponentIdentifier cid = generator.getGenerates();
      xmlGen.setGenerates(cid.getId());
      xmlGen.setGeneratesType(cid.getType());
      Version version = cid.getVersion();
      if (version != null) xmlGen.setGeneratesVersionString(version.toString());
      xmlGen.setAttribute(generator.getAttribute());
      ComponentRequest component = generator.getComponent();
      if (component != null) {
        xmlGen.setComponent(component.getId());
        xmlGen.setComponentType(component.getType());
      }
      gt.getGenerator().add(xmlGen);
    }
  }