@jahia/javascript-modules-library 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (87) hide show
  1. package/LICENSE +201 -0
  2. package/README.md +35 -0
  3. package/core/index.js +1 -0
  4. package/core/server/components/AbsoluteArea.js +1 -0
  5. package/core/server/components/AddContentButtons.js +1 -0
  6. package/core/server/components/AddResources.js +1 -0
  7. package/core/server/components/Area.js +1 -0
  8. package/core/server/components/index.js +1 -0
  9. package/core/server/components/render/HydrateInBrowser.js +1 -0
  10. package/core/server/components/render/Render.js +1 -0
  11. package/core/server/components/render/RenderInBrowser.js +1 -0
  12. package/core/server/components/render/index.js +1 -0
  13. package/core/server/components/render/internal/InBrowser.js +1 -0
  14. package/core/server/framework/defineJahiaComponent.js +1 -0
  15. package/core/server/framework/index.js +1 -0
  16. package/core/server/framework/register.js +1 -0
  17. package/core/server/hooks/index.js +1 -0
  18. package/core/server/hooks/useGQLQuery.js +1 -0
  19. package/core/server/hooks/useJCRQuery.js +1 -0
  20. package/core/server/hooks/useServerContext.js +1 -0
  21. package/core/server/hooks/useUrlBuilder.js +1 -0
  22. package/core/server/index.js +1 -0
  23. package/core/server/utils/index.js +1 -0
  24. package/core/server/utils/jcr/getChildNodes.js +1 -0
  25. package/core/server/utils/jcr/getNodeFromPathOrId.js +1 -0
  26. package/core/server/utils/jcr/getNodeProps.js +1 -0
  27. package/core/server/utils/jcr/getNodesByJCRQuery.js +1 -0
  28. package/core/server/utils/jcr/index.js +1 -0
  29. package/core/server/utils/urlBuilder/index.js +1 -0
  30. package/core/server/utils/urlBuilder/urlBuilder.js +1 -0
  31. package/index.js +1 -0
  32. package/nav/index.js +1 -0
  33. package/nav/server/index.js +1 -0
  34. package/nav/server/navBuilder/index.js +1 -0
  35. package/nav/server/navBuilder/navBuilder.js +24 -0
  36. package/package.json +60 -0
  37. package/types/@jahia/javascript-modules-library-private.d.ts +60 -0
  38. package/types/core/index.d.ts +1 -0
  39. package/types/core/server/components/AbsoluteArea.d.ts +29 -0
  40. package/types/core/server/components/AddContentButtons.d.ts +13 -0
  41. package/types/core/server/components/AddResources.d.ts +31 -0
  42. package/types/core/server/components/Area.d.ts +27 -0
  43. package/types/core/server/components/index.d.ts +5 -0
  44. package/types/core/server/components/render/HydrateInBrowser.d.ts +13 -0
  45. package/types/core/server/components/render/Render.d.ts +23 -0
  46. package/types/core/server/components/render/RenderInBrowser.d.ts +13 -0
  47. package/types/core/server/components/render/index.d.ts +3 -0
  48. package/types/core/server/components/render/internal/InBrowser.d.ts +8 -0
  49. package/types/core/server/framework/defineJahiaComponent.d.ts +41 -0
  50. package/types/core/server/framework/index.d.ts +2 -0
  51. package/types/core/server/framework/register.d.ts +7 -0
  52. package/types/core/server/hooks/index.d.ts +4 -0
  53. package/types/core/server/hooks/useGQLQuery.d.ts +5 -0
  54. package/types/core/server/hooks/useJCRQuery.d.ts +3 -0
  55. package/types/core/server/hooks/useServerContext.d.ts +14 -0
  56. package/types/core/server/hooks/useUrlBuilder.d.ts +31 -0
  57. package/types/core/server/index.d.ts +4 -0
  58. package/types/core/server/utils/index.d.ts +2 -0
  59. package/types/core/server/utils/jcr/getChildNodes.d.ts +9 -0
  60. package/types/core/server/utils/jcr/getNodeFromPathOrId.d.ts +12 -0
  61. package/types/core/server/utils/jcr/getNodeProps.d.ts +7 -0
  62. package/types/core/server/utils/jcr/getNodesByJCRQuery.d.ts +9 -0
  63. package/types/core/server/utils/jcr/index.d.ts +4 -0
  64. package/types/core/server/utils/urlBuilder/index.d.ts +1 -0
  65. package/types/core/server/utils/urlBuilder/urlBuilder.d.ts +27 -0
  66. package/types/globals.d.ts +11 -0
  67. package/types/index.d.ts +19 -0
  68. package/types/java.io.d.ts +694 -0
  69. package/types/java.net.d.ts +190 -0
  70. package/types/java.security.d.ts +27 -0
  71. package/types/java.util.d.ts +1536 -0
  72. package/types/javax.jcr.d.ts +1250 -0
  73. package/types/javax.servlet.d.ts +426 -0
  74. package/types/javax.servlet.http.d.ts +1431 -0
  75. package/types/nav/index.d.ts +1 -0
  76. package/types/nav/server/index.d.ts +1 -0
  77. package/types/nav/server/navBuilder/index.d.ts +1 -0
  78. package/types/nav/server/navBuilder/navBuilder.d.ts +78 -0
  79. package/types/org.jahia.modules.npm.modules.engine.js.server.d.ts +292 -0
  80. package/types/org.jahia.services.content.d.ts +1463 -0
  81. package/types/org.jahia.services.content.decorator.d.ts +92 -0
  82. package/types/org.jahia.services.query.d.ts +35 -0
  83. package/types/org.jahia.services.render.d.ts +168 -0
  84. package/types/org.jahia.services.usermanager.d.ts +85 -0
  85. package/types/org.osgi.framework.d.ts +1004 -0
  86. package/types/server.d.ts +27 -0
  87. package/types/servercontext.d.ts +29 -0
@@ -0,0 +1,1004 @@
1
+ declare module 'org.osgi.framework' {
2
+ import { Dictionary, Enumeration } from 'java.util';
3
+ import { URL } from 'java.net';
4
+ import { File } from 'java.io';
5
+ /**
6
+ * An installed bundle in the Framework.
7
+ *
8
+ *
9
+ * A `Bundle` object is the access point to define the lifecycle of an
10
+ * installed bundle. Each bundle installed in the OSGi environment must have an
11
+ * associated `Bundle` object.
12
+ *
13
+ *
14
+ * A bundle must have a unique identity, a `long`, chosen by the
15
+ * Framework. This identity must not change during the lifecycle of a bundle,
16
+ * even when the bundle is updated. Uninstalling and then reinstalling the
17
+ * bundle must create a new unique identity.
18
+ *
19
+ *
20
+ * A bundle can be in one of six states:
21
+ *
22
+ * {@link #UNINSTALLED}
23
+ * {@link #INSTALLED}
24
+ * {@link #RESOLVED}
25
+ * {@link #STARTING}
26
+ * {@link #STOPPING}
27
+ * {@link #ACTIVE}
28
+ *
29
+ *
30
+ * Values assigned to these states have no specified ordering; they represent
31
+ * bit values that may be ORed together to determine if a bundle is in one of
32
+ * the valid states.
33
+ *
34
+ *
35
+ * A bundle should only have active threads of execution when its state is one
36
+ * of `STARTING`,`ACTIVE`, or `STOPPING`. An
37
+ * `UNINSTALLED` bundle can not be set to another state; it is a zombie
38
+ * and can only be reached because references are kept somewhere.
39
+ *
40
+ *
41
+ * The Framework is the only entity that is allowed to create `Bundle`
42
+ * objects, and these objects are only valid within the Framework that created
43
+ * them.
44
+ *
45
+ *
46
+ * Bundles have a natural ordering such that if two `Bundle`s have the
47
+ * same {@link #getBundleId() bundle id} they are equal. A `Bundle` is
48
+ * less than another `Bundle` if it has a lower {@link #getBundleId()
49
+ * bundle id} and is greater if it has a higher bundle id.
50
+ *
51
+ * @ThreadSafe
52
+ * @author $Id: 545299bc454bb01ef73a14693ffec76a13430eea $
53
+ */
54
+ export class Bundle {
55
+ /**
56
+ * Returns this bundle's current state.
57
+ *
58
+ *
59
+ * A bundle can be in only one state at any time.
60
+ *
61
+ * @return An element of `UNINSTALLED`,`INSTALLED`,
62
+ * `RESOLVED`, `STARTING`, `STOPPING`,
63
+ * `ACTIVE`.
64
+ */
65
+ getState(): number;
66
+ /**
67
+ * Returns this bundle's Manifest headers and values. This method returns
68
+ * all the Manifest headers and values from the main section of this
69
+ * bundle's Manifest file; that is, all lines prior to the first blank line.
70
+ *
71
+ *
72
+ * Manifest header names are case-insensitive. The methods of the returned
73
+ * `Dictionary` object must operate on header names in a
74
+ * case-insensitive manner.
75
+ *
76
+ * If a Manifest header value starts with "%", it must be
77
+ * localized according to the default locale. If no localization is found
78
+ * for a header value, the header value without the leading "%" is
79
+ * returned.
80
+ *
81
+ *
82
+ * For example, the following Manifest headers and values are included if
83
+ * they are present in the Manifest file:
84
+ *
85
+ * * Bundle-Name
86
+ * Bundle-Vendor
87
+ * Bundle-Version
88
+ * Bundle-Description
89
+ * Bundle-DocURL
90
+ * Bundle-ContactAddress
91
+ *
92
+ *
93
+ *
94
+ * This method must continue to return Manifest header information while
95
+ * this bundle is in the `UNINSTALLED` state.
96
+ *
97
+ * @return An unmodifiable `Dictionary` object containing this
98
+ * bundle's Manifest headers and values.
99
+ * @throws SecurityException If the caller does not have the appropriate
100
+ * `AdminPermission[this,METADATA]`, and the Java Runtime
101
+ * Environment supports permissions.
102
+ * @see Constants#BUNDLE_LOCALIZATION
103
+ */
104
+ getHeaders(): Dictionary<string, string>;
105
+ /**
106
+ * Returns this bundle's unique identifier. This bundle is assigned a unique
107
+ * identifier by the Framework when it was installed in the OSGi
108
+ * environment.
109
+ *
110
+ *
111
+ * A bundle's unique identifier has the following attributes:
112
+ *
113
+ * Is unique and persistent.
114
+ * Is a `long`.
115
+ * Its value is not reused for another bundle, even after a bundle is
116
+ * uninstalled.
117
+ * Does not change while a bundle remains installed.
118
+ * Does not change when a bundle is updated.
119
+ *
120
+ *
121
+ *
122
+ * This method must continue to return this bundle's unique identifier while
123
+ * this bundle is in the `UNINSTALLED` state.
124
+ *
125
+ * @return The unique identifier of this bundle.
126
+ */
127
+ getBundleId(): number;
128
+ /**
129
+ * Returns this bundle's location identifier.
130
+ *
131
+ *
132
+ * The location identifier is the location passed to
133
+ * `BundleContext.installBundle` when a bundle is installed. The
134
+ * location identifier does not change while this bundle remains installed,
135
+ * even if this bundle is updated.
136
+ *
137
+ *
138
+ * This method must continue to return this bundle's location identifier
139
+ * while this bundle is in the `UNINSTALLED` state.
140
+ *
141
+ * @return The string representation of this bundle's location identifier.
142
+ * @throws SecurityException If the caller does not have the appropriate
143
+ * `AdminPermission[this,METADATA]`, and the Java Runtime
144
+ * Environment supports permissions.
145
+ */
146
+ getLocation(): string;
147
+ /**
148
+ * Returns this bundle's `ServiceReference` list for all services it
149
+ * has registered or `null` if this bundle has no registered services.
150
+ *
151
+ *
152
+ * If the Java runtime supports permissions, a `ServiceReference`
153
+ * object to a service is included in the returned list only if the caller
154
+ * has the `ServicePermission` to get the service using at least one
155
+ * of the named classes the service was registered under.
156
+ *
157
+ *
158
+ * The list is valid at the time of the call to this method, however, as the
159
+ * Framework is a very dynamic environment, services can be modified or
160
+ * unregistered at anytime.
161
+ *
162
+ * @return An array of `ServiceReference` objects or `null`.
163
+ * @throws IllegalStateException If this bundle has been uninstalled.
164
+ * @see ServiceRegistration
165
+ * @see ServiceReference
166
+ * @see ServicePermission
167
+ */
168
+ getRegisteredServices(): ServiceReference<any>[];
169
+ /**
170
+ * Returns this bundle's `ServiceReference` list for all services it
171
+ * is using or returns `null` if this bundle is not using any
172
+ * services. A bundle is considered to be using a service if it has any
173
+ * unreleased service objects.
174
+ *
175
+ *
176
+ * If the Java Runtime Environment supports permissions, a
177
+ * `ServiceReference` object to a service is included in the returned
178
+ * list only if the caller has the `ServicePermission` to get the
179
+ * service using at least one of the named classes the service was
180
+ * registered under.
181
+ *
182
+ * The list is valid at the time of the call to this method, however, as the
183
+ * Framework is a very dynamic environment, services can be modified or
184
+ * unregistered at anytime.
185
+ *
186
+ * @return An array of `ServiceReference` objects or `null`.
187
+ * @throws IllegalStateException If this bundle has been uninstalled.
188
+ * @see ServiceReference
189
+ * @see ServicePermission
190
+ */
191
+ getServicesInUse(): ServiceReference<any>[];
192
+ /**
193
+ * Find the specified resource from this bundle's class loader.
194
+ *
195
+ * This bundle's class loader is called to search for the specified
196
+ * resource. If this bundle's state is `INSTALLED`, this method must
197
+ * attempt to resolve this bundle before attempting to get the specified
198
+ * resource. If this bundle cannot be resolved, then only this bundle must
199
+ * be searched for the specified resource. Imported packages cannot be
200
+ * searched when this bundle has not been resolved. If this bundle is a
201
+ * fragment bundle then `null` is returned.
202
+ *
203
+ * Note: Jar and zip files are not required to include directory entries.
204
+ * URLs to directory entries will not be returned if the bundle contents do
205
+ * not contain directory entries.
206
+ *
207
+ * @param name The name of the resource. See `ClassLoader.getResource`
208
+ * for a description of the format of a resource name.
209
+ * @return A URL to the named resource, or `null` if the resource
210
+ * could not be found or if this bundle is a fragment bundle or if
211
+ * the caller does not have the appropriate
212
+ * `AdminPermission[this,RESOURCE]`, and the Java Runtime
213
+ * Environment supports permissions.
214
+ * @throws IllegalStateException If this bundle has been uninstalled.
215
+ * @see #getEntry(String)
216
+ * @see #findEntries(String, String, boolean)
217
+ * @since 1.1
218
+ */
219
+ getResource(name: string): URL;
220
+ /**
221
+ * Returns this bundle's Manifest headers and values localized to the
222
+ * specified locale.
223
+ *
224
+ *
225
+ * This method performs the same function as `Bundle.getHeaders()`
226
+ * except the manifest header values are localized to the specified locale.
227
+ *
228
+ *
229
+ * If a Manifest header value starts with "%", it must be
230
+ * localized according to the specified locale. If a locale is specified and
231
+ * cannot be found, then the header values must be returned using the
232
+ * default locale. Localizations are searched for in the following order:
233
+ *
234
+ * * bn + "_" + Ls + "_" + Cs + "_" + Vs
235
+ * bn + "_" + Ls + "_" + Cs
236
+ * bn + "_" + Ls
237
+ * bn + "_" + Ld + "_" + Cd + "_" + Vd
238
+ * bn + "_" + Ld + "_" + Cd
239
+ * bn + "_" + Ld
240
+ * bn
241
+ *
242
+ *
243
+ * Where `bn` is this bundle's localization basename, `Ls`,
244
+ * `Cs` and `Vs` are the specified locale (language, country,
245
+ * variant) and `Ld`, `Cd` and `Vd` are the default locale
246
+ * (language, country, variant).
247
+ *
248
+ * If `null` is specified as the locale string, the header values must
249
+ * be localized using the default locale. If the empty string ("")
250
+ * is specified as the locale string, the header values must not be
251
+ * localized and the raw (unlocalized) header values, including any leading
252
+ * "%", must be returned. If no localization is found for a header
253
+ * value, the header value without the leading "%" is returned.
254
+ *
255
+ *
256
+ * This method must continue to return Manifest header information while
257
+ * this bundle is in the `UNINSTALLED` state, however the header
258
+ * values must only be available in the raw and default locale values.
259
+ *
260
+ * @param locale The locale name into which the header values are to be
261
+ * localized. If the specified locale is `null` then the locale
262
+ * returned by `java.util.Locale.getDefault` is used. If the
263
+ * specified locale is the empty string, this method will return the
264
+ * raw (unlocalized) manifest headers including any leading
265
+ * "%".
266
+ * @return An unmodifiable `Dictionary` object containing this
267
+ * bundle's Manifest headers and values.
268
+ * @throws SecurityException If the caller does not have the appropriate
269
+ * `AdminPermission[this,METADATA]`, and the Java Runtime
270
+ * Environment supports permissions.
271
+ * @see #getHeaders()
272
+ * @see Constants#BUNDLE_LOCALIZATION
273
+ * @since 1.3
274
+ */
275
+ getHeaders(locale: string): Dictionary<string, string>;
276
+ /**
277
+ * Returns the symbolic name of this bundle as specified by its
278
+ * `Bundle-SymbolicName` manifest header. The bundle symbolic name
279
+ * should be based on the reverse domain name naming convention like that
280
+ * used for java packages.
281
+ *
282
+ *
283
+ * This method must continue to return this bundle's symbolic name while
284
+ * this bundle is in the `UNINSTALLED` state.
285
+ *
286
+ * @return The symbolic name of this bundle or `null` if this bundle
287
+ * does not have a symbolic name.
288
+ * @since 1.3
289
+ */
290
+ getSymbolicName(): string;
291
+ /**
292
+ * Find the specified resources from this bundle's class loader.
293
+ *
294
+ * This bundle's class loader is called to search for the specified
295
+ * resources. If this bundle's state is `INSTALLED`, this method must
296
+ * attempt to resolve this bundle before attempting to get the specified
297
+ * resources. If this bundle cannot be resolved, then only this bundle must
298
+ * be searched for the specified resources. Imported packages cannot be
299
+ * searched when a bundle has not been resolved. If this bundle is a
300
+ * fragment bundle then `null` is returned.
301
+ *
302
+ * Note: Jar and zip files are not required to include directory entries.
303
+ * URLs to directory entries will not be returned if the bundle contents do
304
+ * not contain directory entries.
305
+ *
306
+ * @param name The name of the resource. See
307
+ * `ClassLoader.getResources` for a description of the format
308
+ * of a resource name.
309
+ * @return An enumeration of URLs to the named resources, or `null` if
310
+ * the resource could not be found or if this bundle is a fragment
311
+ * bundle or if the caller does not have the appropriate
312
+ * `AdminPermission[this,RESOURCE]`, and the Java Runtime
313
+ * Environment supports permissions.
314
+ * @throws IllegalStateException If this bundle has been uninstalled.
315
+ * @throws IOException If there is an I/O error.
316
+ * @since 1.3
317
+ */
318
+ getResources(name: string): Enumeration<URL>;
319
+ /**
320
+ * Returns an Enumeration of all the paths (`String` objects) to
321
+ * entries within this bundle whose longest sub-path matches the specified
322
+ * path. This bundle's class loader is not used to search for entries. Only
323
+ * the contents of this bundle are searched.
324
+ *
325
+ * The specified path is always relative to the root of this bundle and may
326
+ * begin with a "/". A path value of "/" indicates the
327
+ * root of this bundle.
328
+ *
329
+ * Returned paths indicating subdirectory paths end with a "/".
330
+ * The returned paths are all relative to the root of this bundle and must
331
+ * not begin with "/".
332
+ *
333
+ * Note: Jar and zip files are not required to include directory entries.
334
+ * Paths to directory entries will not be returned if the bundle contents do
335
+ * not contain directory entries.
336
+ *
337
+ * @param path The path name for which to return entry paths.
338
+ * @return An Enumeration of the entry paths (`String` objects) or
339
+ * `null` if no entry could be found or if the caller does not
340
+ * have the appropriate `AdminPermission[this,RESOURCE]` and
341
+ * the Java Runtime Environment supports permissions.
342
+ * @throws IllegalStateException If this bundle has been uninstalled.
343
+ * @since 1.3
344
+ */
345
+ getEntryPaths(path: string): Enumeration<string>;
346
+ /**
347
+ * Returns a URL to the entry at the specified path in this bundle. This
348
+ * bundle's class loader is not used to search for the entry. Only the
349
+ * contents of this bundle are searched for the entry.
350
+ *
351
+ * The specified path is always relative to the root of this bundle and may
352
+ * begin with "/". A path value of "/" indicates the
353
+ * root of this bundle.
354
+ *
355
+ * Note: Jar and zip files are not required to include directory entries.
356
+ * URLs to directory entries will not be returned if the bundle contents do
357
+ * not contain directory entries.
358
+ *
359
+ * @param path The path name of the entry.
360
+ * @return A URL to the entry, or `null` if no entry could be found or
361
+ * if the caller does not have the appropriate
362
+ * `AdminPermission[this,RESOURCE]` and the Java Runtime
363
+ * Environment supports permissions.
364
+ * @throws IllegalStateException If this bundle has been uninstalled.
365
+ * @since 1.3
366
+ */
367
+ getEntry(path: string): URL;
368
+ /**
369
+ * Returns the time when this bundle was last modified. A bundle is
370
+ * considered to be modified when it is installed, updated or uninstalled.
371
+ *
372
+ *
373
+ * The time value is the number of milliseconds since January 1, 1970,
374
+ * 00:00:00 UTC.
375
+ *
376
+ * @return The time when this bundle was last modified.
377
+ * @since 1.3
378
+ */
379
+ getLastModified(): number;
380
+ /**
381
+ * Returns this bundle's {@link BundleContext}. The returned
382
+ * `BundleContext` can be used by the caller to act on behalf of this
383
+ * bundle.
384
+ *
385
+ *
386
+ * If this bundle is not in the {@link #STARTING}, {@link #ACTIVE}, or
387
+ * {@link #STOPPING} states or this bundle is a fragment bundle, then this
388
+ * bundle has no valid `BundleContext`. This method will return
389
+ * `null` if this bundle has no valid `BundleContext`.
390
+ *
391
+ * @return A `BundleContext` for this bundle or `null` if this
392
+ * bundle has no valid `BundleContext`.
393
+ * @throws SecurityException If the caller does not have the appropriate
394
+ * `AdminPermission[this,CONTEXT]`, and the Java Runtime
395
+ * Environment supports permissions.
396
+ * @since 1.4
397
+ */
398
+ getBundleContext(): BundleContext;
399
+ /**
400
+ * Returns the version of this bundle as specified by its
401
+ * `Bundle-Version` manifest header. If this bundle does not have a
402
+ * specified version then {@link Version#emptyVersion} is returned.
403
+ *
404
+ *
405
+ * This method must continue to return this bundle's version while this
406
+ * bundle is in the `UNINSTALLED` state.
407
+ *
408
+ * @return The version of this bundle.
409
+ * @since 1.5
410
+ */
411
+ getVersion(): Version;
412
+ /**
413
+ * Creates a `File` object for a file in the persistent storage area
414
+ * provided for this bundle by the Framework. This method will return
415
+ * `null` if the platform does not have file system support or this
416
+ * bundle is a fragment bundle.
417
+ *
418
+ *
419
+ * A `File` object for the base directory of the persistent storage
420
+ * area provided for this bundle by the Framework can be obtained by calling
421
+ * this method with an empty string as `filename`.
422
+ *
423
+ *
424
+ * If the Java Runtime Environment supports permissions, the Framework will
425
+ * ensure that this bundle has the `java.io.FilePermission` with
426
+ * actions `read`,`write`,`delete` for all files
427
+ * (recursively) in the persistent storage area provided for this bundle.
428
+ *
429
+ * @param filename A relative name to the file to be accessed.
430
+ * @return A `File` object that represents the requested file or
431
+ * `null` if the platform does not have file system support or
432
+ * this bundle is a fragment bundle.
433
+ * @throws IllegalStateException If this bundle has been uninstalled.
434
+ * @since 1.6
435
+ */
436
+ getDataFile(filename: string): File;
437
+ }
438
+ /**
439
+ * A bundle's execution context within the Framework. The context is used to
440
+ * grant access to other methods so that this bundle can interact with the
441
+ * Framework.
442
+ *
443
+ *
444
+ * `BundleContext` methods allow a bundle to:
445
+ *
446
+ * Subscribe to events published by the Framework.
447
+ * Register service objects with the Framework service registry.
448
+ * Retrieve `ServiceReferences` from the Framework service registry.
449
+ * Get and release service objects for a referenced service.
450
+ * Install new bundles in the Framework.
451
+ * Get the list of bundles installed in the Framework.
452
+ * Get the {@link Bundle} object for a bundle.
453
+ * Create `File` objects for files in a persistent storage area
454
+ * provided for the bundle by the Framework.
455
+ *
456
+ *
457
+ *
458
+ * A `BundleContext` object will be created for a bundle when the bundle
459
+ * is started. The `Bundle` object associated with a `BundleContext`
460
+ * object is called the context bundle.
461
+ *
462
+ *
463
+ * The `BundleContext` object will be passed to the
464
+ * {@link BundleActivator#start(BundleContext)} method during activation of the
465
+ * context bundle. The same `BundleContext` object will be passed to the
466
+ * {@link BundleActivator#stop(BundleContext)} method when the context bundle is
467
+ * stopped. A `BundleContext` object is generally for the private use of
468
+ * its associated bundle and is not meant to be shared with other bundles in the
469
+ * OSGi environment.
470
+ *
471
+ *
472
+ * The `BundleContext` object is only valid during the execution of its
473
+ * context bundle; that is, during the period from when the context bundle is in
474
+ * the `STARTING`, `STOPPING`, and `ACTIVE` bundle states.
475
+ * However, the `BundleContext` object becomes invalid after
476
+ * {@link BundleActivator#stop(BundleContext)} returns (if the bundle has a
477
+ * Bundle Activator). The `BundleContext` object becomes invalid before
478
+ * disposing of any remaining registered services and releasing any remaining
479
+ * services in use. Since those activities can result in other bundles being
480
+ * called (for example, {@link ServiceListener}s for
481
+ * {@link ServiceEvent#UNREGISTERING} events and {@link ServiceFactory}s for
482
+ * unget operations), those other bundles can observe the stopping bundle in the
483
+ * `STOPPING` state but with an invalid `BundleContext` object. If
484
+ * the `BundleContext` object is used after it has become invalid, an
485
+ * `IllegalStateException` must be thrown. The `BundleContext`
486
+ * object must never be reused after its context bundle is stopped.
487
+ *
488
+ *
489
+ * Two `BundleContext` objects are equal if they both refer to the same
490
+ * execution context of a bundle. The Framework is the only entity that can
491
+ * create `BundleContext` objects and they are only valid within the
492
+ * Framework that created them.
493
+ *
494
+ *
495
+ * A {@link Bundle} can be {@link Bundle#adapt(Class) adapted} to its
496
+ * `BundleContext`. In order for this to succeed, the caller must have the
497
+ * appropriate `AdminPermission[bundle,CONTEXT]` if the Java Runtime
498
+ * Environment supports permissions.
499
+ *
500
+ * @ThreadSafe
501
+ * @author $Id: 6c43d322b8ea2137c094ce10e1f33e9c54519dd6 $
502
+ */
503
+ export class BundleContext {
504
+ /**
505
+ * Returns the value of the specified property. If the key is not found in
506
+ * the Framework properties, the system properties are then searched. The
507
+ * method returns `null` if the property is not found.
508
+ *
509
+ *
510
+ * All bundles must have permission to read properties whose names start
511
+ * with "org.osgi.".
512
+ *
513
+ * @param key The name of the requested property.
514
+ * @return The value of the requested property, or `null` if the
515
+ * property is undefined.
516
+ * @throws SecurityException If the caller does not have the appropriate
517
+ * `PropertyPermission` to read the property, and the Java
518
+ * Runtime Environment supports permissions.
519
+ */
520
+ getProperty(key: string): string;
521
+ /**
522
+ * Returns the `Bundle` object associated with this
523
+ * `BundleContext`. This bundle is called the context bundle.
524
+ *
525
+ * @return The `Bundle` object associated with this
526
+ * `BundleContext`.
527
+ * @throws IllegalStateException If this BundleContext is no longer valid.
528
+ */
529
+ getBundle(): Bundle;
530
+ /**
531
+ * Returns the bundle with the specified identifier.
532
+ *
533
+ * @param id The identifier of the bundle to retrieve.
534
+ * @return A `Bundle` object or `null` if the identifier does
535
+ * not match any installed bundle.
536
+ */
537
+ getBundle(id: number): Bundle;
538
+ /**
539
+ * Returns a list of all installed bundles.
540
+ *
541
+ * This method returns a list of all bundles installed in the OSGi
542
+ * environment at the time of the call to this method. However, since the
543
+ * Framework is a very dynamic environment, bundles can be installed or
544
+ * uninstalled at anytime.
545
+ *
546
+ * @return An array of `Bundle` objects, one object per installed
547
+ * bundle.
548
+ */
549
+ getBundles(): Bundle[];
550
+ /**
551
+ * Returns an array of `ServiceReference` objects. The returned array
552
+ * of `ServiceReference` objects contains services that were
553
+ * registered under the specified class, match the specified filter
554
+ * expression, and the packages for the class names under which the services
555
+ * were registered match the context bundle's packages as defined in
556
+ * {@link ServiceReference#isAssignableTo(Bundle, String)}.
557
+ *
558
+ *
559
+ * The list is valid at the time of the call to this method. However since
560
+ * the Framework is a very dynamic environment, services can be modified or
561
+ * unregistered at any time.
562
+ *
563
+ *
564
+ * The specified `filter` expression is used to select the registered
565
+ * services whose service properties contain keys and values which satisfy
566
+ * the filter expression. See {@link Filter} for a description of the filter
567
+ * syntax. If the specified `filter` is `null`, all registered
568
+ * services are considered to match the filter. If the specified
569
+ * `filter` expression cannot be parsed, an
570
+ * {@link InvalidSyntaxException} will be thrown with a human readable
571
+ * message where the filter became unparsable.
572
+ *
573
+ *
574
+ * The result is an array of `ServiceReference` objects for all
575
+ * services that meet all of the following conditions:
576
+ *
577
+ * If the specified class name, `clazz`, is not `null`, the
578
+ * service must have been registered with the specified class name. The
579
+ * complete list of class names with which a service was registered is
580
+ * available from the service's {@link Constants#OBJECTCLASS objectClass}
581
+ * property.
582
+ * If the specified `filter` is not `null`, the filter
583
+ * expression must match the service.
584
+ * If the Java Runtime Environment supports permissions, the caller must
585
+ * have `ServicePermission` with the `GET` action for at least
586
+ * one of the class names under which the service was registered.
587
+ * For each class name with which the service was registered, calling
588
+ * {@link ServiceReference#isAssignableTo(Bundle, String)} with the context
589
+ * bundle and the class name on the service's `ServiceReference`
590
+ * object must return `true`
591
+ *
592
+ *
593
+ * @param clazz The class name with which the service was registered or
594
+ * `null` for all services.
595
+ * @param filter The filter expression or `null` for all services.
596
+ * @return An array of `ServiceReference` objects or `null` if
597
+ * no services are registered which satisfy the search.
598
+ * @throws InvalidSyntaxException If the specified `filter` contains
599
+ * an invalid filter expression that cannot be parsed.
600
+ * @throws IllegalStateException If this BundleContext is no longer valid.
601
+ */
602
+ getServiceReferences(clazz: string, filter: string): ServiceReference<any>[];
603
+ /**
604
+ * Returns an array of `ServiceReference` objects. The returned array
605
+ * of `ServiceReference` objects contains services that were
606
+ * registered under the specified class and match the specified filter
607
+ * expression.
608
+ *
609
+ *
610
+ * The list is valid at the time of the call to this method. However since
611
+ * the Framework is a very dynamic environment, services can be modified or
612
+ * unregistered at any time.
613
+ *
614
+ *
615
+ * The specified `filter` expression is used to select the registered
616
+ * services whose service properties contain keys and values which satisfy
617
+ * the filter expression. See {@link Filter} for a description of the filter
618
+ * syntax. If the specified `filter` is `null`, all registered
619
+ * services are considered to match the filter. If the specified
620
+ * `filter` expression cannot be parsed, an
621
+ * {@link InvalidSyntaxException} will be thrown with a human readable
622
+ * message where the filter became unparsable.
623
+ *
624
+ *
625
+ * The result is an array of `ServiceReference` objects for all
626
+ * services that meet all of the following conditions:
627
+ *
628
+ * If the specified class name, `clazz`, is not `null`, the
629
+ * service must have been registered with the specified class name. The
630
+ * complete list of class names with which a service was registered is
631
+ * available from the service's {@link Constants#OBJECTCLASS objectClass}
632
+ * property.
633
+ * If the specified `filter` is not `null`, the filter
634
+ * expression must match the service.
635
+ * If the Java Runtime Environment supports permissions, the caller must
636
+ * have `ServicePermission` with the `GET` action for at least
637
+ * one of the class names under which the service was registered.
638
+ *
639
+ *
640
+ * @param clazz The class name with which the service was registered or
641
+ * `null` for all services.
642
+ * @param filter The filter expression or `null` for all services.
643
+ * @return An array of `ServiceReference` objects or `null` if
644
+ * no services are registered which satisfy the search.
645
+ * @throws InvalidSyntaxException If the specified `filter` contains
646
+ * an invalid filter expression that cannot be parsed.
647
+ * @throws IllegalStateException If this BundleContext is no longer valid.
648
+ * @since 1.3
649
+ */
650
+ getAllServiceReferences(clazz: string, filter: string): ServiceReference<any>[];
651
+ /**
652
+ * Returns a `ServiceReference` object for a service that implements
653
+ * and was registered under the specified class.
654
+ *
655
+ *
656
+ * The returned `ServiceReference` object is valid at the time of the
657
+ * call to this method. However as the Framework is a very dynamic
658
+ * environment, services can be modified or unregistered at any time.
659
+ *
660
+ *
661
+ * This method is the same as calling
662
+ * {@link #getServiceReferences(String, String)} with a `null` filter
663
+ * expression and then finding the reference with the highest priority. It
664
+ * is provided as a convenience for when the caller is interested in any
665
+ * service that implements the specified class.
666
+ *
667
+ * If multiple such services exist, the service with the highest priority is
668
+ * selected. This priority is defined as the service reference with the
669
+ * highest ranking (as specified in its {@link Constants#SERVICE_RANKING}
670
+ * property) is returned.
671
+ *
672
+ * If there is a tie in ranking, the service with the lowest service id (as
673
+ * specified in its {@link Constants#SERVICE_ID} property); that is, the
674
+ * service that was registered first is returned.
675
+ *
676
+ * @param clazz The class name with which the service was registered.
677
+ * @return A `ServiceReference` object, or `null` if no services
678
+ * are registered which implement the named class.
679
+ * @throws IllegalStateException If this BundleContext is no longer valid.
680
+ * @see #getServiceReferences(String, String)
681
+ */
682
+ getServiceReference(clazz: string): ServiceReference<any>;
683
+ /**
684
+ * Returns the service object for the service referenced by the specified
685
+ * `ServiceReference` object.
686
+ *
687
+ *
688
+ * A bundle's use of a service object obtained from this method is tracked
689
+ * by the bundle's use count of that service. Each time the service object
690
+ * is returned by {@link #getService(ServiceReference)} the context bundle's
691
+ * use count for the service is incremented by one. Each time the service
692
+ * object is released by {@link #ungetService(ServiceReference)} the context
693
+ * bundle's use count for the service is decremented by one.
694
+ *
695
+ *
696
+ * When a bundle's use count for the service drops to zero, the bundle
697
+ * should no longer use the service object.
698
+ *
699
+ *
700
+ * This method will always return `null` when the service associated
701
+ * with the specified `reference` has been unregistered.
702
+ *
703
+ *
704
+ * The following steps are required to get the service object:
705
+ *
706
+ * If the service has been unregistered, `null` is returned.
707
+ * If the context bundle's use count for the service is currently zero
708
+ * and the service has {@link Constants#SCOPE_BUNDLE bundle} or
709
+ * {@link Constants#SCOPE_PROTOTYPE prototype} scope, the
710
+ * {@link ServiceFactory#getService(Bundle, ServiceRegistration)} method is
711
+ * called to supply the service object for the context bundle. If the
712
+ * service object returned by the `ServiceFactory` object is
713
+ * `null`, not an `instanceof` all the classes named when the
714
+ * service was registered or the `ServiceFactory` object throws an
715
+ * exception or will be recursively called for the context bundle,
716
+ * `null` is returned and a Framework event of type
717
+ * {@link FrameworkEvent#ERROR} containing a {@link ServiceException}
718
+ * describing the error is fired. The supplied service object is cached by
719
+ * the Framework. While the context bundle's use count for the service is
720
+ * greater than zero, subsequent calls to get the service object for the
721
+ * context bundle will return the cached service object.
722
+ * The context bundle's use count for the service is incremented by one.
723
+ *
724
+ * The service object for the service is returned.
725
+ *
726
+ *
727
+ * @param Type of Service.
728
+ * @param reference A reference to the service.
729
+ * @return A service object for the service associated with
730
+ * `reference` or `null` if the service is not
731
+ * registered, the service object returned by a
732
+ * `ServiceFactory` does not implement the classes under which
733
+ * it was registered or the `ServiceFactory` threw an
734
+ * exception.
735
+ * @throws SecurityException If the caller does not have the
736
+ * `ServicePermission` to get the service using at least one
737
+ * of the named classes the service was registered under and the
738
+ * Java Runtime Environment supports permissions.
739
+ * @throws IllegalStateException If this BundleContext is no longer valid.
740
+ * @throws IllegalArgumentException If the specified
741
+ * `ServiceReference` was not created by the same framework
742
+ * instance as this `BundleContext`.
743
+ * @see #ungetService(ServiceReference)
744
+ * @see ServiceFactory
745
+ */
746
+ getService<S>(reference: ServiceReference<S>): S;
747
+ /**
748
+ * Returns the {@link ServiceObjects} object for the service referenced by
749
+ * the specified `ServiceReference` object.
750
+ *
751
+ *
752
+ * The {@link ServiceObjects} object can be used to obtain multiple service
753
+ * objects for services with {@link Constants#SCOPE_PROTOTYPE prototype}
754
+ * scope.
755
+ *
756
+ *
757
+ * For services with {@link Constants#SCOPE_SINGLETON singleton} or
758
+ * {@link Constants#SCOPE_BUNDLE bundle} scope, the
759
+ * {@link ServiceObjects#getService()} method behaves the same as the
760
+ * {@link #getService(ServiceReference)} method and the
761
+ * {@link ServiceObjects#ungetService(Object)} method behaves the same as
762
+ * the {@link #ungetService(ServiceReference)} method. That is, only one,
763
+ * use-counted service object is available from the {@link ServiceObjects}
764
+ * object.
765
+ *
766
+ *
767
+ * This method will always return `null` when the service associated
768
+ * with the specified `reference` has been unregistered.
769
+ *
770
+ * @param Type of Service.
771
+ * @param reference A reference to the service.
772
+ * @return A {@link ServiceObjects} object for the service associated with
773
+ * the specified `reference` or `null` if the service is
774
+ * not registered.
775
+ * @throws SecurityException If the caller does not have the
776
+ * `ServicePermission` to get the service using at least one
777
+ * of the named classes the service was registered under and the
778
+ * Java Runtime Environment supports permissions.
779
+ * @throws IllegalStateException If this BundleContext is no longer valid.
780
+ * @throws IllegalArgumentException If the specified
781
+ * `ServiceReference` was not created by the same framework
782
+ * instance as this `BundleContext`.
783
+ * @see PrototypeServiceFactory
784
+ * @since 1.8
785
+ */
786
+ getServiceObjects<S>(reference: ServiceReference<S>): ServiceObjects<S>;
787
+ /**
788
+ * Creates a `File` object for a file in the persistent storage area
789
+ * provided for the bundle by the Framework. This method will return
790
+ * `null` if the platform does not have file system support.
791
+ *
792
+ *
793
+ * A `File` object for the base directory of the persistent storage
794
+ * area provided for the context bundle by the Framework can be obtained by
795
+ * calling this method with an empty string as `filename`.
796
+ *
797
+ *
798
+ * If the Java Runtime Environment supports permissions, the Framework will
799
+ * ensure that the bundle has the `java.io.FilePermission` with
800
+ * actions `read`,`write`,`delete` for all files
801
+ * (recursively) in the persistent storage area provided for the context
802
+ * bundle.
803
+ *
804
+ * @param filename A relative name to the file to be accessed.
805
+ * @return A `File` object that represents the requested file or
806
+ * `null` if the platform does not have file system support.
807
+ * @throws IllegalStateException If this BundleContext is no longer valid.
808
+ */
809
+ getDataFile(filename: string): File;
810
+ /**
811
+ * Returns the bundle with the specified location.
812
+ *
813
+ * @param location The location of the bundle to retrieve.
814
+ * @return A `Bundle` object or `null` if the location does not
815
+ * match any installed bundle.
816
+ * @since 1.6
817
+ */
818
+ getBundle(location: string): Bundle;
819
+ }
820
+ /**
821
+ * Allows multiple service objects for a service to be obtained.
822
+ *
823
+ * For services with {@link Constants#SCOPE_PROTOTYPE prototype} scope, multiple
824
+ * service objects for the service can be obtained. Since implementations of
825
+ * {@link PrototypeServiceFactory} can return the same service object
826
+ * repeatedly, the framework must use count the returned service objects to
827
+ * release the service object only when its use count returns to zero.
828
+ *
829
+ * For services with {@link Constants#SCOPE_SINGLETON singleton} or
830
+ * {@link Constants#SCOPE_BUNDLE bundle} scope, only one, use-counted service
831
+ * object is available to a requesting bundle.
832
+ *
833
+ * Any unreleased service objects obtained from this `ServiceObjects`
834
+ * object are automatically released by the framework when the bundle associated
835
+ * with the BundleContext used to create this `ServiceObjects` object is
836
+ * stopped.
837
+ *
838
+ * @param Type of Service
839
+ * @see BundleContext#getServiceObjects(ServiceReference)
840
+ * @see PrototypeServiceFactory
841
+ * @ThreadSafe
842
+ * @since 1.8
843
+ * @author $Id$
844
+ */
845
+ export class ServiceObjects<S> {
846
+
847
+ }
848
+ /**
849
+ * A reference to a service.
850
+ *
851
+ *
852
+ * The Framework returns `ServiceReference` objects from the
853
+ * `BundleContext.getServiceReference` and
854
+ * `BundleContext.getServiceReferences` methods.
855
+ *
856
+ * A `ServiceReference` object may be shared between bundles and can be
857
+ * used to examine the properties of the service and to get the service object.
858
+ *
859
+ * Every service registered in the Framework has a unique
860
+ * `ServiceRegistration` object and may have multiple, distinct
861
+ * `ServiceReference` objects referring to it. `ServiceReference`
862
+ * objects associated with a `ServiceRegistration` object have the same
863
+ * `hashCode` and are considered equal (more specifically, their
864
+ * `equals()` method will return `true` when compared).
865
+ *
866
+ * If the same service object is registered multiple times,
867
+ * `ServiceReference` objects associated with different
868
+ * `ServiceRegistration` objects are not equal.
869
+ *
870
+ * @param Type of Service.
871
+ * @see BundleContext#getServiceReference(Class)
872
+ * @see BundleContext#getServiceReference(String)
873
+ * @see BundleContext#getServiceReferences(Class, String)
874
+ * @see BundleContext#getServiceReferences(String, String)
875
+ * @see BundleContext#getService(ServiceReference)
876
+ * @see BundleContext#getServiceObjects(ServiceReference)
877
+ * @ThreadSafe
878
+ * @author $Id: 1454244c30992b7a52ac3838b03bc584c3495816 $
879
+ */
880
+ export class ServiceReference<S> {
881
+ /**
882
+ * Returns the property value to which the specified property key is mapped
883
+ * in the properties `Dictionary` object of the service referenced by
884
+ * this `ServiceReference` object.
885
+ *
886
+ *
887
+ * Property keys are case-insensitive.
888
+ *
889
+ *
890
+ * This method must continue to return property values after the service has
891
+ * been unregistered. This is so references to unregistered services (for
892
+ * example, `ServiceReference` objects stored in the log) can still be
893
+ * interrogated.
894
+ *
895
+ * @param key The property key.
896
+ * @return The property value to which the key is mapped; `null` if
897
+ * there is no property named after the key.
898
+ */
899
+ getProperty(key: string): any;
900
+ /**
901
+ * Returns an array of the keys in the properties `Dictionary` object
902
+ * of the service referenced by this `ServiceReference` object.
903
+ *
904
+ *
905
+ * This method will continue to return the keys after the service has been
906
+ * unregistered. This is so references to unregistered services (for
907
+ * example, `ServiceReference` objects stored in the log) can still be
908
+ * interrogated.
909
+ *
910
+ *
911
+ * This method is case-preserving ; this means that every key in the
912
+ * returned array must have the same case as the corresponding key in the
913
+ * properties `Dictionary` that was passed to the
914
+ * {@link BundleContext#registerService(String[],Object,Dictionary)} or
915
+ * {@link ServiceRegistration#setProperties(Dictionary)} methods.
916
+ *
917
+ * @return An array of property keys.
918
+ */
919
+ getPropertyKeys(): string[];
920
+ /**
921
+ * Returns the bundle that registered the service referenced by this
922
+ * `ServiceReference` object.
923
+ *
924
+ *
925
+ * This method must return `null` when the service has been
926
+ * unregistered. This can be used to determine if the service has been
927
+ * unregistered.
928
+ *
929
+ * @return The bundle that registered the service referenced by this
930
+ * `ServiceReference` object; `null` if that service has
931
+ * already been unregistered.
932
+ * @see BundleContext#registerService(String[],Object,Dictionary)
933
+ */
934
+ getBundle(): Bundle;
935
+ /**
936
+ * Returns the bundles that are using the service referenced by this
937
+ * `ServiceReference` object. Specifically, this method returns the
938
+ * bundles whose usage count for that service is greater than zero.
939
+ *
940
+ * @return An array of bundles whose usage count for the service referenced
941
+ * by this `ServiceReference` object is greater than zero;
942
+ * `null` if no bundles are currently using that service.
943
+ *
944
+ * @since 1.1
945
+ */
946
+ getUsingBundles(): Bundle[];
947
+ /**
948
+ * Returns a copy of the properties of the service referenced by this
949
+ * `ServiceReference` object.
950
+ *
951
+ * This method will continue to return the properties after the service has
952
+ * been unregistered. This is so references to unregistered services (for
953
+ * example, `ServiceReference` objects stored in the log) can still be
954
+ * interrogated.
955
+ *
956
+ * The returned `Dictionary` object:
957
+ *
958
+ * Must map property values by using property keys in a
959
+ * case-insensitive manner.
960
+ * Must return property keys is a case-preserving manner. This
961
+ * means that the keys must have the same case as the corresponding key in
962
+ * the properties `Dictionary` that was passed to the
963
+ * {@link BundleContext#registerService(String[],Object,Dictionary)} or
964
+ * {@link ServiceRegistration#setProperties(Dictionary)} methods.
965
+ * Is the property of the caller and can be modified by the caller but
966
+ * any changes are not reflected in the properties of the service.
967
+ * {@link ServiceRegistration#setProperties(Dictionary)} must be called to
968
+ * modify the properties of the service.
969
+ *
970
+ *
971
+ * @return A copy of the properties of the service referenced by this
972
+ * `ServiceReference` object
973
+ * @since 1.9
974
+ */
975
+ getProperties(): Dictionary<string, any>;
976
+ }
977
+ export class Version {
978
+ /**
979
+ * Returns the major component of this version identifier.
980
+ *
981
+ * @return The major component.
982
+ */
983
+ getMajor(): number;
984
+ /**
985
+ * Returns the minor component of this version identifier.
986
+ *
987
+ * @return The minor component.
988
+ */
989
+ getMinor(): number;
990
+ /**
991
+ * Returns the micro component of this version identifier.
992
+ *
993
+ * @return The micro component.
994
+ */
995
+ getMicro(): number;
996
+ /**
997
+ * Returns the qualifier component of this version identifier.
998
+ *
999
+ * @return The qualifier component.
1000
+ */
1001
+ getQualifier(): string;
1002
+ }
1003
+
1004
+ }