Suche

What you will learn

In this short summary you will get an idea how services are registered to the engine and how to write your own IServiceProvider.

1. Basics

The IServiceProvider is the core component that enables the developers to register services, so that they become available throughout the runtime of the IEngine. The used IServiceProvider can be assigned to the IContext (with the ContextBuilder) during the process of the Engine Builder while creating the default IEngine.

By default, the IServiceProvider is the preferred source for fetching services. But when a service couldn’t be found, then the default IEngine falls back on the ServiceLoader mechanism provided natively by Java. This behaviour can be configured through the IServiceProvider method boolean preferServiceLoader().

Your implementation of IServiceProvider gets wrapped around internally by the framework and enhanced by the ServiceLoader mechanism.

2. Signature

Before giving a short example on how the interface should be used, this section describes the signature of the IServiceProvider interface, as well as an overview on which methods have to be implemented.

<T> T find(Class<T> clazz);

Fetches the wanted service registered under the class given. Null if none could be found.

<T> T find(Class<T> clazz, String id);

Fetches the wanted service registered under the class and id given. Used for example when multiple services are registered, but only one needs to be fetched.

Map<Class<?>, Object> getAll();

Returns all registered services of the provider.

<A, T extends A> void put(Class<A> clazz, T object);

Registers a service at the provider.

<A, T extends A> void put(Class<A> clazz, T object, String id);

Registers a service with an id at the provider.

default boolean preferServiceLoader()

Defines if the ServiceLoader mechanism is preferred over the service fetched from the provider. By default, it returns false, and services from this provider are preferred.

3. Usage

This section briefly outlines a few examples demonstrating how the IServiceProvider should be used.

3.1. Configure at the Engine Builder

To make sure the services are available during the default IEngine runtime, you need to configure it at the Engine Builder.

// Using the context builder to create a IContext
final ContextBuilder cb = new ContextBuilder(); (1)
// Using your own written IServiceProvider
final IServiceProvider sp = new YourProvider();
cb.setServiceProviderFactory(context -> sp); (2)
// Finalizing the Engine Builder
final IContext context = cb.build();
final IEngine engine = new EngineBuilder()...setContext(context).build(); (3)
1 The IServiceProvider is part of the IContext so we use the Context Builder to combine them both.
2 Registering your implementation is as easy as let it be the return value of an IServiceProviderFactory. As we didn’t implement one we can use an anonymous class to let it return for us.
3 Now the IContext only needs to be set to the Engine Builder and the services will be available to the engine.

The IServiceProvider is part of the IContext and can be later accessed over that, during engine runtime.

3.2. Registering Services

You can register services before configuring it for the IEngine or during the execution. In both cases call the put method of the IServiceProvider to register an implementation to an interface it fulfills.

// Using the context builder to create a IContext
final ContextBuilder cb = new ContextBuilder();
// Using your own written IServiceProvider
final IServiceProvider sp = new YourProvider();

sp.put(IDataTransformer.class, new JsonStringDataTransformer()); (1)

cb.setServiceProviderFactory(context -> sp);
// Finalizing the Engine Builder
final IContext context = cb.build();
final IEngine engine = new EngineBuilder()...setContext(context).build();
1 The service IDataTransformer is registered with the default implementation JsonStringDataTransformer and is now accessible during engine execution.

3.3. Fetching Services

Let’s suppose we are in an inner component of the engine, e.g. a WrappingPersistenceService and want to transform any data before putting them into the persistence. Then the wrapping component only needs to be initialized with the Context of the engine. Then we can fetch the IServiceProvider and request the IDataTransformer service.

class WrappingPersistenceService implements IPersistenceService{

	private final IContext context; (1)
	private final IPersistenceService wrapped;
	...
    @Override
    public Object find(final String key){
		final IDataTransformer dt = this.context.getServiceProvider().find(IDataTransformer.class); (2)
...
    }
}
1 The IContext is set beforehand. Remember that the IServiceProvider is part of the context.
2 Now you can use the context during method invocation to access the services registered in the IServiceProvider
Also services of the ServiceLoader can be fetched this way. Because your given IServiceProvider is enhanced by the mechanism from us.

4. Default Implementations

  • de.asap.pak.core.simple.context.SimpleServiceProvider : Functions as a prototype IServiceProvider which holds the services registered in a map.

  • de.asap.pak.extra.guice.GuiceServiceProvider : Uses the functionalities of Guice, allowing to use its annotation to register services etc.

Sonatype Nexus

PAK features connectors and commands for Sonatype Nexus. This means the software can directly interact with Nexus repositories for storing and managing artifacts. Through these connectors, PAK can automate tasks like uploading binaries or retrieving dependencies, ensuring efficient artifact management within Nexus.

Jenkins

PAK has connectors and commands for Jenkins. This allows the software to directly communicate with Jenkins servers, enabling the automation of CI/CD (Continuous Integration/Continuous Deployment) tasks. Through these connectors, PAK can trigger builds, fetch build statuses, or manage job configurations, streamlining the CI/CD processes within Jenkins.

Git Hub

PAK possesses connectors and commands for GitHub. This means the software can interface directly with GitHub repositories, facilitating actions like code pushes, pull requests, or issue tracking. Through these connectors, PAK can automate various GitHub operations, enhancing code collaboration and repository management.

Atlassian Confluence

PAK is equipped with connectors and commands for Atlassian Confluence. This enables the software to directly interact with Confluence spaces and pages. Through these connectors, PAK can automate actions such as creating, updating, or retrieving documentation, ensuring efficient content management and collaboration within Confluence.

Codebeamer

PAK features connectors and commands for Codebeamer. This allows the software to seamlessly integrate with Codebeamer’s ALM (Application Lifecycle Management) platform. Through these connectors, PAK can automate tasks like issue tracking, test management, or requirements tracing, enhancing the coordination and management of software development processes.

JFrog Artifactory

PAK has connectors and commands for JFrog Artifactory. This means the software can directly interface with Artifactory repositories, enabling actions like artifact storage, retrieval, and management. Through these connectors, PAK can automate tasks such as deploying artifacts or managing repository configurations, streamlining the integration and management of binary artifacts within Artifactory.

Amazon Web Services (AWS)

PAK has connectors and commands for Amazon Web Services (AWS). This means the software possesses specialized interfaces to directly interact with AWS services and execute actions on the AWS platform. Through these connectors, PAK can automate AWS-specific commands, such as launching EC2 instances, managing S3 buckets, or configuring Lambda functions. This allows for efficient integration, management, and automation of AWS resources and services directly from PAK.

Atlassian Jira

PAK features integration tools and capabilities for Atlassian Jira. These tools allow for a direct connection to Jira and the execution of specific actions. Using these integration tools, PAK can automate Jira actions such as adding comments or changing ticket priorities, ensuring seamless handling and coordination of Jira processes.

Git

PAK has connectors and commands for Git. This means it has interfaces to directly communicate with Git and execute actions. Through these connectors, the software can automate Git commands such as retrieving changes or creating branches, enabling efficient integration and management of Git tasks.

Generic Human Tasks

PAK offers you a standard set of commands which require creative input from the user. Enables you to start with automating your workflows, that still need abit of human input.

Generic Commands

PAK offers a standard set of commands giving you the first steps to automate your workflows.

Nexus Maven Command Pool

Nexus is an artifact repository manager for storing binaries, libraries, and artifacts, supporting formats like Maven. Maven, a software project management tool, is based on the Project Object Model (POM) and allows developers to consistently define projects and dependencies. Our Command Pool offers commands for interactions between Maven and Nexus, such as artifact uploads or dependency retrieval.

Artifactory Maven Command Pool

Artifactory allows developers to store, retrieve, and manage binary files and artifacts, providing a
central source for all binaries used in a development process. Apache Maven is a software project
management and comprehension tool that enables developers to consistently describe a project and
its dependencies. Our Command Pool offers a collection of commands used to facilitate interactions
between Maven and Artifactory, such as uploading artifacts or retrieving dependencies.

Open API Command Interpreter

The OpenApi Command Interpreter allows you the automatic parsing of commands from an OpenApi defintion. No additional code needs to be written anymore, just add the address to the definition and our framework does the rest!

Kotlin Command Interpreter

The Kotlin Command Interpreter allows you the parsing and execution of commands within a Kotlin environment to automate various tasks or processes.

Bpmn Interpreter

Workflows come in many shapes and forms. The BPMN (Business Process Model and Notation) Interpreter enables the parsing of worklows defined in the BPMN format into the PAK intern model.

Human Task Interpreter

The Human Task Interpreter allows you the parsing and running of commands within a HTML and Javascript environment. Use this to build commands which need the creative input of a workflow user!

Java Command Interpreter

The Java Command Interpreter allows you the parsing and execution of commands within a Java
environment to automate various tasks or processes.

Core

The heart of the PAK-Framework. Contains the means to run workflows with the PAK engine, but also the possibility to enrich the frameworks interfaces with your own implementations and solutions.

RocksDB Persistence

Data that is generated by a workflow run needs to be saved for short or longer terms. Our solution to the Persistence Interface of the PAK-Framework is to use the high-performance, key-value based RocksDB developed by Facebook.

PAK online

PAK Online is a web based application and provides an Open API based REST API. It enables you to upload workflows and run them periodically or on REST demand.

Command Line App

Run tasks and workflows on the console or as part of a CI/CD Pipeline with our Command Line Interface.

Workflow Editor

With our specially developed editor, a wide variety of workflows can be easily modeled in the wide known BPMN process format.

Workflow Executor

The Workflow Executor is the application to run your workflows. It features a multilingual UI and easy managment of your favorite workflows.

Support

We offer a community website where you can exchange ideas and support each other. For our Pro packages we also offer full support via email.