View Javadoc

1   /*
2    * Copyright (c) 1998-2002 The Jgroup Team.
3    *
4    * This program is free software; you can redistribute it and/or modify
5    * it under the terms of the GNU Lesser General Public License version 2 as
6    * published by the Free Software Foundation.
7    *
8    * This program is distributed in the hope that it will be useful,
9    * but WITHOUT ANY WARRANTY; without even the implied warranty of
10   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
11   * GNU Lesser General Public License for more details.
12   *
13   * You should have received a copy of the GNU Lesser General Public License
14   * along with this program; if not, write to the Free Software
15   * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
16   *
17   */
18  
19  package jgroup.core.registry;
20  
21  import java.rmi.RemoteException;
22  import java.rmi.server.*;
23  
24  import jgroup.core.JgroupException;
25  
26  
27  /**
28   *  This interface is the service provider interface for the registry
29   *  location service.  It is used by Jgroup to identify classes that are
30   *  able to retrieve proxies for registry service implementations and
31   *  create registry replicas.
32   *
33   *  @author Alberto Montresor
34   *  @author Hein Meling
35   *  @since Jgroup 0.8
36   */
37  public interface RegistryLocator
38  {
39  
40    /**
41     *  Returns a proxy for the dependable registry service.
42     *
43     *  @return 
44     *    A proxy for the dependable registry service.
45     *
46     *  @exception RemoteException 
47     *    Raised if the proxy could not be obtained.
48     *  @exception ConfigurationException
49     *    Raised if there was a problem parsing the distributed system
50     *    configuration file.
51     */
52    public DependableRegistry getRegistry()
53      throws JgroupException, RemoteException;
54  
55  
56    /**
57     *  Returns a proxy for the dependable registry service.
58     *
59     *  Communication with this remote registry will use the supplied
60     *  <code>RMIClientSocketFactory</code> to create socket connections
61     *  to the dependable registry on the distributed system and port.
62     *
63     *  @param csf
64     *    Client-side socket factory used to make connections to the
65     *    dependable registry. If <code>csf</code> is null, then the
66     *    default client-side socket factory will be used.
67     *
68     *  @return 
69     *    A proxy for the dependable registry service.
70     *
71     *  @exception RemoteException 
72     *    Raised if the proxy could not be obtained.
73     *  @exception ConfigurationException
74     *    Raised if there was a problem parsing the distributed system
75     *    configuration file.
76     */
77    public DependableRegistry getRegistry(RMIClientSocketFactory csf)
78      throws JgroupException, RemoteException;
79  
80  
81    /**
82     *  Creates and exports a dependable registry replica on the local
83     *  host listening for incoming requests on an the port specified in
84     *  the system configuration file. <p>
85     *
86     *  @return 
87     *    The newly created dependable registry replica.
88     *
89     *  @exception RemoteException
90     *    Raised if the registry could not be exported.
91     *  @exception JgroupException
92     *    Raised if a registry instance could not be created.
93     *  @exception ConfigurationException
94     *    Raised if there was a problem parsing the distributed system
95     *    configuration file.
96     */
97    public DependableRegistry createRegistry()
98      throws JgroupException, RemoteException;
99  
100 
101   /**
102    *  Creates and exports a dependable registry replica on the local
103    *  host listening for incoming requests on an the port specified in
104    *  the system configuration file. <p>
105    *
106    *  The new instance of the dependable registry listens to incoming
107    *  requests using a <code>ServerSocket</code> created from the
108    *  supplied <code>RMIServerSocketFactory</code>.  A client that
109    *  receives a reference to this registry will then use a
110    *  <code>Socket</code> created from the supplied
111    *  <code>RMIClientSocketFactory</code>.
112    *
113    *  @param csf
114    *    Client-side <code>Socket</code> factory used to make connections
115    *    to the registry.
116    *  @param ssf
117    *    Server-side <code>ServerSocket</code> factory used to accept
118    *    connections to the registry.
119    *
120    *  @return 
121    *    The newly created dependable registry replica.
122    *
123    *  @exception RemoteException
124    *    Raised if the registry could not be exported.
125    *  @exception JgroupException
126    *    Raised if a registry instance could not be created.
127    *  @exception ConfigurationException
128    *    Raised if there was a problem parsing the distributed system
129    *    configuration file.
130    */
131   public DependableRegistry createRegistry(RMIClientSocketFactory csf, RMIServerSocketFactory ssf)
132     throws JgroupException, RemoteException;
133 
134   
135   /**
136    * Returns a LookupRegistry interface, which can be used
137    * by clients to lookup a remote reference from registry.
138    * 
139    * @return 
140    *   LookupRegistry with methods to lookup remote ref from registry.
141    */
142   public LookupRegistry getLookupRegistry()
143     throws JgroupException, RemoteException;
144 
145 } // END RegistryLocator