Package org.omg.dds

Examples of org.omg.dds.Subscriber


    {
       
        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  = ObjectUtil.classForName(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 ;
            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) {
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.