[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;
|
package li.strolch.agent.api;
|
||||||
|
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
import li.strolch.agent.impl.DataStoreMode;
|
import li.strolch.agent.impl.DataStoreMode;
|
||||||
import li.strolch.agent.impl.StrolchRealm;
|
import li.strolch.agent.impl.StrolchRealm;
|
||||||
|
|
||||||
|
@ -33,7 +35,10 @@ public interface ComponentContainer {
|
||||||
|
|
||||||
public abstract <T> T getComponent(Class<T> clazz);
|
public abstract <T> T getComponent(Class<T> clazz);
|
||||||
|
|
||||||
|
public abstract Set<String> getRealmNames();
|
||||||
|
|
||||||
public abstract StrolchRealm getDefaultRealm();
|
public abstract StrolchRealm getDefaultRealm();
|
||||||
|
|
||||||
public abstract StrolchRealm getRealm(String realm);
|
public abstract StrolchRealm getRealm(String realm);
|
||||||
|
|
||||||
}
|
}
|
|
@ -15,6 +15,8 @@
|
||||||
*/
|
*/
|
||||||
package li.strolch.agent.api;
|
package li.strolch.agent.api;
|
||||||
|
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
import li.strolch.agent.impl.StrolchRealm;
|
import li.strolch.agent.impl.StrolchRealm;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -22,8 +24,9 @@ import li.strolch.agent.impl.StrolchRealm;
|
||||||
*/
|
*/
|
||||||
public interface ElementMapHandler {
|
public interface ElementMapHandler {
|
||||||
|
|
||||||
|
public Set<String> getRealmNames();
|
||||||
|
|
||||||
public StrolchRealm getDefaultRealm();
|
public StrolchRealm getDefaultRealm();
|
||||||
|
|
||||||
public StrolchRealm getRealm(String realm);
|
public StrolchRealm getRealm(String realm);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,7 +16,9 @@
|
||||||
package li.strolch.agent.impl;
|
package li.strolch.agent.impl;
|
||||||
|
|
||||||
import java.text.MessageFormat;
|
import java.text.MessageFormat;
|
||||||
|
import java.util.HashSet;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
import li.strolch.agent.api.ElementMapHandler;
|
import li.strolch.agent.api.ElementMapHandler;
|
||||||
import li.strolch.agent.api.StrolchComponent;
|
import li.strolch.agent.api.StrolchComponent;
|
||||||
|
@ -38,6 +40,11 @@ public abstract class AbstractElementMapHandler extends StrolchComponent impleme
|
||||||
super(container, componentName);
|
super(container, componentName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Set<String> getRealmNames() {
|
||||||
|
return new HashSet<>(realms.keySet());
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public StrolchRealm getDefaultRealm() {
|
public StrolchRealm getDefaultRealm() {
|
||||||
return getRealm(StrolchConstants.DEFAULT_REALM);
|
return getRealm(StrolchConstants.DEFAULT_REALM);
|
||||||
|
|
|
@ -85,6 +85,11 @@ public class ComponentContainerImpl implements ComponentContainer {
|
||||||
return component;
|
return component;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Set<String> getRealmNames() {
|
||||||
|
return getComponent(ElementMapHandler.class).getRealmNames();
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public StrolchRealm getDefaultRealm() {
|
public StrolchRealm getDefaultRealm() {
|
||||||
return getRealm(StrolchConstants.DEFAULT_REALM);
|
return getRealm(StrolchConstants.DEFAULT_REALM);
|
||||||
|
|
Loading…
Reference in New Issue