706 Push Stream Specification - OSGi Enterprise 7
OSGi Enterprise Release 7
Prev
Next
706
Push Stream Specification
Version 1.0
706.1
Introduction
In large-scale distributed systems
events
are a
commonly used communication mechanism for passing data and triggering
behaviors. Events are typically generated
asynchronously
rather than at the request of the
processing system, and once received an event usually undergoes some level
of transformation before being stored, acted upon, or forwarded to another
consumer.
Pipelines and streams are a popular and effective model for
consuming and processing events, with numerous APIs providing this sort of
model. One of the most well-known processing pipeline APIs is the Java 8
Streams API, which provides a functional pipeline for operating on
Collections. The Streams API is inherently
pull
based
” as it relies on iterators and spliterators to
pull
the next entry from the stream. This is the
primary difference between synchronous and asynchronous models. In an
asynchronous world events are pushed into the pipeline as they are
received.
This specification defines a PushStream API which can be used on
devices which support the Java 8 compact1 profile. The PushStream API
defined by this specification depends on OSGi Promises but is independent
of all other OSGi specifications, including the OSGi Framework, and thus
can be easily used outside of the OSGi environment.
A PushStream object encapsulates a pipeline of a potentially
asynchronous tasks which will be performed when an event arrives. The
result of the processing pipeline is represented using a Promise object
which will resolve when the result has been calculated.
PushStream capture the effects of errors, finite streams and back
pressure by making these explicit in the API signatures. Errors and End of
Stream conditions are represented by specific events which are pushed into
the stream. Back pressure is represented by a delay value returned from
the event pipeline stages.
706.1.1
Essentials
Common concepts
- The API is inspired by
the Streams API in Java 8 and uses the same basic concepts. See
[1]
Java 8 Stream API
Independent
- The design is independent
of all other OSGi specifications (except for OSGi Promises) and can
be used outside of an OSGi environment.
Asynchronous
- The design is built to
handle asynchronously produced events.
Back Pressure
- The design provides a
means for event pipelines to communicate back-pressure to the Event
Source.
Complete
- The design provides a very
complete set of operations for PushStreams which are primitives that
can be used to address most use cases.
Generified
- Generics are used to promote
type safety.
706.1.2
Entities
Push Event Source
- A PushEventSource
object represents a source of asynchronous events, and can be used
to create a PushStream.
Push Event Consumer
- A Push Event
Consumer object represents a sink for asynchronous events, and can
be attached to a PushEventSource or a PushStream.
Push Stream
- A PushStream object
represents a pipeline for processing asynchronous events.
Terminal Operation
- The final operation
of a PushStream pipeline results in a Promise which represents the
completion state of the pipeline. The operation also begins the
processing of events.
706.2
Asynchronous Event Streams
The Push Stream API is built upon the principals of Asynchronous
Event streams, and therefore requires three basic primitives:
An event object
A source of event objects
A consumer of event objects
706.2.1
The Push Event
The
PushEvent
is an object representing an event. Every Push
Event has an event type, which has one of three values:
DATA
- A data event encapsulates a typed
object
ERROR
- An error event encapsulates an exception
and indicates a failure in the event stream.
CLOSE
- A close event represents the end of the
stream of events.
An event stream consists of zero or more data events followed by a
terminal event
. A terminal event is either an error
or a close, and it indicates that there will be no more events in this
stream. Depending on the reason for the terminal event it may be
possible to re-attach to the event source and consume more
events.
706.2.2
The Push Event Source
A Push Event Source object represents a source of asynchronous
Push Events. The event source defines a single method
open(PushEventConsumer)
which can be used to connect to the source and
begin receiving a stream of events.
The
open
method of the Push Event Source returns an
AutoCloseable
which can be used to close the event stream.
If the
close
method is called on this object then the
stream is terminated by sending a close event. If additional calls are
made to the close method then they return without further action.
706.2.3
The Push Event Consumer
A Push Event Consumer object represents a sink for asynchronous
Push Events. The event consumer defines a single method
accept(PushEvent)
which can be used to receive a stream of
events.
The
accept
method of the Push Event Consumer returns
long
representing
back pressure
Back pressure is described in detail in
Back pressure
. If the returned long is
negative then the event stream should be closed by the event
source.
706.2.4
Closing the Event Stream
There are three ways in which a stream of events can complete
normally.
The Push Event Source may close the stream at any time by
sending a terminal event to the consumer. Upon receiving a terminal
event the consumer should clean up any resources and not expect to
receive further messages. Note that in a multi-threaded system the
consumer may receive events out of order, and in this case data
events may be received after a terminal event. Event processors
should be careful to ignore data events that occur after terminal
events, and to ensure that any downstream consumers receive any
pending data events before forwarding the terminal event.
The
open
method of the Push Event Source returns
an
AutoCloseable
which can be used to close the event
stream. If the
close
method is called on this object
then the stream is terminated by sending a close event. If
additional calls are made to the close method then they return
without action. If the close method is called after a terminal event
has been sent for any other reason then it must return without
action.
The
accept
method of the Push Event Consumer
returns a long indicating back pressure. If the long is negative
then the event source must close the stream by sending a close
event.
706.3
The Push Stream
Simple event passing can be achieved by connecting a Push Event
Consumer directly to a Push Event Source, however this model forces a
large amount of flow-control and resource management into a single
location. Furthermore it is difficult to reuse business logic across
different event streams.
The
PushStream
provides a powerful, flexible pipeline for event
processing. The Push Stream API shares many concepts with the Java 8
Streams API, in particular Push Streams are lazy, they may not consume the
entire event stream, and they can be composed from functional
steps.
706.3.1
Simple Pipelines
A Push Stream can be created from a Push Event Source by using a
PushStreamProvider
. A Push Stream represents a stage in an event
processing pipeline. The overall pipeline is constructed from zero or
more
intermediate operations
, and completed with a
single
terminal operation
Each intermediate operation returns a new Push Stream object
chained to the previous pipeline step. Once a Push Stream object has had
an intermediate operation invoked on it then it may not have any other
operations chained to it. Terminal operations are either void, or return
Promise
representing the future result of the pipeline.
These API patterns allow Push Streams to be built using a fluent
API.
Push Stream instances are lazy, and so the Push Stream will not be
connected to the Push Event Source until a
terminal
operation
is invoked on the Push Stream. This means that a push
stream object can be safely built without events being received when the
pipeline is partially initialized.
706.3.1.1
Mapping, Flat Mapping and Filtering
The simplest intermediate operations on a Push Stream are
mapping
and
filtering
. These
operations use stateless, non-interfering functions to alter the data
received by the next stage in the pipeline.
706.3.1.1.1
Mapping
Mapping is the act of transforming an event from one type into
another. This may involve taking a field from the object, or
performing some simple processing on it. When mapping there is an
one to one
relationship between input and
output events, that is, each input event is mapped to exactly one
output event.
PushStream streamOfStrings = getStreamOfStrings();

PushStream streamOfLengths =
streamOfStrings.map(String::length);
If the mapping function throws an Exception then an Error
Event is propagated down the stream to the next pipeline step. The
failure in the error event is set to the Exception thrown by the
mapping function. The current pipeline step is also closed, and the
close operation is propagated back upstream to the event source by
closing previous pipeline stages. Any subsequently received events
must not be propagated and must return negative back
pressure.
706.3.1.1.2
Flat Mapping
Flat Mapping is the act of transforming an event from one type
into multiple events of another type. This may involve taking fields
from an object, or performing some simple processing on it. When
flat mapping there is a
one to many
relationship between input and output events, that is, each input
event is mapped to zero or more output events.
A flat mapping function should asynchronously consume the
event data and return a Push Stream containing the flow of
subsequent events.
PushStream streamOfStrings = getStreamOfStrings();

PushStream streamOfCharacters =
streamOfStrings.flatMap(s -> {
SimplePushEventSource spes =
getSimplePushEventSource();

spes.connectPromise()
.onResolve(() ->
executor.execute(() -> {
for(int i = 0; i < s.length; i++) {
spes.publish(s.charAt(i));
});
return pushStreamProvider.createStream(spes);
});
If the flat mapping function throws an Exception then an Error
Event is propagated down the stream to the next pipeline step. The
failure in the error event is set to the Exception thrown by the
mapping function. The current pipeline step is also closed, and the
close operation is propagated back upstream to the event source by
closing previous pipeline stages. Any subsequently received events
must not be propagated and must return negative back
pressure.
706.3.1.1.3
Filtering
Filtering is the act of removing events from the stream based
on some characteristic of the event data. This may involve
inspecting the fields of the data object, or performing some simple
processing on it. If the filter function returns true for an event
then it will be passed to the next stage of the pipeline. If the
filter function returns false then it will be discarded, and not
passed to the next pipeline stage.
PushStream streamOfStrings = getStreamOfStrings();

PushStream filteredStrings =
streamOfStrings.filter(s -> s.length() == 42);
If the filtering function throws an Exception then an Error
Event is propagated down the stream to the next pipeline step. The
failure in the error event is set to the Exception thrown by the
filter function. The current pipeline step is also closed, and the
close operation is propagated back upstream to the event source by
closing previous pipeline stages. Any subsequently received events
must not be propagated and must return negative back
pressure.
706.3.1.1.4
Asynchronous Mapping
Mapping operations may sometimes take time to calculate their
results. PushStream operations should, in general be fast and
non-blocking and so long-running mapping operations should be run on
a separate thread. The
asyncMap(int,int,Function)
operation allows the mapping function to
return a Promise representing the ongoing calculation of the mapped
value. When this promise resolves then its value will be passed to
the next pipeline stage.
As asynchronous mapping operations are long-running they
require back pressure to be generated as the number of running
operations increases. The amount of back pressure returned is equal
to the number of pending promises (aside from the mapping operation
that has just started) plus the number of waiting threads if the
maximum number of concurrent promises has been reached. The returned
back pressure when only a single promise is running is therefore
always zero.
706.3.1.2
Stateless and Stateful Intermediate Operations
Intermediate operations are either
stateless
or
stateful
Stateless operations are ones where the pipeline stage does not need
to remember the previous data from the stream. Mapping, Flat Mapping
and Filtering are all stateless operations. The following table lists
the stateless operations on the Push Stream.
Table
706
.1 Stateless Intermediate Operations on the Push Stream
Intermediate Operation
Description
adjustBackPressure(LongUnaryOperator)
adjustBackPressure(ToLongBiFunction)
Register a transformation function to adjust the
back pressure returned by the previous entry in the stream.
The result of this function will be returned as back
pressure.
asyncMap(int,int,Function)
Register a mapping function which will
asynchronously calculate the value to be passed to the next
stage of the stream. The returned back pressure is equal to
one less than the number of outstanding promises, plus the
number of queued threads, multiplied by the delay
value.
filter(Predicate)
Register a selection function to be called with
each data event in the stream. If the function returns
true
then the event will propagated, if
false
then the event will dropped from the
stream.
flatMap(Function)
Register a transformation function to be called
with each data event in the stream. Each incoming data element
is converted into a stream of elements. The transformed data
is then propagated to the next stage of the
stream.
fork(int,int,Executor)
Pushes event processing onto one or more threads
in the supplied
Executor
returning a fixed back
pressure
map(Function)
Register a transformation function to be called
with each data event in the stream. The transformed data is
propagated to the next stage of the stream.
merge(PushStream)
Merges
this
stream and another
stream into a single stream. The returned stream will not
close until both parent streams are closed.
sequential()
Forces data events to be delivered sequentially
to the next stage of the stream. Events may be delivered on
multiple threads, but will not arrive concurrently at the next
stage of the pipeline.
split(Predicate...)
Register a set of filter functions to select
elements that should be forwarded downstream. The returned
streams correspond to the supplied filter
functions.
Stateful operations differ from stateless operations in that
they must remember items from the stream. Sometimes stateful
operations must remember large numbers of events, or even the entire
stream. For example the
distinct
operation remembers the
identity of each entry in the stream, and filters out duplicate
events.
Care should be taken when using Stateful operations with large
or infinite streams. For example the
sorted
operation
must process the
entire
stream until it receives
a close event. At this point the events can be sorted and delivered in
order. It is usually a good idea to use the
limit
operation to restrict the length of the stream before performing a
stateful operation which must remember many elements.
The following table lists all of the stateful operations of the
PushStream.
Table
706
.2 Stateful Intermediate Operations on the Push Stream
Intermediate Operation
Description
buffer()
Introduces a buffer before the next stage of the
stream. The buffer can be used to provide a circuit breaker,
or to allow a switch of consumer thread(s).
buildBuffer()
Introduces a configurable buffer before the next
stage of the stream. The buffer can be used to provide a
circuit breaker, or to allow a switch of consumer
thread(s).
coalesce(Function)
coalesce(int,Function)
coalesce(IntSupplier,Function)
Register a coalescing function which aggregates
one or more data events into a single data event which will be
passed to the next stage of the stream.
The
number of events to be accumulated is either provided as a
fixed number, or as the result of a function
distinct()
A variation of
filter(Predicate)
which drops data from the stream that
has already been seen. Specifically if a data element
equals
an element which has previously been seen
then it will be dropped. This stateful operation must remember
all data that has been seen.
limit(long)
Limits the length of the stream to the defined
number of elements. Once that number of elements are received
then a close event is propagated to the next stage of the
stream.
limit(Duration)
Limits the time that the stream will remain open
to the supplied
Duration
. Once that time has
elapsed then a close event is propagated to the next stage of
the stream.
skip(long)
Drops the supplied number of data events from the
stream and then forwards any further data
events.
sorted()
sorted(Comparator)
Remembers all items in the stream until the
stream ends. At this point the data in the stream will be
propagated to the next stage of the stream, either in the
Natural Ordering of the elements, or in the order defined by
the supplied Comparator.
timeout(Duration)
Tracks the time since the last event was
received. If no event is received within the supplied Duration
then an error event is propagated to the next stage of the
stream. The exception in the event will be an
org.osgi.util.promise.TimeoutException
window(Duration,Function)
window(Duration,Executor,Function)
window(Supplier,IntSupplier,BiFunction)
window(Supplier,IntSupplier,Executor,BiFunction)
Collects events over the specified time-limit,
passing them to the registered handler function. If no events
occur during the time limit then a Collection containing no
events is passed to the handler function.
706.3.1.3
Terminal Operations
Terminal operations mark the end of a processing pipeline.
Invoking a terminal operation causes the PushStream to connect to its
underlying event source and begin processing.
The simplest terminal operation is the
count()
operation. This method returns a promise that
will resolve when the stream finishes. If the stream finishes with a
close event then the promise will resolve with a Long representing the
number of events that reached the end of the pipeline. If the stream
finishes with an error then the promise will fail with that
error.
Terminal operations such as
forEachEvent(PushEventConsumer)
are passed a handler function which will be
called for each piece of data that reaches the end of the stream. If
the handler function throws an Exception then the Promise returned by
the terminal operation must fail with the Exception thrown by the
handler function.
Some terminal operations, like
count
require the
full stream to be processed, others are able to finish before the end
of the stream. These are known as
short
circuiting
operations. An example of a short-circuiting
operation is
findFirst()
. This operation resolves the promise with the
first event that is received by the end of the pipeline. Once a
short-circuiting operation has completed it propagates negative
back-pressure through the pipeline to close the source of events. Any
subsequently received events must not affect the result and must
return negative back pressure. If an asynchronous pipeline step is
encountered, such as a buffer, the close operation is propagated back
upstream to the event source by closing previous pipeline
stages.
Table
706
.3 Non Short Circuiting Terminal Operations on the Push
Stream
Terminal Operation
Description
collect(Collector)
Uses the Java Collector API to collect the data
from events into a single Collection, Map, or other
type.
count()
Counts the number of events that reach the end of
the stream pipeline.
forEach(Consumer)
Register a function to be called back with the
data from each event in the stream
forEachEvent(PushEventConsumer)
Register a
PushEventConsumer
to be
called back with each event in the stream. If negative
back-pressure is returned then the stream will be
closed.
max(Comparator)
Uses a Comparator to find the largest data
element in the stream of data. The promise is resolved with
the final result when the stream finishes.
min(Comparator)
Uses a Comparator to find the smallest data
element in the stream of data. The promise is resolved with
the final result when the stream finishes.
reduce(BinaryOperator)
reduce(T,BinaryOperator)
reduce(U,BiFunction,BinaryOperator)
Uses a Binary Operator function to combine event
data into a single object. The promise is resolved with the
final result when the stream finishes.
toArray()
toArray(IntFunction)
Collects together all of the event data in a
single array which is used to resolve the returned
promise.
Table
706
.4 Short Circuiting Terminal Operations on the Push
Stream
Terminal Operation
Description
allMatch(Predicate)
Resolves with
false
if any event
reaches the end of the stream pipeline that does not match the
predicate. If the stream ends without any data matching the
predicate then the promise resolves with
true
anyMatch(Predicate)
Resolves with
true
if any data event
reaches the end of the stream pipeline and matches the
supplied predicate. If the stream ends without any data
matching the predicate then the promise resolves with
false
findAny()
Resolves with an Optional representing the data
from the first event that reaches the end of the pipeline. If
the stream ends without any data reaching the end of the
pipeline then the promise resolves with an empty
Optional.
findFirst()
Resolves with an Optional representing the data
from the first event that reaches the end of the pipeline. If
the stream ends without any data reaching the end of the
pipeline then the promise resolves with an empty
Optional.
noneMatch(Predicate)
Resolves with
false
if any data
event reaches the end of the stream pipeline and matches the
supplied predicate. If the stream ends without any data
matching the predicate then the promise resolves with
true
706.3.2
Buffering, Back pressure and Circuit Breakers
Buffering and Back Pressure are an important part of asynchronous
stream processing. Back pressure and buffering are therefore an
important part of the push stream API.
706.3.2.1
Back pressure
In a synchronous model the producer's thread is held by the
consumer until the consumer has finished processing the data. This is
not true for asynchronous systems, and so a producer can easily
overwhelm a consumer with data. Back pressure is therefore used in
asynchronous systems to allow consumers to control the speed at which
producers provide data.
Back pressure in the asynchronous event processing model is
provided by the PushEventConsumer. The value returned by the
accept
method of the PushEventConsumer is an indication
of the requested back pressure. A return of zero indicates that event
delivery may continue immediately. A positive return value indicates
that the source should delay sending any further events for the
requested number of milliseconds. A negative return value indicates
that no further events should be sent and that the stream can be
closed.
Back pressure in a Push Stream can also be applied mid-way
through the processing pipeline through the use of the
adjustBackPressure(LongUnaryOperator)
or
adjustBackPressure(ToLongBiFunction)
methods. These methods can be used to increase
or decrease the back pressure requested by later stages of the
pipeline.
706.3.2.2
Buffering
In asynchronous systems events may be produced and consumed at
different rates. If the consumer is faster than the producer then
there is no issue, however if the producer is faster than the consumer
then events must be held somewhere. Back pressure provides some
assistance here, however some sources do not have control over when
events are produced. In these cases the data must be buffered until it
can be processed.
As well as providing a queue for pending work, introducing
buffers allows event processing to be moved onto a different thread,
and for the number of processing threads to be changed part way
through the pipeline. Buffering can therefore protect an
PushEventSource from having its event generation thread “stolen” by a
consumer which executes a long running operation. As a result the
PushEventSource can be written more simply, without a thread switch,
if a buffer is used.
Buffering also provides a “fire break” for back-pressure.
Back-pressure return values propagate back along a PushStream until
they reach a part of the stream that is able to respond. For some
PushEventSource implementations it is not possible to slow or delay
event generation, however a buffer can always respond to back pressure
by not releasing events from the buffer. Buffers can therefore be used
to “smooth out” sources that produce bursts of events more quickly
than they can be immediately processed. This simplifies the creation
of PushEventConsumer instances, which can rely on their back-pressure
requests being honored.
Buffering is provided by the Push Stream using default
configuration values, either when creating the Push Stream from the
Push Stream Provider, or using the
buffer
method. These
defaults are described in
Building a Buffer or Push Stream
The default configuration values can be overridden by using a
BufferBuilder
to explicitly provide the buffering
parameters. If no Executor is provided then the PushStream will create
its own internal Executor with the same number of threads as the
defined parallelism. An internally created Executor will be shut down
when the PushStream is closed.
706.3.2.3
Buffering policies
Buffering policies govern the behavior of a buffer as it becomes
full.
The
QueuePolicy
of the buffer determines what happens when the
queue becomes full. Different policies may discard incoming data,
evict data from the buffer, block, or throw an exception.
The
QueuePolicyOption
provides basic implementations of the queue
policies, but custom polices can be implemented to provide more
complex behaviors.
The
PushbackPolicy
of the buffer determines how much back
pressure is requested by the buffer. Different policies may return a
constant value, slowly increase the back pressure as the buffer fills,
or return an exponentially increasing value when the buffer is
full.
The
PushbackPolicyOption
provides basic implementations of the push
back policies, but custom polices can be implemented to provide more
complex behaviors.
706.3.2.4
Building a Buffer or Push Stream
The
PushStreamBuilder
can be obtained from a Push Stream Provider
and used to customize the buffer at the start of the PushStream, or it
can be used to create an unbuffered PushStream. An unbuffered
PushStream uses the incoming event delivery thread to process the
events, and therefore users must be careful not to block the thread,
or perform long-running tasks. The default configuration building a
Push Stream is as follows:
A parallelism of one
FAIL
queue policy
LINEAR
push back policy with a maximum push back
of one second
A Buffer with a capacity of 32 elements
A Push Stream also requires a timer and an executor. For a new
Push Stream the Push Stream Provider must create a new fixed pool of
worker threads with the same size as the parallelism. The Push Stream
Provider may create a new
ScheduledExecutorService
for
each new Push Stream, or reuse a common Scheduler. When adding a
buffer to an existing Push Stream the existing executor and timer used
by the Push Stream are reused by default. The builder of the
Buffer/Push Stream may provide their own executor and timer using the
withExecutor(Executor)
and
withScheduler(ScheduledExecutorService)
methods
706.3.2.5
Circuit Breakers
Buffering is a powerful tool in event processing pipelines,
however it cannot help in the situation where the average event
production rate is higher than the average processing rate. Rather
than having an infinitely growing buffer a circuit breaker is used. A
circuit breaker is a buffer which fails the stream when the buffer is
full. This halts event processing and prevents the consuming system
from being overwhelmed.
The default policy for push stream buffers is the FAIL policy,
which means that push stream buffers are all circuit breakers by
default.
706.3.3
Forking
Sometimes the processing that needs to be performed on an event is
long-running. An important part of the asynchronous eventing model is
that callbacks are short and non-blocking, which means that these
callbacks should not run using the primary event thread. One solution to
this is to buffer the stream, allowing a thread handoff at the buffer
and limiting the impact of the long-running task. Buffering, however,
has other consequences, and so it may be the case that a simple thread
hand-off is preferable.
Forking allows users to specify a maximum number of concurrent
downstream operations. Incoming events will block if this limit has been
reached. If there are blocked threads then the returned back pressure
for an event will be equal to the number of queued threads multiplied by
the supplied timeout value. If there are no blocked threads then the
back pressure will be zero.
706.3.4
Coalescing and Windowing
Coalescing and windowing are both processes by which multiple
incoming data events are collapsed into a single outgoing event.
706.3.4.1
Coalescing
There are two main ways to coalesce a stream.
The first mechanism delegates all responsibility to the
coalescing function, which returns an
Optional
. The
coalescing function is called for every data event, and returns an
optional which either has a value, or is empty. If the optional has a
value then this value is passed to the next stage of the processing
pipeline. If the optional is empty then no data event is passed to the
next stage.
The second mechanism allows the stream to be configured with a
(potentially variable) buffer size. The stream then stores values into
this buffer. When the buffer is full then the stream passes the buffer
to the handler function, which returns data to be passed to the next
stage. If the stream finishes when a buffer is partially filled then
the partially filled buffer will be passed to the handler
function.
When coalescing events there is no opportunity for feedback from
the event handler while the events are being buffered. As a result
back pressure from the handler is zero except when the event triggers
a call to the next stage. When the next stage is triggered the back
pressure from that stage is returned.
706.3.4.2
Windowing
Windowing is similar to coalescing, the primary difference
between coalescing and windowing is the way in which the next stage of
processing is triggered. A coalescing stage collects events until it
has the correct number and then passes them to the handler function,
regardless of how long this takes. A windowing stage collects events
for a given amount of time, and then passes the collected events to
the handler function, regardless of how many events are
collected.
To avoid the need for a potentially infinite buffer a windowing
stage may also place a limit on the number of events to be buffered.
If this limit is reached then the window finishes early and the buffer
is passed to the client, just like a coalescing stage. In this mode of
operation the handler function is also passed the length of time for
which the window lasted.
As windowing requires the collected events to be delivered
asynchronously there is no opportunity for back-pressure from the
previous stage to be applied upstream. Windowing therefore returns
zero back-pressure in all cases except when a buffer size limit has
been declared and is reached. If a window size limit is reached then
the windowing stage returns the remaining window time as back
pressure. Applying back pressure in this way means that the event
source will tend not to repeatedly over saturate the window.
706.3.5
Merging and Splitting
Merging and Splitting are actions that can be used to combine push
streams, or to convert one stream into many streams.
706.3.5.1
Merging
A client may need to consume data from more than one Event
Sources. In this case the PushStream may be used to merge two event
streams. The returned stream will receive events from both parent
streams, but will only close when
both
parent
streams have delivered terminal events.
706.3.5.2
Splitting
Sometimes it is desirable to split a stream into multiple
parallel pipelines. These pipelines are independent from the point at
which they are split, but share the same source and upstream
pipeline.
Splitting a stream is possible using the
split(Predicate... predicates)
method.
For each predicate a PushStream will be returned that receives the
events accepted by the predicate.
The lifecycle of a split stream differs from that of a normal
stream in two key ways:
The stream will begin event delivery when any of the
downstream handlers encounters a terminal operation
The stream will only close when all of the downstream
handlers are closed
706.3.6
Time Limited Streams
An important difference between Push Streams and Java 8 Streams is
that events occur over time, there are therefore some operations that do
not apply to Java 8 Streams which are relevant to Push Streams.
The
limit()
operation on a Stream can be used to
limit the number of elements that are processed, however on a Push
Stream that number of events may never be reached, even though the
stream has not closed. Push Streams therefore also have a
limit
method which takes a
Duration
. This
duration limits the time for which the stream is open, closing it after
the duration has elapsed.
The
timeout
operation of a Push Stream can be used to
end a stream if no events are received for the given amount of time. If
an event is received then this resets the timeout counter. The timeout
operation is therefore a useful mechanism for identifying pipelines
which have stalled in their processing. If the timeout expires then it
propagates an error event to the next stage of the pipeline. The
Exception in the error event is an
org.osgi.util.promise.TimeoutException
706.3.7
Closing Streams
PushStream
represents a stage in the processing pipeline
and is
AutoCloseable
. When the
close()
method is invoked it will not, in general,
coincide with the processing of an event. The closing of a stream in
this way must therefore do the following things:
Send a close event downstream to close the stream
Discard events subsequently received by this pipeline stage,
and return negative backpressure for any that do arrive at this
pipeline stage.
Propagate the close operation upstream until the
AutoCloseable
returned by the
open(PushEventConsumer)
method is closed.
The result of this set of operations must be that all stages of
the pipeline, including the connection to the
PushEventSource
, are eagerly closed. This may be as a result of
receiving a close event, negative back pressure, or the close call being
propagated back up the pipeline, but it must not wait for the next
event. For example, if an event is produced every ten minutes and the
stream is closed one minute after an event is created then it must not
take a further nine minutes to close the connection to the Push Event
Source.
706.4
The Push Stream Provider
The
PushStreamProvider
can be used to assist with a
variety of asynchronous event handling use cases. A Push Stream Provider
can create Push Stream instances from a Push Event Source, it can buffer
an Push Event Consumer, or it can turn a Push Stream into a reusable Push
Event Source.
706.4.1
Building Buffers
The Push Stream Provider allows several types of buffered objects
to be created. By default all Push Streams are created with a buffer,
but other objects can also be wrapped in a buffer. For example a Push
Event Consumer can be wrapped in a buffer to isolate it from a Push
Event Source. The
SimplePushEventSource
also has a buffer,
which is used to isolate the event producing thread from event
consumers.
In all cases buffers are configured using a
BufferBuilder
with the following defaults:
A parallelism of one
FAIL
QueuePolicy
LINEAR
PushbackPolicy with a maximum pushback
of one second
A Buffer with a capacity of 32 elements
A Buffer requires a timer and an executor. If no Executor is
provided when creating a buffer then the buffer will have its own
internal Executor with the same number of threads as the defined
parallelism. The Push Stream Provider may create a new
ScheduledExecutorService
for each buffer, or reuse a common
Scheduler. The builder of the Buffer may provide their own executor and
timer using the
withExecutor(Executor)
and
withScheduler(ScheduledExecutorService)
methods
Any internally created Executor will be shut down after the buffer
has processed a terminal event.
706.4.2
Mapping between Java 8 Streams and Push Streams
There are a number of scenarios where an application developer may
wish to convert between a Java 8 Stream and a PushStream. In particular,
the
flatMap(Function)
operation of a Push Stream takes a single event
and converts it into many events in a Push Stream. Common operations,
such as splitting the event into child events will result in a Java
Collection, or a Java 8 Stream. These need to be converted into a Push
Stream before they can be returned from the flatMap operation.
To assist this model the PushStreamProvider provides two
streamOf
methods. These convert a Java 8 Stream into a Push
Stream, changing the pull-based model of Java 8 Streams into the
asynchronous model of the Push Stream.
The first
streamOf(Stream)
method takes a Java 8 Stream. The PushStream
created by this method is not fully asynchronous, it uses the connecting
thread to consume the Java 8 Stream. As a result the streams created
using this method will block terminal operations. This method should
therefore not normally be used for infinite event streams, but instead
for short, finite streams of data that can be processed rapidly, for
example as the result of a flatmapping operation. In this scenario
reusing the incoming thread improves performance. In the following
example an incoming list of URLs is registered for download.
PushStreamProvider psp = new PushStreamProvider();

PushStream> urls = getURLStream();

urls.flatMap(l -> psp.streamOf(l.stream()))
.forEach(url -> registerDownload(url));
For larger Streams of data, or when truly asynchronous operation
is required, there is a second
streamOf(Executor,ScheduledExecutorService,Stream)
method which allows for asynchronous consumption
of the stream. The Executor is used to consume elements from the Java 8
Stream using a single task. This mode of operation is suitable for use
with infinite data streams, or for streams which require a truly
asynchronous mode of operation, and does not require the stream to be
parallel. If
null
is passed for the
Executor
then the PushStreamProvider will create a fixed thread pool of size 2.
This allows for work to continue in the Push Stream even if the
passed-in Stream blocks the consuming thread. If
null
is
passed for the
ScheduledExecutor
then the Push Stream
Provider may create a new scheduler or use a shared default.
706.5
Simple Push Event Sources
The PushEventSource and PushEventConsumer are both functional
interfaces, however it is noticeably harder to implement a PushEventSource
than a PushEventConsumer. A PushEventSource must be able to support
multiple independently closeable consumer registrations, all of which are
providing potentially different amounts of back pressure.
To simplify the case where a user wishes to write a basic event
source the PushStreamProvider is able to create a SimplePushEventSource.
The SimplePushEventSource handles the details of implementing
PushEventSource, providing a simplified API for the event producing code
to use.
Events can be sent via the Simple Push Event Source
publish(T)
method at any time until it is closed. These
events may be silently ignored if no consumer is connected, but if one or
more consumers are connected then the event will be asynchronously
delivered to them.
Close or error events can be sent equally easily using the
endOfStream()
and
error(Throwable)
methods. These will send disconnection events to
all of the currently connected consumers and remove them from the Simple
Push Event Source. Note that sending these events does not close the
Simple Push Event Source. Subsequent connection attempts will succeed, and
events can still be published.
706.5.1
Optimizing Event Creation
In addition to the publication methods the Simple Push Event
Source provides
isConnected()
and
connectPromise()
methods. The isConnected method gives a
point-in-time snapshot of whether there are any connections to the
Simple Push Event Source. If this method returns false then the event
producer may wish to avoid creating the event, particularly if it is
computationally expensive to do so. The connectPromise method returns a
Promise representing the current connection state. This Promise resolves
when there is a client connected (which means it may be resolved
immediately as it is created). If the Simple Push Event Source is closed
before the Promise resolves then the Promise is failed with an
IllegalStateException. The connect Promise can be used to trigger the
initialization of an event thread, allowing lazier startup.
PushStreamProvider psp = new PushStreamProvider();

SimplePushEventSource ses = psp.createSimpleEventSource(Long.class))

Success onConnect = p -> {
new Thread(() -> {
long counter = 0;
// Keep going as long as someone is listening
while (ses.isConnected()) {
ses.publish(++counter);
Thread.sleep(100);
System.out.println("Published: " + counter);
// Restart delivery when a new listener connects
ses.connectPromise().then(onConnect);
}).start();
return null;
};

// Begin delivery when someone is listening
ses.connectPromise().then(onConnect);

// Create a listener which prints out even numbers
psp.createStream(ses).
filter(l -> l % 2L == 0).
limit(5000L).
forEach(f -> System.out.println("Consumed event: " + f));
706.6
Security
The Push Stream API does not define any OSGi services nor does the
API perform any privileged actions. Therefore, it has no security
considerations.
706.7
org.osgi.util.pushstream
Version 1.0
Push Stream Package Version 1.0.
Bundles wishing to use this package must list the package in the
Import-Package header of the bundle's manifest.
Example import for consumers using the API in this package:
Import-Package: org.osgi.util.pushstream; version="[1.0,2.0)"
Example import for providers implementing the API in this package:
Import-Package: org.osgi.util.pushstream; version="[1.0,1.1)"
706.7.1
Summary
BufferBuilder
Create a buffered section of a Push-based stream
PushbackPolicy
PushbackPolicy
is used to calculate how much back pressure to apply
based on the current buffer.
PushbackPolicyOption
PushbackPolicyOption
provides a standard set of simple
PushbackPolicy
implementations.
PushEvent
A PushEvent is an immutable object that is transferred through a
communication channel to push information to a downstream consumer.
PushEvent.EventType
The type of a
PushEvent
PushEventConsumer
An Async Event Consumer asynchronously receives Data events until it receives
either a Close or Error event.
PushEventSource
An event source.
PushStream
A Push Stream fulfills the same role as the Java 8 stream but it reverses the
control direction.
PushStreamBuilder
A Builder for a PushStream.
PushStreamProvider
A factory for
PushStream
instances, and utility methods for handling
PushEventSource
s and
PushEventConsumer
QueuePolicy
QueuePolicy
is used to control how events should be queued in the
current buffer.
QueuePolicyOption
QueuePolicyOption
provides a standard set of simple
QueuePolicy
implementations.
SimplePushEventSource
SimplePushEventSource
is a helper that makes it simpler to write a
PushEventSource
706.7.2
public interface BufferBuilder>>

The type of object being built

The type of objects in the
PushEvent

The type of the Queue used in the user specified buffer
Create a buffered section of a Push-based stream
Provider Type
Consumers of this API must not implement this type
706.7.2.1
public R build()
Returns
the object being built
706.7.2.2
public BufferBuilder withBuffer(U queue)
queue
The BlockingQueue implementation to use as a buffer
Returns
this builder
706.7.2.3
public BufferBuilder withExecutor(Executor executor)
executor
Set the Executor that should be used to deliver events from this
buffer
Returns
this builder
706.7.2.4
public BufferBuilder withParallelism(int parallelism)
parallelism
Set the maximum permitted number of concurrent event deliveries allowed
from this buffer
Returns
this builder
706.7.2.5
public BufferBuilder withPushbackPolicy(PushbackPolicy pushbackPolicy)
pushbackPolicy
Set the
PushbackPolicy
of this builder
Returns
this builder
706.7.2.6
public BufferBuilder withPushbackPolicy(PushbackPolicyOption pushbackPolicyOption, long time)
pushbackPolicyOption
time
Set the
PushbackPolicy
of this builder
Returns
this builder
706.7.2.7
public BufferBuilder withQueuePolicy(QueuePolicy queuePolicy)
queuePolicy
Set the
QueuePolicy
of this Builder
Returns
this builder
706.7.2.8
public BufferBuilder withQueuePolicy(QueuePolicyOption queuePolicyOption)
queuePolicyOption
Set the
QueuePolicy
of this Builder
Returns
this builder
706.7.2.9
public BufferBuilder withScheduler(ScheduledExecutorService scheduler)
scheduler
Set the ScheduledExecutorService that should be used to trigger
timed events after this buffer
Returns
this builder
706.7.3
public interface PushbackPolicy>>

The type of the data

The type of the queue
PushbackPolicy
is used to calculate how much back pressure to apply
based on the current buffer. The
PushbackPolicy
will be called after
an event has been queued, and the returned value will be used as back
pressure.
See Also
PushbackPolicyOption
706.7.3.1
public long pushback(U queue) throws Exception
queue
Given the current state of the queue, determine the level of back
pressure that should be applied
Returns
a back pressure value in nanoseconds
Throws
Exception
706.7.4
enum PushbackPolicyOption
PushbackPolicyOption
provides a standard set of simple
PushbackPolicy
implementations.
See Also
PushbackPolicy
706.7.4.1
FIXED
Returns a fixed amount of back pressure, independent of how full the
buffer is
706.7.4.2
ON_FULL_FIXED
Returns zero back pressure until the buffer is full, then it returns a
fixed value
706.7.4.3
ON_FULL_EXPONENTIAL
Returns zero back pressure until the buffer is full, then it returns an
exponentially increasing amount, starting with the supplied value and
doubling it each time. Once the buffer is no longer full the back
pressure returns to zero.
706.7.4.4
LINEAR
Returns zero back pressure when the buffer is empty, then it returns a
linearly increasing amount of back pressure based on how full the buffer
is. The maximum value will be returned when the buffer is full.
706.7.4.5
public abstract PushbackPolicy getPolicy(long value)
Type Parameters
>>
value
Create a
PushbackPolicy
instance configured with a base back
pressure time in nanoseconds

The actual backpressure returned will vary based on the selected
implementation, the base value, and the state of the buffer.
Returns
PushbackPolicy
to use
706.7.4.6
public static PushbackPolicyOption valueOf(String name)
706.7.4.7
public static PushbackPolicyOption[] values()
706.7.5
public abstract class PushEvent

The payload type of the event.
A PushEvent is an immutable object that is transferred through a
communication channel to push information to a downstream consumer. The event
has three different types:
EventType.DATA
– Provides access to a typed data element in the
stream.
EventType.CLOSE
– The stream is closed. After receiving this
event, no more events will follow.
EventType.ERROR
– The stream ran into an unrecoverable problem
and is sending the reason downstream. The stream is closed and no more events
will follow after this event.
Concurrency
Immutable
Provider Type
Consumers of this API must not implement this type
706.7.5.1
public static PushEvent close()
Type Parameters


The payload type.
Create a new close event.
Returns
A new close event.
706.7.5.2
public static PushEvent data(T payload)
Type Parameters


The payload type.
payload
The payload.
Create a new data event.
Returns
A new data event wrapping the specified payload.
706.7.5.3
public static PushEvent error(Throwable t)
Type Parameters


The payload type.
The error.
Create a new error event.
Returns
A new error event with the specified error.
706.7.5.4
public T getData()
Return the data for this event.
Returns
The data payload.
Throws
IllegalStateException
– if this event is not a
EventType.DATA
event.
706.7.5.5
public Throwable getFailure()
Return the error that terminated the stream.
Returns
The error that terminated the stream.
Throws
IllegalStateException
– if this event is not an
EventType.ERROR
event.
706.7.5.6
public abstract PushEvent.EventType getType()
Get the type of this event.
Returns
The type of this event.
706.7.5.7
public boolean isTerminal()
Answer if no more events will follow after this event.
Returns
false
if this is a data event, otherwise
true
706.7.5.8
public PushEvent nodata()
Type Parameters


The new payload type.
Convenience to cast a close/error event to another payload type. Since
the payload type is not needed for these events this is harmless. This
therefore allows you to forward the close/error event downstream without
creating anew event.
Returns
The current error or close event mapped to a new payload type.
Throws
IllegalStateException
– if the event is a
EventType.DATA
event.
706.7.6
enum PushEvent.EventType
The type of a
PushEvent
706.7.6.1
DATA
A data event forming part of the stream
706.7.6.2
ERROR
An error event that indicates streaming has failed and that no more
events will arrive
706.7.6.3
CLOSE
An event that indicates that the stream has terminated normally
706.7.6.4
public static PushEvent.EventType valueOf(String name)
706.7.6.5
public static PushEvent.EventType[] values()
706.7.7
public interface PushEventConsumer

The type for the event payload
An Async Event Consumer asynchronously receives Data events until it receives
either a Close or Error event.
706.7.7.1
public static final long ABORT = -1L
If ABORT is used as return value, the sender should close the channel all
the way to the upstream source. The ABORT will not guarantee that no
more events are delivered since this is impossible in a concurrent
environment. The consumer should accept subsequent events and close/clean
up when the Close or Error event is received.

Though ABORT has the value -1, any value less than 0 will act as an
abort.
706.7.7.2
public static final long CONTINUE = 0L
A 0 indicates that the consumer is willing to receive subsequent events
at full speeds.

Any value more than 0 will indicate that the consumer is becoming
overloaded and wants a delay of the given milliseconds before the next
event is sent. This allows the consumer to pushback the event delivery
speed.
706.7.7.3
public long accept(PushEvent event) throws Exception
event
The event
Accept an event from a source. Events can be delivered on multiple
threads simultaneously. However, Close and Error events are the last
events received, no more events must be sent after them.
Returns
less than 0 means abort, 0 means continue, more than 0 means
delay ms
Throws
Exception
– to indicate that an error has occurred and that no
further events should be delivered to this
PushEventConsumer
706.7.8
public interface PushEventSource

The payload type
An event source. An event source can open a channel between a source and a
consumer. Once the channel is opened (even before it returns) the source can
send events to the consumer.

A source should stop sending and automatically close the channel when sending
an event returns a negative value, see
PushEventConsumer.ABORT
Values that are larger than 0 should be treated as a request to delay the
next events with those number of milliseconds.
706.7.8.1
public AutoCloseable open(PushEventConsumer aec) throws Exception
aec
the consumer (not null)
Open the asynchronous channel between the source and the consumer. The
call returns an AutoCloseable. This can be closed, and should
close the channel, including sending a Close event if the channel was not
already closed. The returned object must be able to be closed multiple
times without sending more than one Close events.
Returns
a AutoCloseable that can be used to close the stream
Throws
Exception
706.7.9
public interface PushStream
extends AutoCloseable

The Payload type
A Push Stream fulfills the same role as the Java 8 stream but it reverses the
control direction. The Java 8 stream is pull based and this is push based. A
Push Stream makes it possible to build a pipeline of transformations using a
builder kind of model. Just like streams, it provides a number of terminating
methods that will actually open the channel and perform the processing until
the channel is closed (The source sends a Close event). The results of the
processing will be send to a Promise, just like any error events. A stream
can be used multiple times. The Push Stream represents a pipeline. Upstream
is in the direction of the source, downstream is in the direction of the
terminating method. Events are sent downstream asynchronously with no
guarantee for ordering or concurrency. Methods are available to provide
serialization of the events and splitting in background threads.
Provider Type
Consumers of this API must not implement this type
706.7.9.1
public PushStream adjustBackPressure(LongUnaryOperator adjustment)
adjustment
Changes the back-pressure propagated by this pipeline stage.
The supplied function receives the back pressure returned by the next
pipeline stage and returns the back pressure that should be returned by
this stage. This function will not be called if the previous pipeline
stage returns negative back pressure.
Returns
Builder style (can be a new or the same object)
706.7.9.2
public PushStream adjustBackPressure(ToLongBiFunction adjustment)
adjustment
Changes the back-pressure propagated by this pipeline stage.
The supplied function receives the data object passed to the next
pipeline stage and the back pressure that was returned by that stage when
accepting it. The function returns the back pressure that should be
returned by this stage. This function will not be called if the previous
pipeline stage returns negative back pressure.
Returns
Builder style (can be a new or the same object)
706.7.9.3
public Promise allMatch(Predicate predicate)
predicate
Closes the channel and resolve the promise with false when the predicate
does not matches a pay load. If the channel is closed before, the promise
is resolved with true.
This is a
short circuiting terminal operation
Returns
A Promise that will resolve when an event fails to match the
predicate, or the end of the stream is reached
706.7.9.4
public Promise anyMatch(Predicate predicate)
predicate
Close the channel and resolve the promise with true when the predicate
matches a payload. If the channel is closed before the predicate matches,
the promise is resolved with false.
This is a
short circuiting terminal operation
Returns
A Promise that will resolve when an event matches the predicate,
or the end of the stream is reached
706.7.9.5
public PushStream asyncMap(int n, int delay, Function> mapper)
Type Parameters

number of simultaneous promises to use
delay
Nr of ms/promise that is queued back pressure
mapper
The mapping function
Asynchronously map the payload values. The mapping function returns a
Promise representing the asynchronous mapping operation.
The PushStream limits the number of concurrently running mapping
operations, and returns back pressure based on the number of existing
queued operations.
Returns
Builder style (can be a new or the same object)
Throws
IllegalArgumentException
– if the number of threads is < 1 or
the delay is < 0
NullPointerException
– if the mapper is null
706.7.9.6
public PushStream buffer()
Buffer the events in a queue using default values for the queue size and
other behaviors. Buffered work will be processed asynchronously in the
rest of the chain. Buffering also blocks the transmission of back
pressure to previous elements in the chain, although back pressure is
honored by the buffer.
Buffers are useful for "bursty" event sources which produce a number of
events close together, then none for some time. These bursts can
sometimes overwhelm downstream event consumers. Buffering will not,
however, protect downstream components from a source which produces
events faster than they can be consumed. For fast sources
filter(Predicate)
and
coalesce(int, Function)
fork(int, int, Executor)
are better choices.
Returns
Builder style (can be a new or the same object)
706.7.9.7
public PushStreamBuilder buildBuffer()
Type Parameters
>>
Build a buffer to enqueue events in a queue using custom values for the
queue size and other behaviors. Buffered work will be processed
asynchronously in the rest of the chain. Buffering also blocks the
transmission of back pressure to previous elements in the chain, although
back pressure is honored by the buffer.
Buffers are useful for "bursty" event sources which produce a number of
events close together, then none for some time. These bursts can
sometimes overwhelm downstream event consumers. Buffering will not,
however, protect downstream components from a source which produces
events faster than they can be consumed. For fast sources
filter(Predicate)
and
coalesce(int, Function)
fork(int, int, Executor)
are better choices.
Buffers are also useful as "circuit breakers" in the pipeline. If a
QueuePolicyOption.FAIL
is used then a full buffer will trigger
the stream to close, preventing an event storm from reaching the client.
Returns
A builder which can be used to configure the buffer for this
pipeline stage.
706.7.9.8
public void close()
Close this PushStream by sending an event of type
PushEvent.EventType.CLOSE
downstream. Closing a PushStream is a
safe operation that will not throw an Exception.
Calling
close()
on a closed PushStream has no effect.
706.7.9.9
public PushStream coalesce(Function> f)
Type Parameters

Coalesces a number of events into a new type of event. The input events
are forwarded to a accumulator function. This function returns an
Optional. If the optional is present, it's value is send downstream,
otherwise it is ignored.
Returns
Builder style (can be a new or the same object)
706.7.9.10
public PushStream coalesce(int count, Function, R> f)
Type Parameters

count
Coalesces a number of events into a new type of event. A fixed number of
input events are forwarded to a accumulator function. This function
returns new event data to be forwarded on.
Returns
Builder style (can be a new or the same object)
706.7.9.11
public PushStream coalesce(IntSupplier count, Function, R> f)
Type Parameters

count
Coalesces a number of events into a new type of event. A variable number
of input events are forwarded to a accumulator function. The number of
events to be forwarded is determined by calling the count function. The
accumulator function then returns new event data to be forwarded on.
Returns
Builder style (can be a new or the same object)
706.7.9.12
public Promise collect(Collector collector)
Type Parameters

collector
See Stream. Will resolve once the channel closes.
This is a
terminal operation
Returns
A Promise representing the collected results
706.7.9.13
public Promise count()
See Stream. Will resolve onces the channel closes.
This is a
terminal operation
Returns
A Promise representing the number of values in the stream
706.7.9.14
public PushStream distinct()
Remove any duplicates. Notice that this can be expensive in a large
stream since it must track previous payloads.
Returns
Builder style (can be a new or the same object)
706.7.9.15
public PushStream filter(Predicate predicate)
predicate
The predicate that is tested (not null)
Only pass events downstream when the predicate tests true.
Returns
Builder style (can be a new or the same object)
706.7.9.16
public Promise> findAny()
Close the channel and resolve the promise with the first element. If the
channel is closed before, the Optional will have no value.
This is a
terminal operation
Returns
a promise
706.7.9.17
public Promise> findFirst()
Close the channel and resolve the promise with the first element. If the
channel is closed before, the Optional will have no value.
Returns
a promise
706.7.9.18
public PushStream flatMap(Function> mapper)
Type Parameters

mapper
The flat map function
Flat map the payload value (turn one event into 0..n events of
potentially another type).
Returns
Builder style (can be a new or the same object)
706.7.9.19
public Promise forEach(Consumer action)
action
The action to perform
Execute the action for each event received until the channel is closed.
This is a terminating method, the returned promise is resolved when the
channel closes.
This is a
terminal operation
Returns
A promise that is resolved when the channel closes.
706.7.9.20
public Promise forEachEvent(PushEventConsumer action)
action
Pass on each event to another consumer until the stream is closed.
This is a
terminal operation
Returns
a promise
706.7.9.21
public PushStream fork(int n, int delay, Executor e)
number of simultaneous background threads to use
delay
Nr of ms/thread that is queued back pressure
an executor to use for the background threads.
Execute the downstream events in up to n background threads. If more
requests are outstanding apply delay * nr of delayed threads back
pressure. A downstream channel that is closed or throws an exception will
cause all execution to cease and the stream to close
Returns
Builder style (can be a new or the same object)
Throws
IllegalArgumentException
– if the number of threads is < 1 or
the delay is < 0
NullPointerException
– if the Executor is null
706.7.9.22
public PushStream limit(long maxSize)
maxSize
Maximum number of elements has been received
Automatically close the channel after the maxSize number of elements is
received.
Returns
Builder style (can be a new or the same object)
706.7.9.23
public PushStream limit(Duration maxTime)
maxTime
The maximum time that the stream should remain open
Automatically close the channel after the given amount of time has
elapsed.
Returns
Builder style (can be a new or the same object)
706.7.9.24
public PushStream map(Function mapper)
Type Parameters

mapper
The map function
Map a payload value.
Returns
Builder style (can be a new or the same object)
706.7.9.25
public Promise> max(Comparator comparator)
comparator
See Stream. Will resolve onces the channel closes.
This is a
terminal operation
Returns
A Promise representing the maximum value, or null if no values
are seen before the end of the stream
706.7.9.26
public PushStream merge(PushEventSource source)
source
The source to merge in.
Merge in the events from another source. The resulting channel is not
closed until this channel and the channel from the source are closed.
Returns
Builder style (can be a new or the same object)
706.7.9.27
public PushStream merge(PushStream source)
source
The source to merge in.
Merge in the events from another PushStream. The resulting channel is not
closed until this channel and the channel from the source are closed.
Returns
Builder style (can be a new or the same object)
706.7.9.28
public Promise> min(Comparator comparator)
comparator
See Stream. Will resolve onces the channel closes.
This is a
terminal operation
Returns
A Promise representing the minimum value, or null if no values
are seen before the end of the stream
706.7.9.29
public Promise noneMatch(Predicate predicate)
predicate
Closes the channel and resolve the promise with false when the predicate
matches any pay load. If the channel is closed before, the promise is
resolved with true.
This is a
short circuiting terminal operation
Returns
A Promise that will resolve when an event matches the predicate,
or the end of the stream is reached
706.7.9.30
public PushStream onClose(Runnable closeHandler)
closeHandler
Will be called on close
Must be run after the channel is closed. This handler will run after the
downstream methods have processed the close event and before the upstream
methods have closed.
Returns
This stream
706.7.9.31
public PushStream onError(Consumer closeHandler)
closeHandler
Will be called on close
Must be run after the channel is closed. This handler will run after the
downstream methods have processed the close event and before the upstream
methods have closed.
Returns
This stream
706.7.9.32
public Promise reduce(T identity, BinaryOperator accumulator)
identity
The identity/begin value
accumulator
The accumulator
Standard reduce, see Stream. The returned promise will be resolved when
the channel closes.
This is a
terminal operation
Returns
706.7.9.33
public Promise> reduce(BinaryOperator accumulator)
accumulator
The accumulator
Standard reduce without identity, so the return is an Optional. The
returned promise will be resolved when the channel closes.
This is a
terminal operation
Returns
an Optional
706.7.9.34
public Promise reduce(U identity, BiFunction accumulator, BinaryOperator combiner)
Type Parameters

identity
accumulator
combiner
combines two U's into one U (for example, combine two
lists)
Standard reduce with identity, accumulator and combiner. The returned
promise will be resolved when the channel closes.
This is a
terminal operation
Returns
The promise
706.7.9.35
public PushStream sequential()
Ensure that any events are delivered sequentially. That is, no
overlapping calls downstream. This can be used to turn a forked stream
(where for example a heavy conversion is done in multiple threads) back
into a sequential stream so a reduce is simple to do.
Returns
Builder style (can be a new or the same object)
706.7.9.36
public PushStream skip(long n)
number of elements to skip
Skip a number of events in the channel.
Returns
Builder style (can be a new or the same object)
Throws
IllegalArgumentException
– if the number of events to skip is
negative
706.7.9.37
public PushStream sorted()
Sorted the elements, assuming that T extends Comparable. This is of
course expensive for large or infinite streams since it requires
buffering the stream until close.
Returns
Builder style (can be a new or the same object)
706.7.9.38
public PushStream sorted(Comparator comparator)
comparator
Sorted the elements with the given comparator. This is of course
expensive for large or infinite streams since it requires buffering the
stream until close.
Returns
Builder style (can be a new or the same object)
706.7.9.39
public PushStream[] split(Predicate... predicates)
predicates
the predicates to test
Split the events to different streams based on a predicate. If the
predicate is true, the event is dispatched to that channel on the same
position. All predicates are tested for every event.
This method differs from other methods of PushStream in three significant
ways:
The return value contains multiple streams.
This stream will only close when all of these child streams have
closed.
Event delivery is made to all open children that accept the event.
Returns
streams that map to the predicates
706.7.9.40
public PushStream timeout(Duration idleTime)
idleTime
The length of time that the stream should remain open
when no events are being received.
Automatically fail the channel if no events are received for the
indicated length of time. If the timeout is reached then a failure event
containing a
TimeoutException
will be sent.
Returns
Builder style (can be a new or the same object)
706.7.9.41
public Promise toArray()
Collect the payloads in an Object array after the channel is closed. This
is a terminating method, the returned promise is resolved when the
channel is closed.
This is a
terminal operation
Returns
A promise that is resolved with all the payloads received over
the channel
706.7.9.42
public Promise toArray(IntFunction generator)
Type Parameters

generator
Collect the payloads in an Object array after the channel is closed. This
is a terminating method, the returned promise is resolved when the
channel is closed. The type of the array is handled by the caller using a
generator function that gets the length of the desired array.
This is a
terminal operation
Returns
A promise that is resolved with all the payloads received over
the channel
706.7.9.43
public PushStream window(Duration d, Function, R> f)
Type Parameters

Buffers a number of events over a fixed time interval and then forwards
the events to an accumulator function. This function returns new event
data to be forwarded on. Note that:
The collection forwarded to the accumulator function will be empty if
no events arrived during the time interval.
The accumulator function will be run and the forwarded event
delivered as a different task, (and therefore potentially on a different
thread) from the one that delivered the event to this
PushStream
Due to the buffering and asynchronous delivery required, this method
prevents the propagation of back-pressure to earlier stages
Returns
Builder style (can be a new or the same object)
706.7.9.44
public PushStream window(Duration d, Executor executor, Function, R> f)
Type Parameters

executor
Buffers a number of events over a fixed time interval and then forwards
the events to an accumulator function. This function returns new event
data to be forwarded on. Note that:
The collection forwarded to the accumulator function will be empty if
no events arrived during the time interval.
The accumulator function will be run and the forwarded event
delivered by a task given to the supplied executor.
Due to the buffering and asynchronous delivery required, this method
prevents the propagation of back-pressure to earlier stages
Returns
Builder style (can be a new or the same object)
706.7.9.45
public PushStream window(Supplier timeSupplier, IntSupplier maxEvents, BiFunction, R> f)
Type Parameters

timeSupplier
maxEvents
Buffers a number of events over a variable time interval and then
forwards the events to an accumulator function. The length of time over
which events are buffered is determined by the time function. A maximum
number of events can also be requested, if this number of events is
reached then the accumulator will be called early. The accumulator
function returns new event data to be forwarded on. It is also given the
length of time for which the buffer accumulated data. This may be less
than the requested interval if the buffer reached the maximum number of
requested events early. Note that:
The collection forwarded to the accumulator function will be empty if
no events arrived during the time interval.
The accumulator function will be run and the forwarded event
delivered as a different task, (and therefore potentially on a different
thread) from the one that delivered the event to this
PushStream
Due to the buffering and asynchronous delivery required, this method
prevents the propagation of back-pressure to earlier stages
If the window finishes by hitting the maximum number of events then
the remaining time in the window will be applied as back-pressure to the
previous stage, attempting to slow the producer to the expected windowing
threshold.
Returns
Builder style (can be a new or the same object)
706.7.9.46
public PushStream window(Supplier timeSupplier, IntSupplier maxEvents, Executor executor, BiFunction,
R> f)
Type Parameters

timeSupplier
maxEvents
executor
Buffers a number of events over a variable time interval and then
forwards the events to an accumulator function. The length of time over
which events are buffered is determined by the time function. A maximum
number of events can also be requested, if this number of events is
reached then the accumulator will be called early. The accumulator
function returns new event data to be forwarded on. It is also given the
length of time for which the buffer accumulated data. This may be less
than the requested interval if the buffer reached the maximum number of
requested events early. Note that:
The collection forwarded to the accumulator function will be empty if
no events arrived during the time interval.
The accumulator function will be run and the forwarded event
delivered as a different task, (and therefore potentially on a different
thread) from the one that delivered the event to this
PushStream
If the window finishes by hitting the maximum number of events then
the remaining time in the window will be applied as back-pressure to the
previous stage, attempting to slow the producer to the expected windowing
threshold.
Returns
Builder style (can be a new or the same object)
706.7.10
public interface PushStreamBuilder>>
extends BufferBuilder, T, U>

The type of objects in the
PushEvent

The type of the Queue used in the user specified buffer
A Builder for a PushStream. This Builder extends the support of a standard
BufferBuilder by allowing the PushStream to be unbuffered.
Provider Type
Consumers of this API must not implement this type
706.7.10.1
public PushStreamBuilder unbuffered()
Tells this
PushStreamBuilder
to create an unbuffered stream which
delivers events directly to its consumer using the incoming delivery
thread. Setting the
PushStreamBuilder
to be unbuffered means that
any buffer, queue policy or push back policy will be ignored. Note that
calling one of:
withBuffer(BlockingQueue)
withQueuePolicy(QueuePolicy)
withQueuePolicy(QueuePolicyOption)
withPushbackPolicy(PushbackPolicy)
withPushbackPolicy(PushbackPolicyOption, long)
withParallelism(int)
after this method will reset this builder to require a buffer.
Returns
the builder
706.7.10.2
public PushStreamBuilder withBuffer(U queue)
queue
The BlockingQueue implementation to use as a buffer
Returns
this builder
706.7.10.3
public PushStreamBuilder withExecutor(Executor executor)
executor
Set the Executor that should be used to deliver events from this
buffer
Returns
this builder
706.7.10.4
public PushStreamBuilder withParallelism(int parallelism)
parallelism
Set the maximum permitted number of concurrent event deliveries allowed
from this buffer
Returns
this builder
706.7.10.5
public PushStreamBuilder withPushbackPolicy(PushbackPolicy pushbackPolicy)
pushbackPolicy
Set the
PushbackPolicy
of this builder
Returns
this builder
706.7.10.6
public PushStreamBuilder withPushbackPolicy(PushbackPolicyOption pushbackPolicyOption, long time)
pushbackPolicyOption
time
Set the
PushbackPolicy
of this builder
Returns
this builder
706.7.10.7
public PushStreamBuilder withQueuePolicy(QueuePolicy queuePolicy)
queuePolicy
Set the
QueuePolicy
of this Builder
Returns
this builder
706.7.10.8
public PushStreamBuilder withQueuePolicy(QueuePolicyOption queuePolicyOption)
queuePolicyOption
Set the
QueuePolicy
of this Builder
Returns
this builder
706.7.10.9
public PushStreamBuilder withScheduler(ScheduledExecutorService scheduler)
scheduler
Set the ScheduledExecutorService that should be used to trigger
timed events after this buffer
Returns
this builder
706.7.11
public final class PushStreamProvider
A factory for
PushStream
instances, and utility methods for handling
PushEventSource
s and
PushEventConsumer
706.7.11.1
public PushStreamProvider()
706.7.11.2
public BufferBuilder, T, U> buildBufferedConsumer(PushEventConsumer delegate)
Type Parameters
>>
delegate
Build a buffered
PushEventConsumer
with custom configuration.
The returned consumer will be buffered from the event source, and will
honor back pressure requests from its delegate even if the event source
does not.
Buffered consumers are useful for "bursty" event sources which produce a
number of events close together, then none for some time. These bursts
can sometimes overwhelm the consumer. Buffering will not, however,
protect downstream components from a source which produces events faster
than they can be consumed.
Buffers are also useful as "circuit breakers". If a
QueuePolicyOption.FAIL
is used then a full buffer will request
that the stream close, preventing an event storm from reaching the
client.
Note that this buffered consumer will close when it receives a terminal
event, or if the delegate returns negative backpressure. No further
events will be propagated after this time.
Returns
PushEventConsumer
with a buffer directly before it
706.7.11.3
public BufferBuilder, T, U> buildEventSourceFromStream(PushStream stream)
Type Parameters
>>
stream
Convert an
PushStream
into an
PushEventSource
. The first
call to
PushEventSource.open(PushEventConsumer)
will begin event
processing.
The
PushEventSource
will remain active until the backing stream
is closed, and permits multiple consumers to
PushEventSource.open(PushEventConsumer)
it. Note that this means
the caller of this method is responsible for closing the supplied
stream if it is not finite in length.
Late joining
consumers will not receive historical events, but will immediately
receive the terminal event which closed the stream if the stream is
already closed.
Returns
PushEventSource
backed by the
PushStream
706.7.11.4
public BufferBuilder, T, U> buildSimpleEventSource(Class type)
Type Parameters
>>
type
Build a
SimplePushEventSource
with the supplied type and custom
buffering behaviors. The SimplePushEventSource will respond to back
pressure requests from the consumers connected to it.
Returns
SimplePushEventSource
706.7.11.5
public PushStreamBuilder buildStream(PushEventSource eventSource)
Type Parameters
>>
eventSource
The source of the events
Builds a push stream with custom configuration.
The resulting
PushStream
may be buffered or unbuffered depending
on how it is configured.
Returns
PushStreamBuilder
for the stream
706.7.11.6
public PushEventConsumer createBufferedConsumer(PushEventConsumer delegate)
Type Parameters

delegate
Create a buffered
PushEventConsumer
with the default configured
buffer, executor size, queue, queue policy and pushback policy. This is
equivalent to calling
buildBufferedConsumer(delegate).create();
The returned consumer will be buffered from the event source, and will
honor back pressure requests from its delegate even if the event source
does not.
Buffered consumers are useful for "bursty" event sources which produce a
number of events close together, then none for some time. These bursts
can sometimes overwhelm the consumer. Buffering will not, however,
protect downstream components from a source which produces events faster
than they can be consumed.
Returns
PushEventConsumer
with a buffer directly before it
706.7.11.7
public PushEventSource createEventSourceFromStream(PushStream stream)
Type Parameters

stream
Convert an
PushStream
into an
PushEventSource
. The first
call to
PushEventSource.open(PushEventConsumer)
will begin event
processing. The
PushEventSource
will remain active until the
backing stream is closed, and permits multiple consumers to
PushEventSource.open(PushEventConsumer)
it. This is equivalent
to:
buildEventSourceFromStream(stream).create();
Returns
PushEventSource
backed by the
PushStream
706.7.11.8
public SimplePushEventSource createSimpleEventSource(Class type)
Type Parameters

type
Create a
SimplePushEventSource
with the supplied type and default
buffering behaviors. The SimplePushEventSource will respond to back
pressure requests from the consumers connected to it. This is equivalent
to:
buildSimpleEventSource(type).create();
Returns
SimplePushEventSource
706.7.11.9
public PushStream createStream(PushEventSource eventSource)
Type Parameters

eventSource
Create a stream with the default configured buffer, executor size, queue,
queue policy and pushback policy. This is equivalent to calling
buildStream(source).create();
This stream will be buffered from the event producer, and will honor back
pressure even if the source does not.
Buffered streams are useful for "bursty" event sources which produce a
number of events close together, then none for some time. These bursts
can sometimes overwhelm downstream processors. Buffering will not,
however, protect downstream components from a source which produces
events faster (on average) than they can be consumed.
Event delivery will not begin until a terminal operation is reached on
the chain of PushStreams. Once a terminal operation is reached the stream
will be connected to the event source.
Returns
PushStream
with a default initial buffer
706.7.11.10
public PushStream streamOf(Stream items)
Type Parameters

items
The items to push into the PushStream
Create an Unbuffered
PushStream
from a Java Stream The
data from the stream will be pushed into the PushStream synchronously as
it is opened. This may make terminal operations blocking unless a buffer
has been added to the
PushStream
. Care should be taken with
infinite Streams to avoid blocking indefinitely.
Returns
A PushStream containing the items from the Java Stream
706.7.11.11
public PushStream streamOf(Executor executor, ScheduledExecutorService scheduler, Stream items)
Type Parameters

executor
The worker to use to push items from the Stream into the
PushStream
scheduler
The scheduler to use to trigger timed events in the
PushStream
items
The items to push into the PushStream
Create an Unbuffered
PushStream
from a Java Stream The
data from the stream will be pushed into the PushStream asynchronously
using the supplied Executor.
Returns
A PushStream containing the items from the Java Stream
706.7.12
public interface QueuePolicy>>

The type of the data

The type of the queue
QueuePolicy
is used to control how events should be queued in the
current buffer. The
QueuePolicy
will be called when an event has
arrived.
See Also
QueuePolicyOption
706.7.12.1
public void doOffer(U queue, PushEvent event) throws Exception
queue
event
Enqueue the event and return the remaining capacity available for events
Throws
Exception
– If an error occurred adding the event to the queue.
This exception will cause the connection between the
PushEventSource
and the
PushEventConsumer
to
be closed with an
EventType.ERROR
706.7.13
enum QueuePolicyOption
QueuePolicyOption
provides a standard set of simple
QueuePolicy
implementations.
See Also
QueuePolicy
706.7.13.1
DISCARD_OLDEST
Attempt to add the supplied event to the queue. If the queue is unable to
immediately accept the value then discard the value at the head of the
queue and try again. Repeat this process until the event is enqueued.
706.7.13.2
BLOCK
Attempt to add the supplied event to the queue, blocking until the
enqueue is successful.
706.7.13.3
FAIL
Attempt to add the supplied event to the queue, throwing an exception if
the queue is full.
706.7.13.4
public abstract QueuePolicy getPolicy()
Type Parameters
>>
Returns
QueuePolicy
implementation
706.7.13.5
public static QueuePolicyOption valueOf(String name)
706.7.13.6
public static QueuePolicyOption[] values()
706.7.14
public interface SimplePushEventSource
extends PushEventSource, AutoCloseable

The type of the events produced by this source
SimplePushEventSource
is a helper that makes it simpler to write a
PushEventSource
. Users do not need to manage multiple registrations
to the stream, nor do they have to be concerned with back pressure.
Provider Type
Consumers of this API must not implement this type
706.7.14.1
public void close()
Close this source. Calling this method indicates that there will never be
any more events published by it. Calling this method sends a close event
to all connected consumers. After calling this method any
PushEventConsumer
that tries to
open(PushEventConsumer)
this source will immediately receive a close event, and will not see any
remaining buffered events.
706.7.14.2
public Promise connectPromise()
This method can be used to delay event generation until an event source
has connected. The returned promise will resolve as soon as one or more
PushEventConsumer
instances have opened the
SimplePushEventSource.
The returned promise may already be resolved if this
SimplePushEventSource
already has connected consumers. If the
SimplePushEventSource
is closed before the returned Promise
resolves then it will be failed with an IllegalStateException.
Note that the connected consumers are able to asynchronously close their
connections to this
SimplePushEventSource
, and therefore it is
possible that once the promise resolves this
SimplePushEventSource
may no longer be connected to any
consumers.
Returns
A promise representing the connection state of this EventSource
706.7.14.3
public void endOfStream()
Close this source for now, but potentially reopen it later. Calling this
method asynchronously sends a close event to all connected consumers and
then disconnects them. Any events previously queued by the
publish(Object)
method will be delivered before this close
event.
After calling this method any
PushEventConsumer
that wishes may
open(PushEventConsumer)
this source, and will receive subsequent
events.
706.7.14.4
public void error(Throwable t)
the error
Close this source for now, but potentially reopen it later. Calling this
method asynchronously sends an error event to all connected consumers and
then disconnects them. Any events previously queued by the
publish(Object)
method will be delivered before this error
event.
After calling this method any
PushEventConsumer
that wishes may
open(PushEventConsumer)
this source, and will receive subsequent
events.
706.7.14.5
public boolean isConnected()
Determine whether there are any
PushEventConsumer
s for this
PushEventSource
. This can be used to skip expensive event
creation logic when there are no listeners.
Returns
true if any consumers are currently connected
706.7.14.6
public void publish(T t)
Asynchronously publish an event to this stream and all connected
PushEventConsumer
instances. When this method returns there is no
guarantee that all consumers have been notified. Events published by a
single thread will maintain their relative ordering, however they may be
interleaved with events from other threads.
Throws
IllegalStateException
– if the source is closed
706.8
References
[1]
Java 8
Stream API
Prev
Next
OSGi Specification License, Version 2.0
License Grant
No Warranties and Limitation of Liability
Covenant Not to Assert
General
Trademarks
Feedback
Introduction
1.1
Overview of Services
1.1.1
Dependency Injection Models
1.1.2
Distributed Services
1.1.3
Web Applications and HTTP Servlets
1.1.4
Asynchronous Processing and Event models
1.1.5
Management and Configuration services
1.1.6
Naming and Directory services
1.1.7
Database Access
1.1.8
Transaction Support
1.1.9
Miscellaneous Supporting Services
1.2
Application and Provisioning Support
1.3
Reader Level
1.4
Version Information
1.4.1
OSGi Core Release 7
1.4.2
Component Versions
1.4.3
Note
1.5
References
1.6
Changes
100
Remote Services
100.1
The Fallacies
100.2
Remote Service Properties
100.2.1
Registering a Service for Export
100.2.2
Getting an Imported Service
100.2.3
On Demand Import
100.3
Intents
100.3.1
Basic Remote Services: osgi.basic
100.3.2
Asynchronous Remote Services: osgi.async
100.3.3
Confidential Remote Services: osgi.confidential
100.3.4
Private Remote Services: osgi.private
100.4
General Usage
100.4.1
Call by Value
100.4.2
Data Fencing
100.4.3
Remote Services Life Cycle
100.4.4
Runtime
100.4.5
Exceptions
100.5
Configuration Types
100.5.1
Configuration Type Properties
100.5.2
Dependencies
100.6
Security
100.6.1
Limiting Exports and Imports
100.7
References
100.8
Changes
101
Log Service Specification
101.1
Introduction
101.1.1
Entities
101.2
The Logger Interface
101.3
Obtaining a Logger
101.4
Logger Configuration
101.4.1
Configuration Admin Integration
101.4.2
Effective Log Level
101.5
Log Stream Provider
101.6
Log Reader Service
101.7
Log Entry Interface
101.8
Mapping of Events
101.8.1
Bundle Events Mapping
101.8.2
Service Events Mapping
101.8.3
Framework Events Mapping
101.8.4
Log Events
101.9
Log Service
101.10
Capabilities
101.11
Security
101.12
org.osgi.service.log
101.12.1
Summary
101.12.2
public interface FormatterLogger extends Logger
101.12.3
public interface LogEntry
101.12.4
public interface Logger
101.12.5
public interface LoggerConsumer
101.12.6
public interface LoggerFactory
101.12.7
enum LogLevel
101.12.8
public interface LogListener extends EventListener
101.12.9
public interface LogReaderService
101.12.10
public interface LogService extends LoggerFactory
101.13
org.osgi.service.log.admin
101.13.1
Summary
101.13.2
public interface LoggerAdmin
101.13.3
public interface LoggerContext
101.14
org.osgi.service.log.stream
101.14.1
Summary
101.14.2
public interface LogStreamProvider
101.14.3
enum LogStreamProvider.Options
101.15
References
101.16
Changes
102
Http Service Specification
102.1
Introduction
102.1.1
Entities
102.2
Registering Servlets
102.3
Registering Resources
102.4
Mapping HTTP Requests to Servlet and Resource Registrations
102.5
The Default Http Context Object
102.6
Multipurpose Internet Mail Extension (MIME) Types
102.7
Authentication
102.8
Security
102.8.1
Accessing Resources with the Default Http Context
102.8.2
Accessing Other Types of Resources
102.8.3
Servlet and HttpContext objects
102.9
Configuration Properties
102.10
org.osgi.service.http
102.10.1
Summary
102.10.2
public interface HttpContext
102.10.3
public interface HttpService
102.10.4
public class NamespaceException extends Exception
102.11
References
104
Configuration Admin Service Specification
104.1
Introduction
104.1.1
Essentials
104.1.2
Entities
104.1.3
Synopsis
104.2
Configuration Targets
104.3
The Persistent Identity
104.3.1
PID Syntax
104.3.2
Targeted PIDs
104.3.3
Extenders and Targeted PIDs
104.4
The Configuration Object
104.4.1
Location Binding
104.4.2
Dynamic Binding
104.4.3
Configuration Properties
104.4.4
Property Propagation
104.4.5
Automatic Properties
104.4.6
Equality
104.5
Managed Service
104.5.1
Singletons
104.5.2
Networks
104.5.3
Configuring Managed Services
104.5.4
Race Conditions
104.5.5
Examples of Managed Service
104.5.6
Deletion
104.6
Managed Service Factory
104.6.1
When to Use a Managed Service Factory
104.6.2
Registration
104.6.3
Deletion
104.6.4
Managed Service Factory Example
104.6.5
Multiple Consoles Example
104.7
Configuration Admin Service
104.7.1
Creating a Managed Service Configuration Object
104.7.2
Creating a Managed Service Factory Configuration Object
104.7.3
Accessing Existing Configurations
104.7.4
Updating a Configuration
104.7.5
Using Multi-Locations
104.7.6
Regions
104.7.7
Deletion
104.7.8
Updating a Bundle's Own Configuration
104.7.9
Configuration Attributes
104.8
Configuration Events
104.8.1
Event Admin Service and Configuration Change Events
104.9
Configuration Plugin
104.9.1
Limiting The Targets
104.9.2
Example of Property Expansion
104.9.3
Configuration Data Modifications
104.9.4
Forcing a Callback
104.9.5
Calling Order
104.9.6
Manual Invocation
104.10
Meta Typing
104.11
Coordinator Support
104.12
Capabilities
104.12.1
osgi.implementation Capability
104.12.2
osgi.service Capability
104.13
Security
104.13.1
Configuration Permission
104.13.2
Permissions Summary
104.13.3
Configuration and Permission Administration
104.14
org.osgi.service.cm
104.14.1
Summary
104.14.2
Permissions
104.14.3
public interface Configuration
104.14.4
enum Configuration.ConfigurationAttribute
104.14.5
public interface ConfigurationAdmin
104.14.6
public final class ConfigurationConstants
104.14.7
public class ConfigurationEvent
104.14.8
public class ConfigurationException extends Exception
104.14.9
public interface ConfigurationListener
104.14.10
public final class ConfigurationPermission extends BasicPermission
104.14.11
public interface ConfigurationPlugin
104.14.12
public interface ManagedService
104.14.13
public interface ManagedServiceFactory
104.14.14
public class ReadOnlyConfigurationException extends RuntimeException
104.14.15
public interface SynchronousConfigurationListener extends ConfigurationListener
104.15
org.osgi.service.cm.annotations
104.15.1
Summary
104.15.2
@RequireConfigurationAdmin
104.16
Changes
105
Metatype Service Specification
105.1
Introduction
105.1.1
Essentials
105.1.2
Entities
105.1.3
Operation
105.2
Attributes Model
105.3
Object Class Definition
105.4
Attribute Definition
105.5
Meta Type Service
105.6
Meta Type Provider Service
105.7
Using the Meta Type Resources
105.7.1
XML Schema of a Meta Type Resource
105.7.2
Designate Element
105.7.3
Example Metadata File
105.7.4
Object Element
105.8
Meta Type Resource XML Schema
105.9
Meta Type Annotations
105.9.1
ObjectClassDefinition Annotation
105.9.2
AttributeDefinition Annotation
105.9.3
Designate Annotation
105.10
Limitations
105.11
Related Standards
105.12
Capabilities
105.13
Security Considerations
105.14
org.osgi.service.metatype
105.14.1
Summary
105.14.2
public interface AttributeDefinition
105.14.3
public interface MetaTypeInformation extends MetaTypeProvider
105.14.4
public interface MetaTypeProvider
105.14.5
public interface MetaTypeService
105.14.6
public interface ObjectClassDefinition
105.15
org.osgi.service.metatype.annotations
105.15.1
Summary
105.15.2
@AttributeDefinition
105.15.3
enum AttributeType
105.15.4
@Designate
105.15.5
@Icon
105.15.6
@ObjectClassDefinition
105.15.7
@Option
105.15.8
@RequireMetaTypeExtender
105.15.9
@RequireMetaTypeImplementation
105.16
References
105.17
Changes
107
User Admin Service Specification
107.1
Introduction
107.1.1
Essentials
107.1.2
Entities
107.1.3
Operation
107.2
Authentication
107.2.1
Repository
107.2.2
Basic Authentication
107.2.3
Certificates
107.3
Authorization
107.3.1
The Authorization Object
107.3.2
Authorization Example
107.4
Repository Maintenance
107.5
User Admin Events
107.5.1
Event Admin and User Admin Change Events
107.6
Security
107.6.1
User Admin Permission
107.7
Relation to JAAS
107.7.1
JDK 1.3 Dependencies
107.7.2
Existing OSGi Mechanism
107.7.3
Future Road Map
107.8
org.osgi.service.useradmin
107.8.1
Summary
107.8.2
public interface Authorization
107.8.3
public interface Group extends User
107.8.4
public interface Role
107.8.5
public interface User extends Role
107.8.6
public interface UserAdmin
107.8.7
public class UserAdminEvent
107.8.8
public interface UserAdminListener
107.8.9
public final class UserAdminPermission extends BasicPermission
107.9
References
110
Initial Provisioning Specification
110.1
Introduction
110.1.1
Essentials
110.1.2
Entities
110.2
Procedure
110.2.1
InitialProvisioning-Entries Manifest Header
110.3
Special Configurations
110.3.1
Branded OSGi framework Server
110.3.2
Non-connected OSGi framework
110.4
The Provisioning Service
110.5
Management Agent Environment
110.6
Mapping To File Scheme
110.6.1
Example With File Scheme
110.7
Mapping To HTTP(S) Scheme
110.7.1
HTTPS Certificates
110.7.2
Certificate Encoding
110.7.3
URL Encoding
110.8
Mapping To RSH Scheme
110.8.1
Shared Secret
110.8.2
Request Coding
110.8.3
Response Coding
110.8.4
RSH URL
110.8.5
Extensions to the Provisioning Service Dictionary
110.8.6
RSH Transport
110.9
Exception Handling
110.10
Security
110.10.1
Concerns
110.10.2
OSGi framework Long-Term Security
110.10.3
Permissions
110.11
org.osgi.service.provisioning
110.11.1
Summary
110.11.2
public interface ProvisioningService
110.12
References
112
Declarative Services Specification
112.1
Introduction
112.1.1
Essentials
112.1.2
Entities
112.1.3
Synopsis
112.1.4
Readers
112.2
Components
112.2.1
Declaring a Component
112.2.2
Immediate Component
112.2.3
Delayed Component
112.2.4
Factory Component
112.3
References to Services
112.3.1
Accessing Services
112.3.2
Method Injection
112.3.3
Field Injection
112.3.4
Constructor Injection
112.3.5
Reference Cardinality
112.3.6
Reference Scope
112.3.7
Reference Policy
112.3.8
Reference Policy Option
112.3.9
Reference Field Option
112.3.10
Selecting Target Services
112.3.11
Circular References
112.3.12
Logger Support
112.4
Component Description
112.4.1
Annotations
112.4.2
Service Component Header
112.4.3
XML Document
112.4.4
Component Element
112.4.5
Implementation Element
112.4.6
Property and Properties Elements
112.4.7
Service Element
112.4.8
Reference Element
112.4.9
Factory Property and Factory Properties Elements
112.5
Component Life Cycle
112.5.1
Enabled
112.5.2
Satisfied
112.5.3
Immediate Component
112.5.4
Delayed Component
112.5.5
Factory Component
112.5.6
Activation
112.5.7
Bound Services
112.5.8
Component Context
112.5.9
Activation Objects
112.5.10
Binding Services
112.5.11
Activate Method
112.5.12
Bound Service Replacement
112.5.13
Updated
112.5.14
Modification
112.5.15
Modified Method
112.5.16
Deactivation
112.5.17
Deactivate Method
112.5.18
Unbinding
112.5.19
Life Cycle Example
112.6
Component Properties
112.6.1
Service Properties
112.6.2
Reference Properties
112.7
Deployment
112.7.1
Configuration Changes
112.8
Annotations
112.8.1
Component Annotations
112.8.2
Component Property Types
112.8.3
Ordering of Generated Component Properties
112.9
Service Component Runtime
112.9.1
Relationship to OSGi Framework
112.9.2
Starting and Stopping SCR
112.9.3
Logging Messages
112.9.4
Locating Component Methods and Fields
112.9.5
Bundle Activator Interaction
112.9.6
Introspection
112.9.7
Capabilities
112.10
Security
112.10.1
Service Permissions
112.10.2
Required Admin Permission
112.10.3
Using hasPermission
112.10.4
Configuration Multi-Locations and Regions
112.11
Component Description Schema
112.12
org.osgi.service.component
112.12.1
Summary
112.12.2
public interface ComponentConstants
112.12.3
public interface ComponentContext
112.12.4
public class ComponentException extends RuntimeException
112.12.5
public interface ComponentFactory
112.12.6
public interface ComponentInstance
112.12.7
public interface ComponentServiceObjects
112.13
org.osgi.service.component.annotations
112.13.1
Summary
112.13.2
@Activate
112.13.3
enum CollectionType
112.13.4
@Component
112.13.5
@ComponentPropertyType
112.13.6
enum ConfigurationPolicy
112.13.7
@Deactivate
112.13.8
enum FieldOption
112.13.9
@Modified
112.13.10
@Reference
112.13.11
enum ReferenceCardinality
112.13.12
enum ReferencePolicy
112.13.13
enum ReferencePolicyOption
112.13.14
enum ReferenceScope
112.13.15
@RequireServiceComponentRuntime
112.13.16
enum ServiceScope
112.14
org.osgi.service.component.runtime
112.14.1
Summary
112.14.2
public interface ServiceComponentRuntime
112.15
org.osgi.service.component.runtime.dto
112.15.1
Summary
112.15.2
public class ComponentConfigurationDTO extends DTO
112.15.3
public class ComponentDescriptionDTO extends DTO
112.15.4
public class ReferenceDTO extends DTO
112.15.5
public class SatisfiedReferenceDTO extends DTO
112.15.6
public class UnsatisfiedReferenceDTO extends DTO
112.16
org.osgi.service.component.propertytypes
112.16.1
Summary
112.16.2
@ExportedService
112.16.3
@ServiceDescription
112.16.4
@ServiceRanking
112.16.5
@ServiceVendor
112.17
References
112.18
Changes
113
Event Admin Service Specification
113.1
Introduction
113.1.1
Essentials
113.1.2
Entities
113.1.3
Synopsis
113.1.4
What To Read
113.2
Event Admin Architecture
113.3
The Event
113.3.1
Topics
113.3.2
Properties
113.3.3
High Performance
113.4
Event Handler
113.4.1
Ordering
113.5
Event Publisher
113.6
Specific Events
113.6.1
General Conventions
113.6.2
OSGi Events
113.6.3
Framework Event
113.6.4
Bundle Event
113.6.5
Service Event
113.6.6
Other Event Sources
113.7
Event Admin Service
113.7.1
Synchronous Event Delivery
113.7.2
Asynchronous Event Delivery
113.7.3
Order of Event Delivery
113.8
Reliability
113.8.1
Exceptions in callbacks
113.8.2
Dealing with Stalled Handlers
113.9
Interoperability with Native Applications
113.10
Capabilities
113.10.1
osgi.implementation Capability
113.10.2
osgi.service Capability
113.11
Security
113.11.1
Topic Permission
113.11.2
Required Permissions
113.11.3
Security Context During Event Callbacks
113.12
org.osgi.service.event
113.12.1
Summary
113.12.2
public class Event
113.12.3
public interface EventAdmin
113.12.4
public interface EventConstants
113.12.5
public interface EventHandler
113.12.6
public class EventProperties implements Map
113.12.7
public final class TopicPermission extends Permission
113.13
org.osgi.service.event.annotations
113.13.1
Summary
113.13.2
@RequireEventAdmin
113.14
org.osgi.service.event.propertytypes
113.14.1
Summary
113.14.2
@EventDelivery
113.14.3
@EventFilter
113.14.4
@EventTopics
113.15
Changes
122
Remote Service Admin Service Specification
122.1
Introduction
122.1.1
Essentials
122.1.2
Entities
122.1.3
Synopsis
122.2
Actors
122.3
Topology Managers
122.3.1
Multiple Topology Managers
122.3.2
Example Use Cases
122.4
Endpoint Description
122.4.1
Validity
122.4.2
Mutability
122.4.3
Endpoint Id
122.4.4
Framework UUID
122.4.5
Resource Containment
122.5
Remote Service Admin
122.5.1
Exporting
122.5.2
Importing
122.5.3
Updates
122.5.4
Reflection
122.5.5
Registration Life Cycle
122.5.6
Invalid Registrations
122.5.7
Proxying
122.6
Discovery
122.6.1
Scope and Filters
122.6.2
Endpoint Event Listener Interface
122.6.3
Endpoint Listener Interface
122.6.4
Endpoint Event Listener and Endpoint Listener
Implementations
122.6.5
Endpoint Description Providers
122.6.6
On Demand
122.7
Events
122.7.1
Event Admin Mapping
122.8
Endpoint Description Extender Format
122.8.1
XML Schema
122.9
Capability Namespaces
122.9.1
Local Discovery Extender
122.9.2
Discovery Provider Capability
122.9.3
Distribution Provider Capability
122.9.4
Topology Manager Capability
122.9.5
Service Capability
122.10
Advice to implementations
122.10.1
Notifying listeners
122.10.2
Receiving Endpoint lifecycle notifications
122.11
Security
122.11.1
Import and Export Registrations
122.11.2
Endpoint Permission
122.12
org.osgi.service.remoteserviceadmin
122.12.1
Summary
122.12.2
public class EndpointDescription
122.12.3
public class EndpointEvent
122.12.4
public interface EndpointEventListener
122.12.5
public interface EndpointListener
122.12.6
public final class EndpointPermission extends Permission
122.12.7
public interface ExportReference
122.12.8
public interface ExportRegistration
122.12.9
public interface ImportReference
122.12.10
public interface ImportRegistration
122.12.11
public class RemoteConstants
122.12.12
public interface RemoteServiceAdmin
122.12.13
public class RemoteServiceAdminEvent
122.12.14
public interface RemoteServiceAdminListener
122.13
org.osgi.service.remoteserviceadmin.namespace
122.13.1
Summary
122.13.2
public final class DiscoveryNamespace extends Namespace
122.13.3
public final class DistributionNamespace extends Namespace
122.13.4
public final class TopologyNamespace extends Namespace
122.14
References
123
JTA Transaction Services Specification
123.1
Introduction
123.1.1
Essentials
123.1.2
Entities
123.1.3
Dependencies
123.1.4
Synopsis
123.2
JTA Overview
123.2.1
Global and Local Transactions
123.2.2
Durable Resource
123.2.3
Volatile Resource
123.2.4
Threading
123.3
Application
123.3.1
No Enlistment
123.3.2
Application Bundle Enlistment
123.3.3
Container Managed Enlistment
123.4
Resource Managers
123.5
The JTA Provider
123.5.1
User Transaction
123.5.2
Transaction Manager
123.5.3
Transaction Synchronization Service
123.6
Life Cycle
123.6.1
JTA Provider
123.6.2
Application Bundles
123.6.3
Error Handling
123.7
Security
123.8
References
124
Management Model Specification for JMX™ Technology
124.1
Introduction
124.1.1
Essentials
124.1.2
Entities
124.1.3
Synopsis
124.2
JMX Overview
124.2.1
Connectors and Adapters
124.2.2
Object Name
124.2.3
MBeans
124.2.4
Open Types
124.3
OSGi JMX Management
124.3.1
Naming
124.3.2
Object Naming
124.3.3
The MBean Server
124.3.4
Registrations
124.4
MBeans
124.5
Item
124.6
Security
124.7
org.osgi.jmx
124.7.1
Summary
124.7.2
public class Item
124.7.3
public class JmxConstants
124.8
org.osgi.jmx.framework
124.8.1
Summary
124.8.2
public interface BundleStateMBean
124.8.3
public interface FrameworkMBean
124.8.4
public interface PackageStateMBean
124.8.5
public interface ServiceStateMBean
124.9
org.osgi.jmx.service.cm
124.9.1
Summary
124.9.2
public interface ConfigurationAdminMBean
124.10
org.osgi.jmx.service.permissionadmin
124.10.1
Summary
124.10.2
public interface PermissionAdminMBean
124.11
org.osgi.jmx.service.provisioning
124.11.1
Summary
124.11.2
public interface ProvisioningServiceMBean
124.12
org.osgi.jmx.service.useradmin
124.12.1
Summary
124.12.2
public interface UserAdminMBean
124.13
org.osgi.jmx.framework.wiring
124.13.1
Summary
124.13.2
public interface BundleWiringStateMBean
124.14
References
125
Data Service Specification for JDBC™ Technology
125.1
Introduction
125.1.1
Essentials
125.1.2
Entities
125.1.3
Dependencies
125.1.4
Synopsis
125.2
Database Driver
125.2.1
Life Cycle
125.2.2
Package Dependencies
125.3
Applications
125.3.1
Selecting the Data Source Factory Service
125.3.2
Using Database Drivers
125.3.3
Using JDBC in OSGi and Containers
125.4
Security
125.5
org.osgi.service.jdbc
125.5.1
Summary
125.5.2
public interface DataSourceFactory
125.6
References
126
JNDI Services Specification
126.1
Introduction
126.1.1
Essentials
126.1.2
Entities
126.1.3
Dependencies
126.1.4
Synopsis
126.2
JNDI Overview
126.2.1
Context and Dir Context
126.2.2
Initial Context
126.2.3
URL Context Factory
126.2.4
Object and Reference Conversion
126.2.5
Environment
126.2.6
Naming Manager Singletons
126.2.7
Built-In JNDI Providers
126.3
JNDI Context Manager Service
126.3.1
Environment and Bundles
126.3.2
Context Creation
126.3.3
Rebinding
126.3.4
Life Cycle and Dynamism
126.4
JNDI Provider Admin service
126.5
JNDI Providers
126.5.1
Initial Context Factory Builder Provider
126.5.2
Initial Context Factory Provider
126.5.3
Object Factory Builder Provider
126.5.4
Object Factory Provider
126.5.5
URL Context Provider
126.5.6
JRE Context Providers
126.6
OSGi URL Scheme
126.6.1
Service Proxies
126.6.2
Services and State
126.7
Traditional Client Model
126.7.1
New Initial Context
126.7.2
Static Conversion
126.7.3
Caller's Bundle Context
126.7.4
Life Cycle Mismatch
126.8
Security
126.8.1
JNDI Implementation
126.8.2
JNDI Clients
126.8.3
OSGi URL namespace
126.9
org.osgi.service.jndi
126.9.1
Summary
126.9.2
public class JNDIConstants
126.9.3
public interface JNDIContextManager
126.9.4
public interface JNDIProviderAdmin
126.10
References
127
JPA Service Specification
127.1
Introduction
127.1.1
Essentials
127.1.2
Entities
127.1.3
Dependencies
127.1.4
Synopsis
127.2
JPA Overview
127.2.1
Persistence
127.2.2
JPA Provider
127.2.3
Managed and Unmanaged
127.2.4
JDBC Access in JPA
127.3
Bundles with Persistence
127.3.1
Services
127.3.2
Persistence Bundle
127.3.3
Client Bundles
127.3.4
Custom Configured Entity Manager
127.4
Extending a Persistence Bundle
127.4.1
Class Space Consistency
127.4.2
Meta Persistence Header
127.4.3
Processing
127.4.4
Ready Phase
127.4.5
Service Registrations
127.4.6
Registering the Entity Manager Factory Builder Service
127.4.7
Registering the Entity Manager Factory
127.4.8
Stopping
127.4.9
Entity Manager Factory Life Cycle
127.5
JPA Provider
127.5.1
Managed Model
127.5.2
Database Access
127.5.3
Data Source Factory Service Matching
127.5.4
Rebinding
127.5.5
Enhancing Entity Classes
127.5.6
Class Loading
127.5.7
Validation
127.6
Static Access
127.6.1
Access
127.7
Capabilities
127.7.1
The Extender Capability
127.7.2
The JPA Contract Capability
127.7.3
Service capabilities
127.8
Security
127.8.1
Service Permissions
127.8.2
Required Admin Permission
127.9
org.osgi.service.jpa
127.9.1
Summary
127.9.2
public interface EntityManagerFactoryBuilder
127.10
org.osgi.service.jpa.annotations
127.10.1
Summary
127.10.2
@RequireJPAExtender
127.11
References
127.12
Changes
128
Web Applications Specification
128.1
Introduction
128.1.1
Essentials
128.1.2
Entities
128.1.3
Dependencies
128.1.4
Synopsis
128.2
Web Container
128.3
Web Application Bundle
128.3.1
WAB Definition
128.3.2
Starting the Web Application Bundle
128.3.3
Failure
128.3.4
Publishing the Servlet Context
128.3.5
Static Content
128.3.6
Dynamic Content
128.3.7
Content Serving Example
128.3.8
Stopping the Web Application Bundle
128.3.9
Uninstalling the Web Application Bundle
128.3.10
Stopping of the Web Extender
128.4
Web URL Handler
128.4.1
URL Scheme
128.4.2
URL Parsing
128.4.3
URL Parameters
128.4.4
WAB Modification
128.4.5
WAR Manifest Processing
128.4.6
Signed WAR files
128.5
Events
128.6
Interacting with the OSGi Environment
128.6.1
Bundle Context Access
128.6.2
Other Component Models
128.6.3
Resource Lookup
128.6.4
Resource Injection and Annotations
128.6.5
Java Server Pages Support
128.6.6
Compilation
128.7
Security
128.8
References
130
Coordinator Service Specification
130.1
Introduction
130.1.1
Essentials
130.1.2
Entities
130.2
Usage
130.2.1
Synopsis
130.2.2
Explicit Coordination
130.2.3
Multi Threading
130.2.4
Implicit Coordinations
130.2.5
Partial Ending
130.2.6
Locking
130.2.7
Failing
130.2.8
Time-out
130.2.9
Joining
130.2.10
Variables
130.2.11
Optimizing Example
130.2.12
Security Example
130.3
Coordinator Service
130.3.1
Coordination Creation
130.3.2
Adding Participants
130.3.3
Active
130.3.4
Explicit and Implicit Models
130.3.5
Termination
130.3.6
Ending
130.3.7
Failing, TIMEOUT, ORPHANED, and RELEASED
130.3.8
Nesting Implicit Coordinations
130.3.9
Time-outs
130.3.10
Released
130.3.11
Coordinator Convenience Methods
130.3.12
Administrative Access
130.3.13
Summary
130.4
Security
130.5
org.osgi.service.coordinator
130.5.1
Summary
130.5.2
public interface Coordination
130.5.3
public class CoordinationException extends RuntimeException
130.5.4
public final class CoordinationPermission extends BasicPermission
130.5.5
public interface Coordinator
130.5.6
public interface Participant
132
Repository Service Specification
132.1
Introduction
132.1.1
Essentials
132.1.2
Entities
132.1.3
Synopsis
132.2
Using a Repository
132.2.1
Combining Requirements
132.3
Repository
132.3.1
Repository Content
132.4
osgi.content Namespace
132.5
XML Repository Format
132.5.1
Repository Element
132.5.2
Referral Element
132.5.3
Resource Element
132.5.4
Capability Element
132.5.5
Requirement Element
132.5.6
Attribute Element
132.5.7
Directive Element
132.5.8
Sample XML File
132.6
XML Repository Schema
132.7
Capabilities
132.7.1
osgi.implementation Capability
132.7.2
osgi.service Capability
132.8
Security
132.8.1
External Access
132.8.2
Permissions
132.9
org.osgi.service.repository
132.9.1
Summary
132.9.2
public interface AndExpression extends RequirementExpression
132.9.3
public final class ContentNamespace extends Namespace
132.9.4
public interface ExpressionCombiner
132.9.5
public interface IdentityExpression extends RequirementExpression
132.9.6
public interface NotExpression extends RequirementExpression
132.9.7
public interface OrExpression extends RequirementExpression
132.9.8
public interface Repository
132.9.9
public interface RepositoryContent
132.9.10
public interface RequirementBuilder
132.9.11
public interface RequirementExpression
132.10
References
132.11
Changes
133
Service Loader Mediator Specification
133.1
Introduction
133.1.1
Essentials
133.1.2
Entities
133.1.3
Synopsis
133.2
Java Service Loader API
133.3
Consumers
133.3.1
Processing
133.3.2
Opting In
133.3.3
Restricting Visibility
133.3.4
Life Cycle Impedance Mismatch
133.3.5
Consumer Example
133.4
Service Provider Bundles
133.4.1
Advertising
133.4.2
Publishing the Service Providers
133.4.3
OSGi Services
133.4.4
Service Provider Example
133.5
Service Loader Mediator
133.5.1
Registering Services
133.5.2
OSGi Service Factory
133.5.3
Service Loader and Modularity
133.5.4
Processing Consumers
133.5.5
Visibility
133.5.6
Life Cycle
133.6
osgi.serviceloader Namespace
133.7
Use of the osgi.extender Namespace
133.8
Security
133.8.1
Mediator
133.8.2
Consumers
133.8.3
Service Providers
133.9
org.osgi.service.serviceloader
133.9.1
Summary
133.9.2
public final class ServiceLoaderNamespace extends Namespace
133.10
References
134
Subsystem Service Specification
134.1
Introduction
134.1.1
Essentials
134.1.2
Entities
134.1.3
Synopsis
134.2
Subsystems
134.2.1
Subsystem Manifest Headers
134.2.2
Subsystem Identifiers and Type
134.2.3
Subsystem-SymbolicName Header
134.2.4
Subsystem-Version Header
134.2.5
Subsystem-Type Header
134.2.6
Deriving the Subsystem Identity
134.2.7
Subsystem Identity Capability
134.2.8
Subsystem-Localization Header
134.3
Subsystem Region
134.4
Subsystem Relationships
134.4.1
Prevent Cycles and Recursion
134.5
Determining Content
134.5.1
Subsystem-Content Header
134.5.2
Subsystem-Content Requirements
134.5.3
Preferred-Provider Header
134.5.4
Resource Repositories
134.5.5
Discovering Content Resources
134.6
Determining Dependencies
134.7
Accepting Dependencies
134.8
Sharing Capabilities
134.8.1
Preferred Provider
134.8.2
System Capabilities
134.9
Region Context Bundle
134.10
Explicit and Implicit Resources
134.10.1
Explicit Resources
134.10.2
Explicit Resource Example
134.11
Resource References
134.11.1
Reference Count
134.12
Starting and Stopping Resources
134.12.1
Start Order
134.12.2
Active Use Count
134.13
Subsystem Service
134.13.1
Root Subsystem
134.13.2
Subsystem Service Properties
134.13.3
Subsystem States
134.13.4
Subsystem Service Registrations
134.13.5
Subsystem Manifest Headers
134.14
Subsystem Life Cycle
134.14.1
Installing
134.14.2
Resolving
134.14.3
Starting
134.14.4
Stopping
134.14.5
Uninstalling
134.15
Pre-Calculated Deployment
134.15.1
Deployment Headers
134.15.2
Validating Subsystem Identity
134.15.3
Deployed-Content
134.15.4
Provision-Resource
134.15.5
Import-Package
134.15.6
Export-Package
134.15.7
Require-Bundle
134.15.8
Services
134.15.9
Subsystem-ImportService
134.15.10
Subsystem-ExportService
134.16
Subsystem Types
134.16.1
Application
134.16.2
Application Deployment
134.16.3
Composite
134.16.4
Feature
134.17
Weaving Hooks
134.18
Stopping and Uninstalling Subsystems Implementation
134.19
Capabilities
134.20
Security
134.20.1
Subsystem Permission
134.20.2
Actions
134.20.3
Required Permissions
134.21
org.osgi.service.subsystem
134.21.1
Summary
134.21.2
public interface Subsystem
134.21.3
enum Subsystem.State
134.21.4
public class SubsystemConstants
134.21.5
public class SubsystemException extends RuntimeException
134.21.6
public final class SubsystemPermission extends BasicPermission
134.22
References
135
Common Namespaces Specification
135.1
Introduction
135.1.1
Versioning
135.2
osgi.extender Namespace
135.2.1
Extenders and Framework Hooks
135.3
osgi.contract Namespace
135.3.1
Versioning
135.4
osgi.service Namespace
135.4.1
Versioning
135.5
osgi.implementation Namespace
135.6
osgi.unresolvable Namespace
135.7
org.osgi.namespace.contract
135.7.1
Summary
135.7.2
public final class ContractNamespace extends Namespace
135.8
org.osgi.namespace.extender
135.8.1
Summary
135.8.2
public final class ExtenderNamespace extends Namespace
135.9
org.osgi.namespace.service
135.9.1
Summary
135.9.2
public final class ServiceNamespace extends Namespace
135.10
org.osgi.namespace.implementation
135.10.1
Summary
135.10.2
public final class ImplementationNamespace extends Namespace
135.11
org.osgi.namespace.unresolvable
135.11.1
Summary
135.11.2
public final class UnresolvableNamespace extends Namespace
135.12
References
135.13
Changes
137
REST Management Service Specification
137.1
Introduction
137.1.1
Essentials
137.1.2
Entities
137.1.3
Synopsis
137.2
Interacting with the REST Management Service
137.2.1
Resource Identifier Overview
137.2.2
Filtering Results
137.2.3
Content Type Matching
137.3
Resources
137.3.1
Framework Startlevel Resource
137.3.2
Bundles Resource
137.3.3
Bundles Representations Resource
137.3.4
Bundle Resource
137.3.5
Bundle State Resource
137.3.6
Bundle Header Resource
137.3.7
Bundle Startlevel Resource
137.3.8
Services Resource
137.3.9
Services Representations Resource
137.3.10
Service Resource
137.4
Representations
137.4.1
Bundle Representation
137.4.2
Bundles Representations
137.4.3
Bundle State Representation
137.4.4
Bundle Header Representation
137.4.5
Framework Startlevel Representation
137.4.6
Bundle Startlevel Representation
137.4.7
Service Representation
137.4.8
Services Representations
137.4.9
Bundle Exception Representation
137.5
Clients
137.5.1
Java Client
137.5.2
JavaScript Client
137.6
Extending the REST Management Service
137.6.1
Extensions Resource
137.6.2
Extensions Representation
137.7
XML Schema
137.8
Capabilities
137.8.1
osgi.implementation Capability
137.8.2
osgi.service Capability
137.9
Security
137.10
org.osgi.service.rest
137.10.1
Summary
137.10.2
public interface RestApiExtension
137.11
org.osgi.service.rest.client
137.11.1
Summary
137.11.2
public interface RestClient
137.11.3
public interface RestClientFactory
137.12
JavaScript Client API
137.12.1
Summary
137.12.2
interface OSGiRestClient
137.12.3
callback interface OSGiRestCallback
137.13
References
138
Asynchronous Service Specification
138.1
Introduction
138.1.1
Essentials
138.1.2
Entities
138.2
Usage
138.2.1
Synopsis
138.2.2
Making Async Invocations
138.2.3
Async Invocations of Void Methods
138.2.4
Fire and Forget Calls
138.2.5
Multi Threading
138.3
Async Service
138.3.1
Using the Async Service
138.3.2
Asynchronous Failures
138.3.3
Thread Safety and Instance Sharing
138.3.4
Service Object Lifecycle Management
138.4
The Async Mediator
138.4.1
Building the Mediator Object
138.4.2
Async Mediator Behaviors
138.4.3
Thread Safety and Instance Sharing
138.5
Fire and Forget Invocations
138.6
Delegating to Asynchronous Implementations
138.6.1
Obtaining a Promise from an Async Delegate
138.6.2
Delegating Fire and Forget Calls to an Async Delegate
138.6.3
Lifecycle for Service Objects When Delegating
138.7
Capabilities
138.8
Security
138.9
org.osgi.service.async
138.9.1
Summary
138.9.2
public interface Async
138.10
org.osgi.service.async.delegate
138.10.1
Summary
138.10.2
public interface AsyncDelegate
140
Http Whiteboard Specification
140.1
Introduction
140.1.1
Entities
140.2
The Servlet Context
140.2.1
String getMimeType(String)
140.2.2
String getRealPath(String)
140.2.3
URL getResource(String)
140.2.4
Set getResourcePaths(String)
140.2.5
Security Handling
140.2.6
Behavior of the Servlet Context
140.2.7
Relation to the Servlet Container
140.3
Common Whiteboard Properties
140.4
Registering Servlets
140.4.1
Multipart File Upload
140.4.2
Error Pages
140.4.3
Asynchronous Request Handling
140.4.4
Annotations
140.5
Registering Servlet Filters
140.5.1
Servlet Pre-Processors
140.6
Registering Resources
140.6.1
Overlapping Resource and Servlet Registrations
140.7
Registering Listeners
140.8
Life Cycle
140.8.1
Whiteboard Service Dynamics and Active Requests
140.9
The Http Service Runtime Service
140.10
Integration with Http Service Contexts
140.11
Configuration Properties
140.12
Capabilities
140.12.1
osgi.implementation Capability
140.12.2
osgi.contract Capability
140.12.3
osgi.service Capability
140.13
Security
140.13.1
Service Permissions
140.13.2
Introspection
140.13.3
Accessing Resources with the Default Servlet Context Helper
Implementation
140.13.4
Accessing Other Types of Resources
140.13.5
Calling Http Whiteboard Services
140.13.6
Multipart Upload
140.14
org.osgi.service.http.context
140.14.1
Summary
140.14.2
public abstract class ServletContextHelper
140.15
org.osgi.service.http.runtime
140.15.1
Summary
140.15.2
public interface HttpServiceRuntime
140.15.3
public final class HttpServiceRuntimeConstants
140.16
org.osgi.service.http.runtime.dto
140.16.1
Summary
140.16.2
public abstract class BaseServletDTO extends DTO
140.16.3
public final class DTOConstants
140.16.4
public class ErrorPageDTO extends BaseServletDTO
140.16.5
public class FailedErrorPageDTO extends ErrorPageDTO
140.16.6
public class FailedFilterDTO extends FilterDTO
140.16.7
public class FailedListenerDTO extends ListenerDTO
140.16.8
public class FailedPreprocessorDTO extends PreprocessorDTO
140.16.9
public class FailedResourceDTO extends ResourceDTO
140.16.10
public class FailedServletContextDTO extends ServletContextDTO
140.16.11
public class FailedServletDTO extends ServletDTO
140.16.12
public class FilterDTO extends DTO
140.16.13
public class ListenerDTO extends DTO
140.16.14
public class PreprocessorDTO extends DTO
140.16.15
public class RequestInfoDTO extends DTO
140.16.16
public class ResourceDTO extends DTO
140.16.17
public class RuntimeDTO extends DTO
140.16.18
public class ServletContextDTO extends DTO
140.16.19
public class ServletDTO extends BaseServletDTO
140.17
org.osgi.service.http.whiteboard
140.17.1
Summary
140.17.2
public final class HttpWhiteboardConstants
140.17.3
public interface Preprocessor extends Filter
140.18
org.osgi.service.http.whiteboard.annotations
140.18.1
Summary
140.18.2
@RequireHttpWhiteboard
140.19
org.osgi.service.http.whiteboard.propertytypes
140.19.1
Summary
140.19.2
@HttpWhiteboardContext
140.19.3
@HttpWhiteboardContextSelect
140.19.4
@HttpWhiteboardFilterAsyncSupported
140.19.5
@HttpWhiteboardFilterDispatcher
140.19.6
@HttpWhiteboardFilterName
140.19.7
@HttpWhiteboardFilterPattern
140.19.8
@HttpWhiteboardFilterRegex
140.19.9
@HttpWhiteboardFilterServlet
140.19.10
@HttpWhiteboardListener
140.19.11
@HttpWhiteboardResource
140.19.12
@HttpWhiteboardServletAsyncSupported
140.19.13
@HttpWhiteboardServletErrorPage
140.19.14
@HttpWhiteboardServletMultipart
140.19.15
@HttpWhiteboardServletName
140.19.16
@HttpWhiteboardServletPattern
140.19.17
@HttpWhiteboardTarget
140.20
References
140.21
Changes
147
Transaction Control Service Specification
147.1
Introduction
147.1.1
Essentials
147.1.2
Entities
147.2
Usage
147.2.1
Synopsis
147.2.2
Running Scoped Work
147.2.3
Accessing Scoped Resources
147.2.4
Exception Management
147.2.5
Multi Threading
147.3
Transaction Control Service
147.3.1
Scope Life Cycle
147.3.2
Scopes and Exception Management
147.3.3
Transaction Scope lifecycle
147.4
The TransactionContext
147.4.1
Transaction Lifecycle callbacks
147.4.2
Scoped variables
147.4.3
Transaction Key
147.4.4
The Transaction Status
147.4.5
Local Transaction scopes
147.4.6
XA Transaction scopes
147.5
Resource Providers
147.5.1
Generic Resource Providers
147.5.2
JDBC Resource Providers
147.5.3
JPA
147.5.4
Connection Pooling
147.6
Transaction Recovery
147.6.1
Enlisting a Recoverable Resource in a Transaction
147.6.2
Providing an XAResource for Recovery
147.6.3
Identifying implementations which support recovery
147.7
Capabilities
147.8
Security
147.9
org.osgi.service.transaction.control
147.9.1
Summary
147.9.2
public interface LocalResource
147.9.3
public interface ResourceProvider
147.9.4
public class ScopedWorkException extends RuntimeException
147.9.5
public abstract class TransactionBuilder implements TransactionStarter
147.9.6
public interface TransactionContext
147.9.7
public interface TransactionControl extends TransactionStarter
147.9.8
public class TransactionException extends RuntimeException
147.9.9
public class TransactionRolledBackException extends TransactionException
147.9.10
public interface TransactionStarter
147.9.11
enum TransactionStatus
147.10
org.osgi.service.transaction.control.jdbc
147.10.1
Summary
147.10.2
public interface JDBCConnectionProvider extends ResourceProvider
147.10.3
public interface JDBCConnectionProviderFactory
147.11
org.osgi.service.transaction.control.jpa
147.11.1
Summary
147.11.2
public interface JPAEntityManagerProvider extends ResourceProvider
147.11.3
public interface JPAEntityManagerProviderFactory
147.12
org.osgi.service.transaction.control.recovery
147.12.1
Summary
147.12.2
public interface RecoverableXAResource
148
Cluster Information Specification
148.1
Introduction
148.1.1
Essentials
148.1.2
Entities
148.2
OSGi frameworks in a cluster
148.3
Node Status Service
148.4
Framework Node Status Service
148.5
Application-specific Node Status metadata
148.6
Security
148.6.1
Cluster Tag Permission
148.6.2
Required Permissions
148.6.3
Remote service visibility in a cluster
148.7
org.osgi.service.clusterinfo
148.7.1
Summary
148.7.2
public final class ClusterTagPermission extends Permission
148.7.3
public interface FrameworkManager
148.7.4
public interface FrameworkNodeStatus extends NodeStatus, FrameworkManager
148.7.5
public interface NodeStatus
148.8
org.osgi.service.clusterinfo.dto
148.8.1
Summary
148.8.2
public class FrameworkNodeStatusDTO extends NodeStatusDTO
148.8.3
public class NodeStatusDTO extends DTO
150
Configurator Specification
150.1
Introduction
150.2
Entities
150.3
Configuration Resources
150.3.1
Configuration Resource Format
150.3.2
PIDs, Factory Configurations and Targeted PIDs
150.3.3
Configuration Dictionary
150.3.4
Data Types
150.3.5
Ranking
150.3.6
Overwrite Policies
150.4
Bundle Configuration Resources
150.5
Initial Configurations
150.6
Life Cycle
150.7
Grouping and Coordinations
150.8
Security
150.8.1
Configuration Permission
150.8.2
Service Permission
150.8.3
Configuration Admin Service
150.8.4
File Permission
150.9
Capabilities
150.9.1
osgi.extender Capability
150.10
osgi.configuration Namespace
150.11
Configuration Resources in a Repository
150.12
org.osgi.service.configurator
150.12.1
Summary
150.12.2
public final class ConfiguratorConstants
150.13
org.osgi.service.configurator.annotations
150.13.1
Summary
150.13.2
@RequireConfigurator
150.14
org.osgi.service.configurator.namespace
150.14.1
Summary
150.14.2
public final class ConfigurationNamespace extends Namespace
150.15
References
151
JAX-RS Whiteboard Specification
151.1
Introduction
151.1.1
Entities
151.2
The JAX-RS Whiteboard
151.2.1
The JAX-RS Service Runtime Service
151.2.2
Inspecting the Runtime DTOs
151.2.3
Relation to the Servlet Container
151.2.4
Isolation between JAX-RS Whiteboards
151.3
Common Whiteboard Properties
151.4
Registering JAX-RS Resources
151.4.1
JAX-RS Resource mapping
151.4.2
JAX-RS Whiteboard Resource Lifecycle
151.4.3
Resource Service Properties
151.4.4
A JAX-RS Whiteboard Resource Example
151.5
Registering JAX-RS Extensions
151.5.1
Name Binding and JAX-RS Extensions
151.5.2
Extension ordering
151.5.3
Extension dependencies
151.5.4
Built in extensions
151.5.5
JAX-RS Whiteboard Extension Lifecycle
151.5.6
Extension Service Properties
151.5.7
A JAX-RS Whiteboard Extension Example
151.6
Registering JAX-RS Applications
151.6.1
Application shadowing
151.6.2
Application Extension Dependencies
151.6.3
Application Service Properties
151.6.4
Accessing the Application service properties
151.6.5
A JAX-RS Whiteboard Application Example
151.7
Advertising JAX-RS Endpoints
151.8
Whiteboard Error Handling
151.9
The JAX-RS Client API
151.9.1
Client Filters, Interceptors, Readers and Writers
151.9.2
Reactive Clients
151.9.3
Consuming Server Sent Events
151.10
Portability and Interoperability
151.10.1
Media Type support
151.11
Capabilities
151.11.1
osgi.implementation Capability
151.11.2
osgi.contract Capability
151.11.3
osgi.service Capability
151.12
Security
151.12.1
Service Permissions
151.12.2
Runtime Introspection
151.12.3
Calling JAX-RS Whiteboard Services
151.13
org.osgi.service.jaxrs.client
151.13.1
Summary
151.13.2
public interface PromiseRxInvoker extends RxInvoker
151.13.3
public interface SseEventSourceFactory
151.14
org.osgi.service.jaxrs.runtime
151.14.1
Summary
151.14.2
public interface JaxrsEndpoint
151.14.3
public interface JaxrsServiceRuntime
151.14.4
public final class JaxrsServiceRuntimeConstants
151.15
org.osgi.service.jaxrs.runtime.dto
151.15.1
Summary
151.15.2
public class ApplicationDTO extends BaseApplicationDTO
151.15.3
public abstract class BaseApplicationDTO extends BaseDTO
151.15.4
public abstract class BaseDTO extends DTO
151.15.5
public abstract class BaseExtensionDTO extends BaseDTO
151.15.6
public final class DTOConstants
151.15.7
public class ExtensionDTO extends BaseExtensionDTO
151.15.8
public class FailedApplicationDTO extends BaseApplicationDTO
151.15.9
public class FailedExtensionDTO extends BaseExtensionDTO
151.15.10
public class FailedResourceDTO extends BaseDTO
151.15.11
public class ResourceDTO extends BaseDTO
151.15.12
public class ResourceMethodInfoDTO extends DTO
151.15.13
public class RuntimeDTO extends DTO
151.16
org.osgi.service.jaxrs.whiteboard
151.16.1
Summary
151.16.2
public final class JaxrsWhiteboardConstants
151.17
org.osgi.service.jaxrs.whiteboard.annotations
151.17.1
Summary
151.17.2
@RequireJaxrsWhiteboard
151.18
org.osgi.service.jaxrs.whiteboard.propertytypes
151.18.1
Summary
151.18.2
@JaxrsApplicationBase
151.18.3
@JaxrsApplicationSelect
151.18.4
@JaxrsExtension
151.18.5
@JaxrsExtensionSelect
151.18.6
@JaxrsMediaType
151.18.7
@JaxrsName
151.18.8
@JaxrsResource
151.18.9
@JaxrsWhiteboardTarget
151.18.10
@JSONRequired
151.19
References
152
CDI Integration Specification
152.1
Introduction
152.1.1
Essentials
152.1.2
Entities
152.1.3
Synopsis
152.2
Components
152.3
Component Scope
152.3.1
Contexts
152.4
Container Component
152.4.1
Container Component Configuration
152.4.2
Container Component Life Cycle
152.5
Standard Definitions
152.5.1
Annotation Inheritance
152.5.2
Code Examples
152.6
Single Component
152.6.1
Single Component Naming
152.6.2
Single Component Configuration
152.7
Factory Component
152.7.1
Factory Component Naming
152.7.2
Factory Component Configuration
152.8
Component Properties
152.8.1
Reference Properties
152.9
Bean Property Types
152.9.1
Bean Property Type Mapping
152.9.2
Coercing Bean Property Type Values
152.9.3
Standard Bean Property Types
152.10
Providing Services
152.10.1
@Service applied to bean class
152.10.2
@Service applied to type use
152.10.3
@Service applied to Producers
152.10.4
@Service Type Restrictions
152.10.5
Service Properties
152.10.6
Service Scope
152.10.7
Container Component Services
152.10.8
Single Component Services
152.10.9
Factory Component Services
152.11
Component Property Injection Points
152.11.1
Coordinator Support
152.12
Reference Injection Points
152.12.1
Reference injection point types
152.12.2
Reference Service scope
152.12.3
Bean Service Objects
152.12.4
Reference Greediness
152.12.5
Service Type
152.12.6
Any Service Type
152.12.7
Target Filter
152.12.8
Reference Names
152.12.9
Static References
152.12.10
Static Optional References
152.12.11
Static Multi-cardinality References
152.12.12
Default Minimum Cardinality
152.12.13
Dynamic References
152.13
Interacting with Service Events
152.14
CDI Component Runtime
152.14.1
Relationship to the OSGi Framework
152.14.2
Injecting the Bundle Context
152.14.3
Starting and Stopping CCR
152.14.4
Logging Messages
152.14.5
Bundle Activator Interaction
152.14.6
Introspection
152.14.7
Logger Support
152.14.8
Disabling Components
152.14.9
Container Component and Service Cycles
152.15
Capabilities
152.16
Relationship to CDI features
152.16.1
Bean Descriptors
152.16.2
Bean Discovery
152.16.3
Portable Extensions
152.16.4
Bean Manager
152.16.5
Decorators and Interceptors
152.17
Security
152.17.1
Service Permissions
152.17.2
Required Admin Permission
152.17.3
Using hasPermission
152.17.4
Configuration Multi-Locations and Regions
152.18
org.osgi.service.cdi
152.18.1
Summary
152.18.2
public class CDIConstants
152.18.3
enum ComponentType
152.18.4
enum ConfigurationPolicy
152.18.5
enum MaximumCardinality
152.18.6
enum ReferencePolicy
152.18.7
enum ReferencePolicyOption
152.18.8
enum ServiceScope
152.19
org.osgi.service.cdi.annotations
152.19.1
Summary
152.19.2
@Bean
152.19.3
@BeanPropertyType
152.19.4
public static final class BeanPropertyType.Literal extends AnnotationLiteral implements BeanPropertyType
152.19.5
@Beans
152.19.6
@ComponentProperties
152.19.7
public static final class ComponentProperties.Literal extends AnnotationLiteral implements ComponentProperties
152.19.8
@ComponentScoped
152.19.9
public static final class ComponentScoped.Literal extends AnnotationLiteral implements ComponentScoped
152.19.10
@FactoryComponent
152.19.11
public static final class FactoryComponent.Literal extends AnnotationLiteral implements FactoryComponent
152.19.12
@MinimumCardinality
152.19.13
public static final class MinimumCardinality.Literal extends AnnotationLiteral implements MinimumCardinality
152.19.14
@PID
152.19.15
public static final class PID.Literal extends AnnotationLiteral implements PID
152.19.16
@PIDs
152.19.17
public static final class PIDs.Literal extends AnnotationLiteral implements PIDs
152.19.18
@PrototypeRequired
152.19.19
public static final class PrototypeRequired.Literal extends AnnotationLiteral implements PrototypeRequired
152.19.20
@Reference
152.19.21
public static final class Reference.Any
152.19.22
public static final class Reference.Literal extends AnnotationLiteral implements Reference
152.19.23
@Reluctant
152.19.24
public static final class Reluctant.Literal extends AnnotationLiteral implements Reluctant
152.19.25
@RequireCDIExtender
152.19.26
@RequireCDIImplementation
152.19.27
@Service
152.19.28
public static final class Service.Literal extends AnnotationLiteral implements Service
152.19.29
@ServiceInstance
152.19.30
public static final class ServiceInstance.Literal extends AnnotationLiteral implements ServiceInstance
152.19.31
@SingleComponent
152.19.32
public static final class SingleComponent.Literal extends AnnotationLiteral implements SingleComponent
152.20
org.osgi.service.cdi.propertytypes
152.20.1
Summary
152.20.2
public class BeanPropertyException extends RuntimeException
152.20.3
@ExportedService
152.20.4
@ServiceDescription
152.20.5
@ServiceRanking
152.20.6
@ServiceVendor
152.21
org.osgi.service.cdi.reference
152.21.1
Summary
152.21.2
public interface BeanServiceObjects
152.21.3
public interface BindBeanServiceObjects
152.21.4
public interface BindService
152.21.5
public interface BindServiceReference
152.22
org.osgi.service.cdi.runtime
152.22.1
Summary
152.22.2
public interface CDIComponentRuntime
152.23
org.osgi.service.cdi.runtime.dto
152.23.1
Summary
152.23.2
public class ActivationDTO extends DTO
152.23.3
public class ComponentDTO extends DTO
152.23.4
public class ComponentInstanceDTO extends DTO
152.23.5
public class ConfigurationDTO extends DTO
152.23.6
public class ContainerDTO extends DTO
152.23.7
public class ExtensionDTO extends DTO
152.23.8
public class ReferenceDTO extends DTO
152.24
org.osgi.service.cdi.runtime.dto.template
152.24.1
Summary
152.24.2
public class ActivationTemplateDTO extends DTO
152.24.3
public class ComponentTemplateDTO extends DTO
152.24.4
public class ConfigurationTemplateDTO extends DTO
152.24.5
public class ContainerTemplateDTO extends DTO
152.24.6
public class ExtensionTemplateDTO extends DTO
152.24.7
public class ReferenceTemplateDTO extends DTO
152.25
References
702
XML Parser Service Specification
702.1
Introduction
702.1.1
Essentials
702.1.2
Entities
702.1.3
Operations
702.2
JAXP
702.3
XML Parser service
702.4
Properties
702.5
Getting a Parser Factory
702.6
Adapting a JAXP Parser to OSGi
702.6.1
JAR Based Services
702.6.2
XMLParserActivator
702.6.3
Adapting an Existing JAXP Compatible Parser
702.7
Usage of JAXP
702.8
Security
702.9
org.osgi.util.xml
702.9.1
Summary
702.9.2
public class XMLParserActivator implements BundleActivator, ServiceFactory
702.10
References
705
Promises Specification
705.1
Introduction
705.1.1
Essentials
705.1.2
Entities
705.2
Promise
705.3
Deferred
705.4
Callbacks
705.4.1
Runnable
705.4.2
Consumer
705.4.3
Success and Failure
705.5
Chaining Promises
705.6
Monad
705.7
Timing
705.8
Functional Interfaces
705.9
Utility Methods
705.10
Security
705.11
org.osgi.util.promise
705.11.1
Summary
705.11.2
public class Deferred
705.11.3
public class FailedPromisesException extends RuntimeException
705.11.4
public interface Failure
705.11.5
public interface Promise
705.11.6
public class PromiseFactory
705.11.7
public class Promises
705.11.8
public interface Success
705.11.9
public class TimeoutException extends Exception
705.12
org.osgi.util.function
705.12.1
Summary
705.12.2
public interface Consumer
705.12.3
public interface Function
705.12.4
public interface Predicate
705.13
References
705.14
Changes
706
Push Stream Specification
706.1
Introduction
706.1.1
Essentials
706.1.2
Entities
706.2
Asynchronous Event Streams
706.2.1
The Push Event
706.2.2
The Push Event Source
706.2.3
The Push Event Consumer
706.2.4
Closing the Event Stream
706.3
The Push Stream
706.3.1
Simple Pipelines
706.3.2
Buffering, Back pressure and Circuit Breakers
706.3.3
Forking
706.3.4
Coalescing and Windowing
706.3.5
Merging and Splitting
706.3.6
Time Limited Streams
706.3.7
Closing Streams
706.4
The Push Stream Provider
706.4.1
Building Buffers
706.4.2
Mapping between Java 8 Streams and Push Streams
706.5
Simple Push Event Sources
706.5.1
Optimizing Event Creation
706.6
Security
706.7
org.osgi.util.pushstream
706.7.1
Summary
706.7.2
public interface BufferBuilder>>
706.7.3
public interface PushbackPolicy>>
706.7.4
enum PushbackPolicyOption
706.7.5
public abstract class PushEvent
706.7.6
enum PushEvent.EventType
706.7.7
public interface PushEventConsumer
706.7.8
public interface PushEventSource
706.7.9
public interface PushStream extends AutoCloseable
706.7.10
public interface PushStreamBuilder>> extends BufferBuilder,
T, U>
706.7.11
public final class PushStreamProvider
706.7.12
public interface QueuePolicy>>
706.7.13
enum QueuePolicyOption
706.7.14
public interface SimplePushEventSource extends PushEventSource, AutoCloseable
706.8
References
707
Converter Specification
707.1
Introduction
707.2
Entities
707.3
Standard Converter
707.4
Conversions
707.4.1
Generics
707.4.2
Scalars
707.4.3
Arrays and Collections
707.4.4
Maps, Interfaces, Java Beans, DTOs and Annotations
707.5
Repeated or Deferred Conversions
707.6
Customizing converters
707.6.1
Catch-all rules
707.7
Conversion failures
707.8
Security
707.9
org.osgi.util.converter
707.9.1
Summary
707.9.2
public class ConversionException extends RuntimeException
707.9.3
public interface Converter
707.9.4
public interface ConverterBuilder
707.9.5
public interface ConverterFunction
707.9.6
public class Converters
707.9.7
public interface Converting extends Specifying
707.9.8
public interface Functioning extends Specifying
707.9.9
public abstract class Rule implements TargetRule
707.9.10
public interface Specifying>
707.9.11
public interface TargetRule
707.9.12
public class TypeReference
707.9.13
public class TypeRule implements TargetRule
707.10
References

C U Cyber History — Public Interest Web Archive