Package java.util.jar.Attributes

Examples of java.util.jar.Attributes.Name


        {
            return Name.SPECIFICATION_VERSION;
        }
        else
        {
            return new Name(attrName);
        }
    }
View Full Code Here


     * Retrives the attribute with the specified name. The default
     * implementation simply throws an exception.
     */
    public Object getAttribute(String attrName) throws FileSystemException
    {
        final Name name = lookupName(attrName);
        return getAttribute(name);
    }
View Full Code Here

  }

  public Manifest getManifest(boolean shouldCreate) {
    if (manifest == null && shouldCreate) {
      String WEAVER_MANIFEST_VERSION = "1.0";
      Attributes.Name CREATED_BY = new Name("Created-By");
      String WEAVER_CREATED_BY = "AspectJ Compiler";

      manifest = new Manifest();

      Attributes attributes = manifest.getMainAttributes();
View Full Code Here

                mf = JarUtils.loadJarManifest(new FileInputStream(c.getFile()));
            } catch (IOException e) {
                logger.logError("Unable to generate access rules from bundle " + c.getFile(), e);
                return;
            }
            Parameters exportPkgs = new Parameters(mf.getMainAttributes().getValue(new Name(Constants.EXPORT_PACKAGE)));
            List<IAccessRule> tmp = new LinkedList<IAccessRule>();
            for (String exportPkg : exportPkgs.keySet()) {
                String pathStr = exportPkg.replace('.', '/') + "/*";
                tmp.add(JavaCore.newAccessRule(new Path(pathStr), IAccessRule.K_ACCESSIBLE));
            }
View Full Code Here

                mf = JarUtils.loadJarManifest(new FileInputStream(c.getFile()));
            } catch (IOException e) {
                logger.logError("Unable to generate access rules from bundle " + c.getFile(), e);
                return;
            }
            Parameters exportPkgs = new Parameters(mf.getMainAttributes().getValue(new Name(Constants.EXPORT_PACKAGE)));
            List<IAccessRule> tmp = new LinkedList<IAccessRule>();
            for (String exportPkg : exportPkgs.keySet()) {
                String pathStr = exportPkg.replace('.', '/') + "/*";
                tmp.add(JavaCore.newAccessRule(new Path(pathStr), IAccessRule.K_ACCESSIBLE));
            }
View Full Code Here

        List result = new ArrayList(targetFiles);

        File manifestFile = new File(source, (String) sourceFiles.remove(0));
        Manifest resultManifest = Utils.readManifest(manifestFile);

        resultManifest.getMainAttributes().remove(new Name(Constants.DEPLOYMENTPACKAGE_FIXPACK));

        for (Iterator i = result.iterator(); i.hasNext();) {
            String targetFile = (String) i.next();
            if (!MANIFEST_NAME.equals(targetFile) && !resultManifest.getEntries().containsKey(targetFile)) {
                i.remove();
            }
        }

        for (Iterator iter = sourceFiles.iterator(); iter.hasNext();) {
            String path = (String) iter.next();
            File from = new File(source, path);
            File to = new File(target, path);
            if (targetFiles.contains(path)) {
                if (!to.delete()) {
                    throw new IOException("Could not delete " + to);
                }
            }
            else {
                result.add(path);
            }
            if (!rename(from, to)) {
                throw new IOException("Could not rename " + from + " to " + to);
            }
        }

        targetFiles.removeAll(sourceFiles);

        for (Iterator iter = resultManifest.getEntries().keySet().iterator(); iter.hasNext();) {
            String path = (String) iter.next();
            Attributes sourceAttribute = (Attributes) resultManifest.getEntries().get(path);
            if ("true".equals(sourceAttribute.remove(new Name(Constants.DEPLOYMENTPACKAGE_MISSING)))) {
                targetFiles.remove(path);
            }
        }

        for (Iterator iter = targetFiles.iterator(); iter.hasNext();) {
View Full Code Here

   */
  public void mergeManifest(Manifest manifest) throws IOException {
    if (manifest != null) {
      Attributes attributes = manifest.getMainAttributes();
      for (Iterator<Object> i = attributes.keySet().iterator(); i.hasNext();) {
        Name name = (Name) i.next();
        String key = name.toString();
        // Dont want instructions
        if (key.startsWith("-"))
          continue;

        if (getProperty(key) == null)
View Full Code Here

        {
            return Name.SPECIFICATION_VERSION;
        }
        else
        {
            return new Name(attrName);
        }
    }
View Full Code Here

     * Retrives the attribute with the specified name. The default
     * implementation simply throws an exception.
     */
    public Object getAttribute(String attrName) throws FileSystemException
    {
        final Name name = lookupName(attrName);
        return getAttribute(name);
    }
View Full Code Here

        List result = new ArrayList(targetFiles);

        File manifestFile = new File(source, (String) sourceFiles.remove(0));
        Manifest resultManifest = Utils.readManifest(manifestFile);

        resultManifest.getMainAttributes().remove(new Name(Constants.DEPLOYMENTPACKAGE_FIXPACK));

        for (Iterator i = result.iterator(); i.hasNext();) {
            String targetFile = (String) i.next();
            if (!"META-INF/MANIFEST.MF".equals(targetFile) && !resultManifest.getEntries().containsKey(targetFile)) {
                i.remove();
            }
        }

        for (Iterator iter = sourceFiles.iterator(); iter.hasNext();) {
            String path = (String) iter.next();
            File from = new File(source, path);
            File to = new File(target, path);
            if (targetFiles.contains(path)) {
                if (!to.delete()) {
                    throw new IOException("Could not delete " + to);
                }
            }
            else {
                result.add(path);
            }
            if (!rename(from, to)) {
                throw new IOException("Could not rename " + from + " to "  + to);
            }
        }

        targetFiles.removeAll(sourceFiles);

        for (Iterator iter = resultManifest.getEntries().keySet().iterator(); iter.hasNext();) {
            String path = (String) iter.next();
            Attributes sourceAttribute = (Attributes) resultManifest.getEntries().get(path);
            if ("true".equals(sourceAttribute.remove(new Name(Constants.DEPLOYMENTPACKAGE_MISSING)))) {
                targetFiles.remove(path);
            }
        }

        for (Iterator iter = targetFiles.iterator(); iter.hasNext();) {
View Full Code Here

TOP

Related Classes of java.util.jar.Attributes.Name

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.