View Javadoc

1   /*
2      Copyright 2008 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.channel;
17  
18  import fulmine.model.container.events.ContainerDestroyedEvent;
19  
20  /**
21   * Used by the handlers of the {@link Channel} to interact with it.
22   * 
23   * @author Ramon Servadei
24   */
25  public interface IChannelOperations
26  {
27      /**
28       * Find out if the connection to the peer channel synchronized
29       * 
30       * @return <code>true</code> if the connection to the peer channel is
31       *         synchronized.
32       */
33      boolean isConnectionSyn();
34  
35      /**
36       * Mark the connection to the peer channel as synchronized.
37       */
38      void setConnectionSyn();
39  
40      /**
41       * Send a message to the connected channel.
42       * 
43       * @param message
44       *            the byte[] encapsulating the message to send
45       */
46      void send(byte[] message);
47  
48      /**
49       * Get the byte[] to represent the container destroyed event
50       * 
51       * @param event
52       *            the container destroyed event to convert into byte[] form
53       * @return a byte[] representing the container destroyed event
54       */
55      byte[] getContainerDestroyedMessage(ContainerDestroyedEvent event);
56  }