Source Code Cross Referenced for PicoBasedSpringFactory.java in  » Web-Server » JicarillaHTTP » org » jicarilla » container » integration » spring » 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 » Web Server » JicarillaHTTP » org.jicarilla.container.integration.spring 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /* ====================================================================
002:        The Jicarilla Software License
003:
004:        Copyright (c) 2003 Leo Simons.
005:        All rights reserved.
006:
007:        Permission is hereby granted, free of charge, to any person obtaining
008:        a copy of this software and associated documentation files (the
009:        "Software"), to deal in the Software without restriction, including
010:        without limitation the rights to use, copy, modify, merge, publish,
011:        distribute, sublicense, and/or sell copies of the Software, and to
012:        permit persons to whom the Software is furnished to do so, subject to
013:        the following conditions:
014:
015:        The above copyright notice and this permission notice shall be
016:        included in all copies or substantial portions of the Software.
017:
018:        THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
019:        EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
020:        MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
021:        IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
022:        CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
023:        TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
024:        SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
025:        ==================================================================== */
026:        package org.jicarilla.container.integration.spring;
027:
028:        import org.picocontainer.ComponentAdapter;
029:        import org.picocontainer.PicoContainer;
030:        import org.picocontainer.PicoException;
031:        import org.picocontainer.defaults.InstanceComponentAdapter;
032:        import org.springframework.beans.BeansException;
033:        import org.springframework.beans.factory.BeanFactory;
034:        import org.springframework.beans.factory.BeanNotOfRequiredTypeException;
035:        import org.springframework.beans.factory.NoSuchBeanDefinitionException;
036:
037:        /**
038:         * 
039:         *
040:         * @author <a href="lsimons at jicarilla dot org">Leo Simons</a>
041:         * @version $Id: PicoBasedSpringFactory.java,v 1.1 2004/03/08 21:05:25 lsimons Exp $
042:         */
043:        public class PicoBasedSpringFactory implements  BeanFactory {
044:            protected final PicoContainer m_container;
045:
046:            public PicoBasedSpringFactory(final PicoContainer container) {
047:                m_container = container;
048:            }
049:
050:            public Object getBean(final String name) throws BeansException {
051:                if (name == null)
052:                    throw new NoSuchBeanDefinitionException(name,
053:                            "The name parameter was null, which is not allowed!");
054:
055:                if (!m_container.hasComponent(name))
056:                    throw new NoSuchBeanDefinitionException(name,
057:                            "No entry exists for the bean name '" + name + "'");
058:
059:                try {
060:                    return m_container.getComponentInstance(name);
061:                } catch (PicoException pe) {
062:                    throw new SpringPicoBeansException(pe.getMessage(), pe);
063:                }
064:            }
065:
066:            public Object getBean(final String name, final Class requiredType)
067:                    throws BeansException {
068:                if (name == null)
069:                    throw new NoSuchBeanDefinitionException(name,
070:                            "The name parameter was null, which is not allowed!");
071:
072:                if (requiredType == null)
073:                    throw new NoSuchBeanDefinitionException(name,
074:                            "The requiredTupe parameter was null, which is not "
075:                                    + "allowed!");
076:
077:                if (!m_container.hasComponent(name))
078:                    throw new NoSuchBeanDefinitionException(name,
079:                            "No entry exists for the bean name '" + name + "'");
080:
081:                try {
082:                    final Object result = m_container
083:                            .getComponentInstance(name);
084:                    if (requiredType.isInstance(result))
085:                        return result;
086:                    else
087:                        throw new BeanNotOfRequiredTypeException(name,
088:                                requiredType, result);
089:                } catch (PicoException pe) {
090:                    throw new SpringPicoBeansException(pe.getMessage(), pe);
091:                }
092:            }
093:
094:            public boolean containsBean(final String name)
095:                    throws BeansException {
096:                return m_container.hasComponent(name);
097:            }
098:
099:            public boolean isSingleton(final String name)
100:                    throws NoSuchBeanDefinitionException {
101:                final ComponentAdapter adapter = m_container
102:                        .findComponentAdapter(name);
103:                if (adapter instanceof  InstanceComponentAdapter)
104:                    return true;
105:
106:                return false;
107:            }
108:
109:            public String[] getAliases(final String name)
110:                    throws NoSuchBeanDefinitionException {
111:                return new String[0];
112:            }
113:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.