/*
(non-Javadoc)
@see org.jdiameter.client.api.controller.IRealmTable#matchRealm(org.jdiameter.client.api.IRequest)
496631
@Override
  public Realm matchRealm(IRequest request) {
    try {
      // once again casting...
      IMessage req = (IMessage) request;
      String destinationRealm = req.getAvps().getAvp(Avp.DESTINATION_REALM).getDiameterIdentity();
      // we have req, we need match, not dummy longest from right BS match.
      return this.matchRealm(req, destinationRealm);
    }
    catch (Exception e) {
      logger.error("Unable to read Destination-Realm AVP to match realm to request", e);
    }

    return null;
  }
484532
@Override
    public MatchStrength hasFormat(InputAccessor acc) throws IOException
    {
        if (!acc.hasMoreBytes()) {
            return MatchStrength.INCONCLUSIVE;
        }
        byte b = acc.nextByte();
        // Very first thing, a UTF-8 BOM?
        if (b == UTF8_BOM_1) { // yes, looks like UTF-8 BOM
            if (!acc.hasMoreBytes()) {
                return MatchStrength.INCONCLUSIVE;
            }
            if (acc.nextByte() != UTF8_BOM_2) {
                return MatchStrength.NO_MATCH;
            }
            if (!acc.hasMoreBytes()) {
                return MatchStrength.INCONCLUSIVE;
            }
            if (acc.nextByte() != UTF8_BOM_3) {
                return MatchStrength.NO_MATCH;
            }
            if (!acc.hasMoreBytes()) {
                return MatchStrength.INCONCLUSIVE;
            }
            b = acc.nextByte();
        }
        if (b == '{' || Character.isLetter((char) b) || Character.isDigit((char) b)) {
            return MatchStrength.WEAK_MATCH;
        }
        return MatchStrength.INCONCLUSIVE;
    }
474308
public boolean matches(String requestUri) {
        Matcher matcher = regex.matcher(requestUri);
        return matcher.matches();
    }
398846
public boolean matches(String schemeParam, String hostParam, String uriParam) {
        // If URI mapping enforce a host, ensure it is the one used.
        if (this.host != null && !this.host.equalsIgnoreCase(schemeParam + "://" + hostParam)) {
            return false;
        }

        if (this.extension != null && !uriParam.endsWith(this.extension)) {
            return false;
        }

        if (this.path != null && !uriParam.startsWith(this.path)) {
            return false;
        }
        return true;
    }
593831
def getDomainRealm(self, inputURL, environ):
        """"""
        # we don't get the realm here, its already been resolved in
        # request_resolver
        if inputURL.startswith("/"):
            inputURL = inputURL[1:]
        parts = inputURL.split("/")
        return parts[0]
352005
private SubscriptionMatchResult matchIdsWithAndOr(String theParamName, List<List<IQueryParameterType>> theAndOrParams, RuntimeResourceDefinition theResourceDefinition, IBaseResource theResource, ResourceIndexedSearchParams theSearchParams) {
		if (theAndOrParams.isEmpty()) {
			return SubscriptionMatchResult.successfulMatch();
		}

		if (hasQualifiers(theAndOrParams)) {
			return SubscriptionMatchResult.unsupportedFromParameterAndReason(theParamName, SubscriptionMatchResult.STANDARD_PARAMETER);
		}
		if (hasPrefixes(theAndOrParams)) {

			return SubscriptionMatchResult.unsupportedFromParameterAndReason(theParamName, SubscriptionMatchResult.PREFIX);

		}
		if (hasChain(theAndOrParams)) {
			return SubscriptionMatchResult.unsupportedFromParameterAndReason(theParamName, SubscriptionMatchResult.CHAIN);
		}
		switch (theParamName) {
			case IAnyResource.SP_RES_ID:

				return SubscriptionMatchResult.fromBoolean(matchIdsAndOr(theAndOrParams, theResource));

			case IAnyResource.SP_RES_LANGUAGE:
			case Constants.PARAM_HAS:
			case Constants.PARAM_TAG:
			case Constants.PARAM_PROFILE:
			case Constants.PARAM_SECURITY:

				return SubscriptionMatchResult.unsupportedFromParameterAndReason(theParamName, SubscriptionMatchResult.PARAM);

			default:

				String resourceName = theResourceDefinition.getName();
				RuntimeSearchParam paramDef = mySearchParamRegistry.getActiveSearchParam(resourceName, theParamName);
				return matchResourceParam(theParamName, theAndOrParams, theSearchParams, resourceName, paramDef);
		}
	}
109624
private MessageProcessorSearchResults matchMessage(MessageItem msg)
                    throws SIDiscriminatorSyntaxException
    {
        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.entry(
                        tc,
                        "matchMessage",
                        new Object[] { msg });

        //Extract the message from the MessageItem
        JsMessage jsMsg = msg.getMessage();

        //  Match Consumers is only called for PubSub targets.
        TopicAuthorization topicAuth = _messageProcessor.getDiscriminatorAccessChecker();
        MessageProcessorSearchResults searchResults = new MessageProcessorSearchResults(topicAuth);

        // Defect 382250, set the unlockCount from MsgStore into the message
        // in the case where the message is being redelivered.
        int redelCount = msg.guessRedeliveredCount();

        if (redelCount > 0)
        {
            if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
                SibTr.debug(tc, "Set deliverycount into message: " + redelCount);
            jsMsg.setDeliveryCount(redelCount);
        }

        // Get the matching consumers from the matchspace
        _matchspace.retrieveMatchingOutputHandlers(
                                                   _destination,
                                                   jsMsg.getDiscriminator(),
                                                   (MatchSpaceKey) jsMsg,
                                                   searchResults);

        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.exit(
                       tc,
                       "matchMessage",
                       new Object[] { searchResults });

        return searchResults;
    }
1132641
public function getRealmForFieldValue($op, $entity_type, $bundle_id, $field_name, $field_value) {
    $realm = $op . '_' . $entity_type . '_' . $bundle_id . '_' . $field_name . '_' . $field_value;
    return $realm;
  }
757388
public static RealmAttribute createRealmAttribute(byte realm[]) {
		RealmAttribute attribute = new RealmAttribute();

		attribute.setRealm(realm);
		return attribute;
	}
174240
public static boolean isMatch(Method javaMethod,
                                String name, Class<?> []param)
  {
    if (! javaMethod.getName().equals(name))
      return false;

    Class<?> []mparam = javaMethod.getParameterTypes();

    return isMatch(mparam, param);
  }
446476
@Override
  public void _LocalPeer_setRealm(String realm) throws MBeanException {
    getMutableConfiguration().setStringValue(OwnRealm.ordinal(), realm);

    if (logger.isInfoEnabled()) {
      logger.info("Local Peer Realm successfully changed to '" + realm + "'. Restart to Diameter stack is needed to apply changes.");
    }
  }
33373
@Override
  public Description matchMethodInvocation(MethodInvocationTree tree, VisitorState state) {
    if (!INSTANCE_OF_CLASS.matches(tree, state)) {
      return Description.NO_MATCH;
    }
    return describeMatch(tree, SuggestedFix.replace(tree, buildReplacement(tree, state)));
  }
1081668
public String getDefaultParentForEntityInRealm(String entType, String realmName) throws WIMException {
        String defaultParent = getDefaultParent(entType);
        if (realmName != null) {
            validateRealmName(realmName);
            String parent = null;
            RealmConfig realmConfig = getRealmConfig(realmName);
            Map defaultParentsMap = realmConfig.getDefaultParentMapping();
            if (defaultParentsMap != null) {
                parent = (String) defaultParentsMap.get(entType);
                if (parent != null) {
                    defaultParent = parent;
                }
            }
            if (parent == null && !isUniqueNameInRealm(defaultParent, realmName)) {
                defaultParent = null;
            }
        }
        return defaultParent;
    }
154689
@SuppressWarnings("deprecation")
    @Override
    public String getRealPath(String arg0) {
        try {
            collaborator.preInvoke(componentMetaData);
            return request.getRealPath(arg0);
        } finally {
            collaborator.postInvoke();
        }
    }
372114
private boolean isRenditionMatchSizeSameSmaller(MediaFormat mediaFormat, MediaFormat mediaFormatRequested) {
    long widthRequested = mediaFormatRequested.getEffectiveMinWidth();
    long heightRequested = mediaFormatRequested.getEffectiveMinHeight();

    long widthMin = mediaFormat.getEffectiveMinWidth();
    long heightMin = mediaFormat.getEffectiveMinHeight();

    return widthMin <= widthRequested && heightMin <= heightRequested;
  }
1330583
@Override
    protected MatchResponse getMatchResponse(SecurityConstraint securityConstraint, String resourceName, String method) {
        CollectionMatch collectionMatch = getCollectionMatch(securityConstraint.getWebResourceCollections(), resourceName, method);

        if (CollectionMatch.RESPONSE_NO_MATCH.equals(collectionMatch)) {
            return MatchResponse.NO_MATCH_RESPONSE;
        }

        if (com.ibm.ws.webcontainer.osgi.WebContainer.getServletContainerSpecLevel() >= 31) {
            if (collectionMatch.isExactMatch() && securityConstraint.isAccessUncovered() && securityConstraint.isFromHttpConstraint()) {
                return new MatchResponse(securityConstraint.getRoles(), securityConstraint.isSSLRequired(),
                                securityConstraint.isAccessPrecluded(), CollectionMatch.RESPONSE_PERMIT);
            }
        }

        return new MatchResponse(securityConstraint.getRoles(), securityConstraint.isSSLRequired(),
                        securityConstraint.isAccessPrecluded(), collectionMatch);
    }
1033456
public void expectExactMatch(String name, String anotherName) {
        expectExactMatch(name, anotherName, messages.get(Validation.EXACT_MATCH_KEY.name(), name, anotherName));
    }