Stuart McCulloch | d00f971 | 2009-07-13 10:06:47 +0000 | [diff] [blame^] | 1 | package aQute.lib.osgi; |
| 2 | |
| 3 | import java.util.*; |
| 4 | import java.util.regex.*; |
| 5 | |
| 6 | public interface Constants { |
| 7 | /* |
| 8 | * Defined in OSGi |
| 9 | */ |
| 10 | /** |
| 11 | * @syntax Bundle-ActivationPolicy ::= policy ( ’;’ directive )* policy ::= |
| 12 | * ’lazy’ |
| 13 | */ |
| 14 | String BUNDLE_ACTIVATION_POLICY = "Bundle-ActivationPolicy"; |
| 15 | String BUNDLE_ACTIVATOR = "Bundle-Activator"; |
| 16 | String BUNDLE_BLUEPRINT = "Bundle-Copyright"; |
| 17 | String BUNDLE_CATEGORY = "Bundle-Category"; |
| 18 | String BUNDLE_CLASSPATH = "Bundle-ClassPath"; |
| 19 | String BUNDLE_CONTACTADDRESS = "Bundle-ContactAddress"; |
| 20 | String BUNDLE_COPYRIGHT = "Bundle-Copyright"; |
| 21 | String BUNDLE_DESCRIPTION = "Bundle-Description"; |
| 22 | String BUNDLE_DOCURL = "Bundle-DocURL"; |
| 23 | String BUNDLE_ICON = "Bundle-Icon"; |
| 24 | String BUNDLE_LICENSE = "Bundle-License"; |
| 25 | String BUNDLE_LOCALIZATION = "Bundle-Localization"; |
| 26 | String BUNDLE_MANIFESTVERSION = "Bundle-ManifestVersion"; |
| 27 | String BUNDLE_NAME = "Bundle-Name"; |
| 28 | String BUNDLE_NATIVECODE = "Bundle-NativeCode"; |
| 29 | String BUNDLE_REQUIREDEXECUTIONENVIRONMENT = "Bundle-RequiredExecutionEnvironment"; |
| 30 | String BUNDLE_SYMBOLICNAME = "Bundle-SymbolicName"; |
| 31 | String BUNDLE_UPDATELOCATION = "Bundle-UpdateLocation"; |
| 32 | String BUNDLE_VENDOR = "Bundle-Vendor"; |
| 33 | String BUNDLE_VERSION = "Bundle-Version"; |
| 34 | String DYNAMICIMPORT_PACKAGE = "DynamicImport-Package"; |
| 35 | String EXPORT_PACKAGE = "Export-Package"; |
| 36 | String EXPORT_SERVICE = "Export-Service"; |
| 37 | String FRAGMENT_HOST = "Fragment-Host"; |
| 38 | String IMPORT_PACKAGE = "Import-Package"; |
| 39 | String IMPORT_SERVICE = "Import-Service"; |
| 40 | String REQUIRE_BUNDLE = "Require-Bundle"; |
| 41 | String SERVICE_COMPONENT = "Service-Component"; |
| 42 | |
| 43 | String PRIVATE_PACKAGE = "Private-Package"; |
| 44 | String IGNORE_PACKAGE = "Ignore-Package"; |
| 45 | String INCLUDE_RESOURCE = "Include-Resource"; |
| 46 | String CONDITIONAL_PACKAGE = "Conditional-Package"; |
| 47 | String BND_LASTMODIFIED = "Bnd-LastModified"; |
| 48 | String CREATED_BY = "Created-By"; |
| 49 | String TOOL = "Tool"; |
| 50 | String TESTCASES = "Test-Cases"; |
| 51 | |
| 52 | String headers[] = { |
| 53 | BUNDLE_ACTIVATOR, BUNDLE_CONTACTADDRESS, BUNDLE_COPYRIGHT, |
| 54 | BUNDLE_DESCRIPTION, BUNDLE_DOCURL, BUNDLE_LOCALIZATION, |
| 55 | BUNDLE_NATIVECODE, BUNDLE_VENDOR, BUNDLE_VERSION, BUNDLE_LICENSE, |
| 56 | BUNDLE_CLASSPATH, SERVICE_COMPONENT, EXPORT_PACKAGE, |
| 57 | IMPORT_PACKAGE, BUNDLE_LOCALIZATION, BUNDLE_MANIFESTVERSION, |
| 58 | BUNDLE_NAME, BUNDLE_NATIVECODE, |
| 59 | BUNDLE_REQUIREDEXECUTIONENVIRONMENT, BUNDLE_SYMBOLICNAME, |
| 60 | BUNDLE_VERSION, FRAGMENT_HOST, PRIVATE_PACKAGE, IGNORE_PACKAGE, |
| 61 | INCLUDE_RESOURCE, REQUIRE_BUNDLE, IMPORT_SERVICE, EXPORT_SERVICE, |
| 62 | CONDITIONAL_PACKAGE, BND_LASTMODIFIED, TESTCASES }; |
| 63 | |
| 64 | String BUILDPATH = "-buildpath"; |
| 65 | String BUMPPOLICY = "-bumppolicy"; |
| 66 | String CONDUIT = "-conduit"; |
| 67 | String DEPENDSON = "-dependson"; |
| 68 | String DEPLOYREPO = "-deployrepo"; |
| 69 | String DONOTCOPY = "-donotcopy"; |
| 70 | String DEBUG = "-debug"; |
| 71 | String EXPORT_CONTENTS = "-exportcontents"; |
| 72 | String FAIL_OK = "-failok"; |
| 73 | String INCLUDE = "-include"; |
| 74 | String INCLUDERESOURCE = "-includeresource"; |
| 75 | String MAKE = "-make"; |
| 76 | String MANIFEST = "-manifest"; |
| 77 | String NOEXTRAHEADERS = "-noextraheaders"; |
| 78 | String NOMANIFEST = "-nomanifest"; |
| 79 | String NOUSES = "-nouses"; |
| 80 | String NOPE = "-nope"; |
| 81 | String PEDANTIC = "-pedantic"; |
| 82 | String PLUGIN = "-plugin"; |
| 83 | String POM = "-pom"; |
| 84 | String RELEASEREPO = "-releaserepo"; |
| 85 | String REMOVE_HEADERS = "-removeheaders"; |
| 86 | String RESOURCEONLY = "-resourceonly"; |
| 87 | String SOURCES = "-sources"; |
| 88 | String SOURCEPATH = "-sourcepath"; |
| 89 | String SUB = "-sub"; |
| 90 | String RUNPROPERTIES = "-runproperties"; |
| 91 | String RUNSYSTEMPACKAGES = "-runsystempackages"; |
| 92 | String RUNBUNDLES = "-runbundles"; |
| 93 | String RUNPATH = "-runpath"; |
| 94 | String RUNVM = "-runvm"; |
| 95 | |
| 96 | String REPORTNEWER = "-reportnewer"; |
| 97 | String SIGN = "-sign"; |
| 98 | String TESTPACKAGES = "-testpackages"; |
| 99 | String TESTREPORT = "-testreport"; |
| 100 | String TESTBUNDLES = "-testbundles"; |
| 101 | String UNDERTEST = "-undertest"; |
| 102 | String VERBOSE = "-verbose"; |
| 103 | String VERSIONPOLICY = "-versionpolicy"; |
| 104 | |
| 105 | // Deprecated |
| 106 | String CLASSPATH = "-classpath"; |
| 107 | |
| 108 | String options[] = { |
| 109 | BUILDPATH, BUMPPOLICY, CONDUIT, CLASSPATH, DEPENDSON, DONOTCOPY, |
| 110 | EXPORT_CONTENTS, FAIL_OK, INCLUDE, INCLUDERESOURCE, MAKE, MANIFEST, |
| 111 | NOEXTRAHEADERS, NOUSES, NOPE, PEDANTIC, PLUGIN, POM, |
| 112 | REMOVE_HEADERS, RESOURCEONLY, SOURCES, SOURCEPATH, SOURCES, |
| 113 | SOURCEPATH, SUB, RUNBUNDLES, RUNPATH, RUNSYSTEMPACKAGES, |
| 114 | RUNPROPERTIES, REPORTNEWER, UNDERTEST, TESTBUNDLES, TESTPACKAGES, |
| 115 | TESTREPORT, VERBOSE, NOMANIFEST, DEPLOYREPO, RELEASEREPO }; |
| 116 | |
| 117 | // Ignore bundle specific headers. These bundles do not make |
| 118 | // a lot of sense to inherit |
| 119 | String[] BUNDLE_SPECIFIC_HEADERS = new String[] { |
| 120 | INCLUDE_RESOURCE, BUNDLE_ACTIVATOR, BUNDLE_CLASSPATH, BUNDLE_NAME, |
| 121 | BUNDLE_NATIVECODE, BUNDLE_SYMBOLICNAME, IMPORT_PACKAGE, |
| 122 | EXPORT_PACKAGE, DYNAMICIMPORT_PACKAGE, FRAGMENT_HOST, |
| 123 | REQUIRE_BUNDLE, PRIVATE_PACKAGE, EXPORT_CONTENTS, TESTCASES, |
| 124 | NOMANIFEST }; |
| 125 | |
| 126 | char DUPLICATE_MARKER = '~'; |
| 127 | |
| 128 | String SPLIT_PACKAGE_DIRECTIVE = "-split-package:"; |
| 129 | String IMPORT_DIRECTIVE = "-import:"; |
| 130 | String NO_IMPORT_DIRECTIVE = "-noimport:"; |
| 131 | String REMOVE_ATTRIBUTE_DIRECTIVE = "-remove-attribute:"; |
| 132 | |
| 133 | String USES_DIRECTIVE = "uses:"; |
| 134 | String MANDATORY_DIRECTIVE = "mandatory:"; |
| 135 | String INCLUDE_DIRECTIVE = "include:"; |
| 136 | String EXCLUDE_DIRECTIVE = "exclude:"; |
| 137 | String PRESENCE_DIRECTIVE = "presence:"; |
| 138 | String SINGLETON_DIRECTIVE = "singleton:"; |
| 139 | String EXTENSION_DIRECTIVE = "extension:"; |
| 140 | String VISIBILITY_DIRECTIVE = "visibility:"; |
| 141 | String FRAGMENT_ATTACHMENT_DIRECTIVE = "fragment-attachment:"; |
| 142 | String RESOLUTION_DIRECTIVE = "resolution:"; |
| 143 | String PATH_DIRECTIVE = "path:"; |
| 144 | String SIZE_ATTRIBUTE = "size"; |
| 145 | String LINK_ATTRIBUTE = "link"; |
| 146 | String NAME_ATTRIBUTE = "name"; |
| 147 | String DESCRIPTION_ATTRIBUTE = "description"; |
| 148 | String OSNAME_ATTRIBUTE = "osname"; |
| 149 | String OSVERSION_ATTRIBUTE = "osversion"; |
| 150 | String PROCESSOR_ATTRIBUTE = "processor"; |
| 151 | String LANGUAGE_ATTRIBUTE = "language"; |
| 152 | String SELECTION_FILTER_ATTRIBUTE = "selection-filter"; |
| 153 | String BLUEPRINT_WAIT_FOR_DEPENDENCIES_ATTRIBUTE = "blueprint.wait-for-dependencies"; |
| 154 | String BLUEPRINT_TIMEOUT_ATTRIBUTE = "blueprint.timeout"; |
| 155 | String VERSION_ATTRIBUTE = "version"; |
| 156 | String BUNDLE_SYMBOLIC_NAME_ATTRIBUTE = "bundle-symbolic-name"; |
| 157 | String BUNDLE_VERSION_ATTRIBUTE = "bundle-version"; |
| 158 | |
| 159 | String KEYSTORE_LOCATION_DIRECTIVE = "keystore:"; |
| 160 | String KEYSTORE_PROVIDER_DIRECTIVE = "provider:"; |
| 161 | String KEYSTORE_PASSWORD_DIRECTIVE = "password:"; |
| 162 | String SIGN_PASSWORD_DIRECTIVE = "sign-password:"; |
| 163 | |
| 164 | String NONE = "none"; |
| 165 | |
| 166 | String directives[] = { |
| 167 | SPLIT_PACKAGE_DIRECTIVE, NO_IMPORT_DIRECTIVE, IMPORT_DIRECTIVE, |
| 168 | RESOLUTION_DIRECTIVE, INCLUDE_DIRECTIVE, USES_DIRECTIVE, |
| 169 | EXCLUDE_DIRECTIVE, KEYSTORE_LOCATION_DIRECTIVE, |
| 170 | KEYSTORE_PROVIDER_DIRECTIVE, KEYSTORE_PASSWORD_DIRECTIVE, |
| 171 | SIGN_PASSWORD_DIRECTIVE, |
| 172 | |
| 173 | // TODO |
| 174 | }; |
| 175 | |
| 176 | String USES_USES = "<<USES>>"; |
| 177 | String CURRENT_USES = "@uses"; |
| 178 | String IMPORT_REFERENCE = "reference"; |
| 179 | String IMPORT_PRIVATE = "private"; |
| 180 | String[] importDirectives = { |
| 181 | IMPORT_REFERENCE, IMPORT_PRIVATE }; |
| 182 | |
| 183 | static final Pattern VALID_PROPERTY_TYPES = Pattern |
| 184 | .compile("(String|Long|Double|Float|Integer|Byte|Character|Boolean|Short)"); |
| 185 | |
| 186 | String DEFAULT_BND_EXTENSION = ".bnd"; |
| 187 | String DEFAULT_JAR_EXTENSION = ".jar"; |
| 188 | String DEFAULT_BAR_EXTENSION = ".bar"; |
| 189 | String[] METAPACKAGES = { |
| 190 | "META-INF", "OSGI-INF", "OSGI-OPT" }; |
| 191 | |
| 192 | int STRATEGY_HIGHEST = 1; |
| 193 | int STRATEGY_LOWEST = -1; |
| 194 | |
| 195 | String CURRENT_VERSION = "@"; |
| 196 | String CURRENT_PACKAGE = "@package"; |
| 197 | } |