Jian Li | 0967cd7 | 2015-11-25 17:38:48 -0800 | [diff] [blame] | 1 | /* |
Jian Li | c132c11 | 2016-01-28 20:27:34 -0800 | [diff] [blame^] | 2 | * Copyright 2016 Open Networking Laboratory |
Jian Li | 0967cd7 | 2015-11-25 17:38:48 -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.cpman; |
| 17 | |
Jian Li | 0967cd7 | 2015-11-25 17:38:48 -0800 | [diff] [blame] | 18 | import org.apache.felix.scr.annotations.Activate; |
Jian Li | c132c11 | 2016-01-28 20:27:34 -0800 | [diff] [blame^] | 19 | import org.apache.felix.scr.annotations.Component; |
Jian Li | 0967cd7 | 2015-11-25 17:38:48 -0800 | [diff] [blame] | 20 | import org.apache.felix.scr.annotations.Deactivate; |
| 21 | import org.apache.felix.scr.annotations.Modified; |
Jian Li | 6080432 | 2015-12-02 14:46:31 -0800 | [diff] [blame] | 22 | import org.apache.felix.scr.annotations.Reference; |
| 23 | import org.apache.felix.scr.annotations.ReferenceCardinality; |
Jian Li | 6080432 | 2015-12-02 14:46:31 -0800 | [diff] [blame] | 24 | import org.onosproject.core.ApplicationId; |
| 25 | import org.onosproject.core.CoreService; |
| 26 | import org.onosproject.net.device.DeviceService; |
Jian Li | 0967cd7 | 2015-11-25 17:38:48 -0800 | [diff] [blame] | 27 | import org.slf4j.Logger; |
Jian Li | c132c11 | 2016-01-28 20:27:34 -0800 | [diff] [blame^] | 28 | import org.slf4j.LoggerFactory; |
Jian Li | 0967cd7 | 2015-11-25 17:38:48 -0800 | [diff] [blame] | 29 | |
| 30 | /** |
Jian Li | c132c11 | 2016-01-28 20:27:34 -0800 | [diff] [blame^] | 31 | * Skeletal ONOS application component. |
Jian Li | 0967cd7 | 2015-11-25 17:38:48 -0800 | [diff] [blame] | 32 | */ |
Jian Li | 6080432 | 2015-12-02 14:46:31 -0800 | [diff] [blame] | 33 | @Component(immediate = true) |
Jian Li | 0967cd7 | 2015-11-25 17:38:48 -0800 | [diff] [blame] | 34 | public class ControlPlaneManager { |
| 35 | |
Jian Li | c132c11 | 2016-01-28 20:27:34 -0800 | [diff] [blame^] | 36 | private final Logger log = LoggerFactory.getLogger(getClass()); |
Jian Li | 6080432 | 2015-12-02 14:46:31 -0800 | [diff] [blame] | 37 | |
| 38 | @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY) |
| 39 | protected CoreService coreService; |
| 40 | |
| 41 | @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY) |
Jian Li | c132c11 | 2016-01-28 20:27:34 -0800 | [diff] [blame^] | 42 | protected DeviceService deviceService; |
| 43 | |
| 44 | private ApplicationId appId; |
Jian Li | 0967cd7 | 2015-11-25 17:38:48 -0800 | [diff] [blame] | 45 | |
| 46 | @Activate |
Jian Li | c132c11 | 2016-01-28 20:27:34 -0800 | [diff] [blame^] | 47 | protected void activate() { |
Jian Li | 6080432 | 2015-12-02 14:46:31 -0800 | [diff] [blame] | 48 | appId = coreService.registerApplication("org.onosproject.cpman"); |
Jian Li | c132c11 | 2016-01-28 20:27:34 -0800 | [diff] [blame^] | 49 | deviceService.getAvailableDevices(); |
Jian Li | 6080432 | 2015-12-02 14:46:31 -0800 | [diff] [blame] | 50 | log.info("Started"); |
Jian Li | 0967cd7 | 2015-11-25 17:38:48 -0800 | [diff] [blame] | 51 | } |
| 52 | |
| 53 | @Deactivate |
Jian Li | c132c11 | 2016-01-28 20:27:34 -0800 | [diff] [blame^] | 54 | protected void deactivate() { |
Jian Li | 6080432 | 2015-12-02 14:46:31 -0800 | [diff] [blame] | 55 | log.info("Stopped"); |
Jian Li | 0967cd7 | 2015-11-25 17:38:48 -0800 | [diff] [blame] | 56 | } |
| 57 | |
| 58 | @Modified |
Jian Li | c132c11 | 2016-01-28 20:27:34 -0800 | [diff] [blame^] | 59 | protected void modified() { |
Jian Li | 0967cd7 | 2015-11-25 17:38:48 -0800 | [diff] [blame] | 60 | } |
Jian Li | 6080432 | 2015-12-02 14:46:31 -0800 | [diff] [blame] | 61 | |
Jian Li | 6080432 | 2015-12-02 14:46:31 -0800 | [diff] [blame] | 62 | } |