Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions .github/workflows/checkstyle.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
name: checkstyle

on:
workflow_dispatch:
pull_request:
branches: [ main ]

jobs:
checkstyle:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: actions/setup-java@v5
with:
distribution: 'temurin'
java-version: '17'
- name: Run Checkstyle
run: ./gradlew checkstyleMain checkstyleTest
1 change: 1 addition & 0 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ plugins {
`java-library`
`maven-publish`
signing
checkstyle
id("com.vanniktech.maven.publish") version "0.36.0"
}

Expand Down
436 changes: 436 additions & 0 deletions config/checkstyle/checkstyle.xml

Large diffs are not rendered by default.

22 changes: 22 additions & 0 deletions config/checkstyle/suppressions.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<?xml version="1.0"?>

<!--
~ Copyright (c) 2022 Microsoft Corporation
~
~ This program and the accompanying materials are made available under the
~ terms of the Apache License, Version 2.0 which is available at
~ https://www.apache.org/licenses/LICENSE-2.0
~
~ SPDX-License-Identifier: Apache-2.0
~
~ Contributors:
~ Microsoft Corporation - initial API and implementation
~
-->

<!DOCTYPE suppressions PUBLIC
"-//Puppy Crawl//DTD Suppressions 1.1//EN"
"http://www.puppycrawl.com/dtds/suppressions_1_1.dtd">
<suppressions>
<suppress files="package-info.java" checks="[a-zA-Z0-9]*"/>
</suppressions>
22 changes: 11 additions & 11 deletions src/main/java/org/eclipse/dataplane/Dataplane.java
Original file line number Diff line number Diff line change
Expand Up @@ -58,12 +58,12 @@ public class Dataplane {
private final Set<String> transferTypes = new HashSet<>();
private final Set<String> labels = new HashSet<>();

private OnPrepare onPrepare = _m -> Result.failure(new UnsupportedOperationException("onPrepare is not implemented"));
private OnStart onStart = _m -> Result.failure(new UnsupportedOperationException("onStart is not implemented"));
private OnTerminate onTerminate = _m -> Result.failure(new UnsupportedOperationException("onTerminate is not implemented"));
private OnSuspend onSuspend = _m -> Result.failure(new UnsupportedOperationException("onSuspend is not implemented"));
private OnStarted onStarted = _m -> Result.failure(new UnsupportedOperationException("onStarted is not implemented"));;
private OnCompleted onCompleted = _m -> Result.failure(new UnsupportedOperationException("onCompleted is not implemented"));
private OnPrepare onPrepare = dataFlow -> Result.failure(new UnsupportedOperationException("onPrepare is not implemented"));
private OnStart onStart = dataFlow -> Result.failure(new UnsupportedOperationException("onStart is not implemented"));
private OnTerminate onTerminate = dataFlow -> Result.failure(new UnsupportedOperationException("onTerminate is not implemented"));
private OnSuspend onSuspend = dataFlow -> Result.failure(new UnsupportedOperationException("onSuspend is not implemented"));
private OnStarted onStarted = dataFlow -> Result.failure(new UnsupportedOperationException("onStarted is not implemented"));
private OnCompleted onCompleted = dataFlow -> Result.failure(new UnsupportedOperationException("onCompleted is not implemented"));

private final HttpClient httpClient = HttpClient.newHttpClient();
private final ObjectMapper objectMapper = new ObjectMapper();
Expand Down Expand Up @@ -173,7 +173,7 @@ public Result<Void> terminate(String dataFlowId, DataFlowTerminateMessage messag
/**
* Notify the control plane that the data flow has been completed.
*
* @param dataFlowId
* @param dataFlowId id of the data flow
*/
public Result<Void> notifyCompleted(String dataFlowId) {
return store.findById(dataFlowId)
Expand Down Expand Up @@ -201,8 +201,8 @@ public Result<Void> notifyCompleted(String dataFlowId) {
/**
* Notify the control plane that the data flow failed for some reason
*
* @param dataFlowId
* @param throwable
* @param dataFlowId id of the data flow
* @param throwable the error
*/
public Result<Void> notifyErrored(String dataFlowId, Throwable throwable) {
return store.findById(dataFlowId)
Expand Down Expand Up @@ -243,8 +243,8 @@ public Result<Void> started(String flowId, DataFlowStartedNotificationMessage st
/**
* Received notification that the flow has been completed
*
* @param flowId
* @return
* @param flowId id of the data flow
* @return result indicating whether data flow was completed successfully
*/
public Result<Void> completed(String flowId) {
return store.findById(flowId).compose(onCompleted::action)
Expand Down
22 changes: 18 additions & 4 deletions src/main/java/org/eclipse/dataplane/domain/DataAddress.java
Original file line number Diff line number Diff line change
@@ -1,3 +1,17 @@
/*
* Copyright (c) 2025 Think-it GmbH
*
* This program and the accompanying materials are made available under the
* terms of the Apache License, Version 2.0 which is available at
* https://www.apache.org/licenses/LICENSE-2.0
*
* SPDX-License-Identifier: Apache-2.0
*
* Contributors:
* Think-it GmbH - initial API and implementation
*
*/

package org.eclipse.dataplane.domain;

import com.fasterxml.jackson.annotation.JsonProperty;
Expand All @@ -15,10 +29,10 @@ public DataAddress(String endpointType, String endpoint, List<EndpointProperty>
this("DataAddress", endpointType, endpoint, endpointProperties);
}

public record EndpointProperty (
String type,
String name,
String value
public record EndpointProperty(
String type,
String name,
String value
) {

}
Expand Down
29 changes: 23 additions & 6 deletions src/main/java/org/eclipse/dataplane/domain/Result.java
Original file line number Diff line number Diff line change
@@ -1,3 +1,17 @@
/*
* Copyright (c) 2025 Think-it GmbH
*
* This program and the accompanying materials are made available under the
* terms of the Apache License, Version 2.0 which is available at
* https://www.apache.org/licenses/LICENSE-2.0
*
* SPDX-License-Identifier: Apache-2.0
*
* Contributors:
* Think-it GmbH - initial API and implementation
*
*/

package org.eclipse.dataplane.domain;

import java.util.NoSuchElementException;
Expand All @@ -13,13 +27,15 @@ public static <C> Result<C> success(C content) {
return new Success<>(content);
}

public static <R> Result<R> failure(Exception e){ return new Failure<>(e); }
public static <R> Result<R> failure(Exception e) {
return new Failure<>(e);
}

public static <R> Result<R> attempt(ExceptionThrowingSupplier<R> resultSupplier) {
try {
var resultValue = resultSupplier.get();
return Result.success(resultValue);
} catch (Exception exception){
} catch (Exception exception) {
return Result.failure(exception);
}
}
Expand All @@ -32,7 +48,7 @@ public static <R> Result<R> attempt(ExceptionThrowingSupplier<R> resultSupplier)

public abstract <X extends Throwable> C orElseThrow(Function<Exception, X> exceptionSupplier) throws X;

public abstract <T> Result<T> map(ExceptionThrowingFunction<C,T> transformValue);
public abstract <T> Result<T> map(ExceptionThrowingFunction<C, T> transformValue);

public abstract <T> Result<T> compose(ExceptionThrowingFunction<C, Result<T>> transformValue);

Expand All @@ -48,7 +64,7 @@ private static class Success<C> extends Result<C> {

private final C content;

public Success(C content) {
Success(C content) {
this.content = content;
}

Expand Down Expand Up @@ -81,7 +97,7 @@ public <T> Result<T> map(ExceptionThrowingFunction<C, T> transformValue) {
public <T> Result<T> compose(ExceptionThrowingFunction<C, Result<T>> transformValue) {
try {
return transformValue.apply(this.content);
} catch(Exception e) {
} catch (Exception e) {
return Result.failure(e);
}
}
Expand All @@ -90,6 +106,7 @@ public <T> Result<T> compose(ExceptionThrowingFunction<C, Result<T>> transformVa
private static class Failure<C> extends Result<C> {

private final Exception exception;

private Failure(Exception exception) {
this.exception = exception;
}
Expand Down Expand Up @@ -126,7 +143,7 @@ public <T> Result<T> compose(ExceptionThrowingFunction<C, Result<T>> transformVa
}

@FunctionalInterface
public interface ExceptionThrowingFunction<T,R> {
public interface ExceptionThrowingFunction<T, R> {
R apply(T t) throws Exception;
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,17 @@
/*
* Copyright (c) 2025 Think-it GmbH
*
* This program and the accompanying materials are made available under the
* terms of the Apache License, Version 2.0 which is available at
* https://www.apache.org/licenses/LICENSE-2.0
*
* SPDX-License-Identifier: Apache-2.0
*
* Contributors:
* Think-it GmbH - initial API and implementation
*
*/

package org.eclipse.dataplane.domain.dataflow;

import java.util.List;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,17 @@
/*
* Copyright (c) 2025 Think-it GmbH
*
* This program and the accompanying materials are made available under the
* terms of the Apache License, Version 2.0 which is available at
* https://www.apache.org/licenses/LICENSE-2.0
*
* SPDX-License-Identifier: Apache-2.0
*
* Contributors:
* Think-it GmbH - initial API and implementation
*
*/

package org.eclipse.dataplane.domain.dataflow;

import org.eclipse.dataplane.domain.DataAddress;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,17 @@
/*
* Copyright (c) 2025 Think-it GmbH
*
* This program and the accompanying materials are made available under the
* terms of the Apache License, Version 2.0 which is available at
* https://www.apache.org/licenses/LICENSE-2.0
*
* SPDX-License-Identifier: Apache-2.0
*
* Contributors:
* Think-it GmbH - initial API and implementation
*
*/

package org.eclipse.dataplane.domain.dataflow;

import org.eclipse.dataplane.domain.DataAddress;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,17 @@
/*
* Copyright (c) 2025 Think-it GmbH
*
* This program and the accompanying materials are made available under the
* terms of the Apache License, Version 2.0 which is available at
* https://www.apache.org/licenses/LICENSE-2.0
*
* SPDX-License-Identifier: Apache-2.0
*
* Contributors:
* Think-it GmbH - initial API and implementation
*
*/

package org.eclipse.dataplane.domain.dataflow;

import org.eclipse.dataplane.domain.DataAddress;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,17 @@
/*
* Copyright (c) 2025 Think-it GmbH
*
* This program and the accompanying materials are made available under the
* terms of the Apache License, Version 2.0 which is available at
* https://www.apache.org/licenses/LICENSE-2.0
*
* SPDX-License-Identifier: Apache-2.0
*
* Contributors:
* Think-it GmbH - initial API and implementation
*
*/

package org.eclipse.dataplane.domain.dataflow;

public record DataFlowStatusResponseMessage(
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,17 @@
/*
* Copyright (c) 2025 Think-it GmbH
*
* This program and the accompanying materials are made available under the
* terms of the Apache License, Version 2.0 which is available at
* https://www.apache.org/licenses/LICENSE-2.0
*
* SPDX-License-Identifier: Apache-2.0
*
* Contributors:
* Think-it GmbH - initial API and implementation
*
*/

package org.eclipse.dataplane.domain.dataflow;

public record DataFlowSuspendMessage(
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,17 @@
/*
* Copyright (c) 2025 Think-it GmbH
*
* This program and the accompanying materials are made available under the
* terms of the Apache License, Version 2.0 which is available at
* https://www.apache.org/licenses/LICENSE-2.0
*
* SPDX-License-Identifier: Apache-2.0
*
* Contributors:
* Think-it GmbH - initial API and implementation
*
*/

package org.eclipse.dataplane.domain.dataflow;

public record DataFlowTerminateMessage(
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,17 @@
/*
* Copyright (c) 2025 Think-it GmbH
*
* This program and the accompanying materials are made available under the
* terms of the Apache License, Version 2.0 which is available at
* https://www.apache.org/licenses/LICENSE-2.0
*
* SPDX-License-Identifier: Apache-2.0
*
* Contributors:
* Think-it GmbH - initial API and implementation
*
*/

package org.eclipse.dataplane.domain.registration;

import java.util.Set;
Expand All @@ -9,6 +23,6 @@ public record DataPlaneRegistrationMessage(
String endpoint,
Set<String> transferTypes,
Set<String> labels
// TODO: authorization
// TODO: authorization
) {
}
14 changes: 14 additions & 0 deletions src/main/java/org/eclipse/dataplane/logic/OnCompleted.java
Original file line number Diff line number Diff line change
@@ -1,3 +1,17 @@
/*
* Copyright (c) 2025 Think-it GmbH
*
* This program and the accompanying materials are made available under the
* terms of the Apache License, Version 2.0 which is available at
* https://www.apache.org/licenses/LICENSE-2.0
*
* SPDX-License-Identifier: Apache-2.0
*
* Contributors:
* Think-it GmbH - initial API and implementation
*
*/

package org.eclipse.dataplane.logic;

import org.eclipse.dataplane.domain.Result;
Expand Down
Loading