ejona | ba71ee9 | 2014-08-14 14:17:13 -0700 | [diff] [blame^] | 1 | package com.google.net.stubby; |
| 2 | |
| 3 | import com.google.net.stubby.Server.MethodDefinition; |
| 4 | import com.google.net.stubby.Server.ServiceDefinition; |
| 5 | |
| 6 | import javax.annotation.Nullable; |
| 7 | import javax.annotation.concurrent.ThreadSafe; |
| 8 | |
| 9 | /** Registry of services and their methods for dispatching incoming calls. */ |
| 10 | @ThreadSafe |
| 11 | public abstract class HandlerRegistry { |
| 12 | /** Lookup full method name, starting with '/'. Returns {@code null} if method not found. */ |
| 13 | @Nullable |
| 14 | public abstract Method lookupMethod(String methodName); |
| 15 | |
| 16 | /** A method definition and its parent's service definition. */ |
| 17 | public static final class Method { |
| 18 | private final ServiceDefinition serviceDef; |
| 19 | private final MethodDefinition methodDef; |
| 20 | |
| 21 | public Method(ServiceDefinition serviceDef, MethodDefinition methodDef) { |
| 22 | this.serviceDef = serviceDef; |
| 23 | this.methodDef = methodDef; |
| 24 | } |
| 25 | |
| 26 | public ServiceDefinition getServiceDefinition() { |
| 27 | return serviceDef; |
| 28 | } |
| 29 | |
| 30 | public MethodDefinition getMethodDefinition() { |
| 31 | return methodDef; |
| 32 | } |
| 33 | } |
| 34 | } |