Service Cutter Library

The Service Cutter engine (https://github.com/ServiceCutter/ServiceCutter) provided as library which can be used in other applications to generate service decompositions.

License

License

GroupId

GroupId

org.contextmapper
ArtifactId

ArtifactId

service-cutter-library
Last Version

Last Version

1.2.1
Release Date

Release Date

Type

Type

pom
Description

Description

Service Cutter Library
The Service Cutter engine (https://github.com/ServiceCutter/ServiceCutter) provided as library which can be used in other applications to generate service decompositions.
Project URL

Project URL

https://github.com/ContextMapper/service-cutter-library
Project Organization

Project Organization

Context Mapper
Source Code Management

Source Code Management

https://github.com/ContextMapper/service-cutter-library

Download service-cutter-library

How to add to project

<!-- https://jarcasting.com/artifacts/org.contextmapper/service-cutter-library/ -->
<dependency>
    <groupId>org.contextmapper</groupId>
    <artifactId>service-cutter-library</artifactId>
    <version>1.2.1</version>
    <type>pom</type>
</dependency>
// https://jarcasting.com/artifacts/org.contextmapper/service-cutter-library/
implementation 'org.contextmapper:service-cutter-library:1.2.1'
// https://jarcasting.com/artifacts/org.contextmapper/service-cutter-library/
implementation ("org.contextmapper:service-cutter-library:1.2.1")
'org.contextmapper:service-cutter-library:pom:1.2.1'
<dependency org="org.contextmapper" name="service-cutter-library" rev="1.2.1">
  <artifact name="service-cutter-library" type="pom" />
</dependency>
@Grapes(
@Grab(group='org.contextmapper', module='service-cutter-library', version='1.2.1')
)
libraryDependencies += "org.contextmapper" % "service-cutter-library" % "1.2.1"
[org.contextmapper/service-cutter-library "1.2.1"]

Dependencies

compile (6)

Group / Artifact Type Version
org.graphstream : gs-core jar 1.3
org.graphstream : gs-algo jar 1.3
org.slf4j : slf4j-log4j12 jar 1.7.28
com.google.guava : guava jar 28.1-jre
com.fasterxml.jackson.core : jackson-databind jar 2.9.2
org.nlpub : watset jar 2.1.5

Project Modules

There are no modules declared in this project.

Context Mapper

Service Cutter Library

Build Status codecov Maven Central License

The Service Cutter tool provides a structured way to service decomposition. It is based on the Bachelor Thesis by Lukas Kölbener and Michael Gysel.

The original tool repository is located under https://github.com/ServiceCutter/ServiceCutter.

This fork aims to provide the Service Cutter engine as a library to be used within other tools such as Context Mapper.

Usage

The library is published to the Maven central repository, so you can easily include it to your Gradle or Maven build:

Gradle:

implementation 'org.contextmapper:service-cutter-library:1.2.1'

Maven:

<dependency>
  <groupId>org.contextmapper</groupId>
  <artifactId>service-cutter-library</artifactId>
  <version>1.2.1</version>
</dependency>

Eclipse:

Since we use the library inside our Context Mapper Eclipse plugin, we also need it as Eclipse feature (OSGi bundle) in a P2 repository. Thus, we provide the following two Eclipse update sites for snapshots (master builds) and releases:

Input

As in the original Service Cutter tool there are two input models which you need to generate service decompositions with the library:

  • Domain Model (Entity Relation Model); required
  • User Representations; optional

Originally these input models are provided as JSON files. You find explanations and examples on the Service Cutter page. You also find the examples in our test resources, here. However, if you use this library you just have to provide the models with the classes offered in the package ch.hsr.servicecutter.api.model. Thereby you can create the models manually in Java or however you want to create it.

Solver Configuration

In the original Service Cutter tool you can provide parameters and priorities on the coupling criteria via the user interface. This configuration has to be provided with the ch.hsr.servicecutter.solver.SolverConfiguration class here in the library version. The configuration can be created with the ch.hsr.servicecutter.api.SolverConfigurationFactory which gives you the default configuration which can then be changed (factory also provides JSON import).

Usage Example

Usage of Service Cutter within your application, in case you provide the input files (entity relations and user representations) as JSON files:

public static void main(String[] args) throws IOException {
    // create ERD and user representations from JSON files
    File erdFile = new File("./src/test/resources/booking_1_model.json");
    File urFile = new File("./src/test/resources/booking_2_user_representations.json");
    EntityRelationDiagram erd = new EntityRelationDiagramImporterJSON().createERDFromJSONFile(erdFile);
    UserRepresentationContainer userRepresentations = new UserRepresentationContainerImporterJSON()
        .createUserRepresentationContainerFromJSONFile(urFile);

    // build solver context (user representations are optional)
    ServiceCutterContext context = new ServiceCutterContextBuilder(erd)
        .withUserRepresentations(userRepresentations)
        .build();

    // generate service decompositions
    SolverResult result = new ServiceCutter(context).generateDecomposition();
    
    // analyze and do something with the result ...
}

If you don't want to work with JSON files you can construct the models manually with the classes provided in the package ch.hsr.servicecutter.api.model.

If you want to create the SolverConfiguration and change priorities on coupling criteria it can be done as follows:

// create configuration
SolverConfiguration configuration = new SolverConfigurationFactory().createDefaultConfiguration();
        
// change parameters
configuration.setPriority(CouplingCriterion.PREDEFINED_SERVICE, SolverPriority.XS);
        
// build solver context (user representations are optional)
ServiceCutterContext context = new ServiceCutterContextBuilder(erd)
    .withUserRepresentations(userRepresentations)
    .withCustomSolverConfiguration(configuration)
    .build();

Note: If you don't pass a configuration to the ServiceCutterContextBuilder, it will use the default configuration.

With the ch.hsr.servicecutter.api.SolverConfigurationFactory you can also create the Configuration from a JSON file. The default configuration looks as follows: (JSON)

{
  "algorithmParams": {
    "leungM": 0.1,
    "leungDelta": 0.55,
    "cwNodeWeighting": 1.0,
    "mclExpansionOperations": 2.0,
    "mclPowerCoefficient": 2.0
  },
  "priorities": {
    "Identity & Lifecycle Commonality": "M",
    "Semantic Proximity": "M",
    "Shared Owner": "M",
    "Structural Volatility": "XS",
    "Latency": "M",
    "Consistency Criticality": "XS",
    "Availability Criticality": "XS",
    "Content Volatility": "XS",
    "Consistency Constraint": "M",
    "Storage Similarity": "XS",
    "Predefined Service Constraint": "M",
    "Security Contextuality": "M",
    "Security Criticality": "XS",
    "Security Constraint": "M"
  },
  "algorithm": "Leung"
}

Priorities

The solver currently supports the following priorities: IGNORE, XS, S, M, L, XL, XXL

Algorithms

We currently only support the "Epidemic Label Propagation" by Leung et al. The "Girvan-Newman" algorithm by M. Girvan and M. E. J. Newman has been supported by Service Cutter but we haven't included it into the library due to its license. We want to add new algorithms in the future.

Build

If you want to checkout the library and build it by yourself you can do that with the following Gradle command: (prerequisite: JDK 1.8)

./gradlew clean build

Contributing

Contribution is always welcome! Here are some ways how you can contribute:

  • Create Github issues if you find bugs or just want to give suggestions for improvements.
  • This is an open source project: if you want to code, create pull requests from forks of this repository. Please refer to a Github issue if you contribute this way.

Licence

Service Cutter and this library version are released under the Apache License, Version 2.0.

org.contextmapper

Context Mapper

A Modeling Framework for Strategic Domain-driven Design (DDD) and Service Decomposition

Versions

Version
1.2.1
1.2.0
1.1.5
1.1.4
1.1.3
1.1.2
1.1.1
1.1.0
1.0.4
1.0.3
1.0.2
1.0.1
1.0.0