ORB orb = ORB.init(args,null);
POA poa = POAHelper.narrow(orb.resolve_initial_references("RootPOA"));
poa.the_POAManager().activate();
DomainParticipantFactory domainparticipantFactory ;
DomainParticipant domainparticipant ;
Subscriber suscriber ;
FooDataReader foodatareader ;
DataReader datareader ;
org.omg.dds.Topic topic ;
SubscriberQos suscriberqos ;
DataReaderQos datareaderqos ;
org.omg.CORBA.Object objRef = orb.resolve_initial_references("NameService");
// Use NamingContextExt which is part of the Interoperable
// Naming Service (INS) specification.
NamingContextExt ncRef = NamingContextExtHelper.narrow(objRef);
// resolve the Object Reference in Naming
String rname = "DomainParticipantFactory";
byte tab[ ] = new byte [1];
tab[0] = 1 ;
UserDataQosPolicy UDQP = new UserDataQosPolicy(tab);
DomainParticipantQos DPQOS =
new DomainParticipantQos(UDQP,new EntityFactoryQosPolicy()) ;
domainparticipantFactory = DomainParticipantFactoryHelper.narrow(ncRef.resolve_str(rname));
TopicQos tq = new TopicQos(
new TopicDataQosPolicy(tab),
new DurabilityQosPolicy(
DurabilityQosPolicyKind.from_int(0),
new Duration_t(0,0)),
new DeadlineQosPolicy(new Duration_t(0,0)),
new LatencyBudgetQosPolicy(new Duration_t(0,0)),
new LivelinessQosPolicy(
LivelinessQosPolicyKind.from_int(0),
new Duration_t(0,0)),
new ReliabilityQosPolicy(
ReliabilityQosPolicyKind.from_int(0),
new Duration_t(0,0)),
new DestinationOrderQosPolicy(
DestinationOrderQosPolicyKind.from_int(0)),
new HistoryQosPolicy(
HistoryQosPolicyKind.from_int(0),0),
new ResourceLimitsQosPolicy(0,0,0),
new TransportPriorityQosPolicy(0),
new LifespanQosPolicy (new Duration_t(0,0)),
new OwnershipQosPolicy(
OwnershipQosPolicyKind.from_int(0)));
domainparticipant =
domainparticipantFactory.create_participant(0,DPQOS,null);
topic =
domainparticipant.create_topic("foo",
"demo.dds.dcps.foosample.Foo",
tq ,null);
String st [] = new String [1];
st[0] = "" ;
suscriberqos = new SubscriberQos(
new org.omg.dds.PresentationQosPolicy(
org.omg.dds.PresentationQosPolicyAccessScopeKind.from_int(0),
false ,false ),
new PartitionQosPolicy(st),
new GroupDataQosPolicy(tab),
new org.omg.dds.EntityFactoryQosPolicy(false));
suscriber = domainparticipant.create_subscriber(suscriberqos,null);
datareaderqos = new DataReaderQos(
new DurabilityQosPolicy(
DurabilityQosPolicyKind.from_int(0),
new Duration_t(0,0)),
new DeadlineQosPolicy(new Duration_t(0,0)),
new LatencyBudgetQosPolicy(new Duration_t(0,0)),
new LivelinessQosPolicy (
LivelinessQosPolicyKind.from_int(0),
new Duration_t(0,0)),
new ReliabilityQosPolicy(
ReliabilityQosPolicyKind.from_int(0),
new Duration_t(0,0)),
new DestinationOrderQosPolicy(
DestinationOrderQosPolicyKind.from_int(0)),
new HistoryQosPolicy(
HistoryQosPolicyKind.from_int(0),0),
new ResourceLimitsQosPolicy(0,0,0),
new UserDataQosPolicy(tab) ,
new TimeBasedFilterQosPolicy(new Duration_t(0,0)),
new ReaderDataLifecycleQosPolicy(new Duration_t(0,0)));
datareader = suscriber. create_datareader(topic,datareaderqos,null);
foodatareader = FooDataReaderHelper.narrow(datareader);
DataReaderListener listener =
DataReaderListenerHelper.narrow(poa.servant_to_reference(new FooDataReaderListenerImpl())) ;
if (foodatareader == null) {