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.rpc;
17  
18  import fulmine.ILifeCycle;
19  import fulmine.model.field.IField;
20  
21  /**
22   * A component that is responsible for managing the current registered RPC
23   * definitions for a local context.
24   * 
25   * @author Ramon Servadei
26   */
27  public interface IRpcRegistry extends ILifeCycle, IRpcPublishOperations
28  {
29      /** The name for the registry record */
30      String RPC_REGISTRY = "RpcRegistry";
31  
32      /**
33       * The prefix for each key in the registry record. Each key value is the
34       * 'toString' value of the RPC definition
35       */
36      String RPC_KEY = "Rpc";
37  
38      /**
39       * The field name in the registry record that indicates how many RPC
40       * definition keys are currently registered
41       */
42      String RPC_KEY_COUNT = "RpcKeyCount";
43  
44      /**
45       * Get the handler for the RPC registry key. When a remote context invokes
46       * an RPC on the local context, only the registry key and the arguments are
47       * sent from the remote context.
48       * 
49       * @param registryKey
50       *            the registry key of the RPC
51       * @return the handler or <code>null</code> if not found
52       */
53      IRpcHandler getHandler(String registryKey);
54  
55      /**
56       * Get the {@link IRpcDefinition} registered against the RPC registry key.
57       * 
58       * @param registryKey
59       *            the registry key of the RPC
60       * @return the definition or <code>null</code> if not found
61       */
62      IRpcDefinition getDefinition(String registryKey);
63  
64      /**
65       * Get the RPC registry key for the RPC defined by the procedure name and
66       * arguments.
67       * 
68       * @param rpcName
69       *            the name of the RPC
70       * @param args
71       *            the arguments for the RPC
72       * @return the registry key or <code>null</code> if no match is found
73       */
74      String getRegistryKey(String rpcName, IField[] args);
75  }