Package net.jini.core.lookup

Examples of net.jini.core.lookup.ServiceRegistrar


    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 {
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

                 * Thus, the 'next' element to unmarshal is actually at
                 * the same index as the last element that was unmarshalled.
                 */
                MarshalledObject marshalledObj
                                 = (MarshalledObject)(marshalledRegs.get(i));
                ServiceRegistrar reg = (ServiceRegistrar)(marshalledObj.get());
                /* Success: record the un-marshalled element
                 *          delete the corresponding un-marshalled element
                 */
                unmarshalledRegs.add( reg );
                marshalledRegs.remove(i);
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

  throws Exception
    {
        logger.log(Level.FINE, "starting lookup service "+indx);
        /* retrieve the member groups with which to configure the lookup */
        String[] memberGroups = (String[])memberGroupsList.get(indx);
        ServiceRegistrar lookupProxy = null;
        if(implClassname.equals("com.sun.jini.test.services.lookupsimulator.LookupSimulatorImpl"))
        {
            /* Use either a random or an explicit locator port */
            DiscoveryProtocolSimulator generator =
    new DiscoveryProtocolSimulator(config, memberGroups, manager, port);
            genMap.put( generator, memberGroups );
            lookupProxy = generator.getLookupProxy();
        } else {//start a non-simulated lookup service implementation
      logger.log(Level.FINER, "Starting lookup for host " + serviceHost);
            lookupProxy = manager.startLookupService(serviceHost); // already prepared
            genMap.put( lookupProxy, memberGroups );
        }//endif
        lookupList.add( lookupProxy );
        LookupLocator lookupLocator = QAConfig.getConstrainedLocator(lookupProxy.getLocator());
        locatorsStarted.add(lookupLocator);
        LocatorsUtil.displayLocator(lookupLocator,
                                    "  locator ",Level.FINE);
        String displayGroups = GroupsUtil.toCommaSeparatedStr(memberGroups);
        if(displayGroups.equals("")) displayGroups = new String("NO_GROUPS");
View Full Code Here

                                 String[] replaceGroups,
                                 boolean alternate,
                                 int discardType)
    {
        try {
            ServiceRegistrar lookupProxy = null;
            if( curGen instanceof DiscoveryProtocolSimulator ) {
                DiscoveryProtocolSimulator generator
                                         = (DiscoveryProtocolSimulator)curGen;
                lookupProxy = generator.getLookupProxy();
            } else {
                lookupProxy = (ServiceRegistrar)curGen;
            }//endif
            String[] curGroups = lookupProxy.getGroups();
            String[] newGroups =  new String[] {"Group_"
                                                +lookupProxy.getServiceID()};
            if(replaceGroups != null) {
                newGroups = replaceGroups;
            } else {
                if((curGroups != null) && (curGroups.length > 0)) {
                    if(alternate) {
View Full Code Here

        Map newMap = new HashMap();
  Iterator iter = map.keySet().iterator();
        for(int i=0;iter.hasNext();i++) {
            Object key = iter.next();
            if( !(key instanceof DiscoveryProtocolSimulator) ) return map;
            ServiceRegistrar reg =
                           ((DiscoveryProtocolSimulator)key).getLookupProxy();
            String[] groups = (String[])map.get(key);
            newMap.put(reg,groups);
        }//end loop
        return newMap;
View Full Code Here

     *  discovered.
     */
    protected ServiceRegistrar[] getRegsToDiscover(ArrayList useList) {
        ArrayList regsList = new ArrayList();
        for(int i=0;i<useList.size();i++) {
            ServiceRegistrar reg =
                   ( ((DiscoveryStruct)(useList.get(i))).regGroups ).reg;
            if(reg == nullcontinue;
            regsList.add(reg);
        }
        return (ServiceRegistrar[])(regsList).toArray
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.