KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > emf > codegen > ecore > templates > model > ManifestMF


1 package org.eclipse.emf.codegen.ecore.templates.model;
2
3 import java.util.*;
4 import org.eclipse.emf.codegen.ecore.genmodel.*;
5
6 public class ManifestMF
7 {
8   protected static String JavaDoc nl;
9   public static synchronized ManifestMF create(String JavaDoc lineSeparator)
10   {
11     nl = lineSeparator;
12     ManifestMF result = new ManifestMF();
13     nl = null;
14     return result;
15   }
16
17   protected final String JavaDoc NL = nl == null ? (System.getProperties().getProperty("line.separator")) : nl;
18   protected final String JavaDoc TEXT_1 = "Manifest-Version: 1.0" + NL + "Bundle-ManifestVersion: 2" + NL + "Bundle-Name: %pluginName" + NL + "Bundle-SymbolicName: ";
19   protected final String JavaDoc TEXT_2 = "; singleton:=true" + NL + "Bundle-Version: 1.0.0" + NL + "Bundle-ClassPath: ";
20   protected final String JavaDoc TEXT_3 = ".jar";
21   protected final String JavaDoc TEXT_4 = ".";
22   protected final String JavaDoc TEXT_5 = NL + "Bundle-Activator: ";
23   protected final String JavaDoc TEXT_6 = "$Implementation";
24   protected final String JavaDoc TEXT_7 = NL + "Bundle-Vendor: %providerName" + NL + "Bundle-Localization: plugin";
25   protected final String JavaDoc TEXT_8 = NL + "Export-Package: ";
26   protected final String JavaDoc TEXT_9 = ",";
27   protected final String JavaDoc TEXT_10 = NL + " ";
28   protected final String JavaDoc TEXT_11 = NL + "Require-Bundle: ";
29   protected final String JavaDoc TEXT_12 = ";visibility:=reexport";
30   protected final String JavaDoc TEXT_13 = ",";
31   protected final String JavaDoc TEXT_14 = NL + " ";
32   protected final String JavaDoc TEXT_15 = ";visibility:=reexport";
33   protected final String JavaDoc TEXT_16 = NL + "Eclipse-AutoStart: true";
34   protected final String JavaDoc TEXT_17 = NL;
35
36   public String JavaDoc generate(Object JavaDoc argument)
37   {
38     StringBuffer JavaDoc stringBuffer = new StringBuffer JavaDoc();
39     
40 /**
41  * <copyright>
42  *
43  * Copyright (c) 2005 IBM Corporation and others.
44  * All rights reserved. This program and the accompanying materials
45  * are made available under the terms of the Eclipse Public License v1.0
46  * which accompanies this distribution, and is available at
47  * http://www.eclipse.org/legal/epl-v10.html
48  *
49  * Contributors:
50  * IBM - Initial API and implementation
51  *
52  * </copyright>
53  */

54
55     GenModel genModel = (GenModel)argument;
56     stringBuffer.append(TEXT_1);
57     stringBuffer.append(genModel.getModelPluginID());
58     stringBuffer.append(TEXT_2);
59     if (genModel.isRuntimeJar()) {
60     stringBuffer.append(genModel.getModelPluginID());
61     stringBuffer.append(TEXT_3);
62     }else{
63     stringBuffer.append(TEXT_4);
64     }
65     if (genModel.hasModelPluginClass()) {
66     stringBuffer.append(TEXT_5);
67     stringBuffer.append(genModel.getQualifiedModelPluginClassName());
68     stringBuffer.append(TEXT_6);
69     }
70     stringBuffer.append(TEXT_7);
71     Iterator packagesIterator = genModel.getModelQualifiedPackageNames().iterator(); if (packagesIterator.hasNext()) { String JavaDoc pack = (String JavaDoc)packagesIterator.next();
72     stringBuffer.append(TEXT_8);
73     stringBuffer.append(pack);
74     while(packagesIterator.hasNext()) { pack = (String JavaDoc)packagesIterator.next();
75     stringBuffer.append(TEXT_9);
76     stringBuffer.append(TEXT_10);
77     stringBuffer.append(pack);
78     }
79     }
80     Iterator requiredPluginIterator = genModel.getModelRequiredPlugins().iterator(); if (requiredPluginIterator.hasNext()) { String JavaDoc pluginID = (String JavaDoc)requiredPluginIterator.next();
81     stringBuffer.append(TEXT_11);
82     stringBuffer.append(pluginID);
83     if (!pluginID.startsWith("org.eclipse.core.runtime")){
84     stringBuffer.append(TEXT_12);
85     } while(requiredPluginIterator.hasNext()) { pluginID = (String JavaDoc)requiredPluginIterator.next();
86     stringBuffer.append(TEXT_13);
87     stringBuffer.append(TEXT_14);
88     stringBuffer.append(pluginID);
89     if (!pluginID.startsWith("org.eclipse.core.runtime")){
90     stringBuffer.append(TEXT_15);
91     }}
92     }
93     stringBuffer.append(TEXT_16);
94     stringBuffer.append(TEXT_17);
95     return stringBuffer.toString();
96   }
97 }
98
Popular Tags