Package net.jini.core.lookup

Examples of net.jini.core.lookup.ServiceItem


   *
   *
   */
  public void serviceChanged(ServiceDiscoveryEvent e)
  {
    ServiceItem si = e.getPreEventServiceItem();
    ServiceListModel model = (ServiceListModel)queueList.getModel();
    model.update(si, e.getPostEventServiceItem());
  }
View Full Code Here


  private QueueInterface getQueueService(int index)
    throws IOException
  {
    final ServiceID id =
      ((ServiceListModel)queueList.getModel()).getServiceID(index);
    ServiceItem si = lookupCache.lookup(new ServiceItemFilter() {

      public boolean check(ServiceItem item) {
        if(item.serviceID.equals(id))
          return true;
        return false;
View Full Code Here

      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();
      proxy = (ServiceRegistrar)
        QAConfig.getConfig().prepare("test.reggiePreparer",
                  proxy);
      ServiceMatches matches;
      matches = proxy.lookup(tmpl, 1);
      if (item == null) {
    if (matches.items.length != 0)
        throw new TestException(
            "verifyEventItems: event item is null, lookup returns non-null");
      } else {
    if (matches.items.length == 0)
        throw new TestException(
            "verifyEventItems: event item is non-null, lookup returns null");
    ServiceItem litem = matches.items[0];
    if (!item.service.equals(litem.service))
        throw new TestException(
            "verifyEventItems: event item service does not equal lookup value");
    if (!attrsEqual(item.attributeSets, litem.attributeSets))
         throw new TestException(
View Full Code Here

             * lookup service(s) for the one registered service that both
             * matches the template and satisfies the filter
             */
            logger.log(Level.FINE, "  performing lookup -- "
                      +"srvcItem = srvcDiscoveryMgr.lookup(template,filter)");
            ServiceItem srvcItem = srvcDiscoveryMgr.lookup(template,
                                                           firstStageFilter);

            if(expectedService == null) {
                if(srvcItem != null) {
                    throw new TestException(" -- filter failed -- unexpected "
View Full Code Here

     */
    protected void applyTestDef() throws Exception {
        /* Through the service discovery manager, query the discovered lookup
         * service(s) for the desired services
         */
        ServiceItem srvcItem = srvcDiscoveryMgr.lookup(template,
                                                       firstStageFilter);
        if(srvcItem == null) {
            throw new TestException(" -- service returned is null");
        } else if(srvcItem.service == null) {
            throw new TestException(" -- service component of "
View Full Code Here

            logger.log(Level.FINE, "looking up non-existant "
                             +"service -- blocking "+waitDurSecs+" second(s)");
        }//endif(nSrvcs>0)
        /* Try to lookup the service, block until the service appears */
            long startTime = System.currentTimeMillis();
            ServiceItem srvcItem = srvcDiscoveryMgr.lookup(template,
                                                           firstStageFilter,
                                                           waitDur);
            long endTime = System.currentTimeMillis();
            long actualBlockTime = endTime-startTime;
            long waitError = (actualBlockTime-waitDur)/1000;
View Full Code Here

        /* Through the service discovery manager, query the discovered lookup
         * service(s) for the desired registered service(s), and verify
         * that the desired service is returned immediately (does not block).
         */
  long startTime = System.currentTimeMillis();
  ServiceItem srvcItem = srvcDiscoveryMgr.lookup(template,
                   firstStageFilter,
                   waitDur);
  long endTime = System.currentTimeMillis();
  long actualBlockTime = endTime-startTime;
  long waitError = (actualBlockTime-waitDur)/1000;
View Full Code Here

                    throw new RuntimeException(e.toString());
                }
                logger.log(Level.FINE, "registering test service "
                                              +i+" with lookup service "+loc);
                ServiceRegistration srvcReg =
                 lookupProxy.register(new ServiceItem(srvcID,testService,null),
                                      Long.MAX_VALUE);
    Lease srvcLease = null;
    try {
        srvcReg = (ServiceRegistration) getConfig().prepare(
           "test.reggieServiceRegistrationPreparer",
View Full Code Here

        public SrvcListener(QAConfig util, String classname) {
            this.util = util;
            this.classname = classname;
        }//end constructor
  public void serviceAdded(ServiceDiscoveryEvent event) {
            ServiceItem srvcItem = event.getPostEventServiceItem();
            ServiceID srvcID = srvcItem.serviceID;
            logger.log(Level.FINE, ""+nAdded+" -- serviceAdded()-"
                              +srvcItem.service+"-"+srvcID);
            synchronized(lock) {
                nAdded++;
View Full Code Here

            synchronized(lock) {
                nAdded++;
            }
  }//end serviceAdded
  public void serviceRemoved(ServiceDiscoveryEvent event) {
            ServiceItem srvcItem = event.getPreEventServiceItem();
            ServiceID srvcID = srvcItem.serviceID;
            logger.log(Level.FINE, ""+nRemoved+" -- serviceRemoved()-"
                              +srvcItem.service+"-"+srvcID);
            synchronized(lock) {
                nRemoved++;
View Full Code Here

TOP

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

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.