-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2 from inspectIT/VHVAPM-513
Vhvapm 513
- Loading branch information
Showing
60 changed files
with
5,534 additions
and
6,771 deletions.
There are no files selected for viewing
This file contains 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 |
---|---|---|
@@ -1,7 +1,7 @@ | ||
/frontend/.nuxt/ | ||
/frontend/node_modules/ | ||
/out/ | ||
.DS_Store | ||
.idea | ||
*.iml | ||
|
||
/agentmanager/frontend/src/.nuxt/ | ||
/agentmanager/frontend/src/node_modules/ |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains 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,262 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<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 https://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
<modelVersion>4.0.0</modelVersion> | ||
<parent> | ||
<groupId>org.springframework.boot</groupId> | ||
<artifactId>spring-boot-starter-parent</artifactId> | ||
<version>3.3.0</version> | ||
<relativePath/> <!-- lookup parent from repository --> | ||
</parent> | ||
<groupId>rocks.gepard</groupId> | ||
<artifactId>backend</artifactId> | ||
<version>0.0.1-SNAPSHOT</version> | ||
<name>backend</name> | ||
<description>backend</description> | ||
<properties> | ||
<java.version>17</java.version> | ||
<kotlin.version>1.9.0</kotlin.version> | ||
</properties> | ||
|
||
<!-- DEPENDENCIES--> | ||
<dependencies> | ||
<dependency> | ||
<groupId>org.springframework.boot</groupId> | ||
<artifactId>spring-boot-starter-data-jpa</artifactId> | ||
</dependency> | ||
|
||
<dependency> | ||
<groupId>org.springframework.boot</groupId> | ||
<artifactId>spring-boot-starter-web</artifactId> | ||
</dependency> | ||
|
||
<dependency> | ||
<groupId>com.fasterxml.jackson.module</groupId> | ||
<artifactId>jackson-module-kotlin</artifactId> | ||
</dependency> | ||
|
||
<dependency> | ||
<groupId>org.jetbrains.kotlin</groupId> | ||
<artifactId>kotlin-reflect</artifactId> | ||
</dependency> | ||
|
||
<dependency> | ||
<groupId>org.jetbrains.kotlin</groupId> | ||
<artifactId>kotlin-stdlib-jdk8</artifactId> | ||
<version>${kotlin.version}</version> | ||
</dependency> | ||
|
||
<dependency> | ||
<groupId>org.springframework.boot</groupId> | ||
<artifactId>spring-boot-devtools</artifactId> | ||
<scope>runtime</scope> | ||
<optional>true</optional> | ||
</dependency> | ||
|
||
<dependency> | ||
<groupId>com.h2database</groupId> | ||
<artifactId>h2</artifactId> | ||
<scope>runtime</scope> | ||
</dependency> | ||
|
||
<dependency> | ||
<groupId>org.projectlombok</groupId> | ||
<artifactId>lombok</artifactId> | ||
<optional>true</optional> | ||
</dependency> | ||
|
||
<dependency> | ||
<groupId>org.springframework.boot</groupId> | ||
<artifactId>spring-boot-starter-test</artifactId> | ||
<scope>test</scope> | ||
</dependency> | ||
|
||
<dependency> | ||
<groupId>org.jetbrains.kotlin</groupId> | ||
<artifactId>kotlin-test-junit5</artifactId> | ||
<scope>test</scope> | ||
</dependency> | ||
|
||
<dependency> | ||
<groupId>com.google.code.gson</groupId> | ||
<artifactId>gson</artifactId> | ||
<version>2.10.1</version> | ||
<scope>test</scope> | ||
</dependency> | ||
|
||
<dependency> | ||
<groupId>io.swagger.core.v3</groupId> | ||
<artifactId>swagger-annotations</artifactId> | ||
<version>2.2.2</version> | ||
</dependency> | ||
|
||
<dependency> | ||
<groupId>org.openapitools</groupId> | ||
<artifactId>jackson-databind-nullable</artifactId> | ||
<version>0.2.2</version> | ||
</dependency> | ||
|
||
<dependency> | ||
<groupId>javax.validation</groupId> | ||
<artifactId>validation-api</artifactId> | ||
<version>2.0.1.Final</version> | ||
</dependency> | ||
|
||
<dependency> | ||
<groupId>javax.servlet</groupId> | ||
<artifactId>javax.servlet-api</artifactId> | ||
<version>3.0.1</version> | ||
<scope>compile</scope> | ||
</dependency> | ||
|
||
<dependency> | ||
<groupId>javax.annotation</groupId> | ||
<artifactId>javax.annotation-api</artifactId> | ||
<version>1.3.2</version> | ||
</dependency> | ||
|
||
<dependency> | ||
<groupId>org.apache.commons</groupId> | ||
<artifactId>commons-lang3</artifactId> | ||
<version>3.14.0</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.jetbrains.kotlin</groupId> | ||
<artifactId>kotlin-test</artifactId> | ||
<version>${kotlin.version}</version> | ||
<scope>test</scope> | ||
</dependency> | ||
</dependencies> | ||
|
||
<build> | ||
<sourceDirectory>${project.basedir}/src/main/kotlin</sourceDirectory> | ||
<testSourceDirectory>${project.basedir}/src/test/kotlin</testSourceDirectory> | ||
|
||
<!-- PLUGINS--> | ||
<plugins> | ||
<plugin> | ||
<groupId>org.springframework.boot</groupId> | ||
<artifactId>spring-boot-maven-plugin</artifactId> | ||
<configuration> | ||
<excludes> | ||
<exclude> | ||
<groupId>org.projectlombok</groupId> | ||
<artifactId>lombok</artifactId> | ||
</exclude> | ||
</excludes> | ||
</configuration> | ||
</plugin> | ||
|
||
<plugin> | ||
<groupId>org.jetbrains.kotlin</groupId> | ||
<artifactId>kotlin-maven-plugin</artifactId> | ||
<version>${kotlin.version}</version> | ||
<executions> | ||
<execution> | ||
<id>compile</id> | ||
<phase>compile</phase> | ||
<goals> | ||
<goal>compile</goal> | ||
</goals> | ||
<configuration> | ||
<sourceDirs> | ||
<source>src/main/kotlin</source> | ||
<source>target/generated-sources/annotations</source> | ||
<source>target/generated-sources/openapi/src/main/java</source> | ||
</sourceDirs> | ||
</configuration> | ||
</execution> | ||
<execution> | ||
<id>test-compile</id> | ||
<phase>test-compile</phase> | ||
<goals> | ||
<goal>test-compile</goal> | ||
</goals> | ||
<configuration> | ||
<sourceDirs> | ||
<source>src/test/kotlin</source> | ||
<source>target/generated-test-sources/test-annotations</source> | ||
</sourceDirs> | ||
</configuration> | ||
</execution> | ||
</executions> | ||
<configuration> | ||
<args> | ||
<arg>-Xjsr305=strict</arg> | ||
</args> | ||
<compilerPlugins> | ||
<plugin>spring</plugin> | ||
<plugin>jpa</plugin> | ||
</compilerPlugins> | ||
<jvmTarget>1.8</jvmTarget> | ||
</configuration> | ||
<dependencies> | ||
<dependency> | ||
<groupId>org.jetbrains.kotlin</groupId> | ||
<artifactId>kotlin-maven-allopen</artifactId> | ||
<version>${kotlin.version}</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.jetbrains.kotlin</groupId> | ||
<artifactId>kotlin-maven-noarg</artifactId> | ||
<version>${kotlin.version}</version> | ||
</dependency> | ||
</dependencies> | ||
</plugin> | ||
|
||
<plugin> | ||
<groupId>org.openapitools</groupId> | ||
<artifactId>openapi-generator-maven-plugin</artifactId> | ||
<version>6.1.0</version> | ||
<executions> | ||
<execution> | ||
<goals> | ||
<goal>generate</goal> | ||
</goals> | ||
<configuration> | ||
<inputSpec> | ||
${project.basedir}/src/main/resources/openai/AgentController-1.0.0.yaml | ||
</inputSpec> | ||
<generatorName>spring</generatorName> | ||
<apiPackage>rocks.gepard.backend.infrastructure.incoming.api</apiPackage> | ||
<modelPackage>rocks.gepard.backend.infrastructure.incoming.model</modelPackage> | ||
<configOptions> | ||
<interfaceOnly>true</interfaceOnly> | ||
</configOptions> | ||
</configuration> | ||
</execution> | ||
</executions> | ||
</plugin> | ||
<plugin> | ||
<groupId>org.apache.maven.plugins</groupId> | ||
<artifactId>maven-compiler-plugin</artifactId> | ||
<executions> | ||
<execution> | ||
<id>default-compile</id> | ||
<phase>none</phase> | ||
</execution> | ||
<execution> | ||
<id>default-testCompile</id> | ||
<phase>none</phase> | ||
</execution> | ||
<execution> | ||
<id>compile</id> | ||
<phase>compile</phase> | ||
<goals> | ||
<goal>compile</goal> | ||
</goals> | ||
</execution> | ||
<execution> | ||
<id>testCompile</id> | ||
<phase>test-compile</phase> | ||
<goals> | ||
<goal>testCompile</goal> | ||
</goals> | ||
</execution> | ||
</executions> | ||
</plugin> | ||
|
||
</plugins> | ||
</build> | ||
|
||
</project> |
This file contains 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 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
26 changes: 26 additions & 0 deletions
26
agentmanager/backend/src/main/kotlin/rocks/gepard/backend/application/AgentCache.kt
This file contains 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,26 @@ | ||
package rocks.gepard.backend.application | ||
|
||
import rocks.gepard.backend.infrastructure.incoming.model.AgentResponseDto | ||
|
||
|
||
class AgentCache<K, V> : GenericCache<K, V> { | ||
|
||
private val cache = HashMap<K,V>() | ||
|
||
override val size: Int | ||
get() = cache.size | ||
|
||
override fun set(key: K, value: V) { | ||
cache[key] = value | ||
} | ||
|
||
override fun remove(key: K) = cache.remove(key) | ||
|
||
override fun get(key: K) = cache[key] | ||
|
||
override fun clear() = cache.clear() | ||
|
||
fun getAllAgents() : MutableList<AgentResponseDto>{ | ||
return TODO() | ||
} | ||
} |
36 changes: 36 additions & 0 deletions
36
agentmanager/backend/src/main/kotlin/rocks/gepard/backend/application/AgentService.kt
This file contains 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,36 @@ | ||
package rocks.gepard.backend.application | ||
|
||
import org.springframework.stereotype.Service | ||
import rocks.gepard.backend.domain.model.Agent | ||
import rocks.gepard.backend.infrastructure.incoming.model.AgentDto | ||
import rocks.gepard.backend.infrastructure.incoming.model.AgentResponseDto | ||
|
||
@Service | ||
class AgentService { | ||
|
||
private val agentCache: AgentCache<String, Agent> = AgentCache() | ||
|
||
fun storeAgent(agent: Agent?) { | ||
agent?.let { | ||
agentCache.set(it.name, it) | ||
} | ||
} | ||
|
||
fun getAllAgents(): MutableList<AgentResponseDto> { | ||
|
||
return agentCache.getAllAgents() | ||
} | ||
|
||
fun getAgentByName(agentName: String?): AgentResponseDto? { | ||
return agentName | ||
?.let { agentCache.get(it) } | ||
?.let(Agent::toResponseDto) | ||
} | ||
} | ||
|
||
fun Agent.toResponseDto(): AgentResponseDto { | ||
return AgentResponseDto().name(this.name) | ||
.javaversion(this.getJavaVersion()) | ||
.otelversion(this.getOtelVersion()) | ||
.config(this.configuration.toString()) | ||
} |
Oops, something went wrong.