Code Monkey home page Code Monkey logo

java-systemd's People

Contributors

brett-smith avatar thjomnx avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

java-systemd's Issues

java-systemd not compatible with dbus-java v5

With the latest major release of dbus-java (v5.0.0), Systemd.get().getManager() fails with:

java.lang.NoSuchMethodError: org/freedesktop/dbus/connections/impl/DBusConnection.getConnection(Lorg/freedesktop/dbus/connections/impl/DBusConnection$DBusBusType;)Lorg/freedesktop/dbus/connections/impl/DBusConnection; (loaded from xxxxxxx/org.freeedesktop.dbus.5.0.jar by org.eclipse.osgi.internal.loader.EquinoxClassLoader@99aa01a5[org.freeedesktop.dbus:5.0.0(id=183)]) called from class de.thjom.java.systemd.Systemd (loaded from xxxxxxxxx/de.thjom.java.systemd.2.1.jar by org.eclipse.osgi.internal.loader.EquinoxClassLoader@3fb8805f[de.thjom.java.systemd:2.1.0(id=204)]).
	de.thjom.java.systemd.Systemd.open(Systemd.java:164)
	de.thjom.java.systemd.Systemd.get(Systemd.java:116)
	de.thjom.java.systemd.Systemd.get(Systemd.java:105)
	...

Apparently the DBusConnection.getConnection(DBusConnection.DBusBusType.SYSTEM) method has been removed.

I had the same issue with some low-level code which uses dbus-java directly, and it worked by using:
DBusConnection dBusConnection = DBusConnectionBuilder.forSystemBus().build() instead.

Creation of units and services?

I just recently found your project and it seems to have a great set of API calls for managing and monitoring units and services. However, after searching around, I can't seem to find any functions that help in the creation of new units and services.

I am working on a program that dynamically creates services for systemd to manager and I am hoping to leverage your API for both monitoring, managing and also creating these units. Currently I create the units via a template:

[Unit]
Description=Transcoding StreamID %%i

[Service]
ExecStart=/bin/echo TEST %1$s/%%i :: Random num: %2$s
User=%1$s
Restart=always
RestartSec=3
StandardOutput=journal+console
StandardError=journal+console
SyslogIdentifier=transcoding_streamid_%%i

[Install]
Alias=transcoding-streamid-%%i
WantedBy=multi-user.target

I use String.format to create a file called [email protected] and the %%i works with the @ aspect of the service unit.

Then I run this command to enable it and fire it up:

new ProcessBuilder()
        .command("sudo", "systemctl", "enable", "--now", serviceFile.getPath())
        .redirectErrorStream(true)
        .start();

I have various other code to read the stdout/stderr and also check the exit value, ensuring it returns 0. All that said, is there functionality in your system to create and register services?

If not, I may be interested in extending this ability into your API (if time allows). Do you have a thought on where it would be best to implement this ability? Would you recommend sub classing and/or implementing any particular interfaces in your code to make this happen properly?

Problem using methods that returns tuples

In ManagerInterface there is some methods that returns a Tuples

Ex: EnableUnitFiles, ReenableUnitFiles, PresetUnitFiles etc.

This doesn't work in current version and throws an exception when trying to map the result back to List
There exists a similar function reenableUnitFiles that returns List but that also fails to run.

@DBusMemberName(value = "EnableUnitFiles")
List<UnitFileChange> enableUnitFiles(List<String> names, boolean runtime, boolean force);

The return signature for this functions is ba(sss) so it should probably be changed to something like:

PairTuplet<Boolean, List<UnitFileChange>> enableUnitFiles(List<String> names, boolean runtime, boolean force);

Where PairTuplet extends Tuplet.
For some reason it seems only to work when using parameterized typed class otherwise it would probably only need to change to:

UnitFileInstallChange enableUnitFiles(List<String> names, boolean runtime, boolean force);

And that UnitFileInstallChange holds an List of UnitFileChanges instead of only one UnitFileChanges as it is today. But we didn't get that one to work.

[question] How did you get systemd-dbus java binding?

Hey Markus,
This issue is question, so feel free to close it if you wish. I noticed that you have a bunch of code which seems to be maintained manually. Yet looking at it amount I believe first portion could be generated few years back. Was it a case? Can you recommend any code generator which actually works?
Generator I found in dbus-java produces incomplete results.

Thanks,
Łukasz

Set Logging Level

Thank you very much for creating this nice library!

As I am a Java noob, I haven't found a way to change the log level of the library.
Could you point that out to me?

Cheers,
Valentin

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.