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;
20  
21  import java.lang.reflect.InvocationHandler;
22  import java.rmi.Remote;
23  import java.rmi.RemoteException;
24  import java.rmi.server.ExportException;
25  
26  import jgroup.core.registry.DependableRegistry.RegistryEntry;
27  
28  
29  /**
30   *  This interface is used to obtain the identifier of the current
31   *  EGMI invocation and to get a registry entry and bootstrap handler
32   *  for the dependable registry.
33   *
34   *  @author Alberto Montresor
35   *  @author Hein Meling
36   *  @since Jgroup 0.8
37   */
38  public interface ExternalGMIService
39    extends Layer
40  {
41  
42    ////////////////////////////////////////////////////////////////////////////////////////////
43    // Nested interface
44    ////////////////////////////////////////////////////////////////////////////////////////////
45  
46    /**
47     * This interface must be implemented by all EGMI services that can
48     * be used by the bootstrap mechanism.
49     * 
50     * @author Tor Arve Stangeland
51     */
52    public interface BootstrapInvocationHandler
53      extends InvocationHandler, Remote
54    {
55  
56      /**
57       * Merge this handler with the given handler.
58       * 
59       * @param handler
60       *   <code>BootstrapInvoationHandler</code> handler to merge with
61       * 
62       * @throws JgroupException if merge failed for some reason
63       */
64      public void merge(BootstrapInvocationHandler handler)
65        throws JgroupException, RemoteException;
66    
67      /**
68       * Return the invocation handler type
69       */
70      public String getType()
71        throws RemoteException;
72  
73    } // END of BootstrapInvocationHandler
74  
75  
76    ////////////////////////////////////////////////////////////////////////////////////////////
77    // Interface methods
78    ////////////////////////////////////////////////////////////////////////////////////////////
79  
80    /**
81     *  Returns the invocation identifier for the current external group
82     *  method invocation.
83     */
84    public IID getIdentifier();
85  
86    /**
87     *  Returns the registry entry type required for this implementation
88     *  of the external GMI service.
89     */
90    public RegistryEntry getRegistryEntry(String serviceName)
91      throws JgroupException;
92  
93    /**
94     * Returns an <code>BootstrapInvocationHandler</code> that can be bound
95     * to a normal Java RMI registry instance and later merged with others.
96     */
97    public BootstrapInvocationHandler getBootstrapHandler()
98      throws JgroupException;
99  
100   /**
101    * Returns a proxy exported with the <code>BasicJeriExporter</code>.
102    * 
103    * @param impl the remote object to be exported
104    * @return the exported proxy
105    * @throws JgroupException if the object could not be exported
106    */
107   public Remote getProxy(Remote impl)
108     throws ExportException;
109 
110 } // END ExternalGMIService