Basic implementation for files app
This commit is contained in:
@@ -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