Package java.util.jar

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


     */
    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


    @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

 
  public SubsystemManifest(InputStream in) throws IOException {
    Manifest manifest = ManifestProcessor.parseManifest(in);
    Attributes attributes = manifest.getMainAttributes();
    Map<String, Header<?>> headers = new HashMap<String, Header<?>>(attributes.size() + 4); // Plus the # of potentially derived headers.
    for (Entry<Object, Object> entry : attributes.entrySet()) {
      String key = String.valueOf(entry.getKey());
      headers.put(key, HeaderFactory.createHeader(key, String.valueOf(entry.getValue())));
    }
    fillInDefaults(headers);
    this.headers = Collections.unmodifiableMap(headers);
View Full Code Here

 
  public DeploymentManifest(InputStream in) throws IOException {
    Manifest manifest = ManifestProcessor.parseManifest(in);
    Attributes attributes = manifest.getMainAttributes();
    Map<String, Header<?>> headers = new HashMap<String, Header<?>>(attributes.size() + 4); // Plus the # of potentially derived headers.
    for (Entry<Object, Object> entry : attributes.entrySet()) {
      String key = String.valueOf(entry.getKey());
      headers.put(key, HeaderFactory.createHeader(key, String.valueOf(entry.getValue())));
    }
    this.headers = Collections.unmodifiableMap(headers);
  }
View Full Code Here

      log("Setting " + propertyBundleVersionName + "=" + bundleVersion);
    }
   
    if (propertyPrefix != null) {
      log("Setting manifest entries to properties with prefix " + propertyPrefix);
      for (Entry<Object, Object> entry : attributes.entrySet()) {
        String name = ((Attributes.Name) entry.getKey()).toString();
        String value = (String) entry.getValue();
        getProject().setNewProperty(propertyPrefix + name, value);
        if (verbose) {
          log("Setting " + propertyPrefix + name + "=" + value);
View Full Code Here

                return new Properties();
            }

            Attributes mainAttributes = manifest.getMainAttributes();
            Properties newProps = new Properties();
            for (Map.Entry<Object, Object> entry : mainAttributes.entrySet()) {
                String name = entry.getKey().toString();
                String value = entry.getValue().toString();
                newProps.setProperty(name, value);
            }
            propertiesCache = newProps;
View Full Code Here

  private Map<String, String> readManifestIntoMap(Manifest mf){  
    HashMap<String, String> props = new HashMap<String, String>();
   
    Attributes mainAttrs = mf.getMainAttributes();
    if (mainAttrs!=null){
      Set<Entry<Object, Object>> attributeSet =  mainAttrs.entrySet();
      if (attributeSet != null){
        // Copy all the manifest headers across. The entry set should be a set of
        // Name to String mappings, by calling String.valueOf we do the conversion
        // to a string and we do not NPE.
        for (Map.Entry<Object, Object> entry : attributeSet) {
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.