Package org.moxie.maxml

Examples of org.moxie.maxml.MaxmlMap


    Union classfiles = structure.createClassfiles();
    Path outputpath = new Path(mxtest.getProject());
    outputpath.setPath(mxtest.getClassesDir().getAbsolutePath());
    classfiles.add(outputpath);
   
    MaxmlMap attributes = mxtest.getBuild().getConfig().getTaskAttributes(mxtest.getTaskName());
    if (attributes == null) {
      attributes = new MaxmlMap();
    }

    // source files
    SourceFilesElement sourcefiles = structure.createSourcefiles();
    sourcefiles.setEncoding(attributes.getString("encoding", null));
    Path sourcepath = new Path(mxtest.getProject());
    sourcepath.setRefid(new Reference(mxtest.getProject(), Key.compileSourcePath.referenceId()));
    sourcefiles.add(sourcepath);
   
    // report output folder
View Full Code Here


    // EMMA properties
    testng.addSysproperty(mxtest.getEmmaFileProperty());
    testng.addSysproperty(mxtest.getEmmaMergeProperty());
 
    // configure properties from Moxie file
    MaxmlMap attributes = mxtest.getBuild().getConfig().getTaskAttributes("testng");
    if (attributes != null) {
      AttributeReflector.setAttributes(mxtest.getProject(), testng, attributes);
    }

    testng.execute();
View Full Code Here

    return showtitle == null || showtitle;
  }

  private void configure(Build build) {
    configured = true;
    MaxmlMap attributes = build.getConfig().getTaskAttributes(getTaskName());
    if (attributes == null) {
      build.getConsole().error(getTaskName() + " attributes are null!");
      return;
    }
   
View Full Code Here

    }
   
    console.debug(getTaskName() + " configuration");

    // display specified mx:jar attributes
    MaxmlMap attributes = build.getConfig().getTaskAttributes(getTaskName());
    AttributeReflector.logAttributes(this, attributes, console);

    // optionally inject MxLauncher utility
    if (launcher != null) {
      if (launcher.getName().equals(MxLauncher.class.getName().replace('.', '/') + ".class")) {
View Full Code Here

      InputStream is = getClass().getResourceAsStream(MessageFormat.format("/archetypes/{0}.moxie", project.type));
      if (is == null) {
        log("Unknown archetype " + project.type);
        System.exit(1);
      }
      MaxmlMap map = null;
      try {
      map = Maxml.parse(is);
    } catch (MaxmlException e) {
      e.printStackTrace();
    } finally {
      try {
        is.close();
      } catch (Exception e) {
      }
    }
     
      // property substitution
      Map<String, String> properties = new HashMap<String, String>();
      properties.put(Key.groupId.name(), project.groupId);
      properties.put(Key.artifactId.name(), project.artifactId);
      properties.put(Key.version.name(), project.version);
      properties.put(Key.apply.name(), StringUtils.flattenStrings(apply, ", "));
      for (String key : map.keySet()) {
        Object o = map.get(key);
        if (o instanceof String) {
          String value = resolveProperties(o.toString(), properties);
          map.put(key, value);
        }
      }
     
      createDirectories(project, map, Key.sourceDirectories);
      createDirectories(project, map, Key.resourceDirectories);
     
      // Eclipse-ext dependency directory
      if (Eclipse.ext.equals(project.eclipse)) {
        map.put(Toolkit.Key.dependencyDirectory.name(), "ext");
      }

      // write build.moxie
      String maxml = map.toMaxml();
    moxieFile = new File(project.dir, "build.moxie");
      FileUtils.writeContent(moxieFile, maxml);
     
      // write build.xml
      try {
View Full Code Here

     
    File root = Toolkit.getMxRoot();
      File gitAliases = new File(root, "git.moxie");
      if (gitAliases.exists()) {
        try {
          MaxmlMap map = Maxml.parse(gitAliases);
          // look for protocol alias matches
          for (String alias : map.keySet()) {
            // ensure alias is legal
            if ("ftp".equals(alias)
                || "http".equals(alias)
                || "https".equals(alias)
                || "git".equals(alias)
                || "ssh".equals(alias)) {
              error(MessageFormat.format("Illegal repository alias \"{0}\"!", alias));
              continue;
            }
           
            // look for alias match
            String proto = alias + "://";
            if (url.startsWith(proto)) {
              String baseUrl = map.getString(alias, "");
              if (baseUrl.charAt(baseUrl.length() - 1) != '/') {
                return baseUrl + '/' + repo;
              }
              return baseUrl + repo;
            }
View Full Code Here

   
    if (releaseLog == null) {
      releaseLog = new File(getProject().getBaseDir(), "releases.moxie");
    }
   
    MaxmlMap map = null;
    try {
      map = Maxml.parse(moxieFile);
    } catch (MaxmlException e) {
      throw new MoxieException(e);
    }

    String groupId = map.getString(Toolkit.Key.groupId.name(), "");
    String artifactId = map.getString(Toolkit.Key.artifactId.name(), "");
    String projectName = map.getString(Toolkit.Key.name.name(), null);
    if (StringUtils.isEmpty(projectName)) {
      projectName = groupId + ":" + artifactId;
    }

    String version;
    String releaseVersion = map.getString(Toolkit.Key.releaseVersion.name(), "");
   
    SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd");
    Date releaseDate = map.getDate(Toolkit.Key.releaseDate.name(), null);
    String releaseDateStr = releaseDate == null ? null : df.format(releaseDate);
    Date buildDate = new Date();
    String buildDateStr = buildDate == null ? null : df.format(buildDate);
   
    ArtifactVersion artifactVersion = new ArtifactVersion(
        map.getString(Constants.Key.version.name(), "0.0.0-SNAPSHOT"));
   
    Map<String, String> properties = new HashMap<String, String>();
    List<Substitute> replacements = new ArrayList<Substitute>();
    switch (stage) {
    case release:
View Full Code Here

    }
  }

  private void configure(Build build) {
    configured = true;
    MaxmlMap attributes = build.getConfig().getTaskAttributes(getTaskName());
    if (attributes == null) {
      build.getConsole().error(getTaskName() + " attributes are null!");
      return;
    }
   
View Full Code Here

    }
   
    console.debug(getTaskName() + " configuration");

    // display specified mxgenjar attributes
    MaxmlMap attributes = build.getConfig().getTaskAttributes(getTaskName());
    AttributeReflector.logAttributes(this, attributes, console);

    // optionally inject MxLauncher utility
    if (launcher != null) {
      if (launcher.getName().equals(MxLauncher.class.getName().replace('.', '/') + ".class")) {
View Full Code Here

    return "MoxieData (" + file + ")";
  }

  MoxieData parse() throws IOException, MaxmlException {

    MaxmlMap map = new MaxmlMap();
    if (file.exists()) {
      String content = FileUtils.readContent(file, "\n").trim();
      map = Maxml.parse(content);
    }
    parseDependencies(map, Key.dependencies);   
    lastDownloaded = parseDate(map, Key.lastDownloaded, lastDownloaded);
    lastChecked = parseDate(map, Key.lastChecked, lastChecked);
    lastUpdated = parseDate(map, Key.lastUpdated, lastUpdated);
    lastSolved = parseDate(map, Key.lastSolved, lastSolved);
    origin = map.getString(Key.origin.name(), null);
    if ("null".equals(origin)) {
      // Moxie <= 0.5.0 workaround
      // null origin b/c of .m2/repository copy persisted as "null"
      origin = null;
    }
    solutionVersion = map.getInt("solutionVersion", 0);
    return this;
  }
View Full Code Here

TOP

Related Classes of org.moxie.maxml.MaxmlMap

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.