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.protocol.specification;
17  
18  import fulmine.IAddressable;
19  import fulmine.context.IFrameworkContext;
20  import fulmine.model.container.IContainer;
21  
22  /**
23   * Reads fulmine delta (FD) protocol frames.
24   * <p>
25   * Please refer to the "Fulmine Delta Transmission Protocol" specification for a
26   * complete description of the fulmine serialisation technique.
27   * 
28   * @see IFrameConstants
29   * @author Ramon Servadei
30   * 
31   */
32  public interface IFrameReader
33  {
34      /**
35       * Reads an FD frame holding the state of a container. The container to
36       * process the frame is located or created by this method.
37       * 
38       * @param frame
39       *            the byte[] holding the wire state of a container.
40       * @param remoteContextIdentity
41       *            the identity of the remote context this frame is from
42       * @param context
43       *            the context to use to create the remote {@link IContainer}
44       * @return the remote {@link IContainer} with the state in the frame applied
45       */
46      IContainer read(byte[] frame, String remoteContextIdentity,
47          IFrameworkContext context);
48  
49      /**
50       * Get the remote container for the frame. The container to process the
51       * frame is located or created by this method.
52       * 
53       * @param frame
54       *            the byte[] holding the wire state of a container.
55       * @param remoteContextIdentity
56       *            the identity of the remote context this frame is from
57       * @param context
58       *            the context to use to create the remote {@link IContainer}
59       * @return the remote {@link IContainer} for the frame.
60       */
61      IContainer getRemoteContainerForFrame(byte[] frame,
62          String remoteContextIdentity, IFrameworkContext context);
63  
64      /**
65       * Get the identity, type and domain of the container in the frame
66       * 
67       * @param frame
68       *            the byte[] holding the wire state of a container.
69       * @param remoteContextIdentity
70       *            the identity of the remote context this frame is from
71       * @return an {@link IAddressable} object identifying the identity, type and
72       *         domain of the container this frame is for
73       */
74      IAddressable getRemoteContainerDetailsFromFrame(final byte[] frame,
75          String remoteContextIdentity);
76  }