Thomas Vachuska | 02aeb03 | 2015-01-06 22:36:30 -0800 | [diff] [blame] | 1 | /* |
| 2 | * Copyright 2015 Open Networking Laboratory |
| 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; |
| 20 | import org.onosproject.core.Permission; |
| 21 | import org.onosproject.store.Store; |
| 22 | |
| 23 | import java.io.InputStream; |
| 24 | import java.util.Set; |
| 25 | |
| 26 | /** |
| 27 | * Service for managing network control applications. |
| 28 | */ |
| 29 | public interface ApplicationStore extends Store<ApplicationEvent, ApplicationStoreDelegate> { |
| 30 | |
| 31 | /** |
| 32 | * Returns the set of all installed applications. |
| 33 | * |
| 34 | * @return set of installed apps |
| 35 | */ |
| 36 | Set<Application> getApplications(); |
| 37 | |
| 38 | /** |
| 39 | * Returns the registered id of the application with the given name. |
| 40 | * |
| 41 | * @param name application name |
| 42 | * @return registered application id |
| 43 | */ |
| 44 | ApplicationId getId(String name); |
| 45 | |
| 46 | /** |
| 47 | * Returns the application with the supplied application identifier. |
| 48 | * |
| 49 | * @param appId application identifier |
| 50 | * @return application descriptor |
| 51 | */ |
| 52 | Application getApplication(ApplicationId appId); |
| 53 | |
| 54 | /** |
| 55 | * Returns the current application state. |
| 56 | * |
| 57 | * @param appId application identifier |
| 58 | * @return application state |
| 59 | */ |
| 60 | ApplicationState getState(ApplicationId appId); |
| 61 | |
| 62 | /** |
| 63 | * Creates the application from the specified application descriptor |
| 64 | * input stream. |
| 65 | * |
| 66 | * @param appDescStream application archive input stream |
| 67 | * @return application descriptor |
| 68 | */ |
| 69 | Application create(InputStream appDescStream); |
| 70 | |
| 71 | /** |
| 72 | * Removes the specified application. |
| 73 | * |
| 74 | * @param appId application identifier |
| 75 | */ |
| 76 | void remove(ApplicationId appId); |
| 77 | |
| 78 | /** |
| 79 | * Mark the application as actived. |
| 80 | * |
| 81 | * @param appId application identifier |
| 82 | */ |
| 83 | void activate(ApplicationId appId); |
| 84 | |
| 85 | /** |
| 86 | * Mark the application as deactivated. |
| 87 | * |
| 88 | * @param appId application identifier |
| 89 | */ |
| 90 | void deactivate(ApplicationId appId); |
| 91 | |
| 92 | /** |
| 93 | * Returns the permissions granted to the applications. |
| 94 | * |
| 95 | * @param appId application identifier |
| 96 | * @return set of granted permissions |
| 97 | */ |
| 98 | Set<Permission> getPermissions(ApplicationId appId); |
| 99 | |
| 100 | /** |
| 101 | * Updates the permissions granted to the applications. |
| 102 | * |
| 103 | * @param appId application identifier |
| 104 | * @param permissions set of granted permissions |
| 105 | */ |
| 106 | void setPermissions(ApplicationId appId, Set<Permission> permissions); |
| 107 | |
| 108 | } |