Package java.util.jar

Examples of java.util.jar.Attributes$Name


                 */
                List sections = archiveConfig.getManifestSections();
                for ( Iterator i = sections.iterator(); i.hasNext(); )
                {
                    ManifestSection section = ( ManifestSection ) i.next();
                    Attributes attributes = new Attributes();

                    if ( !section.isManifestEntriesEmpty() )
                    {
                        Map entries = section.getManifestEntries();
                        for ( Iterator j = entries.entrySet().iterator(); j.hasNext(); )
                        {
                            Map.Entry entry = ( Map.Entry ) j.next();
                            attributes.putValue( ( String ) entry.getKey(), ( String ) entry.getValue() );
                        }
                    }

                    mavenManifest.getEntries().put( section.getName(), attributes );
                }
            }

            Attributes mainMavenAttributes = mavenManifest.getMainAttributes();
            mainMavenAttributes.putValue( "Created-By", "Apache Maven Bundle Plugin" );

            String[] removeHeaders = builder.getProperty( Constants.REMOVEHEADERS, "" ).split( "," );

            // apply -removeheaders to the custom manifest
            for ( int i = 0; i < removeHeaders.length; i++ )
            {
                for ( Iterator j = mainMavenAttributes.keySet().iterator(); j.hasNext(); )
                {
                    if ( j.next().toString().matches( removeHeaders[i].trim() ) )
                    {
                        j.remove();
                    }
View Full Code Here


        for (Map.Entry< ? , ? > entry : org.getMainAttributes().entrySet()) {
            String nice = clean((String) entry.getValue());
            result.getMainAttributes().put(entry.getKey(), nice);
        }
        for (String name : org.getEntries().keySet()) {
            Attributes attrs = result.getAttributes(name);
            if (attrs == null) {
                attrs = new Attributes();
                result.getEntries().put(name, attrs);
            }

            for (Map.Entry< ? , ? > entry : org.getAttributes(name).entrySet()) {
                String nice = clean((String) entry.getValue());
                attrs.put(entry.getKey(), nice);
            }
        }
        return result;
    }
View Full Code Here

     * given manifest.
     */
    protected boolean isPackageSealed(String name, Manifest man) {

        String path = name.replace('.', '/') + '/';
        Attributes attr = man.getAttributes(path);
        String sealed = null;
        if (attr != null) {
            sealed = attr.getValue(Name.SEALED);
        }
        if (sealed == null) {
            if ((attr = man.getMainAttributes()) != null) {
                sealed = attr.getValue(Name.SEALED);
            }
        }
        return "true".equalsIgnoreCase(sealed);

    }
View Full Code Here

        }

        private void initializePropertiesFromManifest(Manifest manifest) {
            containsDataFromManifest = true;

            Attributes attributes = manifest.getMainAttributes();
            implementationVendor = getAttributeValueOrDefault(attributes, "Implementation-Vendor");
            implementationVersion = getAttributeValueOrDefault(attributes, "Implementation-Version");
            implementationTitle = getAttributeValueOrDefault(attributes, "Implementation-Title");
            scmTimestamp = getAttributeValueOrDefault(attributes, "SCM-Timestamp");
        }
View Full Code Here

        try {
            oldMF = jar.getManifest();
        } catch (IOException e) {
            e.printStackTrace();
        }
        Attributes mainAttributes = oldMF.getMainAttributes();

        String existingExportPackage = mainAttributes
                .getValue(EXPORT_PACKAGE_ATTRIBUTE);
        if (existingExportPackage != null) {
            exportPackage = existingExportPackage + "," + exportPackage;
        }
View Full Code Here

                    if (is == null) {
                        continue;
                    }
                    // Read manifest attributes
                    Manifest manifest = new Manifest(is);
                    Attributes attribs = manifest.getMainAttributes();
                    String license = attribs.getValue(VAADIN_ADDON_LICENSE);
                    String name = attribs.getValue(VAADIN_ADDON_NAME);
                    String vers = attribs.getValue(VAADIN_ADDON_VERSION) == null ? ""
                            : attribs.getValue(VAADIN_ADDON_VERSION);
                    String title = attribs.getValue(VAADIN_ADDON_TITLE) == null ? name
                            : attribs.getValue(VAADIN_ADDON_TITLE);

                    String widgetsets = attribs
                            .getValue(VAADIN_ADDON_WIDGETSET) == null ? name
                            : attribs.getValue(VAADIN_ADDON_WIDGETSET);

                    if (name == null || license == null) {
                        continue;
                    }
                    if (VAADIN_AGPL.equals(license)) {
View Full Code Here

            Manifest bundleManifest = jis.getManifest();
            if (bundleManifest == null) {
                throw new RuntimeException("Not a valid manifest in: " + m_url);
            }

            Attributes attributes = bundleManifest.getMainAttributes();

            if (m_symbolicName == null || "".equals(m_symbolicName.trim())) {
                setSymbolicName(getRequiredHeader(attributes, "Bundle-SymbolicName"));
            }
View Full Code Here

        return this;
    }

    private Manifest createManifest(List<ArtifactData> files) throws Exception {
        Manifest manifest = new Manifest();
        Attributes main = manifest.getMainAttributes();
        main.putValue("Manifest-Version", "1.0");
        main.putValue("DeploymentPackage-SymbolicName", m_symbolicName);
        main.putValue("DeploymentPackage-Version", m_version);

        if ((m_fixPackageVersion != null) && !"".equals(m_fixPackageVersion)) {
            main.putValue("DeploymentPackage-FixPack", m_fixPackageVersion);
        }

        Map<String, Attributes> entries = manifest.getEntries();

        Iterator<ArtifactData> filesIter = files.iterator();
        while (filesIter.hasNext()) {
            ArtifactData file = filesIter.next();

            Attributes a = new Attributes();
            a.putValue("Name", file.getFilename());

            if (file.isBundle()) {
                a.putValue("Bundle-SymbolicName", file.getSymbolicName());
                a.putValue("Bundle-Version", file.getVersion());
                if (file.isCustomizer()) {
                    a.putValue("DeploymentPackage-Customizer", "true");
                    a.putValue("Deployment-ProvidesResourceProcessor", file.getProcessorPid());
                }
            }
            else {
                a.putValue("Resource-Processor", file.getProcessorPid());
            }

            if (file.isMissing()) {
                a.putValue("DeploymentPackage-Missing", "true");
            }

            entries.put(file.getFilename(), a);
        }
View Full Code Here

                    int read = jis.read(buf);

                    JarInputStream jis2 = new JarInputStream(new ByteArrayInputStream(Arrays.copyOf(buf, read)));
                    Manifest manifest2 = jis2.getManifest();

                    Attributes mainAttributes = manifest2.getMainAttributes();
                    assertEquals("1.1.0", mainAttributes.getValue("Bundle-Version"));
                    assertEquals("bar", mainAttributes.getValue("Foo"));
                   
                    jis2.close();
                }
                jis.closeEntry();
            }
View Full Code Here

        assertEquals(headerName, expectedValue, attributes.getValue(headerName));
    }

    private void assertManifestEntry(Manifest manifest, String key, String headerName, String expectedValue)
        throws RuntimeException {
        Attributes attributes = manifest.getEntries().get(key);
        assertNotNull("No attributes found for: " + key, attributes);
        assertAttributes(attributes, headerName, expectedValue);
    }
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.