Source Code Cross Referenced for JNDIProvided.java in  » Inversion-of-Control » PicoContainer » org » picocontainer » gems » jndi » 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 » Inversion of Control » PicoContainer » org.picocontainer.gems.jndi 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*****************************************************************************
002:         * Copyright (c) PicoContainer Organization. All rights reserved.            *
003:         * ------------------------------------------------------------------------- *
004:         * The software in this package is published under the terms of the BSD      *
005:         * style license a copy of which has been included with this distribution in *
006:         * the LICENSE.txt file.                                                     *
007:         *                                                                           *
008:         *****************************************************************************/package org.picocontainer.gems.jndi;
009:
010:        import java.io.Serializable;
011:
012:        import javax.naming.NamingException;
013:
014:        import org.picocontainer.ComponentAdapter;
015:        import org.picocontainer.PicoCompositionException;
016:        import org.picocontainer.PicoContainer;
017:        import org.picocontainer.PicoVisitor;
018:
019:        /**
020:         * represents dependency provided via JNDI. This dependency is not 
021:         * to be managed by container at all, so there is no lifecycle, no 
022:         * monitoring etc. 
023:         * @author Konstantin Pribluda
024:         *
025:         */
026:        public class JNDIProvided<T> implements  ComponentAdapter<T>,
027:                Serializable {
028:
029:            JNDIObjectReference<T> jndiReference;
030:
031:            Object componentKey;
032:
033:            /**
034:             * create adapter with specified key and reference
035:             * @param componentKey component key
036:             * @param reference JNDI reference storing component
037:             */
038:            public JNDIProvided(Object componentKey,
039:                    JNDIObjectReference<T> reference) {
040:                this .componentKey = componentKey;
041:                this .jndiReference = reference;
042:            }
043:
044:            /**
045:             * create adapter with JNDI reference. referenced object class will be 
046:             * takes as key
047:             * @param reference JNDI reference storing component
048:             */
049:            public JNDIProvided(JNDIObjectReference<T> reference) {
050:                this (reference.get().getClass(), reference);
051:            }
052:
053:            /**
054:             * create adapter based on JNDI name. I leave this unchecked because
055:             * type is really not known at this time
056:             * @param jndiName name to be used
057:             * @throws NamingException will be thrown if something goes 
058:             * wrong in JNDI
059:             */
060:            @SuppressWarnings("unchecked")
061:            public JNDIProvided(String jndiName) throws NamingException {
062:                this (new JNDIObjectReference(jndiName));
063:            }
064:
065:            public Object getComponentKey() {
066:                return componentKey;
067:            }
068:
069:            @SuppressWarnings("unchecked")
070:            public Class getComponentImplementation() {
071:                return jndiReference.get().getClass();
072:            }
073:
074:            /**
075:             * retrieve instance out of JNDI
076:             */
077:            public T getComponentInstance(PicoContainer container)
078:                    throws PicoCompositionException {
079:                return jndiReference.get();
080:            }
081:
082:            /**
083:             * we have nothing to verify here
084:             */
085:            public void verify(PicoContainer container)
086:                    throws PicoCompositionException {
087:            }
088:
089:            /**
090:             * as there is no puprose of proceeding further down, 
091:             * we do nothing here
092:             */
093:            public void accept(PicoVisitor visitor) {
094:            }
095:
096:            public ComponentAdapter<T> getDelegate() {
097:                return null;
098:            }
099:
100:            public <U extends ComponentAdapter> U findAdapterOfType(
101:                    Class<U> componentAdapterType) {
102:                return null;
103:            }
104:
105:            public String getDescriptor() {
106:                return "JNDI(" + jndiReference.getName() + ")";
107:            }
108:
109:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.