001    /*
002     * Licensed to the Apache Software Foundation (ASF) under one
003     * or more contributor license agreements.  See the NOTICE file
004     * distributed with this work for additional information
005     * regarding copyright ownership.  The ASF licenses this file
006     * to you under the Apache License, Version 2.0 (the
007     * "License"); you may not use this file except in compliance
008     * with the License.  You may obtain a copy of the License at
009     *
010     *   http://www.apache.org/licenses/LICENSE-2.0
011     *
012     * Unless required by applicable law or agreed to in writing,
013     * software distributed under the License is distributed on an
014     * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
015     * KIND, either express or implied.  See the License for the
016     * specific language governing permissions and limitations
017     * under the License.
018     */
019    package org.apache.fulcrum.yaafi.framework.interceptor;
020    
021    import java.lang.reflect.Method;
022    import java.util.Map;
023    
024    import org.apache.fulcrum.yaafi.framework.tls.ThreadLocalStorage;
025    
026    /**
027     * Contains context information for the interceptors being invoked. The
028     * class contains a request context which allows to store data from within an
029     * interceptor. It also provides access to a ThreadLocalStorage to associate
030     * data with the current thread.
031     *
032     * @author <a href="mailto:siegfried.goeschl@it20one.at">Siegfried Goeschl</a>
033     */
034    public interface AvalonInterceptorContext
035    {
036        /**
037         * @return Returns the context for the given request.
038         */
039        Map getRequestContext();
040    
041        /**
042         * @return Returns the serviceDelegate.
043         */
044        Object getServiceDelegate();
045    
046        /**
047         * @return Returns the serviceName.
048         */
049        String getServiceName();
050    
051        /**
052         * @return Returns the serviceShorthand.
053         */
054        String getServiceShorthand();
055    
056        /**
057         * @return Returns the args.
058         */
059        Object [] getArgs();
060    
061        /**
062         * @return Returns the method.
063         */
064        Method getMethod();
065    
066        /**
067         * @return Returns the ThreadLocalStorage
068         */
069        ThreadLocalStorage getThreadContext();
070    
071        /**
072         * @return is a transaction id defined for the current thread
073         */
074        boolean hasTransactionId();
075    
076        /**
077         * @return get the transaction id defined for the current thread
078         */
079        Object getTransactionId();
080    
081        /**
082         * Set the transaction id for the current thread.
083         * @param transactionId the transaction id
084         */
085        void setTransactionId(Object transactionId);
086    
087        /**
088         * Clears the transaction id for the current thread.
089         */
090        void clearTransactionId();
091    
092        /**
093         * Increment the current service invocation depth
094         */
095        void incrementInvocationDepth();
096    
097        /**
098         * Decrement the current service invocation depth
099         */
100        void decrementInvocationDepth();
101    
102        /**
103         * Get the current service invocation depth
104         * @return the current service invocation depth
105         */
106        int getInvocationDepth();
107    
108        /**
109         * @return Returns the invocationId.
110         */
111        Long getInvocationId();
112    }