Source Code Cross Referenced for AopContext.java in  » J2EE » spring-framework-2.5 » org » springframework » aop » framework » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » J2EE » spring framework 2.5 » org.springframework.aop.framework 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


01:        /*
02:         * Copyright 2002-2007 the original author or authors.
03:         *
04:         * Licensed under the Apache License, Version 2.0 (the "License");
05:         * you may not use this file except in compliance with the License.
06:         * You may obtain a copy of the License at
07:         *
08:         *      http://www.apache.org/licenses/LICENSE-2.0
09:         *
10:         * Unless required by applicable law or agreed to in writing, software
11:         * distributed under the License is distributed on an "AS IS" BASIS,
12:         * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13:         * See the License for the specific language governing permissions and
14:         * limitations under the License.
15:         */
16:
17:        package org.springframework.aop.framework;
18:
19:        /**
20:         * Class containing static methods used to obtain information about the current AOP invocation.
21:         *
22:         * <p>The <code>currentProxy()</code> method is usable if the AOP framework is configured to
23:         * expose the current proxy (not the default). It returns the AOP proxy in use. Target objects
24:         * or advice can use this to make advised calls, in the same way as <code>getEJBObject()</code>
25:         * can be used in EJBs. They can also use it to find advice configuration.
26:         *
27:         * <p>Spring's AOP framework does not expose proxies by default, as there is a performance cost
28:         * in doing so.
29:         *
30:         * <p>The functionality in this class might be used by a target object that needed access
31:         * to resources on the invocation. However, this approach should not be used when there is
32:         * a reasonable alternative, as it makes application code dependent on usage under AOP and
33:         * the Spring AOP framework in particular.
34:         *
35:         * @author Rod Johnson
36:         * @author Juergen Hoeller
37:         * @since 13.03.2003
38:         */
39:        public abstract class AopContext {
40:
41:            /**
42:             * ThreadLocal holder for AOP proxy associated with this thread.
43:             * Will contain <code>null</code> unless the "exposeProxy" property on
44:             * the controlling proxy configuration has been set to "true".
45:             * @see ProxyConfig#setExposeProxy
46:             */
47:            private static final ThreadLocal currentProxy = new ThreadLocal();
48:
49:            /**
50:             * Try to return the current AOP proxy. This method is usable only if the
51:             * calling method has been invoked via AOP, and the AOP framework has been set
52:             * to expose proxies. Otherwise, this method will throw an IllegalStateException.
53:             * @return Object the current AOP proxy (never returns <code>null</code>)
54:             * @throws IllegalStateException if the proxy cannot be found, because the
55:             * method was invoked outside an AOP invocation context, or because the
56:             * AOP framework has not been configured to expose the proxy
57:             */
58:            public static Object currentProxy() throws IllegalStateException {
59:                Object proxy = currentProxy.get();
60:                if (proxy == null) {
61:                    throw new IllegalStateException(
62:                            "Cannot find current proxy: Set 'exposeProxy' property on Advised to 'true' to make it available.");
63:                }
64:                return proxy;
65:            }
66:
67:            /**
68:             * Make the given proxy available via the <code>currentProxy()</code> method.
69:             * <p>Note that the caller should be careful to keep the old value as appropriate.
70:             * @param proxy the proxy to expose (or <code>null</code> to reset it)
71:             * @return the old proxy, which may be <code>null</code> if none was bound
72:             * @see #currentProxy()
73:             */
74:            static Object setCurrentProxy(Object proxy) {
75:                Object old = currentProxy.get();
76:                currentProxy.set(proxy);
77:                return old;
78:            }
79:
80:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.