Skip to content

Commit

Permalink
chore: separate boot and connector modules and normalize module and p…
Browse files Browse the repository at this point in the history
…ackage structure (#4065)

* Separate boot from core; refactor package a module names

* Align packages

* Package moves

* Package alignment

* Rename lib modules

* Remove to lib

* Align module names

* Checkstyle fixes

* Fix tests

* Fix rebase errors

* Remove task as it is applied in the EDC Gradle plugin

* Checkstyle

* Update deps

* Add newline
  • Loading branch information
jimmarino authored Mar 30, 2024
1 parent ed6aa61 commit c0e67c6
Show file tree
Hide file tree
Showing 1,135 changed files with 4,239 additions and 4,159 deletions.
8 changes: 4 additions & 4 deletions DEPENDENCIES
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,9 @@ maven/mavencentral/com.fasterxml.jackson.datatype/jackson-datatype-jakarta-jsonp
maven/mavencentral/com.fasterxml.jackson.datatype/jackson-datatype-jsr310/2.14.0, Apache-2.0, approved, #4699
maven/mavencentral/com.fasterxml.jackson.datatype/jackson-datatype-jsr310/2.15.1, Apache-2.0, approved, #7930
maven/mavencentral/com.fasterxml.jackson.datatype/jackson-datatype-jsr310/2.17.0, Apache-2.0, approved, #14160
maven/mavencentral/com.fasterxml.jackson.jakarta.rs/jackson-jakarta-rs-base/2.17.0, , restricted, clearlydefined
maven/mavencentral/com.fasterxml.jackson.jakarta.rs/jackson-jakarta-rs-base/2.17.0, Apache-2.0, approved, #14194
maven/mavencentral/com.fasterxml.jackson.jakarta.rs/jackson-jakarta-rs-json-provider/2.15.1, Apache-2.0, approved, #9236
maven/mavencentral/com.fasterxml.jackson.jakarta.rs/jackson-jakarta-rs-json-provider/2.17.0, , restricted, clearlydefined
maven/mavencentral/com.fasterxml.jackson.jakarta.rs/jackson-jakarta-rs-json-provider/2.17.0, Apache-2.0, approved, #14195
maven/mavencentral/com.fasterxml.jackson.module/jackson-module-jakarta-xmlbind-annotations/2.15.3, Apache-2.0, approved, #9241
maven/mavencentral/com.fasterxml.jackson.module/jackson-module-jakarta-xmlbind-annotations/2.17.0, Apache-2.0, approved, #13668
maven/mavencentral/com.fasterxml.jackson/jackson-bom/2.15.1, Apache-2.0, approved, #7929
Expand Down Expand Up @@ -297,9 +297,9 @@ maven/mavencentral/org.jacoco/org.jacoco.report/0.8.9, EPL-2.0 AND Apache-2.0, a
maven/mavencentral/org.javassist/javassist/3.28.0-GA, Apache-2.0 OR LGPL-2.1-or-later OR MPL-1.1, approved, #327
maven/mavencentral/org.javassist/javassist/3.29.2-GA, Apache-2.0 AND LGPL-2.1-or-later AND MPL-1.1, approved, #6023
maven/mavencentral/org.jetbrains.kotlin/kotlin-stdlib-common/1.9.10, Apache-2.0, approved, #14186
maven/mavencentral/org.jetbrains.kotlin/kotlin-stdlib-jdk7/1.9.10, None, restricted, #14188
maven/mavencentral/org.jetbrains.kotlin/kotlin-stdlib-jdk7/1.9.10, None, restricted, #14193
maven/mavencentral/org.jetbrains.kotlin/kotlin-stdlib-jdk8/1.8.21, Apache-2.0, approved, #8919
maven/mavencentral/org.jetbrains.kotlin/kotlin-stdlib-jdk8/1.9.10, None, restricted, #14185
maven/mavencentral/org.jetbrains.kotlin/kotlin-stdlib-jdk8/1.9.10, None, restricted, #14191
maven/mavencentral/org.jetbrains.kotlin/kotlin-stdlib/1.9.10, Apache-2.0, approved, #11827
maven/mavencentral/org.jetbrains/annotations/13.0, Apache-2.0, approved, clearlydefined
maven/mavencentral/org.jetbrains/annotations/17.0.0, Apache-2.0, approved, clearlydefined
Expand Down
9 changes: 1 addition & 8 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -57,12 +57,5 @@ allprojects {
configDirectory.set(rootProject.file("resources"))
}

// EdcRuntimeExtension uses this to determine the runtime classpath of the module to run.
tasks.register("printClasspath") {
dependsOn(tasks.compileJava)
doLast {
println(sourceSets["main"].runtimeClasspath.asPath)
}
}


}
4 changes: 3 additions & 1 deletion core/common/boot/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,9 @@ plugins {
}

dependencies {
api(project(":spi:common:core-spi"))
api(project(":spi:common:boot-spi"))

implementation(project(":core:common:lib:boot-lib"))

implementation(libs.opentelemetry.api)
testImplementation(libs.junit.jupiter.api)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,24 @@

package org.eclipse.edc.boot;

import org.eclipse.edc.boot.health.HealthCheckServiceConfiguration;
import org.eclipse.edc.boot.health.HealthCheckServiceImpl;
import org.eclipse.edc.boot.system.ExtensionLoader;
import org.eclipse.edc.boot.vault.InMemoryVault;
import org.eclipse.edc.runtime.metamodel.annotation.BaseExtension;
import org.eclipse.edc.runtime.metamodel.annotation.Extension;
import org.eclipse.edc.runtime.metamodel.annotation.Inject;
import org.eclipse.edc.runtime.metamodel.annotation.Provider;
import org.eclipse.edc.runtime.metamodel.annotation.Setting;
import org.eclipse.edc.spi.security.Vault;
import org.eclipse.edc.spi.system.ExecutorInstrumentation;
import org.eclipse.edc.spi.system.ServiceExtension;
import org.eclipse.edc.spi.system.ServiceExtensionContext;
import org.eclipse.edc.spi.system.health.HealthCheckService;
import org.eclipse.edc.spi.telemetry.Telemetry;
import org.eclipse.edc.spi.types.TypeManager;

import java.time.Clock;
import java.time.Duration;


@BaseExtension
Expand All @@ -32,17 +40,45 @@ public class BootServicesExtension implements ServiceExtension {

public static final String NAME = "Boot Services";

@Setting
public static final String LIVENESS_PERIOD_SECONDS_SETTING = "edc.core.system.health.check.liveness-period";
@Setting
public static final String STARTUP_PERIOD_SECONDS_SETTING = "edc.core.system.health.check.startup-period";
@Setting
public static final String READINESS_PERIOD_SECONDS_SETTING = "edc.core.system.health.check.readiness-period";
@Setting
public static final String THREADPOOL_SIZE_SETTING = "edc.core.system.health.check.threadpool-size";
@Setting(value = "Configures the participant id this runtime is operating on behalf of")
public static final String PARTICIPANT_ID = "edc.participant.id";

private static final long DEFAULT_DURATION = 60;
private static final int DEFAULT_TP_SIZE = 3;

@Inject
private ExecutorInstrumentation instrumentation;

private HealthCheckServiceImpl healthCheckService;

@Override
public String name() {
return NAME;
}

@Provider
public TypeManager typeManager() {
return new TypeManager();
@Override
public void initialize(ServiceExtensionContext context) {
var config = getHealthCheckConfig(context);
healthCheckService = new HealthCheckServiceImpl(config, instrumentation);
}

@Override
public void start() {
healthCheckService.start();
}

@Override
public void shutdown() {
healthCheckService.stop();
ServiceExtension.super.shutdown();
}

@Provider
Expand All @@ -55,4 +91,36 @@ public Telemetry telemetry() {
return ExtensionLoader.loadTelemetry();
}

@Provider
public HealthCheckService healthCheckService() {
return healthCheckService;
}

@Provider(isDefault = true)
public Vault vault(ServiceExtensionContext context) {
return createInmemVault(context);
}

@Provider(isDefault = true)
public ExecutorInstrumentation defaultInstrumentation() {
return ExecutorInstrumentation.noop();
}

@Provider(isDefault = true)
public Vault createInmemVault(ServiceExtensionContext context) {
context.getMonitor().warning("Using the InMemoryVault is not suitable for production scenarios and should be replaced with an actual Vault!");
return new InMemoryVault(context.getMonitor());
}

private HealthCheckServiceConfiguration getHealthCheckConfig(ServiceExtensionContext context) {
return HealthCheckServiceConfiguration.Builder.newInstance()
.livenessPeriod(Duration.ofSeconds(context.getSetting(LIVENESS_PERIOD_SECONDS_SETTING, DEFAULT_DURATION)))
.startupStatusPeriod(Duration.ofSeconds(context.getSetting(STARTUP_PERIOD_SECONDS_SETTING, DEFAULT_DURATION)))
.readinessPeriod(Duration.ofSeconds(context.getSetting(READINESS_PERIOD_SECONDS_SETTING, DEFAULT_DURATION)))
.readinessPeriod(Duration.ofSeconds(context.getSetting(READINESS_PERIOD_SECONDS_SETTING, DEFAULT_DURATION)))
.threadPoolSize(context.getSetting(THREADPOOL_SIZE_SETTING, DEFAULT_TP_SIZE))
.build();
}


}
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,9 @@
*
*/

package org.eclipse.edc.spi.monitor;
package org.eclipse.edc.boot.monitor;

import org.eclipse.edc.spi.monitor.Monitor;

import java.util.Collection;
import java.util.List;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,12 @@

package org.eclipse.edc.boot.system;

import org.eclipse.edc.boot.system.injection.EdcInjectionException;
import org.eclipse.edc.boot.system.injection.InjectionContainer;
import org.eclipse.edc.boot.system.injection.InjectionPoint;
import org.eclipse.edc.boot.system.injection.InjectionPointScanner;
import org.eclipse.edc.boot.system.injection.ProviderMethod;
import org.eclipse.edc.boot.system.injection.ProviderMethodScanner;
import org.eclipse.edc.boot.util.CyclicDependencyException;
import org.eclipse.edc.boot.util.TopologicalSort;
import org.eclipse.edc.runtime.metamodel.annotation.BaseExtension;
Expand All @@ -23,12 +29,6 @@
import org.eclipse.edc.spi.EdcException;
import org.eclipse.edc.spi.system.ServiceExtension;
import org.eclipse.edc.spi.system.ServiceExtensionContext;
import org.eclipse.edc.spi.system.injection.EdcInjectionException;
import org.eclipse.edc.spi.system.injection.InjectionContainer;
import org.eclipse.edc.spi.system.injection.InjectionPoint;
import org.eclipse.edc.spi.system.injection.InjectionPointScanner;
import org.eclipse.edc.spi.system.injection.ProviderMethod;
import org.eclipse.edc.spi.system.injection.ProviderMethodScanner;

import java.util.ArrayList;
import java.util.Arrays;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,17 +17,17 @@

import io.opentelemetry.api.GlobalOpenTelemetry;
import io.opentelemetry.api.OpenTelemetry;
import org.eclipse.edc.boot.monitor.MultiplexingMonitor;
import org.eclipse.edc.boot.system.injection.InjectionContainer;
import org.eclipse.edc.boot.system.injection.InjectorImpl;
import org.eclipse.edc.boot.system.injection.ProviderMethod;
import org.eclipse.edc.boot.system.injection.ProviderMethodScanner;
import org.eclipse.edc.boot.system.injection.lifecycle.ExtensionLifecycleManager;
import org.eclipse.edc.spi.monitor.ConsoleMonitor;
import org.eclipse.edc.spi.monitor.Monitor;
import org.eclipse.edc.spi.monitor.MultiplexingMonitor;
import org.eclipse.edc.spi.system.MonitorExtension;
import org.eclipse.edc.spi.system.ServiceExtension;
import org.eclipse.edc.spi.system.ServiceExtensionContext;
import org.eclipse.edc.spi.system.injection.InjectionContainer;
import org.eclipse.edc.spi.system.injection.ProviderMethod;
import org.eclipse.edc.spi.system.injection.ProviderMethodScanner;
import org.eclipse.edc.spi.telemetry.Telemetry;
import org.jetbrains.annotations.NotNull;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
*
*/

package org.eclipse.edc.spi.system.injection;
package org.eclipse.edc.boot.system.injection;

import org.eclipse.edc.spi.EdcException;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
*
*/

package org.eclipse.edc.spi.system.injection;
package org.eclipse.edc.boot.system.injection;

import org.eclipse.edc.spi.system.ServiceExtension;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
*
*/

package org.eclipse.edc.spi.system.injection;
package org.eclipse.edc.boot.system.injection;

import org.eclipse.edc.runtime.metamodel.annotation.Provides;
import org.eclipse.edc.spi.result.Result;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
*
*/

package org.eclipse.edc.spi.system.injection;
package org.eclipse.edc.boot.system.injection;

/**
* Represents an auto-injectable property. Possible implementors are field injection points, constructor injection points, etc.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
*
*/

package org.eclipse.edc.spi.system.injection;
package org.eclipse.edc.boot.system.injection;

import org.eclipse.edc.runtime.metamodel.annotation.Inject;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
*
*/

package org.eclipse.edc.spi.system.injection;
package org.eclipse.edc.boot.system.injection;

import org.eclipse.edc.spi.system.ServiceExtension;
import org.eclipse.edc.spi.system.ServiceExtensionContext;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,6 @@

import org.eclipse.edc.spi.EdcException;
import org.eclipse.edc.spi.system.ServiceExtensionContext;
import org.eclipse.edc.spi.system.injection.EdcInjectionException;
import org.eclipse.edc.spi.system.injection.InjectionContainer;
import org.eclipse.edc.spi.system.injection.Injector;

import java.util.Map;
import java.util.function.Supplier;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
*
*/

package org.eclipse.edc.spi.system.injection;
package org.eclipse.edc.boot.system.injection;

import org.jetbrains.annotations.NotNull;

Expand All @@ -28,5 +28,6 @@ public interface ObjectFactory {
* @param clazz The object's class
* @throws RuntimeException if a new instance could not be created
*/
@NotNull <T> T constructInstance(Class<T> clazz);
@NotNull
<T> T constructInstance(Class<T> clazz);
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
*
*/

package org.eclipse.edc.spi.system.injection;
package org.eclipse.edc.boot.system.injection;

import org.eclipse.edc.runtime.metamodel.annotation.Provider;
import org.eclipse.edc.spi.system.ServiceExtensionContext;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
*
*/

package org.eclipse.edc.spi.system.injection;
package org.eclipse.edc.boot.system.injection;

import org.eclipse.edc.runtime.metamodel.annotation.Provider;
import org.eclipse.edc.spi.system.ServiceExtension;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,6 @@

import org.eclipse.edc.spi.EdcException;
import org.eclipse.edc.spi.system.ServiceExtensionContext;
import org.eclipse.edc.spi.system.injection.InjectionContainer;
import org.eclipse.edc.spi.system.injection.InjectionPointScanner;
import org.eclipse.edc.spi.system.injection.Injector;
import org.eclipse.edc.spi.system.injection.ObjectFactory;
import org.jetbrains.annotations.NotNull;

import java.lang.reflect.Constructor;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,13 @@

package org.eclipse.edc.boot.system.injection.lifecycle;

import org.eclipse.edc.boot.system.injection.InjectionContainer;
import org.eclipse.edc.boot.system.injection.Injector;
import org.eclipse.edc.runtime.metamodel.annotation.Inject;
import org.eclipse.edc.runtime.metamodel.annotation.Provider;
import org.eclipse.edc.spi.monitor.Monitor;
import org.eclipse.edc.spi.system.ServiceExtension;
import org.eclipse.edc.spi.system.ServiceExtensionContext;
import org.eclipse.edc.spi.system.injection.InjectionContainer;
import org.eclipse.edc.spi.system.injection.Injector;

/**
* {@link ServiceExtension} implementors should not be constructed by just invoking their constructors, instead they need to go through
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@

package org.eclipse.edc.boot.system.injection.lifecycle;

import org.eclipse.edc.boot.system.injection.InjectionContainer;
import org.eclipse.edc.boot.system.injection.Injector;
import org.eclipse.edc.spi.monitor.Monitor;
import org.eclipse.edc.spi.system.ServiceExtension;
import org.eclipse.edc.spi.system.ServiceExtensionContext;
import org.eclipse.edc.spi.system.injection.InjectionContainer;
import org.eclipse.edc.spi.system.injection.Injector;

import static java.lang.String.format;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@

package org.eclipse.edc.boot.system.injection.lifecycle;

import org.eclipse.edc.boot.system.injection.InjectionContainer;
import org.eclipse.edc.boot.system.injection.Injector;
import org.eclipse.edc.spi.monitor.Monitor;
import org.eclipse.edc.spi.system.ServiceExtension;
import org.eclipse.edc.spi.system.ServiceExtensionContext;
import org.eclipse.edc.spi.system.injection.InjectionContainer;
import org.eclipse.edc.spi.system.injection.Injector;

/**
* Represents an abstract phase in an {@link ServiceExtension}'s lifecycle. Is used by the {@link ExtensionLifecycleManager} to ensure the correct
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@

package org.eclipse.edc.boot.system.injection.lifecycle;

import org.eclipse.edc.boot.system.injection.ProviderMethod;
import org.eclipse.edc.boot.system.injection.ProviderMethodScanner;
import org.eclipse.edc.spi.system.ServiceExtension;
import org.eclipse.edc.spi.system.ServiceExtensionContext;
import org.eclipse.edc.spi.system.injection.ProviderMethod;
import org.eclipse.edc.spi.system.injection.ProviderMethodScanner;

/**
* Represents an {@link ServiceExtension}'s lifecycle phase where all it's provider methods are invoked by the {@link ExtensionLifecycleManager}, and the provided objects are registered into the context.
Expand Down
Loading

0 comments on commit c0e67c6

Please sign in to comment.