Package org.apache.muse.ws.dm.muws.impl

Source Code of org.apache.muse.ws.dm.muws.impl.SimpleCorrelatableProperties

/*=============================================================================*
*  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.ArrayList;
import java.util.Collection;
import java.util.Iterator;

import javax.xml.namespace.QName;

import org.apache.muse.util.messages.Messages;
import org.apache.muse.util.messages.MessagesFactory;
import org.apache.muse.ws.addressing.EndpointReference;
import org.apache.muse.ws.addressing.soap.SoapFault;
import org.apache.muse.ws.dm.muws.CorrelatableProperties;
import org.apache.muse.ws.dm.muws.Correlation;

/**
*
* SimpleCorrelatableProperties is Muse's default implementation of the
* WSDM CorrelatableProperties capability. This implementation is dialect-independent,
* meaning it can work with any correlation expressions so long as they are
* provided through the {@linkplain Correlation Correlation interface}.
*
* @author Dan Jemiolo (danj)
*
*/

public class SimpleCorrelatableProperties
    extends AbstractManageabilityCapability implements CorrelatableProperties
{
    //
    // Used to lookup all exception messages
    //
    private static Messages _MESSAGES =
        MessagesFactory.get(SimpleCorrelatableProperties.class);
   
    private Collection _correlations = new ArrayList();
   
    public void addCorrelation(Correlation expression)
    {
        if (expression == null)
            throw new NullPointerException(_MESSAGES.get("NullCorrelation"));
       
        _correlations.add(expression);
    }
   
    public Correlation[] getCorrelatableProperties()
    {
        Correlation[] array = new Correlation[_correlations.size()];
        return (Correlation[])_correlations.toArray(array);
    }

    public QName[] getPropertyNames()
    {
        return PROPERTIES;
    }
   
    public boolean matches(EndpointReference epr)
        throws SoapFault
    {
        Iterator i = _correlations.iterator();
       
        //
        // return false if any one of the correlations fails
        //
        while (i.hasNext())
        {
            Correlation next = (Correlation)i.next();
           
            if (!next.matches(epr))
                return false;
        }
       
        return true;
    }
}
TOP

Related Classes of org.apache.muse.ws.dm.muws.impl.SimpleCorrelatableProperties

TOP
Copyright © 2018 www.massapi.com. 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.