Basic implementation for files app
This commit is contained in:
22
web-container-registry/pom.xml
Normal file
22
web-container-registry/pom.xml
Normal file
@@ -0,0 +1,22 @@
|
||||
<?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 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<parent>
|
||||
<artifactId>nbs-cloud-aggregator</artifactId>
|
||||
<groupId>de.77zzcx7.nbs-cloud</groupId>
|
||||
<version>1-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>web-container-registry</artifactId>
|
||||
|
||||
<dependencies>
|
||||
<!-- Spring -->
|
||||
<dependency>
|
||||
<groupId>org.springframework</groupId>
|
||||
<artifactId>spring-context</artifactId>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
||||
@@ -0,0 +1,18 @@
|
||||
package de.nbscloud.webcontainer.registry;
|
||||
|
||||
public interface App {
|
||||
// New app:
|
||||
// 1) Create module
|
||||
// 2) Add dependencies (like other app modules)
|
||||
// 3) Register module in web-container module
|
||||
// 4) Add module to dependency management in aggregator pom
|
||||
// 5) Add module package to web-container application @ComponentScan
|
||||
|
||||
String getId();
|
||||
|
||||
String getIcon();
|
||||
|
||||
String getStartPath();
|
||||
|
||||
int getIndex();
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
package de.nbscloud.webcontainer.registry;
|
||||
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.Comparator;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.CopyOnWriteArrayList;
|
||||
|
||||
@Component
|
||||
public class AppRegistry {
|
||||
private final List<App> apps = new CopyOnWriteArrayList<>();
|
||||
|
||||
public void registerApp(App app) {
|
||||
this.apps.add(app);
|
||||
|
||||
this.apps.sort(Comparator.comparing(App::getIndex));
|
||||
}
|
||||
|
||||
public List<App> getAll() {
|
||||
return Collections.unmodifiableList(this.apps);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user