diff options
author | talio <tali.orenbach@amdocs.com> | 2017-11-12 16:12:35 +0200 |
---|---|---|
committer | talio <tali.orenbach@amdocs.com> | 2017-11-13 10:03:55 +0200 |
commit | ce889adae3f91a8296bf41ce5804a51483242b2a (patch) | |
tree | a2fffe0fdbb03b8774c40df9ac9d72e6f145b8da /openecomp-be/lib/openecomp-common-lib | |
parent | dd1a401f81b7c90c340ab69288236763bad19e83 (diff) |
forwarder
implement toggling feature on forwarder
Issue-Id : SDC-653
Change-Id: I238ae82b6f1fd9fce58ab584acd362a6bafd0dff
Signed-off-by: talio <tali.orenbach@amdocs.com>
Diffstat (limited to 'openecomp-be/lib/openecomp-common-lib')
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); + } +} |