OpenSplice Java 5 DCPS  v6.x
OpenSplice Java 5 OpenSplice Data Distribution Service Data-Centric Publish-Subscribe API
TopicListenerImpl.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.topic;
22 
23 import java.io.Serializable;
24 
31 
32 import DDS.AllDataDisposedTopicStatusHolder;
33 import DDS.InconsistentTopicStatus;
34 
35 public class TopicListenerImpl<TYPE> extends
36  Listener<TopicListener<TYPE>>
37  implements DDS.ExtTopicListener, Serializable {
38  private static final long serialVersionUID = -3957061097858393241L;
39  private final transient AbstractTopic<TYPE> topic;
40  private final transient org.opensplice.dds.topic.TopicListener<TYPE> extListener;
41 
44  this(environment, topic, listener, false);
45  }
46 
49  boolean waitUntilInitialised) {
50  super(environment, listener, waitUntilInitialised);
51  this.topic = topic;
52 
53  if(listener instanceof org.opensplice.dds.topic.TopicListener<?>){
54  this.extListener = (org.opensplice.dds.topic.TopicListener<TYPE>)listener;
55  } else{
56  this.extListener = null;
57  }
58  }
59 
60  @Override
61  public void on_inconsistent_topic(DDS.Topic arg0,
63  this.waitUntilInitialised();
64  this.listener.onInconsistentTopic(new InconsistentTopicEventImpl<TYPE>(
65  this.environment, this.topic, StatusConverter.convert(this.environment,
66  arg1)));
67 
68  }
69 
70  @Override
71  public void on_all_data_disposed(DDS.Topic arg0) {
72  AllDataDisposedTopicStatusHolder holder = new AllDataDisposedTopicStatusHolder();
73  int rc = arg0.get_all_data_disposed_topic_status(holder);
74 
75  if(rc == DDS.RETCODE_OK.value){
76  if(extListener != null){
77  this.waitUntilInitialised();
78  if(holder.value != null){
79  this.extListener
80  .onAllDataDisposed(new AllDataDisposedEventImpl<TYPE>(
81  this.environment, this.topic,
82  StatusConverter.convert(this.environment, holder.value)));
83  } else {
84  this.extListener
85  .onAllDataDisposed(new AllDataDisposedEventImpl<TYPE>(
86  this.environment, this.topic, null));
87  }
88  }
89  }
90  }
91 }
void on_inconsistent_topic(DDS.Topic arg0, InconsistentTopicStatus arg1)
static QosPolicyCount [] convert(OsplServiceEnvironment env, DDS.QosPolicyCount[] old)
TopicListenerImpl(OsplServiceEnvironment environment, AbstractTopic< TYPE > topic, TopicListener< TYPE > listener, boolean waitUntilInitialised)
OsplServiceEnvironment environment
Definition: Listener.java:33
Since org.omg.dds.topic.Topic is a kind of org.omg.dds.core.Entity, it has the ability to have an ass...
Extension of org.omg.dds.topic.TopicListener to provide callback to notify AllDataDisposedEvent as we...
TopicListenerImpl(OsplServiceEnvironment environment, AbstractTopic< TYPE > topic, TopicListener< TYPE > listener)
Another topic exists with the same name but different characteristics.