diff options
Diffstat (limited to 'openecomp-be/lib/openecomp-common-lib/src/main/java')
2 files changed, 42 insertions, 0 deletions
diff --git a/openecomp-be/lib/openecomp-common-lib/src/main/java/org/openecomp/sdc/common/togglz/ToggleableFeature.java b/openecomp-be/lib/openecomp-common-lib/src/main/java/org/openecomp/sdc/common/togglz/ToggleableFeature.java new file mode 100644 index 0000000000..aab9845573 --- /dev/null +++ b/openecomp-be/lib/openecomp-common-lib/src/main/java/org/openecomp/sdc/common/togglz/ToggleableFeature.java @@ -0,0 +1,15 @@ +package org.openecomp.sdc.common.togglz; + +import org.togglz.core.Feature; +import org.togglz.core.annotation.Label; +import org.togglz.core.context.FeatureContext; + +public enum ToggleableFeature implements Feature { + + @Label ("Forwarder Capability") + FORWARDER_CAPABILITY; + + public boolean isActive() { + return FeatureContext.getFeatureManager().isActive(this); + } +} diff --git a/openecomp-be/lib/openecomp-common-lib/src/main/java/org/openecomp/sdc/common/togglz/TogglzConfiguration.java b/openecomp-be/lib/openecomp-common-lib/src/main/java/org/openecomp/sdc/common/togglz/TogglzConfiguration.java new file mode 100644 index 0000000000..d743205e5b --- /dev/null +++ b/openecomp-be/lib/openecomp-common-lib/src/main/java/org/openecomp/sdc/common/togglz/TogglzConfiguration.java @@ -0,0 +1,27 @@ +package org.openecomp.sdc.common.togglz; + +import org.togglz.core.Feature; +import org.togglz.core.manager.TogglzConfig; +import org.togglz.core.repository.StateRepository; +import org.togglz.core.repository.file.FileBasedStateRepository; +import org.togglz.core.user.SimpleFeatureUser; +import org.togglz.core.user.UserProvider; + +import java.io.File; + +public class TogglzConfiguration implements TogglzConfig { + @Override + public Class<? extends Feature> getFeatureClass() { + return ToggleableFeature.class; + } + + @Override + public StateRepository getStateRepository() { + return new FileBasedStateRepository(new File("/tmp/features.properties")); + } + + @Override + public UserProvider getUserProvider() { + return () -> new SimpleFeatureUser("admin", true); + } +} |