[New] Added ComponentContainer.getRealmNames()
Now it is possible to iterate over the configured realms. This is used in the li.strolch.rest project to build an inspector of the agent
This commit is contained in:
parent
06c3c816da
commit
11fbf61cb3
|
@ -15,6 +15,8 @@
|
|||
*/
|
||||
package li.strolch.agent.api;
|
||||
|
||||
import java.util.Set;
|
||||
|
||||
import li.strolch.agent.impl.DataStoreMode;
|
||||
import li.strolch.agent.impl.StrolchRealm;
|
||||
|
||||
|
@ -26,14 +28,17 @@ public interface ComponentContainer {
|
|||
public abstract StrolchAgent getAgent();
|
||||
|
||||
public abstract ComponentState getState();
|
||||
|
||||
|
||||
public abstract DataStoreMode getDataStoreMode();
|
||||
|
||||
public abstract boolean hasComponent(Class<?> clazz);
|
||||
|
||||
public abstract <T> T getComponent(Class<T> clazz);
|
||||
|
||||
public abstract Set<String> getRealmNames();
|
||||
|
||||
public abstract StrolchRealm getDefaultRealm();
|
||||
|
||||
public abstract StrolchRealm getRealm(String realm);
|
||||
|
||||
}
|
|
@ -15,6 +15,8 @@
|
|||
*/
|
||||
package li.strolch.agent.api;
|
||||
|
||||
import java.util.Set;
|
||||
|
||||
import li.strolch.agent.impl.StrolchRealm;
|
||||
|
||||
/**
|
||||
|
@ -22,8 +24,9 @@ import li.strolch.agent.impl.StrolchRealm;
|
|||
*/
|
||||
public interface ElementMapHandler {
|
||||
|
||||
public Set<String> getRealmNames();
|
||||
|
||||
public StrolchRealm getDefaultRealm();
|
||||
|
||||
public StrolchRealm getRealm(String realm);
|
||||
|
||||
}
|
||||
|
|
|
@ -16,7 +16,9 @@
|
|||
package li.strolch.agent.impl;
|
||||
|
||||
import java.text.MessageFormat;
|
||||
import java.util.HashSet;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import li.strolch.agent.api.ElementMapHandler;
|
||||
import li.strolch.agent.api.StrolchComponent;
|
||||
|
@ -38,6 +40,11 @@ public abstract class AbstractElementMapHandler extends StrolchComponent impleme
|
|||
super(container, componentName);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Set<String> getRealmNames() {
|
||||
return new HashSet<>(realms.keySet());
|
||||
}
|
||||
|
||||
@Override
|
||||
public StrolchRealm getDefaultRealm() {
|
||||
return getRealm(StrolchConstants.DEFAULT_REALM);
|
||||
|
|
|
@ -85,6 +85,11 @@ public class ComponentContainerImpl implements ComponentContainer {
|
|||
return component;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Set<String> getRealmNames() {
|
||||
return getComponent(ElementMapHandler.class).getRealmNames();
|
||||
}
|
||||
|
||||
@Override
|
||||
public StrolchRealm getDefaultRealm() {
|
||||
return getRealm(StrolchConstants.DEFAULT_REALM);
|
||||
|
|
Loading…
Reference in New Issue