All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.opensaml.messaging.handler.impl.BasicMessageHandlerChain Maven / Gradle / Ivy

The newest version!
/*
 * Licensed to the University Corporation for Advanced Internet Development,
 * Inc. (UCAID) under one or more contributor license agreements.  See the
 * NOTICE file distributed with this work for additional information regarding
 * copyright ownership. The UCAID licenses this file to You 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.opensaml.messaging.handler.impl;

import java.util.Collections;
import java.util.List;

import javax.annotation.Nonnull;
import javax.annotation.Nullable;

import net.shibboleth.utilities.java.support.annotation.constraint.NonnullAfterInit;
import net.shibboleth.utilities.java.support.annotation.constraint.NonnullElements;

import org.opensaml.messaging.context.MessageContext;
import org.opensaml.messaging.handler.AbstractMessageHandler;
import org.opensaml.messaging.handler.MessageHandler;
import org.opensaml.messaging.handler.MessageHandlerChain;
import org.opensaml.messaging.handler.MessageHandlerException;

/**
 * A basic implementation of {@link MessageHandlerChain}.
 */
public class BasicMessageHandlerChain extends AbstractMessageHandler 
    implements MessageHandlerChain {

    /** The list of members of the handler chain. */
    @NonnullAfterInit @NonnullElements private List members;
    
    /** 
     * {@inheritDoc}
     * 
     * 

* The returned list is immutable. Changes to the list * should be accomplished through {@link BasicMessageHandlerChain#setHandlers(List)}. *

* * */ @NonnullAfterInit @NonnullElements public List getHandlers() { return members; } /** * Set the list of message handler chain members. * *

* The supplied list is copied before being stored. Later modifications to * the originally supplied list will not be reflected in the handler chain membership. *

* * @param handlers the list of message handler members */ public void setHandlers(@Nullable @NonnullElements final List handlers) { if (handlers != null) { members = List.copyOf(handlers); } else { members = Collections.emptyList(); } } /** {@inheritDoc} */ public void doInvoke(@Nonnull final MessageContext msgContext) throws MessageHandlerException { if (members != null) { for (final MessageHandler handler : members) { handler.invoke(msgContext); } } } }




© 2015 - 2025 Weber Informatics LLC | Privacy Policy