blob: 51d3eb41bf5a827d175857ecfe738bab0aef2772 [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
18import org.onosproject.core.Application;
19import org.onosproject.core.ApplicationId;
Thomas Vachuska42e8cce2015-07-29 19:25:18 -070020import org.onosproject.event.ListenerService;
Changhoon Yoonb856b812015-08-10 03:47:19 +090021import org.onosproject.security.Permission;
Thomas Vachuska02aeb032015-01-06 22:36:30 -080022
Thomas Vachuska08b4dec2017-08-31 15:20:17 -070023import java.io.InputStream;
Thomas Vachuska02aeb032015-01-06 22:36:30 -080024import java.util.Set;
25
26/**
27 * Service for inspecting inventory of network control applications.
28 */
Thomas Vachuska42e8cce2015-07-29 19:25:18 -070029public interface ApplicationService
30 extends ListenerService<ApplicationEvent, ApplicationListener> {
Thomas Vachuska02aeb032015-01-06 22:36:30 -080031
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 Vachuskac65dd712015-11-04 17:19:10 -080071 /**
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 Vachuska08b4dec2017-08-31 15:20:17 -070078
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 Vachuska02aeb032015-01-06 22:36:30 -080088}