Skip to content

Commit

Permalink
Merge pull request #1180 from eclipse-passage/1084
Browse files Browse the repository at this point in the history
Please use latest version of com.sun.jna and com.sun.jna.platform #1084
  • Loading branch information
eparovyshnaya authored Dec 7, 2022
2 parents 0ca83d4 + d049889 commit 20ddbe9
Show file tree
Hide file tree
Showing 8 changed files with 64 additions and 42 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,12 @@
<message_argument value="org.eclipse.osgi"/>
</message_arguments>
</filter>
<filter id="933232702">
<message_arguments>
<message_argument value="2.6.1"/>
<message_argument value="org.eclipse.osgi"/>
</message_arguments>
</filter>
</resource>
<resource path="META-INF/MANIFEST.MF" type="org.osgi.service.cm.Configuration">
<filter id="305422471">
Expand Down
6 changes: 6 additions & 0 deletions bundles/org.eclipse.passage.lic.jface/.settings/.api_filters
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,11 @@
<message_argument value="org.eclipse.osgi"/>
</message_arguments>
</filter>
<filter id="933232702">
<message_arguments>
<message_argument value="2.6.1"/>
<message_argument value="org.eclipse.osgi"/>
</message_arguments>
</filter>
</resource>
</component>
6 changes: 3 additions & 3 deletions bundles/org.eclipse.passage.lic.oshi/META-INF/MANIFEST.MF
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ Bundle-Name: %Bundle-Name
Bundle-Vendor: %Bundle-Vendor
Bundle-Copyright: %Bundle-Copyright
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
Require-Bundle: com.sun.jna;bundle-version="[4.5.1,5.0.0)",
com.sun.jna.platform;bundle-version="[4.5.1,5.0.0)",
com.github.oshi.oshi-core;bundle-version="[3.8.0,3.10.0)",
Require-Bundle: com.sun.jna;bundle-version="5.12.0",
com.sun.jna.platform;bundle-version="5.12.0",
com.github.oshi.oshi-core;bundle-version="6.2.2",
org.eclipse.passage.lic.api;bundle-version="2.6.1",
org.eclipse.passage.lic.base;bundle-version="2.6.1"
Export-Package: org.eclipse.passage.lic.oshi
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2020 ArSysOp
* Copyright (c) 2020, 2022 ArSysOp
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License 2.0 which is available at
Expand All @@ -9,10 +9,10 @@
*
* Contributors:
* ArSysOp - initial API and implementation
* ArSysOp - porting to OSHi 6.3.2
*******************************************************************************/
package org.eclipse.passage.lic.oshi;

import java.net.SocketException;
import java.util.function.Supplier;

import oshi.hardware.NetworkIF;
Expand All @@ -27,21 +27,7 @@ final class NetHardwareAddress implements Supplier<String> {

@Override
public String get() {
byte[] address;
try {
address = net.getNetworkInterface().getHardwareAddress();
} catch (SocketException e) {
return null; // mimic null: supports OSHI reading policy
}
return enlisted(address);
}

private String enlisted(byte[] bytes) {
StringBuilder out = new StringBuilder();
for (int one : bytes) {
out.append(one);
}
return out.toString();
return net.getMacaddr();
}

}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2020, 2021 ArSysOp
* Copyright (c) 2020, 2022 ArSysOp
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License 2.0 which is available at
Expand All @@ -9,6 +9,7 @@
*
* Contributors:
* ArSysOp - initial API and implementation
* ArSysOp - porting to OSHi 6.3.2
*******************************************************************************/
package org.eclipse.passage.lic.oshi;

Expand All @@ -30,7 +31,7 @@

import oshi.SystemInfo;
import oshi.hardware.Baseboard;
import oshi.hardware.CentralProcessor;
import oshi.hardware.CentralProcessor.ProcessorIdentifier;
import oshi.hardware.ComputerSystem;
import oshi.hardware.HardwareAbstractionLayer;
import oshi.software.os.OperatingSystem;
Expand Down Expand Up @@ -107,13 +108,13 @@ private void read() throws LicensingException {
private void readOS(OperatingSystem info) {
hardware.store(info::getFamily, new OS.Family());
hardware.store(info::getManufacturer, new OS.Manufacturer());
hardware.store(info.getVersion()::getVersion, new OS.Version());
hardware.store(info.getVersion()::getBuildNumber, new OS.BuildNumber());
hardware.store(info.getVersionInfo()::getVersion, new OS.Version());
hardware.store(info.getVersionInfo()::getBuildNumber, new OS.BuildNumber());
}

private void readHal(HardwareAbstractionLayer hal) {
readPart(hal::getComputerSystem, this::readSystem);
readPart(hal::getProcessor, this::readProcessor);
readPart(hal.getProcessor()::getProcessorIdentifier, this::readProcessor);
}

private void readSystem(ComputerSystem info) {
Expand All @@ -139,7 +140,7 @@ private void readFirmware(oshi.hardware.Firmware info) {
hardware.store(info::getDescription, new Firmware.Description());
}

private void readProcessor(CentralProcessor info) {
private void readProcessor(ProcessorIdentifier info) {
hardware.store(info::getVendor, new Cpu.Vendor());
hardware.store(info::getFamily, new Cpu.Family());
hardware.store(info::getModel, new Cpu.Model());
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2020 ArSysOp
* Copyright (c) 2020, 2022 ArSysOp
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License 2.0 which is available at
Expand All @@ -9,11 +9,11 @@
*
* Contributors:
* ArSysOp - initial API and implementation
* ArSysOp - porting to OSHi 6.3.2
*******************************************************************************/
package org.eclipse.passage.lic.oshi;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Objects;
import java.util.Set;
Expand Down Expand Up @@ -70,11 +70,11 @@ final void read(SystemInfo system) {
new FragileData<>(() -> source(system), this::readSource).supply();
}

private void readSource(T[] source) {
Arrays.stream(source).forEach(src -> properties.add(fillProperties(src, new EnvironmentProperties())));
private void readSource(List<T> source) {
source.stream().forEach(src -> properties.add(fillProperties(src, new EnvironmentProperties())));
}

protected abstract T[] source(SystemInfo system);
protected abstract List<T> source(SystemInfo system);

protected abstract EnvironmentProperties fillProperties(T source, EnvironmentProperties props);

Expand All @@ -85,7 +85,7 @@ static final class Disks extends Swath<HWDiskStore> {
}

@Override
protected HWDiskStore[] source(SystemInfo system) {
protected List<HWDiskStore> source(SystemInfo system) {
return system.getHardware().getDiskStores();
}

Expand All @@ -106,7 +106,7 @@ static final class Nets extends Swath<NetworkIF> {
}

@Override
protected NetworkIF[] source(SystemInfo system) {
protected List<NetworkIF> source(SystemInfo system) {
return system.getHardware().getNetworkIFs();
}

Expand Down
4 changes: 2 additions & 2 deletions features/org.eclipse.passage.lic.oshi.feature/feature.xml
Original file line number Diff line number Diff line change
Expand Up @@ -40,14 +40,14 @@
id="com.sun.jna"
download-size="0"
install-size="0"
version="4.5.1.v20210503-0343"
version="0.0.0"
unpack="false"/>

<plugin
id="com.sun.jna.platform"
download-size="0"
install-size="0"
version="4.5.1.v20221112-0806"
version="0.0.0"
unpack="false"/>

<plugin
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
Contributors:
ArSysOp - initial API and implementation
-->
<target name="org.eclipse.passage.target" sequenceNumber="109">
<target name="org.eclipse.passage.target" sequenceNumber="110">
<locations>
<location includeAllPlatforms="false" includeConfigurePhase="false" includeMode="planner" includeSource="true" type="InstallableUnit">
<repository location="https://download.eclipse.org/cbi/updates/license/"/>
Expand Down Expand Up @@ -75,9 +75,6 @@
<unit id="com.fasterxml.jackson.core.jackson-annotations" version="0.0.0"/>
<unit id="com.fasterxml.jackson.core.jackson-core" version="0.0.0"/>
<unit id="com.fasterxml.jackson.core.jackson-databind" version="0.0.0"/>
<unit id="com.github.oshi.oshi-core" version="0.0.0"/>
<unit id="com.sun.jna" version="4.5.1.v20210503-0343"/>
<unit id="com.sun.jna.platform" version="4.5.1.v20221112-0806"/>
<unit id="jakarta.servlet" version="0.0.0"/>
<unit id="javax.activation" version="0.0.0"/>
<unit id="org.apache.commons.csv" version="0.0.0"/>
Expand All @@ -87,8 +84,34 @@
<unit id="org.bouncycastle.bcprov" version="0.0.0"/>
<unit id="org.bouncycastle.bcutil" version="0.0.0"/>
<unit id="org.junit" version="0.0.0"/>
<unit id="org.slf4j.api" version="0.0.0"/>
<unit id="org.slf4j.apis.log4j" version="0.0.0"/>
</location>
<location includeDependencyDepth="none" includeDependencyScopes="compile" includeSource="true" missingManifest="error" type="Maven">
<dependencies>
<dependency>
<groupId>com.github.oshi</groupId>
<artifactId>oshi-core</artifactId>
<version>6.2.2</version>
<type>jar</type>
</dependency>
<dependency>
<groupId>net.java.dev.jna</groupId>
<artifactId>jna-platform</artifactId>
<version>5.12.1</version>
<type>jar</type>
</dependency>
<dependency>
<groupId>net.java.dev.jna</groupId>
<artifactId>jna</artifactId>
<version>5.12.1</version>
<type>jar</type>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>1.7.36</version>
<type>jar</type>
</dependency>
</dependencies>
</location>
</locations>
</target>
</target>

0 comments on commit 20ddbe9

Please sign in to comment.