View Javadoc

1   /*
2      Copyright 2007 Ramon Servadei
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  package fulmine.distribution.connection;
17  
18  import fulmine.ILifeCycle;
19  import fulmine.distribution.events.ConnectionAvailableEvent;
20  import fulmine.event.IEventManager;
21  
22  /**
23   * A connection broker is a logical abstraction of the network of available
24   * remote context instances. It provides the ability to create a
25   * {@link IConnection} to other remote contexts in the network. The broker and
26   * connection both hide the I/O communication implementation.
27   * 
28   * @author Ramon Servadei
29   */
30  public interface IConnectionBroker extends ILifeCycle
31  {
32      /**
33       * Start the broker instance.
34       */
35      void start();
36  
37      /**
38       * Connect to the remote context identified in the connection parameters.
39       * The connection is created asynchronously.
40       * <p>
41       * When available, the connection will be encapsulated in a
42       * {@link ConnectionAvailableEvent} and distributed using the event
43       * framework. To receive the connection event, a listener should be
44       * registered against the connection event typed source (
45       * {@link IEventManager#getSystemEventSource(Class)}).
46       * 
47       * @param connectionParameters
48       *            the parameters for creating the connection
49       */
50      void connect(IConnectionParameters connectionParameters);
51  }