Package net.jini.core.lookup

Examples of net.jini.core.lookup.ServiceRegistrar


     */
    private void updateGroupsInGlobalSet(Map groupsMap) {
        Set eSet = groupsMap.entrySet();
        for(Iterator itr = eSet.iterator(); itr.hasNext(); ) {
            Map.Entry pair = (Map.Entry)itr.next();
            ServiceRegistrar reg = (ServiceRegistrar)pair.getKey();
            if(allDiscoveredRegs.containsKey(reg)) {
                LookupLocator loc
                  = ((LocatorGroupsStruct)allDiscoveredRegs.get(reg)).locator;
                String[] newGroups = (String[])pair.getValue();
                LocatorGroupsStruct locGroups
View Full Code Here


        testLocator("hostname", -300, "jini://hostname:-300/", false);

        // Ensure that the locator actually works.
        DiscoveryAdmin admin = null;

  ServiceRegistrar reg = createLookup();
  admin = getAdmin(reg);
  String[] actualGroups = new String[] {
      "disc_test" };
  admin.setMemberGroups(actualGroups);
  LookupLocator locator =
      QAConfig.getConstrainedLocator(reg.getLocator());
  ServiceRegistrar reg1 = locator.getRegistrar();
 
  if (reg1.equals(reg) == false) {
      throw new TestException("registrars not the same");
  }
    }
View Full Code Here

        long T0 = System.currentTimeMillis();
        long deltaT = 0;
        long maxT   = nSecsJoin * 1000; //work in milliseconds
        while(deltaT < maxT) {
            for(int i=0;i<lusList.size();i++) {
                ServiceRegistrar reg = (ServiceRegistrar)lusList.get(i);
                if(regList.contains(reg)) continue;
                try {
                    Object testService = reg.lookup(template);
                    if(testService instanceof TestService) {
                        regList.add(reg);
                    }//endif
                } catch(RemoteException e) { /* try again*/ }
            }//end loop
View Full Code Here

        /* Retrieve and store the service's ID as stored in each lookup */
        ArrayList lusList = getLookupListSnapshot
                                              ("AbstractBaseTest.verifyJoin");
        ArrayList srvcIDs = new ArrayList(lusList.size());
        for(int i=0;i<lusList.size();i++) {
            ServiceRegistrar reg = (ServiceRegistrar)lusList.get(i);
      /* Verify 1 service registered with lookup service i */
      ServiceMatches matches = reg.lookup(template,
            Integer.MAX_VALUE);
      if(matches.totalMatches == 0) {
    throw new TestException("lookup service "+i
                                        +" -- no matching service found");
      } else if(matches.totalMatches != 1) {
View Full Code Here

            long maxT   = nSecsWait * 1000; //work in milliseconds
            while(deltaT <= maxT) {
                int nRegs = regList.size();
                for(int i=0;i<nRegs;i++) {
                    /* Pop the stack of lookups */
                    ServiceRegistrar reg = (ServiceRegistrar)regList.remove(0);
        /* Verify 1 service registered with lookup service i */
        ServiceMatches matches = reg.lookup(template,
              Integer.MAX_VALUE);
        if(matches.totalMatches == 0) {
      throw new TestException("lookup service "+i
               +" -- no matching service found");
        } else if(matches.totalMatches != 1) {
      throw new TestException("lookup service "+i
            +" -- totalMatches ("
            +matches.totalMatches
            +") != 1");
        }//endif
        /* Verify that the given attributes were propagated */
        Entry[] lookupAttrs = matches.items[0].attributeSets;
        logger.log(Level.FINE, "lookup service "+i
             +" -- comparing attributes");
        if(!AttributesUtil.compareAttributeSets(attrs,
                  lookupAttrs,
                  Level.OFF))
                        {
                            logger.log(Level.FINE,
               "                 -- NO MATCH");
                            regList.add(reg);// push it back on the stack
                        } else {
                            logger.log(Level.FINE,
               "                 -- attributes MATCH");
                        }//endif
                 }//end loop
                if(regList.size() == 0) break;
                DiscoveryServiceUtil.delayMS(1000);
                deltaT = System.currentTimeMillis() - T0;
            }//end loop
            /* If propagation failed, display expected & actual attributes */
            if(regList.size() > 0) {
                String retStr = "attributes not propagated successfully "
                                   +"on "+regList.size()+" lookup service(s)";
                logger.log(Level.FINE, retStr);
                AttributesUtil.displayAttributeSet(attrs,
                                                   "expectedAttrs",
                                                   Level.FINE);
                for(int i=0;i<regList.size();i++) {
                    ServiceRegistrar reg = (ServiceRegistrar)regList.get(i);
        ServiceMatches matches = reg.lookup(template,
              Integer.MAX_VALUE);
        if(matches.totalMatches != 1) {
      logger.log(Level.FINE,
           "lookup service "+i+" -- totalMatches "
           +"invalid ("+matches.totalMatches+") ... "
View Full Code Here

            HashMap discardMap = new HashMap(groupsMap.size());
            /* loop thru the (registrar,groups) pairs, find regs to discard */
            Set eSet = groupsMap.entrySet();
            for(Iterator itr = eSet.iterator(); itr.hasNext(); ) {
                Map.Entry pair = (Map.Entry)itr.next();
                ServiceRegistrar reg = (ServiceRegistrar)pair.getKey();
                /* Include the current reg in the discard map only if that
                 * reg is in the regInfo's discovered set.
                 */
                if( (regInfo.discoveredRegsMap).containsKey(reg) ) {
                    /* The groups corresponding to the discarded registrar that
View Full Code Here

                HashMap locatorMap = new HashMap(groupsMap.size());
                /* Retrieve the locators of each registrar in the event */
                for(Iterator itr = (groupsMap.keySet()).iterator();
                                                            itr.hasNext(); )
                {
                    ServiceRegistrar reg = (ServiceRegistrar)itr.next();
                    locatorMap.put(reg,
                    ((LocatorGroupsStruct)allDiscoveredRegs.get(reg)).locator);
                }//end loop

                for( Iterator itr=registrationByID.values().iterator();
View Full Code Here

            HashMap discardMap = new HashMap(groupsMap.size());
            /* loop thru the (registrar,groups) pairs, find regs to discard */
            Set eSet = groupsMap.entrySet();
            for(Iterator itr = eSet.iterator(); itr.hasNext(); ) {
                Map.Entry pair = (Map.Entry)itr.next();
                ServiceRegistrar reg = (ServiceRegistrar)pair.getKey();
                String[] regGroups = (String[])pair.getValue();
                LookupLocator regLoc = (LookupLocator)locatorMap.get(reg);
                /* Include the current reg in the discard map only if that
                 * reg is in the regInfo's discovered set, the regInfo
                 * is not interested in discovering the reg through locator
View Full Code Here

    new DataOutputStream(sock.getOutputStream());
      dstr.writeInt(protoVersion);
      dstr.flush();
      ObjectInputStream istr =
    new ObjectInputStream(sock.getInputStream());
      ServiceRegistrar registrar =
    (ServiceRegistrar)((MarshalledObject)istr.readObject()).get();
      for (int grpCount = istr.readInt(); --grpCount >= 0; ) {
    istr.readUTF(); // ensure proper format, then discard
      }
      return registrar;
View Full Code Here

      }

      // read LUS proxy
      MarshalledInstance mi =
    (MarshalledInstance) new ObjectInputStream(in).readObject();
      ServiceRegistrar reg = (ServiceRegistrar) mi.get(
    defaultLoader,
    verifyCodebaseIntegrity,
    verifierLoader,
    context);
View Full Code Here

TOP

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

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.