Modular hawkBit (#378)
* Cleaned up component scan * More flexibility for hawkBit micro services * Introduce spring boot starters * Eclipse Jetty as hawkBit default * Fixed links as prep for wiki removal Signed-off-by: kaizimmerm <kai.zimmermann@bosch-si.com>
This commit is contained in:
@@ -1,32 +0,0 @@
|
||||
/**
|
||||
* Copyright (c) 2015 Bosch Software Innovations GmbH and others.
|
||||
*
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*/
|
||||
package org.eclipse.hawkbit;
|
||||
|
||||
import java.lang.annotation.ElementType;
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
import java.lang.annotation.Target;
|
||||
|
||||
import org.springframework.context.annotation.ComponentScan;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.context.annotation.Import;
|
||||
import org.springframework.stereotype.Controller;
|
||||
|
||||
/**
|
||||
* Annotation to enable {@link ComponentScan} in the resource package to setup
|
||||
* all {@link Controller} annotated classes and setup the REST-Resources for the
|
||||
* Management API.
|
||||
*/
|
||||
@Target(ElementType.TYPE)
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@Configuration
|
||||
@Import(RepositoryApplicationConfiguration.class)
|
||||
public @interface EnableJpaRepository {
|
||||
|
||||
}
|
||||
@@ -196,7 +196,7 @@ public class JpaArtifactManagement implements ArtifactManagement {
|
||||
final boolean overrideExisting) {
|
||||
return createArtifact(inputStream, moduleId, filename, null, null, overrideExisting, null);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public Long countArtifactsAll() {
|
||||
return localArtifactRepository.count();
|
||||
|
||||
@@ -14,7 +14,6 @@ import java.util.Map;
|
||||
import java.util.Optional;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import javax.persistence.EntityManager;
|
||||
import javax.persistence.EntityNotFoundException;
|
||||
import javax.validation.ConstraintDeclarationException;
|
||||
|
||||
@@ -92,9 +91,6 @@ public class JpaRolloutManagement implements RolloutManagement {
|
||||
*/
|
||||
private static final int TRANSACTION_TARGETS = 1000;
|
||||
|
||||
@Autowired
|
||||
private EntityManager entityManager;
|
||||
|
||||
@Autowired
|
||||
private RolloutRepository rolloutRepository;
|
||||
|
||||
|
||||
@@ -6,12 +6,13 @@
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*/
|
||||
package org.eclipse.hawkbit;
|
||||
package org.eclipse.hawkbit.repository.jpa;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
import javax.persistence.EntityManager;
|
||||
|
||||
import org.eclipse.hawkbit.ControllerPollProperties;
|
||||
import org.eclipse.hawkbit.repository.ArtifactManagement;
|
||||
import org.eclipse.hawkbit.repository.ControllerManagement;
|
||||
import org.eclipse.hawkbit.repository.DeploymentManagement;
|
||||
@@ -21,6 +22,7 @@ import org.eclipse.hawkbit.repository.ReportManagement;
|
||||
import org.eclipse.hawkbit.repository.RepositoryProperties;
|
||||
import org.eclipse.hawkbit.repository.RolloutGroupManagement;
|
||||
import org.eclipse.hawkbit.repository.RolloutManagement;
|
||||
import org.eclipse.hawkbit.repository.RolloutProperties;
|
||||
import org.eclipse.hawkbit.repository.SoftwareManagement;
|
||||
import org.eclipse.hawkbit.repository.SystemManagement;
|
||||
import org.eclipse.hawkbit.repository.TagManagement;
|
||||
@@ -35,21 +37,6 @@ import org.eclipse.hawkbit.repository.builder.SoftwareModuleBuilder;
|
||||
import org.eclipse.hawkbit.repository.builder.TargetFilterQueryBuilder;
|
||||
import org.eclipse.hawkbit.repository.event.remote.EventEntityManager;
|
||||
import org.eclipse.hawkbit.repository.event.remote.EventEntityManagerHolder;
|
||||
import org.eclipse.hawkbit.repository.jpa.JpaArtifactManagement;
|
||||
import org.eclipse.hawkbit.repository.jpa.JpaControllerManagement;
|
||||
import org.eclipse.hawkbit.repository.jpa.JpaDeploymentManagement;
|
||||
import org.eclipse.hawkbit.repository.jpa.JpaDistributionSetManagement;
|
||||
import org.eclipse.hawkbit.repository.jpa.JpaEntityFactory;
|
||||
import org.eclipse.hawkbit.repository.jpa.JpaReportManagement;
|
||||
import org.eclipse.hawkbit.repository.jpa.JpaRolloutGroupManagement;
|
||||
import org.eclipse.hawkbit.repository.jpa.JpaRolloutManagement;
|
||||
import org.eclipse.hawkbit.repository.jpa.JpaSoftwareManagement;
|
||||
import org.eclipse.hawkbit.repository.jpa.JpaSystemManagement;
|
||||
import org.eclipse.hawkbit.repository.jpa.JpaTagManagement;
|
||||
import org.eclipse.hawkbit.repository.jpa.JpaTargetFilterQueryManagement;
|
||||
import org.eclipse.hawkbit.repository.jpa.JpaTargetManagement;
|
||||
import org.eclipse.hawkbit.repository.jpa.JpaTenantConfigurationManagement;
|
||||
import org.eclipse.hawkbit.repository.jpa.JpaTenantStatsManagement;
|
||||
import org.eclipse.hawkbit.repository.jpa.aspects.ExceptionMappingAspectHandler;
|
||||
import org.eclipse.hawkbit.repository.jpa.autoassign.AutoAssignChecker;
|
||||
import org.eclipse.hawkbit.repository.jpa.autoassign.AutoAssignScheduler;
|
||||
@@ -78,6 +65,7 @@ import org.eclipse.hawkbit.security.SecurityTokenGenerator;
|
||||
import org.eclipse.hawkbit.security.SystemSecurityContext;
|
||||
import org.eclipse.hawkbit.tenancy.TenantAware;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
|
||||
import org.springframework.boot.autoconfigure.orm.jpa.JpaBaseConfiguration;
|
||||
import org.springframework.boot.context.properties.EnableConfigurationProperties;
|
||||
import org.springframework.boot.orm.jpa.EntityScan;
|
||||
@@ -106,7 +94,7 @@ import com.google.common.collect.Maps;
|
||||
@EnableAspectJAutoProxy
|
||||
@Configuration
|
||||
@ComponentScan
|
||||
@EnableConfigurationProperties(RepositoryProperties.class)
|
||||
@EnableConfigurationProperties({ RepositoryProperties.class, ControllerPollProperties.class, RolloutProperties.class })
|
||||
@EnableScheduling
|
||||
@EntityScan("org.eclipse.hawkbit.repository.jpa.model")
|
||||
public class RepositoryApplicationConfiguration extends JpaBaseConfiguration {
|
||||
@@ -525,6 +513,7 @@ public class RepositoryApplicationConfiguration extends JpaBaseConfiguration {
|
||||
*/
|
||||
@Bean
|
||||
@ConditionalOnMissingBean
|
||||
@ConditionalOnProperty(prefix = "hawkbit.autoassign.scheduler", name = "enabled", matchIfMissing = true)
|
||||
public AutoAssignScheduler autoAssignScheduler(final TenantAware tenantAware,
|
||||
final SystemManagement systemManagement, final SystemSecurityContext systemSecurityContext,
|
||||
final AutoAssignChecker autoAssignChecker) {
|
||||
@@ -50,8 +50,8 @@ public class AutoAssignScheduler {
|
||||
* @param autoAssignChecker
|
||||
* to run a check as tenant
|
||||
*/
|
||||
public AutoAssignScheduler(TenantAware tenantAware, SystemManagement systemManagement,
|
||||
SystemSecurityContext systemSecurityContext, AutoAssignChecker autoAssignChecker) {
|
||||
public AutoAssignScheduler(final TenantAware tenantAware, final SystemManagement systemManagement,
|
||||
final SystemSecurityContext systemSecurityContext, final AutoAssignChecker autoAssignChecker) {
|
||||
this.tenantAware = tenantAware;
|
||||
this.systemManagement = systemManagement;
|
||||
this.systemSecurityContext = systemSecurityContext;
|
||||
|
||||
@@ -23,7 +23,8 @@ import org.springframework.boot.test.SpringApplicationConfiguration;
|
||||
import org.springframework.transaction.annotation.Isolation;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
@SpringApplicationConfiguration(classes = { org.eclipse.hawkbit.RepositoryApplicationConfiguration.class })
|
||||
@SpringApplicationConfiguration(classes = {
|
||||
org.eclipse.hawkbit.repository.jpa.RepositoryApplicationConfiguration.class })
|
||||
public abstract class AbstractJpaIntegrationTest extends AbstractIntegrationTest {
|
||||
|
||||
@PersistenceContext
|
||||
|
||||
@@ -35,7 +35,6 @@ spring.jpa.properties.eclipselink.logging.parameters=true
|
||||
|
||||
flyway.enabled=true
|
||||
flyway.sqlMigrationSuffix=${spring.jpa.database}.sql
|
||||
#spring.jpa.show-sql=true
|
||||
|
||||
# DDI configuration
|
||||
hawkbit.controller.pollingTime=00:01:00
|
||||
|
||||
Reference in New Issue
Block a user