Package java.util

Examples of java.util.LinkedHashMap$LinkedHashIterator


    /**
     * @see org.andromda.cartridges.jsf.metafacades.JSFUseCase#getAllForwards()
     */
    protected List handleGetAllForwards()
    {
        final Map forwards = new LinkedHashMap();
        for (final Iterator iterator = this.getActionForwards().iterator(); iterator.hasNext();)
        {
            final ModelElementFacade forward = (ModelElementFacade)iterator.next();
            forwards.put(forward.getName(), forward);
        }
        for (final Iterator iterator = this.getForwards().iterator(); iterator.hasNext();)
        {
            final ModelElementFacade forward = (ModelElementFacade)iterator.next();
            forwards.put(forward.getName(), forward);
        }
        return new ArrayList(forwards.values());       
    }
View Full Code Here


    /**
     * @see org.andromda.cartridges.jsf.metafacades.JSFUseCase#getNavigationRules()
     */
    protected Collection handleGetNavigationRules()
    {
        final Map rules = new LinkedHashMap();
        final Collection views = this.getViews();
        for (final Iterator iterator = views.iterator(); iterator.hasNext();)
        {
            final JSFView view = (JSFView)iterator.next();
            rules.put(view.getFromOutcome(), view);
            for (final Iterator forwardIterator = view.getForwards().iterator(); forwardIterator.hasNext();)
            {
                final Object forward = forwardIterator.next();
                String name;
                if (forward instanceof JSFForward)
                {
                    name = ((JSFForward)forward).getFromOutcome();
                }
                else
                {
                    name = ((JSFAction)forward).getFromOutcome();
                }
                rules.put(name, forward);
            }
        }
        return rules.values();
    }
View Full Code Here

     * @param modelElements a collection of model elements, elements that are not model elements will be ignored
     * @return the argument model elements without, elements with a duplicate name will only be recorded once
     */
    public List filterUniqueByName(Collection modelElements)
    {
        final Map filteredElements = new LinkedHashMap();

        for (final Iterator elementIterator = modelElements.iterator(); elementIterator.hasNext();)
        {
            final Object object = elementIterator.next();
            if (object instanceof ModelElementFacade)
            {
                final ModelElementFacade modelElement = (ModelElementFacade)object;
                if (!filteredElements.containsKey(modelElement.getName()))
                {
                    filteredElements.put(modelElement.getName(), modelElement);
                }
            }
        }

        return new ArrayList(filteredElements.values());
    }
View Full Code Here

        {
            messages = Collections.EMPTY_MAP;
        }
        else
        {
            messages = new LinkedHashMap(); // we want to keep the order

            for (final Iterator iterator = taggedValues.iterator(); iterator.hasNext();)
            {
                final String value = (String)iterator.next();
                messages.put(StringUtilsHelper.toResourceMessageKey(value), value);
View Full Code Here

        }

        String handle = Association.FAILED_ASSOC_HANDLE;

        // build a list of association types, with the preferred one at the end
        LinkedHashMap requests = new LinkedHashMap();

        if (discovered.isVersion2())
        {
            requests.put(AssociationSessionType.NO_ENCRYPTION_SHA1MAC, null);
            requests.put(AssociationSessionType.NO_ENCRYPTION_SHA256MAC, null);
            requests.put(AssociationSessionType.DH_SHA1, null);
            requests.put(AssociationSessionType.DH_SHA256, null);
        }
        else
        {
            requests.put(AssociationSessionType.NO_ENCRYPTION_COMPAT_SHA1MAC, null);
            requests.put(AssociationSessionType.DH_COMPAT_SHA1, null);
        }

        if (_prefAssocSessEnc.isVersion2() == discovered.isVersion2())
            requests.put(_prefAssocSessEnc, null);

        // build a stack of Association Request objects
        // and keep only the allowed by the configured preferences
        // the most-desirable entry is always at the top of the stack
        Stack reqStack = new Stack();
        Iterator iter = requests.keySet().iterator();
        while(iter.hasNext())
        {
            AssociationSessionType type = (AssociationSessionType) iter.next();

            // create the appropriate Association Request
            AssociationRequest newReq = createAssociationRequest(type, opUrl);
            if (newReq != null) reqStack.push(newReq);
        }

        // perform the association attempts
        int attemptsLeft = maxAttempts;
        LinkedHashMap alreadyTried = new LinkedHashMap();
        while (attemptsLeft > 0 && ! reqStack.empty())
        {
            try
            {
                attemptsLeft--;
                AssociationRequest assocReq =
                        (AssociationRequest) reqStack.pop();

                if (DEBUG)
                    _log.debug("Trying association type: " + assocReq.getType());

                // was this association / session type attempted already?
                if (alreadyTried.keySet().contains(assocReq.getType()))
                {
                    if (DEBUG) _log.debug("Already tried.");
                    continue;
                }

                // mark the current request type as already tried
                alreadyTried.put(assocReq.getType(), null);

                ParameterList respParams = new ParameterList();
                int status = call(opEndpoint, assocReq, respParams);

                // process the response
                if (status == HttpStatus.SC_OK) // success response
                {
                    AssociationResponse assocResp;

                    assocResp = AssociationResponse
                            .createAssociationResponse(respParams);

                    // valid association response
                    Association assoc =
                            assocResp.getAssociation(assocReq.getDHSess());
                    handle = assoc.getHandle();

                    AssociationSessionType respType = assocResp.getType();
                    if ( respType.equals(assocReq.getType()) ||
                            // v1 OPs may return a success no-encryption resp
                            ( ! discovered.isVersion2() &&
                              respType.getHAlgorithm() == null &&
                              createAssociationRequest(respType,opUrl) != null))
                    {
                        // store the association and do no try alternatives
                        _associations.save(opEndpoint, assoc);
                        _log.info("Associated with " + discovered.getOPEndpoint()
                                + " handle: " + assoc.getHandle());
                        break;
                    }
                    else
                        _log.info("Discarding association response, " +
                                  "not matching consumer criteria");
                }
                else if (status == HttpStatus.SC_BAD_REQUEST) // error response
                {
                    _log.info("Association attempt failed.");

                    // retrieve fallback sess/assoc/encryption params set by OP
                    // and queue a new attempt
                    AssociationError assocErr =
                            AssociationError.createAssociationError(respParams);

                    AssociationSessionType opType =
                            AssociationSessionType.create(
                                    assocErr.getSessionType(),
                                    assocErr.getAssocType());

                    if (alreadyTried.keySet().contains(opType))
                        continue;

                    // create the appropriate Association Request
                    AssociationRequest newReq =
                            createAssociationRequest(opType, opUrl);
View Full Code Here

      // List emails = fetchResp.getAttributeValues("email");
      // String email = (String) emails.get(0);

      List aliases = fetchResp.getAttributeAliases();
      Map attributes = new LinkedHashMap();
      for (Iterator iter = aliases.iterator(); iter.hasNext();) {
        String alias = (String) iter.next();
        List values = fetchResp.getAttributeValues(alias);
        if (values.size() > 0) {
          String[] arr = new String[values.size()];
          values.toArray(arr);
          attributes.put(alias, StringUtils.join(arr));
        }
      }
      httpReq.setAttribute("attributes", attributes);
    }
  }
View Full Code Here

                if( ! func.parseReport(report) ) {
                    System.out.println("badly formed report, can't parse");
                    continue; // bad report, can't parse
                }

                LinkedHashMap field = func.getFields();
                HashMap unit = func.getUnits();
                String key;

                System.out.println("<report>");
                for( Iterator it = field.keySet().iterator(); it.hasNext(); ) {
                    key = (String) it.next();
                    //System.out.println(key + "\t\t" + (String) field.get(key));
                    System.out.println("\t<parameter name=\""+ key +"\" value=\""+
                   (String) field.get(key) +"\" units=\""+ (String) unit.get(key)
                       +"\" />" );
                }
                System.out.println("</report>");
            }

            //System.out.println("</report>");
            return;
        }


        // else
        System.out.println( report );
        if( ! func.parseReport(report) ) {
            System.out.println("badly formed report, can't parse");
            System.exit(1);
        }
        LinkedHashMap field = func.getFields();
        HashMap unit = func.getUnits();
        String key;

        System.out.println("<report>");
        for( Iterator it = field.keySet().iterator(); it.hasNext(); ) {
            key = (String) it.next();
            //System.out.println(key + "\t\t" + (String) field.get(key));
            System.out.println("\t<parameter name=\""+ key +"\" value=\""+
           (String) field.get(key) +"\" units=\""+ (String) unit.get(key)
           +"\" />" );
        }
        System.out.println("</report>");

    }
View Full Code Here

            SessionTxState state = (SessionTxState)i.next();
            state.handleFailover(newServerID, oldSessionID, newSessionID);

            if (tmpMap == null)
            {
               tmpMap = new LinkedHashMap();
            }
            tmpMap.put(new Integer(newSessionID), state);
         }
      }
View Full Code Here

   private SessionTxState getSessionTxState(int sessionID)
   {
      if (sessionStatesMap == null)
      {
         sessionStatesMap = new LinkedHashMap();
      }

      SessionTxState sessionTxState = (SessionTxState)sessionStatesMap.get(new Integer(sessionID));

      if (sessionTxState == null)
View Full Code Here

     
   // JDBCSupport overrides ----------------------------
  
   protected Map getDefaultDMLStatements()
   {               
      Map map = new LinkedHashMap();
      map.put("SELECT_PRECONF_CLIENTID", "SELECT CLIENTID FROM JBM_USER WHERE USER_ID=?");
      return map;
   }
View Full Code Here

TOP

Related Classes of java.util.LinkedHashMap$LinkedHashIterator

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.