blob: 745408771723f152c0dcb29a3bf5a34ffd1d509a [file] [log] [blame]
Stuart McCullochbb014372012-06-07 21:57:32 +00001package aQute.lib.osgi;
2
3import java.nio.charset.*;
4import java.util.*;
5import java.util.regex.*;
6
7public interface Constants {
8 /*
9 * Defined in OSGi
10 */
11 /**
12 * @syntax Bundle-ActivationPolicy ::= policy ( ’;’ directive )* policy ::=
13 * ’lazy’
14 */
Stuart McCulloch2286f232012-06-15 13:27:53 +000015 String BND_ADDXMLTOTEST = "Bnd-AddXMLToTest";
16 String BUNDLE_ACTIVATIONPOLICY = "Bundle-ActivationPolicy";
17 String BUNDLE_ACTIVATOR = "Bundle-Activator";
18 String BUNDLE_BLUEPRINT = "Bundle-Copyright";
19 String BUNDLE_CATEGORY = "Bundle-Category";
20 String BUNDLE_CLASSPATH = "Bundle-ClassPath";
21 String BUNDLE_CONTACTADDRESS = "Bundle-ContactAddress";
22 String BUNDLE_COPYRIGHT = "Bundle-Copyright";
23 String BUNDLE_DESCRIPTION = "Bundle-Description";
24 String BUNDLE_DOCURL = "Bundle-DocURL";
25 String BUNDLE_ICON = "Bundle-Icon";
26 String BUNDLE_LICENSE = "Bundle-License";
27 String BUNDLE_LOCALIZATION = "Bundle-Localization";
28 String BUNDLE_MANIFESTVERSION = "Bundle-ManifestVersion";
29 String BUNDLE_NAME = "Bundle-Name";
30 String BUNDLE_NATIVECODE = "Bundle-NativeCode";
31 String BUNDLE_REQUIREDEXECUTIONENVIRONMENT = "Bundle-RequiredExecutionEnvironment";
32 String BUNDLE_SYMBOLICNAME = "Bundle-SymbolicName";
33 String BUNDLE_UPDATELOCATION = "Bundle-UpdateLocation";
34 String BUNDLE_VENDOR = "Bundle-Vendor";
35 String BUNDLE_VERSION = "Bundle-Version";
36 String DYNAMICIMPORT_PACKAGE = "DynamicImport-Package";
37 String EXPORT_PACKAGE = "Export-Package";
38 String EXPORT_SERVICE = "Export-Service";
39 String FRAGMENT_HOST = "Fragment-Host";
40 String IMPORT_PACKAGE = "Import-Package";
41 String IMPORT_SERVICE = "Import-Service";
42 String PROVIDE_CAPABILITY = "Provide-Capability";
43 String REQUIRE_BUNDLE = "Require-Bundle";
44 String REQUIRE_CAPABILITY = "Require-Capability";
45 String SERVICE_COMPONENT = "Service-Component";
Stuart McCullochbb014372012-06-07 21:57:32 +000046
Stuart McCulloch2286f232012-06-15 13:27:53 +000047 String PRIVATE_PACKAGE = "Private-Package";
48 String IGNORE_PACKAGE = "Ignore-Package";
49 String INCLUDE_RESOURCE = "Include-Resource";
50 String CONDITIONAL_PACKAGE = "Conditional-Package";
51 String BND_LASTMODIFIED = "Bnd-LastModified";
52 String CREATED_BY = "Created-By";
53 String TOOL = "Tool";
54 String TESTCASES = "Test-Cases";
Stuart McCullochd4826102012-06-26 16:34:24 +000055 /**
56 * @deprecated Use {@link Constants#TESTCASES}.
57 */
58 @Deprecated
59 String TESTSUITES = "Test-Suites";
Stuart McCulloch2286f232012-06-15 13:27:53 +000060 String SIGNATURE_TEST = "-signaturetest";
Stuart McCullochbb014372012-06-07 21:57:32 +000061
Stuart McCulloch2286f232012-06-15 13:27:53 +000062 String headers[] = {
63 BUNDLE_ACTIVATOR, BUNDLE_CONTACTADDRESS, BUNDLE_COPYRIGHT, BUNDLE_DESCRIPTION, BUNDLE_DOCURL,
64 BUNDLE_LOCALIZATION, BUNDLE_NATIVECODE, BUNDLE_VENDOR, BUNDLE_VERSION, BUNDLE_LICENSE, BUNDLE_CLASSPATH,
65 SERVICE_COMPONENT, EXPORT_PACKAGE, IMPORT_PACKAGE, BUNDLE_LOCALIZATION, BUNDLE_MANIFESTVERSION,
66 BUNDLE_NAME, BUNDLE_NATIVECODE, BUNDLE_REQUIREDEXECUTIONENVIRONMENT, BUNDLE_SYMBOLICNAME, BUNDLE_VERSION,
67 FRAGMENT_HOST, PRIVATE_PACKAGE, IGNORE_PACKAGE, INCLUDE_RESOURCE, REQUIRE_BUNDLE, IMPORT_SERVICE,
68 EXPORT_SERVICE, CONDITIONAL_PACKAGE, BND_LASTMODIFIED, TESTCASES, SIGNATURE_TEST, REQUIRE_CAPABILITY,
69 PROVIDE_CAPABILITY
70 };
Stuart McCullochbb014372012-06-07 21:57:32 +000071
Stuart McCulloch2286f232012-06-15 13:27:53 +000072 String BUILDPATH = "-buildpath";
73 String BUILDPACKAGES = "-buildpackages";
74 String BUMPPOLICY = "-bumppolicy";
75 String CONDUIT = "-conduit";
76 String COMPILER_SOURCE = "-source";
77 String COMPILER_TARGET = "-target";
78 String DEPENDSON = "-dependson";
79 String DEPLOY = "-deploy";
80 String DEPLOYREPO = "-deployrepo";
81 String DIGESTS = "-digests";
82 String DSANNOTATIONS = "-dsannotations";
83 String DONOTCOPY = "-donotcopy";
84 String DEBUG = "-debug";
85 String EXPORT_CONTENTS = "-exportcontents";
86 String FAIL_OK = "-failok";
87 String INCLUDE = "-include";
88 String INCLUDERESOURCE = "-includeresource";
89 String MAKE = "-make";
90 String METATYPE = "-metatype";
91 String MANIFEST = "-manifest";
92 String SAVEMANIFEST = "-savemanifest";
93 String NAMESECTION = "-namesection";
94 String NODEFAULTVERSION = "-nodefaultversion";
95 String NOEXTRAHEADERS = "-noextraheaders";
96 String NOMANIFEST = "-nomanifest";
97 String NOUSES = "-nouses";
Stuart McCulloch2286f232012-06-15 13:27:53 +000098 String NOBUNDLES = "-nobundles";
99 String PEDANTIC = "-pedantic";
100 String PLUGIN = "-plugin";
101 String PLUGINPATH = "-pluginpath";
102 String POM = "-pom";
103 String RELEASEREPO = "-releaserepo";
104 String REMOVEHEADERS = "-removeheaders";
105 String RESOURCEONLY = "-resourceonly";
106 String SOURCES = "-sources";
107 String SOURCEPATH = "-sourcepath";
108 String SUB = "-sub";
109 String RUNPROPERTIES = "-runproperties";
110 String RUNSYSTEMPACKAGES = "-runsystempackages";
111 String RUNBUNDLES = "-runbundles";
Stuart McCullochd4826102012-06-26 16:34:24 +0000112 String RUNREPOS = "-runrepos";
Stuart McCulloch2286f232012-06-15 13:27:53 +0000113 String RUNPATH = "-runpath";
114 String RUNSTORAGE = "-runstorage";
115 String RUNBUILDS = "-runbuilds";
116 String RUNPATH_MAIN_DIRECTIVE = "main:";
117 String RUNPATH_LAUNCHER_DIRECTIVE = "launcher:";
118 String RUNVM = "-runvm";
119 String RUNTRACE = "-runtrace";
120 String RUNFRAMEWORK = "-runframework";
121 String RUNTIMEOUT = "-runtimeout";
122 String SNAPSHOT = "-snapshot";
123 String RUNFRAMEWORK_SERVICES = "services";
124 String RUNFRAMEWORK_NONE = "none";
125 String REPORTNEWER = "-reportnewer";
126 String SIGN = "-sign";
127 String TESTPACKAGES = "-testpackages";
128 String TESTREPORT = "-testreport";
129 String TESTPATH = "-testpath";
130 String TESTCONTINUOUS = "-testcontinuous";
131 String UNDERTEST = "-undertest";
132 String VERBOSE = "-verbose";
Stuart McCulloch2286f232012-06-15 13:27:53 +0000133 String PROVIDER_POLICY = "-provider-policy";
134 String CONSUMER_POLICY = "-consumer-policy";
Stuart McCulloch2286f232012-06-15 13:27:53 +0000135 String WAB = "-wab";
136 String WABLIB = "-wablib";
137 String REQUIRE_BND = "-require-bnd";
Stuart McCullochbb014372012-06-07 21:57:32 +0000138
139 // Deprecated
Stuart McCulloch2286f232012-06-15 13:27:53 +0000140 String CLASSPATH = "-classpath";
141 String OUTPUT = "-output";
Stuart McCullochbb014372012-06-07 21:57:32 +0000142
Stuart McCulloch2286f232012-06-15 13:27:53 +0000143 String options[] = {
144 BUILDPATH, BUMPPOLICY, CONDUIT, CLASSPATH, CONSUMER_POLICY, DEPENDSON, DONOTCOPY, EXPORT_CONTENTS, FAIL_OK,
145 INCLUDE, INCLUDERESOURCE, MAKE, MANIFEST, NOEXTRAHEADERS, NOUSES, NOBUNDLES, PEDANTIC, PLUGIN, POM,
146 PROVIDER_POLICY, REMOVEHEADERS, RESOURCEONLY, SOURCES, SOURCEPATH, SOURCES, SOURCEPATH, SUB, RUNBUNDLES,
147 RUNPATH, RUNSYSTEMPACKAGES, RUNPROPERTIES, REPORTNEWER, UNDERTEST, TESTPATH, TESTPACKAGES, TESTREPORT,
148 VERBOSE, NOMANIFEST, DEPLOYREPO, RELEASEREPO, SAVEMANIFEST, RUNVM, WAB, WABLIB, RUNFRAMEWORK, RUNTRACE,
149 TESTCONTINUOUS, SNAPSHOT, NAMESECTION, DIGESTS, DSANNOTATIONS
150 };
Stuart McCullochbb014372012-06-07 21:57:32 +0000151
152 // Ignore bundle specific headers. These bundles do not make
153 // a lot of sense to inherit
Stuart McCulloch2286f232012-06-15 13:27:53 +0000154 String[] BUNDLE_SPECIFIC_HEADERS = new String[] {
155 INCLUDE_RESOURCE, BUNDLE_ACTIVATOR, BUNDLE_CLASSPATH, BUNDLE_NAME, BUNDLE_NATIVECODE, BUNDLE_SYMBOLICNAME,
156 IMPORT_PACKAGE, EXPORT_PACKAGE, DYNAMICIMPORT_PACKAGE, FRAGMENT_HOST, REQUIRE_BUNDLE, PRIVATE_PACKAGE,
157 EXPORT_CONTENTS, TESTCASES, NOMANIFEST, SIGNATURE_TEST, WAB, WABLIB, REQUIRE_CAPABILITY,
158 PROVIDE_CAPABILITY, DSANNOTATIONS, SERVICE_COMPONENT
159 };
Stuart McCullochbb014372012-06-07 21:57:32 +0000160
Stuart McCulloch2286f232012-06-15 13:27:53 +0000161 char DUPLICATE_MARKER = '~';
162 String SPECIFICATION_VERSION = "specification-version";
163 String SPLIT_PACKAGE_DIRECTIVE = "-split-package:";
164 String IMPORT_DIRECTIVE = "-import:";
165 String NO_IMPORT_DIRECTIVE = "-noimport:";
166 String REMOVE_ATTRIBUTE_DIRECTIVE = "-remove-attribute:";
167 String LIB_DIRECTIVE = "lib:";
168 String NOANNOTATIONS = "-noannotations";
169 String COMMAND_DIRECTIVE = "command:";
170 String USES_DIRECTIVE = "uses:";
171 String MANDATORY_DIRECTIVE = "mandatory:";
172 String INCLUDE_DIRECTIVE = "include:";
173 String PROVIDE_DIRECTIVE = "provide:";
174 String EXCLUDE_DIRECTIVE = "exclude:";
175 String PRESENCE_DIRECTIVE = "presence:";
176 String PRIVATE_DIRECTIVE = "private:";
177 String SINGLETON_DIRECTIVE = "singleton:";
178 String EXTENSION_DIRECTIVE = "extension:";
179 String VISIBILITY_DIRECTIVE = "visibility:";
180 String FRAGMENT_ATTACHMENT_DIRECTIVE = "fragment-attachment:";
181 String RESOLUTION_DIRECTIVE = "resolution:";
182 String PATH_DIRECTIVE = "path:";
183 String SIZE_ATTRIBUTE = "size";
184 String LINK_ATTRIBUTE = "link";
185 String NAME_ATTRIBUTE = "name";
186 String DESCRIPTION_ATTRIBUTE = "description";
187 String OSNAME_ATTRIBUTE = "osname";
188 String OSVERSION_ATTRIBUTE = "osversion";
189 String PROCESSOR_ATTRIBUTE = "processor";
190 String LANGUAGE_ATTRIBUTE = "language";
191 String SELECTION_FILTER_ATTRIBUTE = "selection-filter";
192 String BLUEPRINT_WAIT_FOR_DEPENDENCIES_ATTRIBUTE = "blueprint.wait-for-dependencies";
193 String BLUEPRINT_TIMEOUT_ATTRIBUTE = "blueprint.timeout";
194 String VERSION_ATTRIBUTE = "version";
195 String BUNDLE_SYMBOLIC_NAME_ATTRIBUTE = "bundle-symbolic-name";
196 String BUNDLE_VERSION_ATTRIBUTE = "bundle-version";
197 String FROM_DIRECTIVE = "from:";
Stuart McCullochbb014372012-06-07 21:57:32 +0000198
Stuart McCulloch2286f232012-06-15 13:27:53 +0000199 String KEYSTORE_LOCATION_DIRECTIVE = "keystore:";
200 String KEYSTORE_PROVIDER_DIRECTIVE = "provider:";
201 String KEYSTORE_PASSWORD_DIRECTIVE = "password:";
202 String SIGN_PASSWORD_DIRECTIVE = "sign-password:";
Stuart McCullochbb014372012-06-07 21:57:32 +0000203
Stuart McCulloch2286f232012-06-15 13:27:53 +0000204 String NONE = "none";
Stuart McCullochbb014372012-06-07 21:57:32 +0000205
Stuart McCulloch2286f232012-06-15 13:27:53 +0000206 String directives[] = {
207 SPLIT_PACKAGE_DIRECTIVE, NO_IMPORT_DIRECTIVE, IMPORT_DIRECTIVE, RESOLUTION_DIRECTIVE, INCLUDE_DIRECTIVE,
208 USES_DIRECTIVE, EXCLUDE_DIRECTIVE, KEYSTORE_LOCATION_DIRECTIVE, KEYSTORE_PROVIDER_DIRECTIVE,
209 KEYSTORE_PASSWORD_DIRECTIVE, SIGN_PASSWORD_DIRECTIVE, COMMAND_DIRECTIVE, NOANNOTATIONS, LIB_DIRECTIVE,
210 RUNPATH_LAUNCHER_DIRECTIVE, FROM_DIRECTIVE, PRIVATE_DIRECTIVE
Stuart McCullochbb014372012-06-07 21:57:32 +0000211
Stuart McCulloch2286f232012-06-15 13:27:53 +0000212 // TODO
213 };
Stuart McCullochbb014372012-06-07 21:57:32 +0000214
Stuart McCulloch2286f232012-06-15 13:27:53 +0000215 String USES_USES = "<<USES>>";
216 String CURRENT_USES = "@uses";
217 String IMPORT_REFERENCE = "reference";
218 String IMPORT_PRIVATE = "private";
219 String[] importDirectives = {
220 IMPORT_REFERENCE, IMPORT_PRIVATE
221 };
Stuart McCullochbb014372012-06-07 21:57:32 +0000222
Stuart McCulloch2286f232012-06-15 13:27:53 +0000223 static final Pattern VALID_PROPERTY_TYPES = Pattern
224 .compile("(String|Long|Double|Float|Integer|Byte|Character|Boolean|Short)");
Stuart McCullochbb014372012-06-07 21:57:32 +0000225
Stuart McCulloch2286f232012-06-15 13:27:53 +0000226 String DEFAULT_BND_EXTENSION = ".bnd";
227 String DEFAULT_JAR_EXTENSION = ".jar";
228 String DEFAULT_BAR_EXTENSION = ".bar";
229 String DEFAULT_BNDRUN_EXTENSION = ".bndrun";
230 String[] METAPACKAGES = {
231 "META-INF", "OSGI-INF", "OSGI-OPT"
232 };
Stuart McCullochbb014372012-06-07 21:57:32 +0000233
Stuart McCulloch2286f232012-06-15 13:27:53 +0000234 String CURRENT_VERSION = "@";
235 String CURRENT_PACKAGE = "@package";
Stuart McCullochbb014372012-06-07 21:57:32 +0000236
Stuart McCulloch2286f232012-06-15 13:27:53 +0000237 String BUILDFILES = "buildfiles";
Stuart McCullochbb014372012-06-07 21:57:32 +0000238
Stuart McCulloch2286f232012-06-15 13:27:53 +0000239 String EMPTY_HEADER = "<<EMPTY>>";
Stuart McCullochbb014372012-06-07 21:57:32 +0000240
Stuart McCulloch2286f232012-06-15 13:27:53 +0000241 String EMBEDDED_REPO = "/embedded-repo.jar";
242 String LAUNCHER_PLUGIN = "Launcher-Plugin";
243 String TESTER_PLUGIN = "Tester-Plugin";
Stuart McCullochbb014372012-06-07 21:57:32 +0000244
Stuart McCulloch2286f232012-06-15 13:27:53 +0000245 String DEFAULT_LAUNCHER_BSN = "biz.aQute.launcher";
246 String DEFAULT_TESTER_BSN = "biz.aQute.junit";
Stuart McCullochbb014372012-06-07 21:57:32 +0000247
Stuart McCulloch2286f232012-06-15 13:27:53 +0000248 String DEFAULT_DO_NOT_COPY = "CVS|\\.svn|\\.git|\\.DS_Store";
Stuart McCullochbb014372012-06-07 21:57:32 +0000249
Stuart McCulloch2286f232012-06-15 13:27:53 +0000250 Charset DEFAULT_CHARSET = Charset.forName("UTF8");
251 String VERSION_FILTER = "version";
252 String PROVIDER_TYPE_DIRECTIVE = "x-provider-type:";
Stuart McCullochbb014372012-06-07 21:57:32 +0000253
254 /**
255 * Component constants
256 */
Stuart McCulloch2286f232012-06-15 13:27:53 +0000257 public final static String NAMESPACE_STEM = "http://www.osgi.org/xmlns/scr";
258 public final static String JIDENTIFIER = "<<identifier>>";
259 public final static String COMPONENT_NAME = "name:";
260 public final static String COMPONENT_FACTORY = "factory:";
261 public final static String COMPONENT_SERVICEFACTORY = "servicefactory:";
262 public final static String COMPONENT_IMMEDIATE = "immediate:";
263 public final static String COMPONENT_ENABLED = "enabled:";
264 public final static String COMPONENT_DYNAMIC = "dynamic:";
265 public final static String COMPONENT_MULTIPLE = "multiple:";
266 public final static String COMPONENT_PROVIDE = "provide:";
267 public final static String COMPONENT_OPTIONAL = "optional:";
268 public final static String COMPONENT_PROPERTIES = "properties:";
269 public final static String COMPONENT_IMPLEMENTATION = "implementation:";
270 public final static String COMPONENT_DESIGNATE = "designate:";
271 public final static String COMPONENT_DESIGNATEFACTORY = "designateFactory:";
272 public final static String COMPONENT_DESCRIPTORS = ".descriptors:";
Stuart McCullochbb014372012-06-07 21:57:32 +0000273
274 // v1.1.0
Stuart McCulloch2286f232012-06-15 13:27:53 +0000275 public final static String COMPONENT_VERSION = "version:";
276 public final static String COMPONENT_CONFIGURATION_POLICY = "configuration-policy:";
277 public final static String COMPONENT_MODIFIED = "modified:";
278 public final static String COMPONENT_ACTIVATE = "activate:";
279 public final static String COMPONENT_DEACTIVATE = "deactivate:";
Stuart McCullochbb014372012-06-07 21:57:32 +0000280
Stuart McCulloch2286f232012-06-15 13:27:53 +0000281 final static Map<String,String> EMPTY = Collections.emptyMap();
Stuart McCullochbb014372012-06-07 21:57:32 +0000282
Stuart McCulloch2286f232012-06-15 13:27:53 +0000283 public final static String[] componentDirectives = new String[] {
284 COMPONENT_FACTORY, COMPONENT_IMMEDIATE, COMPONENT_ENABLED, COMPONENT_DYNAMIC, COMPONENT_MULTIPLE,
285 COMPONENT_PROVIDE, COMPONENT_OPTIONAL, COMPONENT_PROPERTIES, COMPONENT_IMPLEMENTATION,
286 COMPONENT_SERVICEFACTORY, COMPONENT_VERSION, COMPONENT_CONFIGURATION_POLICY, COMPONENT_MODIFIED,
287 COMPONENT_ACTIVATE, COMPONENT_DEACTIVATE, COMPONENT_NAME, COMPONENT_DESCRIPTORS, COMPONENT_DESIGNATE,
288 COMPONENT_DESIGNATEFACTORY
289 };
Stuart McCullochbb014372012-06-07 21:57:32 +0000290
Stuart McCulloch2286f232012-06-15 13:27:53 +0000291 public final static Set<String> SET_COMPONENT_DIRECTIVES = new HashSet<String>(
292 Arrays.asList(componentDirectives));
Stuart McCullochbb014372012-06-07 21:57:32 +0000293
Stuart McCulloch2286f232012-06-15 13:27:53 +0000294 public final static Set<String> SET_COMPONENT_DIRECTIVES_1_1 = //
295 new HashSet<String>(Arrays.asList(
296 COMPONENT_VERSION,
297 COMPONENT_CONFIGURATION_POLICY,
298 COMPONENT_MODIFIED,
299 COMPONENT_ACTIVATE,
300 COMPONENT_DEACTIVATE));
Stuart McCullochbb014372012-06-07 21:57:32 +0000301
302}