001/*
002 * Licensed to the Apache Software Foundation (ASF) under one or more
003 * contributor license agreements.  See the NOTICE file distributed with
004 * this work for additional information regarding copyright ownership.
005 * The ASF licenses this file to You under the Apache License, Version 2.0
006 * (the "License"); you may not use this file except in compliance with
007 * the License.  You may obtain a copy of the License at
008 *
009 *     http://www.apache.org/licenses/LICENSE-2.0
010 *
011 * Unless required by applicable law or agreed to in writing, software
012 * distributed under the License is distributed on an "AS IS" BASIS,
013 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014 * See the License for the specific language governing permissions and
015 * limitations under the License.
016 */
017package org.apache.commons.chain;
018
019import java.util.Map;
020
021/**
022 * A {@link Context} represents the state information that is
023 * accessed and manipulated by the execution of a {@link Command} or a
024 * {@link Chain}. Specialized implementations of {@link Context} will
025 * typically add JavaBeans properties that contain typesafe accessors
026 * to information that is relevant to a particular use case for this
027 * context, and/or add operations that affect the state information
028 * that is saved in the context.
029 *
030 * <p>Implementations of {@link Context} must also implement all of the
031 * required and optional contracts of the {@code java.util.Map}
032 * interface.</p>
033 *
034 * <p>It is strongly recommended, but not required, that JavaBeans
035 * properties added to a particular {@link Context} implementation exhibit
036 * <em>Attribute-Property Transparency</em>. In other words,
037 * a value stored via a call to {@code setFoo(value)} should be visible
038 * by calling {@code get("foo")}, and a value stored
039 * via a call to {@code put("foo", value)} should be
040 * visible by calling {@code getFoo()}. If your {@link Context}
041 * implementation class exhibits this feature, it becomes easier to reuse the
042 * implementation in multiple environments, without the need to cast to a
043 * particular implementation class in order to access the property getter
044 * and setter methods.</p>
045 *
046 * <p>To protect applications from evolution of this interface, specialized
047 * implementations of {@link Context} should generally be created by extending
048 * the provided base class ({@link org.apache.commons.chain.impl.ContextBase})
049 * rather than directly implementing this interface.</p>
050 *
051 * <p>Applications should <strong>NOT</strong> assume that
052 * {@link Context} implementations, or the values stored in its
053 * attributes, may be accessed from multiple threads
054 * simultaneously unless this is explicitly documented for a particular
055 * implementation.</p>
056 *
057 * @author Craig R. McClanahan
058 * @version $Revision$ $Date$
059 */
060public interface Context extends Map<String, Object> {
061}