tom | 53efab5 | 2014-10-07 17:43:48 -0700 | [diff] [blame^] | 1 | package org.onlab.onos.cluster.impl; |
| 2 | |
| 3 | import org.apache.felix.scr.annotations.Activate; |
| 4 | import org.apache.felix.scr.annotations.Component; |
| 5 | import org.apache.felix.scr.annotations.Service; |
| 6 | import org.onlab.onos.CoreService; |
| 7 | import org.onlab.onos.Version; |
| 8 | import org.onlab.util.Tools; |
| 9 | |
| 10 | import java.io.File; |
| 11 | import java.util.List; |
| 12 | |
| 13 | /** |
| 14 | * Core service implementation. |
| 15 | */ |
| 16 | @Component |
| 17 | @Service |
| 18 | public class CoreManager implements CoreService { |
| 19 | |
| 20 | private static final File VERSION_FILE = new File("../VERSION"); |
| 21 | private static Version version = Version.version("1.0.0-SNAPSHOT"); |
| 22 | |
| 23 | // TODO: work in progress |
| 24 | |
| 25 | @Activate |
| 26 | public void activate() { |
| 27 | List<String> versionLines = Tools.slurp(VERSION_FILE); |
| 28 | if (versionLines != null && !versionLines.isEmpty()) { |
| 29 | version = Version.version(versionLines.get(0)); |
| 30 | } |
| 31 | } |
| 32 | |
| 33 | @Override |
| 34 | public Version version() { |
| 35 | return version; |
| 36 | } |
| 37 | |
| 38 | } |