Package net.jini.core.lookup

Examples of net.jini.core.lookup.ServiceRegistrar.lookup()


        Name sn = new Name(spaceName);
        ServiceTemplate tmpl = new ServiceTemplate(null/* serviceID */, classes, new Entry[] {sn});

        LookupLocator locator = new LookupLocator(url); // <protocol>://<hostname>
        ServiceRegistrar sr = locator.getRegistrar();
        JavaSpace space = (JavaSpace) sr.lookup(tmpl);

        return space;
    }
}
View Full Code Here


        // Creating a lookup locator
        LookupLocator locator = new LookupLocator(uri);
        ServiceRegistrar sr = locator.getRegistrar();

        TransactionManager tm = (TransactionManager) sr.lookup(tmpl);
        return tm;
    }

}
View Full Code Here

                String registrarInfo = "Registrar: " + registrar.getServiceID();
                System.out.println();
                System.out.println(registrarInfo);
                LOG.debug(registrarInfo);
                ServiceTemplate template = new ServiceTemplate(null, null, null);
                ServiceMatches matches = registrar.lookup(template, Integer.MAX_VALUE);
                ServiceItem[] items = matches.items;
                for (int i = 0; i < items.length; i++) {
                    String serviceInfo = "  Service: " + items[i].service;
                    System.out.println(serviceInfo);
                    LOG.debug(serviceInfo);
View Full Code Here

              aeAttributes[0] = new Name("Neon Light");
              aeAttributes[1] = new ServiceInfo("Name", "Manufactor", "vendor","version","model","serial");
             
              template = new ServiceTemplate (null, null, aeAttributes);

              myRoomLight = (RoomLight) registrar.lookup (template);

              System.out.println (" ist das Licht an? ->" + myRoomLight.isOn() + "<-");
          } catch (Exception e) {
              System.out.println ("client: MyClient.main() exception: " + e);
          }
View Full Code Here

                logger.finest("ServiceDiscoveryManager - LookupTask started");
    ServiceRegistrar proxy = reg.proxy;
    ServiceMatches matches;
                /* For the given lookup, get all services matching the tmpl */
    try {
        matches = proxy.lookup(tmpl, Integer.MAX_VALUE);
    } catch (Exception e) {
                    boolean cacheTerminated;
                    synchronized(serviceIdMap) {
                        cacheTerminated = bCacheTerminated;
                    }//end sync
View Full Code Here

  for(int i=0; i<len; i++) {
      ServiceRegistrar proxy = proxys[(i + rand) % len];
      ServiceItem sItem = null;
      try {
                int maxMatches = ( (filter != null) ? Integer.MAX_VALUE : 1 );
    ServiceMatches sm = proxy.lookup(tmpl, maxMatches);
    sItem = getMatchedServiceItem(sm, filter);
      } catch(Exception e) {
                logger.log(Level.INFO,
                           "Exception occurred during query, discarding proxy",
                           e);
View Full Code Here

                     * requested by passing in "infinity" for the maximum
                     * number of matches (Integer.MAX_VALUE).
                     */
                    if(filter != null) max = Integer.MAX_VALUE;
                    /* Query the current lookup for matching service(s). */
        ServiceMatches sm = proxy.lookup(tmpl, max);
        int nItems = sm.items.length;
        if(nItems == 0) continue;//no matches, query next lookup
                    /* Loop thru the matching services, randomly selecting
                     * each service, applying the filter if appropriate,
                     * and making sure the service has not already been
View Full Code Here

      }
      if (event != null) {
    ServiceRegistrar[] registrars = event.getRegistrars();
    for (int i = registrars.length; --i >= 0; ) {
        ServiceRegistrar registrar = registrars[i];
        serviceRef = registrar.lookup(template);
        if (serviceRef != null) {
      manager.terminate();
      return;             
        }
    }
View Full Code Here

      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 {
View Full Code Here

  for(int i=0; i<len; i++) {
      ServiceRegistrar proxy = proxys[(i + rand) % len];
      ServiceItem sItem = null;
      try {
                int maxMatches = ( (filter != null) ? Integer.MAX_VALUE : 1 );
    ServiceMatches sm = proxy.lookup(tmpl, maxMatches);
    sItem = getMatchedServiceItem(sm, filter);
      } catch(Exception e) {
                logger.log(Level.INFO,
                           "Exception occurred during query, discarding proxy",
                           e);
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.