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