Package net.jini.core.lookup

Examples of net.jini.core.lookup.ServiceEvent


                                         int nExpectedEvnts,
                                         int expectedTransition,
                                         ServiceRegistration[] serviceRegs)
                                                         throws Exception
    {
        ServiceEvent evnt = null;
        if (eventVector.size() != nExpectedEvnts) {
            throw new TestException("# of Events Received ("+
                                             eventVector.size()+
                                             ") != # of Events Expected ("+
                                             nExpectedEvnts+")");
  } else {
            ServiceID evntSrvcID;
            ServiceID expdSrvcID;
            ServiceID handbackSrvcID;
      for(int i=0; i<eventVector.size(); i++) {
                evnt = (ServiceEvent)eventVector.elementAt(i);
                if (evnt == null) {
                    throw new TestException
                             ("null Event returned from Vector at element "+i);
       } else {
                    if (evnt.getTransition() != expectedTransition) {
      dumpEventIDs(eventVector, serviceRegs);
                        throw new TestException("Unexpected Transition returned ("+
            evnt.getTransition()+")");
        } else {
                        evntSrvcID = evnt.getServiceID();
                        expdSrvcID = serviceRegs[i].getServiceID();
                        if ( !(evntSrvcID.equals(expdSrvcID)) ) {
                            throw new TestException("Service ID Received ("+
                evntSrvcID+
                ") != Service ID Expected ("+
                expdSrvcID+")");
      } else {
          handbackSrvcID =
        (ServiceID)(evnt.getRegistrationObject().get());

          if ( !(handbackSrvcID.equals(expdSrvcID)) ) {
        throw new TestException
            ("Handback Service ID ("+
             handbackSrvcID+
View Full Code Here


    }

    public static void dumpEventIDs(Vector eventVector,
                                    ServiceRegistration[] serviceRegs)
    {
        ServiceEvent evnt = null;
  ServiceID evntSrvcID;
  ServiceID expdSrvcID;
  ServiceID handbackSrvcID;
  for(int i=0; i<eventVector.size(); i++) {
      evnt = (ServiceEvent)eventVector.elementAt(i);
      evntSrvcID = evnt.getServiceID();
      expdSrvcID = serviceRegs[i].getServiceID();
      System.out.println("Expected ID = " + expdSrvcID + ", received ID = " + evntSrvcID);
  }
    }
View Full Code Here

  throws Exception
    {
  ServiceTemplate tmpl = new ServiceTemplate(null, null, null);
    outer:
  for (int i = 0; i < eventVector.size(); i++) {
      ServiceEvent evnt = (ServiceEvent)eventVector.elementAt(i);
      for (int j = i + 1; j < eventVector.size(); j++) {
    ServiceEvent oevnt = (ServiceEvent)eventVector.elementAt(j);
    if (evnt.getServiceID().equals(oevnt.getServiceID()))
        continue outer;
      }
      ServiceItem item = evnt.getServiceItem();
      tmpl.serviceID = evnt.getServiceID();
      ServiceRegistrar proxy = (ServiceRegistrar)evnt.getSource();
View Full Code Here

            super();
        }

        /** Method called remotely by lookup to handle the generated event. */
        public synchronized void notify(RemoteEvent ev) {
            ServiceEvent srvcEvnt = (ServiceEvent)ev;
            evntVec.addElement(srvcEvnt);
        }
View Full Code Here

            super();
        }

        /** Method called remotely by lookup to handle the generated event. */
        public void notify(RemoteEvent ev) {
            ServiceEvent srvcEvnt = (ServiceEvent)ev;
            evntVec.addElement(srvcEvnt);
        }
View Full Code Here

        public Listener() throws RemoteException {
            super();
        }
        /** Method called remotely by lookup to handle the generated event. */
        public void notify(RemoteEvent ev) {
            ServiceEvent srvcEvnt = (ServiceEvent)ev;
            evntVec.addElement(srvcEvnt);
            try {
                QATestUtils.SrvcAttrTuple tuple = (QATestUtils.SrvcAttrTuple)
                                      (srvcEvnt.getRegistrationObject().get());

                receivedTuples.addElement(new QATestUtils.SrvcAttrTuple
                                                   (srvcItems,addAttrs,
                                                    tuple.getSrvcObj(),
                                                    tuple.getAttrObj(),
                                                    srvcEvnt.getTransition()));
            } catch (ClassNotFoundException e) {
                logger.log(Level.INFO, "Unexpected exception", e);
            } catch (IOException e) {
                logger.log(Level.INFO, "Unexpected exception", e);
            }
View Full Code Here

        public Listener() throws RemoteException {
            super();
        }
        /** Method called remotely by lookup to handle the generated event. */
        public void notify(RemoteEvent ev) {
            ServiceEvent srvcEvnt = (ServiceEvent)ev;
            evntVec.addElement(srvcEvnt);
            try {
                QATestUtils.SrvcAttrTuple tuple = (QATestUtils.SrvcAttrTuple)
                                      (srvcEvnt.getRegistrationObject().get());

                receivedTuples.addElement(new QATestUtils.SrvcAttrTuple
                                                   (srvcItems,tmplAttrs,
                                                    tuple.getSrvcObj(),
                                                    tuple.getAttrObj(),
                                                    srvcEvnt.getTransition()));
            } catch (ClassNotFoundException e) {
                logger.log(Level.INFO, "Unexpected exception", e);
            } catch (IOException e) {
                logger.log(Level.INFO, "Unexpected exception", e);
            }
View Full Code Here

        public Listener() throws RemoteException {
            super();
        }
        /** Method called remotely by lookup to handle the generated event. */
        public void notify(RemoteEvent ev) {
            ServiceEvent srvcEvnt = (ServiceEvent)ev;
            evntVec.addElement(srvcEvnt);
            try {
                QATestUtils.SrvcAttrTuple tuple = (QATestUtils.SrvcAttrTuple)
                                      (srvcEvnt.getRegistrationObject().get());

                receivedTuples.addElement(new QATestUtils.SrvcAttrTuple
                                                   (srvcItems,tmplAttrs,
                                                    tuple.getSrvcObj(),
                                                    tuple.getAttrObj(),
                                                    srvcEvnt.getTransition()));
            } catch (ClassNotFoundException e) {
                logger.log(Level.INFO, "Unexpected exception", e);
            } catch (IOException e) {
                logger.log(Level.INFO, "Unexpected exception", e);
            }
View Full Code Here

        public Listener() throws RemoteException {
            super();
        }
        /** Method called remotely by lookup to handle the generated event. */
        public void notify(RemoteEvent ev) {
            ServiceEvent srvcEvnt = (ServiceEvent)ev;
            evntVec.addElement(srvcEvnt);
            try {
                QATestUtils.SrvcAttrTuple tuple = (QATestUtils.SrvcAttrTuple)
                                      (srvcEvnt.getRegistrationObject().get());

                receivedTuples.addElement(new QATestUtils.SrvcAttrTuple
                                                   (srvcItems,tmplAttrs,
                                                    tuple.getSrvcObj(),
                                                    tuple.getAttrObj(),
                                                    srvcEvnt.getTransition()));
            } catch (Throwable e) {
                logger.log(Level.INFO, "Unexpected exception", e);
            }
        }
View Full Code Here

                lookupListenerProxy =
                     (RemoteEventListener)lookupListenerExporter.export(this);
            }//end constructor

      public void notify(RemoteEvent evt) {
    ServiceEvent theEvent = (ServiceEvent)evt;
    notifyServiceMap( theEvent.getSource(),
          theEvent.getID(),
          theEvent.getSequenceNumber(),
          theEvent.getServiceID(),
          theEvent.getServiceItem(),
          theEvent.getTransition() );
      }//end notify
View Full Code Here

TOP

Related Classes of net.jini.core.lookup.ServiceEvent

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.