diff --git a/hawkbit-ddi/hawkbit-ddi-starter/pom.xml b/hawkbit-ddi/hawkbit-ddi-starter/pom.xml
index 910b30f24..e0cb0d3ab 100644
--- a/hawkbit-ddi/hawkbit-ddi-starter/pom.xml
+++ b/hawkbit-ddi/hawkbit-ddi-starter/pom.xml
@@ -19,9 +19,37 @@
hawkbit-ddi-starter
- hawkBit :: Spring Boot Starter DDI API
+ hawkBit :: DDI API :: Spring Boot Starter
+
+
+ org.eclipse.hawkbit
+ hawkbit-security-controller
+ ${project.version}
+
+
+ org.eclipse.hawkbit
+ hawkbit-artifact-repository-filesystem
+ ${project.version}
+
+
+ org.eclipse.hawkbit
+ hawkbit-repository-jpa
+ ${project.version}
+
+
+ org.eclipse.hawkbit
+ hawkbit-ddi-resource
+ ${project.version}
+
+
+ org.eclipse.hawkbit
+ hawkbit-autoconfigure
+ ${project.version}
+
+
+
org.springframework.boot
@@ -44,28 +72,5 @@
spring-security-aspects
-
-
-
- org.eclipse.hawkbit
- hawkbit-ddi-resource
- ${project.version}
-
-
- org.eclipse.hawkbit
- hawkbit-security-controller
- ${project.version}
-
-
- org.eclipse.hawkbit
- hawkbit-repository-jpa
- ${project.version}
-
-
- org.eclipse.hawkbit
- hawkbit-autoconfigure
- ${project.version}
-
-
\ No newline at end of file
diff --git a/hawkbit-mgmt/hawkbit-mgmt-starter/pom.xml b/hawkbit-mgmt/hawkbit-mgmt-starter/pom.xml
index 47e848110..54fe05dcc 100644
--- a/hawkbit-mgmt/hawkbit-mgmt-starter/pom.xml
+++ b/hawkbit-mgmt/hawkbit-mgmt-starter/pom.xml
@@ -19,25 +19,30 @@
hawkbit-mgmt-starter
- hawkBit :: Spring Boot Starter Management API
+ hawkBit :: Management API :: Spring Boot Starter
-
- org.eclipse.hawkbit
- hawkbit-mgmt-resource
- ${project.version}
-
org.eclipse.hawkbit
hawkbit-security-controller
${project.version}
+
+ org.eclipse.hawkbit
+ hawkbit-artifact-repository-filesystem
+ ${project.version}
+
org.eclipse.hawkbit
hawkbit-repository-jpa
${project.version}
+
+ org.eclipse.hawkbit
+ hawkbit-mgmt-resource
+ ${project.version}
+
org.eclipse.hawkbit
hawkbit-autoconfigure
diff --git a/hawkbit-repository/hawkbit-repository-jpa/pom.xml b/hawkbit-repository/hawkbit-repository-jpa/pom.xml
index df016f551..ada150d82 100644
--- a/hawkbit-repository/hawkbit-repository-jpa/pom.xml
+++ b/hawkbit-repository/hawkbit-repository-jpa/pom.xml
@@ -36,11 +36,6 @@
hawkbit-repository-core
${project.version}
-
- org.eclipse.hawkbit
- hawkbit-artifact-repository-filesystem
- ${project.version}
-
org.springframework
spring-core
diff --git a/hawkbit-repository/hawkbit-repository-jpa/src/main/java/org/eclipse/hawkbit/repository/jpa/RepositoryApplicationConfiguration.java b/hawkbit-repository/hawkbit-repository-jpa/src/main/java/org/eclipse/hawkbit/repository/jpa/RepositoryApplicationConfiguration.java
index be9248de2..d2af7ebac 100644
--- a/hawkbit-repository/hawkbit-repository-jpa/src/main/java/org/eclipse/hawkbit/repository/jpa/RepositoryApplicationConfiguration.java
+++ b/hawkbit-repository/hawkbit-repository-jpa/src/main/java/org/eclipse/hawkbit/repository/jpa/RepositoryApplicationConfiguration.java
@@ -12,6 +12,7 @@ package org.eclipse.hawkbit.repository.jpa;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
+import java.util.Optional;
import java.util.concurrent.ScheduledExecutorService;
import javax.sql.DataSource;
@@ -173,6 +174,7 @@ import org.springframework.beans.factory.ObjectProvider;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.config.BeanPostProcessor;
import org.springframework.boot.autoconfigure.AutoConfigureAfter;
+import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.boot.autoconfigure.domain.EntityScan;
@@ -181,6 +183,7 @@ import org.springframework.boot.autoconfigure.orm.jpa.JpaBaseConfiguration;
import org.springframework.boot.autoconfigure.orm.jpa.JpaProperties;
import org.springframework.boot.autoconfigure.transaction.TransactionManagerCustomizers;
import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Conditional;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.EnableAspectJAutoProxy;
import org.springframework.context.annotation.Import;
@@ -872,9 +875,9 @@ public class RepositoryApplicationConfiguration extends JpaBaseConfiguration {
@ConditionalOnMissingBean
ArtifactManagement artifactManagement(
final EntityManager entityManager, final LocalArtifactRepository localArtifactRepository,
- final SoftwareModuleRepository softwareModuleRepository, final ArtifactRepository artifactRepository,
+ final SoftwareModuleRepository softwareModuleRepository, final Optional artifactRepository,
final QuotaManagement quotaManagement, final TenantAware tenantAware) {
- return new JpaArtifactManagement(entityManager, localArtifactRepository, softwareModuleRepository, artifactRepository,
+ return new JpaArtifactManagement(entityManager, localArtifactRepository, softwareModuleRepository, artifactRepository.orElse(null),
quotaManagement, tenantAware);
}
diff --git a/hawkbit-repository/hawkbit-repository-jpa/src/main/java/org/eclipse/hawkbit/repository/jpa/management/JpaArtifactManagement.java b/hawkbit-repository/hawkbit-repository-jpa/src/main/java/org/eclipse/hawkbit/repository/jpa/management/JpaArtifactManagement.java
index fd88026fa..de9659447 100644
--- a/hawkbit-repository/hawkbit-repository-jpa/src/main/java/org/eclipse/hawkbit/repository/jpa/management/JpaArtifactManagement.java
+++ b/hawkbit-repository/hawkbit-repository-jpa/src/main/java/org/eclipse/hawkbit/repository/jpa/management/JpaArtifactManagement.java
@@ -11,8 +11,10 @@ package org.eclipse.hawkbit.repository.jpa.management;
import java.io.IOException;
import java.io.InputStream;
+import java.util.Objects;
import java.util.Optional;
+import jakarta.annotation.Nullable;
import jakarta.persistence.EntityManager;
import lombok.extern.slf4j.Slf4j;
@@ -74,6 +76,7 @@ public class JpaArtifactManagement implements ArtifactManagement {
private final SoftwareModuleRepository softwareModuleRepository;
+ @Nullable
private final ArtifactRepository artifactRepository;
private final TenantAware tenantAware;
@@ -82,7 +85,7 @@ public class JpaArtifactManagement implements ArtifactManagement {
public JpaArtifactManagement(final EntityManager entityManager,
final LocalArtifactRepository localArtifactRepository,
- final SoftwareModuleRepository softwareModuleRepository, final ArtifactRepository artifactRepository,
+ final SoftwareModuleRepository softwareModuleRepository, @Nullable final ArtifactRepository artifactRepository,
final QuotaManagement quotaManagement, final TenantAware tenantAware) {
this.entityManager = entityManager;
this.localArtifactRepository = localArtifactRepository;
@@ -102,6 +105,10 @@ public class JpaArtifactManagement implements ArtifactManagement {
@Retryable(include = {
ConcurrencyFailureException.class }, maxAttempts = Constants.TX_RT_MAX, backoff = @Backoff(delay = Constants.TX_RT_DELAY))
public Artifact create(final ArtifactUpload artifactUpload) {
+ if (artifactRepository == null) {
+ throw new UnsupportedOperationException("ArtifactRepository is unavailable");
+ }
+
final long moduleId = artifactUpload.getModuleId();
assertArtifactQuota(moduleId, 1);
final JpaSoftwareModule softwareModule =
@@ -190,8 +197,11 @@ public class JpaArtifactManagement implements ArtifactManagement {
}
@Override
- public Optional loadArtifactBinary(final String sha1Hash, final long softwareModuleId,
- final boolean isEncrypted) {
+ public Optional loadArtifactBinary(final String sha1Hash, final long softwareModuleId, final boolean isEncrypted) {
+ if (artifactRepository == null) {
+ throw new UnsupportedOperationException("ArtifactRepository is unavailable");
+ }
+
assertSoftwareModuleExists(softwareModuleId);
final String tenant = tenantAware.getCurrentTenant();
@@ -217,10 +227,13 @@ public class JpaArtifactManagement implements ArtifactManagement {
* Software module related UPDATE permission shall be checked by the callers!
*
* @param sha1Hash no longer needed
- * @param softwareModuleId the garbage collection call is made for
*/
@PreAuthorize(SpPermission.SpringEvalExpressions.HAS_AUTH_DELETE_REPOSITORY)
void clearArtifactBinary(final String sha1Hash) {
+ if (artifactRepository == null) {
+ throw new UnsupportedOperationException("ArtifactRepository is unavailable");
+ }
+
// countBySha1HashAndTenantAndSoftwareModuleDeletedIsFalse will skip ACM checks and
// will return total count as it should be
final long count = localArtifactRepository.countBySha1HashAndTenantAndSoftwareModuleDeletedIsFalse(