OpenSplice Java 5 DCPS  v6.x
OpenSplice Java 5 OpenSplice Data Distribution Service Data-Centric Publish-Subscribe API
PublisherQosImpl.java
Go to the documentation of this file.
1 /*
2  * Vortex OpenSplice
3  *
4  * This software and documentation are Copyright 2006 to 2021 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.pub;
22 
28 import org.omg.dds.pub.PublisherQos;
37 
38 public class PublisherQosImpl extends EntityQosImpl<ForPublisher> implements
39  PublisherQos {
40 
41  private static final long serialVersionUID = 3160319098450969471L;
42 
45  super(environment, policies);
46  }
47 
49  super(environment);
50  }
51 
52  private PublisherQosImpl(PublisherQosImpl source,
53  ForPublisher... 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.containsKey(Presentation.class)) {
62  this.put(Presentation.class, new PresentationImpl(this.environment));
63  }
64  if (!this.containsKey(Partition.class)) {
65  this.put(Partition.class, new PartitionImpl(this.environment));
66  }
67  if (!this.containsKey(GroupData.class)) {
68  this.put(GroupData.class, new GroupDataImpl(this.environment));
69  }
70  if (!this.containsKey(EntityFactory.class)) {
71  this.put(EntityFactory.class, new EntityFactoryImpl(
72  this.environment));
73  }
74  }
75  }
76 
77  @Override
79  return this.get(Presentation.class);
80  }
81 
82  @Override
84  return this.get(Partition.class);
85  }
86 
87  @Override
89  return this.get(GroupData.class);
90  }
91 
92  @Override
94  return this.get(EntityFactory.class);
95  }
96 
97  @Override
99  return this.withPolicies(policy);
100  }
101 
102  @Override
104  synchronized(this.policies) {
105  return new PublisherQosImpl(this, policy);
106  }
107  }
108 
110  DDS.PublisherQos oldQos) {
111  if (oldQos == null) {
112  throw new IllegalArgumentExceptionImpl(env,
113  "oldQos parameter is null.");
114  }
115 
116  PublisherQosImpl qos = new PublisherQosImpl(env);
117 
118  qos.put(EntityFactory.class,
119  PolicyConverter.convert(env, oldQos.entity_factory));
120  qos.put(GroupData.class,
121  PolicyConverter.convert(env, oldQos.group_data));
122  qos.put(Partition.class, PolicyConverter.convert(env, oldQos.partition));
123  qos.put(Presentation.class,
124  PolicyConverter.convert(env, oldQos.presentation));
125 
126  return qos;
127  }
128 
129  public DDS.PublisherQos convert() {
130  DDS.PublisherQos old = new DDS.PublisherQos();
131 
132  synchronized (this.policies) {
133  old.entity_factory = PolicyConverter.convert(this.environment,
134  ((EntityFactory) this.policies.get(EntityFactory.class)));
135  old.group_data = PolicyConverter.convert(this.environment,
136  ((GroupData) this.policies.get(GroupData.class)));
137 
138  old.partition = PolicyConverter.convert(this.environment,
139  ((Partition) this.policies.get(Partition.class)));
140  old.presentation = PolicyConverter.convert(this.environment,
141  ((Presentation) this.policies.get(Presentation.class)));
142  }
143  return old;
144  }
145 }
static PublisherQosImpl convert(OsplServiceEnvironment env, DDS.PublisherQos oldQos)
PublisherQos withPolicy(ForPublisher policy)
PublisherQosImpl(OsplServiceEnvironment environment)
This policy allows the introduction of a logical partition concept inside the "physical" partition in...
Definition: Partition.java:86
void setupPolicies(Collection< T > policies)
T put(Class<? extends T > arg0, T arg1)
PublisherQos withPolicies(ForPublisher... policy)
PublisherQosImpl(OsplServiceEnvironment environment, ForPublisher... policies)
Specifies how the samples representing changes to data instances are presented to the subscribing app...
User data not known by the middleware, but distributed by means of built-in topics.
Definition: GroupData.java:44
static DDS.UserDataQosPolicy convert(OsplServiceEnvironment env, UserData p)
A QosPolicy interface that implements this marker interface applies to org.omg.dds.pub.Publisher Entities.
Definition: QosPolicy.java:142
This class is the abstract root for all the QoS policies.
Definition: QosPolicy.java:118
final OsplServiceEnvironment environment
HashMap< Class<? extends T >, T > policies
Controls the behavior of the org.omg.dds.core.Entity when acting as a factory for other entities...