1. Project Clover database Wed Jan 17 2024 23:40:18 CST
  2. Package org.europa.together.business

File FeatureFlags.java

 

Code metrics

0
0
0
1
117
30
0
-
-
0
-

Classes

Class Line # Actions
FeatureFlags 23 0 - 0 0
-1.0 -
 

Contributing tests

No tests hitting this source file were found.

Source view

1    package org.europa.together.business;
2   
3    import java.io.IOException;
4    import java.net.ConnectException;
5    import java.util.Map;
6    import org.apiguardian.api.API;
7    import static org.apiguardian.api.API.Status.STABLE;
8    import org.europa.together.exceptions.MisconfigurationException;
9    import org.ff4j.FF4j;
10    import org.ff4j.core.Feature;
11    import org.springframework.stereotype.Component;
12   
13    /**
14    * Feature Flags is a wrapper for the FF4j library to enable toggels for
15    * activating and deactivating features.
16    *
17    * @author elmar.dott@gmail.com
18    * @version 1.0
19    * @since 1.0
20    */
21    @API(status = STABLE, since = "3.0", consumers = "FeatureFlagsFF4j")
22    @Component
 
23    public interface FeatureFlags {
24   
25    /**
26    * Identifier for the given feature.
27    */
28    @API(status = STABLE, since = "3.0")
29    String FEATURE_ID = "CM-13";
30   
31    /**
32    * Define the configuration set for FeatureFlags.
33    */
34    @API(status = STABLE, since = "3.0")
35    String CONFIG_SET = "features";
36   
37    /**
38    * Defines for which MODULE_VERSION the configuration will work.
39    */
40    @API(status = STABLE, since = "3.0")
41    String CONFIG_VERSION = "1.0";
42   
43    /**
44    * Connect an application to a feature store by a given database connection
45    * file.<li>jdbc.driverClassName</li>
46    * <li>jdbc.url</li>
47    * <li>jdbc.user</li>
48    * <li>jdbc.password</li>
49    *
50    * @param propertyFile as String
51    * @return feature store as FF4j
52    * @throws java.io.IOException
53    * @throws java.net.ConnectException
54    * @throws org.europa.together.exceptions.MisconfigurationException
55    */
56    FF4j getFeatureStore(String propertyFile)
57    throws IOException, ConnectException, MisconfigurationException;
58   
59    /**
60    * Check if a feature is enbaled or not.
61    *
62    * @param featureId as String
63    * @return check as boolean
64    */
65    boolean check(String featureId);
66   
67    /**
68    * Activate a feature in the feature store by given ID.
69    *
70    * @param featureId as String
71    */
72    void activateFeature(String featureId);
73   
74    /**
75    * Deactivate a feature in the feature store by given ID.
76    *
77    * @param featureId as String
78    */
79    void deactivateFeature(String featureId);
80   
81    /**
82    * Add a feature to the feature store.
83    *
84    *
85    * @param feature as Feature
86    */
87    void addFeature(Feature feature);
88   
89    /**
90    * Get the full feature by a given ID from the feature store.
91    *
92    * @param featureId as String
93    * @return feature as Feature
94    */
95    Feature getFeature(String featureId);
96   
97    /**
98    * Update an existing feature in the feature store.
99    *
100    * @param feature as Feature
101    */
102    void updateFeature(Feature feature);
103   
104    /**
105    * Remove an existing feature from the feature store.
106    *
107    * @param featureId
108    */
109    void removeFeature(String featureId);
110   
111    /**
112    * Grab all in the feature store existing features.
113    *
114    * @return Feature by its featureId as Map
115    */
116    Map<String, Feature> listAllFeatures();
117    }