Package org.omg.dds

Examples of org.omg.dds.Subscriber


     */
    public void Lookup_Sub_interesded_of_topic(String topic_name){
       
        org.omg.dds.DomainParticipant  domain_temp ;
        DomainParticipantImpl domain_impl ;
        Subscriber sub_temp ;
        SubscriberImpl sub_impl ;
        Iterator _it_DomainParticipant = references_domaines_participant.iterator();
        Iterator _it_Subscriber ;
       
        while(_it_DomainParticipant.hasNext()){
           
            try{
                domain_temp = (DomainParticipant)_it_DomainParticipant.next();
                domain_impl =(DomainParticipantImpl) poa.reference_to_servant(domain_temp);
                _it_Subscriber = domain_impl.getVector_Subscriber().iterator() ;
               
                while(_it_Subscriber.hasNext()){                   
                    sub_temp =  (Subscriber) _it_Subscriber.next();
                    if(sub_temp.lookup_datareader(topic_name) != null){                       
                        all_Sub.add(sub_temp);                   
                    }                   
                }
            }
            catch(Exception e){
View Full Code Here


    {
       
        Object instance = null  ;
        boolean is_topic= false ;
        boolean is_instance = false ;
        Subscriber sub_temp ;
        SubscriberImpl sub_impl_temp ;
        DataReader DR ;
        Class typehelper = null ;
        Class  type_param_extract [] = new Class [1 ];
        java.lang.Object valu_param_extract[] = new java.lang.Object[1];
        Iterator It ;
       
        if(data.type().equal(TopicHelper.type()))
        {                       
            is_topic = true ;
            topic = TopicHelper.extract(data) ;          
        }
        else
        {           
            is_instance = true ;
            valu_param_extract[0] = data ;
            type_param_extract[0] = Any.class ;
           
            try{
                typehelper  = Class.forName(topic.get_type_name()+"Helper") ;
                Method extract = typehelper.getMethod("extract",type_param_extract);
                instance = extract.invoke(null ,valu_param_extract);
            }
            catch(Exception e)
            {
                e.printStackTrace();
            }         
        }
       
        if(is_topic){           
            Lookup_Sub_interesded_of_topic(topic.get_name());          
        }
        else if( is_instance)
        {          
            try{               
                It = all_Sub.iterator() ;
                while(It.hasNext()){
                    sub_temp = (Subscriber)It.next() ;
                    sub_impl_temp = (SubscriberImpl)poa.reference_to_servant(sub_temp);
                    sub_impl_temp.setInstance(instance);                   
                    DR = sub_temp.lookup_datareader(topic.get_name());                   
                    DR.take_instance_from_subscriber() ;
                   
                    if(DR.get_listener()!= null ){                       
                        DR.get_listener().on_data_available(DR);                       
                    }                                                          
View Full Code Here

     * @return
     */
    public int delete_topic(Topic a_topic) {

        Iterator It = Vector_Subscriber.iterator() ;
        Subscriber temp ;
        while(It.hasNext()){
            temp = (Subscriber)It.next() ;
            if (temp.lookup_datareader(a_topic.get_name())!= null){

                return RETCODE_PRECONDITION_NOT_MET.value ;
            }
        }
        It = Vector_Publisher.iterator() ;
View Full Code Here

            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 ;
            org.omg.dds.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 org.omg.dds.LatencyBudgetQosPolicy(new Duration_t(0,0)),new org.omg.dds.LivelinessQosPolicy (LivelinessQosPolicyKind.from_int(0),new Duration_t(0,0)),new org.omg.dds.ReliabilityQosPolicy(ReliabilityQosPolicyKind.from_int(0),new Duration_t(0,0)),new org.omg.dds.DestinationOrderQosPolicy(DestinationOrderQosPolicyKind.from_int(0)),new org.omg.dds.HistoryQosPolicy(org.omg.dds.HistoryQosPolicyKind.from_int(0),0),new org.omg.dds.ResourceLimitsQosPolicy(0,0,0),new org.omg.dds.TransportPriorityQosPolicy(0),new org.omg.dds.LifespanQosPolicy (new Duration_t(0,0)),new org.omg.dds.OwnershipQosPolicy(org.omg.dds.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 org.omg.dds.LatencyBudgetQosPolicy(new Duration_t(0,0)),new org.omg.dds.LivelinessQosPolicy (LivelinessQosPolicyKind.from_int(0),new Duration_t(0,0)),new org.omg.dds.ReliabilityQosPolicy(ReliabilityQosPolicyKind.from_int(0),new Duration_t(0,0)),new org.omg.dds.DestinationOrderQosPolicy(DestinationOrderQosPolicyKind.from_int(0)),new org.omg.dds.HistoryQosPolicy(org.omg.dds.HistoryQosPolicyKind.from_int(0),0),new org.omg.dds.ResourceLimitsQosPolicy(0,0,0),new org.omg.dds.UserDataQosPolicy(tab) , new org.omg.dds.TimeBasedFilterQosPolicy(new Duration_t(0,0) ) , new org.omg.dds.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())) ;
            foodatareader.set_listener(listener,0)
            orb.run();             
        }
View Full Code Here

            org.omg.dds.Topic topic;
            Publisher publisher;
            DataWriter datawriter;
            PublisherQos publisherqos;
            DataWriterQos datawriterqos;
            Subscriber suscriber;
            DataReader datareader;
            org.omg.dds.Topic topicMessage;
            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;
            org.omg.dds.UserDataQosPolicy UDQP = new UserDataQosPolicy(tab);
            DomainParticipantQos DPQOS = new DomainParticipantQos(UDQP,
                    new EntityFactoryQosPolicy());
            domainpartiFactory = 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 org.omg.dds.LatencyBudgetQosPolicy(new Duration_t(0, 0)),
                    new org.omg.dds.LivelinessQosPolicy(LivelinessQosPolicyKind
                            .from_int(0), new Duration_t(0, 0)),
                    new org.omg.dds.ReliabilityQosPolicy(
                            ReliabilityQosPolicyKind.from_int(0),
                            new Duration_t(0, 0)),
                    new org.omg.dds.DestinationOrderQosPolicy(
                            DestinationOrderQosPolicyKind.from_int(0)),
                    new org.omg.dds.HistoryQosPolicy(
                            org.omg.dds.HistoryQosPolicyKind.from_int(0), 0),
                    new org.omg.dds.ResourceLimitsQosPolicy(0, 0, 0),
                    new org.omg.dds.TransportPriorityQosPolicy(0),
                    new org.omg.dds.LifespanQosPolicy(new Duration_t(0, 0)),
                    new org.omg.dds.OwnershipQosPolicy(
                            org.omg.dds.OwnershipQosPolicyKind.from_int(0)));
            domainparticipant = domainpartiFactory.create_participant(0, DPQOS,
                    null);
            topic = domainparticipant.create_topic("tamperature",
                    "demo.dds.dcps.temperaturesample.Temperature",
                    tq, null);
            topicMessage = domainparticipant.create_topic("messsage",
                    "demo.dds.dcps.temperaturesample.Message", tq,
                    null);
            String st[] = new String[1];
            st[0] = "";
            publisherqos = new PublisherQos(
                    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));
            publisher = domainparticipant.create_publisher(publisherqos, null);
            datawriterqos = new DataWriterQos(
                    new DurabilityQosPolicy(
                            DurabilityQosPolicyKind.from_int(0),
                            new Duration_t(0, 0)),
                    new DeadlineQosPolicy(new Duration_t(0, 0)),
                    new org.omg.dds.LatencyBudgetQosPolicy(new Duration_t(0, 0)),
                    new org.omg.dds.LivelinessQosPolicy(LivelinessQosPolicyKind
                            .from_int(0), new Duration_t(0, 0)),
                    new org.omg.dds.ReliabilityQosPolicy(
                            ReliabilityQosPolicyKind.from_int(0),
                            new Duration_t(0, 0)),
                    new org.omg.dds.DestinationOrderQosPolicy(
                            DestinationOrderQosPolicyKind.from_int(0)),
                    new org.omg.dds.HistoryQosPolicy(
                            org.omg.dds.HistoryQosPolicyKind.from_int(0), 0),
                    new org.omg.dds.ResourceLimitsQosPolicy(0, 0, 0),
                    new TransportPriorityQosPolicy(0), new LifespanQosPolicy(
                            new Duration_t(0, 0)),
                    new org.omg.dds.UserDataQosPolicy(tab),
                    new OwnershipStrengthQosPolicy(0),
                    new org.omg.dds.WriterDataLifecycleQosPolicy(true));

            datawriter = publisher
                    .create_datawriter(topic, datawriterqos, null);
            temperatureDW = TemperatureDataWriterHelper.narrow(datawriter);
            // a producer suscribe for topic message
            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 org.omg.dds.LatencyBudgetQosPolicy(new Duration_t(0, 0)),
                    new org.omg.dds.LivelinessQosPolicy(LivelinessQosPolicyKind
                            .from_int(0), new Duration_t(0, 0)),
                    new org.omg.dds.ReliabilityQosPolicy(
                            ReliabilityQosPolicyKind.from_int(0),
                            new Duration_t(0, 0)),
                    new org.omg.dds.DestinationOrderQosPolicy(
                            DestinationOrderQosPolicyKind.from_int(0)),
                    new org.omg.dds.HistoryQosPolicy(
                            org.omg.dds.HistoryQosPolicyKind.from_int(0), 0),
                    new org.omg.dds.ResourceLimitsQosPolicy(0, 0, 0),
                    new org.omg.dds.UserDataQosPolicy(tab),
                    new org.omg.dds.TimeBasedFilterQosPolicy(new Duration_t(0,
                            0)), new org.omg.dds.ReaderDataLifecycleQosPolicy(
                            new Duration_t(0, 0)));
            datareader = suscriber.create_datareader(topicMessage,
                    datareaderqos, null);
            MessageDataReader messagedatareader = MessageDataReaderHelper
                    .narrow(datareader);
            DataReaderListener listener = DataReaderListenerHelper.narrow(poa
                    .servant_to_reference(new MessageDataReaderListenerImpl()));
View Full Code Here

            POA poa = POAHelper.narrow(orb
                    .resolve_initial_references("RootPOA"));
            poa.the_POAManager().activate();
            DomainParticipantFactory domainparticipantFactory;
            DomainParticipant domainparticipant;
            Subscriber suscriber;
            TemperatureDataReader temperdatareader;
            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;
            org.omg.dds.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 org.omg.dds.LatencyBudgetQosPolicy(new Duration_t(0, 0)),
                    new org.omg.dds.LivelinessQosPolicy(LivelinessQosPolicyKind
                            .from_int(0), new Duration_t(0, 0)),
                    new org.omg.dds.ReliabilityQosPolicy(
                            ReliabilityQosPolicyKind.from_int(0),
                            new Duration_t(0, 0)),
                    new org.omg.dds.DestinationOrderQosPolicy(
                            DestinationOrderQosPolicyKind.from_int(0)),
                    new org.omg.dds.HistoryQosPolicy(
                            org.omg.dds.HistoryQosPolicyKind.from_int(0), 0),
                    new org.omg.dds.ResourceLimitsQosPolicy(0, 0, 0),
                    new org.omg.dds.TransportPriorityQosPolicy(0),
                    new org.omg.dds.LifespanQosPolicy(new Duration_t(0, 0)),
                    new org.omg.dds.OwnershipQosPolicy(
                            org.omg.dds.OwnershipQosPolicyKind.from_int(0)));
            domainparticipant = domainparticipantFactory.create_participant(0,
                    DPQOS, null);
            topic = domainparticipant.create_topic("tamperature",
                    "demo.dds.dcps.temperaturesample.Temperature", 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 org.omg.dds.LatencyBudgetQosPolicy(new Duration_t(0, 0)),
                    new org.omg.dds.LivelinessQosPolicy(LivelinessQosPolicyKind
                            .from_int(0), new Duration_t(0, 0)),
                    new org.omg.dds.ReliabilityQosPolicy(
                            ReliabilityQosPolicyKind.from_int(0),
                            new Duration_t(0, 0)),
                    new org.omg.dds.DestinationOrderQosPolicy(
                            DestinationOrderQosPolicyKind.from_int(0)),
                    new org.omg.dds.HistoryQosPolicy(
                            org.omg.dds.HistoryQosPolicyKind.from_int(0), 0),
                    new org.omg.dds.ResourceLimitsQosPolicy(0, 0, 0),
                    new org.omg.dds.UserDataQosPolicy(tab),
                    new org.omg.dds.TimeBasedFilterQosPolicy(new Duration_t(0,
                            0)), new org.omg.dds.ReaderDataLifecycleQosPolicy(
                            new Duration_t(0, 0)));
            datareader = suscriber
                    .create_datareader(topic, datareaderqos, null);
            temperdatareader = TemperatureDataReaderHelper.narrow(datareader);
            DataReaderListener listener = DataReaderListenerHelper
                    .narrow(poa
                            .servant_to_reference(new TemperatureDataReaderListenerImpl(
View Full Code Here

   * @return
   */
  public int delete_topic(Topic a_topic) {
 
    Iterator It = Vector_Subscriber.iterator() ;
    Subscriber temp ;
    while(It.hasNext()){
      temp = (Subscriber)It.next() ;
      if (temp.lookup_datareader(a_topic.get_name())!= null){
     
        return RETCODE_PRECONDITION_NOT_MET.value ;
      }
    }
    It = Vector_Publisher.iterator() ;
View Full Code Here

     */
    public void Lookup_Sub_interesded_of_topic(String topic_name){
       
        org.omg.dds.DomainParticipant  domain_temp ;
        DomainParticipantImpl domain_impl ;
        Subscriber sub_temp ;
        SubscriberImpl sub_impl ;
        Iterator _it_DomainParticipant = references_domaines_participant.iterator();
        Iterator _it_Subscriber ;
       
        while(_it_DomainParticipant.hasNext()){
           
            try{
                domain_temp = (DomainParticipant)_it_DomainParticipant.next();
                domain_impl =(DomainParticipantImpl) poa.reference_to_servant(domain_temp);
                _it_Subscriber = domain_impl.getVector_Subscriber().iterator() ;
               
                while(_it_Subscriber.hasNext()){                   
                    sub_temp =  (Subscriber) _it_Subscriber.next();
                    if(sub_temp.lookup_datareader(topic_name) != null){                       
                        all_Sub.add(sub_temp);                   
                    }                   
                }
            }
            catch(Exception e){
View Full Code Here

    {
       
        Object instance = null  ;
        boolean is_topic= false ;
        boolean is_instance = false ;
        Subscriber sub_temp ;
        SubscriberImpl sub_impl_temp ;
        DataReader DR ;
        Class typehelper = null ;
        Class  type_param_extract [] = new Class [1 ];
        java.lang.Object valu_param_extract[] = new java.lang.Object[1];
        Iterator It ;
       
        if(data.type().equal(TopicHelper.type()))
        {                       
            is_topic = true ;
            topic = TopicHelper.extract(data) ;          
        }
        else
        {           
            is_instance = true ;
            valu_param_extract[0] = data ;
            type_param_extract[0] = Any.class ;
           
            try{
                typehelper  = Class.forName(topic.get_type_name()+"Helper") ;
                Method extract = typehelper.getMethod("extract",type_param_extract);
                instance = extract.invoke(null ,valu_param_extract);
            }
            catch(Exception e)
            {
                e.printStackTrace();
            }         
        }
       
        if(is_topic){           
            Lookup_Sub_interesded_of_topic(topic.get_name());          
        }
        else if( is_instance)
        {          
            try{               
                It = all_Sub.iterator() ;
                while(It.hasNext()){
                    sub_temp = (Subscriber)It.next() ;
                    sub_impl_temp = (SubscriberImpl)poa.reference_to_servant(sub_temp);
                    sub_impl_temp.setInstance(instance);                   
                    DR = sub_temp.lookup_datareader(topic.get_name());                   
                    DR.take_instance_from_subscriber() ;
                   
                    if(DR.get_listener()!= null ){                       
                        DR.get_listener().on_data_available(DR);                       
                    }                                                          
View Full Code Here

     */
    public void Lookup_Sub_interesded_of_topic(String topic_name){
       
        org.omg.dds.DomainParticipant  domain_temp ;
        DomainParticipantImpl domain_impl ;
        Subscriber sub_temp ;
        SubscriberImpl sub_impl ;
        Iterator _it_DomainParticipant = references_domaines_participant.iterator();
        Iterator _it_Subscriber ;
       
        while(_it_DomainParticipant.hasNext()){
           
            try{
                domain_temp = (DomainParticipant)_it_DomainParticipant.next();
                domain_impl =(DomainParticipantImpl) poa.reference_to_servant(domain_temp);
                _it_Subscriber = domain_impl.getVector_Subscriber().iterator() ;
               
                while(_it_Subscriber.hasNext()){                   
                    sub_temp =  (Subscriber) _it_Subscriber.next();
                    if(sub_temp.lookup_datareader(topic_name) != null){                       
                        all_Sub.add(sub_temp);                   
                    }                   
                }
            }
            catch(Exception e){
View Full Code Here

TOP

Related Classes of org.omg.dds.Subscriber

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.