OpenSplice Java 5 DCPS  v6.x
OpenSplice Java 5 OpenSplice Data Distribution Service Data-Centric Publish-Subscribe API
PolicyConverter.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.core.policy;
22 
23 import java.util.Set;
24 
25 import org.omg.dds.core.Duration;
26 import org.omg.dds.core.policy.Deadline;
33 import org.omg.dds.core.policy.History;
35 import org.omg.dds.core.policy.Lifespan;
55 import org.omg.dds.core.policy.UserData;
57 
58 public class PolicyConverter {
59  public static DDS.UserDataQosPolicy convert(OsplServiceEnvironment env,
60  UserData p) {
61  return new DDS.UserDataQosPolicy(p.getValue());
62  }
63 
65  DDS.UserDataQosPolicy old) {
66  return new UserDataImpl(env, old.value);
67  }
68 
70  DDS.EntityFactoryQosPolicy old) {
71  return new EntityFactoryImpl(env, old.autoenable_created_entities);
72  }
73 
74  public static DDS.EntityFactoryQosPolicy convert(
76  return new DDS.EntityFactoryQosPolicy(p.isAutoEnableCreatedEntities());
77  }
78 
80  DDS.SchedulingQosPolicy old) {
81  Scheduling ls = new SchedulingImpl(env);
82 
83  switch (old.scheduling_class.kind.value()) {
84  case DDS.SchedulingClassQosPolicyKind._SCHEDULE_DEFAULT:
86  break;
87  case DDS.SchedulingClassQosPolicyKind._SCHEDULE_REALTIME:
89  break;
90  case DDS.SchedulingClassQosPolicyKind._SCHEDULE_TIMESHARING:
92  break;
93  default:
94  throw new DDSExceptionImpl(env,
95  "Failed to convert listenerSchedulingClass");
96  }
97  switch (old.scheduling_priority_kind.kind.value()) {
98  case DDS.SchedulingPriorityQosPolicyKind._PRIORITY_ABSOLUTE:
100  break;
101  case DDS.SchedulingPriorityQosPolicyKind._PRIORITY_RELATIVE:
103  break;
104  default:
105  throw new DDSExceptionImpl(env,
106  "Failed to convert listenerSchedulingKind");
107  }
108  return ls;
109  }
110 
111  public static DDS.SchedulingQosPolicy convert(OsplServiceEnvironment env,
112  Scheduling p) {
113  DDS.SchedulingQosPolicy old = new DDS.SchedulingQosPolicy();
114 
115  switch (p.getSchedulingClass()) {
116  case DEFAULT:
117  old.scheduling_class = new DDS.SchedulingClassQosPolicy(
118  DDS.SchedulingClassQosPolicyKind.SCHEDULE_DEFAULT);
119  break;
120  case REALTIME:
121  old.scheduling_class = new DDS.SchedulingClassQosPolicy(
122  DDS.SchedulingClassQosPolicyKind.SCHEDULE_REALTIME);
123  break;
124  case TIMESHARING:
125  old.scheduling_class = new DDS.SchedulingClassQosPolicy(
126  DDS.SchedulingClassQosPolicyKind.SCHEDULE_TIMESHARING);
127  break;
128  default:
129  throw new DDSExceptionImpl(env,
130  "Failed to convert listenerSchedulingClass");
131  }
132 
133  switch (p.getKind()) {
134  case ABSOLUTE:
135  old.scheduling_priority_kind = new DDS.SchedulingPriorityQosPolicy(
136  DDS.SchedulingPriorityQosPolicyKind.PRIORITY_ABSOLUTE);
137  break;
138  case RELATIVE:
139  old.scheduling_priority_kind = new DDS.SchedulingPriorityQosPolicy(
140  DDS.SchedulingPriorityQosPolicyKind.PRIORITY_RELATIVE);
141  break;
142  default:
143  throw new DDSExceptionImpl(env,
144  "Failed to convert listenerSchedulingKind");
145  }
146  old.scheduling_priority = p.getPriority();
147 
148  return old;
149  }
150 
152  DDS.Duration_t old) {
153  return new DurationImpl(env, old.sec, old.nanosec);
154  }
155 
156  public static DDS.Duration_t convert(OsplServiceEnvironment env, Duration p) {
157  return Utilities.convert(env, p);
158  }
159 
161  DDS.DeadlineQosPolicy old) {
162  return new DeadlineImpl(env, convert(env, old.period));
163  }
164 
165  public static DDS.DeadlineQosPolicy convert(OsplServiceEnvironment env,
166  Deadline p) {
167  return new DDS.DeadlineQosPolicy(convert(env, p.getPeriod()));
168  }
169 
171  DDS.DestinationOrderQosPolicy old) {
172  switch (old.kind.value()) {
173  case DDS.DestinationOrderQosPolicyKind._BY_RECEPTION_TIMESTAMP_DESTINATIONORDER_QOS:
175  case DDS.DestinationOrderQosPolicyKind._BY_SOURCE_TIMESTAMP_DESTINATIONORDER_QOS:
177  default:
178  throw new IllegalArgumentExceptionImpl(env,
179  "Unknown DestinationOrder kind.");
180  }
181  }
182 
183  public static DDS.DestinationOrderQosPolicy convert(
185  switch (p.getKind()) {
186  case BY_RECEPTION_TIMESTAMP:
187  return new DDS.DestinationOrderQosPolicy(
188  DDS.DestinationOrderQosPolicyKind.BY_RECEPTION_TIMESTAMP_DESTINATIONORDER_QOS);
189  case BY_SOURCE_TIMESTAMP:
190  return new DDS.DestinationOrderQosPolicy(
191  DDS.DestinationOrderQosPolicyKind.BY_SOURCE_TIMESTAMP_DESTINATIONORDER_QOS);
192  default:
193  throw new IllegalArgumentExceptionImpl(env,
194  "Unknown DestinationOrder kind.");
195  }
196  }
197 
199  DDS.DurabilityQosPolicy old) {
200  switch (old.kind.value()) {
201  case DDS.DurabilityQosPolicyKind._VOLATILE_DURABILITY_QOS:
202  return new DurabilityImpl(env, Durability.Kind.VOLATILE);
203  case DDS.DurabilityQosPolicyKind._TRANSIENT_LOCAL_DURABILITY_QOS:
205  case DDS.DurabilityQosPolicyKind._TRANSIENT_DURABILITY_QOS:
206  return new DurabilityImpl(env, Durability.Kind.TRANSIENT);
207  case DDS.DurabilityQosPolicyKind._PERSISTENT_DURABILITY_QOS:
208  return new DurabilityImpl(env, Durability.Kind.PERSISTENT);
209  default:
210  throw new IllegalArgumentExceptionImpl(env,
211  "Unknown Durability kind.");
212  }
213  }
214 
215  public static DDS.DurabilityQosPolicy convert(OsplServiceEnvironment env,
216  Durability p) {
217  switch (p.getKind()) {
218  case VOLATILE:
219  return new DDS.DurabilityQosPolicy(
220  DDS.DurabilityQosPolicyKind.VOLATILE_DURABILITY_QOS);
221  case TRANSIENT_LOCAL:
222  return new DDS.DurabilityQosPolicy(
223  DDS.DurabilityQosPolicyKind.TRANSIENT_LOCAL_DURABILITY_QOS);
224  case TRANSIENT:
225  return new DDS.DurabilityQosPolicy(
226  DDS.DurabilityQosPolicyKind.TRANSIENT_DURABILITY_QOS);
227  case PERSISTENT:
228  return new DDS.DurabilityQosPolicy(
229  DDS.DurabilityQosPolicyKind.PERSISTENT_DURABILITY_QOS);
230  default:
231  throw new IllegalArgumentExceptionImpl(env,
232  "Unknown Durability kind.");
233  }
234  }
235 
237  DDS.DurabilityServiceQosPolicy old) {
238  History.Kind kind;
239 
240  switch (old.history_kind.value()) {
241  case DDS.HistoryQosPolicyKind._KEEP_ALL_HISTORY_QOS:
242  kind = History.Kind.KEEP_ALL;
243  break;
244  case DDS.HistoryQosPolicyKind._KEEP_LAST_HISTORY_QOS:
245  kind = History.Kind.KEEP_LAST;
246  break;
247  default:
248  throw new IllegalArgumentExceptionImpl(env, "Unknown History kind.");
249  }
250 
251  return new DurabilityServiceImpl(env, convert(env,
252  old.service_cleanup_delay), kind, old.history_depth,
253  old.max_samples, old.max_instances,
254  old.max_samples_per_instance);
255  }
256 
257  public static DDS.DurabilityServiceQosPolicy convert(
259  DDS.HistoryQosPolicyKind kind;
260 
261  switch (p.getHistoryKind()) {
262  case KEEP_ALL:
263  kind = DDS.HistoryQosPolicyKind.KEEP_ALL_HISTORY_QOS;
264  break;
265  case KEEP_LAST:
266  kind = DDS.HistoryQosPolicyKind.KEEP_LAST_HISTORY_QOS;
267  break;
268  default:
271  "Unknown History kind.");
272  }
273  return new DDS.DurabilityServiceQosPolicy(convert(env,
274  p.getServiceCleanupDelay()), kind, p.getHistoryDepth(),
277  }
278 
280  DDS.HistoryQosPolicy old) {
281  History.Kind kind;
282 
283  switch (old.kind.value()) {
284  case DDS.HistoryQosPolicyKind._KEEP_ALL_HISTORY_QOS:
285  kind = History.Kind.KEEP_ALL;
286  break;
287  case DDS.HistoryQosPolicyKind._KEEP_LAST_HISTORY_QOS:
288  kind = History.Kind.KEEP_LAST;
289  break;
290  default:
291  throw new IllegalArgumentExceptionImpl(env, "Unknown History kind.");
292  }
293  return new HistoryImpl(env, kind, old.depth);
294  }
295 
296  public static DDS.HistoryQosPolicy convert(OsplServiceEnvironment env,
297  History p) {
298  DDS.HistoryQosPolicyKind kind;
299 
300  switch (p.getKind()) {
301  case KEEP_ALL:
302  kind = DDS.HistoryQosPolicyKind.KEEP_ALL_HISTORY_QOS;
303  break;
304  case KEEP_LAST:
305  kind = DDS.HistoryQosPolicyKind.KEEP_LAST_HISTORY_QOS;
306  break;
307  default:
308  throw new IllegalArgumentExceptionImpl(env, "Unknown History kind.");
309  }
310  return new DDS.HistoryQosPolicy(kind, p.getDepth());
311  }
312 
314  DDS.LatencyBudgetQosPolicy old) {
315  return new LatencyBudgetImpl(env, convert(env, old.duration));
316  }
317 
318  public static DDS.LatencyBudgetQosPolicy convert(
320  return new DDS.LatencyBudgetQosPolicy(convert(env, p.getDuration()));
321  }
322 
324  DDS.LifespanQosPolicy old) {
325  return new LifespanImpl(env, convert(env, old.duration));
326  }
327 
328  public static DDS.LifespanQosPolicy convert(OsplServiceEnvironment env,
329  Lifespan p) {
330  return new DDS.LifespanQosPolicy(convert(env, p.getDuration()));
331  }
332 
334  DDS.ReaderLifespanQosPolicy old) {
335  if (old.use_lifespan == false) {
336  return null;
337  }
338  return new ReaderLifespanImpl(env, convert(env, old.duration));
339  }
340 
341  public static DDS.ReaderLifespanQosPolicy convert(
343  if (p == null) {
344  return new DDS.ReaderLifespanQosPolicy(false,
345  DDS.DURATION_ZERO.value);
346  }
347  return new DDS.ReaderLifespanQosPolicy(true, convert(env,
348  p.getDuration()));
349  }
350 
352  DDS.ShareQosPolicy old) {
353  if (old.enable == false) {
354  return null;
355  }
356  return new ShareImpl(env, old.name);
357  }
358 
359  public static DDS.ShareQosPolicy convert(OsplServiceEnvironment env, Share p) {
360  if (p == null) {
361  return new DDS.ShareQosPolicy("", false);
362  }
363  return new DDS.ShareQosPolicy(p.getName(), true);
364  }
365 
367  DDS.SubscriptionKeyQosPolicy old) {
368  if (old.use_key_list == false) {
369  return null;
370  }
371  return new SubscriptionKeysImpl(env, old.key_list);
372  }
373 
374  public static DDS.SubscriptionKeyQosPolicy convert(
376  if (p == null) {
377  return new DDS.SubscriptionKeyQosPolicy(false, new String[0]);
378  }
379  return new DDS.SubscriptionKeyQosPolicy(true, p.getKey().toArray(
380  new String[p.getKey().size()]));
381  }
382 
384  DDS.TimeBasedFilterQosPolicy old) {
385  return new TimeBasedFilterImpl(env, Utilities.convert(env,
386  old.minimum_separation));
387  }
388 
389  public static DDS.TimeBasedFilterQosPolicy convert(
391  return new DDS.TimeBasedFilterQosPolicy(Utilities.convert(env,
392  p.getMinimumSeparation()));
393  }
394 
396  DDS.LivelinessQosPolicy old) {
397  Liveliness.Kind kind;
398 
399  switch (old.kind.value()) {
400  case DDS.LivelinessQosPolicyKind._AUTOMATIC_LIVELINESS_QOS:
401  kind = Liveliness.Kind.AUTOMATIC;
402  break;
403  case DDS.LivelinessQosPolicyKind._MANUAL_BY_PARTICIPANT_LIVELINESS_QOS:
405  break;
406  case DDS.LivelinessQosPolicyKind._MANUAL_BY_TOPIC_LIVELINESS_QOS:
408  break;
409  default:
410  throw new IllegalArgumentExceptionImpl(env,
411  "Unknown Liveliness kind.");
412  }
413  return new LivelinessImpl(env, kind, convert(env, old.lease_duration));
414  }
415 
416  public static DDS.LivelinessQosPolicy convert(OsplServiceEnvironment env,
417  Liveliness p) {
418  DDS.LivelinessQosPolicyKind kind;
419 
420  switch (p.getKind()) {
421  case AUTOMATIC:
422  kind = DDS.LivelinessQosPolicyKind.AUTOMATIC_LIVELINESS_QOS;
423  break;
424  case MANUAL_BY_PARTICIPANT:
425  kind = DDS.LivelinessQosPolicyKind.MANUAL_BY_PARTICIPANT_LIVELINESS_QOS;
426  break;
427  case MANUAL_BY_TOPIC:
428  kind = DDS.LivelinessQosPolicyKind.MANUAL_BY_TOPIC_LIVELINESS_QOS;
429  break;
430  default:
431  throw new IllegalArgumentExceptionImpl(env,
432  "Unknown Liveliness kind.");
433  }
434  return new DDS.LivelinessQosPolicy(kind, convert(env,
435  p.getLeaseDuration()));
436  }
437 
439  DDS.OwnershipQosPolicy old) {
440  Ownership.Kind kind;
441 
442  switch (old.kind.value()) {
443  case DDS.OwnershipQosPolicyKind._SHARED_OWNERSHIP_QOS:
444  kind = Ownership.Kind.SHARED;
445  break;
446  case DDS.OwnershipQosPolicyKind._EXCLUSIVE_OWNERSHIP_QOS:
447  kind = Ownership.Kind.EXCLUSIVE;
448  break;
449  default:
450  throw new IllegalArgumentExceptionImpl(env,
451  "Unknown Ownership kind.");
452  }
453  return new OwnershipImpl(env, kind);
454  }
455 
456  public static DDS.OwnershipQosPolicy convert(OsplServiceEnvironment env,
457  Ownership p) {
458  DDS.OwnershipQosPolicyKind kind;
459 
460  switch (p.getKind()) {
461  case SHARED:
462  kind = DDS.OwnershipQosPolicyKind.SHARED_OWNERSHIP_QOS;
463  break;
464  case EXCLUSIVE:
465  kind = DDS.OwnershipQosPolicyKind.EXCLUSIVE_OWNERSHIP_QOS;
466  break;
467  default:
468  throw new IllegalArgumentExceptionImpl(env,
469  "Unknown Ownership kind.");
470  }
471  return new DDS.OwnershipQosPolicy(kind);
472  }
473 
475  DDS.ReliabilityQosPolicy old) {
476  Reliability.Kind kind;
477 
478  switch (old.kind.value()) {
479  case DDS.ReliabilityQosPolicyKind._BEST_EFFORT_RELIABILITY_QOS:
481  break;
482  case DDS.ReliabilityQosPolicyKind._RELIABLE_RELIABILITY_QOS:
483  kind = Reliability.Kind.RELIABLE;
484  break;
485  default:
486  throw new IllegalArgumentExceptionImpl(env,
487  "Unknown Reliability kind.");
488  }
489  return new ReliabilityImpl(env, kind, convert(env,
490  old.max_blocking_time), old.synchronous);
491  }
492 
493  public static DDS.ReliabilityQosPolicy convert(OsplServiceEnvironment env,
494  Reliability p) {
496  boolean synchronous;
497  DDS.ReliabilityQosPolicyKind kind;
498 
499  try {
501  synchronous = r.isSynchronous();
502  } catch (ClassCastException e) {
503  synchronous = false;
504  }
505  switch (p.getKind()) {
506  case RELIABLE:
507  kind = DDS.ReliabilityQosPolicyKind.RELIABLE_RELIABILITY_QOS;
508  break;
509  case BEST_EFFORT:
510  kind = DDS.ReliabilityQosPolicyKind.BEST_EFFORT_RELIABILITY_QOS;
511  break;
512  default:
513  throw new IllegalArgumentExceptionImpl(env,
514  "Unknown Reliability kind.");
515  }
516  return new DDS.ReliabilityQosPolicy(kind, convert(env,
517  p.getMaxBlockingTime()), synchronous);
518  }
519 
521  DDS.ResourceLimitsQosPolicy old) {
522  return new ResourceLimitsImpl(env, old.max_samples, old.max_instances,
523  old.max_samples_per_instance);
524  }
525 
526  public static DDS.ResourceLimitsQosPolicy convert(
528  return new DDS.ResourceLimitsQosPolicy(p.getMaxSamples(),
530  }
531 
533  DDS.TopicDataQosPolicy old) {
534  return new TopicDataImpl(env, old.value);
535  }
536 
537  public static DDS.TopicDataQosPolicy convert(OsplServiceEnvironment env,
538  TopicData p) {
539  return new DDS.TopicDataQosPolicy(p.getValue());
540  }
541 
543  DDS.TransportPriorityQosPolicy old) {
544  return new TransportPriorityImpl(env, old.value);
545  }
546 
547  public static DDS.TransportPriorityQosPolicy convert(
549  return new DDS.TransportPriorityQosPolicy(p.getValue());
550  }
551 
553  DDS.GroupDataQosPolicy old) {
554  return new GroupDataImpl(env, old.value);
555  }
556 
557  public static DDS.GroupDataQosPolicy convert(OsplServiceEnvironment env,
558  GroupData p) {
559  return new DDS.GroupDataQosPolicy(p.getValue());
560  }
561 
563  DDS.PartitionQosPolicy old) {
564  return new PartitionImpl(env, old.name);
565  }
566 
567  public static DDS.PartitionQosPolicy convert(OsplServiceEnvironment env,
568  Partition p) {
569  Set<String> partitions = p.getName();
570  String[] pArray = p.getName().toArray(new String[partitions.size()]);
571 
572  return new DDS.PartitionQosPolicy(pArray);
573  }
574 
576  DDS.PresentationQosPolicy old) {
577  AccessScopeKind kind;
578 
579  switch (old.access_scope.value()) {
580  case DDS.PresentationQosPolicyAccessScopeKind._INSTANCE_PRESENTATION_QOS:
581  kind = AccessScopeKind.INSTANCE;
582  break;
583  case DDS.PresentationQosPolicyAccessScopeKind._TOPIC_PRESENTATION_QOS:
584  kind = AccessScopeKind.TOPIC;
585  break;
586  case DDS.PresentationQosPolicyAccessScopeKind._GROUP_PRESENTATION_QOS:
587  kind = AccessScopeKind.GROUP;
588  break;
589  default:
590  throw new IllegalArgumentExceptionImpl(env,
591  "Unknown Presentation AccessScope kind.");
592  }
593  return new PresentationImpl(env, kind, old.coherent_access,
594  old.ordered_access);
595  }
596 
597  public static DDS.PresentationQosPolicy convert(OsplServiceEnvironment env,
598  Presentation p) {
599  DDS.PresentationQosPolicyAccessScopeKind kind;
600 
601  switch (p.getAccessScope()) {
602  case INSTANCE:
603  kind = DDS.PresentationQosPolicyAccessScopeKind.INSTANCE_PRESENTATION_QOS;
604  break;
605  case TOPIC:
606  kind = DDS.PresentationQosPolicyAccessScopeKind.TOPIC_PRESENTATION_QOS;
607  break;
608  case GROUP:
609  kind = DDS.PresentationQosPolicyAccessScopeKind.GROUP_PRESENTATION_QOS;
610  break;
611  default:
612  throw new IllegalArgumentExceptionImpl(env,
613  "Unknown Presentation AccessScope kind.");
614  }
615  return new DDS.PresentationQosPolicy(kind, p.isCoherentAccess(),
616  p.isOrderedAccess());
617  }
618 
620  DDS.OwnershipStrengthQosPolicy old) {
621  return new OwnershipStrengthImpl(env, old.value);
622  }
623 
624  public static DDS.OwnershipStrengthQosPolicy convert(
626  return new DDS.OwnershipStrengthQosPolicy(p.getValue());
627  }
628 
630  DDS.WriterDataLifecycleQosPolicy old) {
631  return new WriterDataLifecycleImpl(env,
632  old.autodispose_unregistered_instances, convert(env,
633  old.autopurge_suspended_samples_delay), convert(env,
634  old.autounregister_instance_delay));
635  }
636 
637  public static DDS.WriterDataLifecycleQosPolicy convert(
639  Duration autoPurgeSuspendedSamplesDelay, autoUnregisterInstanceDelay;
641 
642  try {
644  autoPurgeSuspendedSamplesDelay = w
645  .getAutoPurgeSuspendedSamplesDelay();
646  autoUnregisterInstanceDelay = w.getAutoUnregisterInstanceDelay();
647  } catch (ClassCastException e) {
648  autoPurgeSuspendedSamplesDelay = p.getEnvironment().getSPI()
649  .infiniteDuration();
650  autoUnregisterInstanceDelay = p.getEnvironment().getSPI()
651  .infiniteDuration();
652  }
653 
654  return new DDS.WriterDataLifecycleQosPolicy(
656  autoPurgeSuspendedSamplesDelay), convert(env,
657  autoUnregisterInstanceDelay));
658  }
659 
661  DDS.ReaderDataLifecycleQosPolicy old) {
663 
664  switch (old.invalid_sample_visibility.kind.value()) {
665  case DDS.InvalidSampleVisibilityQosPolicyKind._ALL_INVALID_SAMPLES:
667  break;
668  case DDS.InvalidSampleVisibilityQosPolicyKind._MINIMUM_INVALID_SAMPLES:
670  break;
671  case DDS.InvalidSampleVisibilityQosPolicyKind._NO_INVALID_SAMPLES:
673  break;
674  default:
675  throw new IllegalArgumentExceptionImpl(env,
676  "Unknown ReaderDataLifecycle InvalidSampleVisibilityKind.");
677  }
678  return new ReaderDataLifecycleImpl(env, Utilities.convert(env,
679  old.autopurge_nowriter_samples_delay), Utilities.convert(env,
680  old.autopurge_disposed_samples_delay),
681  old.autopurge_dispose_all, kind);
682  }
683 
684  public static DDS.ReaderDataLifecycleQosPolicy convert(
688  boolean autoPurgeDisposeAll;
689  DDS.InvalidSampleVisibilityQosPolicy invalidSampleVisibility;
690 
691  try {
693  autoPurgeDisposeAll = r.getAutoPurgeDisposeAll();
694  switch (r.getInvalidSampleInvisibility()) {
695  case ALL:
696  invalidSampleVisibility = new DDS.InvalidSampleVisibilityQosPolicy(
697  DDS.InvalidSampleVisibilityQosPolicyKind.ALL_INVALID_SAMPLES);
698  break;
699  case MINIMUM:
700  invalidSampleVisibility = new DDS.InvalidSampleVisibilityQosPolicy(
701  DDS.InvalidSampleVisibilityQosPolicyKind.MINIMUM_INVALID_SAMPLES);
702  break;
703  case NONE:
704  invalidSampleVisibility = new DDS.InvalidSampleVisibilityQosPolicy(
705  DDS.InvalidSampleVisibilityQosPolicyKind.NO_INVALID_SAMPLES);
706  break;
707  default:
708  throw new IllegalArgumentExceptionImpl(env,
709  "Unknown ReaderDataLifecycle InvalidSampleVisibilityKind.");
710  }
711 
712  } catch (ClassCastException e) {
713  autoPurgeDisposeAll = false;
714  invalidSampleVisibility = new DDS.InvalidSampleVisibilityQosPolicy(
715  DDS.InvalidSampleVisibilityQosPolicyKind.MINIMUM_INVALID_SAMPLES);
716  }
717 
718  return new DDS.ReaderDataLifecycleQosPolicy(convert(env,
719  p.getAutoPurgeNoWriterSamplesDelay()), convert(env,
720  p.getAutoPurgeDisposedSamplesDelay()), autoPurgeDisposeAll,
721  true, invalidSampleVisibility);
722  }
723 
724  public static Class<? extends QosPolicy> convert(
725  OsplServiceEnvironment env, int policyId) {
726  Class<? extends QosPolicy> policy;
727 
728  switch (policyId) {
729  case DDS.DEADLINE_QOS_POLICY_ID.value:
730  policy = Deadline.class;
731  break;
732  case DDS.DESTINATIONORDER_QOS_POLICY_ID.value:
733  policy = DestinationOrder.class;
734  break;
735  case DDS.DURABILITY_QOS_POLICY_ID.value:
736  policy = Durability.class;
737  break;
738  case DDS.DURABILITYSERVICE_QOS_POLICY_ID.value:
739  policy = DurabilityService.class;
740  break;
741  case DDS.ENTITYFACTORY_QOS_POLICY_ID.value:
742  policy = EntityFactory.class;
743  break;
744  case DDS.GROUPDATA_QOS_POLICY_ID.value:
745  policy = GroupData.class;
746  break;
747  case DDS.HISTORY_QOS_POLICY_ID.value:
748  policy = History.class;
749  break;
750  case DDS.LATENCYBUDGET_QOS_POLICY_ID.value:
751  policy = LatencyBudget.class;
752  break;
753  case DDS.LIFESPAN_QOS_POLICY_ID.value:
754  policy = Lifespan.class;
755  break;
756  case DDS.LIVELINESS_QOS_POLICY_ID.value:
757  policy = Liveliness.class;
758  break;
759  case DDS.OWNERSHIP_QOS_POLICY_ID.value:
760  policy = Ownership.class;
761  break;
762  case DDS.OWNERSHIPSTRENGTH_QOS_POLICY_ID.value:
763  policy = OwnershipStrength.class;
764  break;
765  case DDS.PARTITION_QOS_POLICY_ID.value:
766  policy = Partition.class;
767  break;
768  case DDS.PRESENTATION_QOS_POLICY_ID.value:
769  policy = Presentation.class;
770  break;
771  case DDS.READERDATALIFECYCLE_QOS_POLICY_ID.value:
772  policy = ReaderDataLifecycle.class;
773  break;
774  case DDS.RELIABILITY_QOS_POLICY_ID.value:
775  policy = Reliability.class;
776  break;
777  case DDS.RESOURCELIMITS_QOS_POLICY_ID.value:
778  policy = ResourceLimits.class;
779  break;
780  case DDS.SCHEDULING_QOS_POLICY_ID.value:
781  policy = Scheduling.class;
782  break;
783  case DDS.TIMEBASEDFILTER_QOS_POLICY_ID.value:
784  policy = TimeBasedFilter.class;
785  break;
786  case DDS.TOPICDATA_QOS_POLICY_ID.value:
787  policy = TopicData.class;
788  break;
789  case DDS.TRANSPORTPRIORITY_QOS_POLICY_ID.value:
790  policy = TransportPriority.class;
791  break;
792  case DDS.USERDATA_QOS_POLICY_ID.value:
793  policy = UserData.class;
794  break;
795  case DDS.WRITERDATALIFECYCLE_QOS_POLICY_ID.value:
796  policy = WriterDataLifecycle.class;
797  break;
798  case 23: /* TODO: Add SUBSCRIPTIONKEY_QOS_POLICY_ID to classic Java PSM */
799  policy = SubscriptionKeys.class;
800  break;
801  case 24: /* TODO: Add VIEWKEY_QOS_POLICY_ID to classic Java PSM */
802  policy = ViewKeys.class;
803  break;
804  case 25:/* TODO: Add READERLIFESPAN_QOS_POLICY_ID to classic Java PSM */
805  policy = ReaderLifespan.class;
806  break;
807  case 26:/* TODO: Add SHARE_QOS_POLICY_ID to classic Java PSM */
808  policy = Share.class;
809  break;
810  case DDS.INVALID_QOS_POLICY_ID.value:
811  policy = null;
812  break;
813  default:
814  throw new IllegalArgumentExceptionImpl(env,
815  "Found unknown QoSPolicy id: " + policyId);
816  }
817  return policy;
818  }
819 }
This QosPolicy provides OpenSplice-specific extensions to the org.omg.dds.core.policy.WriterDataLifecycle.
Specifies the configuration of the durability service.
VOLATILE
The Service does not need to keep any samples of data instances on behalf of any org.omg.dds.sub.DataReader that is not known by the org.omg.dds.pub.DataWriter at the time the instance is written.
Specifies the behavior of the org.omg.dds.sub.DataReader with regards to the life cycle of the data i...
ServiceEnvironment getEnvironment()
boolean isCoherentAccess()
If coherentAccess is set, then the accessScope controls the maximum extent of coherent changes...
static Class<? extends QosPolicy > convert(OsplServiceEnvironment env, int policyId)
static Duration convert(OsplServiceEnvironment env, DDS.Duration_t old)
MANUAL_BY_PARTICIPANT
The user application takes responsibility to signal liveliness to the Service.
static DDS.GroupDataQosPolicy convert(OsplServiceEnvironment env, GroupData p)
RELIABLE
Specifies the Service will attempt to deliver all samples in its history.
[optional] Specifies the value of the "strength" used to arbitrate among multiple org...
static DDS.TimeBasedFilterQosPolicy convert(OsplServiceEnvironment env, TimeBasedFilter p)
Scheduling withKind(SchedulingKind schedulingKind)
Copy this policy and override the value of the property.
Specifies the behavior of the org.omg.dds.pub.DataWriter with regards to the life cycle of the data i...
byte [] getValue()
Get a copy of the data.
static SubscriptionKeys convert(OsplServiceEnvironment env, DDS.SubscriptionKeyQosPolicy old)
This org.omg.dds.core.policy.QosPolicy is similar to the org.omg.dds.core.policy.Lifespan (applicable...
KEEP_ALL
On the publishing side, the Service will attempt to keep all samples (representing each value written...
Definition: History.java:155
static DDS.DurabilityQosPolicy convert(OsplServiceEnvironment env, Durability p)
static DDS.ReliabilityQosPolicy convert(OsplServiceEnvironment env, Reliability p)
Specifies the maximum acceptable delay from the time the data is written until the data is inserted i...
This class provides OpenSplice-specific extensions to the org.omg.dds.core.policy.ReaderDataLifecycle policy.
static Ownership convert(OsplServiceEnvironment env, DDS.OwnershipQosPolicy old)
Filter that allows a org.omg.dds.sub.DataReader to specify that it is interested only in (potentially...
Scheduling withSchedulingClass(SchedulingClass schedulingClass)
Copy this policy and override the value of the property.
static OwnershipStrength convert(OsplServiceEnvironment env, DDS.OwnershipStrengthQosPolicy old)
static DDS.ShareQosPolicy convert(OsplServiceEnvironment env, Share p)
static EntityFactory convert(OsplServiceEnvironment env, DDS.EntityFactoryQosPolicy old)
static DDS.EntityFactoryQosPolicy convert(OsplServiceEnvironment env, EntityFactory p)
static TransportPriority convert(OsplServiceEnvironment env, DDS.TransportPriorityQosPolicy old)
static DDS.PresentationQosPolicy convert(OsplServiceEnvironment env, Presentation p)
static DDS.DestinationOrderQosPolicy convert(OsplServiceEnvironment env, DestinationOrder p)
User data not known by the middleware, but distributed by means of built-in topics.
Definition: UserData.java:48
static Presentation convert(OsplServiceEnvironment env, DDS.PresentationQosPolicy old)
static Lifespan convert(OsplServiceEnvironment env, DDS.LifespanQosPolicy old)
static Liveliness convert(OsplServiceEnvironment env, DDS.LivelinessQosPolicy old)
static TopicData convert(OsplServiceEnvironment env, DDS.TopicDataQosPolicy old)
static DDS.Duration_t convert(OsplServiceEnvironment environment, Duration d)
Definition: Utilities.java:232
static History convert(OsplServiceEnvironment env, DDS.HistoryQosPolicy old)
static DDS.TransportPriorityQosPolicy convert(OsplServiceEnvironment env, TransportPriority p)
BY_SOURCE_TIMESTAMP
Indicates that data is ordered based on a time stamp placed at the source (by the Service or by the a...
static DDS.ResourceLimitsQosPolicy convert(OsplServiceEnvironment env, ResourceLimits p)
static GroupData convert(OsplServiceEnvironment env, DDS.GroupDataQosPolicy old)
This policy allows the introduction of a logical partition concept inside the "physical" partition in...
Definition: Partition.java:86
specifies the priority type, which may be either RELATIVE or ABSOLUTE.
Definition: Scheduling.java:92
abstract ServiceProviderInterface getSPI()
This method is not intended for use by applications.
static DDS.ReaderDataLifecycleQosPolicy convert(OsplServiceEnvironment env, org.omg.dds.core.policy.ReaderDataLifecycle p)
AUTOMATIC
The infrastructure will automatically signal liveliness for the org.omg.dds.pub.DataWriters at least ...
static ResourceLimits convert(OsplServiceEnvironment env, DDS.ResourceLimitsQosPolicy old)
static Share convert(OsplServiceEnvironment env, DDS.ShareQosPolicy old)
This QosPolicy allows sharing of entities by multiple processes or threads.
Definition: Share.java:46
static DDS.DurabilityServiceQosPolicy convert(OsplServiceEnvironment env, DurabilityService p)
static DDS.Duration_t convert(OsplServiceEnvironment env, Duration p)
static ReaderLifespan convert(OsplServiceEnvironment env, DDS.ReaderLifespanQosPolicy old)
byte [] getValue()
Get a copy of the data.
boolean getAutoPurgeDisposeAll()
Whether or not instances that have been disposed by means of the org.opensplice.dds.topic.Topic#disposeAllData() method will automatically be purged by the middleware or not.
static DDS.OwnershipStrengthQosPolicy convert(OsplServiceEnvironment env, OwnershipStrength p)
EXCLUSIVE
Indicates each instance can only be owned by one org.omg.dds.pub.DataWriter, but the owner of an inst...
Definition: Ownership.java:120
static Deadline convert(OsplServiceEnvironment env, DDS.DeadlineQosPolicy old)
static DDS.PartitionQosPolicy convert(OsplServiceEnvironment env, Partition p)
KEEP_LAST
On the publishing side, the Service will only attempt to keep the most recent "depth" samples (org...
Definition: History.java:141
static TimeBasedFilter convert(OsplServiceEnvironment env, DDS.TimeBasedFilterQosPolicy old)
static DDS.LifespanQosPolicy convert(OsplServiceEnvironment env, Lifespan p)
static DDS.WriterDataLifecycleQosPolicy convert(OsplServiceEnvironment env, WriterDataLifecycle p)
byte [] getValue()
Get a copy of the data.
static Durability convert(OsplServiceEnvironment env, DDS.DurabilityQosPolicy old)
static DDS.SchedulingQosPolicy convert(OsplServiceEnvironment env, Scheduling p)
static DurabilityService convert(OsplServiceEnvironment env, DDS.DurabilityServiceQosPolicy old)
SHARED
Indicates shared ownership for each instance.
Definition: Ownership.java:109
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)
This QosPolicy specifies the scheduling parameters that will be used for a thread that is spawned by ...
Definition: Scheduling.java:45
OpenSplice-specific extension to org.omg.dds.core.policy.Reliability That specifies whether a DataWri...
BEST_EFFORT
Indicates that it is acceptable to not retry propagation of any samples.
TRANSIENT
The Service will attempt to keep some samples so that they can be delivered to any potential late-joi...
static ReaderDataLifecycle convert(OsplServiceEnvironment env, DDS.ReaderDataLifecycleQosPolicy old)
static UserData convert(OsplServiceEnvironment env, DDS.UserDataQosPolicy old)
static DDS.LatencyBudgetQosPolicy convert(OsplServiceEnvironment env, LatencyBudget p)
Determines the mechanism and parameters used by the application to determine whether an org...
PERSISTENT
Data is kept on permanent storage, so that they can outlive a system session.
static DDS.ReaderLifespanQosPolicy convert(OsplServiceEnvironment env, ReaderLifespan p)
By using the SubscriptionKey QosPolicy, a DataReader can force its own key-list definition on data sa...
This policy is a hint to the infrastructure as to how to set the priority of the underlying transport...
INSTANCE
Scope spans only a single instance.
static Scheduling convert(OsplServiceEnvironment env, DDS.SchedulingQosPolicy old)
This class is the abstract root for all the QoS policies.
Definition: QosPolicy.java:118
static WriterDataLifecycle convert(OsplServiceEnvironment env, DDS.WriterDataLifecycleQosPolicy old)
TRANSIENT_LOCAL
The Service will attempt to keep some samples so that they can be delivered to any potential late-joi...
specifies the scheduling class used by the Operating System, which may be DEFAULT, REALTIME or TIMESHARING.
static DestinationOrder convert(OsplServiceEnvironment env, DDS.DestinationOrderQosPolicy old)
static DDS.DeadlineQosPolicy convert(OsplServiceEnvironment env, Deadline p)
static DDS.HistoryQosPolicy convert(OsplServiceEnvironment env, History p)
Controls the criteria used to determine the logical order among changes made by org.omg.dds.pub.Publisher entities to the same instance of data (i.e., matching Topic and key).
MANUAL_BY_TOPIC
The user application takes responsibility to signal liveliness to the Service.
static Reliability convert(OsplServiceEnvironment env, DDS.ReliabilityQosPolicy old)
A span of elapsed time expressed with nanosecond precision.
Definition: Duration.java:35
static DDS.LivelinessQosPolicy convert(OsplServiceEnvironment env, Liveliness p)
BY_RECEPTION_TIMESTAMP
Indicates that data is ordered based on the reception time at each org.omg.dds.sub.Subscriber.
Specifies the resources that the Service can consume in order to meet the requested QoS...
Controls the behavior of the org.omg.dds.core.Entity when acting as a factory for other entities...
static Partition convert(OsplServiceEnvironment env, DDS.PartitionQosPolicy old)
This policy indicates the level of reliability requested by a org.omg.dds.sub.DataReader or offered b...
boolean isOrderedAccess()
If orderedAccess is set, then the accessScope controls the maximum extent for which order will be pre...
static LatencyBudget convert(OsplServiceEnvironment env, DDS.LatencyBudgetQosPolicy old)
This QosPolicy is used to set the key list of a DataReaderView.
Definition: ViewKeys.java:54
This policy expresses if the data should "outlive" their writing time.
static DDS.SubscriptionKeyQosPolicy convert(OsplServiceEnvironment env, SubscriptionKeys p)
static DDS.OwnershipQosPolicy convert(OsplServiceEnvironment env, Ownership p)
org.omg.dds.sub.DataReader expects a new sample updating the value of each instance at least once eve...
Definition: Deadline.java:92
TOPIC
Scope spans to all instances within the same org.omg.dds.pub.DataWriter (or org.omg.dds.sub.DataReader), but not across instances in different DataWriter (or DataReader).
GROUP
[optional] Scope spans to all instances belonging to org.omg.dds.pub.DataWriter (or org...
This QosPolicy specifies whether a DataWriter exclusively may own an instance.
Definition: Ownership.java:63
static DDS.TopicDataQosPolicy convert(OsplServiceEnvironment env, TopicData p)
Specifies the maximum duration of validity of the data written by the org.omg.dds.pub.DataWriter.
Definition: Lifespan.java:57
Instance state changes are communicated to a org.omg.dds.sub.DataReader by means of the sample info a...
User data not known by the middleware, but distributed by means of built-in topics.
Definition: TopicData.java:42
Specifies the behavior of the Service in the case where the value of a sample changes (one or more ti...
Definition: History.java:76