Laszlo Papp | 8b3a5f6 | 2017-10-05 13:32:00 +0100 | [diff] [blame] | 1 | /* |
| 2 | * Copyright 2017-present Open Networking Foundation |
| 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 | |
| 17 | package org.onosproject.drivers.polatis.netconf; |
| 18 | |
Laszlo Papp | 759f0d3 | 2018-03-05 13:24:30 +0000 | [diff] [blame] | 19 | import com.google.common.collect.ImmutableList; |
| 20 | |
Ray Milkey | d84f89b | 2018-08-17 14:54:17 -0700 | [diff] [blame] | 21 | import org.osgi.service.component.annotations.Activate; |
| 22 | import org.osgi.service.component.annotations.Component; |
| 23 | import org.osgi.service.component.annotations.Deactivate; |
| 24 | import org.osgi.service.component.annotations.Reference; |
| 25 | import org.osgi.service.component.annotations.ReferenceCardinality; |
Laszlo Papp | 8b3a5f6 | 2017-10-05 13:32:00 +0100 | [diff] [blame] | 26 | import org.onosproject.net.driver.AbstractDriverLoader; |
Laszlo Papp | 44deba9 | 2017-11-08 16:41:30 +0000 | [diff] [blame] | 27 | import org.onosproject.net.optical.OpticalDevice; |
Laszlo Papp | 759f0d3 | 2018-03-05 13:24:30 +0000 | [diff] [blame] | 28 | import org.onosproject.ui.UiGlyph; |
| 29 | import org.onosproject.ui.UiGlyphFactory; |
| 30 | import org.onosproject.ui.UiExtensionService; |
Laszlo Papp | 8b3a5f6 | 2017-10-05 13:32:00 +0100 | [diff] [blame] | 31 | |
| 32 | /** |
| 33 | * Loader for Polatis device drivers. |
| 34 | */ |
| 35 | @Component(immediate = true) |
| 36 | public class PolatisDriversLoader extends AbstractDriverLoader { |
| 37 | |
Laszlo Papp | 44deba9 | 2017-11-08 16:41:30 +0000 | [diff] [blame] | 38 | // OSGI: help bundle plugin discover runtime package dependency. |
| 39 | @SuppressWarnings("unused") |
| 40 | private OpticalDevice optical; |
| 41 | |
Ray Milkey | d84f89b | 2018-08-17 14:54:17 -0700 | [diff] [blame] | 42 | @Reference(cardinality = ReferenceCardinality.MANDATORY) |
Laszlo Papp | 759f0d3 | 2018-03-05 13:24:30 +0000 | [diff] [blame] | 43 | protected UiExtensionService uiExtensionService; |
| 44 | |
| 45 | private UiGlyphFactory glyphFactory = |
| 46 | () -> ImmutableList.of( |
| 47 | new UiGlyph("policon", "0 0 64 64", |
| 48 | "M 32.024746,2 30.163615,19.069136 24.258784,3.015638 " |
| 49 | + "26.879599,19.985033 17.021343,6.007051 23.943688,21.71947 " |
| 50 | + "10.8045,10.769161 21.557349,24.15439 6.031794,16.978659 " |
| 51 | + "19.883076,27.1245 3.027943,24.21114 19.033986,30.42674 " |
| 52 | + "2,31.97526 19.069136,33.83639 3.015638,39.74122 " |
| 53 | + "19.985033,37.12041 6.007051,46.97866 21.719466,40.05632 " |
| 54 | + "10.769161,53.19551 24.154391,42.44265 16.978659,57.96822 " |
| 55 | + "27.124504,44.11693 24.21114,60.97206 30.426738,44.96602 " |
| 56 | + "31.975259,62 33.83639,44.93086 39.74122,60.98437 " |
| 57 | + "37.120405,44.01497 46.978663,57.99296 40.056317,42.28054 " |
| 58 | + "53.195507,53.23084 42.442656,39.84561 57.968215,47.02135 " |
| 59 | + "44.116927,36.8755 60.972063,39.78886 44.966018,33.57327 " |
| 60 | + "62,32.02475 44.930865,30.16362 60.984369,24.25878 " |
| 61 | + "44.014972,26.8796 57.992959,17.021342 42.280539,23.94369 " |
| 62 | + "53.23084,10.8045 39.845614,21.55735 47.021349,6.031794 " |
| 63 | + "36.875501,19.883076 39.788865,3.027943 33.573267,19.033986 Z " |
| 64 | + "m -0.05497,19.23081 A 10.768943,10.768943 0 0 1 " |
| 65 | + "42.769201,31.96977 10.768943,10.768943 0 0 1 " |
| 66 | + "32.030235,42.7692 10.768943,10.768943 0 0 1 " |
| 67 | + "21.230812,32.03023 10.768943,10.768943 0 0 1 " |
| 68 | + "31.969778,21.23081 Z") |
| 69 | ); |
| 70 | |
Laszlo Papp | 8b3a5f6 | 2017-10-05 13:32:00 +0100 | [diff] [blame] | 71 | public PolatisDriversLoader() { |
| 72 | super("/polatis-drivers.xml"); |
| 73 | } |
Laszlo Papp | 759f0d3 | 2018-03-05 13:24:30 +0000 | [diff] [blame] | 74 | |
| 75 | @Activate |
| 76 | @Override |
| 77 | protected void activate() { |
| 78 | uiExtensionService.register(glyphFactory); |
| 79 | super.activate(); |
| 80 | } |
| 81 | |
| 82 | @Deactivate |
| 83 | @Override |
| 84 | protected void deactivate() { |
| 85 | uiExtensionService.unregister(glyphFactory); |
| 86 | super.deactivate(); |
| 87 | } |
Laszlo Papp | 8b3a5f6 | 2017-10-05 13:32:00 +0100 | [diff] [blame] | 88 | } |