View Javadoc

1   /***
2    * Redistribution and use of this software and associated documentation
3    * ("Software"), with or without modification, are permitted provided
4    * that the following conditions are met:
5    *
6    * 1. Redistributions of source code must retain copyright
7    *    statements and notices.  Redistributions must also contain a
8    *    copy of this document.
9    *
10   * 2. Redistributions in binary form must reproduce the
11   *    above copyright notice, this list of conditions and the
12   *    following disclaimer in the documentation and/or other
13   *    materials provided with the distribution.
14   *
15   * 3. The name "Exolab" must not be used to endorse or promote
16   *    products derived from this Software without prior written
17   *    permission of Exoffice Technologies.  For written permission,
18   *    please contact info@exolab.org.
19   *
20   * 4. Products derived from this Software may not be called "Exolab"
21   *    nor may "Exolab" appear in their names without prior written
22   *    permission of Exoffice Technologies. Exolab is a registered
23   *    trademark of Exoffice Technologies.
24   *
25   * 5. Due credit should be given to the Exolab Project
26   *    (http://www.exolab.org/).
27   *
28   * THIS SOFTWARE IS PROVIDED BY EXOFFICE TECHNOLOGIES AND CONTRIBUTORS
29   * ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT
30   * NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
31   * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL
32   * EXOFFICE TECHNOLOGIES OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
33   * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
34   * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
35   * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
36   * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
37   * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
38   * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
39   * OF THE POSSIBILITY OF SUCH DAMAGE.
40   *
41   * Copyright 2000 (C) Exoffice Technologies Inc. All Rights Reserved.
42   *
43   * $Id: AdminConnection.java,v 1.4 2003/08/17 01:32:23 tanderson Exp $
44   *
45   * Date         Author  Changes
46   * $Date	    jimm    Created
47   */
48  
49  
50  package org.exolab.jms.jndiadministration;
51  
52  import java.util.Enumeration;
53  
54  
55  /***
56   * The abstract class all AdminConnection objects must inherit from.
57   * Currently there are only two object types. OfflineConnection, for objects
58   * that directly connect to and use the persistency mechanism, and
59   * OnlineConnection objects that connect to an OpenJMSServer for all
60   * their requests.
61   *
62   * @version     $Revision: 1.4 $ $Date: 2003/08/17 01:32:23 $
63   * @author      <a href="mailto:mourikis@exolab.org">Jim Mourikis</a>
64   * @see         OfflineConnection
65   * @see		OnlineConnection
66   */
67  public abstract class AdminConnection {
68  
69      protected static AdminConnection instance_ = null;
70  
71      /***
72       * Returns the one and only instance of the connection object.
73       *
74       * @return AdminConnection The one and only instance.
75       *
76       */
77      public static AdminConnection instance() {
78          return instance_;
79      }
80  
81      /***
82       * Close the connection.
83       *
84       */
85      public abstract void close();
86  
87  
88      /***
89       * Get an enumerated list of all the Contexts
90       *
91       * @return 	Enumeration The list of contexts
92       *
93       */
94      public abstract Enumeration getAllContexts(String name);
95  
96  
97      /***
98       * Return the object associated with this context.
99       * if none exists return null.
100      *
101      * @param context The context name
102      * @return Object	The object for this context.
103      *
104      */
105     public abstract Object lookup(String context);
106 
107 
108     /***
109      * Create a new context with the given name.
110      *
111      * @param name The new context name.
112      * @exception NamingException If the context cannot be created.
113      *
114      */
115     public abstract void createContext(String name)
116         throws javax.naming.NamingException;
117 
118 
119     /***
120      * Destroy context with the given name.
121      *
122      * @param name The new context name.
123      * @exception NamingException If the context cannot be created.
124      *
125      */
126     public abstract void destroyContext(String name)
127         throws javax.naming.NamingException;
128 
129 
130     /***
131      * Rename context with the given name.
132      *
133      * @param oldName The old context name
134      * @param newName The new context name
135      * @exception NamingException If the context cannot be created.
136      *
137      */
138     public abstract void renameContext(String oldName, String newName)
139         throws javax.naming.NamingException;
140 
141 
142     /***
143      * Rebind the context with the given object.
144      *
145      * @param name The context name
146      * @param ob The object to bind in this context
147      * @exception NamingException If the context cannot be created.
148      *
149      */
150     public abstract void rebind(String name, Object ob)
151         throws javax.naming.NamingException;
152 
153 } // End AdminConnection