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.context;
17  
18  import fulmine.model.field.IField;
19  import fulmine.rpc.IRpcDefinition;
20  import fulmine.rpc.IRpcMarker;
21  import fulmine.rpc.IRpcResultHandler;
22  import fulmine.util.reference.DualValue;
23  
24  /**
25   * Interface exposing operations that the handlers of the {@link RpcManager} can
26   * use.
27   * 
28   * @author Ramon Servadei
29   */
30  public interface IRpcManagerOperations
31  {
32  
33      /**
34       * Invoke the RPC in the named remote context.
35       * 
36       * @param remoteContextIdentity
37       *            the remote context to invoke the RPC in
38       * @param rpcKey
39       *            the RPC key
40       * @param definition
41       *            the RPC definition
42       * @param args
43       *            the arguments for the RPC
44       * @param resultHandler
45       *            the handler to process the asynchronous result
46       * @param marker
47       *            the marker that allows the resultHandler to tie up the result
48       *            from this specific RPC invocation
49       */
50      void invoke(String remoteContextIdentity, String rpcKey,
51          IRpcDefinition definition, IField[] args,
52          IRpcResultHandler resultHandler, IRpcMarker marker);
53  
54      /**
55       * Get the RPC registry key and {@link IRpcDefinition} for the procedure.
56       * This checks the RPC registry record of the remote context to find the key
57       * for an RPC with matching name and arguments.
58       * 
59       * @param remoteContextIdentity
60       *            the remote context
61       * @param procedure
62       *            the RPC name
63       * @param args
64       *            the RPC arguments
65       * @return the RPC registry key and {@link IRpcDefinition} for the RPC in
66       *         the remote context or <code>null</code> if not found
67       */
68      DualValue<String, IRpcDefinition> getRegistryKeyAndDefinition(
69          String remoteContextIdentity, String procedure, IField[] args);
70  }