Package org.apache.tools.ant.taskdefs

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


       
        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

    project.setName(resource.getName());
    project.setBasedir(resource.getLocation().toString());
    Copy copy=new Copy();
    copy.setOverwrite(true);
    copy.setProject(project);
    Manifest manifest = getManifest(resource);
    String bundelName=genarateFullName(manifest).toString();
    File bundelFile=new File(bundelName);
    if(!bundelFile.exists()){
      bundelFile.mkdirs();
    }
View Full Code Here

  protected Manifest getManifest(IProject model){
    try {
      IFile manifestMf=model.getFile(Constants.MANIFEST_MF);
      InputStreamReader reader =
          new InputStreamReader(manifestMf.getContents());
      Manifest manifest = new Manifest(reader);
      reader.close();
      return manifest;
    } catch (Exception e) {
      e.printStackTrace();
    }
View Full Code Here

            InputStream is = OneJarTask.class.getResourceAsStream(ONE_JAR_BOOT);
            if (is == null)
                throw new IOException("Unable to load default " + ONE_JAR_BOOT + ": consider using the <one-jar onejarboot=\"...\"> option.");
            // Pull the manifest out and use it.
            JarInputStream jis = new JarInputStream(is);
            Manifest manifest = new Manifest();
            java.util.jar.Manifest jmanifest = jis.getManifest();
            java.util.jar.Attributes jattributes = jmanifest.getMainAttributes();
            try {
                // Specify our Created-By and Main-Class attributes as overrides.
                manifest.addConfiguredAttribute(new Attribute("Created-By", "One-Jar 0.98 Ant taskdef"));
                manifest.addConfiguredAttribute(new Attribute(MAIN_CLASS, jattributes.getValue(MAIN_CLASS)));
                if (oneJarMainClass != null) {
                    manifest.addConfiguredAttribute(new Attribute(Boot.ONE_JAR_MAIN_CLASS, oneJarMainClass));
                }
                super.addConfiguredManifest(manifest);
            } catch (ManifestException mx) {
                throw new BuildException(mx);
            }
View Full Code Here

TOP

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

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.