001: /*
002: * ChainBuilder ESB
003: * Visual Enterprise Integration
004: *
005: * Copyright (C) 2008 Bostech Corporation
006: *
007: * This program is free software; you can redistribute it and/or modify it
008: * under the terms of the GNU General Public License as published by the
009: * Free Software Foundation; either version 2 of the License, or (at your option)
010: * any later version.
011: *
012: * This program is distributed in the hope that it will be useful,
013: * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
014: * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
015: * for more details.
016: *
017: * You should have received a copy of the GNU General Public License along with
018: * this program; if not, write to the Free Software Foundation, Inc.,
019: * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
020: *
021: *
022: * $Id$
023: */
024: package com.bostechcorp.cbesb.build.ant.util;
025:
026: import java.io.File;
027: import java.io.FileInputStream;
028: import java.util.Iterator;
029: import java.util.Map;
030: import java.util.jar.Attributes;
031: import java.util.jar.Manifest;
032: import java.util.jar.Attributes.Name;
033:
034: public class EclipseManifestFile {
035:
036: public static final String BUNDLE_NAME = "Bundle-Name";
037: public static final String BUNDLE_VENDOR = "Bundle-Vendor";
038: public static final String BUNDLE_MANIFEST_VERSION = "Bundle-ManifestVersion";
039: public static final String BUNDLE_LOCALIZATION = "Bundle-Localization";
040: public static final String BUNDLE_SYMBOLIC_NAME = "Bundle-SymbolicName";
041: public static final String MANIFEST_VERSION = "Manifest-Version";
042: public static final String EXPORT_PACKAGE = "Export-Package";
043: public static final String REQUIRE_BUNDLE = "Require-Bundle";
044: public static final String BUNDLE_VERSION = "Bundle-Version";
045: public static final String ECLIPSE_LAZY_START = "Eclipse-LazyStart";
046:
047: private String bundleName;
048: private String bundleVendor;
049: private String bundleManifestVersion;
050: private String bundleLocalization;
051: private String bundleSymbolicName;
052: private String manifestVersion;
053: private String exportPackage;
054: private String requireBundle;
055: private String bundleVersion;
056: private String eclipseLazyStart;
057:
058: public String getBundleLocalization() {
059: return bundleLocalization;
060: }
061:
062: public void setBundleLocalization(String bundleLocalization) {
063: this .bundleLocalization = bundleLocalization;
064: }
065:
066: public String getBundleManifestVersion() {
067: return bundleManifestVersion;
068: }
069:
070: public void setBundleManifestVersion(String bundleManifestVersion) {
071: this .bundleManifestVersion = bundleManifestVersion;
072: }
073:
074: public String getBundleName() {
075: return bundleName;
076: }
077:
078: public void setBundleName(String bundleName) {
079: this .bundleName = bundleName;
080: }
081:
082: public String getBundleSymbolicName() {
083: return bundleSymbolicName;
084: }
085:
086: public void setBundleSymbolicName(String bundleSymbolicName) {
087: this .bundleSymbolicName = bundleSymbolicName;
088: }
089:
090: public String getBundleVendor() {
091: return bundleVendor;
092: }
093:
094: public void setBundleVendor(String bundleVendor) {
095: this .bundleVendor = bundleVendor;
096: }
097:
098: public String getBundleVersion() {
099: return bundleVersion;
100: }
101:
102: public void setBundleVersion(String bundleVersion) {
103: this .bundleVersion = bundleVersion;
104: }
105:
106: public String getEclipseLazyStart() {
107: return eclipseLazyStart;
108: }
109:
110: public void setEclipseLazyStart(String eclipseLazyStart) {
111: this .eclipseLazyStart = eclipseLazyStart;
112: }
113:
114: public String getExportPackage() {
115: return exportPackage;
116: }
117:
118: public void setExportPackage(String exportPackage) {
119: this .exportPackage = exportPackage;
120: }
121:
122: public String getManifestVersion() {
123: return manifestVersion;
124: }
125:
126: public void setManifestVersion(String manifestVersion) {
127: this .manifestVersion = manifestVersion;
128: }
129:
130: public String getRequireBundle() {
131: return requireBundle;
132: }
133:
134: public void setRequireBundle(String requireBundle) {
135: this .requireBundle = requireBundle;
136: }
137:
138: public void load(File manifestFile) throws Exception {
139: FileInputStream fis = new FileInputStream(manifestFile);
140: Manifest manifest = new Manifest(fis);
141: Attributes mainAttrs = manifest.getMainAttributes();
142:
143: bundleName = mainAttrs.getValue(BUNDLE_NAME);
144: bundleVersion = mainAttrs.getValue(BUNDLE_VENDOR);
145: bundleManifestVersion = mainAttrs
146: .getValue(BUNDLE_MANIFEST_VERSION);
147: bundleLocalization = mainAttrs.getValue(BUNDLE_LOCALIZATION);
148: bundleSymbolicName = mainAttrs.getValue(BUNDLE_SYMBOLIC_NAME);
149: manifestVersion = mainAttrs.getValue(MANIFEST_VERSION);
150: exportPackage = mainAttrs.getValue(EXPORT_PACKAGE);
151: requireBundle = mainAttrs.getValue(REQUIRE_BUNDLE);
152: bundleVersion = mainAttrs.getValue(BUNDLE_VERSION);
153: eclipseLazyStart = mainAttrs.getValue(ECLIPSE_LAZY_START);
154:
155: }
156:
157: }
|