Skip to content

Commit f09b051

Browse files
authored
Merge pull request #59 from Aitia-IIOT/tb/orchestration
Dynamic Orchestration impl & MQTT rework related changes
2 parents 40fa863 + d3a59e3 commit f09b051

102 files changed

Lines changed: 7400 additions & 149 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44
.settings/
55
/serviceregistry/.factorypath
66
/serviceregistry/*.log
7+
/serviceorchestration-dynamic/.factorypath
8+
/serviceorchestration-dynamic/*.log
79
.checkstyle
810
*.lck
911
/authentication/.factorypath

authentication/src/main/java/eu/arrowhead/authentication/AuthenticationConstants.java

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,9 +45,6 @@ public final class AuthenticationConstants {
4545
public static final String CLEANER_JOB_INTERVAL = "cleaner.job.interval";
4646
public static final String $CLEANER_JOB_INTERVAL_WD = "${" + CLEANER_JOB_INTERVAL + ":" + AuthenticationDefaults.CLEANER_JOB_INTERVAL_DEFAULT + "}";
4747

48-
// property size related
49-
public static final int SYSTEM_NAME_LENGTH = ArrowheadEntity.VARCHAR_SMALL;
50-
5148
// Quartz related
5249
public static final String CLEANER_TRIGGER = "authenticationCleanerTrigger";
5350
public static final String CLEANER_JOB = "authenticationCleanerJob";

authentication/src/main/java/eu/arrowhead/authentication/service/validation/ManagementValidation.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
import org.springframework.stereotype.Service;
1313
import org.springframework.util.Assert;
1414

15-
import eu.arrowhead.authentication.AuthenticationConstants;
1615
import eu.arrowhead.authentication.jpa.entity.ActiveSession;
1716
import eu.arrowhead.authentication.jpa.entity.System;
1817
import eu.arrowhead.authentication.method.AuthenticationMethods;
@@ -22,6 +21,7 @@
2221
import eu.arrowhead.authentication.service.dto.NormalizedIdentityQueryRequestDTO;
2322
import eu.arrowhead.authentication.service.dto.NormalizedIdentitySessionQueryRequestDTO;
2423
import eu.arrowhead.authentication.service.normalization.ManagementNormalization;
24+
import eu.arrowhead.common.Constants;
2525
import eu.arrowhead.common.Utilities;
2626
import eu.arrowhead.common.exception.InternalServerError;
2727
import eu.arrowhead.common.exception.InvalidParameterException;
@@ -72,7 +72,7 @@ public void validateRequester(final String requester, final String origin) {
7272
throw new InvalidParameterException("Requester name is missing or empty", origin);
7373
}
7474

75-
if (requester.length() > AuthenticationConstants.SYSTEM_NAME_LENGTH) {
75+
if (requester.length() > Constants.SYSTEM_NAME_MAX_LENGTH) {
7676
throw new InvalidParameterException("Requester name is too long: " + requester, origin);
7777
}
7878

@@ -356,7 +356,7 @@ private void validateIdentityWithoutCredentials(final IdentityMgmtRequestDTO ide
356356
throw new InvalidParameterException("System name is missing or empty", origin);
357357
}
358358

359-
if (identity.systemName().length() > AuthenticationConstants.SYSTEM_NAME_LENGTH) {
359+
if (identity.systemName().length() > Constants.SYSTEM_NAME_MAX_LENGTH) {
360360
throw new InvalidParameterException("System name is too long: " + identity.systemName(), origin);
361361
}
362362

pom.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626

2727
<modules>
2828
<module>serviceregistry</module>
29+
<module>serviceorchestration-dynamic</module>
2930
<module>authentication</module>
3031
</modules>
3132

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/target/
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<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">
3+
<modelVersion>4.0.0</modelVersion>
4+
<parent>
5+
<groupId>eu.arrowhead</groupId>
6+
<artifactId>arrowhead-core</artifactId>
7+
<version>${revision}</version>
8+
</parent>
9+
<artifactId>arrowhead-serviceorchestration-dynamic</artifactId>
10+
<version>5.0.0</version>
11+
<packaging>jar</packaging>
12+
<name>Arrowhead Service Orchestration - Dynamic</name>
13+
<description>Arrowhead Service Orchestration (Dynamic) using Spring Boot</description>
14+
15+
<url>https://github.com/Aitia-IIOT/ah5-core-java-spring</url>
16+
17+
<build>
18+
<plugins>
19+
<plugin>
20+
<artifactId>maven-resources-plugin</artifactId>
21+
<version>${mvn.resources.version}</version>
22+
<executions>
23+
<execution>
24+
<id>copy-resources</id>
25+
<phase>validate</phase>
26+
<goals>
27+
<goal>copy-resources</goal>
28+
</goals>
29+
<configuration>
30+
<outputDirectory>${basedir}/target</outputDirectory>
31+
<resources>
32+
<resource>
33+
<directory>src/main/resources</directory>
34+
<includes>
35+
<include>application.properties</include>
36+
<include>log4j2.xml</include>
37+
</includes>
38+
</resource>
39+
</resources>
40+
</configuration>
41+
</execution>
42+
</executions>
43+
</plugin>
44+
</plugins>
45+
</build>
46+
<dependencies>
47+
<dependency>
48+
<groupId>org.apache.commons</groupId>
49+
<artifactId>commons-lang3</artifactId>
50+
</dependency>
51+
</dependencies>
52+
</project>
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
package eu.arrowhead.serviceorchestration;
2+
3+
import java.util.UUID;
4+
import java.util.concurrent.BlockingQueue;
5+
import java.util.concurrent.LinkedBlockingQueue;
6+
7+
import org.springframework.context.annotation.Bean;
8+
import org.springframework.context.annotation.Configuration;
9+
10+
import eu.arrowhead.serviceorchestration.service.utils.matchmaker.DefaultServiceInstanceMatchmaker;
11+
import eu.arrowhead.serviceorchestration.service.utils.matchmaker.ServiceInstanceMatchmaker;
12+
13+
@Configuration
14+
public class BeanConfig {
15+
16+
//=================================================================================================
17+
// methods
18+
19+
//-------------------------------------------------------------------------------------------------
20+
@Bean(name = DynamicServiceOrchestrationConstants.JOB_QUEUE_PUSH_ORCHESTRATION)
21+
BlockingQueue<UUID> initPushOrchestrationJobQueue() {
22+
return new LinkedBlockingQueue<>();
23+
}
24+
25+
//-------------------------------------------------------------------------------------------------
26+
@Bean(name = DynamicServiceOrchestrationConstants.SERVICE_INSTANCE_MATCHMAKER)
27+
ServiceInstanceMatchmaker initServiceInstanceMatchmaker() {
28+
return new DefaultServiceInstanceMatchmaker();
29+
}
30+
}
Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
package eu.arrowhead.serviceorchestration;
2+
3+
public final class DynamicServiceOrchestrationConstants {
4+
5+
//=================================================================================================
6+
// members
7+
8+
public static final String SYSTEM_NAME = "serviceorchestration-dynamic";
9+
10+
public static final String DATABASE_ENTITY_PACKAGE = "eu.arrowhead.serviceorchestration.jpa.entity";
11+
public static final String DATABASE_REPOSITORY_PACKAGE = "eu.arrowhead.serviceorchestration.jpa.repository";
12+
13+
public static final String ENABLE_AUTHORIZATION = "enable.authorization";
14+
public static final String $ENABLE_AUTHORIZATION_WD = "${" + ENABLE_AUTHORIZATION + ":" + DynamicServiceOrchestrationDefaults.ENABLE_AUTHORIZATION_DEFAULT + "}";
15+
public static final String ENABLE_TRANSLATION = "enable.translation";
16+
public static final String $ENABLE_TRANSLATION_WD = "${" + ENABLE_TRANSLATION + ":" + DynamicServiceOrchestrationDefaults.ENABLE_TRANSLATION_DEFAULT + "}";
17+
public static final String ENABLE_QOS = "enable.qos";
18+
public static final String $ENABLE_QOS_WD = "${" + ENABLE_QOS + ":" + DynamicServiceOrchestrationDefaults.ENABLE_QOS_DEFAULT + "}";
19+
public static final String ENABLE_INTERCLOUD = "enable.intercloud";
20+
public static final String $ENABLE_INTERCLOUD_WD = "${" + ENABLE_INTERCLOUD + ":" + DynamicServiceOrchestrationDefaults.ENABLE_INTERCLOUD_DEFAULT + "}";
21+
public static final String CLEANER_JOB_INTERVAL = "cleaner.job.interval";
22+
public static final String $CLEANER_JOB_INTERVAL_WD = "${" + CLEANER_JOB_INTERVAL + ":" + DynamicServiceOrchestrationDefaults.CLEANER_JOB_INTERVAL_DEFAULT + "}";
23+
public static final String ORCHESTRATION_HISTORY_MAX_AGE = "orchestration.history.max.age";
24+
public static final String $ORCHESTRATION_HISTORY_MAX_AGE_WD = "${" + ORCHESTRATION_HISTORY_MAX_AGE + ":" + DynamicServiceOrchestrationDefaults.ORCHESTRATION_HISTORY_MAX_AGE_DEFAULT + "}";
25+
public static final String PUSH_ORCHESTRATION_MAX_THREAD = "push.orchestration.max.thread";
26+
public static final String $PUSH_ORCHESTRATION_MAX_THREAD_WD = "${" + PUSH_ORCHESTRATION_MAX_THREAD + ":" + DynamicServiceOrchestrationDefaults.PUSH_ORCHESTRATION_MAX_THREAD_DEFAULT + "}";
27+
28+
public static final String HTTP_API_BASE_PATH = "/serviceorchestration";
29+
public static final String HTTP_API_MONITOR_PATH = HTTP_API_BASE_PATH + "/monitor";
30+
public static final String HTTP_API_GENERAL_MANAGEMENT_PATH = HTTP_API_BASE_PATH + "/general/mgmt";
31+
public static final String HTTP_API_ORCHESTRATION_PATH = HTTP_API_BASE_PATH + "/orchestration";
32+
public static final String HTTP_API_ORCHESTRATION_MGMT_PREFIX = HTTP_API_ORCHESTRATION_PATH + "/mgmt";
33+
public static final String HTTP_API_ORCHESTRATION_PUSH_MANAGEMENT_PATH = HTTP_API_ORCHESTRATION_MGMT_PREFIX + "/push";
34+
public static final String HTTP_API_ORCHESTRATION_HISTORY_MANAGEMENT_PATH = HTTP_API_ORCHESTRATION_MGMT_PREFIX + "/history";
35+
public static final String HTTP_API_ORCHESTRATION_LOCK_MANAGEMENT_PATH = HTTP_API_ORCHESTRATION_MGMT_PREFIX + "/lock";
36+
37+
public static final String MQTT_API_BASE_TOPIC_PREFIX = "arrowhead/serviceorchestration";
38+
public static final String MQTT_API_MONITOR_BASE_TOPIC = MQTT_API_BASE_TOPIC_PREFIX + "/monitor/";
39+
public static final String MQTT_API_GENERAL_MANAGEMENT_BASE_TOPIC = MQTT_API_BASE_TOPIC_PREFIX + "/general/management/";
40+
41+
public static final String VERSION_MONITOR = "1.0.0";
42+
public static final String VERSION_GENERAL_MANAGEMENT = "1.0.0";
43+
public static final String VERSION_ORCHESTRATION = "1.0.0";
44+
public static final String VERSION_ORCHESTRATION_PUSH_MANAGEMENT = "1.0.0";
45+
public static final String VERSION_ORCHESTRATION_LOCK_MANAGEMENT = "1.0.0";
46+
public static final String VERSION_ORCHESTRATION_HISTORY_MANAGEMENT = "1.0.0";
47+
48+
public static final String METADATA_KEY_ORCHESTRATION_STRATEGY = "orchestration-strategy";
49+
public static final String METADATA_VALUE_ORCHESTRATION_STRATEGY = "dynamic";
50+
51+
public static final String JOB_QUEUE_PUSH_ORCHESTRATION = "jobQueuePushOrchestration";
52+
public static final String SERVICE_INSTANCE_MATCHMAKER = "serviceInstanceMatchmaker";
53+
54+
public static final Object SYNC_LOCK_SUBSCRIPTION = new Object();
55+
public static final Object SYNC_LOCK_ORCH_LOCK = new Object();
56+
57+
// Quartz related
58+
public static final String CLEANER_TRIGGER = "dynamicOrchestrationCleanerTrigger";
59+
public static final String CLEANER_JOB = "dynamicOrchestrationCleanerJob";
60+
61+
// Operation related
62+
63+
public static final String HTTP_API_OP_PULL_PATH = "/pull";
64+
public static final String HTTP_API_OP_PUSH_SUBSCRIBE_PATH = "/subscribe";
65+
public static final String HTTP_PATH_PARAM_ID = "{id}";
66+
public static final String HTTP_API_OP_PUSH_UNSUBSCRIBE_PATH = "/unsubscribe/" + HTTP_PATH_PARAM_ID;
67+
public static final String HTTP_API_OP_PUSH_UNSUBSCRIBE_BULK_PATH = "/unsubscribe";
68+
public static final String HTTP_API_OP_PUSH_TRIGGER_PATH = "/trigger";
69+
public static final String HTTP_API_OP_QUERY_PATH = "/query";
70+
public static final String HTTP_API_OP_CREATE_PATH = "/create";
71+
public static final String HTTP_PATH_PARAM_OWNER = "{owner}";
72+
public static final String HTTP_API_OP_REMOVE_LOCK_PATH = "/remove/" + HTTP_PATH_PARAM_OWNER;
73+
74+
public static final String ORCH_WARN_AUTO_MATCHMAKING = "auto_matchmaking";
75+
public static final String ORCH_WARN_QOS_NOT_ENABLED = "qos_not_enabled";
76+
public static final String ORCH_WARN_NOT_EXCLUSIVE = "not_exclusive";
77+
public static final String ORCH_WARN_PART_TIME_EXCLUSIVITY = "part_time_exclusivity";
78+
public static final String ORCH_WARN_INTER_CLOUD = "inter_cloud";
79+
80+
public static final String NOTIFY_KEY_ADDRESS = "address";
81+
public static final String NOTIFY_KEY_PORT = "port";
82+
public static final String NOTIFY_KEY_METHOD = "method";
83+
public static final String NOTIFY_KEY_PATH = "path";
84+
public static final String NOTIFY_KEY_TOPIC = "topic";
85+
86+
//=================================================================================================
87+
// assistant methods
88+
89+
//-------------------------------------------------------------------------------------------------
90+
private DynamicServiceOrchestrationConstants() {
91+
throw new UnsupportedOperationException();
92+
}
93+
}
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
package eu.arrowhead.serviceorchestration;
2+
3+
import eu.arrowhead.common.Defaults;
4+
5+
public final class DynamicServiceOrchestrationDefaults extends Defaults {
6+
7+
//=================================================================================================
8+
// members
9+
10+
public static final String ENABLE_AUTHORIZATION_DEFAULT = "false";
11+
public static final String ENABLE_TRANSLATION_DEFAULT = "false";
12+
public static final String ENABLE_QOS_DEFAULT = "false";
13+
public static final String ENABLE_INTERCLOUD_DEFAULT = "false";
14+
public static final String CLEANER_JOB_INTERVAL_DEFAULT = "30000";
15+
public static final String ORCHESTRATION_HISTORY_MAX_AGE_DEFAULT = "15";
16+
public static final String PUSH_ORCHESTRATION_MAX_THREAD_DEFAULT = "5";
17+
18+
//=================================================================================================
19+
// assistant methods
20+
21+
//-------------------------------------------------------------------------------------------------
22+
private DynamicServiceOrchestrationDefaults() {
23+
throw new UnsupportedOperationException();
24+
}
25+
}
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
package eu.arrowhead.serviceorchestration;
2+
3+
import org.springframework.boot.SpringApplication;
4+
import org.springframework.boot.autoconfigure.SpringBootApplication;
5+
import org.springframework.boot.autoconfigure.domain.EntityScan;
6+
import org.springframework.context.annotation.ComponentScan;
7+
import org.springframework.data.jpa.repository.config.EnableJpaRepositories;
8+
import org.springframework.scheduling.annotation.EnableScheduling;
9+
10+
import eu.arrowhead.common.Constants;
11+
import eu.arrowhead.common.jpa.RefreshableRepositoryImpl;
12+
13+
@SpringBootApplication
14+
@ComponentScan(Constants.BASE_PACKAGE)
15+
@EntityScan(DynamicServiceOrchestrationConstants.DATABASE_ENTITY_PACKAGE)
16+
@EnableJpaRepositories(basePackages = DynamicServiceOrchestrationConstants.DATABASE_REPOSITORY_PACKAGE, repositoryBaseClass = RefreshableRepositoryImpl.class)
17+
@EnableScheduling
18+
public class DynamicServiceOrchestrationMain {
19+
20+
//=================================================================================================
21+
// methods
22+
23+
//-------------------------------------------------------------------------------------------------
24+
public static void main(final String[] args) {
25+
SpringApplication.run(DynamicServiceOrchestrationMain.class, args);
26+
}
27+
28+
//=================================================================================================
29+
// boilerplate
30+
31+
//-------------------------------------------------------------------------------------------------
32+
protected DynamicServiceOrchestrationMain() {
33+
}
34+
}

0 commit comments

Comments
 (0)