Source Code Cross Referenced for OpenEJBContext.java in  » J2EE » openejb3 » org » apache » openejb » tomcat » catalina » 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 » openejb3 » org.apache.openejb.tomcat.catalina 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /**
002:         *
003:         * Licensed to the Apache Software Foundation (ASF) under one or more
004:         * contributor license agreements.  See the NOTICE file distributed with
005:         * this work for additional information regarding copyright ownership.
006:         * The ASF licenses this file to You under the Apache License, Version 2.0
007:         * (the "License"); you may not use this file except in compliance with
008:         * the License.  You may obtain a copy of the License at
009:         *
010:         *     http://www.apache.org/licenses/LICENSE-2.0
011:         *
012:         *  Unless required by applicable law or agreed to in writing, software
013:         *  distributed under the License is distributed on an "AS IS" BASIS,
014:         *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
015:         *  See the License for the specific language governing permissions and
016:         *  limitations under the License.
017:         */package org.apache.openejb.tomcat.catalina;
018:
019:        import org.apache.openejb.core.ThreadContext;
020:
021:        import javax.naming.Binding;
022:        import javax.naming.Context;
023:        import javax.naming.Name;
024:        import javax.naming.NameClassPair;
025:        import javax.naming.NameParser;
026:        import javax.naming.NamingEnumeration;
027:        import javax.naming.NamingException;
028:        import java.util.Hashtable;
029:
030:        public class OpenEJBContext implements  Context {
031:            private static final String URL_PREFIX = "comp";
032:
033:            public Object lookup(Name name) throws NamingException {
034:                return getThreadContext().lookup(addUrlPrefix(name));
035:            }
036:
037:            public Object lookup(String name) throws NamingException {
038:                return getThreadContext().lookup(addUrlPrefix(name));
039:            }
040:
041:            public void bind(Name name, Object obj) throws NamingException {
042:                getThreadContext().bind(addUrlPrefix(name), obj);
043:            }
044:
045:            public void bind(String name, Object obj) throws NamingException {
046:                getThreadContext().bind(addUrlPrefix(name), obj);
047:            }
048:
049:            public void rebind(Name name, Object obj) throws NamingException {
050:                getThreadContext().rebind(addUrlPrefix(name), obj);
051:            }
052:
053:            public void rebind(String name, Object obj) throws NamingException {
054:                getThreadContext().rebind(addUrlPrefix(name), obj);
055:            }
056:
057:            public void unbind(Name name) throws NamingException {
058:                getThreadContext().unbind(addUrlPrefix(name));
059:            }
060:
061:            public void unbind(String name) throws NamingException {
062:                getThreadContext().unbind(addUrlPrefix(name));
063:            }
064:
065:            public void rename(Name oldName, Name newName)
066:                    throws NamingException {
067:                getThreadContext().rename(addUrlPrefix(oldName),
068:                        addUrlPrefix(newName));
069:            }
070:
071:            public void rename(String oldName, String newName)
072:                    throws NamingException {
073:                getThreadContext().rename(addUrlPrefix(oldName),
074:                        addUrlPrefix(newName));
075:            }
076:
077:            public NamingEnumeration<NameClassPair> list(Name name)
078:                    throws NamingException {
079:                return getThreadContext().list(addUrlPrefix(name));
080:            }
081:
082:            public NamingEnumeration<NameClassPair> list(String name)
083:                    throws NamingException {
084:                return getThreadContext().list(addUrlPrefix(name));
085:            }
086:
087:            public NamingEnumeration<Binding> listBindings(Name name)
088:                    throws NamingException {
089:                return getThreadContext().listBindings(addUrlPrefix(name));
090:            }
091:
092:            public NamingEnumeration<Binding> listBindings(String name)
093:                    throws NamingException {
094:                return getThreadContext().listBindings(addUrlPrefix(name));
095:            }
096:
097:            public void destroySubcontext(Name name) throws NamingException {
098:                getThreadContext().destroySubcontext(addUrlPrefix(name));
099:            }
100:
101:            public void destroySubcontext(String name) throws NamingException {
102:                getThreadContext().destroySubcontext(addUrlPrefix(name));
103:            }
104:
105:            public Context createSubcontext(Name name) throws NamingException {
106:                return getThreadContext().createSubcontext(addUrlPrefix(name));
107:            }
108:
109:            public Context createSubcontext(String name) throws NamingException {
110:                return getThreadContext().createSubcontext(addUrlPrefix(name));
111:            }
112:
113:            public Object lookupLink(Name name) throws NamingException {
114:                return getThreadContext().lookupLink(addUrlPrefix(name));
115:            }
116:
117:            public Object lookupLink(String name) throws NamingException {
118:                return getThreadContext().lookupLink(addUrlPrefix(name));
119:            }
120:
121:            public NameParser getNameParser(Name name) throws NamingException {
122:                return getThreadContext().getNameParser(addUrlPrefix(name));
123:            }
124:
125:            public NameParser getNameParser(String name) throws NamingException {
126:                return getThreadContext().getNameParser(addUrlPrefix(name));
127:            }
128:
129:            public Name composeName(Name name, Name prefix)
130:                    throws NamingException {
131:                return getThreadContext().composeName(addUrlPrefix(name),
132:                        prefix);
133:            }
134:
135:            public String composeName(String name, String prefix)
136:                    throws NamingException {
137:                return getThreadContext().composeName(addUrlPrefix(name),
138:                        prefix);
139:            }
140:
141:            public Object addToEnvironment(String propName, Object propVal)
142:                    throws NamingException {
143:                return getThreadContext().addToEnvironment(propName, propVal);
144:            }
145:
146:            public Object removeFromEnvironment(String propName)
147:                    throws NamingException {
148:                return getThreadContext().removeFromEnvironment(propName);
149:            }
150:
151:            public Hashtable<?, ?> getEnvironment() throws NamingException {
152:                return getThreadContext().getEnvironment();
153:            }
154:
155:            public void close() throws NamingException {
156:                getThreadContext().close();
157:            }
158:
159:            public String getNameInNamespace() throws NamingException {
160:                return URL_PREFIX;
161:            }
162:
163:            private Context getThreadContext() throws NamingException {
164:                ThreadContext threadContext = ThreadContext.getThreadContext();
165:                Context context = threadContext.getDeploymentInfo()
166:                        .getJndiEnc();
167:                return context;
168:            }
169:
170:            private String addUrlPrefix(String name) throws NamingException {
171:                if (name.startsWith(URL_PREFIX)) {
172:                    return name.substring(URL_PREFIX.length());
173:                }
174:                return name;
175:            }
176:
177:            private Name addUrlPrefix(Name name) throws NamingException {
178:                if (!name.isEmpty() || !name.get(0).equals(URL_PREFIX)) {
179:                    return name.getSuffix(1);
180:                }
181:                return name;
182:            }
183:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.