Skip to content

Commit

Permalink
Merge pull request #3837 from dseurotech/refactorings/exterminateStatics
Browse files Browse the repository at this point in the history
Refactorings/exterminate statics
  • Loading branch information
Coduz authored Feb 6, 2024
2 parents 3783cfa + b8e989e commit f913868
Show file tree
Hide file tree
Showing 772 changed files with 14,795 additions and 12,931 deletions.
3 changes: 1 addition & 2 deletions assembly/api/docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ ENV BROKER_ADDR broker
ENV BROKER_PORT 1883

ENV DATASTORE_ADDR es:9200
ENV DATASTORE_CLIENT org.eclipse.kapua.service.elasticsearch.client.rest.RestElasticsearchClientProvider

ENV SQL_DB_ADDR db
ENV SQL_DB_PORT 3306
Expand All @@ -31,11 +30,11 @@ ENV JOB_ENGINE_BASE_ADDR http://job-engine:8080/v1

ENV JAVA_OPTS "-Dapi.cors.origins.allowed=\${API_CORS_ORIGINS_ALLOWED} \
-Dcommons.db.schema.update=true \
-Dlocator.guice.stage=PRODUCTION \
-Dcommons.db.connection.host=\${SQL_DB_ADDR} \
-Dcommons.db.connection.port=\${SQL_DB_PORT} \
-Dbroker.host=\${BROKER_ADDR} \
-Ddatastore.elasticsearch.nodes=\${DATASTORE_ADDR} \
-Ddatastore.elasticsearch.provider=\${DATASTORE_CLIENT} \
-Dcommons.eventbus.url=\${SERVICE_BROKER_ADDR} \
-Dcertificate.jwt.private.key=file:///etc/opt/kapua/key.pk8 \
-Dcertificate.jwt.certificate=file:///etc/opt/kapua/cert.pem \
Expand Down
4 changes: 1 addition & 3 deletions assembly/broker-artemis/configurations/locator.xml
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,6 @@
</provided>

<packages>
<package>org.eclipse.kapua.commons</package>
<package>org.eclipse.kapua.message</package>
<package>org.eclipse.kapua.service</package>
<package>org.eclipse.kapua</package>
</packages>
</locator-config>
15 changes: 15 additions & 0 deletions assembly/broker-artemis/descriptors/kapua-broker-artemis.xml
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,16 @@
<include>com.h2database:h2</include>
<include>com.zaxxer:HikariCP</include>

<!-- Locator dependencies -->
<include>com.google.inject:guice</include>
<include>org.reflections:reflections</include>
<include>org.javassist:javassist</include>
<include>javax.cache:cache-api</include>
<include>aopalliance:aopalliance</include>
<include>${pom.groupId}:kapua-locator-guice</include>

<!-- / Locator dependencies -->

<include>com.fasterxml.jackson.core:jackson-core</include>
<include>com.fasterxml.jackson.core:jackson-databind</include>
<include>com.fasterxml.jackson.core:jackson-annotations</include>
Expand All @@ -99,9 +109,11 @@
<include>com.warrenstrange:googleauth</include>
<include>javax.cache:cache-api</include>
<include>javax.inject:javax.inject</include>
<include>javax.annotation:javax.annotation-api</include>
<include>org.apache.shiro:shiro-core</include>
<include>org.bitbucket.b_c:jose4j</include>
<include>org.javassist:javassist</include>
<include>com.google.zxing:core</include>

<include>${pom.groupId}:kapua-account-api</include>
<include>${pom.groupId}:kapua-account-internal</include>
Expand All @@ -116,14 +128,17 @@
<include>${pom.groupId}:kapua-message-api</include>
<include>${pom.groupId}:kapua-message-internal</include>
<include>${pom.groupId}:kapua-openid-api</include>
<include>${pom.groupId}:kapua-openid-provider</include>
<include>${pom.groupId}:kapua-service-api</include>
<include>${pom.groupId}:kapua-security-authentication-api</include>
<include>${pom.groupId}:kapua-security-authorization-api</include>
<include>${pom.groupId}:kapua-security-certificate-api</include>
<include>${pom.groupId}:kapua-security-registration-api</include>
<include>${pom.groupId}:kapua-security-certificate-internal</include>
<include>${pom.groupId}:kapua-security-shiro</include>
<include>${pom.groupId}:kapua-service-client</include>
<include>${pom.groupId}:kapua-tag-api</include>
<include>${pom.groupId}:kapua-tag-internal</include>
<include>${pom.groupId}:kapua-user-api</include>
<include>${pom.groupId}:kapua-user-internal</include>
</includes>
Expand Down
2 changes: 2 additions & 0 deletions assembly/broker-artemis/docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@ ENV JAVA_ARGS "-Dcommons.db.schema.update=true \
-Dcommons.db.connection.port=\${SQL_DB_PORT} \
-Dcommons.eventbus.url=\${SERVICE_BROKER_ADDR} \
-Dbroker.ip=message-broker \
-Dlocator.class.impl=org.eclipse.kapua.locator.guice.GuiceLocatorImpl \
-Dlocator.guice.stage=PRODUCTION \
-Dcertificate.jwt.private.key=file:///etc/opt/kapua/key.pk8 \
-Dcertificate.jwt.certificate=file:///etc/opt/kapua/cert.pem"

Expand Down
13 changes: 12 additions & 1 deletion assembly/broker-artemis/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,10 @@
<groupId>org.eclipse.kapua</groupId>
<artifactId>kapua-locator-guice</artifactId>
</dependency>
<dependency>
<groupId>org.eclipse.kapua</groupId>
<artifactId>kapua-openid-provider</artifactId>
</dependency>
<dependency>
<groupId>org.eclipse.kapua</groupId>
<artifactId>kapua-service-api</artifactId>
Expand All @@ -87,10 +91,18 @@
<groupId>org.eclipse.kapua</groupId>
<artifactId>kapua-security-shiro</artifactId>
</dependency>
<dependency>
<groupId>org.eclipse.kapua</groupId>
<artifactId>kapua-security-registration-api</artifactId>
</dependency>
<dependency>
<groupId>org.eclipse.kapua</groupId>
<artifactId>kapua-tag-api</artifactId>
</dependency>
<dependency>
<groupId>org.eclipse.kapua</groupId>
<artifactId>kapua-tag-internal</artifactId>
</dependency>
<dependency>
<groupId>org.eclipse.kapua</groupId>
<artifactId>kapua-user-api</artifactId>
Expand All @@ -99,7 +111,6 @@
<groupId>org.eclipse.kapua</groupId>
<artifactId>kapua-user-internal</artifactId>
</dependency>

<dependency>
<groupId>org.eclipse.persistence</groupId>
<artifactId>javax.persistence</artifactId>
Expand Down
3 changes: 1 addition & 2 deletions assembly/console/docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ ENV BROKER_ADDR broker
ENV BROKER_PORT 1883

ENV DATASTORE_ADDR es:9200
ENV DATASTORE_CLIENT org.eclipse.kapua.service.elasticsearch.client.rest.RestElasticsearchClientProvider

ENV SQL_DB_ADDR db
ENV SQL_DB_PORT 3306
Expand All @@ -32,9 +31,9 @@ ENV JOB_ENGINE_BASE_ADDR http://job-engine:8080/v1
ENV JAVA_OPTS "-Dcommons.db.schema.update=true \
-Dcommons.db.connection.host=\${SQL_DB_ADDR} \
-Dcommons.db.connection.port=\${SQL_DB_PORT} \
-Dlocator.guice.stage=PRODUCTION \
-Dbroker.host=\${BROKER_ADDR} \
-Ddatastore.elasticsearch.nodes=\${DATASTORE_ADDR} \
-Ddatastore.elasticsearch.provider=\${DATASTORE_CLIENT} \
-Dcommons.eventbus.url=\${SERVICE_BROKER_ADDR} \
-Dcertificate.jwt.private.key=file:///etc/opt/kapua/key.pk8 \
-Dcertificate.jwt.certificate=file:///etc/opt/kapua/cert.pem \
Expand Down
2 changes: 1 addition & 1 deletion assembly/console/entrypoint/run-console
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ if [ -n "$KEYCLOAK_URL" ] && [ -n "$KAPUA_CONSOLE_URL" ]; then
echo "Activating OpenID Connect Keycloak integration..."
echo " Keycloak: $KEYCLOAK_URL"
echo " Kapua: $KAPUA_CONSOLE_URL"

: KEYCLOAK_REALM=${KEYCLOAK_REALM:=kapua}
: KEYCLOAK_CLIENT_ID=${KEYCLOAK_CLIENT_ID:=console}

Expand Down
1 change: 1 addition & 0 deletions assembly/consumer/lifecycle/docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ ENV JOB_ENGINE_BASE_ADDR http://job-engine:8080/v1
ENV JAVA_OPTS "-Dcommons.db.schema.update=true \
-Dcommons.db.connection.host=\${SQL_DB_ADDR} \
-Dcommons.db.connection.port=\${SQL_DB_PORT} \
-Dlocator.guice.stage=PRODUCTION \
-Dcommons.eventbus.url=\${SERVICE_BROKER_ADDR} \
-Dbroker.host=\${BROKER_HOST} \
-Dbroker.port=\${BROKER_PORT} \
Expand Down
1 change: 1 addition & 0 deletions assembly/consumer/telemetry/docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ ENV SERVICE_BROKER_ADDR failover:(amqp://events-broker:5672)?jms.sendTimeout=100
ENV JAVA_OPTS "-Dcommons.db.schema.update=true \
-Dcommons.db.connection.host=\${SQL_DB_ADDR} \
-Dcommons.db.connection.port=\${SQL_DB_PORT} \
-Dlocator.guice.stage=PRODUCTION \
-Dcommons.eventbus.url=\${SERVICE_BROKER_ADDR} \
-Dconsumer.jaxb_context_class_name=org.eclipse.kapua.consumer.telemetry.TelemetryJAXBContextProvider \
-Ddatastore.elasticsearch.nodes=\${DATASTORE_ADDR} \
Expand Down
3 changes: 1 addition & 2 deletions assembly/job-engine/docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ ENV BROKER_ADDR broker
ENV BROKER_PORT 1883

ENV DATASTORE_ADDR es:9200
ENV DATASTORE_CLIENT org.eclipse.kapua.service.elasticsearch.client.rest.RestElasticsearchClientProvider

ENV SQL_DB_ADDR db
ENV SQL_DB_PORT 3306
Expand All @@ -30,9 +29,9 @@ ENV SERVICE_BROKER_ADDR failover:(amqp://events-broker:5672)?jms.sendTimeout=100
ENV JAVA_OPTS "-Dcommons.db.schema.update=true \
-Dcommons.db.connection.host=\${SQL_DB_ADDR} \
-Dcommons.db.connection.port=\${SQL_DB_PORT} \
-Dlocator.guice.stage=PRODUCTION \
-Dbroker.host=\${BROKER_ADDR} \
-Ddatastore.elasticsearch.nodes=\${DATASTORE_ADDR} \
-Ddatastore.elasticsearch.provider=\${DATASTORE_CLIENT} \
-Dcommons.eventbus.url=\${SERVICE_BROKER_ADDR} \
-Dcertificate.jwt.private.key=file:///etc/opt/kapua/key.pk8 \
-Dcertificate.jwt.certificate=file:///etc/opt/kapua/cert.pem \
Expand Down
1 change: 1 addition & 0 deletions assembly/service/authentication/docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ ENV SERVICE_BROKER_ADDR failover:(amqp://events-broker:5672)?jms.sendTimeout=100
ENV JAVA_OPTS -Dcommons.db.schema.update=true \
-Dcommons.db.connection.host=${SQL_DB_ADDR} \
-Dcommons.db.connection.port=${SQL_DB_PORT} \
-Dlocator.guice.stage=PRODUCTION \
-Dcommons.eventbus.url="${SERVICE_BROKER_ADDR}" \
-Dcertificate.jwt.private.key=file:///etc/opt/kapua/key.pk8 \
-Dcertificate.jwt.certificate=file:///etc/opt/kapua/cert.pem \
Expand Down
43 changes: 43 additions & 0 deletions broker/api/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Copyright (c) 2018, 2022 Eurotech and/or its affiliates and others
This program and the accompanying materials are made
available under the terms of the Eclipse Public License 2.0
which is available at https://www.eclipse.org/legal/epl-2.0/
SPDX-License-Identifier: EPL-2.0
Contributors:
Eurotech - initial API and implementation
-->
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<artifactId>kapua-broker</artifactId>
<groupId>org.eclipse.kapua</groupId>
<version>2.0.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>

<artifactId>kapua-broker-api</artifactId>

<dependencies>
<dependency>
<groupId>org.eclipse.kapua</groupId>
<artifactId>kapua-service-api</artifactId>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.eclipse.kapua</groupId>
<artifactId>kapua-qa-markers</artifactId>
<scope>test</scope>
</dependency>
</dependencies>

</project>
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2020, 2022 Eurotech and/or its affiliates and others
* Copyright (c) 2018, 2022 Eurotech and/or its affiliates and others
*
* This program and the accompanying materials are made
* available under the terms of the Eclipse Public License 2.0
Expand All @@ -10,13 +10,12 @@
* Contributors:
* Eurotech - initial API and implementation
*******************************************************************************/
package org.eclipse.kapua.commons.configuration;
package org.eclipse.kapua.broker;

import org.eclipse.kapua.commons.jpa.AbstractEntityCacheFactory;
public class BrokerDomains {

public class AbstractKapuaConfigurableServiceCache extends AbstractEntityCacheFactory {

public AbstractKapuaConfigurableServiceCache() {
super("AbstractKapuaConfigurableServiceCacheId");
private BrokerDomains() {
}

public static final BrokerDomain BROKER_DOMAIN = new BrokerDomain();
}
4 changes: 4 additions & 0 deletions broker/artemis/plugin/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,10 @@
<artifactId>logback-classic</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.eclipse.kapua</groupId>
<artifactId>kapua-service-client</artifactId>
</dependency>
</dependencies>
<build>
<plugins>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
/*******************************************************************************
* Copyright (c) 2016, 2022 Eurotech and/or its affiliates and others
*
* This program and the accompanying materials are made
* available under the terms of the Eclipse Public License 2.0
* which is available at https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
*
* Contributors:
* Eurotech - initial API and implementation
*******************************************************************************/
package org.eclipse.kapua.broker.artemis;

import com.google.inject.Provides;
import org.eclipse.kapua.KapuaException;
import org.eclipse.kapua.broker.artemis.plugin.security.setting.BrokerSetting;
import org.eclipse.kapua.broker.artemis.plugin.security.setting.BrokerSettingKey;
import org.eclipse.kapua.broker.artemis.plugin.utils.BrokerHostResolver;
import org.eclipse.kapua.broker.artemis.plugin.utils.BrokerIdResolver;
import org.eclipse.kapua.broker.artemis.plugin.utils.BrokerIdentity;
import org.eclipse.kapua.broker.artemis.plugin.utils.DefaultBrokerHostResolver;
import org.eclipse.kapua.broker.artemis.plugin.utils.DefaultBrokerIdResolver;
import org.eclipse.kapua.commons.core.AbstractKapuaModule;
import org.eclipse.kapua.commons.liquibase.DatabaseCheckUpdate;
import org.eclipse.kapua.commons.setting.system.SystemSetting;
import org.eclipse.kapua.commons.setting.system.SystemSettingKey;

import javax.inject.Named;
import javax.inject.Singleton;

public class AppModule extends AbstractKapuaModule {
@Override
protected void configureModule() {
bind(DatabaseCheckUpdate.class).asEagerSingleton();
bind(BrokerSetting.class).in(Singleton.class);
bind(BrokerIdentity.class).in(Singleton.class);
}

@Provides
@Singleton
@Named("clusterName")
String clusterName(SystemSetting systemSetting) {
return systemSetting.getString(SystemSettingKey.CLUSTER_NAME);
}

@Provides
@Singleton
@Named("metricModuleName")
String metricModuleName() {
return "broker-telemetry";
}

@Provides
@Singleton
@Named("brokerHost")
String brokerHost(BrokerHostResolver brokerHostResolver) {
return brokerHostResolver.getBrokerHost();
}


@Singleton
@Provides
BrokerIdResolver brokerIdResolver(BrokerSetting brokerSettings) throws KapuaException {
return new DefaultBrokerIdResolver();
}

@Singleton
@Provides
BrokerHostResolver brokerHostResolver(BrokerSetting brokerSettings) throws KapuaException {
return new DefaultBrokerHostResolver(brokerSettings.getString(BrokerSettingKey.BROKER_HOST));
}
}
Loading

0 comments on commit f913868

Please sign in to comment.