Skip to content

eggy03/cimari

Project Stats License Maven Central Version Minimum JDK Version

Note

The API is currently in rapid development stage. While the core functionalities have been tested and is considered stable, the public API contract may evolve continuously, in form of breaking changes, until a stable API is achieved.

Table Of Contents

About

Cimari is a project derived from ferrumx-windows, created to introduce architectural changes to the entity classes, most notable of which is, making them deeply immutable.

FerrumX-Windows relies on Lombok for a lot of boilerplate code generation for its entity classes. While Lombok supports basic immutability, it does not make Collections or Maps immutable, without which, entity classes can only be considered to be shallow immutable.

Cimari addresses this issue by switching to Immutables, which supports deep immutability.

In addition, Cimari removes the dependency on jPowerShell along with the service methods built around it.

The list doesn't end here. Besides the mentioned changes, there are other internal refactors which attempt to make the project more readable and maintainable.

The full list of changes can be found in Migration Guide and Changelog.

I will continue maintaining FerrumX-Windows separately for as long as I can. However, all new features may not be backported.

Introduction

Cimari is a wrapper around a few CIMWin32 WMI Provider classes and select MSFT classes.

Note that these aforementioned classes are a part of Windows Management Instrumentation, which is Microsoft's implementation of the DMTF CIM Schema, for retrieving SMBIOS Information. Both CIM and SMBIOS standards are defined by Distributed Management Task Force.

Written entirely in Java, the wrapper's primary job is to query the PowerShell for these classes and deserialize provided SMBIOS output into typed entities. Each entity, to which the output is deserialized, represents a loose mapping of an equivalent Win32 Provider or an MSFTclass. For example, the Win32_Processor provider class has an equivalent Win32Processor.java entity which is composed of only the read-only properties of the provider class.

For all the classes, only their read-only properties are accessed. No methods to mutate properties have been implemented so far.

Cross-Platform Support

Cimari heavily relies on WMI, which is Microsoft's implementation of CIM for Windows. This means, only Windows Operating Systems are supported.

There are a few implementations of the CIM Schema that support a variety of Operating Systems:

Unfortunately, most of them have been deprecated or abandoned and were never widely adopted. Therefore, cross-platform compatibility is mostly unplanned for now.

However, you can try out dmidecode4j for Linux. It is a wrapper around the popular utility dmidecode for UNIX operating systems, which provides human-readable SMBIOS data. While it does not strictly follow the WMI CIM Schema, you will find it to be similar to FerrumX-Windows and Cimari, if you are familiar with either of the APIs.

Supported Windows Versions

  • Windows: 7SP1¹, 8.1¹, 10² and 11²
  • PowerShell: 5.1 and above

¹For Windows 8.1 and 7SP1you can install Windows Management Framework 5.1 to upgrade to PowerShell 5.1. See WMF availability across Windows Systems

²This library is not tested on ARM versions of Windows 10 and 11 editions.

CI Stats

Quality Gate Status GitHub Actions Workflow Status Commits to main since latest release

Security Rating Reliability Rating Maintainability Rating Vulnerabilities Coverage

Download

Minimum Supported Java Version: 8

Maven:

<dependency>
    <groupId>io.github.eggy03</groupId>
    <artifactId>cimari</artifactId>
    <version>VERSION</version>
</dependency>

Gradle:

implementation group: 'io.github.eggy03', name: 'cimari', version: 'VERSION'

Replace VERSION with the latest version available in central

Documentation

Usage

Important

More usage examples can be found here.

import io.github.eggy03.cimari.entity.processor.Win32Processor;
import io.github.eggy03.cimari.service.processor.Win32ProcessorService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.util.List;

public class ProcessorExample {

    Logger log = LoggerFactory.getLogger(ProcessorExample.class);

    static void main(String[] args) {

        List<Win32Processor> processorList = new Win32ProcessorService().get(15L); // time after which the session will auto close
        processorList.forEach(cpu -> log.info(cpu.toJson())); // JSON pretty print each cpu instance

        // individual fields are accessible via getter methods
        Win32Processor processor = processorList.getFirst(); // Java 21+ equivalent of (get(0))

        log.info("Processor Name: {}", processor.name());
        log.info("Processor Manufacturer: {}", processor.manufacturer());
        log.info("Processor Max Clock Speed: {} MHz", processor.maxClockSpeed());
    }
}

Projects Using Cimari

  1. Nautilus - A cross-platform Swing based GUI application for displaying computer information

If you want to add your project to this list, simply create an issue with the showcase template and provide the required information.

License

This project is licensed under the MIT License.

About

A wrapper around a few Win32 Provider and MSFT classes, based on the DMTF CIM 2.x Schema, that deserializes read-only SMBIOS output into type-safe and immutable entities.

Topics

Resources

License

Code of conduct

Contributing

Security policy

Stars

Watchers

Forks

Packages

 
 
 

Contributors