OpenSplice Java 5 DCPS  v6.x
OpenSplice Java 5 OpenSplice Data Distribution Service Data-Centric Publish-Subscribe API
DataReader.java
Go to the documentation of this file.
1 /* Copyright 2010, Object Management Group, Inc.
2  * Copyright 2010, PrismTech, Inc.
3  * Copyright 2010, Real-Time Innovations, Inc.
4  * All rights reserved.
5  *
6  * Licensed under the Apache License, Version 2.0 (the "License");
7  * you may not use this file except in compliance with the License.
8  * You may obtain a copy of the License at
9  *
10  * http://www.apache.org/licenses/LICENSE-2.0
11  *
12  * Unless required by applicable law or agreed to in writing, software
13  * distributed under the License is distributed on an "AS IS" BASIS,
14  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15  * See the License for the specific language governing permissions and
16  * limitations under the License.
17  */
18 
19 package org.omg.dds.sub;
20 
21 import java.util.List;
22 import java.util.Set;
23 import java.util.concurrent.TimeUnit;
24 import java.util.concurrent.TimeoutException;
25 
26 import org.omg.dds.core.DDSObject;
27 import org.omg.dds.core.DomainEntity;
28 import org.omg.dds.core.Duration;
39 
40 
131 public interface DataReader<TYPE>
132 extends DomainEntity<DataReaderListener<TYPE>, DataReaderQos>
133 {
143  public <OTHER> DataReader<OTHER> cast();
144 
186  Subscriber.DataState states);
187 
233  String queryExpression,
234  List<String> queryParameters);
235 
278  String queryExpression,
279  String... queryParameters);
280 
344  Subscriber.DataState states,
345  String queryExpression,
346  List<String> queryParameters);
347 
408  Subscriber.DataState states,
409  String queryExpression,
410  String... queryParameters);
411 
421  public void closeContainedEntities();
422 
429 
452 
473 
493 
517 
550 
572 
606  public void waitForHistoricalData(Duration maxWait)
607  throws TimeoutException;
608 
643  public void waitForHistoricalData(long maxWait, TimeUnit unit)
644  throws TimeoutException;
645 
684  public Set<InstanceHandle> getMatchedPublications();
685 
721  InstanceHandle publicationHandle);
722 
723 
724  // --- Type-specific interface: ------------------------------------------
725 
782  public Sample.Iterator<TYPE> read();
783 
943  public Sample.Iterator<TYPE> read(Selector<TYPE> query);
944 
965  public Sample.Iterator<TYPE> read(int maxSamples);
966 
1017  public List<Sample<TYPE>> read(List<Sample<TYPE>> samples);
1018 
1057  public List<Sample<TYPE>> read(
1058  List<Sample<TYPE>> samples,
1059  Selector<TYPE> selector);
1060 
1111  public Sample.Iterator<TYPE> take();
1112 
1135  public Sample.Iterator<TYPE> take(int maxSamples);
1136 
1198  public Sample.Iterator<TYPE> take(Selector<TYPE> query);
1199 
1242  public List<Sample<TYPE>> take(List<Sample<TYPE>> samples);
1243 
1272  public List<Sample<TYPE>> take(
1273  List<Sample<TYPE>> samples,
1274  Selector<TYPE> query);
1275 
1312  public boolean readNextSample(Sample<TYPE> sample);
1313 
1352  public boolean takeNextSample(Sample<TYPE> sample);
1353 
1379  public TYPE getKeyValue(
1380  TYPE keyHolder,
1381  InstanceHandle handle);
1382 
1406  public TYPE getKeyValue(InstanceHandle handle);
1407 
1431  public InstanceHandle lookupInstance(TYPE keyHolder);
1432 
1433 
1434  // --- From Entity: ------------------------------------------------------
1435  @Override
1437 
1438  @Override
1439  public Subscriber getParent();
1440 
1452  public Selector<TYPE> select();
1453 
1511  public static interface Selector<T> extends DDSObject {
1512 
1513  // --- Setters ----------------------------------------------
1514 
1535  public Selector<T> instance(InstanceHandle handle);
1573 
1597  public Selector<T> dataState(Subscriber.DataState state);
1598 
1628  public Selector<T> Content(String queryExpression, List<String> queryParameters);
1629 
1656  public Selector<T> Content(String queryExpression, String... queryParameters);
1677  public Selector<T> maxSamples(int max);
1678 
1679  // --- Getters ----------------------------------------------
1680 
1685  public InstanceHandle getInstance();
1690  public boolean retrieveNextInstance();
1700  public String getQueryExpression();
1705  public List<String> getQueryParameters();
1710  public int getMaxSamples();
1715  public ReadCondition<T> getCondition();
1716 
1717  // --- read/take operations ----------------------------------
1718 
1732  public Sample.Iterator<T> read();
1747  public List<Sample<T>> read(List<Sample<T>> samples);
1761  public Sample.Iterator<T> take();
1776  public List<Sample<T>> take(List<Sample<T>> samples);
1777  }
1778 }
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
StatusCondition< DataReader< TYPE > > getStatusCondition()
A Sample represents an atom of data information (i.e., one value for one instance) as returned by a o...
Definition: Sample.java:116
A StatusCondition object is an immutable object that specifies Condition that is associated with each...
RequestedIncompatibleQosStatus getRequestedIncompatibleQosStatus()
This operation obtains the RequestedIncompatibleQosStatus object of the DataReader.
String getQueryExpression()
Returns the query expression of the selector.
int getMaxSamples()
Returns the maximum number of samples of the selector.
InstanceHandle lookupInstance(TYPE keyHolder)
This operation takes as a parameter an instance and returns a handle that can be used in subsequent o...
Selector< T > instance(InstanceHandle handle)
Set InstanceHandle to filter with during the read or take.
boolean retrieveNextInstance()
Returns if the selector should use the next instance or not.
TopicDescription< TYPE > getTopicDescription()
SampleRejectedStatus getSampleRejectedStatus()
This operation obtains the SampleRejectedStatus object of the DataReader.
boolean readNextSample(Sample< TYPE > sample)
This operation copies the next, non-previously accessed sample from this DataReader.
PublicationBuiltinTopicData getMatchedPublicationData(InstanceHandle publicationHandle)
This operation retrieves information on a publication that is currently "associated" with the DataRea...
A DataState encapsulates sets of sample states, view states, and instance states as a convenience...
Selector< T > dataState(Subscriber.DataState state)
Set DataState to filter with during the read or take.
TYPE getKeyValue(TYPE keyHolder, InstanceHandle handle)
This operation can be used to retrieve the instance key that corresponds to an instance handle...
DomainEntity is the abstract base class for all DCPS entities, except for the org.omg.dds.domain.DomainParticipant.
RequestedDeadlineMissedStatus getRequestedDeadlineMissedStatus()
This operation obtains the RequestedDeadlineMissedStatus object of the DataReader.
Selector< T > Content(String queryExpression, List< String > queryParameters)
Set the Content to filter with during the read or take.
Sample.Iterator< TYPE > read()
This operation accesses a collection of samples from this DataReader.
QueryCondition< TYPE > createQueryCondition(String queryExpression, List< String > queryParameters)
This operation creates a QueryCondition.
SampleLostStatus getSampleLostStatus()
This operation obtains the SampleLostStatus object of the DataReader.
void closeContainedEntities()
This operation closes all the entities that were created by means of the "create" operations on the D...
Sample.Iterator< T > take()
This operation works the same as the DataReader#take(), except that it is performed on this Selector ...
An opaque handle that can be used to refer to a local or remote entity.
Selector< T > maxSamples(int max)
Set maxSamples to limit the number of sample to get during the read or take.
A org.omg.dds.core.policy.QosPolicy value was incompatible with what is offered.
ReadCondition< TYPE > createReadCondition(Subscriber.DataState states)
This operation creates a ReadCondition.
ReadCondition< T > getCondition()
Returns the ReadCondition of the selector.
Set< InstanceHandle > getMatchedPublications()
This operation retrieves the list of publications currently "associated" with the DataReader; that is...
public< OTHER > DataReader< OTHER > cast()
Cast this data reader to the given type, or throw an exception if the cast fails. ...
A supertype of all DDS classes and interfaces.
Definition: DDSObject.java:25
ReadCondition objects are conditions specifically dedicated to read operations and attached to one or...
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.
LivelinessChangedStatus getLivelinessChangedStatus()
This operation obtains the LivelinessChangedStatus object of the DataReader.
Sample.Iterator< TYPE > take()
This operation accesses a collection of samples from this DataReader.
Subscriber.DataState getDataState()
Returns the dataState of the selector.
List< String > getQueryParameters()
Returns a collection of the query parameters of the selector.
The DCPSPublication topic communicates the existence of datawriters by means of the PublicationBuilti...
SubscriptionMatchedStatus getSubscriptionMatchedStatus()
This operation obtains the SubscriptionMatchedStatus object of the DataReader.
The liveliness of one or more org.omg.dds.pub.DataWriters that were writing instances read through th...
Selector< TYPE > select()
Provides a Selector that can be used to refine what read or take methods return.
A span of elapsed time expressed with nanosecond precision.
Definition: Duration.java:35
Sample.Iterator< T > read()
This operation works the same as the DataReader#read(), except that it is performed on this Selector ...
boolean takeNextSample(Sample< TYPE > sample)
This operation copies the next, non-previously accessed sample from this DataReader and "removes" it ...
A (received) sample has been rejected.
This interface is the base for org.omg.dds.topic.Topic, org.omg.dds.topic.ContentFilteredTopic, and org.omg.dds.topic.MultiTopic.
void waitForHistoricalData(Duration maxWait)
This operation is intended only for DataReader entities for which org.omg.dds.core.policy.Durability#getKind() is not org.omg.dds.core.policy.Durability.Kind#VOLATILE.
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.
InstanceHandle getInstance()
Returns the current instance the selector is working on.
Selector< T > nextInstance(boolean retrieveNextInstance)
Set next InstanceHandle to filter with during the read or take.
QueryCondition objects are specialized org.omg.dds.sub.ReadCondition objects that allow the applicati...