Thomas Vachuska | 4f1a60c | 2014-10-28 13:39:07 -0700 | [diff] [blame] | 1 | /* |
Ray Milkey | 34c9590 | 2015-04-15 09:47:53 -0700 | [diff] [blame] | 2 | * Copyright 2014-2015 Open Networking Laboratory |
Thomas Vachuska | 4f1a60c | 2014-10-28 13:39:07 -0700 | [diff] [blame] | 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 | */ |
Brian O'Connor | abafb50 | 2014-12-02 22:26:20 -0800 | [diff] [blame] | 16 | package org.onosproject.core; |
Thomas Vachuska | e0f804a | 2014-10-27 23:40:48 -0700 | [diff] [blame] | 17 | |
Brian O'Connor | abafb50 | 2014-12-02 22:26:20 -0800 | [diff] [blame] | 18 | import org.onosproject.net.provider.ProviderId; |
Thomas Vachuska | 6acd3bb | 2014-11-09 23:44:22 -0800 | [diff] [blame] | 19 | |
Thomas Vachuska | e0f804a | 2014-10-27 23:40:48 -0700 | [diff] [blame] | 20 | import java.util.Set; |
tom | 53efab5 | 2014-10-07 17:43:48 -0700 | [diff] [blame] | 21 | |
| 22 | /** |
| 23 | * Service for interacting with the core system of the controller. |
| 24 | */ |
| 25 | public interface CoreService { |
| 26 | |
Thomas Vachuska | 6cba495 | 2015-04-22 12:38:22 -0700 | [diff] [blame] | 27 | /** |
| 28 | * Name of the core "application". |
| 29 | */ |
Sho SHIMIZU | e2952e4 | 2015-09-11 17:11:21 -0700 | [diff] [blame] | 30 | String CORE_APP_NAME = "org.onosproject.core"; |
Thomas Vachuska | 6cba495 | 2015-04-22 12:38:22 -0700 | [diff] [blame] | 31 | |
| 32 | /** |
| 33 | * Identifier of the core "provider". |
| 34 | */ |
Sho SHIMIZU | e2952e4 | 2015-09-11 17:11:21 -0700 | [diff] [blame] | 35 | ProviderId CORE_PROVIDER_ID = new ProviderId("core", CORE_APP_NAME); |
Thomas Vachuska | 6acd3bb | 2014-11-09 23:44:22 -0800 | [diff] [blame] | 36 | |
tom | 53efab5 | 2014-10-07 17:43:48 -0700 | [diff] [blame] | 37 | /** |
| 38 | * Returns the product version. |
| 39 | * |
| 40 | * @return product version |
| 41 | */ |
| 42 | Version version(); |
| 43 | |
alshabib | 92c65ad | 2014-10-08 21:56:05 -0700 | [diff] [blame] | 44 | /** |
Thomas Vachuska | e0f804a | 2014-10-27 23:40:48 -0700 | [diff] [blame] | 45 | * 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 Vachuska | c65dd71 | 2015-11-04 17:19:10 -0800 | [diff] [blame] | 53 | * |
Thomas Vachuska | e0f804a | 2014-10-27 23:40:48 -0700 | [diff] [blame] | 54 | * @param id the short value of the id |
| 55 | * @return an application id |
| 56 | */ |
| 57 | ApplicationId getAppId(Short id); |
| 58 | |
| 59 | /** |
Ray Milkey | 0247986 | 2015-02-17 17:02:19 -0800 | [diff] [blame] | 60 | * Returns an existing application id from a given id. |
Thomas Vachuska | c65dd71 | 2015-11-04 17:19:10 -0800 | [diff] [blame] | 61 | * |
Ray Milkey | 0247986 | 2015-02-17 17:02:19 -0800 | [diff] [blame] | 62 | * @param name the name portion of the ID to look up |
| 63 | * @return an application id |
| 64 | */ |
| 65 | ApplicationId getAppId(String name); |
| 66 | |
| 67 | /** |
alshabib | 92c65ad | 2014-10-08 21:56:05 -0700 | [diff] [blame] | 68 | * 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 Vachuska | c65dd71 | 2015-11-04 17:19:10 -0800 | [diff] [blame] | 72 | * @param name string identifier |
alshabib | 92c65ad | 2014-10-08 21:56:05 -0700 | [diff] [blame] | 73 | * @return the application id |
| 74 | */ |
Thomas Vachuska | c65dd71 | 2015-11-04 17:19:10 -0800 | [diff] [blame] | 75 | 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); |
alshabib | 92c65ad | 2014-10-08 21:56:05 -0700 | [diff] [blame] | 87 | |
Brian O'Connor | 520c052 | 2014-11-23 23:50:47 -0800 | [diff] [blame] | 88 | /** |
| 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 | |
tom | 53efab5 | 2014-10-07 17:43:48 -0700 | [diff] [blame] | 96 | } |