Source Code Cross Referenced for ComponentDirContext.java in  » 6.0-JDK-Modules-com.sun » jndi » com » sun » jndi » toolkit » ctx » 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 » 6.0 JDK Modules com.sun » jndi » com.sun.jndi.toolkit.ctx 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * Copyright 1999 Sun Microsystems, Inc.  All Rights Reserved.
003:         * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
004:         *
005:         * This code is free software; you can redistribute it and/or modify it
006:         * under the terms of the GNU General Public License version 2 only, as
007:         * published by the Free Software Foundation.  Sun designates this
008:         * particular file as subject to the "Classpath" exception as provided
009:         * by Sun in the LICENSE file that accompanied this code.
010:         *
011:         * This code is distributed in the hope that it will be useful, but WITHOUT
012:         * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
013:         * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
014:         * version 2 for more details (a copy is included in the LICENSE file that
015:         * accompanied this code).
016:         *
017:         * You should have received a copy of the GNU General Public License version
018:         * 2 along with this work; if not, write to the Free Software Foundation,
019:         * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
020:         *
021:         * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
022:         * CA 95054 USA or visit www.sun.com if you need additional information or
023:         * have any questions.
024:         */
025:
026:        package com.sun.jndi.toolkit.ctx;
027:
028:        import javax.naming.*;
029:        import javax.naming.directory.*;
030:
031:        import javax.naming.spi.ResolveResult;
032:
033:        /* Direct subclasses of ComponentDirContext must provide implementations for
034:         * the abstract c_ DirContext methods, and override the c_ Context methods
035:         * (which are no longer abstract because they have been overriden by 
036:         * AtomicContext, the direct superclass of PartialDSCompositeContext).
037:         *
038:         * If the subclass is supports implicit nns, it must override all the
039:         * c_*_nns methods corresponding to those in DirContext and Context.
040:         * See ComponentContext for details.
041:         *
042:         * @author Rosanna Lee
043:         */
044:
045:        public abstract class ComponentDirContext extends
046:                PartialCompositeDirContext {
047:
048:            protected ComponentDirContext() {
049:                _contextType = _COMPONENT;
050:            }
051:
052:            // ------ Abstract methods whose implementations are provided by subclass
053:
054:            /* Equivalent to methods in DirContext */
055:            protected abstract Attributes c_getAttributes(Name name,
056:                    String[] attrIds, Continuation cont) throws NamingException;
057:
058:            protected abstract void c_modifyAttributes(Name name, int mod_op,
059:                    Attributes attrs, Continuation cont) throws NamingException;
060:
061:            protected abstract void c_modifyAttributes(Name name,
062:                    ModificationItem[] mods, Continuation cont)
063:                    throws NamingException;
064:
065:            protected abstract void c_bind(Name name, Object obj,
066:                    Attributes attrs, Continuation cont) throws NamingException;
067:
068:            protected abstract void c_rebind(Name name, Object obj,
069:                    Attributes attrs, Continuation cont) throws NamingException;
070:
071:            protected abstract DirContext c_createSubcontext(Name name,
072:                    Attributes attrs, Continuation cont) throws NamingException;
073:
074:            protected abstract NamingEnumeration c_search(Name name,
075:                    Attributes matchingAttributes, String[] attributesToReturn,
076:                    Continuation cont) throws NamingException;
077:
078:            protected abstract NamingEnumeration c_search(Name name,
079:                    String filter, SearchControls cons, Continuation cont)
080:                    throws NamingException;
081:
082:            protected abstract NamingEnumeration c_search(Name name,
083:                    String filterExpr, Object[] filterArgs,
084:                    SearchControls cons, Continuation cont)
085:                    throws NamingException;
086:
087:            protected abstract DirContext c_getSchema(Name name,
088:                    Continuation cont) throws NamingException;
089:
090:            protected abstract DirContext c_getSchemaClassDefinition(Name name,
091:                    Continuation cont) throws NamingException;
092:
093:            // ------- default implementations of c_*_nns methods from DirContext
094:
095:            // The following methods are called when the DirContext methods
096:            // are invoked with a name that has a trailing slash.
097:            // For naming systems that support implicit nns,
098:            // the trailing slash signifies the implicit nns.
099:            // For such naming systems, override these c_*_nns methods.
100:            //
101:            // For naming systems that support junctions (explicit nns),
102:            // the trailing slash is meaningless because a junction does not
103:            // have an implicit nns.  The default implementation here
104:            // throws a NameNotFoundException for such names.
105:            // If a context wants to accept a trailing slash as having 
106:            // the same meaning as the same name without a trailing slash,
107:            // then it should override these c_*_nns methods.
108:
109:            // See ComponentContext for details.
110:
111:            protected Attributes c_getAttributes_nns(Name name,
112:                    String[] attrIds, Continuation cont) throws NamingException {
113:                c_processJunction_nns(name, cont);
114:                return null;
115:            }
116:
117:            protected void c_modifyAttributes_nns(Name name, int mod_op,
118:                    Attributes attrs, Continuation cont) throws NamingException {
119:                c_processJunction_nns(name, cont);
120:            }
121:
122:            protected void c_modifyAttributes_nns(Name name,
123:                    ModificationItem[] mods, Continuation cont)
124:                    throws NamingException {
125:                c_processJunction_nns(name, cont);
126:            }
127:
128:            protected void c_bind_nns(Name name, Object obj, Attributes attrs,
129:                    Continuation cont) throws NamingException {
130:                c_processJunction_nns(name, cont);
131:            }
132:
133:            protected void c_rebind_nns(Name name, Object obj,
134:                    Attributes attrs, Continuation cont) throws NamingException {
135:                c_processJunction_nns(name, cont);
136:            }
137:
138:            protected DirContext c_createSubcontext_nns(Name name,
139:                    Attributes attrs, Continuation cont) throws NamingException {
140:                c_processJunction_nns(name, cont);
141:                return null;
142:            }
143:
144:            protected NamingEnumeration c_search_nns(Name name,
145:                    Attributes matchingAttributes, String[] attributesToReturn,
146:                    Continuation cont) throws NamingException {
147:                c_processJunction_nns(name, cont);
148:                return null;
149:            }
150:
151:            protected NamingEnumeration c_search_nns(Name name, String filter,
152:                    SearchControls cons, Continuation cont)
153:                    throws NamingException {
154:                c_processJunction_nns(name, cont);
155:                return null;
156:            }
157:
158:            protected NamingEnumeration c_search_nns(Name name,
159:                    String filterExpr, Object[] filterArgs,
160:                    SearchControls cons, Continuation cont)
161:                    throws NamingException {
162:                c_processJunction_nns(name, cont);
163:                return null;
164:            }
165:
166:            protected DirContext c_getSchema_nns(Name name, Continuation cont)
167:                    throws NamingException {
168:                c_processJunction_nns(name, cont);
169:                return null;
170:            }
171:
172:            protected DirContext c_getSchemaClassDefinition_nns(Name name,
173:                    Continuation cont) throws NamingException {
174:                c_processJunction_nns(name, cont);
175:                return null;
176:            }
177:
178:            // ------- implementations of p_ DirContext methods using corresponding 
179:            // ------- DirContext c_ and c_*_nns methods
180:
181:            /* Implements for abstract methods declared in PartialCompositeDirContext */
182:            protected Attributes p_getAttributes(Name name, String[] attrIds,
183:                    Continuation cont) throws NamingException {
184:                HeadTail res = p_resolveIntermediate(name, cont);
185:                Attributes answer = null;
186:                switch (res.getStatus()) {
187:                case TERMINAL_NNS_COMPONENT:
188:                    answer = c_getAttributes_nns(res.getHead(), attrIds, cont);
189:                    break;
190:
191:                case TERMINAL_COMPONENT:
192:                    answer = c_getAttributes(res.getHead(), attrIds, cont);
193:                    break;
194:
195:                default:
196:                    /* USE_CONTINUATION */
197:                    /* cont already set or exception thrown */
198:                    break;
199:                }
200:                return answer;
201:            }
202:
203:            protected void p_modifyAttributes(Name name, int mod_op,
204:                    Attributes attrs, Continuation cont) throws NamingException {
205:                HeadTail res = p_resolveIntermediate(name, cont);
206:                switch (res.getStatus()) {
207:                case TERMINAL_NNS_COMPONENT:
208:                    c_modifyAttributes_nns(res.getHead(), mod_op, attrs, cont);
209:                    break;
210:
211:                case TERMINAL_COMPONENT:
212:                    c_modifyAttributes(res.getHead(), mod_op, attrs, cont);
213:                    break;
214:
215:                default:
216:                    /* USE_CONTINUATION */
217:                    /* cont already set or exception thrown */
218:                    break;
219:                }
220:            }
221:
222:            protected void p_modifyAttributes(Name name,
223:                    ModificationItem[] mods, Continuation cont)
224:                    throws NamingException {
225:                HeadTail res = p_resolveIntermediate(name, cont);
226:                switch (res.getStatus()) {
227:                case TERMINAL_NNS_COMPONENT:
228:                    c_modifyAttributes_nns(res.getHead(), mods, cont);
229:                    break;
230:
231:                case TERMINAL_COMPONENT:
232:                    c_modifyAttributes(res.getHead(), mods, cont);
233:                    break;
234:
235:                default:
236:                    /* USE_CONTINUATION */
237:                    /* cont already set or exception thrown */
238:                    break;
239:                }
240:            }
241:
242:            protected void p_bind(Name name, Object obj, Attributes attrs,
243:                    Continuation cont) throws NamingException {
244:                HeadTail res = p_resolveIntermediate(name, cont);
245:                switch (res.getStatus()) {
246:                case TERMINAL_NNS_COMPONENT:
247:                    c_bind_nns(res.getHead(), obj, attrs, cont);
248:                    break;
249:
250:                case TERMINAL_COMPONENT:
251:                    c_bind(res.getHead(), obj, attrs, cont);
252:                    break;
253:
254:                default:
255:                    /* USE_CONTINUATION */
256:                    /* cont already set or exception thrown */
257:                    break;
258:                }
259:            }
260:
261:            protected void p_rebind(Name name, Object obj, Attributes attrs,
262:                    Continuation cont) throws NamingException {
263:                HeadTail res = p_resolveIntermediate(name, cont);
264:                switch (res.getStatus()) {
265:                case TERMINAL_NNS_COMPONENT:
266:                    c_rebind_nns(res.getHead(), obj, attrs, cont);
267:                    break;
268:
269:                case TERMINAL_COMPONENT:
270:                    c_rebind(res.getHead(), obj, attrs, cont);
271:                    break;
272:
273:                default:
274:                    /* USE_CONTINUATION */
275:                    /* cont already set or exception thrown */
276:                    break;
277:                }
278:            }
279:
280:            protected DirContext p_createSubcontext(Name name,
281:                    Attributes attrs, Continuation cont) throws NamingException {
282:                HeadTail res = p_resolveIntermediate(name, cont);
283:                DirContext answer = null;
284:                switch (res.getStatus()) {
285:                case TERMINAL_NNS_COMPONENT:
286:                    answer = c_createSubcontext_nns(res.getHead(), attrs, cont);
287:                    break;
288:
289:                case TERMINAL_COMPONENT:
290:                    answer = c_createSubcontext(res.getHead(), attrs, cont);
291:                    break;
292:
293:                default:
294:                    /* USE_CONTINUATION */
295:                    /* cont already set or exception thrown */
296:                    break;
297:                }
298:                return answer;
299:            }
300:
301:            protected NamingEnumeration p_search(Name name,
302:                    Attributes matchingAttributes, String[] attributesToReturn,
303:                    Continuation cont) throws NamingException {
304:                HeadTail res = p_resolveIntermediate(name, cont);
305:                NamingEnumeration answer = null;
306:                switch (res.getStatus()) {
307:                case TERMINAL_NNS_COMPONENT:
308:                    answer = c_search_nns(res.getHead(), matchingAttributes,
309:                            attributesToReturn, cont);
310:                    break;
311:
312:                case TERMINAL_COMPONENT:
313:                    answer = c_search(res.getHead(), matchingAttributes,
314:                            attributesToReturn, cont);
315:                    break;
316:
317:                default:
318:                    /* USE_CONTINUATION */
319:                    /* cont already set or exception thrown */
320:                    break;
321:                }
322:                return answer;
323:            }
324:
325:            protected NamingEnumeration p_search(Name name, String filter,
326:                    SearchControls cons, Continuation cont)
327:                    throws NamingException {
328:                HeadTail res = p_resolveIntermediate(name, cont);
329:                NamingEnumeration answer = null;
330:                switch (res.getStatus()) {
331:                case TERMINAL_NNS_COMPONENT:
332:                    answer = c_search_nns(res.getHead(), filter, cons, cont);
333:                    break;
334:
335:                case TERMINAL_COMPONENT:
336:                    answer = c_search(res.getHead(), filter, cons, cont);
337:                    break;
338:
339:                default:
340:                    /* USE_CONTINUATION */
341:                    /* cont already set or exception thrown */
342:                    break;
343:                }
344:                return answer;
345:            }
346:
347:            protected NamingEnumeration p_search(Name name, String filterExpr,
348:                    Object[] filterArgs, SearchControls cons, Continuation cont)
349:                    throws NamingException {
350:                HeadTail res = p_resolveIntermediate(name, cont);
351:                NamingEnumeration answer = null;
352:                switch (res.getStatus()) {
353:                case TERMINAL_NNS_COMPONENT:
354:                    answer = c_search_nns(res.getHead(), filterExpr,
355:                            filterArgs, cons, cont);
356:                    break;
357:
358:                case TERMINAL_COMPONENT:
359:                    answer = c_search(res.getHead(), filterExpr, filterArgs,
360:                            cons, cont);
361:                    break;
362:
363:                default:
364:                    /* USE_CONTINUATION */
365:                    /* cont already set or exception thrown */
366:                    break;
367:                }
368:                return answer;
369:            }
370:
371:            protected DirContext p_getSchema(Name name, Continuation cont)
372:                    throws NamingException {
373:                DirContext answer = null;
374:                HeadTail res = p_resolveIntermediate(name, cont);
375:                switch (res.getStatus()) {
376:                case TERMINAL_NNS_COMPONENT:
377:                    answer = c_getSchema_nns(res.getHead(), cont);
378:                    break;
379:
380:                case TERMINAL_COMPONENT:
381:                    answer = c_getSchema(res.getHead(), cont);
382:                    break;
383:
384:                default:
385:                    /* USE_CONTINUATION */
386:                    /* cont already set or exception thrown */
387:                    break;
388:                }
389:                return answer;
390:            }
391:
392:            protected DirContext p_getSchemaClassDefinition(Name name,
393:                    Continuation cont) throws NamingException {
394:                DirContext answer = null;
395:                HeadTail res = p_resolveIntermediate(name, cont);
396:                switch (res.getStatus()) {
397:                case TERMINAL_NNS_COMPONENT:
398:                    answer = c_getSchemaClassDefinition_nns(res.getHead(), cont);
399:                    break;
400:
401:                case TERMINAL_COMPONENT:
402:                    answer = c_getSchemaClassDefinition(res.getHead(), cont);
403:                    break;
404:
405:                default:
406:                    /* USE_CONTINUATION */
407:                    /* cont already set or exception thrown */
408:                    break;
409:                }
410:                return answer;
411:            }
412:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.