1 /*
2 * Licensed to the Apache Software Foundation (ASF) under one
3 * or more contributor license agreements. See the NOTICE file
4 * distributed with this work for additional information
5 * regarding copyright ownership. The ASF licenses this file
6 * to you under the Apache License, Version 2.0 (the
7 * "License"); you may not use this file except in compliance
8 * with the License. You may obtain a copy of the License at
9 *
10 * http://www.apache.org/licenses/LICENSE-2.0
11 *
12 * Unless required by applicable law or agreed to in writing, software
13 * distributed under the License is distributed on an "AS IS" BASIS,
14 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 * See the License for the specific language governing permissions and
16 * limitations under the License.
17 */
18
19 package org.apache.river.discovery;
20
21 import java.io.IOException;
22 import java.nio.ByteBuffer;
23 import net.jini.core.constraint.InvocationConstraints;
24 import net.jini.io.UnsupportedConstraintException;
25
26 /**
27 * Interface implemented by classes which decode multicast request data
28 * according to discovery protocol formats.
29 *
30 * @author Sun Microsystems, Inc.
31 * @since 2.0
32 */
33 public interface MulticastRequestDecoder extends DiscoveryFormatProvider {
34
35 /**
36 * Decodes the multicast request data contained in the given buffer in a
37 * manner that satisfies the specified absolute constraints and client
38 * subject checker (if any), returning a {@link MulticastRequest} instance
39 * that contains the decoded data. <code>null</code> constraints are
40 * considered equivalent to empty constraints. All the specified
41 * constraints are checked before this method returns.
42 *
43 * @param buf a buffer containing the packet data to decode. The multicast
44 * request data must begin at position zero of <code>buf</code>.
45 * @param constraints the constraints to apply when decoding the data, or
46 * <code>null</code>
47 * @param checker the object to use to check the client subject, or
48 * <code>null</code>
49 * @return the decoded multicast request data
50 * @throws IOException if an error occurs in interpreting the data
51 * @throws UnsupportedConstraintException if unable to satisfy the
52 * specified constraints
53 * @throws SecurityException if the given constraints cannot be satisfied
54 * due to insufficient caller permissions, or if the client subject check
55 * fails
56 * @throws NullPointerException if <code>buf</code> is <code>null</code>
57 */
58 MulticastRequest decodeMulticastRequest(ByteBuffer buf,
59 InvocationConstraints constraints,
60 ClientSubjectChecker checker)
61 throws IOException;
62 }