Creating a registry for gRPC services, early version restarts on each modification of the set of services.

Change-Id: I4ee69873508127ad5362563bc7f0e1c7ac4996aa
diff --git a/incubator/protobuf/api/BUCK b/incubator/protobuf/api/BUCK
new file mode 100644
index 0000000..9ae1ccf
--- /dev/null
+++ b/incubator/protobuf/api/BUCK
@@ -0,0 +1,15 @@
+COMPILE_DEPS = [
+    '//lib:CORE_DEPS',
+    '//incubator/grpc-dependencies:grpc-core-repkg-1.3.0'
+]
+
+TEST_DEPS = [
+    '//lib:TEST_ADAPTERS',
+]
+
+osgi_jar_with_tests (
+    name = 'onos-grpc-api',
+    deps = COMPILE_DEPS,
+    test_deps = TEST_DEPS,
+    visibility = ['PUBLIC'],
+)
diff --git a/incubator/protobuf/api/src/main/java/org/onosproject/protobuf/api/GrpcServiceRegistry.java b/incubator/protobuf/api/src/main/java/org/onosproject/protobuf/api/GrpcServiceRegistry.java
new file mode 100644
index 0000000..5e7e4bc
--- /dev/null
+++ b/incubator/protobuf/api/src/main/java/org/onosproject/protobuf/api/GrpcServiceRegistry.java
@@ -0,0 +1,52 @@
+/*
+ * Copyright 2017-present Open Networking Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onosproject.protobuf.api;
+
+import com.google.common.annotations.Beta;
+import io.grpc.BindableService;
+
+/**
+ * A service that allows for de/registration of gRPC services, and determining
+ * whether a service is present.
+ */
+@Beta
+public interface GrpcServiceRegistry {
+    /**
+     * Register a gRPC service with this registry.
+     * @param service the service to be registered
+     * @return true if the service was added and server successfully started,
+     * false otherwise
+     */
+    boolean register(BindableService service);
+
+    /**
+     * Unregister a gRPC service with this registry.
+     * @param service the service to be unregistered
+     * @return true if the service was removed and the server successfully
+     * started, false otherwise
+     */
+    boolean unregister(BindableService service);
+
+    /**
+     * Checks if an instance of the  provided serviceClass is currently
+     * registered with this registry.
+     * @param serviceClass the class being queries
+     * @return true if an instance of this specified class has been registered,
+     * false otherwise
+     */
+    boolean containsService(Class<BindableService> serviceClass);
+}
diff --git a/incubator/protobuf/api/src/main/java/org/onosproject/protobuf/api/package-info.java b/incubator/protobuf/api/src/main/java/org/onosproject/protobuf/api/package-info.java
new file mode 100644
index 0000000..0541b49
--- /dev/null
+++ b/incubator/protobuf/api/src/main/java/org/onosproject/protobuf/api/package-info.java
@@ -0,0 +1,20 @@
+/*
+ * Copyright 2017-present Open Networking Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * Abstractions for interacting with the gRPC subsystem.
+ */
+package org.onosproject.protobuf.api;