OpenSplice Java 5 DCPS  v6.x
OpenSplice Java 5 OpenSplice Data Distribution Service Data-Centric Publish-Subscribe API
SubscriberListenerImpl.java
Go to the documentation of this file.
1 /*
2  * Vortex OpenSplice
3  *
4  * This software and documentation are Copyright 2006 to 2024 ADLINK
5  * Technology Limited, its affiliated companies and licensors. All rights
6  * reserved.
7  *
8  * Licensed under the Apache License, Version 2.0 (the "License");
9  * you may not use this file except in compliance with the License.
10  * You may obtain a copy of the License at
11  *
12  * http://www.apache.org/licenses/LICENSE-2.0
13  *
14  * Unless required by applicable law or agreed to in writing, software
15  * distributed under the License is distributed on an "AS IS" BASIS,
16  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17  * See the License for the specific language governing permissions and
18  * limitations under the License.
19  *
20  */
21 package org.opensplice.dds.sub;
22 
23 import java.io.Serializable;
24 
39 
40 import DDS.DataReader;
41 import DDS.LivelinessChangedStatus;
42 import DDS.RequestedDeadlineMissedStatus;
43 import DDS.RequestedIncompatibleQosStatus;
44 import DDS.SampleLostStatus;
45 import DDS.SampleRejectedStatus;
46 import DDS.Subscriber;
47 import DDS.SubscriptionMatchedStatus;
48 
49 public class SubscriberListenerImpl extends Listener<SubscriberListener>
50  implements DDS.SubscriberListener, Serializable {
51  private static final long serialVersionUID = -1147185392577428150L;
52  private final transient SubscriberImpl subscriber;
53 
56  this(environment, subscriber, listener, false);
57  }
60  boolean waitUntilInitialised) {
61  super(environment, listener, waitUntilInitialised);
62  this.subscriber = subscriber;
63  }
64 
65  @Override
66  public void on_data_on_readers(Subscriber subs) {
67  this.waitUntilInitialised();
68  this.listener.onDataOnReaders(new DataOnReadersEventImpl(
69  this.environment, this.subscriber, new DataOnReadersStatusImpl(
70  this.environment)));
71  }
72 
73  @Override
76  org.omg.dds.sub.DataReader<Object> found = this.subscriber
77  .lookupDataReader(reader);
78 
79  if (found != null) {
80  this.waitUntilInitialised();
81  this.listener
82  .onRequestedDeadlineMissed(new RequestedDeadlineMissedEventImpl<Object>(
83  this.environment, found, StatusConverter.convert(
84  this.environment, status)));
85  }
86  }
87 
88  @Override
89  public void on_sample_rejected(DataReader reader,
90  SampleRejectedStatus status) {
91  org.omg.dds.sub.DataReader<Object> found = this.subscriber
92  .lookupDataReader(reader);
93 
94  if (found != null) {
95  this.waitUntilInitialised();
96  this.listener.onSampleRejected(new SampleRejectedEventImpl<Object>(
97  this.environment, found, StatusConverter.convert(
98  this.environment, status)));
99  }
100  }
101 
102  @Override
103  public void on_liveliness_changed(DataReader reader,
104  LivelinessChangedStatus status) {
105  org.omg.dds.sub.DataReader<Object> found = this.subscriber
106  .lookupDataReader(reader);
107 
108  if (found != null) {
109  this.waitUntilInitialised();
110  this.listener
111  .onLivelinessChanged(new LivelinessChangedEventImpl<Object>(
112  this.environment, found, StatusConverter.convert(
113  this.environment, status)));
114  }
115  }
116 
117  @Override
118  public void on_data_available(DataReader reader) {
119  org.omg.dds.sub.DataReader<Object> found = this.subscriber
120  .lookupDataReader(reader);
121 
122  if (found != null) {
123  this.waitUntilInitialised();
124  this.listener.onDataAvailable(new DataAvailableEventImpl<Object>(
125  this.environment, found, new DataAvailableStatusImpl(
126  this.environment)));
127  }
128  }
129 
130  @Override
133  org.omg.dds.sub.DataReader<Object> found = this.subscriber
134  .lookupDataReader(arg0);
135 
136  if (found != null) {
137  this.waitUntilInitialised();
138  this.listener
139  .onRequestedIncompatibleQos(new RequestedIncompatibleQosEventImpl<Object>(
140  this.environment, found, StatusConverter.convert(
141  this.environment, arg1)));
142  }
143  }
144 
145  @Override
147  SubscriptionMatchedStatus status) {
148  org.omg.dds.sub.DataReader<Object> found = this.subscriber
149  .lookupDataReader(reader);
150 
151  if (found != null) {
152  this.waitUntilInitialised();
153  this.listener
154  .onSubscriptionMatched(new SubscriptionMatchedEventImpl<Object>(
155  this.environment, found, StatusConverter.convert(
156  this.environment, status)));
157  }
158  }
159 
160  @Override
161  public void on_sample_lost(DataReader reader, SampleLostStatus status) {
162  org.omg.dds.sub.DataReader<Object> found = this.subscriber
163  .lookupDataReader(reader);
164 
165  if (found != null) {
166  this.waitUntilInitialised();
167  this.listener.onSampleLost(new SampleLostEventImpl<Object>(
168  this.environment, found, StatusConverter.convert(
169  this.environment, status)));
170  }
171  }
172 
173 }
A sample has been lost (never received).
A DataReader allows the application (1) to declare the data it wishes to receive (i.e., make a subscription) and (2) to access the data received by the attached org.omg.dds.sub.Subscriber.
A Subscriber is the object responsible for the actual reception of the data resulting from its subscr...
Definition: Subscriber.java:69
SubscriberListenerImpl(OsplServiceEnvironment environment, SubscriberImpl subscriber, SubscriberListener listener)
void on_requested_incompatible_qos(DataReader arg0, RequestedIncompatibleQosStatus arg1)
void on_sample_rejected(DataReader reader, SampleRejectedStatus status)
static QosPolicyCount [] convert(OsplServiceEnvironment env, DDS.QosPolicyCount[] old)
OsplServiceEnvironment environment
Definition: Listener.java:33
SubscriberListenerImpl(OsplServiceEnvironment environment, SubscriberImpl subscriber, SubscriberListener listener, boolean waitUntilInitialised)
Since a org.omg.dds.sub.Subscriber is a kind of org.omg.dds.core.Entity, it has the ability to have a...
A org.omg.dds.core.policy.QosPolicy value was incompatible with what is offered.
void on_sample_lost(DataReader reader, SampleLostStatus status)
void on_liveliness_changed(DataReader reader, LivelinessChangedStatus status)
This class contains the statistics about the discovered number of org.omg.dds.pub.DataWriters that are compatible with the org.omg.dds.sub.DataReader to which the Status is attached.
The liveliness of one or more org.omg.dds.pub.DataWriters that were writing instances read through th...
A (received) sample has been rejected.
void on_subscription_matched(DataReader reader, SubscriptionMatchedStatus status)
The deadline that the org.omg.dds.sub.DataReader was expecting through its org.omg.dds.core.policy.Deadline was not respected for a specific instance.
void on_requested_deadline_missed(DataReader reader, RequestedDeadlineMissedStatus status)