Thomas Vachuska | 02aeb03 | 2015-01-06 22:36:30 -0800 | [diff] [blame] | 1 | /* |
Brian O'Connor | a09fe5b | 2017-08-03 21:12:30 -0700 | [diff] [blame] | 2 | * Copyright 2015-present Open Networking Foundation |
Thomas Vachuska | 02aeb03 | 2015-01-06 22:36:30 -0800 | [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 | */ |
| 16 | package org.onosproject.app; |
| 17 | |
| 18 | import org.onosproject.core.Application; |
| 19 | import org.onosproject.core.ApplicationId; |
Thomas Vachuska | 42e8cce | 2015-07-29 19:25:18 -0700 | [diff] [blame] | 20 | import org.onosproject.event.ListenerService; |
Changhoon Yoon | b856b81 | 2015-08-10 03:47:19 +0900 | [diff] [blame] | 21 | import org.onosproject.security.Permission; |
Thomas Vachuska | 02aeb03 | 2015-01-06 22:36:30 -0800 | [diff] [blame] | 22 | |
Thomas Vachuska | 08b4dec | 2017-08-31 15:20:17 -0700 | [diff] [blame] | 23 | import java.io.InputStream; |
Thomas Vachuska | 02aeb03 | 2015-01-06 22:36:30 -0800 | [diff] [blame] | 24 | import java.util.Set; |
| 25 | |
| 26 | /** |
| 27 | * Service for inspecting inventory of network control applications. |
| 28 | */ |
Thomas Vachuska | 42e8cce | 2015-07-29 19:25:18 -0700 | [diff] [blame] | 29 | public interface ApplicationService |
| 30 | extends ListenerService<ApplicationEvent, ApplicationListener> { |
Thomas Vachuska | 02aeb03 | 2015-01-06 22:36:30 -0800 | [diff] [blame] | 31 | |
| 32 | /** |
| 33 | * Returns the set of all installed applications. |
| 34 | * |
| 35 | * @return set of installed apps |
| 36 | */ |
| 37 | Set<Application> getApplications(); |
| 38 | |
| 39 | /** |
| 40 | * Returns the registered id of the application with the given name. |
| 41 | * |
| 42 | * @param name application name |
| 43 | * @return registered application id |
| 44 | */ |
| 45 | ApplicationId getId(String name); |
| 46 | |
| 47 | /** |
| 48 | * Returns the application with the supplied application identifier. |
| 49 | * |
| 50 | * @param appId application identifier |
| 51 | * @return application descriptor |
| 52 | */ |
| 53 | Application getApplication(ApplicationId appId); |
| 54 | |
| 55 | /** |
| 56 | * Return the application state. |
| 57 | * |
| 58 | * @param appId application identifier |
| 59 | * @return application state |
| 60 | */ |
| 61 | ApplicationState getState(ApplicationId appId); |
| 62 | |
| 63 | /** |
| 64 | * Returns the permissions currently granted to the applications. |
| 65 | * |
| 66 | * @param appId application identifier |
| 67 | * @return set of granted permissions |
| 68 | */ |
| 69 | Set<Permission> getPermissions(ApplicationId appId); |
| 70 | |
Thomas Vachuska | c65dd71 | 2015-11-04 17:19:10 -0800 | [diff] [blame] | 71 | /** |
| 72 | * Registers application pre-deactivation processing hook. |
| 73 | * |
| 74 | * @param appId application identifier |
| 75 | * @param hook pre-deactivation hook |
| 76 | */ |
| 77 | void registerDeactivateHook(ApplicationId appId, Runnable hook); |
Thomas Vachuska | 08b4dec | 2017-08-31 15:20:17 -0700 | [diff] [blame] | 78 | |
| 79 | /** |
| 80 | * Returns stream that contains the application OAR/JAR file contents. |
| 81 | * |
| 82 | * @param appId application identifier |
| 83 | * @return input stream containing the app OAR/JAR file |
| 84 | */ |
| 85 | default InputStream getApplicationArchive(ApplicationId appId) { |
| 86 | return null; |
| 87 | } |
Thomas Vachuska | 02aeb03 | 2015-01-06 22:36:30 -0800 | [diff] [blame] | 88 | } |