Class OshiController

  • All Implemented Interfaces:
    org.springframework.beans.factory.Aware, org.springframework.context.ApplicationContextAware, org.springframework.web.context.ServletContextAware, org.springframework.web.servlet.mvc.Controller

    @Controller
    public class OshiController
    extends AbstractTomcatContainerController
    Creates an instance of Operating System and Hardware Information based on Oshi SystemInfoTest.

    A demonstration of access to many of OSHI's capabilities

    • Field Summary

      Fields 
      Modifier and Type Field Description
      private static org.slf4j.Logger logger
      The Constant logger.
      private static List<String> oshi
      Oshi Cache.
      • Fields inherited from class org.springframework.web.servlet.support.WebContentGenerator

        HEADER_CACHE_CONTROL, METHOD_GET, METHOD_HEAD, METHOD_POST
    • Constructor Summary

      Constructors 
      Constructor Description
      OshiController()  
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      org.springframework.web.servlet.ModelAndView handleRequest​(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)  
      protected org.springframework.web.servlet.ModelAndView handleRequestInternal​(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)  
      private void initialize()
      Process initialization using Oshi System Info Test (code copied from Oshi SystemInfoTest.main).
      private static void printComputerSystem​(oshi.hardware.ComputerSystem computerSystem)
      Prints the computer system.
      private static void printCpu​(oshi.hardware.CentralProcessor processor)
      Prints the cpu.
      private static void printDisks​(List<oshi.hardware.HWDiskStore> list)
      Prints the disks.
      private static void printDisplays​(List<oshi.hardware.Display> list)
      Prints the displays.
      private static void printFileSystem​(oshi.software.os.FileSystem fileSystem)
      Prints the file system.
      private static void printGraphicsCards​(List<oshi.hardware.GraphicsCard> list)
      Prints the graphic cards.
      private static void printInternetProtocolStats​(oshi.software.os.InternetProtocolStats internetProtocolStats)
      Prints the internet protocol stats.
      private static void printMemory​(oshi.hardware.GlobalMemory memory)
      Prints the memory.
      private static void printNetworkInterfaces​(List<oshi.hardware.NetworkIF> list)
      Prints the network interfaces.
      private static void printNetworkParameters​(oshi.software.os.NetworkParams networkParams)
      Prints the network parameters.
      private static void printOperatingSystem​(oshi.software.os.OperatingSystem operatingSystem)
      Prints the operating system.
      private static void printPowerSources​(List<oshi.hardware.PowerSource> list)
      Prints the power sources.
      private static void printProcesses​(oshi.software.os.OperatingSystem os, oshi.hardware.GlobalMemory memory)
      Prints the processes.
      private static void printProcessor​(oshi.hardware.CentralProcessor processor)
      Prints the processor.
      private static void printSensors​(oshi.hardware.Sensors sensors)
      Prints the sensors.
      private static void printServices​(oshi.software.os.OperatingSystem os)
      Prints the services.
      private static void printSoundCards​(List<oshi.hardware.SoundCard> list)
      Prints the sound cards.
      private static void printUsbDevices​(List<oshi.hardware.UsbDevice> list)
      Prints the usb devices.
      void setViewName​(String viewName)
      Sets the view name.
      • Methods inherited from class org.springframework.web.servlet.mvc.AbstractController

        isSynchronizeOnSession, setSynchronizeOnSession
      • Methods inherited from class org.springframework.web.servlet.support.WebContentGenerator

        applyCacheControl, applyCacheSeconds, applyCacheSeconds, cacheForSeconds, cacheForSeconds, checkAndPrepare, checkAndPrepare, checkRequest, getAllowHeader, getCacheControl, getCacheSeconds, getSupportedMethods, getVaryByRequestHeaders, isAlwaysMustRevalidate, isRequireSession, isUseCacheControlHeader, isUseCacheControlNoStore, isUseExpiresHeader, prepareResponse, preventCaching, setAlwaysMustRevalidate, setCacheControl, setCacheSeconds, setRequireSession, setSupportedMethods, setUseCacheControlHeader, setUseCacheControlNoStore, setUseExpiresHeader, setVaryByRequestHeaders
      • Methods inherited from class org.springframework.web.context.support.WebApplicationObjectSupport

        getServletContext, getTempDir, getWebApplicationContext, initApplicationContext, initServletContext, isContextRequired, setServletContext
      • Methods inherited from class org.springframework.context.support.ApplicationObjectSupport

        getApplicationContext, getMessageSourceAccessor, initApplicationContext, obtainApplicationContext, requiredContextClass, setApplicationContext
    • Field Detail

      • logger

        private static final org.slf4j.Logger logger
        The Constant logger.
      • oshi

        private static List<String> oshi
        Oshi Cache.
    • Constructor Detail

      • OshiController

        public OshiController()
    • Method Detail

      • handleRequest

        @RequestMapping(path="/adm/oshi.htm")
        public org.springframework.web.servlet.ModelAndView handleRequest​(javax.servlet.http.HttpServletRequest request,
                                                                          javax.servlet.http.HttpServletResponse response)
                                                                   throws Exception
        Specified by:
        handleRequest in interface org.springframework.web.servlet.mvc.Controller
        Overrides:
        handleRequest in class org.springframework.web.servlet.mvc.AbstractController
        Throws:
        Exception
      • handleRequestInternal

        protected org.springframework.web.servlet.ModelAndView handleRequestInternal​(javax.servlet.http.HttpServletRequest request,
                                                                                     javax.servlet.http.HttpServletResponse response)
                                                                              throws Exception
        Specified by:
        handleRequestInternal in class org.springframework.web.servlet.mvc.AbstractController
        Throws:
        Exception
      • initialize

        private void initialize()
        Process initialization using Oshi System Info Test (code copied from Oshi SystemInfoTest.main).

        Logging switched from 'info' to 'debug' for psi probe usage.

      • printOperatingSystem

        private static void printOperatingSystem​(oshi.software.os.OperatingSystem operatingSystem)
        Prints the operating system.
        Parameters:
        operatingSystem - the operating system
      • printComputerSystem

        private static void printComputerSystem​(oshi.hardware.ComputerSystem computerSystem)
        Prints the computer system.
        Parameters:
        computerSystem - the computer system
      • printProcessor

        private static void printProcessor​(oshi.hardware.CentralProcessor processor)
        Prints the processor.
        Parameters:
        processor - the processor
      • printMemory

        private static void printMemory​(oshi.hardware.GlobalMemory memory)
        Prints the memory.
        Parameters:
        memory - the memory
      • printCpu

        private static void printCpu​(oshi.hardware.CentralProcessor processor)
        Prints the cpu.
        Parameters:
        processor - the processor
      • printProcesses

        private static void printProcesses​(oshi.software.os.OperatingSystem os,
                                           oshi.hardware.GlobalMemory memory)
        Prints the processes.
        Parameters:
        os - the os
        memory - the memory
      • printServices

        private static void printServices​(oshi.software.os.OperatingSystem os)
        Prints the services.
        Parameters:
        os - the operating system
      • printSensors

        private static void printSensors​(oshi.hardware.Sensors sensors)
        Prints the sensors.
        Parameters:
        sensors - the sensors
      • printPowerSources

        private static void printPowerSources​(List<oshi.hardware.PowerSource> list)
        Prints the power sources.
        Parameters:
        list - the power sources
      • printDisks

        private static void printDisks​(List<oshi.hardware.HWDiskStore> list)
        Prints the disks.
        Parameters:
        list - the disk stores
      • printFileSystem

        private static void printFileSystem​(oshi.software.os.FileSystem fileSystem)
        Prints the file system.
        Parameters:
        fileSystem - the file system
      • printNetworkInterfaces

        private static void printNetworkInterfaces​(List<oshi.hardware.NetworkIF> list)
        Prints the network interfaces.
        Parameters:
        list - the network interfaces
      • printNetworkParameters

        private static void printNetworkParameters​(oshi.software.os.NetworkParams networkParams)
        Prints the network parameters.
        Parameters:
        networkParams - the network params
      • printInternetProtocolStats

        private static void printInternetProtocolStats​(oshi.software.os.InternetProtocolStats internetProtocolStats)
        Prints the internet protocol stats.
        Parameters:
        internetProtocolStats - the internet protocal stats
      • printDisplays

        private static void printDisplays​(List<oshi.hardware.Display> list)
        Prints the displays.
        Parameters:
        list - the displays
      • printUsbDevices

        private static void printUsbDevices​(List<oshi.hardware.UsbDevice> list)
        Prints the usb devices.
        Parameters:
        list - the usb devices
      • printSoundCards

        private static void printSoundCards​(List<oshi.hardware.SoundCard> list)
        Prints the sound cards.
        Parameters:
        list - the sound cards
      • printGraphicsCards

        private static void printGraphicsCards​(List<oshi.hardware.GraphicsCard> list)
        Prints the graphic cards.
        Parameters:
        list - the graphics cards