Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
/*******************************************************************************
 * Copyright (c) 2008, 2011 IBM Corporation and others.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *
 * Contributors:
 *     IBM Corporation - initial API and implementation
 *******************************************************************************/

import java.util.*;
import java.util.Map.Entry;
import java.util.jar.*;
import org.eclipse.osgi.internal.baseadaptor.BaseStorageHook;

import org.osgi.framework.*;

public class Main {
    private static Manifest getCompositeManifest(Map compositeManifest) {
        Manifest manifest = new Manifest();
        Attributes attributes = manifest.getMainAttributes();
        attributes.putValue("Manifest-Version", "1.0"); //$NON-NLS-1$//$NON-NLS-2$
        // get the common headers Bundle-ManifestVersion, Bundle-SymbolicName and Bundle-Version
        // get the manifest version from the map
        String manifestVersion = (String) compositeManifest.remove(Constants.BUNDLE_MANIFESTVERSION);
        // here we assume the validation got the correct version for us
        attributes.putValue(Constants.BUNDLE_MANIFESTVERSION, manifestVersion);
        // Ignore the Equinox composite bundle header
        compositeManifest.remove(BaseStorageHook.COMPOSITE_HEADER);
        attributes.putValue(BaseStorageHook.COMPOSITE_HEADER, BaseStorageHook.COMPOSITE_BUNDLE);
        for (Iterator entries = compositeManifest.entrySet().iterator(); entries.hasNext();) {
            Map.Entry entry = (Entry) entries.next();
            if (entry.getKey() instanceof String && entry.getValue() instanceof String)
                attributes.putValue((String) entry.getKey(), (String) entry.getValue());
        }
        return manifest;
    }
}