Package net.jini.core.lookup

Examples of net.jini.core.lookup.ServiceTemplate


            System.setSecurityManager(new RMISecurityManager());
        }

        Class<?>[] classes = new Class<?>[] {net.jini.space.JavaSpace.class};
        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);

View Full Code Here


        }

        // Creating service template to find transaction manager service by matching fields.
        Class<?>[] classes = new Class<?>[] {net.jini.core.transaction.server.TransactionManager.class};
        // Name sn = new Name("*");
        ServiceTemplate tmpl = new ServiceTemplate(null, classes, new Entry[] {});

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

View Full Code Here

            throw new RuntimeException(message, e);
        }

        // create cache of desired _service providers
        final Class[] classes = new Class[] {klass};
        serviceTemplate = new ServiceTemplate(null, classes, entries);
        try {
            lookupCache = getClientManager().createLookupCache(
                    getServiceTemplate(), null, new ServiceDiscListener(this));
        } catch (RemoteException e) {
            final String message = "Error creating _service cache";
View Full Code Here

                ServiceRegistrar registrar = registrars[x];
                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);
View Full Code Here

            if (retryCount > 0) {
                LOG.info("\tFind agent unit test retry " + retryCount + "...");
                Thread.sleep(1000); // wait a bit before retrying
            }

            result = reg.lookup(new ServiceTemplate(null,
                new Class[]{BuildAgentService.class},
                entries));

            isFound = (result != null);
View Full Code Here

public class RoomLightTest {
     public static void main (String[] args) {
          Entry[] aeAttributes;
          LookupLocator lookup;
          ServiceRegistrar registrar;
          ServiceTemplate template;
          RoomLight myRoomLight;

          try {
  /*          Set the security manager to allow the RMI class loader to access
              the codebase for classes that are not available locally */

              System.setSecurityManager (new RMISecurityManager ());

  /*          Find the Jini lookup service (reggie) and print its location */

              lookup = new LookupLocator ("jini://localhost");

  /*          Get the lookup service's ServiceRegistrar and perform a search to find
              the service that has the name attribute name of "HelloWorldServer".
              The lookup service returns an Proxy object to the service */

              registrar  = lookup.getRegistrar();
              aeAttributes = new Entry[2];

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

      refreshPanel();
    }

    protected Entry[] getEntryArray() {
      try{
  ServiceMatches matches = registrar.lookup(new ServiceTemplate(item.serviceID,
                      new Class[] { item.service.getClass() },
                      new Entry[] {}),
              10);
  if(matches.totalMatches != 1)
    Browser.logger.log(Level.INFO, "unexpected lookup matches: {0}",
View Full Code Here

    attrPanel = new AttributeTreePanel();

    // setup notify
    if(admin instanceof JoinAdmin) {
      try {
  stmpl = new ServiceTemplate(item.serviceID,
            new Class[] { item.service.getClass() },
            new Entry[] {});
  receiver = new NotifyReceiver();

  setupNotify();
View Full Code Here

           ServiceItemFilter filter,
           ServiceDiscoveryListener listener,
           long leaseDuration)
                                                       throws RemoteException
    {
  if(tmpl == null) tmpl = new ServiceTemplate(null, null, null);
  LookupCacheImpl cache = new LookupCacheImpl(tmpl, filter,
                                                    listener, leaseDuration);
  synchronized(caches) {
      caches.add(cache);
  }
View Full Code Here

      int len =  tmpl.attributeSetTemplates.length;
      attributeSetTemplates = new Entry[len];
      System.arraycopy(tmpl.attributeSetTemplates, 0,
                             attributeSetTemplates, 0, len);
  }
  return new ServiceTemplate(tmpl.serviceID,
                                   serviceTypes,
                                   attributeSetTemplates);
    }//end copyServiceTemplate
View Full Code Here

TOP

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

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.