Source Code Cross Referenced for SimpleNamingManager.java in  » Database-ORM » Speedo_1.4.5 » org » objectweb » speedo » runtime » jca » 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 ORM » Speedo_1.4.5 » org.objectweb.speedo.runtime.jca 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /**
002:         * Copyright (C) 2001-2004 France Telecom R&D
003:         *
004:         * This library is free software; you can redistribute it and/or
005:         * modify it under the terms of the GNU Lesser General Public
006:         * License as published by the Free Software Foundation; either
007:         * version 2 of the License, or (at your option) any later version.
008:         *
009:         * This library is distributed in the hope that it will be useful,
010:         * but WITHOUT ANY WARRANTY; without even the implied warranty of
011:         * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
012:         * Lesser General Public License for more details.
013:         *
014:         * You should have received a copy of the GNU Lesser General Public
015:         * License along with this library; if not, write to the Free Software
016:         * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
017:         */package org.objectweb.speedo.runtime.jca;
018:
019:        import javax.naming.spi.InitialContextFactory;
020:        import javax.naming.Context;
021:        import javax.naming.NamingException;
022:        import javax.naming.Name;
023:        import javax.naming.NamingEnumeration;
024:        import javax.naming.NameParser;
025:        import java.util.Hashtable;
026:
027:        /**
028:         *
029:         * @author S.Chassande-Barrioz
030:         */
031:        public class SimpleNamingManager implements  InitialContextFactory {
032:
033:            private static SimpleContext ictx;
034:
035:            public SimpleNamingManager() {
036:            }
037:
038:            public Context getInitialContext(Hashtable environment)
039:                    throws NamingException {
040:                if (ictx == null) {
041:                    ictx = new SimpleContext(environment);
042:                } else {
043:                    ictx.context.putAll(environment);
044:                }
045:                return ictx;
046:            }
047:
048:            class SimpleContext implements  Context {
049:
050:                public Hashtable context;
051:
052:                public SimpleContext(Hashtable context) {
053:                    this .context = context;
054:                }
055:
056:                private String name2String(Name n) {
057:                    StringBuffer sb = new StringBuffer("");
058:                    String sep = "";
059:                    for (int i = 0; i < n.size(); i++) {
060:                        sb.append(sep);
061:                        sep = ".";
062:                        sb.append(n.get(i));
063:                    }
064:                    return sb.toString();
065:                }
066:
067:                // IMPLEMENTATION OF THE Context INTERFACE //
068:                //-----------------------------------------//
069:
070:                public Object lookup(Name name) throws NamingException {
071:                    return context.get(name2String(name));
072:                }
073:
074:                public Object lookup(String name) throws NamingException {
075:                    return context.get(name);
076:                }
077:
078:                public void bind(Name name, Object obj) throws NamingException {
079:                    String n = name2String(name);
080:                    if (context.containsKey(n)) {
081:                        throw new NamingException(n + " already bound: "
082:                                + context.get(n));
083:                    } else {
084:                        context.put(n, obj);
085:                    }
086:                }
087:
088:                public void bind(String n, Object obj) throws NamingException {
089:                    if (context.containsKey(n)) {
090:                        throw new NamingException(n + " already bound: "
091:                                + context.get(n));
092:                    } else {
093:                        context.put(n, obj);
094:                    }
095:                }
096:
097:                public void rebind(Name name, Object obj)
098:                        throws NamingException {
099:                    context.put(name2String(name), obj);
100:                }
101:
102:                public void rebind(String n, Object obj) throws NamingException {
103:                    context.put(n, obj);
104:                }
105:
106:                public void unbind(Name name) throws NamingException {
107:                    context.remove(name2String(name));
108:                }
109:
110:                public void unbind(String name) throws NamingException {
111:                    context.remove(name);
112:                }
113:
114:                public void rename(Name oldName, Name newName)
115:                        throws NamingException {
116:                    bind(newName, lookup(oldName));
117:                    unbind(oldName);
118:                }
119:
120:                public void rename(String oldName, String newName)
121:                        throws NamingException {
122:                    bind(newName, lookup(oldName));
123:                    unbind(oldName);
124:                }
125:
126:                public NamingEnumeration list(Name name) throws NamingException {
127:                    return null;
128:                }
129:
130:                public NamingEnumeration list(String name)
131:                        throws NamingException {
132:                    return null;
133:                }
134:
135:                public NamingEnumeration listBindings(Name name)
136:                        throws NamingException {
137:                    return null;
138:                }
139:
140:                public NamingEnumeration listBindings(String name)
141:                        throws NamingException {
142:                    return null;
143:                }
144:
145:                public void destroySubcontext(Name name) throws NamingException {
146:                }
147:
148:                public void destroySubcontext(String name)
149:                        throws NamingException {
150:                }
151:
152:                public Context createSubcontext(Name name)
153:                        throws NamingException {
154:                    return null;
155:                }
156:
157:                public Context createSubcontext(String name)
158:                        throws NamingException {
159:                    return null;
160:                }
161:
162:                public Object lookupLink(Name name) throws NamingException {
163:                    return null;
164:                }
165:
166:                public Object lookupLink(String name) throws NamingException {
167:                    return null;
168:                }
169:
170:                public NameParser getNameParser(Name name)
171:                        throws NamingException {
172:                    return null;
173:                }
174:
175:                public NameParser getNameParser(String name)
176:                        throws NamingException {
177:                    return null;
178:                }
179:
180:                public Name composeName(Name name, Name prefix)
181:                        throws NamingException {
182:                    return null;
183:                }
184:
185:                public String composeName(String name, String prefix)
186:                        throws NamingException {
187:                    return null;
188:                }
189:
190:                public Object addToEnvironment(String propName, Object propVal)
191:                        throws NamingException {
192:                    return null;
193:                }
194:
195:                public Object removeFromEnvironment(String propName)
196:                        throws NamingException {
197:                    return null;
198:                }
199:
200:                public Hashtable getEnvironment() throws NamingException {
201:                    return context;
202:                }
203:
204:                public void close() throws NamingException {
205:                }
206:
207:                public String getNameInNamespace() throws NamingException {
208:                    return null;
209:                }
210:            }
211:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.