Include jHardware dependency

Bring the small parts of jHardware into the project
and make them Java-7 specific.

Rationale: the full version has JNI dependencies and does lots of
things we do not need. Additionally, it is Java 8 only and it
would not suite our needs to be compatible with Java 7.

Change-Id: I58582b885a208556b0b17c0323752c11ed24f943
diff --git a/build.sbt b/build.sbt
index fb48094..715539a 100644
--- a/build.sbt
+++ b/build.sbt
@@ -17,7 +17,6 @@
 
   // added to assembly
   "org.scalatra"          %%  "scalatra"          % scalatraV,
-  "org.jhardware"         %   "jHardware"         % "0.8.4",
 
   // test dependencies
   "org.scalatra"          %%  "scalatra-scalatest"% scalatraV   % Test,
diff --git a/src/main/java/org/jutils/jhardware/HardwareInfo.java b/src/main/java/org/jutils/jhardware/HardwareInfo.java
new file mode 100644
index 0000000..f185183
--- /dev/null
+++ b/src/main/java/org/jutils/jhardware/HardwareInfo.java
@@ -0,0 +1,101 @@
+/*
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jutils.jhardware;
+
+import java.util.Map;
+import java.util.Set;
+import org.jutils.jhardware.info.HardwareFactory;
+import org.jutils.jhardware.info.InfoType;
+import org.jutils.jhardware.model.BiosInfo;
+import org.jutils.jhardware.model.DisplayInfo;
+import org.jutils.jhardware.model.GraphicsCardInfo;
+import org.jutils.jhardware.model.MemoryInfo;
+import org.jutils.jhardware.model.MotherboardInfo;
+import org.jutils.jhardware.model.NetworkInfo;
+import org.jutils.jhardware.model.OSInfo;
+import org.jutils.jhardware.model.ProcessorInfo;
+
+/**
+ * Static class that allows to query for Hardware details.<p>
+ * Each method return the information related with a different component 
+ * (CPU, memory, motherboard....). There are some important data that comes
+ * typed in the response. This is the information that is common in different 
+ * system. The complete and specific information is returned in a Map.
+ * 
+ * @author Javier Garcia Alonso
+ */
+public class HardwareInfo {
+    
+    /**
+     * Hide constructor
+     */
+    private HardwareInfo() {
+    }
+    
+    /**
+     * Gets information related with CPU
+     * 
+     * @return object with typed common data and a map with full data
+     */
+    public static ProcessorInfo getProcessorInfo() {
+        return (ProcessorInfo)HardwareFactory.get(InfoType.PROCESSOR).getInfo();
+    }
+    
+    /**
+     * Gets information related with memory
+     * 
+     * @return object with typed common data and a map with full data
+     */
+    public static MemoryInfo getMemoryInfo() {
+        return (MemoryInfo)HardwareFactory.get(InfoType.MEMORY).getInfo();
+    }
+    
+    /**
+     * Gets information related with the Operating System
+     * 
+     * @return object with typed common data and a map with full data
+     */
+    public static OSInfo getOSInfo() {
+        return (OSInfo)HardwareFactory.get(InfoType.OS).getInfo();
+    }
+    
+    /**
+     * Gets information related with the Network
+     * 
+     * @return object with typed common data and a map with full data
+     */
+    public static NetworkInfo getNetworkInfo() {
+        return (NetworkInfo)HardwareFactory.get(InfoType.NETWORK).getInfo();
+    }
+    
+    public static void main(String [] args) {
+        ProcessorInfo info = HardwareInfo.getProcessorInfo();
+
+        System.out.println("Cache size: " + info.getCacheSize());        
+        System.out.println("Family: " + info.getFamily());
+        System.out.println("Speed (Mhz): " + info.getMhz());
+        System.out.println("Model: " + info.getModel());
+        System.out.println("Model name: " + info.getModelName());
+        System.out.println("Number of cores: " + info.getNumCores());
+        System.out.println("Stepping: " + info.getStepping());
+        System.out.println("Temperature: " + info.getTemperature());
+        System.out.println("Vendor Id: " + info.getVendorId());
+        
+        Set<Map.Entry<String, String>> fullInfos = info.getFullInfo().entrySet();
+
+        for(Map.Entry<String, String> fullInfo: fullInfos) {
+            System.out.println(fullInfo.getKey() + ": " + fullInfo.getValue());
+        }
+    }
+}
diff --git a/src/main/java/org/jutils/jhardware/info/HardwareFactory.java b/src/main/java/org/jutils/jhardware/info/HardwareFactory.java
new file mode 100644
index 0000000..a041b42
--- /dev/null
+++ b/src/main/java/org/jutils/jhardware/info/HardwareFactory.java
@@ -0,0 +1,57 @@
+/*
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jutils.jhardware.info;
+
+import org.jutils.jhardware.info.memory.unix.UnixMemoryInfo;
+import org.jutils.jhardware.info.network.unix.UnixNetworkInfo;
+import org.jutils.jhardware.info.os.unix.UnixOSInfo;
+import org.jutils.jhardware.info.processor.unix.UnixProcessorInfo;
+import org.jutils.jhardware.util.OSDetector;
+
+/**
+ * Factory class to get the right information
+ *
+ * @author Javier Garcia Alonso
+ */
+public class HardwareFactory {
+
+    /**
+     * Hide constructor
+     */
+    private HardwareFactory() {
+    }
+
+    public static HardwareInfo get(InfoType type) {
+        if (OSDetector.isUnix()) {
+            return getUnixInfo(type);
+        } else {
+            throw new UnsupportedOperationException("Your Operating System is not supported");
+        }
+    }
+
+    private static HardwareInfo getUnixInfo(InfoType type) {
+        switch (type) {
+            case PROCESSOR:
+                return new UnixProcessorInfo();
+            case MEMORY:
+                return new UnixMemoryInfo();
+            case OS:
+                return new UnixOSInfo();
+            case NETWORK:
+                return new UnixNetworkInfo();
+            default:
+                throw new IllegalArgumentException("Type of hardware not supported: " + type);
+        }
+    }
+}
diff --git a/src/main/java/org/jutils/jhardware/info/HardwareInfo.java b/src/main/java/org/jutils/jhardware/info/HardwareInfo.java
new file mode 100644
index 0000000..e2d95db
--- /dev/null
+++ b/src/main/java/org/jutils/jhardware/info/HardwareInfo.java
@@ -0,0 +1,25 @@
+/*
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jutils.jhardware.info;
+
+import org.jutils.jhardware.model.ComponentInfo;
+
+/**
+ * Interface that represents a group of hardware information (cpu, memory, motherboard...)
+ * 
+ * @author Javier Garcia Alonso
+ */
+public interface HardwareInfo {
+    ComponentInfo getInfo();    
+}
diff --git a/src/main/java/org/jutils/jhardware/info/InfoType.java b/src/main/java/org/jutils/jhardware/info/InfoType.java
new file mode 100644
index 0000000..81238bd
--- /dev/null
+++ b/src/main/java/org/jutils/jhardware/info/InfoType.java
@@ -0,0 +1,26 @@
+/*
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jutils.jhardware.info;
+
+/**
+ * The type of information to retrieve
+ * 
+ * @author Javier Garcia Alonso
+ */
+public enum InfoType {
+    PROCESSOR,
+    MEMORY,
+    OS,
+    NETWORK
+}
diff --git a/src/main/java/org/jutils/jhardware/info/memory/AbstractMemoryInfo.java b/src/main/java/org/jutils/jhardware/info/memory/AbstractMemoryInfo.java
new file mode 100644
index 0000000..b7acd3f
--- /dev/null
+++ b/src/main/java/org/jutils/jhardware/info/memory/AbstractMemoryInfo.java
@@ -0,0 +1,49 @@
+/*
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jutils.jhardware.info.memory;
+
+import java.util.Map;
+import org.jutils.jhardware.info.HardwareInfo;
+import org.jutils.jhardware.model.MemoryInfo;
+
+/**
+ * Information related to Memory
+ * 
+ * @author Javier Garcia Alonso
+ */
+public abstract class AbstractMemoryInfo implements HardwareInfo { 
+
+    /**
+     *
+     * @return
+     */
+    @Override
+    public MemoryInfo getInfo() {
+        return buildFromDataMap(parseInfo());
+    }
+    
+    protected abstract Map<String, String> parseInfo();
+    
+    protected MemoryInfo buildFromDataMap(Map<String, String> dataMap) {
+        MemoryInfo info = new MemoryInfo();
+        info.setFullInfo(dataMap);
+        if (dataMap != null && !dataMap.isEmpty()) {
+            info.setAvailableMemory(dataMap.get("MemAvailable"));
+            info.setFreeMemory(dataMap.get("MemFree"));
+            info.setTotalMemory(dataMap.get("MemTotal"));
+        }
+        
+        return info;
+    }
+}
diff --git a/src/main/java/org/jutils/jhardware/info/memory/unix/UnixMemoryInfo.java b/src/main/java/org/jutils/jhardware/info/memory/unix/UnixMemoryInfo.java
new file mode 100644
index 0000000..2075c89
--- /dev/null
+++ b/src/main/java/org/jutils/jhardware/info/memory/unix/UnixMemoryInfo.java
@@ -0,0 +1,53 @@
+/*
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jutils.jhardware.info.memory.unix;
+
+import java.util.HashMap;
+import java.util.Map;
+import org.jutils.jhardware.info.memory.AbstractMemoryInfo;
+import org.jutils.jhardware.util.HardwareInfoUtils;
+
+import java.util.List;
+/**
+ * Information related to Memory
+ * 
+ * @author Javier Garcia Alonso
+ */
+public final class UnixMemoryInfo extends AbstractMemoryInfo {
+    private static final String MEMINFO = "/proc/meminfo";
+    
+    private static String getMemoryData(){
+        List<String> streamMemoryInfo = HardwareInfoUtils.readFile(MEMINFO);
+        final StringBuilder buffer = new StringBuilder();
+
+        for (String line: streamMemoryInfo) {
+            buffer.append(line).append("\r\n");
+        }
+        
+        return buffer.toString();
+    }
+
+    @Override
+    protected Map<String, String> parseInfo() {
+        Map<String, String> memoryDataMap = new HashMap<>();
+        String[] dataStringLines = getMemoryData().split("\\r?\\n");
+
+        for (final String dataLine : dataStringLines) {
+            String[] dataStringInfo = dataLine.split(":");
+            memoryDataMap.put(dataStringInfo[0].trim(), (dataStringInfo.length == 2) ? dataStringInfo[1].trim() : "");
+        }
+
+        return memoryDataMap;
+    }    
+}
diff --git a/src/main/java/org/jutils/jhardware/info/network/AbstractNetworkInfo.java b/src/main/java/org/jutils/jhardware/info/network/AbstractNetworkInfo.java
new file mode 100644
index 0000000..6142737
--- /dev/null
+++ b/src/main/java/org/jutils/jhardware/info/network/AbstractNetworkInfo.java
@@ -0,0 +1,65 @@
+/*
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jutils.jhardware.info.network;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+import org.jutils.jhardware.info.HardwareInfo;
+import org.jutils.jhardware.model.NetworkInfo;
+import org.jutils.jhardware.model.NetworkInterfaceInfo;
+
+/**
+ * Information related to Network
+ * 
+ * @author Javier Garcia Alonso
+ */
+public abstract class AbstractNetworkInfo implements HardwareInfo { 
+
+    /**
+     *
+     * @return
+     */
+    @Override
+    public NetworkInfo getInfo() {
+        return buildFromDataMap(parseInfo());
+    }
+    
+    protected abstract Map<String, String> parseInfo();
+    
+    protected NetworkInfo buildFromDataMap(Map<String, String> dataMap) {
+        NetworkInfo info = new NetworkInfo();
+        
+        List<NetworkInterfaceInfo> interfacesList = new ArrayList<>();
+        if (!dataMap.isEmpty()) {
+            int interfacesLength = Integer.parseInt(dataMap.get("interfacesLength"));
+            for (int i = 1; i<=interfacesLength; i++) {
+                NetworkInterfaceInfo interfaceInfo = new NetworkInterfaceInfo();
+                interfaceInfo.setName(dataMap.get("interface_" + i));
+                interfaceInfo.setType(dataMap.get("type_" + i));
+                interfaceInfo.setIpv4(dataMap.get("ipv4_" + i));
+                interfaceInfo.setIpv6(dataMap.get("ipv6_" + i));
+                interfaceInfo.setReceivedPackets(dataMap.get("received_packets_" + i));
+                interfaceInfo.setTransmittedPackets(dataMap.get("transmitted_packets_" + i));
+                interfaceInfo.setReceivedBytes(dataMap.get("received_bytes_" + i));
+                interfaceInfo.setTransmittedBytes(dataMap.get("transmitted_bytes_" + i));
+                interfacesList.add(interfaceInfo);
+            }
+        }
+        
+        info.setNetworkInterfaces(interfacesList);
+        
+        return info;
+    }
+}
diff --git a/src/main/java/org/jutils/jhardware/info/network/unix/UnixNetworkInfo.java b/src/main/java/org/jutils/jhardware/info/network/unix/UnixNetworkInfo.java
new file mode 100644
index 0000000..9e152e0
--- /dev/null
+++ b/src/main/java/org/jutils/jhardware/info/network/unix/UnixNetworkInfo.java
@@ -0,0 +1,85 @@
+/*
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jutils.jhardware.info.network.unix;
+
+import java.util.HashMap;
+import java.util.Map;
+import org.jutils.jhardware.info.network.AbstractNetworkInfo;
+import org.jutils.jhardware.util.HardwareInfoUtils;
+
+/**
+ * Information related to Network
+ *
+ * @author Javier Garcia Alonso
+ */
+public final class UnixNetworkInfo extends AbstractNetworkInfo {        
+
+    private static String getNetworkData() {
+        return HardwareInfoUtils.executeCommand("ifconfig", "-a");
+    }
+
+    @Override
+    protected Map<String, String> parseInfo() {
+        Map<String, String> networkDataMap = new HashMap<>();
+
+        String networkData = getNetworkData();
+        
+        if (networkData != null) {
+            String[] dataStringLines = networkData.split("\\r?\\n");
+
+            int count = 0;
+            for (final String dataLine : dataStringLines) {
+                if (!dataLine.startsWith(" ")) {
+                    count++;
+                    networkDataMap.put("interface_" + count, HardwareInfoUtils.extractText(dataLine, "([^\\s]+)"));
+                    networkDataMap.put("type_" + count, HardwareInfoUtils.extractText(dataLine, "Link encap:(.+?)  "));
+                } else {
+                    updateNetworkData(networkDataMap, count, dataLine);
+                }
+            }
+            networkDataMap.put("interfacesLength", String.valueOf(count));
+        }
+
+        return networkDataMap;
+    }
+
+    private static void updateNetworkData(Map<String, String> networkDataMap, int count, String dataLine) {
+        String lineType = HardwareInfoUtils.extractText(dataLine, "([^\\s]+)");
+        if (null != lineType) {
+            switch (lineType) {
+                case "inet":
+                    networkDataMap.put("ipv4_" + count, HardwareInfoUtils.extractText(dataLine, "addr:(.+?) "));
+                    break;
+                case "inet6":
+                    networkDataMap.put("ipv6_" + count, HardwareInfoUtils.extractText(dataLine, "addr:(.+?) "));
+                    break;
+                case "RX":
+                    if (dataLine.trim().startsWith("RX packets")) {
+                        networkDataMap.put("received_packets_" + count, HardwareInfoUtils.extractText(dataLine, "packets:(.+?) "));
+                    } else {
+                        networkDataMap.put("received_bytes_" + count, HardwareInfoUtils.extractText(dataLine, "RX bytes:(.+?) "));
+                        networkDataMap.put("transmitted_bytes_" + count, HardwareInfoUtils.extractText(dataLine, "TX bytes:(.+?) "));
+                    }
+                    break;
+                case "TX":
+                    networkDataMap.put("transmitted_packets_" + count, HardwareInfoUtils.extractText(dataLine, "packets:(.+?) "));
+                    break;
+                default:
+                    break;
+            }
+        }
+    }
+
+    
+}
diff --git a/src/main/java/org/jutils/jhardware/info/os/AbstractOSInfo.java b/src/main/java/org/jutils/jhardware/info/os/AbstractOSInfo.java
new file mode 100644
index 0000000..c37afb3
--- /dev/null
+++ b/src/main/java/org/jutils/jhardware/info/os/AbstractOSInfo.java
@@ -0,0 +1,51 @@
+/*
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jutils.jhardware.info.os;
+
+import java.util.Map;
+import org.jutils.jhardware.info.HardwareInfo;
+import org.jutils.jhardware.model.OSInfo;
+
+/**
+ * Information related to Operating System
+ * 
+ * @author Javier Garcia Alonso
+ */
+public abstract class AbstractOSInfo implements HardwareInfo { 
+
+    /**
+     *
+     * @return
+     */
+    @Override
+    public OSInfo getInfo() {
+        return buildFromDataMap(parseInfo());
+    }
+    
+    protected abstract Map<String, String> parseInfo();
+    
+    protected OSInfo buildFromDataMap(Map<String, String> dataMap) {
+        OSInfo info = new OSInfo();
+        info.setFullInfo(dataMap);
+        
+        if (dataMap != null && !dataMap.isEmpty()) {
+            info.setName(dataMap.get("Name"));
+            info.setManufacturer(dataMap.get("Manufacturer"));
+            info.setVersion(dataMap.get("Version"));
+            info.setLastBootTime(dataMap.get("LastBootTime"));
+        }
+        
+        return info;
+    }
+}
diff --git a/src/main/java/org/jutils/jhardware/info/os/unix/UnixOSInfo.java b/src/main/java/org/jutils/jhardware/info/os/unix/UnixOSInfo.java
new file mode 100644
index 0000000..f892eb8
--- /dev/null
+++ b/src/main/java/org/jutils/jhardware/info/os/unix/UnixOSInfo.java
@@ -0,0 +1,115 @@
+/*
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jutils.jhardware.info.os.unix;
+
+import java.text.DateFormat;
+import java.text.ParseException;
+import java.text.SimpleDateFormat;
+import java.util.Calendar;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Locale;
+import java.util.Map;
+import org.jutils.jhardware.info.os.AbstractOSInfo;
+import org.jutils.jhardware.util.HardwareInfoUtils;
+
+/**
+ * Information related to Operating System
+ *
+ * @author Javier Garcia Alonso
+ */
+public final class UnixOSInfo extends AbstractOSInfo {
+
+    private static final String OS_RELEASE = "/etc/os-release";
+    private static final String LINE_BREAK_REGEX = "\\r?\\n";
+
+    private static String getOSLsbReleaseData() {
+        String fullData = "";
+
+        fullData += HardwareInfoUtils.executeCommand("lsb_release", "-a");
+
+        return fullData;
+    }
+
+    private static String getOSStartTimeData() {
+        String fullData = "";
+
+        fullData += HardwareInfoUtils.executeCommand("last", "-x");
+
+        return fullData;
+    }
+
+    private static String getOSReleaseData() {
+        List<String> streamProcessorInfo = HardwareInfoUtils.readFile(OS_RELEASE);
+        final StringBuilder buffer = new StringBuilder();
+
+        for(String line: streamProcessorInfo) {
+            buffer.append(line).append("\r\n");
+        }
+
+        return buffer.toString();
+    }
+
+    @Override
+    protected Map<String, String> parseInfo() {
+        Map<String, String> osDataMap = new HashMap<>();
+        
+        String lsbRelease = getOSLsbReleaseData();
+        String[] dataStringLines = lsbRelease.split(LINE_BREAK_REGEX);
+
+        for (final String dataLine : dataStringLines) {
+            String[] dataStringInfo = dataLine.split(":");
+            osDataMap.put(dataStringInfo[0].trim(), (dataStringInfo.length == 2) ? dataStringInfo[1].trim() : "");
+        }
+        
+        String osRelease = getOSReleaseData();
+        dataStringLines = osRelease.split(LINE_BREAK_REGEX);
+
+        for (final String dataLine : dataStringLines) {
+            String[] dataStringInfo = dataLine.split("=");
+            osDataMap.put(HardwareInfoUtils.toCamelCase("OS_" + dataStringInfo[0].trim()), 
+                    (dataStringInfo.length == 2) ? dataStringInfo[1].trim().replaceAll("\"", "") : "");
+        }
+        
+        String startTimeFullData = getOSStartTimeData();
+        dataStringLines = startTimeFullData.split(LINE_BREAK_REGEX);
+
+        for (final String dataLine : dataStringLines) {
+            if (dataLine.startsWith("reboot")) {
+                osDataMap.put("LastBootTime", normalizeBootUpDate(dataLine.substring(39, 55)));
+                break;
+            }
+        }
+        
+        //Set named data
+        osDataMap.put("Manufacturer", osDataMap.get("Distributor ID"));
+        osDataMap.put("Name", osDataMap.get("Description"));
+        osDataMap.put("Version", osDataMap.get("Release"));
+      
+        return osDataMap;
+    }
+    
+    private static String normalizeBootUpDate(String rawBootUpdate) {
+         DateFormat df = new SimpleDateFormat("EEE MMM dd kk:mm yyyy", Locale.ENGLISH);
+         Date returnedDate;
+         try{
+             returnedDate = df.parse(rawBootUpdate + " " + Calendar.getInstance().get(Calendar.YEAR));
+         } catch(ParseException pe) {
+             return rawBootUpdate;
+         }
+         
+         return returnedDate.toString();
+    }
+}
\ No newline at end of file
diff --git a/src/main/java/org/jutils/jhardware/info/processor/AbstractProcessorInfo.java b/src/main/java/org/jutils/jhardware/info/processor/AbstractProcessorInfo.java
new file mode 100644
index 0000000..87eeae5
--- /dev/null
+++ b/src/main/java/org/jutils/jhardware/info/processor/AbstractProcessorInfo.java
@@ -0,0 +1,52 @@
+/*
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jutils.jhardware.info.processor;
+
+import java.util.Map;
+import org.jutils.jhardware.info.HardwareInfo;
+import org.jutils.jhardware.model.ProcessorInfo;
+
+/**
+ * Information related to CPU
+ * 
+ * @author Javier Garcia Alonso
+ */
+public abstract class AbstractProcessorInfo implements HardwareInfo {
+
+    @Override
+    public ProcessorInfo getInfo() {
+        return buildFromDataMap(parseInfo());
+    }
+    
+    protected abstract Map<String, String> parseInfo();
+    
+    protected ProcessorInfo buildFromDataMap(Map<String, String> dataMap) {
+        ProcessorInfo info = new ProcessorInfo();
+        info.setFullInfo(dataMap);
+        
+        if (dataMap != null && !dataMap.isEmpty()) {
+            info.setCacheSize(dataMap.get("cache size"));
+            info.setFamily(dataMap.get("cpu family"));
+            info.setMhz(dataMap.get("cpu MHz"));
+            info.setModel(dataMap.get("model"));
+            info.setModelName(dataMap.get("model name"));
+            info.setNumCores(dataMap.get("cpu cores"));
+            info.setStepping(dataMap.get("stepping"));
+            info.setTemperature(dataMap.get("temperature"));
+            info.setVendorId(dataMap.get("vendor_id"));
+        }
+        
+        return info;
+    }
+}
diff --git a/src/main/java/org/jutils/jhardware/info/processor/unix/UnixProcessorInfo.java b/src/main/java/org/jutils/jhardware/info/processor/unix/UnixProcessorInfo.java
new file mode 100644
index 0000000..667cd4a
--- /dev/null
+++ b/src/main/java/org/jutils/jhardware/info/processor/unix/UnixProcessorInfo.java
@@ -0,0 +1,54 @@
+/*
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jutils.jhardware.info.processor.unix;
+
+import java.util.HashMap;
+import java.util.Map;
+import org.jutils.jhardware.info.processor.AbstractProcessorInfo;
+import org.jutils.jhardware.util.HardwareInfoUtils;
+
+import java.util.List;
+/**
+ * Information related to CPU
+ *
+ * @author Javier Garcia Alonso
+ */
+public final class UnixProcessorInfo extends AbstractProcessorInfo {
+
+    private static final String CPUINFO = "/proc/cpuinfo";    
+
+    public static String getProcessorData() {
+        List<String> streamProcessorInfo = HardwareInfoUtils.readFile(CPUINFO);
+        final StringBuilder buffer = new StringBuilder();
+
+        for(String line: streamProcessorInfo) {
+            buffer.append(line).append("\r\n");
+        }
+        return buffer.toString();
+    }
+
+    @Override
+    protected Map<String, String> parseInfo() {
+        Map<String, String> processorDataMap = new HashMap<>();
+        String[] dataStringLines = getProcessorData().split("\\r?\\n");
+
+        for (final String dataLine : dataStringLines) {
+            String[] dataStringInfo = dataLine.split(":");
+            processorDataMap.put(dataStringInfo[0].trim(),
+                    (dataStringInfo.length == 2) ? dataStringInfo[1].trim() : "");
+        }
+
+        return processorDataMap;
+    }
+}
diff --git a/src/main/java/org/jutils/jhardware/model/BiosInfo.java b/src/main/java/org/jutils/jhardware/model/BiosInfo.java
new file mode 100644
index 0000000..7076335
--- /dev/null
+++ b/src/main/java/org/jutils/jhardware/model/BiosInfo.java
@@ -0,0 +1,61 @@
+/*
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jutils.jhardware.model;
+
+import java.util.Map;
+
+/**
+ *
+ * @author Javier Garcia Alonso
+ */
+public class BiosInfo implements ComponentInfo {
+    private String date;
+    private String manufacturer;
+    private String version;
+   
+    private Map<String, String> fullInfo;
+
+    public String getDate() {
+        return date;
+    }
+
+    public void setDate(String date) {
+        this.date = date;
+    }
+
+    public String getManufacturer() {
+        return manufacturer;
+    }
+
+    public void setManufacturer(String manufacturer) {
+        this.manufacturer = manufacturer;
+    }
+
+    public String getVersion() {
+        return version;
+    }
+
+    public void setVersion(String version) {
+        this.version = version;
+    }
+    
+    public Map<String, String> getFullInfo() {
+        return fullInfo;
+    }
+
+    public void setFullInfo(Map<String, String> fullInfo) {
+        this.fullInfo = fullInfo;
+    }
+    
+}
diff --git a/src/main/java/org/jutils/jhardware/model/ComponentInfo.java b/src/main/java/org/jutils/jhardware/model/ComponentInfo.java
new file mode 100644
index 0000000..d29199d
--- /dev/null
+++ b/src/main/java/org/jutils/jhardware/model/ComponentInfo.java
@@ -0,0 +1,24 @@
+/*
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jutils.jhardware.model;
+
+import java.io.Serializable;
+
+/**
+ *
+ * @author Javier Garcia Alonso
+ */
+public interface ComponentInfo extends Serializable {
+    
+}
diff --git a/src/main/java/org/jutils/jhardware/model/Display.java b/src/main/java/org/jutils/jhardware/model/Display.java
new file mode 100644
index 0000000..56e0808
--- /dev/null
+++ b/src/main/java/org/jutils/jhardware/model/Display.java
@@ -0,0 +1,61 @@
+/*
+ * Copyright 2016 javier.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jutils.jhardware.model;
+
+/**
+ *
+ * @author javier
+ */
+public class Display {
+    private String name;
+    private String currentResolution;
+    private String refreshRate;
+    private String[] supportedResolutions;
+
+    public String getName() {
+        return name;
+    }
+
+    public void setName(String name) {
+        this.name = name;
+    }
+    
+    public String getCurrentResolution() {
+        return currentResolution;
+    }
+
+    public void setCurrentResolution(String currentResolution) {
+        this.currentResolution = currentResolution;
+    }
+
+    public String getRefreshRate() {
+        return refreshRate;
+    }
+
+    public void setRefreshRate(String refreshRate) {
+        this.refreshRate = refreshRate;
+    }
+
+    public String[] getSupportedResolutions() {
+        return supportedResolutions;
+    }
+
+    public void setSupportedResolutions(String[] supportedResolutions) {
+        this.supportedResolutions = supportedResolutions;
+    }
+    
+    
+}
diff --git a/src/main/java/org/jutils/jhardware/model/DisplayInfo.java b/src/main/java/org/jutils/jhardware/model/DisplayInfo.java
new file mode 100644
index 0000000..3004b16
--- /dev/null
+++ b/src/main/java/org/jutils/jhardware/model/DisplayInfo.java
@@ -0,0 +1,32 @@
+/*
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jutils.jhardware.model;
+
+import java.util.List;
+
+/**
+ *
+ * @author Javier Garcia Alonso
+ */
+public class DisplayInfo implements ComponentInfo {
+    List<Display> displayDevices;
+
+    public List<Display> getDisplayDevices() {
+        return displayDevices;
+    }
+
+    public void setDisplayDevices(List<Display> displayDevices) {
+        this.displayDevices = displayDevices;
+    }
+}
diff --git a/src/main/java/org/jutils/jhardware/model/GraphicsCard.java b/src/main/java/org/jutils/jhardware/model/GraphicsCard.java
new file mode 100644
index 0000000..c6078d1
--- /dev/null
+++ b/src/main/java/org/jutils/jhardware/model/GraphicsCard.java
@@ -0,0 +1,88 @@
+/*
+ * Copyright 2016 javier.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jutils.jhardware.model;
+
+/**
+ *
+ * @author javier
+ */
+public class GraphicsCard {
+
+    private String name;
+    private String manufacturer;
+    private String chipType;
+    private String dacType;
+    private String deviceType;
+    private String temperature;
+    private String fanSpeed;
+
+    public String getName() {
+        return name;
+    }
+
+    public void setName(String name) {
+        this.name = name;
+    }
+
+    public String getManufacturer() {
+        return manufacturer;
+    }
+
+    public void setManufacturer(String manufacturer) {
+        this.manufacturer = manufacturer;
+    }
+
+    public String getChipType() {
+        return chipType;
+    }
+
+    public void setChipType(String chipType) {
+        this.chipType = chipType;
+    }
+
+    public String getDacType() {
+        return dacType;
+    }
+
+    public void setDacType(String dacType) {
+        this.dacType = dacType;
+    }
+
+    public String getDeviceType() {
+        return deviceType;
+    }
+
+    public void setDeviceType(String deviceType) {
+        this.deviceType = deviceType;
+    }
+
+    public String getTemperature() {
+        return temperature;
+    }
+
+    public void setTemperature(String temperature) {
+        this.temperature = temperature;
+    }
+
+    public String getFanSpeed() {
+        return fanSpeed;
+    }
+
+    public void setFanSpeed(String fanSpeed) {
+        this.fanSpeed = fanSpeed;
+    }
+
+}
diff --git a/src/main/java/org/jutils/jhardware/model/GraphicsCardInfo.java b/src/main/java/org/jutils/jhardware/model/GraphicsCardInfo.java
new file mode 100644
index 0000000..7b6c195
--- /dev/null
+++ b/src/main/java/org/jutils/jhardware/model/GraphicsCardInfo.java
@@ -0,0 +1,37 @@
+/*
+ * Copyright 2016 Javier Garcia Alonso.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jutils.jhardware.model;
+
+import java.util.List;
+
+/**
+ * Model that encapsulates graphics card information
+ *
+ * @author Javier Garcia Alonso
+ */
+public class GraphicsCardInfo implements ComponentInfo {
+
+    List<GraphicsCard> graphicsCards;
+
+    public List<GraphicsCard> getGraphicsCards() {
+        return graphicsCards;
+    }
+
+    public void setGraphicsCards(List<GraphicsCard> graphicsCards) {
+        this.graphicsCards = graphicsCards;
+    }
+
+}
diff --git a/src/main/java/org/jutils/jhardware/model/MemoryInfo.java b/src/main/java/org/jutils/jhardware/model/MemoryInfo.java
new file mode 100644
index 0000000..6c7fdae
--- /dev/null
+++ b/src/main/java/org/jutils/jhardware/model/MemoryInfo.java
@@ -0,0 +1,62 @@
+/*
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jutils.jhardware.model;
+
+import java.util.Map;
+
+/**
+ *
+ * @author Javier Garcia Alonso
+ */
+public class MemoryInfo implements ComponentInfo {
+    private String totalMemory;
+    private String freeMemory;
+    private String availableMemory;
+   
+    private Map<String, String> fullInfo;
+
+    public String getTotalMemory() {
+        return totalMemory;
+    }
+
+    public void setTotalMemory(String totalMemory) {
+        this.totalMemory = totalMemory;
+    }
+
+    public String getFreeMemory() {
+        return freeMemory;
+    }
+
+    public void setFreeMemory(String freeMemory) {
+        this.freeMemory = freeMemory;
+    }
+
+    public String getAvailableMemory() {
+        return availableMemory;
+    }
+
+    public void setAvailableMemory(String availableMemory) {
+        this.availableMemory = availableMemory;
+    }
+
+    public Map<String, String> getFullInfo() {
+        return fullInfo;
+    }
+
+    public void setFullInfo(Map<String, String> fullInfo) {
+        this.fullInfo = fullInfo;
+    }
+    
+    
+}
diff --git a/src/main/java/org/jutils/jhardware/model/MotherboardInfo.java b/src/main/java/org/jutils/jhardware/model/MotherboardInfo.java
new file mode 100644
index 0000000..2c789bd
--- /dev/null
+++ b/src/main/java/org/jutils/jhardware/model/MotherboardInfo.java
@@ -0,0 +1,62 @@
+/*
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jutils.jhardware.model;
+
+import java.util.Map;
+
+/**
+ *
+ * @author Javier Garcia Alonso
+ */
+public class MotherboardInfo implements ComponentInfo {
+
+    private String name;
+    private String manufacturer;
+    private String version;
+
+    private Map<String, String> fullInfo;
+
+    public String getName() {
+        return name;
+    }
+
+    public void setName(String name) {
+        this.name = name;
+    }
+
+    public String getManufacturer() {
+        return manufacturer;
+    }
+
+    public void setManufacturer(String manufacturer) {
+        this.manufacturer = manufacturer;
+    }
+
+    public Map<String, String> getFullInfo() {
+        return fullInfo;
+    }
+
+    public void setFullInfo(Map<String, String> fullInfo) {
+        this.fullInfo = fullInfo;
+    }
+
+    public String getVersion() {
+        return version;
+    }
+
+    public void setVersion(String version) {
+        this.version = version;
+    }
+
+}
diff --git a/src/main/java/org/jutils/jhardware/model/NetworkInfo.java b/src/main/java/org/jutils/jhardware/model/NetworkInfo.java
new file mode 100644
index 0000000..ce2474e
--- /dev/null
+++ b/src/main/java/org/jutils/jhardware/model/NetworkInfo.java
@@ -0,0 +1,33 @@
+/*
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jutils.jhardware.model;
+
+import java.util.List;
+
+/**
+ *
+ * @author Javier Garcia Alonso
+ */
+public class NetworkInfo implements ComponentInfo {
+    private List<NetworkInterfaceInfo> networkInterfaces;
+
+    public List<NetworkInterfaceInfo> getNetworkInterfaces() {
+        return networkInterfaces;
+    }
+
+    public void setNetworkInterfaces(List<NetworkInterfaceInfo> networkInterfaces) {
+        this.networkInterfaces = networkInterfaces;
+    }
+    
+}
diff --git a/src/main/java/org/jutils/jhardware/model/NetworkInterfaceInfo.java b/src/main/java/org/jutils/jhardware/model/NetworkInterfaceInfo.java
new file mode 100644
index 0000000..6513652
--- /dev/null
+++ b/src/main/java/org/jutils/jhardware/model/NetworkInterfaceInfo.java
@@ -0,0 +1,93 @@
+/*
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jutils.jhardware.model;
+
+/**
+ *
+ * @author Javier Garcia Alonso
+ */
+public class NetworkInterfaceInfo implements ComponentInfo{
+    private String name;
+    private String type;
+    private String ipv4;
+    private String ipv6;
+    private String receivedPackets;
+    private String transmittedPackets;
+    private String receivedBytes;
+    private String transmittedBytes;
+
+    public String getName() {
+        return name;
+    }
+
+    public void setName(String name) {
+        this.name = name;
+    }
+
+    public String getType() {
+        return type;
+    }
+
+    public void setType(String type) {
+        this.type = type;
+    }
+
+    public String getIpv4() {
+        return ipv4;
+    }
+
+    public void setIpv4(String ipv4) {
+        this.ipv4 = ipv4;
+    }
+
+    public String getIpv6() {
+        return ipv6;
+    }
+
+    public void setIpv6(String ipv6) {
+        this.ipv6 = ipv6;
+    }
+
+    public String getReceivedPackets() {
+        return receivedPackets;
+    }
+
+    public void setReceivedPackets(String receivedPackets) {
+        this.receivedPackets = receivedPackets;
+    }
+
+    public String getTransmittedPackets() {
+        return transmittedPackets;
+    }
+
+    public void setTransmittedPackets(String transmittedPackets) {
+        this.transmittedPackets = transmittedPackets;
+    }
+
+    public String getReceivedBytes() {
+        return receivedBytes;
+    }
+
+    public void setReceivedBytes(String receivedBytes) {
+        this.receivedBytes = receivedBytes;
+    }
+
+    public String getTransmittedBytes() {
+        return transmittedBytes;
+    }
+
+    public void setTransmittedBytes(String transmittedBytes) {
+        this.transmittedBytes = transmittedBytes;
+    }    
+}
diff --git a/src/main/java/org/jutils/jhardware/model/OSInfo.java b/src/main/java/org/jutils/jhardware/model/OSInfo.java
new file mode 100644
index 0000000..d22a5c8
--- /dev/null
+++ b/src/main/java/org/jutils/jhardware/model/OSInfo.java
@@ -0,0 +1,69 @@
+/*
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jutils.jhardware.model;
+
+import java.util.Map;
+
+/**
+ *
+ * @author Javier Garcia Alonso
+ */
+public class OSInfo implements ComponentInfo {
+    private String version;
+    private String lastBootTime;
+    private String name;
+    private String manufacturer;
+    private Map<String, String> fullInfo;
+
+    public String getVersion() {
+        return version;
+    }
+
+    public void setVersion(String version) {
+        this.version = version;
+    }
+
+    public String getLastBootTime() {
+        return lastBootTime;
+    }
+
+    public void setLastBootTime(String lastBootTime) {
+        this.lastBootTime = lastBootTime;
+    }
+
+    public String getName() {
+        return name;
+    }
+
+    public void setName(String name) {
+        this.name = name;
+    }
+
+    public String getManufacturer() {
+        return manufacturer;
+    }
+
+    public void setManufacturer(String manufacturer) {
+        this.manufacturer = manufacturer;
+    }
+    
+    public Map<String, String> getFullInfo() {
+        return fullInfo;
+    }
+
+    public void setFullInfo(Map<String, String> fullInfo) {
+        this.fullInfo = fullInfo;
+    }
+    
+}
diff --git a/src/main/java/org/jutils/jhardware/model/ProcessorInfo.java b/src/main/java/org/jutils/jhardware/model/ProcessorInfo.java
new file mode 100644
index 0000000..092106e
--- /dev/null
+++ b/src/main/java/org/jutils/jhardware/model/ProcessorInfo.java
@@ -0,0 +1,115 @@
+/*

+ * Licensed under the Apache License, Version 2.0 (the "License");

+ * you may not use this file except in compliance with the License.

+ * You may obtain a copy of the License at

+ *

+ * http://www.apache.org/licenses/LICENSE-2.0

+ *

+ * Unless required by applicable law or agreed to in writing, software

+ * distributed under the License is distributed on an "AS IS" BASIS,

+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.

+ * See the License for the specific language governing permissions and

+ * limitations under the License.

+ */

+package org.jutils.jhardware.model;

+

+import java.util.Map;

+

+/**

+ * Model that encapsulates processor information

+ * 

+ * @author Javier Garcia Alonso

+ */

+public class ProcessorInfo implements ComponentInfo{

+    private String vendorId;

+    private String family;

+    private String model;

+    private String modelName;

+    private String stepping;

+    private String mhz;

+    private String cacheSize;

+    private String numCores;

+    private String temperature;

+    

+    private Map<String, String> fullInfo;

+

+    public String getVendorId() {

+        return vendorId;

+    }

+

+    public void setVendorId(String vendorId) {

+        this.vendorId = vendorId;

+    }

+

+    public String getFamily() {

+        return family;

+    }

+

+    public void setFamily(String family) {

+        this.family = family;

+    }

+

+    public String getModel() {

+        return model;

+    }

+

+    public void setModel(String model) {

+        this.model = model;

+    }

+

+    public String getModelName() {

+        return modelName;

+    }

+

+    public void setModelName(String modelName) {

+        this.modelName = modelName;

+    }

+

+    public String getStepping() {

+        return stepping;

+    }

+

+    public void setStepping(String stepping) {

+        this.stepping = stepping;

+    }

+

+    public String getMhz() {

+        return mhz;

+    }

+

+    public void setMhz(String mhz) {

+        this.mhz = mhz;

+    }

+

+    public String getCacheSize() {

+        return cacheSize;

+    }

+

+    public void setCacheSize(String cacheSize) {

+        this.cacheSize = cacheSize;

+    }

+

+    public String getNumCores() {

+        return numCores;

+    }

+

+    public void setNumCores(String numCores) {

+        this.numCores = numCores;

+    }

+

+    public String getTemperature() {

+        return temperature;

+    }

+

+    public void setTemperature(String temperature) {

+        this.temperature = temperature;

+    }

+

+    public Map<String, String> getFullInfo() {

+        return fullInfo;

+    }

+

+    public void setFullInfo(Map<String, String> fullInfo) {

+        this.fullInfo = fullInfo;

+    }

+}

diff --git a/src/main/java/org/jutils/jhardware/util/HardwareInfoUtils.java b/src/main/java/org/jutils/jhardware/util/HardwareInfoUtils.java
new file mode 100644
index 0000000..a49e45d
--- /dev/null
+++ b/src/main/java/org/jutils/jhardware/util/HardwareInfoUtils.java
@@ -0,0 +1,150 @@
+/*
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jutils.jhardware.util;
+
+import java.io.BufferedReader;
+import java.io.FileReader;
+import java.io.IOException;
+import java.io.InputStreamReader;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+/**
+ *
+ * @author Javier Garcia Alonso
+ */
+public class HardwareInfoUtils {
+
+    private static final String CRLF = "\r\n";
+
+    private static final String NOT_FOUND = "NOT_FOUND";
+
+    private static final Logger log = Logger.getLogger(HardwareInfoUtils.class.getName());
+    
+    //Hide constructor
+    private HardwareInfoUtils() {
+
+    }
+
+    public static List<String> readFile(String filePath) {
+        Path path = Paths.get(filePath);
+
+        List<String> fileLines = new ArrayList<>();
+        try(BufferedReader reader = new BufferedReader(new FileReader(path.toFile()))) {
+            String line;
+            while(null != (line = reader.readLine())) {
+                fileLines.add(line);
+            }
+        } catch (IOException ex) {
+            log.log(Level.SEVERE, "Unable to read file " + filePath, ex);
+        }
+
+        return fileLines;
+    }
+    
+    public static String getSingleValueFromFile(String filePath) {
+        try(BufferedReader reader = new BufferedReader(new FileReader(filePath))) {
+            return reader.readLine();
+        } catch (IOException ex) {
+            log.log(Level.SEVERE, "Unable to read file " + filePath, ex);
+            return null;
+        }
+    }
+
+    public static String executeCommand(String... command) {
+        String commandOutput = null;
+
+        try {
+            ProcessBuilder processBuilder = new ProcessBuilder(command);
+            processBuilder.redirectErrorStream(true); // redirect error stream to output stream
+
+            commandOutput = readData(processBuilder.start());
+        } catch (IOException ex) {
+            Logger.getLogger(HardwareInfoUtils.class.getName()).log(Level.SEVERE, null, ex);
+        }
+
+        return commandOutput;
+    }
+
+    private static String readData(Process process) {
+        StringBuilder commandOutput = new StringBuilder();
+        BufferedReader processOutput = null;
+
+        try {          
+             processOutput = new BufferedReader(new InputStreamReader(process.getInputStream()));
+            
+            String line;
+            while ((line = processOutput.readLine()) != null) {
+                if (!line.isEmpty()) {
+                    commandOutput.append(line).append(CRLF);
+                }
+            }
+        } catch (IOException ex) {
+            Logger.getLogger(HardwareInfoUtils.class.getName()).log(Level.SEVERE, null, ex);
+        } finally {
+            try {
+                if (processOutput != null) {
+                    processOutput.close();
+                }
+            } catch (IOException ioe) {
+                Logger.getLogger(HardwareInfoUtils.class.getName()).log(Level.SEVERE, null, ioe);
+            }
+        }
+
+        return commandOutput.toString();
+    }
+
+    public static boolean isSudo() {
+        return executeCommand("sudo", "-n", "true").length() == 0;
+    }
+
+    public static String toCamelCase(String s) {
+        String[] parts = s.split("_");
+        String camelCaseString = "";
+        for (String part : parts) {
+            camelCaseString = camelCaseString + toProperCase(part);
+        }
+        return camelCaseString;
+    }
+
+    private static String toProperCase(String s) {
+        return s.substring(0, 1).toUpperCase()
+                + s.substring(1).toLowerCase();
+    }
+    
+    public static String removeAllSpaces(String s) {
+        return s.replaceAll("\\s+", "");
+    }
+    
+    public static String extractText(String text, String regex) {
+        if (text.trim().isEmpty()) {
+            return NOT_FOUND;
+        }
+
+        final Pattern pattern = Pattern.compile(regex);
+        final Matcher matcher = pattern.matcher(text);
+
+        matcher.find();
+        if (matcher.groupCount() > 0) {
+            return matcher.group(1);
+        }
+        return NOT_FOUND;
+    }
+}
diff --git a/src/main/java/org/jutils/jhardware/util/OSDetector.java b/src/main/java/org/jutils/jhardware/util/OSDetector.java
new file mode 100644
index 0000000..d292627
--- /dev/null
+++ b/src/main/java/org/jutils/jhardware/util/OSDetector.java
@@ -0,0 +1,45 @@
+/*
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jutils.jhardware.util;
+
+/**
+ * Detects used OS
+ * 
+ * @author Javier Garcia Alonso
+ */
+public class OSDetector {
+    private static final String OS = System.getProperty("os.name").toLowerCase();
+    
+     /**
+     * Hide constructor
+     */
+    private OSDetector() {
+    }    
+
+    public static boolean isWindows() {
+        return OS.contains("win");
+    }
+
+    public static boolean isMac() {
+        return OS.contains("mac");
+    }
+
+    public static boolean isUnix() {
+        return OS.contains("nix") || OS.contains("nux") || OS.contains("aix");
+    }
+
+    public static boolean isSolaris() {
+        return OS.contains("sunos");
+    }
+}