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