Package java.util.jar

Examples of java.util.jar.Attributes.entrySet()


        return path;
    }

    static void addAttributes(Manifest manifest, List<JarManifestAttributes> attributes) {
        final Attributes mainAttribs = manifest.getMainAttributes();
        Set<Entry<Object, Object>> entrySet = mainAttribs.entrySet();
        for (Entry<Object, Object> entry : entrySet) {
            JarManifestAttributes attribute = JarManifestAttributes.attribute(entry);
            attributes.add(attribute);
        }
    }
View Full Code Here


    }


    private static String guessVersion(Manifest manifest) {
        final Attributes mainAttribs = manifest.getMainAttributes();
        Set<Entry<Object, Object>> entrySet = mainAttribs.entrySet();
        for (String candidate : VERSION_KEY_CANDIDATES) {
            for (Entry<Object, Object> entry : entrySet) {
                if(candidate.equals(entry.getKey().toString())) {
                    return entry.getValue().toString();
                }
View Full Code Here

    @Test(groups = { UNIT })
    public void testArtifactDataManifestGeneration() {
        Attributes B1NoFixpack = BUNDLE1.getManifestAttributes(false);
        assert B1NoFixpack.size() == 2;
        for (Map.Entry<Object, Object> entry : B1NoFixpack.entrySet()) {
            if (entry.getKey().toString().equals(Constants.BUNDLE_SYMBOLICNAME)) {
                assert entry.getValue().toString().equals(BUNDLE1.getSymbolicName());
            }
            else if (entry.getKey().toString().equals(Constants.BUNDLE_VERSION)) {
                assert entry.getValue().toString().equals(BUNDLE1.getVersion());
View Full Code Here

            }
        }

        Attributes B1Fixpack = BUNDLE1.getManifestAttributes(true);
        assert B1Fixpack.size() == 3;
        for (Map.Entry<Object, Object> entry : B1Fixpack.entrySet()) {
            if (entry.getKey().toString().equals(Constants.BUNDLE_SYMBOLICNAME)) {
                assert entry.getValue().toString().equals(BUNDLE1.getSymbolicName());
            }
            else if (entry.getKey().toString().equals(Constants.BUNDLE_VERSION)) {
                assert entry.getValue().toString().equals(BUNDLE1.getVersion());
View Full Code Here

            }
        }

        Attributes R1NoFixpack = RESOURCEPROCESSOR1.getManifestAttributes(false);
        assert R1NoFixpack.size() == 3 : "We expect 3 headers, but find " + R1NoFixpack.size();
        for (Map.Entry<Object, Object> entry : R1NoFixpack.entrySet()) {
            if (entry.getKey().toString().equals(Constants.BUNDLE_SYMBOLICNAME)) {
                assert entry.getValue().toString().equals(RESOURCEPROCESSOR1.getSymbolicName());
            }
            else if (entry.getKey().toString().equals(Constants.BUNDLE_VERSION)) {
                assert entry.getValue().toString().equals(RESOURCEPROCESSOR1.getVersion());
View Full Code Here

            }
        }

        Attributes A1NoFixpack = ARTIFACT1.getManifestAttributes(false);
        assert A1NoFixpack.size() == 1 : "We expect 1 headers, but find " + A1NoFixpack.size();
        for (Map.Entry<Object, Object> entry : A1NoFixpack.entrySet()) {
            if (entry.getKey().toString().equals(DIRECTIVE_KEY_PROCESSORID)) {
                assert entry.getValue().toString().equals("my.processor.pid");
            }
            else {
                assert false : "Unknown header found: " + entry.getKey().toString();
View Full Code Here

     */
    private Map<String, String> getManifestEntries(final Manifest manifest) {
        Attributes attributes = manifest.getMainAttributes();

        Map<String, String> entries = new HashMap<String, String>();
        for (Map.Entry<Object, Object> entry : attributes.entrySet()) {
            entries.put(entry.getKey().toString(), entry.getValue().toString());
        }
        return entries;
    }

View Full Code Here

            }
        }

        final OSGiManifestBuilder builder = OSGiManifestBuilder.newInstance();
        Attributes attributes = manifest.getMainAttributes();
        for (Entry<Object, Object> entry : attributes.entrySet()) {
            String key = entry.getKey().toString();
            String value = (String) entry.getValue();
            if (key.equals("Manifest-Version"))
                continue;
View Full Code Here

               
                // Is this the first line?
                boolean booleanFirstLine = true;
               
                // Returns an iterator over the attribute set.
                Iterator iterator = attributes.entrySet().iterator();
               
                // For every attribute in the set.
                while ( iterator.hasNext() ) {
                    // Get the next attribute.
                    Map.Entry entry = ( Map.Entry ) iterator.next();
View Full Code Here

            Manifest manifest, String entry) {
        Attributes attributes = (entry == null)
                ? manifest.getMainAttributes() : manifest.getAttributes(entry);
        StringBuilder line = new StringBuilder();
        if (attributes != null) {
            for (Map.Entry attr : attributes.entrySet()) {
                line.append(attr.getKey().toString()).append(": ").append((String) attr.getValue());
                appendLine(manifestEntry, line);
                line.setLength(0);
            }
        }
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.