24 lines
563 B
Java
24 lines
563 B
Java
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);
|
|
}
|
|
}
|