blob: 4b1191f117700cfb028ecb95563b087e766063c7 [file] [log] [blame]
tom53efab52014-10-07 17:43:48 -07001package org.onlab.onos.cluster.impl;
2
3import org.apache.felix.scr.annotations.Activate;
4import org.apache.felix.scr.annotations.Component;
5import org.apache.felix.scr.annotations.Service;
6import org.onlab.onos.CoreService;
7import org.onlab.onos.Version;
8import org.onlab.util.Tools;
9
10import java.io.File;
11import java.util.List;
12
13/**
14 * Core service implementation.
15 */
16@Component
17@Service
18public 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}