KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > naming > core > DirContextHelper


1 /*
2  * Copyright 1999-2004 The Apache Software Foundation
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */

16
17 package org.apache.naming.core;
18
19 import javax.naming.directory.DirContext JavaDoc;
20
21 /**
22  * Utility class providing additional operations on DirContexts.
23  * Instead of extending DirContext we use a helper who will work
24  * on any context, including 'foreign' ones ( like JNDI, etc ).
25  *
26  * Typical methods - conversions ( int, boolean), etc.
27  *
28  * This code should check if the context extend our BaseDirContext
29  * and use specific features ( like notes - to cache the conversion
30  * results for example ), but fallback for external contexts.
31  *
32  * @author Costin Manolache
33  */

34 public class DirContextHelper {
35     static DirContextHelper instance=new DirContextHelper();
36     
37     public static DirContextHelper getInstance() {
38         return instance;
39     }
40     
41     
42     /** Debugging string - the context, imediate childs and attributes
43      */

44     public String JavaDoc toString(DirContext JavaDoc ctx) {
45         return "";
46     }
47
48     public int getIntAttribute( DirContext JavaDoc ctx, String JavaDoc name ) {
49         return 0;
50     }
51
52     public long getLongAttribute( DirContext JavaDoc ctx, String JavaDoc name ) {
53         return 0;
54     }
55
56     public String JavaDoc getStringAttribute( DirContext JavaDoc ctx, String JavaDoc name ) {
57         return null;
58     }
59
60     public boolean getBooleanAttribute( DirContext JavaDoc ctx, String JavaDoc name ) {
61         return false;
62     }
63 }
64
65
Popular Tags