blob: 82fce4c586886da46704923b24deceab8eaec714 [file] [log] [blame]
Thomas Vachuska4f1a60c2014-10-28 13:39:07 -07001/*
Brian O'Connora09fe5b2017-08-03 21:12:30 -07002 * Copyright 2014-present Open Networking Foundation
Thomas Vachuska4f1a60c2014-10-28 13:39:07 -07003 *
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 */
Brian O'Connorabafb502014-12-02 22:26:20 -080016package org.onosproject.core;
Thomas Vachuskae0f804a2014-10-27 23:40:48 -070017
Brian O'Connorabafb502014-12-02 22:26:20 -080018import org.onosproject.net.provider.ProviderId;
Thomas Vachuska6acd3bb2014-11-09 23:44:22 -080019
Thomas Vachuskae0f804a2014-10-27 23:40:48 -070020import java.util.Set;
tom53efab52014-10-07 17:43:48 -070021
22/**
23 * Service for interacting with the core system of the controller.
24 */
25public interface CoreService {
26
Thomas Vachuska6cba4952015-04-22 12:38:22 -070027 /**
28 * Name of the core "application".
29 */
Sho SHIMIZUe2952e42015-09-11 17:11:21 -070030 String CORE_APP_NAME = "org.onosproject.core";
Thomas Vachuska6cba4952015-04-22 12:38:22 -070031
32 /**
33 * Identifier of the core "provider".
34 */
Sho SHIMIZUe2952e42015-09-11 17:11:21 -070035 ProviderId CORE_PROVIDER_ID = new ProviderId("core", CORE_APP_NAME);
Thomas Vachuska6acd3bb2014-11-09 23:44:22 -080036
tom53efab52014-10-07 17:43:48 -070037 /**
38 * Returns the product version.
39 *
40 * @return product version
41 */
42 Version version();
43
alshabib92c65ad2014-10-08 21:56:05 -070044 /**
Thomas Vachuskae0f804a2014-10-27 23:40:48 -070045 * Returns the set of currently registered application identifiers.
46 *
47 * @return set of application ids
48 */
49 Set<ApplicationId> getAppIds();
50
51 /**
52 * Returns an existing application id from a given id.
Thomas Vachuskac65dd712015-11-04 17:19:10 -080053 *
Thomas Vachuskae0f804a2014-10-27 23:40:48 -070054 * @param id the short value of the id
55 * @return an application id
56 */
57 ApplicationId getAppId(Short id);
58
59 /**
Ray Milkey02479862015-02-17 17:02:19 -080060 * Returns an existing application id from a given id.
Thomas Vachuskac65dd712015-11-04 17:19:10 -080061 *
Ray Milkey02479862015-02-17 17:02:19 -080062 * @param name the name portion of the ID to look up
63 * @return an application id
64 */
65 ApplicationId getAppId(String name);
66
67 /**
alshabib92c65ad2014-10-08 21:56:05 -070068 * Registers a new application by its name, which is expected
69 * to follow the reverse DNS convention, e.g.
70 * {@code org.flying.circus.app}
71 *
Thomas Vachuskac65dd712015-11-04 17:19:10 -080072 * @param name string identifier
alshabib92c65ad2014-10-08 21:56:05 -070073 * @return the application id
74 */
Thomas Vachuskac65dd712015-11-04 17:19:10 -080075 ApplicationId registerApplication(String name);
76
77 /**
78 * Registers a new application by its name, which is expected
79 * to follow the reverse DNS convention, e.g.
80 * {@code org.flying.circus.app}, along with its pre-deactivation hook.
81 *
82 * @param name string identifier
83 * @param preDeactivate pre-deactivation hook
84 * @return the application id
85 */
86 ApplicationId registerApplication(String name, Runnable preDeactivate);
alshabib92c65ad2014-10-08 21:56:05 -070087
Brian O'Connor520c0522014-11-23 23:50:47 -080088 /**
89 * Returns an id generator for a given topic.
90 *
91 * @param topic topic identified
92 * @return the id generator
93 */
94 IdGenerator getIdGenerator(String topic);
95
tom53efab52014-10-07 17:43:48 -070096}