blob: aa6b8e6ca68eaffbe81db8be8af1f60b68d7f945 [file] [log] [blame]
Thomas Vachuska02aeb032015-01-06 22:36:30 -08001/*
Brian O'Connora09fe5b2017-08-03 21:12:30 -07002 * Copyright 2015-present Open Networking Foundation
Thomas Vachuska02aeb032015-01-06 22:36:30 -08003 *
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 */
16package org.onosproject.app;
17
Arnav Jain6cbacf12019-06-18 14:22:36 -070018import com.google.common.collect.ImmutableSet;
Thomas Vachuska02aeb032015-01-06 22:36:30 -080019import org.onosproject.core.Application;
20import org.onosproject.core.ApplicationId;
Thomas Vachuska42e8cce2015-07-29 19:25:18 -070021import org.onosproject.event.ListenerService;
Changhoon Yoonb856b812015-08-10 03:47:19 +090022import org.onosproject.security.Permission;
Thomas Vachuska02aeb032015-01-06 22:36:30 -080023
Thomas Vachuska08b4dec2017-08-31 15:20:17 -070024import java.io.InputStream;
Thomas Vachuska02aeb032015-01-06 22:36:30 -080025import java.util.Set;
26
27/**
28 * Service for inspecting inventory of network control applications.
29 */
Thomas Vachuska42e8cce2015-07-29 19:25:18 -070030public interface ApplicationService
31 extends ListenerService<ApplicationEvent, ApplicationListener> {
Thomas Vachuska02aeb032015-01-06 22:36:30 -080032
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 Vachuskac65dd712015-11-04 17:19:10 -080072 /**
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 Vachuska08b4dec2017-08-31 15:20:17 -070079
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 Jain6cbacf12019-06-18 14:22:36 -070089
90 /**
91 * Returns the set of all installed applications.
92 *
93 * @return set of apps putside the build/core environment
pierventre81a2cb92022-01-31 09:11:32 +010094 *
95 * @deprecated since onos-2.5
Arnav Jain6cbacf12019-06-18 14:22:36 -070096 */
pierventre81a2cb92022-01-31 09:11:32 +010097 @Deprecated
Arnav Jain6cbacf12019-06-18 14:22:36 -070098 default Set<Application> getRegisteredApplications() {
99 return ImmutableSet.of();
100 }
101
Thomas Vachuska02aeb032015-01-06 22:36:30 -0800102}