![]() |
OpenSplice Java 5 DCPS
v6.x
OpenSplice Java 5 OpenSplice Data Distribution Service Data-Centric Publish-Subscribe API
|
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...
Public Member Functions | |
void | close () |
Reclaim any resources associated with this condition. More... | |
ServiceEnvironment | getEnvironment () |
Set< InstanceState > | getInstanceStates () |
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< SampleState > | getSampleStates () |
This operation returns the set of sample states that are taken into account to determine the triggerValue of the ReadCondition. More... | |
boolean | getTriggerValue () |
Set< ViewState > | getViewStates () |
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... | |
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 > %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) {}
<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.
|
inherited |
Reclaim any resources associated with this condition.
Implemented in org.opensplice.dds.sub.ReadConditionImpl< TYPE >.
|
inherited |
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.
|
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.
Implemented in org.opensplice.dds.sub.ReadConditionImpl< TYPE >.
|
inherited |
Implemented in org.opensplice.dds.sub.ReadConditionImpl< TYPE >.
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.
Implemented in org.opensplice.dds.sub.QueryConditionImpl< TYPE >.
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.
Implemented in org.opensplice.dds.sub.QueryConditionImpl< TYPE >.
|
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.
Implemented in org.opensplice.dds.sub.ReadConditionImpl< TYPE >.
|
inherited |
Implemented in org.opensplice.dds.sub.ReadConditionImpl< TYPE >, org.opensplice.dds.core.StatusConditionImpl< T extends Entity<?, ?>, and org.opensplice.dds.core.GuardConditionImpl.
|
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.
Implemented in org.opensplice.dds.sub.ReadConditionImpl< TYPE >.
void org.omg.dds.sub.QueryCondition< TYPE >.setQueryParameters | ( | List< String > | queryParameters | ) |
This operation changes the queryParameters associated with the QueryCondition.
queryParameters | a container, into which this method will place its result. |
org.omg.dds.core.DDSException | An internal error has occurred. |
org.omg.dds.core.OutOfResourcesException | The Data Distribution Service ran out of resources to complete this operation. |
Implemented in org.opensplice.dds.sub.QueryConditionImpl< TYPE >.
void org.omg.dds.sub.QueryCondition< TYPE >.setQueryParameters | ( | String... | queryParameters | ) |
This operation changes the queryParameters associated with the QueryCondition.
queryParameters | a container, into which this method will place its result. |
org.omg.dds.core.DDSException | An internal error has occurred. |
org.omg.dds.core.OutOfResourcesException | The Data Distribution Service ran out of resources to complete this operation. |
Implemented in org.opensplice.dds.sub.QueryConditionImpl< TYPE >.