Package org.apache.tools.ant.taskdefs

Examples of org.apache.tools.ant.taskdefs.Manifest


        init();
        return this;
    }

    private Manifest generateAntManifest() {
        Manifest antManifest = new Manifest();
        addAttributesToAnt(antManifest);
        addSectionAttributesToAnt(antManifest);
        return antManifest;
    }
View Full Code Here


    private void read(Object manifestPath) {
        File manifestFile = fileResolver.resolve(manifestPath);
        try {
            FileReader reader = new FileReader(manifestFile);
            Manifest antManifest;
            try {
                antManifest = new Manifest(reader);
            } finally {
                reader.close();
            }
            addAntManifestToAttributes(antManifest);
            addAntManifestToSections(antManifest);
View Full Code Here

      throw new BuildException("the template file attribute is required"
                               +" when mode is \"" +mode.getValue() +"\"");
    }


    Manifest manifestProps = new Manifest();
    if (!mode.getValue().equals("templateOnly")) {
      addAttributesFromProperties(manifestProps);
    }

    Manifest manifestToWrite  = Manifest.getDefaultManifest();
    Manifest manifestTemplate = null;

    if (null!=manifestTemplateFile && manifestTemplateFile.exists()) {
      FileInputStream   is = null;
      InputStreamReader ir = null;
      try {
        is = new FileInputStream(manifestTemplateFile);
        if (encoding == null) {
          ir = new InputStreamReader(is, "UTF-8");
        } else {
          ir = new InputStreamReader(is, encoding);
        }
        manifestTemplate = new Manifest(ir);
      } catch (ManifestException me) {
        throw new BuildException("Template manifest " + manifestTemplateFile
                                 + " is invalid", me, getLocation());
      } catch (IOException ioe) {
        throw new BuildException("Failed to read " + manifestTemplateFile,
View Full Code Here

       
        return new File(dir, filename);
    }

    private Manifest parseManifest(XMLElement me) throws PluginException {
        Manifest mf = this.manifest;
        if (mf == null) {
            mf = new Manifest();
        }
        for (Iterator<?> i = me.getChildren().iterator(); i.hasNext();) {
            final XMLElement e = (XMLElement) i.next();
            if (e.getName().equals("attribute")) {
                final String k = e.getStringAttribute("key");
                final String v = e.getStringAttribute("value");
                try {
                    mf.addConfiguredAttribute(new Manifest.Attribute(k, v));
                } catch (ManifestException ex) {
                    throw new PluginException("Error in manifest", ex);
                }
            } else {
                throw new PluginException("Unknown element " + e.getName());
View Full Code Here

        if (this.manifest == null) {
            this.manifest = inc.manifest;
        } else if (inc.manifest != null) {
            try {
                final Manifest merged = new Manifest();
                merged.merge(inc.manifest);
                merged.merge(this.manifest);
                this.manifest = merged;
            } catch (ManifestException ex) {
                throw new PluginException(ex);
            }
        }
View Full Code Here

     * @param descr plugin descriptor object
     * @return the manifest
     * @throws ManifestException
     */
    protected Manifest createManifest(PluginDescriptor descr) throws ManifestException {
        Manifest mf = new Manifest();

        mf.addConfiguredAttribute(new Manifest.Attribute("Bundle-SymbolicName", descr.getId()));
        mf.addConfiguredAttribute(new Manifest.Attribute("Bundle-ManifestVersion", "2"));
        mf.addConfiguredAttribute(new Manifest.Attribute("Bundle-Version", descr.getVersion().toString()));

        return mf;
    }
View Full Code Here

            jarTask.setProject(getProject());
            jarTask.setTaskName(getTaskName());
            jarTask.setDestFile(tmpFile);
            jarTask.setCompress(false);

            final Manifest mf = piList.getManifest();
            if (mf != null) {
                jarTask.addConfiguredManifest(mf);
            }

            final URL[] systemPlugins = systemPluginList.getPluginList();
View Full Code Here


    private void createResourceJar(File tmpFile) throws IOException,
            ManifestException {
        String contentToken = calculateContentToken();
        Manifest mf = buildManifest(contentToken);

        Jar jar = new Jar();
        jar.bindToOwner(this);
        jar.addConfiguredManifest(mf);
        for (FileSet fs : filesets)
View Full Code Here

        return Long.toString(Math.abs(ck.getValue()), Character.MAX_RADIX);
    }

    private Manifest buildManifest(String contentToken)
            throws ManifestException {
        Manifest mf = Manifest.getDefaultManifest();
        addAttribute(mf, DISTR_FORMAT_ATTR, "1.0");
        addAttribute(mf, DISTR_NAME_ATTR, profilename);
        addAttribute(mf, DISTR_ID_ATTR, profileid);
        addAttribute(mf, DISTR_VERSION_ATTR, profileversion);
        addAttribute(mf, DISTR_TOKEN_ATTR, contentToken);
View Full Code Here

    Project project = new Project();
    project.setName(resource.getName());
    project.setBasedir(resource.getLocation().toString());
    // creat jar
    Jar jar = new Jar();
    Manifest manifest = getManifest(resource);
    try {
      jar.addConfiguredManifest(manifest);
    } catch (ManifestException e) {
      e.printStackTrace();
      return null;
View Full Code Here

TOP

Related Classes of org.apache.tools.ant.taskdefs.Manifest

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.