-
Notifications
You must be signed in to change notification settings - Fork 20
Executor skeleton #26
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Draft
borditamas
wants to merge
10
commits into
development
Choose a base branch
from
executor-skeleton
base: development
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from 4 commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
c32f99c
init executor skeleton
borditamas 8b2d8e7
executor skeleton impl
borditamas b4f6ff3
executor skeleton impl
borditamas 6abd90a
executor skeleton cert
borditamas bcb3e30
executor skeleton controller updates
borditamas d1f02c1
executor skeleton execution support impl
borditamas b09695f
executor skeleton execution add missing property
borditamas 60d0bb9
executor skeleton fix
borditamas 02d5523
check configuration
borditamas 959406d
Some fix and Merge branch 'development' into executor-skeleton
borditamas File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,38 @@ | ||
| <?xml version="1.0" encoding="UTF-8"?> | ||
| <classpath> | ||
| <classpathentry kind="src" output="target/classes" path="src/main/java"> | ||
| <attributes> | ||
| <attribute name="optional" value="true"/> | ||
| <attribute name="maven.pomderived" value="true"/> | ||
| </attributes> | ||
| </classpathentry> | ||
| <classpathentry excluding="**" kind="src" output="target/classes" path="src/main/resources"> | ||
| <attributes> | ||
| <attribute name="maven.pomderived" value="true"/> | ||
| </attributes> | ||
| </classpathentry> | ||
| <classpathentry kind="src" output="target/test-classes" path="src/test/java"> | ||
| <attributes> | ||
| <attribute name="optional" value="true"/> | ||
| <attribute name="maven.pomderived" value="true"/> | ||
| <attribute name="test" value="true"/> | ||
| </attributes> | ||
| </classpathentry> | ||
| <classpathentry excluding="**" kind="src" output="target/test-classes" path="src/test/resources"> | ||
| <attributes> | ||
| <attribute name="maven.pomderived" value="true"/> | ||
| <attribute name="test" value="true"/> | ||
| </attributes> | ||
| </classpathentry> | ||
| <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"> | ||
| <attributes> | ||
| <attribute name="maven.pomderived" value="true"/> | ||
| </attributes> | ||
| </classpathentry> | ||
| <classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER"> | ||
| <attributes> | ||
| <attribute name="maven.pomderived" value="true"/> | ||
| </attributes> | ||
| </classpathentry> | ||
| <classpathentry kind="output" path="target/classes"/> | ||
| </classpath> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,23 @@ | ||
| <?xml version="1.0" encoding="UTF-8"?> | ||
| <projectDescription> | ||
| <name>arrowhead-application-skeleton-executor</name> | ||
| <comment></comment> | ||
| <projects> | ||
| </projects> | ||
| <buildSpec> | ||
| <buildCommand> | ||
| <name>org.eclipse.jdt.core.javabuilder</name> | ||
| <arguments> | ||
| </arguments> | ||
| </buildCommand> | ||
| <buildCommand> | ||
| <name>org.eclipse.m2e.core.maven2Builder</name> | ||
| <arguments> | ||
| </arguments> | ||
| </buildCommand> | ||
| </buildSpec> | ||
| <natures> | ||
| <nature>org.eclipse.jdt.core.javanature</nature> | ||
| <nature>org.eclipse.m2e.core.maven2Nature</nature> | ||
| </natures> | ||
| </projectDescription> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,54 @@ | ||
| <project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> | ||
| <modelVersion>4.0.0</modelVersion> | ||
|
|
||
| <parent> | ||
| <groupId>eu.arrowhead</groupId> | ||
| <artifactId>application-skeleton-java-spring</artifactId> | ||
| <version>4.4.0.0</version> | ||
| </parent> | ||
|
|
||
| <artifactId>arrowhead-application-skeleton-executor</artifactId> | ||
| <name>Arrowhead Executor Skeleton</name> | ||
|
|
||
| <build> | ||
| <plugins> | ||
| <plugin> | ||
| <groupId>org.springframework.boot</groupId> | ||
| <artifactId>spring-boot-maven-plugin</artifactId> | ||
| <executions> | ||
| <execution> | ||
| <goals> | ||
| <goal>repackage</goal> | ||
| </goals> | ||
| </execution> | ||
| </executions> | ||
| </plugin> | ||
|
|
||
| <plugin> | ||
| <artifactId>maven-resources-plugin</artifactId> | ||
| <version>3.1.0</version> | ||
| <executions> | ||
| <execution> | ||
| <id>copy-resources</id> | ||
| <phase>validate</phase> | ||
| <goals> | ||
| <goal>copy-resources</goal> | ||
| </goals> | ||
| <configuration> | ||
| <outputDirectory>${basedir}/target</outputDirectory> | ||
| <resources> | ||
| <resource> | ||
| <directory>src/main/resources</directory> | ||
| <includes> | ||
| <include>application.properties</include> | ||
| </includes> | ||
| </resource> | ||
| </resources> | ||
| </configuration> | ||
| </execution> | ||
| </executions> | ||
| </plugin> | ||
| </plugins> | ||
| </build> | ||
|
|
||
| </project> |
45 changes: 45 additions & 0 deletions
45
...main/java/eu/arrowhead/application/skeleton/executor/ExecutorApplicationInitListener.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,45 @@ | ||
| package eu.arrowhead.application.skeleton.executor; | ||
|
|
||
| import org.apache.logging.log4j.LogManager; | ||
| import org.apache.logging.log4j.Logger; | ||
| import org.springframework.beans.factory.annotation.Autowired; | ||
| import org.springframework.context.event.ContextRefreshedEvent; | ||
| import org.springframework.stereotype.Component; | ||
|
|
||
| import ai.aitia.arrowhead.application.library.ArrowheadService; | ||
| import ai.aitia.arrowhead.application.library.config.ApplicationInitListener; | ||
| import eu.arrowhead.common.core.CoreSystem; | ||
|
|
||
| @Component | ||
| public class ExecutorApplicationInitListener extends ApplicationInitListener { | ||
|
|
||
| //================================================================================================= | ||
| // members | ||
|
|
||
| @Autowired | ||
| private ArrowheadService arrowheadService; | ||
|
|
||
| private final Logger logger = LogManager.getLogger(ExecutorApplicationInitListener.class); | ||
|
|
||
| //================================================================================================= | ||
| // methods | ||
|
|
||
| //------------------------------------------------------------------------------------------------- | ||
| @Override | ||
| protected void customInit(final ContextRefreshedEvent event) { | ||
|
|
||
| //Checking the availability of necessary core systems | ||
| checkCoreSystemReachability(CoreSystem.CHOREOGRAPHER); | ||
|
|
||
| //Initialize Arrowhead Context | ||
| arrowheadService.updateCoreServiceURIs(CoreSystem.CHOREOGRAPHER); | ||
|
|
||
| //TODO: implement here any custom behavior on application start up | ||
| } | ||
|
|
||
| //------------------------------------------------------------------------------------------------- | ||
| @Override | ||
| public void customDestroy() { | ||
| //TODO: implement here any custom behavior on application shout down | ||
| } | ||
| } |
20 changes: 20 additions & 0 deletions
20
...leton-executor/src/main/java/eu/arrowhead/application/skeleton/executor/ExecutorMain.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,20 @@ | ||
| package eu.arrowhead.application.skeleton.executor; | ||
|
|
||
| import org.springframework.boot.SpringApplication; | ||
| import org.springframework.boot.autoconfigure.SpringBootApplication; | ||
| import org.springframework.context.annotation.ComponentScan; | ||
|
|
||
| import eu.arrowhead.common.CommonConstants; | ||
|
|
||
| @SpringBootApplication | ||
| @ComponentScan(basePackages = {CommonConstants.BASE_PACKAGE}) //TODO: add custom packages if any | ||
| public class ExecutorMain { | ||
|
|
||
| //================================================================================================= | ||
| // methods | ||
|
|
||
| //------------------------------------------------------------------------------------------------- | ||
| public static void main(final String[] args) { | ||
| SpringApplication.run(ExecutorMain.class, args); | ||
| } | ||
| } |
18 changes: 18 additions & 0 deletions
18
...c/main/java/eu/arrowhead/application/skeleton/executor/configuration/ConfigConstants.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,18 @@ | ||
| package eu.arrowhead.application.skeleton.executor.configuration; | ||
|
|
||
| public class ConfigConstants { | ||
|
|
||
| //================================================================================================= | ||
| // members | ||
|
|
||
| public static final int MIN_MAXKEEPALIVE_REQUESTS = 1; | ||
| public static final int MAX_MAXKEEPALIVE_REQUESTS = 1000; | ||
|
|
||
| //================================================================================================= | ||
| // assistant methods | ||
|
|
||
| //------------------------------------------------------------------------------------------------- | ||
| private ConfigConstants() { | ||
| throw new UnsupportedOperationException(); | ||
| } | ||
| } |
31 changes: 31 additions & 0 deletions
31
...ava/eu/arrowhead/application/skeleton/executor/configuration/ContainerConfProperties.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,31 @@ | ||
| package eu.arrowhead.application.skeleton.executor.configuration; | ||
|
|
||
| import javax.validation.constraints.Max; | ||
| import javax.validation.constraints.Min; | ||
|
|
||
| import org.springframework.boot.context.properties.ConfigurationProperties; | ||
| import org.springframework.context.annotation.Configuration; | ||
| import org.springframework.context.annotation.PropertySource; | ||
| import org.springframework.validation.annotation.Validated; | ||
|
|
||
| @Configuration | ||
| @PropertySource("classpath:application.properties") | ||
| @ConfigurationProperties(prefix = "container") | ||
| @Validated | ||
| public class ContainerConfProperties { | ||
|
|
||
| //================================================================================================= | ||
| // members | ||
|
|
||
| @Min(ConfigConstants.MIN_MAXKEEPALIVE_REQUESTS) | ||
| @Max(ConfigConstants.MAX_MAXKEEPALIVE_REQUESTS) | ||
| private int maxKeepAliveRequests; | ||
|
|
||
| //================================================================================================= | ||
| // methods | ||
|
|
||
| //------------------------------------------------------------------------------------------------- | ||
|
|
||
| public int getMaxKeepAliveRequests() { return maxKeepAliveRequests; } | ||
| public void setMaxKeepAliveRequests(final int maxKeepAliveRequests) { this.maxKeepAliveRequests = maxKeepAliveRequests; } | ||
| } |
47 changes: 47 additions & 0 deletions
47
...java/eu/arrowhead/application/skeleton/executor/configuration/ContainerConfiguration.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,47 @@ | ||
| package eu.arrowhead.application.skeleton.executor.configuration; | ||
|
|
||
| import org.apache.coyote.http11.AbstractHttp11Protocol; | ||
| import org.apache.logging.log4j.LogManager; | ||
| import org.apache.logging.log4j.Logger; | ||
| import org.springframework.beans.factory.annotation.Autowired; | ||
| import org.springframework.boot.web.embedded.tomcat.TomcatServletWebServerFactory; | ||
| import org.springframework.boot.web.server.WebServerFactoryCustomizer; | ||
| import org.springframework.context.annotation.Configuration; | ||
|
|
||
| @Configuration | ||
| public class ContainerConfiguration implements WebServerFactoryCustomizer<TomcatServletWebServerFactory> { | ||
|
|
||
| //================================================================================================= | ||
| // members | ||
|
|
||
| @Autowired | ||
| ContainerConfProperties containerConfProperties; | ||
|
|
||
| private final Logger log = LogManager.getLogger( ContainerConfiguration.class); | ||
|
|
||
| //================================================================================================= | ||
| // methods | ||
|
|
||
| //------------------------------------------------------------------------------------------------- | ||
| @SuppressWarnings("rawtypes") | ||
| @Override | ||
| public void customize(TomcatServletWebServerFactory factory) { | ||
| factory.addConnectorCustomizers(connector -> { | ||
| final AbstractHttp11Protocol protocol = (AbstractHttp11Protocol) connector.getProtocolHandler(); | ||
|
|
||
| protocol.setMaxKeepAliveRequests(containerConfProperties.getMaxKeepAliveRequests()); | ||
|
|
||
| log.info("####################################################################################"); | ||
| log.info("#"); | ||
| log.info("# TomcatCustomizer"); | ||
| log.info("#"); | ||
| log.info("# custom maxKeepAliveRequests {}", protocol.getMaxKeepAliveRequests()); | ||
| log.info("# origin keepalive timeout: {} ms", protocol.getKeepAliveTimeout()); | ||
| log.info("# keepalive timeout: {} ms", protocol.getKeepAliveTimeout()); | ||
| log.info("# connection timeout: {} ms", protocol.getConnectionTimeout()); | ||
| log.info("# max connections: {}", protocol.getMaxConnections()); | ||
| log.info("#"); | ||
| log.info("####################################################################################"); | ||
| }); | ||
| } | ||
| } |
58 changes: 58 additions & 0 deletions
58
...c/main/java/eu/arrowhead/application/skeleton/executor/controller/ExecutorController.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,58 @@ | ||
| package eu.arrowhead.application.skeleton.executor.controller; | ||
|
|
||
| import org.springframework.beans.factory.annotation.Autowired; | ||
| import org.springframework.http.MediaType; | ||
| import org.springframework.web.bind.annotation.GetMapping; | ||
| import org.springframework.web.bind.annotation.PostMapping; | ||
| import org.springframework.web.bind.annotation.RequestBody; | ||
| import org.springframework.web.bind.annotation.ResponseBody; | ||
| import org.springframework.web.bind.annotation.RestController; | ||
|
|
||
| import eu.arrowhead.application.skeleton.executor.service.ExecutorService; | ||
| import eu.arrowhead.common.CommonConstants; | ||
| import eu.arrowhead.common.dto.shared.ChoreographerAbortStepRequestDTO; | ||
| import eu.arrowhead.common.dto.shared.ChoreographerExecuteStepRequestDTO; | ||
| import eu.arrowhead.common.dto.shared.ChoreographerExecutorServiceInfoRequestDTO; | ||
| import eu.arrowhead.common.dto.shared.ChoreographerExecutorServiceInfoResponseDTO; | ||
|
|
||
| @RestController | ||
| public class ExecutorController { | ||
|
|
||
| //================================================================================================= | ||
| // members | ||
|
|
||
| @Autowired | ||
| private ExecutorService executorService; | ||
|
|
||
| //TODO: add your variables here | ||
|
|
||
| //================================================================================================= | ||
| // methods | ||
|
|
||
| //------------------------------------------------------------------------------------------------- | ||
| @GetMapping(path = CommonConstants.ECHO_URI) | ||
| public String echo() { | ||
| return "Got it!"; | ||
| } | ||
|
|
||
| //------------------------------------------------------------------------------------------------- | ||
| @PostMapping(path = CommonConstants.CHOREOGRAPHER_EXECUTOR_CLIENT_SERVICE_START_URI, produces = MediaType.APPLICATION_JSON_VALUE) | ||
borditamas marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| public void start(@RequestBody final ChoreographerExecuteStepRequestDTO request) { | ||
| executorService.startExecution(request); | ||
| } | ||
|
|
||
| //------------------------------------------------------------------------------------------------- | ||
| @PostMapping(path = CommonConstants.CHOREOGRAPHER_EXECUTOR_CLIENT_SERVICE_ABORT_URI, produces = MediaType.APPLICATION_JSON_VALUE) | ||
| public void abort(@RequestBody final ChoreographerAbortStepRequestDTO request) { | ||
borditamas marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| executorService.abortExecution(request); | ||
| } | ||
|
|
||
| //------------------------------------------------------------------------------------------------- | ||
| @PostMapping(path = CommonConstants.CHOREOGRAPHER_EXECUTOR_CLIENT_SERVICE_INFO_URI, consumes = MediaType.APPLICATION_JSON_VALUE, produces = MediaType.APPLICATION_JSON_VALUE) | ||
| @ResponseBody public ChoreographerExecutorServiceInfoResponseDTO serviceInfo(@RequestBody final ChoreographerExecutorServiceInfoRequestDTO request) { | ||
| return executorService.collectServiceInfo(request); | ||
| } | ||
|
|
||
| //------------------------------------------------------------------------------------------------- | ||
| //TODO: implement here your provider related REST end points | ||
borditamas marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| } | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.