Skip to content

Library containing core classes and utilities that are independent of a portal.

License

Notifications You must be signed in to change notification settings

qbicsoftware/core-utils-lib

Repository files navigation

Core Utilities Library

A collection of non-Vaadin, non-Liferay utilities.

Github Workflow Build Maven Package Status Github Workflow Tests Status CodeQl Status Release status Project Licence Written in Java Written in Groovy

How to Run

To build this library use Maven and Java 8:

First compile the project and build an executable java archive:

mvn clean package

Note that you will need java 8. The JAR file will be created in the /target folder:

|-target
|---core-utils-lib-1.0.0-SNAPSHOT.jar
|---...

How to Use

This is a library and the most common way to use this library in particular is by including it in your pom.xml as a dependency:

<dependency>
  <groupId>life.qbic</groupId>
  <artifactId>core-utils-lib</artifactId>
  <version>X.Y.Z</version>
</dependency>

Find QBiC services

Finding QBiC service instances from within an application is as easy as this:

// Example in Groovy
def serviceList = []
def serviceRegistryUrl = new Url("https://host-name-of-registry:<port>/v1")
def connector = new ConsulConnector(serviceRegistryUrl)
connector.withCloseable {
    ConsulServiceFactory factory = new ConsulServiceFactory(it)
    serviceList.addAll(factory.getServicesOfType(ServiceType.SAMPLE_TRACKING))
}
// Example in Java
List serviceList = new ArrayList<>()
Url serviceRegistryUrl = new URL("https://host-name-of-registry:<port>/v1")
try (ConsulConnector connector = new ConsulConnector(serviceRegistryUrl)) {
    ConsulServiceFactory factory = new ConsulServiceFactory(connector)
    serviceList.addAll(factory.getServicesOfType(ServiceType.SAMPLE_TRACKING))
}

License

This work is licensed under the MIT license.

Note: This work uses the Micronaut Framework and derivatives from the Micronaut framework family, its which are licensed under Apache 2.0.