View Javadoc
1   /*
2    * Licensed to the Apache Software Foundation (ASF) under one
3    * or more contributor license agreements.  See the NOTICE file
4    * distributed with this work for additional information
5    * regarding copyright ownership.  The ASF licenses this file
6    * to you under the Apache License, Version 2.0 (the
7    * "License"); you may not use this file except in compliance
8    * with the License.  You may obtain a copy of the License at
9    *
10   *   http://www.apache.org/licenses/LICENSE-2.0
11   *
12   * Unless required by applicable law or agreed to in writing,
13   * software distributed under the License is distributed on an
14   * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15   * KIND, either express or implied.  See the License for the
16   * specific language governing permissions and limitations
17   * under the License.
18   */
19  package org.apache.fulcrum.yaafi.framework.interceptor;
20  
21  import java.lang.reflect.Method;
22  import java.util.Map;
23  
24  import org.apache.fulcrum.yaafi.framework.tls.ThreadLocalStorage;
25  
26  /**
27   * Contains context information for the interceptors being invoked. The
28   * class contains a request context which allows to store data from within an
29   * interceptor. It also provides access to a ThreadLocalStorage to associate
30   * data with the current thread.
31   *
32   * @author <a href="mailto:siegfried.goeschl@it20one.at">Siegfried Goeschl</a>
33   */
34  public interface AvalonInterceptorContext
35  {
36      /**
37       * @return Returns the context for the given request.
38       */
39      Map<String, Object> getRequestContext();
40  
41      /**
42       * @return Returns the serviceDelegate.
43       */
44      Object getServiceDelegate();
45  
46      /**
47       * @return Returns the serviceName.
48       */
49      String getServiceName();
50  
51      /**
52       * @return Returns the serviceShorthand.
53       */
54      String getServiceShorthand();
55  
56      /**
57       * @return Returns the args.
58       */
59      Object [] getArgs();
60  
61      /**
62       * @return Returns the method.
63       */
64      Method getMethod();
65  
66      /**
67       * @return Returns the ThreadLocalStorage
68       */
69      ThreadLocalStorage getThreadContext();
70  
71      /**
72       * @return is a transaction id defined for the current thread
73       */
74      boolean hasTransactionId();
75  
76      /**
77       * @return get the transaction id defined for the current thread
78       */
79      Object getTransactionId();
80  
81      /**
82       * Set the transaction id for the current thread.
83       * @param transactionId the transaction id
84       */
85      void setTransactionId(Object transactionId);
86  
87      /**
88       * Clears the transaction id for the current thread.
89       */
90      void clearTransactionId();
91  
92      /**
93       * Increment the current service invocation depth
94       */
95      void incrementInvocationDepth();
96  
97      /**
98       * Decrement the current service invocation depth
99       */
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 }