blob: df0bbf005e4eb5a9d4710b2da44a49b9a167afcc [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";
55 String SIGNATURE_TEST = "-signaturetest";
Stuart McCullochbb014372012-06-07 21:57:32 +000056
Stuart McCulloch2286f232012-06-15 13:27:53 +000057 String headers[] = {
58 BUNDLE_ACTIVATOR, BUNDLE_CONTACTADDRESS, BUNDLE_COPYRIGHT, BUNDLE_DESCRIPTION, BUNDLE_DOCURL,
59 BUNDLE_LOCALIZATION, BUNDLE_NATIVECODE, BUNDLE_VENDOR, BUNDLE_VERSION, BUNDLE_LICENSE, BUNDLE_CLASSPATH,
60 SERVICE_COMPONENT, EXPORT_PACKAGE, IMPORT_PACKAGE, BUNDLE_LOCALIZATION, BUNDLE_MANIFESTVERSION,
61 BUNDLE_NAME, BUNDLE_NATIVECODE, BUNDLE_REQUIREDEXECUTIONENVIRONMENT, BUNDLE_SYMBOLICNAME, BUNDLE_VERSION,
62 FRAGMENT_HOST, PRIVATE_PACKAGE, IGNORE_PACKAGE, INCLUDE_RESOURCE, REQUIRE_BUNDLE, IMPORT_SERVICE,
63 EXPORT_SERVICE, CONDITIONAL_PACKAGE, BND_LASTMODIFIED, TESTCASES, SIGNATURE_TEST, REQUIRE_CAPABILITY,
64 PROVIDE_CAPABILITY
65 };
Stuart McCullochbb014372012-06-07 21:57:32 +000066
Stuart McCulloch2286f232012-06-15 13:27:53 +000067 String BUILDPATH = "-buildpath";
68 String BUILDPACKAGES = "-buildpackages";
69 String BUMPPOLICY = "-bumppolicy";
70 String CONDUIT = "-conduit";
71 String COMPILER_SOURCE = "-source";
72 String COMPILER_TARGET = "-target";
73 String DEPENDSON = "-dependson";
74 String DEPLOY = "-deploy";
75 String DEPLOYREPO = "-deployrepo";
76 String DIGESTS = "-digests";
77 String DSANNOTATIONS = "-dsannotations";
78 String DONOTCOPY = "-donotcopy";
79 String DEBUG = "-debug";
80 String EXPORT_CONTENTS = "-exportcontents";
81 String FAIL_OK = "-failok";
82 String INCLUDE = "-include";
83 String INCLUDERESOURCE = "-includeresource";
84 String MAKE = "-make";
85 String METATYPE = "-metatype";
86 String MANIFEST = "-manifest";
87 String SAVEMANIFEST = "-savemanifest";
88 String NAMESECTION = "-namesection";
89 String NODEFAULTVERSION = "-nodefaultversion";
90 String NOEXTRAHEADERS = "-noextraheaders";
91 String NOMANIFEST = "-nomanifest";
92 String NOUSES = "-nouses";
Stuart McCulloch285034f2012-06-12 12:41:16 +000093 @Deprecated
Stuart McCulloch2286f232012-06-15 13:27:53 +000094 String NOPE = "-nope";
95 String NOBUNDLES = "-nobundles";
96 String PEDANTIC = "-pedantic";
97 String PLUGIN = "-plugin";
98 String PLUGINPATH = "-pluginpath";
99 String POM = "-pom";
100 String RELEASEREPO = "-releaserepo";
101 String REMOVEHEADERS = "-removeheaders";
102 String RESOURCEONLY = "-resourceonly";
103 String SOURCES = "-sources";
104 String SOURCEPATH = "-sourcepath";
105 String SUB = "-sub";
106 String RUNPROPERTIES = "-runproperties";
107 String RUNSYSTEMPACKAGES = "-runsystempackages";
108 String RUNBUNDLES = "-runbundles";
109 String RUNPATH = "-runpath";
110 String RUNSTORAGE = "-runstorage";
111 String RUNBUILDS = "-runbuilds";
112 String RUNPATH_MAIN_DIRECTIVE = "main:";
113 String RUNPATH_LAUNCHER_DIRECTIVE = "launcher:";
114 String RUNVM = "-runvm";
115 String RUNTRACE = "-runtrace";
116 String RUNFRAMEWORK = "-runframework";
117 String RUNTIMEOUT = "-runtimeout";
118 String SNAPSHOT = "-snapshot";
119 String RUNFRAMEWORK_SERVICES = "services";
120 String RUNFRAMEWORK_NONE = "none";
121 String REPORTNEWER = "-reportnewer";
122 String SIGN = "-sign";
123 String TESTPACKAGES = "-testpackages";
124 String TESTREPORT = "-testreport";
125 String TESTPATH = "-testpath";
126 String TESTCONTINUOUS = "-testcontinuous";
127 String UNDERTEST = "-undertest";
128 String VERBOSE = "-verbose";
Stuart McCulloch285034f2012-06-12 12:41:16 +0000129 @Deprecated
Stuart McCulloch2286f232012-06-15 13:27:53 +0000130 String VERSIONPOLICY_IMPL = "-versionpolicy-impl";
Stuart McCulloch285034f2012-06-12 12:41:16 +0000131 @Deprecated
Stuart McCulloch2286f232012-06-15 13:27:53 +0000132 String VERSIONPOLICY_USES = "-versionpolicy-uses";
133 String PROVIDER_POLICY = "-provider-policy";
134 String CONSUMER_POLICY = "-consumer-policy";
Stuart McCulloch285034f2012-06-12 12:41:16 +0000135 @Deprecated
Stuart McCulloch2286f232012-06-15 13:27:53 +0000136 String VERSIONPOLICY = "-versionpolicy";
137 String WAB = "-wab";
138 String WABLIB = "-wablib";
139 String REQUIRE_BND = "-require-bnd";
Stuart McCullochbb014372012-06-07 21:57:32 +0000140
141 // Deprecated
Stuart McCulloch2286f232012-06-15 13:27:53 +0000142 String CLASSPATH = "-classpath";
143 String OUTPUT = "-output";
Stuart McCullochbb014372012-06-07 21:57:32 +0000144
Stuart McCulloch2286f232012-06-15 13:27:53 +0000145 String options[] = {
146 BUILDPATH, BUMPPOLICY, CONDUIT, CLASSPATH, CONSUMER_POLICY, DEPENDSON, DONOTCOPY, EXPORT_CONTENTS, FAIL_OK,
147 INCLUDE, INCLUDERESOURCE, MAKE, MANIFEST, NOEXTRAHEADERS, NOUSES, NOBUNDLES, PEDANTIC, PLUGIN, POM,
148 PROVIDER_POLICY, REMOVEHEADERS, RESOURCEONLY, SOURCES, SOURCEPATH, SOURCES, SOURCEPATH, SUB, RUNBUNDLES,
149 RUNPATH, RUNSYSTEMPACKAGES, RUNPROPERTIES, REPORTNEWER, UNDERTEST, TESTPATH, TESTPACKAGES, TESTREPORT,
150 VERBOSE, NOMANIFEST, DEPLOYREPO, RELEASEREPO, SAVEMANIFEST, RUNVM, WAB, WABLIB, RUNFRAMEWORK, RUNTRACE,
151 TESTCONTINUOUS, SNAPSHOT, NAMESECTION, DIGESTS, DSANNOTATIONS
152 };
Stuart McCullochbb014372012-06-07 21:57:32 +0000153
154 // Ignore bundle specific headers. These bundles do not make
155 // a lot of sense to inherit
Stuart McCulloch2286f232012-06-15 13:27:53 +0000156 String[] BUNDLE_SPECIFIC_HEADERS = new String[] {
157 INCLUDE_RESOURCE, BUNDLE_ACTIVATOR, BUNDLE_CLASSPATH, BUNDLE_NAME, BUNDLE_NATIVECODE, BUNDLE_SYMBOLICNAME,
158 IMPORT_PACKAGE, EXPORT_PACKAGE, DYNAMICIMPORT_PACKAGE, FRAGMENT_HOST, REQUIRE_BUNDLE, PRIVATE_PACKAGE,
159 EXPORT_CONTENTS, TESTCASES, NOMANIFEST, SIGNATURE_TEST, WAB, WABLIB, REQUIRE_CAPABILITY,
160 PROVIDE_CAPABILITY, DSANNOTATIONS, SERVICE_COMPONENT
161 };
Stuart McCullochbb014372012-06-07 21:57:32 +0000162
Stuart McCulloch2286f232012-06-15 13:27:53 +0000163 char DUPLICATE_MARKER = '~';
164 String SPECIFICATION_VERSION = "specification-version";
165 String SPLIT_PACKAGE_DIRECTIVE = "-split-package:";
166 String IMPORT_DIRECTIVE = "-import:";
167 String NO_IMPORT_DIRECTIVE = "-noimport:";
168 String REMOVE_ATTRIBUTE_DIRECTIVE = "-remove-attribute:";
169 String LIB_DIRECTIVE = "lib:";
170 String NOANNOTATIONS = "-noannotations";
171 String COMMAND_DIRECTIVE = "command:";
172 String USES_DIRECTIVE = "uses:";
173 String MANDATORY_DIRECTIVE = "mandatory:";
174 String INCLUDE_DIRECTIVE = "include:";
175 String PROVIDE_DIRECTIVE = "provide:";
176 String EXCLUDE_DIRECTIVE = "exclude:";
177 String PRESENCE_DIRECTIVE = "presence:";
178 String PRIVATE_DIRECTIVE = "private:";
179 String SINGLETON_DIRECTIVE = "singleton:";
180 String EXTENSION_DIRECTIVE = "extension:";
181 String VISIBILITY_DIRECTIVE = "visibility:";
182 String FRAGMENT_ATTACHMENT_DIRECTIVE = "fragment-attachment:";
183 String RESOLUTION_DIRECTIVE = "resolution:";
184 String PATH_DIRECTIVE = "path:";
185 String SIZE_ATTRIBUTE = "size";
186 String LINK_ATTRIBUTE = "link";
187 String NAME_ATTRIBUTE = "name";
188 String DESCRIPTION_ATTRIBUTE = "description";
189 String OSNAME_ATTRIBUTE = "osname";
190 String OSVERSION_ATTRIBUTE = "osversion";
191 String PROCESSOR_ATTRIBUTE = "processor";
192 String LANGUAGE_ATTRIBUTE = "language";
193 String SELECTION_FILTER_ATTRIBUTE = "selection-filter";
194 String BLUEPRINT_WAIT_FOR_DEPENDENCIES_ATTRIBUTE = "blueprint.wait-for-dependencies";
195 String BLUEPRINT_TIMEOUT_ATTRIBUTE = "blueprint.timeout";
196 String VERSION_ATTRIBUTE = "version";
197 String BUNDLE_SYMBOLIC_NAME_ATTRIBUTE = "bundle-symbolic-name";
198 String BUNDLE_VERSION_ATTRIBUTE = "bundle-version";
199 String FROM_DIRECTIVE = "from:";
Stuart McCullochbb014372012-06-07 21:57:32 +0000200
Stuart McCulloch2286f232012-06-15 13:27:53 +0000201 String KEYSTORE_LOCATION_DIRECTIVE = "keystore:";
202 String KEYSTORE_PROVIDER_DIRECTIVE = "provider:";
203 String KEYSTORE_PASSWORD_DIRECTIVE = "password:";
204 String SIGN_PASSWORD_DIRECTIVE = "sign-password:";
Stuart McCullochbb014372012-06-07 21:57:32 +0000205
Stuart McCulloch2286f232012-06-15 13:27:53 +0000206 String NONE = "none";
Stuart McCullochbb014372012-06-07 21:57:32 +0000207
Stuart McCulloch2286f232012-06-15 13:27:53 +0000208 String directives[] = {
209 SPLIT_PACKAGE_DIRECTIVE, NO_IMPORT_DIRECTIVE, IMPORT_DIRECTIVE, RESOLUTION_DIRECTIVE, INCLUDE_DIRECTIVE,
210 USES_DIRECTIVE, EXCLUDE_DIRECTIVE, KEYSTORE_LOCATION_DIRECTIVE, KEYSTORE_PROVIDER_DIRECTIVE,
211 KEYSTORE_PASSWORD_DIRECTIVE, SIGN_PASSWORD_DIRECTIVE, COMMAND_DIRECTIVE, NOANNOTATIONS, LIB_DIRECTIVE,
212 RUNPATH_LAUNCHER_DIRECTIVE, FROM_DIRECTIVE, PRIVATE_DIRECTIVE
Stuart McCullochbb014372012-06-07 21:57:32 +0000213
Stuart McCulloch2286f232012-06-15 13:27:53 +0000214 // TODO
215 };
Stuart McCullochbb014372012-06-07 21:57:32 +0000216
Stuart McCulloch2286f232012-06-15 13:27:53 +0000217 String USES_USES = "<<USES>>";
218 String CURRENT_USES = "@uses";
219 String IMPORT_REFERENCE = "reference";
220 String IMPORT_PRIVATE = "private";
221 String[] importDirectives = {
222 IMPORT_REFERENCE, IMPORT_PRIVATE
223 };
Stuart McCullochbb014372012-06-07 21:57:32 +0000224
Stuart McCulloch2286f232012-06-15 13:27:53 +0000225 static final Pattern VALID_PROPERTY_TYPES = Pattern
226 .compile("(String|Long|Double|Float|Integer|Byte|Character|Boolean|Short)");
Stuart McCullochbb014372012-06-07 21:57:32 +0000227
Stuart McCulloch2286f232012-06-15 13:27:53 +0000228 String DEFAULT_BND_EXTENSION = ".bnd";
229 String DEFAULT_JAR_EXTENSION = ".jar";
230 String DEFAULT_BAR_EXTENSION = ".bar";
231 String DEFAULT_BNDRUN_EXTENSION = ".bndrun";
232 String[] METAPACKAGES = {
233 "META-INF", "OSGI-INF", "OSGI-OPT"
234 };
Stuart McCullochbb014372012-06-07 21:57:32 +0000235
Stuart McCulloch2286f232012-06-15 13:27:53 +0000236 String CURRENT_VERSION = "@";
237 String CURRENT_PACKAGE = "@package";
Stuart McCullochbb014372012-06-07 21:57:32 +0000238
Stuart McCulloch2286f232012-06-15 13:27:53 +0000239 String BUILDFILES = "buildfiles";
Stuart McCullochbb014372012-06-07 21:57:32 +0000240
Stuart McCulloch2286f232012-06-15 13:27:53 +0000241 String EMPTY_HEADER = "<<EMPTY>>";
Stuart McCullochbb014372012-06-07 21:57:32 +0000242
Stuart McCulloch2286f232012-06-15 13:27:53 +0000243 String EMBEDDED_REPO = "/embedded-repo.jar";
244 String LAUNCHER_PLUGIN = "Launcher-Plugin";
245 String TESTER_PLUGIN = "Tester-Plugin";
Stuart McCullochbb014372012-06-07 21:57:32 +0000246
Stuart McCulloch2286f232012-06-15 13:27:53 +0000247 String DEFAULT_LAUNCHER_BSN = "biz.aQute.launcher";
248 String DEFAULT_TESTER_BSN = "biz.aQute.junit";
Stuart McCullochbb014372012-06-07 21:57:32 +0000249
Stuart McCulloch2286f232012-06-15 13:27:53 +0000250 String DEFAULT_DO_NOT_COPY = "CVS|\\.svn|\\.git|\\.DS_Store";
Stuart McCullochbb014372012-06-07 21:57:32 +0000251
Stuart McCulloch2286f232012-06-15 13:27:53 +0000252 Charset DEFAULT_CHARSET = Charset.forName("UTF8");
253 String VERSION_FILTER = "version";
254 String PROVIDER_TYPE_DIRECTIVE = "x-provider-type:";
Stuart McCullochbb014372012-06-07 21:57:32 +0000255
256 /**
257 * Component constants
258 */
Stuart McCulloch2286f232012-06-15 13:27:53 +0000259 public final static String NAMESPACE_STEM = "http://www.osgi.org/xmlns/scr";
260 public final static String JIDENTIFIER = "<<identifier>>";
261 public final static String COMPONENT_NAME = "name:";
262 public final static String COMPONENT_FACTORY = "factory:";
263 public final static String COMPONENT_SERVICEFACTORY = "servicefactory:";
264 public final static String COMPONENT_IMMEDIATE = "immediate:";
265 public final static String COMPONENT_ENABLED = "enabled:";
266 public final static String COMPONENT_DYNAMIC = "dynamic:";
267 public final static String COMPONENT_MULTIPLE = "multiple:";
268 public final static String COMPONENT_PROVIDE = "provide:";
269 public final static String COMPONENT_OPTIONAL = "optional:";
270 public final static String COMPONENT_PROPERTIES = "properties:";
271 public final static String COMPONENT_IMPLEMENTATION = "implementation:";
272 public final static String COMPONENT_DESIGNATE = "designate:";
273 public final static String COMPONENT_DESIGNATEFACTORY = "designateFactory:";
274 public final static String COMPONENT_DESCRIPTORS = ".descriptors:";
Stuart McCullochbb014372012-06-07 21:57:32 +0000275
276 // v1.1.0
Stuart McCulloch2286f232012-06-15 13:27:53 +0000277 public final static String COMPONENT_VERSION = "version:";
278 public final static String COMPONENT_CONFIGURATION_POLICY = "configuration-policy:";
279 public final static String COMPONENT_MODIFIED = "modified:";
280 public final static String COMPONENT_ACTIVATE = "activate:";
281 public final static String COMPONENT_DEACTIVATE = "deactivate:";
Stuart McCullochbb014372012-06-07 21:57:32 +0000282
Stuart McCulloch2286f232012-06-15 13:27:53 +0000283 final static Map<String,String> EMPTY = Collections.emptyMap();
Stuart McCullochbb014372012-06-07 21:57:32 +0000284
Stuart McCulloch2286f232012-06-15 13:27:53 +0000285 public final static String[] componentDirectives = new String[] {
286 COMPONENT_FACTORY, COMPONENT_IMMEDIATE, COMPONENT_ENABLED, COMPONENT_DYNAMIC, COMPONENT_MULTIPLE,
287 COMPONENT_PROVIDE, COMPONENT_OPTIONAL, COMPONENT_PROPERTIES, COMPONENT_IMPLEMENTATION,
288 COMPONENT_SERVICEFACTORY, COMPONENT_VERSION, COMPONENT_CONFIGURATION_POLICY, COMPONENT_MODIFIED,
289 COMPONENT_ACTIVATE, COMPONENT_DEACTIVATE, COMPONENT_NAME, COMPONENT_DESCRIPTORS, COMPONENT_DESIGNATE,
290 COMPONENT_DESIGNATEFACTORY
291 };
Stuart McCullochbb014372012-06-07 21:57:32 +0000292
Stuart McCulloch2286f232012-06-15 13:27:53 +0000293 public final static Set<String> SET_COMPONENT_DIRECTIVES = new HashSet<String>(
294 Arrays.asList(componentDirectives));
Stuart McCullochbb014372012-06-07 21:57:32 +0000295
Stuart McCulloch2286f232012-06-15 13:27:53 +0000296 public final static Set<String> SET_COMPONENT_DIRECTIVES_1_1 = //
297 new HashSet<String>(Arrays.asList(
298 COMPONENT_VERSION,
299 COMPONENT_CONFIGURATION_POLICY,
300 COMPONENT_MODIFIED,
301 COMPONENT_ACTIVATE,
302 COMPONENT_DEACTIVATE));
Stuart McCullochbb014372012-06-07 21:57:32 +0000303
304}