/*=============================================================================*
* Copyright 2006 The Apache Software Foundation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*=============================================================================*/
package org.apache.muse.ws.dm.muws.impl;
import java.util.Iterator;
import javax.xml.namespace.QName;
import org.w3c.dom.Element;
import org.apache.muse.ws.addressing.EndpointReference;
import org.apache.muse.ws.addressing.soap.SoapFault;
import org.apache.muse.ws.dm.muws.Match;
import org.apache.muse.ws.dm.muws.MuwsConstants;
import org.apache.muse.ws.resource.WsResource;
/**
*
* AllMatch is a {@linkplain ComplexMatch ComplexMatch} that acts as a
* conditional AND (&&) on all subexpressions.
*
* @author Dan Jemiolo (danj)
*
*/
public class AllMatch extends ComplexMatch
{
public AllMatch(WsResource owner)
{
super(owner);
}
public AllMatch(WsResource owner, Element xml)
{
super(owner, xml);
}
protected QName getRootQName()
{
return MuwsConstants.MATCH_ALL_QNAME;
}
/**
*
* @return True if all subexpressions defined by the Match evaluate to
* 'true'. This is the same as combining them in a logical AND.
*
*/
public boolean matches(EndpointReference epr)
throws SoapFault
{
Iterator i = getMatches().iterator();
while (i.hasNext())
{
Match next = (Match)i.next();
if (!next.matches(epr))
return false;
}
return true;
}
}