Package net.jini.lookup.entry

Examples of net.jini.lookup.entry.Name


/*      Create the attributes (an array of entry objects) that describe this
        server and use it to register this server with the lookup service.
        JoinManager finds and registers with the lookup service */

        Entry[] attr = new Entry[2];
        attr[0] = new Name("Neon Light");
        attr[1] = new ServiceInfo("Name", "Manufactor", "vendor","version","model","serial");
        myServer = new RoomLightNeon ();
        serviceItem = new ServiceItem(null, myServer, attr);

        lookup = new LookupLocator ("jini://localhost");
View Full Code Here


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

      if (item.attributeSets[i] instanceof ServiceInfo) {
    ServiceInfo info = (ServiceInfo) item.attributeSets[i];
    System.out.println("    ServiceInfo = " + info.name);
      }
      else if (item.attributeSets[i] instanceof Name) {
    Name name = (Name) item.attributeSets[i];
    System.out.println("    Name = " + name.name);
      }
      else if (item.attributeSets[i] instanceof SearchEngineEntry) {
    System.out.println("    SearchEngineEntry");
    SearchEngineEntry sc =
View Full Code Here

    private void startService() {
  Vector entries = new Vector();
  entries.addElement(new ServiceInfo(PRODUCT, MANUFACTURER,
             VENDOR, VERSION, null, null));
  entries.addElement(new BasicServiceType("XmlSearchService"));
  entries.addElement(new Name(_name));
  Enumeration servers = _servers.elements();
  while (servers.hasMoreElements()) {
      XmlSearchServer server = (XmlSearchServer)servers.nextElement();
      entries.addElement(new SearchEngineEntry(server));
  }
View Full Code Here

      if (item.attributeSets[i] instanceof ServiceInfo) {
  ServiceInfo info = (ServiceInfo) item.attributeSets[i];
  System.out.println("    ServiceInfo = " + info.name);
      }
      else if (item.attributeSets[i] instanceof Name) {
  Name name = (Name) item.attributeSets[i];
  System.out.println("    Name = " + name.name);
      }
    }
  }
View Full Code Here

  addLease(er.getLease(), false);


  logger.log(Level.INFO, "Generating some events");
  for (i = 0; i < NUM_EVENTS; i++) {
      addLease(space.write(new Name("Duh"), null, DURATION), false);
  }

  //Note: JavaSpaces is allowed to compact event notifications.
  // That is, if more than one event is scheduled to be delivered
  // for the same notification target, then the one with the latest
  // sequence number can be sent (alone). Therefore, for
  // NUM_EVENTS > 1, you'll need to add some sort of delay factor
  // in order to prevent multiple notifications from beng queue'd
  // up together on the space side of the house.
  int eventCount = NUM_EVENTS;
  logger.log(Level.INFO, "Getting events");
  getCollectedRemoteEvents(tpl, mr, eventCount, MAX_WAIT);
  logger.log(Level.INFO, "Verifying event delivery");
  assertCount(tpl, eventCount);

  logger.log(Level.INFO, "Generating some more events");
  for (i = 0; i < NUM_EVENTS; i++) {
      addLease(space.write(new Name("Yah"), null, DURATION), false);
  }

  eventCount += NUM_EVENTS;
  logger.log(Level.INFO, "Waiting for event delivery");
  getCollectedRemoteEvents(tpl, mr, eventCount, MAX_WAIT);
  logger.log(Level.INFO, "Verifying event delivery");
  assertCount(tpl, eventCount);

  shutdown(0); // Mailbox is at index 0;

  logger.log(Level.INFO, "Generating some more events");
  for (i = 0; i < NUM_EVENTS; i++) {
      addLease(space.write(new Name("Yah"), null, DURATION), false);
  }

  eventCount += NUM_EVENTS;
  logger.log(Level.INFO, "Waiting for event delivery");
  getCollectedRemoteEvents(tpl, mr, eventCount, MAX_WAIT);
View Full Code Here

  addLease(er.getLease(), false);


  logger.log(Level.INFO, "Generating some events");
  for (i = 0; i < NUM_EVENTS; i++) {
      addLease(space.write(new Name("Duh"), null, DURATION), false);
  }

  //Note: JavaSpaces is allowed to compact event notifications.
  // That is, if more than one event is scheduled to be delivered
  // for the same notification target, then the one with the latest
  // sequence number can be sent (alone). Therefore, for
  // NUM_EVENTS > 1, you'll need to add some sort of delay factor
  // in order to prevent multiple notifications from beng queue'd
  // up together on the space side of the house.
  logger.log(Level.INFO, "Checking event count befor enabling");
  int eventCount = 0;
  assertCount(listener, eventCount);

  logger.log(Level.INFO, "Enabling delivery");
  mr.enableDelivery(listener);
  eventCount += NUM_EVENTS;
  logger.log(Level.INFO, "Waiting for event delivery");
  waitForEvents(listener, eventCount, MAX_WAIT);
  logger.log(Level.INFO, "Verifying event delivery");
  assertCount(listener, eventCount);

  logger.log(Level.INFO, "Generating some more events");
  for (i = 0; i < NUM_EVENTS; i++) {
      addLease(space.write(new Name("Yah"), null, DURATION), false);
  }

  eventCount += NUM_EVENTS;
  logger.log(Level.INFO, "Waiting for event delivery");
  waitForEvents(listener, eventCount, MAX_WAIT);
  logger.log(Level.INFO, "Verifying event delivery");
  assertCount(listener, eventCount);

  shutdown(0); // Mailbox is at index 0;

  logger.log(Level.INFO, "Generating some more events");
  for (i = 0; i < NUM_EVENTS; i++) {
      addLease(space.write(new Name("Yah"), null, DURATION), false);
  }

  eventCount += NUM_EVENTS;
  logger.log(Level.INFO, "Waiting for event delivery");
  waitForEvents(listener, eventCount, MAX_WAIT);
View Full Code Here

  JoinAdmin ja = (JoinAdmin)admin;
  Entry[] attrs = ja.getLookupAttributes();
  logger.log(Level.INFO, "Calling JoinAdmin::getLookupAttributes: got " +
      attrs.length + " items");
  String name = "Spanguini";
  Entry[] newAttrs = { new Name(name) };
  logger.log(Level.INFO, "Calling JoinAdmin::addLookupAttributes()");
  ja.addLookupAttributes(newAttrs);
  logger.log(Level.INFO, "Checking addLookupAttributes call via get call");
  attrs = ja.getLookupAttributes();
  if (!assertContainsName(attrs, name)) {
      throw new TestException(
    "Did not receive proper attribute setting for Name " +
    "after adding");
  }
  name = name + "2";
  Entry[] templates = { new Name() };
  newAttrs[0] = new Name(name);
  logger.log(Level.INFO, "Calling JoinAdmin::modifyLookupAttributes()");
  ja.modifyLookupAttributes(templates, newAttrs);
  attrs = ja.getLookupAttributes();
  if (!assertContainsName(attrs, name)) {
      throw new TestException("Did not receive proper attribute setting for Name after modifying");
View Full Code Here

  JoinAdmin ja = (JoinAdmin)admin;
  Entry[] attrs = ja.getLookupAttributes();
  logger.log(Level.INFO, "Calling JoinAdmin::getLookupAttributes: got " +
      attrs.length + "items");
  String name = "Spanguini";
  Entry[] newAttrs = { new Name(name) };
  logger.log(Level.INFO, "Calling JoinAdmin::addLookupAttributes()");
  ja.addLookupAttributes(newAttrs);
  logger.log(Level.INFO, "Checking addLookupAttributes call via get call");
  attrs = ja.getLookupAttributes();
  if (!assertContainsName(attrs, name)) {
      throw new TestException("Did not receive proper attribute setting for Name " +
         "after adding");
  }

  shutdown(0);

  logger.log(Level.INFO, "Checking addLookupAttributes call after shutdown");
  attrs = ja.getLookupAttributes();
  if (!assertContainsName(attrs, name)) {
      throw new TestException("Did not receive proper attribute setting for Name " +
         "after shutdown");
  }

  name = name + "2";
  Entry[] templates = { new Name() };
  newAttrs[0] = new Name(name);
  logger.log(Level.INFO, "Calling JoinAdmin::modifyLookupAttributes()");
  ja.modifyLookupAttributes(templates, newAttrs);
  logger.log(Level.INFO, "Checking modifyLookupAttributes call via "
        + "getLookupAttributes");
  attrs = ja.getLookupAttributes();
View Full Code Here

  JoinAdmin ja = (JoinAdmin)admin;
  Entry[] attrs = ja.getLookupAttributes();
  logger.log(Level.INFO, "Calling JoinAdmin::getLookupAttributes: got " +
      attrs.length + "items");
  String name = "Spanguini";
  Entry[] newAttrs = { new Name(name) };
  logger.log(Level.INFO, "Calling JoinAdmin::addLookupAttributes()");
  ja.addLookupAttributes(newAttrs);
  logger.log(Level.INFO,
       "Checking addLookupAttributes call via get call");
  attrs = ja.getLookupAttributes();
  if (!assertContainsName(attrs, name)) {
      throw new TestException( "Did not receive proper attribute "
           + "setting for Name after adding");
  }

  shutdown(0);

  logger.log(Level.INFO,
       "Checking addLookupAttributes call after shutdown");
  attrs = ja.getLookupAttributes();
  if (!assertContainsName(attrs, name)) {
      throw new TestException( "Did not receive proper attribute "
           + "setting for Name after shutdown");
  }

  name = name + "2";
  Entry[] templates = { new Name() };
  newAttrs[0] = new Name(name);
  logger.log(Level.INFO, "Calling JoinAdmin::modifyLookupAttributes()");
  ja.modifyLookupAttributes(templates, newAttrs);
  logger.log(Level.INFO, "Checking modifyLookupAttributes call via "
                 + "getLookupAttributes");
  attrs = ja.getLookupAttributes();
View Full Code Here

TOP

Related Classes of net.jini.lookup.entry.Name

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.