Source Code Cross Referenced for InvokerFacade.java in  » Database-JDBC-Connection-Pool » proxool » org » logicalcobwebs » proxool » proxy » 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 » Database JDBC Connection Pool » proxool » org.logicalcobwebs.proxool.proxy 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


01:        /*
02:         * This software is released under a licence similar to the Apache Software Licence.
03:         * See org.logicalcobwebs.proxool.package.html for details.
04:         * The latest version is available at http://proxool.sourceforge.net
05:         */
06:        package org.logicalcobwebs.proxool.proxy;
07:
08:        import org.logicalcobwebs.proxool.ProxoolException;
09:
10:        import java.util.Map;
11:        import java.util.HashMap;
12:        import java.lang.reflect.Method;
13:        import java.lang.reflect.Modifier;
14:
15:        /**
16:         * Invokes a method using a cached method.
17:         * @version $Revision: 1.3 $, $Date: 2004/07/13 21:13:14 $
18:         * @author billhorsman
19:         * @author $Author: billhorsman $ (current maintainer)
20:         * @since Proxool 0.9
21:         */
22:        public class InvokerFacade {
23:
24:            private static Map methodMappers = new HashMap();
25:
26:            /**
27:             * Returns the method in the concrete class with an indentical signature to that passed
28:             * @param concreteClass the class that we want to invoke methods on. It should either implement all methods on
29:             * the injectable interface, or provide methods with an identical signature.
30:             * @param injectableMethod provides signature that we are trying to match
31:             * @return the method in the concrete class that we can invoke as if it were in the interface
32:             * @throws org.logicalcobwebs.proxool.ProxoolException if the method is not found.
33:             */
34:            public static Method getConcreteMethod(Class concreteClass,
35:                    Method injectableMethod) throws ProxoolException {
36:                // Unless the concrete class is public we can't do anything
37:                if (Modifier.isPublic(concreteClass.getModifiers())) {
38:                    Object key = concreteClass.getName() + ":"
39:                            + injectableMethod.getName();
40:                    MethodMapper methodMapper = (MethodMapper) methodMappers
41:                            .get(key);
42:                    if (methodMapper == null) {
43:                        methodMapper = new MethodMapper(concreteClass);
44:                        methodMappers.put(key, methodMapper);
45:                    }
46:                    return methodMapper.getConcreteMethod(injectableMethod);
47:                } else {
48:                    return injectableMethod;
49:                }
50:            }
51:
52:            /**
53:             * Override the method provided by the {@link #getConcreteMethod(java.lang.Class, java.lang.reflect.Method)}. Use this
54:             * if you decide that the concrete method provided wasn't any good. For instance, if you get an IllegalAccessException
55:             * whilst invoking the concrete method then you should perhaps try using the proxy supplied method instead.
56:             * @param concreteClass the class we are invoking upon
57:             * @param injectableMethod the method supplied by the proxy
58:             * @param overridenMethod the one we are going to use (probably the same as injectrableMethod actually)
59:             */
60:            public static void overrideConcreteMethod(Class concreteClass,
61:                    Method injectableMethod, Method overridenMethod) {
62:                Object key = concreteClass.getName() + ":"
63:                        + injectableMethod.getName();
64:                MethodMapper methodMapper = (MethodMapper) methodMappers
65:                        .get(key);
66:                if (methodMapper == null) {
67:                    methodMapper = new MethodMapper(concreteClass);
68:                    methodMappers.put(key, methodMapper);
69:                }
70:                methodMapper.overrideConcreteMethod(injectableMethod,
71:                        overridenMethod);
72:            }
73:
74:        }
75:        /*
76:         Revision history:
77:         $Log: InvokerFacade.java,v $
78:         Revision 1.3  2004/07/13 21:13:14  billhorsman
79:         Optimise using injectable interfaces on methods that are declared in non-public classes by not bothering to use concrete methods at all (it's not possible).
80:
81:         Revision 1.2  2004/07/13 21:06:16  billhorsman
82:         Fix problem using injectable interfaces on methods that are declared in non-public classes.
83:
84:         Revision 1.1  2004/06/02 20:43:53  billhorsman
85:         New classes to support injectable interfaces
86:
87:         */
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.