OpenSplice Java 5 DCPS  v6.x
OpenSplice Java 5 OpenSplice Data Distribution Service Data-Centric Publish-Subscribe API
DomainParticipantQosImpl.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.domain;
22 
36 import org.omg.dds.core.policy.UserData;
37 
38 public class DomainParticipantQosImpl extends
39 EntityQosImpl<ForDomainParticipant> implements DomainParticipantQos {
40  private static final long serialVersionUID = -1811553017861487660L;
41 
43  super(environment);
44  }
45 
47  ForDomainParticipant... domainParticipants) {
48  super(environment, domainParticipants);
49 
50  }
51 
53  ForDomainParticipant... policy) {
54  super(source.environment, source.policies.values());
55  setupPolicies(policy);
56  }
57 
58  @Override
59  protected void setupMissingPolicies() {
60  synchronized (this.policies) {
61  if (!this.policies.containsKey(EntityFactory.class)) {
62  this.policies.put(EntityFactory.class, new EntityFactoryImpl(
63  this.environment));
64  }
65  if (!this.policies.containsKey(UserData.class)) {
66  this.policies.put(UserData.class,
67  new UserDataImpl(this.environment));
68  }
69  if (!this.policies.containsKey(ListenerScheduling.class)) {
70  this.policies.put(ListenerScheduling.class, new SchedulingImpl(
71  this.environment));
72  }
73  if (!this.policies.containsKey(WatchdogScheduling.class)) {
74  this.policies.put(WatchdogScheduling.class, new SchedulingImpl(
75  this.environment));
76  }
77  }
78  }
79 
80  @Override
81  public UserData getUserData() {
82  synchronized (this.policies) {
83  return (UserData) this.policies.get(UserData.class);
84  }
85  }
86 
87  @Override
89  synchronized (this.policies) {
90  return (EntityFactory) this.policies.get(EntityFactory.class);
91  }
92  }
93 
94  @Override
96  synchronized (this.policies) {
97  return (ListenerScheduling) this.policies.get(ListenerScheduling.class);
98  }
99  }
100 
101  @Override
103  synchronized (this.policies) {
104  return (WatchdogScheduling) this.policies.get(WatchdogScheduling.class);
105  }
106  }
107 
108  @Override
110  return this.withPolicies(policy);
111  }
112 
113  @Override
115  QosPolicy.ForDomainParticipant... policy) {
116  synchronized (this.policies) {
117  return new DomainParticipantQosImpl(this, policy);
118  }
119  }
120 
122  DDS.DomainParticipantQos oldQos) {
123 
124  if (oldQos == null) {
125  throw new IllegalArgumentExceptionImpl(env,
126  "oldQos parameter is null.");
127  }
128 
130 
131  qos.put(EntityFactory.class,
132  PolicyConverter.convert(env, oldQos.entity_factory));
133  qos.put(UserData.class, PolicyConverter.convert(env, oldQos.user_data));
134  qos.put(ListenerScheduling.class,
135  PolicyConverter.convert(env, oldQos.listener_scheduling));
136  qos.put(WatchdogScheduling.class,
137  PolicyConverter.convert(env, oldQos.watchdog_scheduling));
138 
139  return qos;
140  }
141 
142  public DDS.DomainParticipantQos convert() {
143  DDS.DomainParticipantQos old = new DDS.DomainParticipantQos();
144 
145  synchronized (this.policies) {
146  old.entity_factory = PolicyConverter.convert(this.environment,
147  ((EntityFactory) this.policies.get(EntityFactory.class)));
148  old.user_data = PolicyConverter.convert(this.environment,
149  ((UserData) this.policies.get(UserData.class)));
150  old.listener_scheduling = PolicyConverter.convert(this.environment,
152  .get(ListenerScheduling.class));
153  old.watchdog_scheduling = PolicyConverter.convert(this.environment,
155  .get(WatchdogScheduling.class));
156  }
157  return old;
158  }
159 }
User data not known by the middleware, but distributed by means of built-in topics.
Definition: UserData.java:48
void setupPolicies(Collection< T > policies)
static DomainParticipantQosImpl convert(OsplServiceEnvironment env, DDS.DomainParticipantQos oldQos)
T put(Class<? extends T > arg0, T arg1)
DomainParticipantQos withPolicies(QosPolicy.ForDomainParticipant... policy)
DomainParticipantQos withPolicy(QosPolicy.ForDomainParticipant policy)
Scheduling for the Watchdog thread of a org.omg.dds.domain.DomainParticipant.
static DDS.UserDataQosPolicy convert(OsplServiceEnvironment env, UserData p)
OpenSplice-specific extension to org.omg.dds.domain.DomainParticipantQos with support to control sche...
This QosPolicy specifies the scheduling parameters that will be used for a thread that is spawned by ...
Definition: Scheduling.java:45
DomainParticipantQosImpl(OsplServiceEnvironment environment, ForDomainParticipant... domainParticipants)
This class is the abstract root for all the QoS policies.
Definition: QosPolicy.java:118
final OsplServiceEnvironment environment
DomainParticipantQosImpl(OsplServiceEnvironment environment)
A QosPolicy interface that implements this marker interface applies to org.omg.dds.domain.DomainParticipant Entities.
Definition: QosPolicy.java:133
Scheduling for the Listener thread of a org.omg.dds.domain.DomainParticipant.
HashMap< Class<? extends T >, T > policies
Controls the behavior of the org.omg.dds.core.Entity when acting as a factory for other entities...