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  /*
20   * Created on 14.09.2005
21   *
22   * TODO To change the template for this generated file go to
23   * Window - Preferences - Java - Code Style - Code Templates
24   */
25  package org.apache.fulcrum.yaafi.framework.interceptor;
26  
27  import java.lang.reflect.Method;
28  import java.util.Map;
29  
30  import org.apache.fulcrum.yaafi.framework.tls.ThreadLocalStorage;
31  
32  /**
33   * Contains context information for the interceptors being invoked. The
34   * class contains a request context which allows to store data from within an
35   * interceptor. It also provides access to a ThreadLocalStorage to associate
36   * data with the current thread.
37   *
38   * @author <a href="mailto:siegfried.goeschl@it20one.at">Siegfried Goeschl</a>
39   */
40  public interface AvalonInterceptorContext
41  {
42      /**
43       * @return Returns the context for the given request.
44       */
45      Map getRequestContext();
46  
47      /**
48       * @return Returns the serviceDelegate.
49       */
50      Object getServiceDelegate();
51  
52      /**
53       * @return Returns the serviceName.
54       */
55      String getServiceName();
56  
57      /**
58       * @return Returns the serviceShorthand.
59       */
60      String getServiceShorthand();
61  
62      /**
63       * @return Returns the args.
64       */
65      Object [] getArgs();
66  
67      /**
68       * @return Returns the method.
69       */
70      Method getMethod();
71  
72      /**
73       * @return Returns the ThreadLocalStorage
74       */
75      ThreadLocalStorage getThreadContext();
76  
77      /**
78       * @return is a transaction id defined for the current thread
79       */
80      boolean hasTransactionId();
81  
82      /**
83       * @return get the transaction id defined for the current thread
84       */
85      Object getTransactionId();
86  
87      /**
88       * Set the transaction id for the current thread.
89       * @param transactionId the transaction id
90       */
91      void setTransactionId(Object transactionId);
92  
93      /**
94       * Clears the transaction id for the current thread.
95       */
96      void clearTransactionId();
97  
98      /**
99       * Increment the current service invocation depth
100      */
101     void incrementInvocationDepth();
102 
103     /**
104      * Decrement the current service invocation depth
105      */
106     void decrementInvocationDepth();
107 
108     /**
109      * Get the current service invocation depth
110      * @return the current service invocation depth
111      */
112     int getInvocationDepth();
113 
114     /**
115      * @return Returns the invocationId.
116      */
117     Long getInvocationId();
118 }