1. Project Clover database Mon Dec 22 2025 14:59:38 CST
  2. Package org.europa.together.business

File FeatureFlags.java

 

Code metrics

0
0
0
1
119
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.<br>
46    * - jdbc.driverClassName<br>
47    * - jdbc.url<br>
48    * - jdbc.user<br>
49    * - jdbc.password
50    *
51    * @param propertyFile as String
52    * @return feature store as FF4j
53    * @throws java.io.IOException case of error
54    * @throws java.net.ConnectException case of error
55    * @throws org.europa.together.exceptions.MisconfigurationException case of
56    * error
57    */
58    FF4j getFeatureStore(String propertyFile)
59    throws IOException, ConnectException, MisconfigurationException;
60   
61    /**
62    * Check if a feature is enbaled or not.
63    *
64    * @param featureId as String
65    * @return check as boolean
66    */
67    boolean check(String featureId);
68   
69    /**
70    * Activate a feature in the feature store by given ID.
71    *
72    * @param featureId as String
73    */
74    void activateFeature(String featureId);
75   
76    /**
77    * Deactivate a feature in the feature store by given ID.
78    *
79    * @param featureId as String
80    */
81    void deactivateFeature(String featureId);
82   
83    /**
84    * Add a feature to the feature store.
85    *
86    *
87    * @param feature as Feature
88    */
89    void addFeature(Feature feature);
90   
91    /**
92    * Get the full feature by a given ID from the feature store.
93    *
94    * @param featureId as String
95    * @return feature as Feature
96    */
97    Feature getFeature(String featureId);
98   
99    /**
100    * Update an existing feature in the feature store.
101    *
102    * @param feature as Feature
103    */
104    void updateFeature(Feature feature);
105   
106    /**
107    * Remove an existing feature from the feature store.
108    *
109    * @param featureId as String
110    */
111    void removeFeature(String featureId);
112   
113    /**
114    * Grab all in the feature store existing features.
115    *
116    * @return Feature by its featureId as Map
117    */
118    Map<String, Feature> listAllFeatures();
119    }