Satellite :: Plugins

Satellite toolkit provides an homogeneous invocation mechanism for Windows and Unix background process

Лицензия

Лицензия

MIT
Группа

Группа

io.zatarox.satellite
Идентификатор

Идентификатор

satellite-plugin-parent
Последняя версия

Последняя версия

1.0.0
Дата

Дата

Тип

Тип

pom
Описание

Описание

Satellite :: Plugins
Satellite toolkit provides an homogeneous invocation mechanism for Windows and Unix background process

Скачать satellite-plugin-parent

Имя Файла Размер
satellite-plugin-parent-1.0.0.pom 3 KB
Обзор

Как подключить последнюю версию

<!-- https://jarcasting.com/artifacts/io.zatarox.satellite/satellite-plugin-parent/ -->
<dependency>
    <groupId>io.zatarox.satellite</groupId>
    <artifactId>satellite-plugin-parent</artifactId>
    <version>1.0.0</version>
    <type>pom</type>
</dependency>
// https://jarcasting.com/artifacts/io.zatarox.satellite/satellite-plugin-parent/
implementation 'io.zatarox.satellite:satellite-plugin-parent:1.0.0'
// https://jarcasting.com/artifacts/io.zatarox.satellite/satellite-plugin-parent/
implementation ("io.zatarox.satellite:satellite-plugin-parent:1.0.0")
'io.zatarox.satellite:satellite-plugin-parent:pom:1.0.0'
<dependency org="io.zatarox.satellite" name="satellite-plugin-parent" rev="1.0.0">
  <artifact name="satellite-plugin-parent" type="pom" />
</dependency>
@Grapes(
@Grab(group='io.zatarox.satellite', module='satellite-plugin-parent', version='1.0.0')
)
libraryDependencies += "io.zatarox.satellite" % "satellite-plugin-parent" % "1.0.0"
[io.zatarox.satellite/satellite-plugin-parent "1.0.0"]

Зависимости

compile (2)

Идентификатор библиотеки Тип Версия
org.apache.maven : maven-core jar 3.3.9
org.apache.maven : maven-compat jar 3.3.9

provided (1)

Идентификатор библиотеки Тип Версия
org.apache.maven.plugin-tools : maven-plugin-annotations jar 3.5

test (4)

Идентификатор библиотеки Тип Версия
org.apache.maven.plugin-testing : maven-plugin-testing-harness jar 3.3.0
junit : junit jar 4.12
org.powermock : powermock-api-mockito jar 1.6.6
org.powermock : powermock-module-junit4 jar 1.6.6

Модули Проекта

  • dumper
  • runner

Satellite Toolkit

Satellite is a set of utilities and Java support classes for running Java applications as server processes. Commonly known as 'daemon' processes in Unix terminology, on Windows they are called 'services'.

Build Status Coverage Status Maven Central

Requirements

Compilation process is performed under Linux. Cross-compilation fanboy :-)

  • Gradle 4.4.x
  • Java Development Kit >= 7
  • Clang 5.x
  • mingw-w64-x86-64-dev (gcc 5.x)
  • libc6-dev-i386

Satellite in action

Writing an independent OS background process become pretty simple. The first step is to implement a java interface who manage background process behaviors. The second step require Phobos or Deimos depending if you are under Windows or Linux. The Daemon behavior has been designed as the same manner as Windows service. Under Windows, only certain service state transitions are valid. The following diagram shows the valid transitions (credits to Microsoft) :

Dependency

In your project, add the Satellite API dependency (Maven POM):

<dependency>
    <groupId>io.zatarox.satellite</groupId>
    <artifactId>satellite-api</artifactId>
    <version>1.0.0-SNAPSHOT</version>
    <scope>provided</scope>
</dependency>

Core of the background process

This is the facade of your service. Attention : calls on these methods are synchronous.

import io.zatarox.satellite.*;

public final class FooBackgroundProcess implements BackgroundProcess {

    @Override
    public void initialize(BackgroundContext dc) throws BackgroundException, Exception {
        System.err.println("Initialized");
    }

    @Override
    public void resume() throws Exception {
        System.err.println("Started...");
    }

    @Override
    public void pause() throws Exception {
        System.err.println("Stopped !");
    }

    @Override
    public void shutdown() {
        System.err.println("Destroyed");
    }
}

Main jar assembly

Finally, add a manifest entry in your main jar (and dependency jars OFC).

<plugin>
  <artifactId>maven-jar-plugin</artifactId>
    <version>3.0.2</version>
        <configuration>
        <archive>
            <index>true</index>
            <manifestEntries>
                <Background-Process-Class>io.zatarox.satellite.FooBackgroundProcess</Background-Process-Class>
            </manifestEntries>
        </archive>
    </configuration>
</plugin>

Sample

To a look to the sample project submodule to see how to get binary frontends from Gradle

Inspiration

This project is based on Apache Commons Daemon.

Версии библиотеки

Версия
1.0.0