OpenSplice Java 5 DCPS  v6.x
OpenSplice Java 5 OpenSplice Data Distribution Service Data-Centric Publish-Subscribe API
org.omg.dds.sub.QueryCondition< TYPE > Interface Template Reference

QueryCondition objects are specialized org.omg.dds.sub.ReadCondition objects that allow the application to also specify a filter on the locally available data. More...

Inheritance diagram for org.omg.dds.sub.QueryCondition< TYPE >:
Inheritance graph
Collaboration diagram for org.omg.dds.sub.QueryCondition< TYPE >:
Collaboration graph

Public Member Functions

void close ()
 Reclaim any resources associated with this condition. More...
 
ServiceEnvironment getEnvironment ()
 
Set< InstanceStategetInstanceStates ()
 This operation returns the set of instance states that are taken into account to determine the triggerValue of the ReadCondition. More...
 
DataReader< TYPE > getParent ()
 
String getQueryExpression ()
 This operation returns the queryExpression associated with the QueryCondition. More...
 
List< String > getQueryParameters ()
 This operation returns the queryParameters associated with the QueryCondition. More...
 
Set< SampleStategetSampleStates ()
 This operation returns the set of sample states that are taken into account to determine the triggerValue of the ReadCondition. More...
 
boolean getTriggerValue ()
 
Set< ViewStategetViewStates ()
 This operation returns the set of view states that are taken into account to determine the triggerValue of the ReadCondition. More...
 
void setQueryParameters (List< String > queryParameters)
 This operation changes the queryParameters associated with the QueryCondition. More...
 
void setQueryParameters (String... queryParameters)
 This operation changes the queryParameters associated with the QueryCondition. More...
 

Detailed Description

QueryCondition objects are specialized org.omg.dds.sub.ReadCondition objects that allow the application to also specify a filter on the locally available data.

The query (queryExpression) is similar to an SQL WHERE clause can be parameterized by arguments that are dynamically changeable by the setQueryParameters(List) operation.

This feature is optional. In the cases where it is not supported, the org.omg.dds.sub.DataReader#createQueryCondition(String, List) will return null.

The triggerValue of a QueryCondition is like that of a ReadCondition with the additional condition that the data associated with at least one sample must be such that the queryExpression evaluates to true.

Example:


// Create a QueryCondition with a DataState with a sample state of not read, new view state and alive instance state.
// And apply a condition that only samples with age > 0 and name equals BILL are shown.
DataState ds = subscriber.createDataState();
ds = ds.with(SampleState.NOT_READ)
       .with(ViewState.NEW)
       .with(InstanceState.ALIVE);
String expr = "age &gt; %0 AND name = %1");
List<String> params = new ArrayList<String>();
params.add("0");
params.add("BILL");
QueryCondition<Foo> queryCond = fooDR.createQueryCondition(ds,expr,params);
//Instantiate a WaitSet and attach the condition.
WaitSet myWS = WaitSet.newWaitSet(env);
myWS.attachCondition(queryCond);
Duration waitTimeout = Duration.newDuration(60, TimeUnit.SECONDS, env);
// Wait for the querycondition to trigger.
try
{
    myWS.waitForConditions(waitTimeout);
    List<Sample<Foo>> samples = new ArrayList<Sample<Foo>>();
    fooDR.select().dataState(ds).Content(expr,params).read(samples);
}
catch (TimeoutException e) {}

Parameters
<TYPE>The concrete type of the data that can be read using the the org.omg.dds.sub.DataReader that created this QueryCondition.

Definition at line 72 of file QueryCondition.java.

Member Function Documentation

◆ close()

void org.omg.dds.sub.ReadCondition< TYPE >.close ( )
inherited

Reclaim any resources associated with this condition.

Implemented in org.opensplice.dds.sub.ReadConditionImpl< TYPE >.

◆ getEnvironment()

ServiceEnvironment org.omg.dds.core.DDSObject.getEnvironment ( )
inherited
Returns
the org.omg.dds.core.ServiceEnvironment object that directly or indirectly was used to create this object.

Implemented in org.omg.dds.core.ServiceEnvironment, org.opensplice.dds.sub.ReflectionDataReader< TYPE, OUT_TYPE >, org.opensplice.dds.core.ModifiableTimeImpl, org.opensplice.dds.pub.ReflectionDataWriter< TYPE >, org.opensplice.dds.core.DurationImpl, org.opensplice.dds.topic.ContentFilteredTopicImpl< TYPE >, org.opensplice.dds.sub.ReadConditionImpl< TYPE >, org.opensplice.dds.core.EntityQosImpl< T extends QosPolicy >, org.opensplice.dds.type.TypeSupportImpl< TYPE >, org.opensplice.dds.topic.PublicationBuiltinTopicDataImpl, org.opensplice.dds.topic.SubscriptionBuiltinTopicDataImpl, org.opensplice.dds.topic.TopicBuiltinTopicDataImpl, org.opensplice.dds.domain.DomainParticipantFactoryImpl, org.opensplice.dds.core.QosProviderImpl, org.opensplice.dds.core.status.OfferedIncompatibleQosStatusImpl, org.opensplice.dds.core.status.RequestedIncompatibleQosStatusImpl, org.opensplice.dds.core.InstanceHandleImpl, org.opensplice.dds.core.StatusConditionImpl< T extends Entity<?, ?>, org.opensplice.dds.core.status.LivelinessChangedStatusImpl, org.opensplice.dds.core.status.PublicationMatchedStatusImpl, org.opensplice.dds.core.status.SubscriptionMatchedStatusImpl, org.opensplice.dds.sub.SampleImpl< TYPE >, org.opensplice.dds.core.policy.ShareImpl, org.opensplice.dds.core.status.OfferedDeadlineMissedStatusImpl, org.opensplice.dds.core.status.SampleRejectedStatusImpl, org.opensplice.dds.core.WaitSetImpl, org.opensplice.dds.topic.ParticipantBuiltinTopicDataImpl, org.opensplice.dds.core.status.RequestedDeadlineMissedStatusImpl, org.opensplice.dds.topic.BuiltinTopicKeyImpl, org.opensplice.dds.core.GuardConditionImpl, org.opensplice.dds.core.event.AllDataDisposedEventImpl< TYPE >, org.opensplice.dds.core.policy.QosPolicyCountImpl, org.opensplice.dds.core.status.InconsistentTopicStatusImpl, org.opensplice.dds.core.status.LivelinessLostStatusImpl, org.opensplice.dds.core.status.SampleLostStatusImpl, org.opensplice.dds.core.policy.QosPolicyImpl, org.opensplice.dds.core.status.AllDataDisposedStatusImpl, org.opensplice.dds.core.IllegalArgumentExceptionImpl, org.opensplice.dds.core.InconsistentPolicyExceptionImpl, org.opensplice.dds.core.policy.PolicyFactoryImpl, org.opensplice.dds.core.policy.TypeConsistencyEnforcementImpl, org.opensplice.dds.core.PreconditionNotMetExceptionImpl, org.opensplice.dds.core.AlreadyClosedExceptionImpl, org.opensplice.dds.core.IllegalOperationExceptionImpl, org.opensplice.dds.core.ImmutablePolicyExceptionImpl, org.opensplice.dds.core.NotEnabledExceptionImpl, org.opensplice.dds.core.OutOfResourcesExceptionImpl, org.opensplice.dds.core.DDSExceptionImpl, org.opensplice.dds.core.status.DataAvailableStatusImpl, and org.opensplice.dds.core.status.DataOnReadersStatusImpl.

◆ getInstanceStates()

Set<InstanceState> org.omg.dds.sub.ReadCondition< TYPE >.getInstanceStates ( )
inherited

This operation returns the set of instance states that are taken into account to determine the triggerValue of the ReadCondition.

These are the instance states specified when the ReadCondition was created.

Returns
an unmodifiable set.

Implemented in org.opensplice.dds.sub.ReadConditionImpl< TYPE >.

◆ getParent()

DataReader<TYPE> org.omg.dds.sub.ReadCondition< TYPE >.getParent ( )
inherited
Returns
the DataReader associated with the ReadCondition. Note that there is exactly one DataReader associated with each ReadCondition.

Implemented in org.opensplice.dds.sub.ReadConditionImpl< TYPE >.

◆ getQueryExpression()

String org.omg.dds.sub.QueryCondition< TYPE >.getQueryExpression ( )

This operation returns the queryExpression associated with the QueryCondition.

That is, the expression specified when the QueryCondition was created.

See also
getQueryParameters()

Implemented in org.opensplice.dds.sub.QueryConditionImpl< TYPE >.

◆ getQueryParameters()

List<String> org.omg.dds.sub.QueryCondition< TYPE >.getQueryParameters ( )

This operation returns the queryParameters associated with the QueryCondition.

That is, the parameters specified on the last successful call to setQueryParameters(List), or if setQueryParameters(List) was never called, the arguments specified when the QueryCondition was created.

Returns
an unmodifiable list of the current query parameters.
See also
#setQueryParameters(List)
getQueryExpression()

Implemented in org.opensplice.dds.sub.QueryConditionImpl< TYPE >.

◆ getSampleStates()

Set<SampleState> org.omg.dds.sub.ReadCondition< TYPE >.getSampleStates ( )
inherited

This operation returns the set of sample states that are taken into account to determine the triggerValue of the ReadCondition.

These are the sample states specified when the ReadCondition was created.

Returns
an unmodifiable set.

Implemented in org.opensplice.dds.sub.ReadConditionImpl< TYPE >.

◆ getTriggerValue()

boolean org.omg.dds.core.Condition.getTriggerValue ( )
inherited

◆ getViewStates()

Set<ViewState> org.omg.dds.sub.ReadCondition< TYPE >.getViewStates ( )
inherited

This operation returns the set of view states that are taken into account to determine the triggerValue of the ReadCondition.

These are the view states specified when the ReadCondition was created.

Returns
an unmodifiable set.

Implemented in org.opensplice.dds.sub.ReadConditionImpl< TYPE >.

◆ setQueryParameters() [1/2]

void org.omg.dds.sub.QueryCondition< TYPE >.setQueryParameters ( List< String >  queryParameters)

This operation changes the queryParameters associated with the QueryCondition.

Parameters
queryParametersa container, into which this method will place its result.
Exceptions
org.omg.dds.core.DDSExceptionAn internal error has occurred.
org.omg.dds.core.OutOfResourcesExceptionThe Data Distribution Service ran out of resources to complete this operation.
See also
getQueryParameters()

Implemented in org.opensplice.dds.sub.QueryConditionImpl< TYPE >.

◆ setQueryParameters() [2/2]

void org.omg.dds.sub.QueryCondition< TYPE >.setQueryParameters ( String...  queryParameters)

This operation changes the queryParameters associated with the QueryCondition.

Parameters
queryParametersa container, into which this method will place its result.
Exceptions
org.omg.dds.core.DDSExceptionAn internal error has occurred.
org.omg.dds.core.OutOfResourcesExceptionThe Data Distribution Service ran out of resources to complete this operation.
See also
getQueryParameters()

Implemented in org.opensplice.dds.sub.QueryConditionImpl< TYPE >.


The documentation for this interface was generated from the following file: