Skip to content

Commit

Permalink
updates 3
Browse files Browse the repository at this point in the history
Signed-off-by: liran2000 <[email protected]>
  • Loading branch information
liran2000 committed Oct 21, 2024
1 parent 651bcce commit dbf0c5c
Show file tree
Hide file tree
Showing 2 changed files with 125 additions and 125 deletions.
226 changes: 113 additions & 113 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -27,17 +27,17 @@
</licenses>

<modules>
<!-- <module>hooks/open-telemetry</module>-->
<!-- <module>tools/junit-openfeature</module>-->
<!-- <module>providers/flagd</module>-->
<!-- <module>providers/flagsmith</module>-->
<!-- <module>providers/go-feature-flag</module>-->
<!-- <module>providers/jsonlogic-eval-provider</module>-->
<!-- <module>providers/env-var</module>-->
<!-- <module>providers/unleash</module>-->
<!-- <module>providers/flipt</module>-->
<!-- <module>providers/configcat</module>-->
<!-- <module>providers/statsig</module>-->
<module>hooks/open-telemetry</module>
<module>tools/junit-openfeature</module>
<module>providers/flagd</module>
<module>providers/flagsmith</module>
<module>providers/go-feature-flag</module>
<module>providers/jsonlogic-eval-provider</module>
<module>providers/env-var</module>
<module>providers/unleash</module>
<module>providers/flipt</module>
<module>providers/configcat</module>
<module>providers/statsig</module>
<module>providers/multiprovider</module>
</modules>

Expand All @@ -54,7 +54,7 @@
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<module-name>${groupId}.${artifactId}</module-name>
<javadoc.failOnWarnings>false</javadoc.failOnWarnings>
<javadoc.failOnWarnings>true</javadoc.failOnWarnings>
<!-- This is required for later correct replacement of surefireArgLine -->
<!-- see surefire-java8 and surefire-java9+ profiles -->
<surefireArgLine/>
Expand Down Expand Up @@ -229,85 +229,85 @@
<version>3.13.0</version>
</plugin>

<!-- <plugin>-->
<!-- <groupId>org.apache.maven.plugins</groupId>-->
<!-- <artifactId>maven-checkstyle-plugin</artifactId>-->
<!-- <version>3.5.0</version>-->
<!-- <configuration>-->
<!-- <configLocation>checkstyle.xml</configLocation>-->
<!-- <encoding>UTF-8</encoding>-->
<!-- <consoleOutput>true</consoleOutput>-->
<!-- <failsOnError>true</failsOnError>-->
<!-- <linkXRef>false</linkXRef>-->
<!-- </configuration>-->
<!-- <dependencies>-->
<!-- <dependency>-->
<!-- <groupId>com.puppycrawl.tools</groupId>-->
<!-- <artifactId>checkstyle</artifactId>-->
<!-- <version>8.45.1</version>-->
<!-- </dependency>-->
<!-- </dependencies>-->
<!-- <executions>-->
<!-- <execution>-->
<!-- <id>validate</id>-->
<!-- <phase>verify</phase>-->
<!-- <goals>-->
<!-- <goal>check</goal>-->
<!-- </goals>-->
<!-- </execution>-->
<!-- </executions>-->
<!-- </plugin>-->

<!-- <plugin>-->
<!-- <groupId>org.apache.maven.plugins</groupId>-->
<!-- <artifactId>maven-pmd-plugin</artifactId>-->
<!-- <version>3.25.0</version>-->
<!-- <configuration>-->
<!-- <excludeRoots>${basedir}/target/generated-sources/</excludeRoots>-->
<!-- </configuration>-->
<!-- <executions>-->
<!-- <execution>-->
<!-- <id>run-pmd</id>-->
<!-- <phase>verify</phase>-->
<!-- <goals>-->
<!-- <goal>check</goal>-->
<!-- </goals>-->
<!-- </execution>-->
<!-- </executions>-->
<!-- </plugin>-->

<!-- <plugin>-->
<!-- <groupId>com.github.spotbugs</groupId>-->
<!-- <artifactId>spotbugs-maven-plugin</artifactId>-->
<!-- <version>4.8.6.4</version>-->
<!-- <configuration>-->
<!-- <excludeFilterFile>spotbugs-exclusions.xml</excludeFilterFile>-->
<!-- <plugins>-->
<!-- <plugin>-->
<!-- <groupId>com.h3xstream.findsecbugs</groupId>-->
<!-- <artifactId>findsecbugs-plugin</artifactId>-->
<!-- <version>1.13.0</version>-->
<!-- </plugin>-->
<!-- </plugins>-->
<!-- </configuration>-->
<!-- <dependencies>-->
<!-- &lt;!&ndash; overwrite dependency on spotbugs if you want to specify the version of spotbugs &ndash;&gt;-->
<!-- <dependency>-->
<!-- <groupId>com.github.spotbugs</groupId>-->
<!-- <artifactId>spotbugs</artifactId>-->
<!-- <version>4.8.6</version>-->
<!-- </dependency>-->
<!-- </dependencies>-->
<!-- <executions>-->
<!-- <execution>-->
<!-- <id>run-spotbugs</id>-->
<!-- <phase>verify</phase>-->
<!-- <goals>-->
<!-- <goal>check</goal>-->
<!-- </goals>-->
<!-- </execution>-->
<!-- </executions>-->
<!-- </plugin>-->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-checkstyle-plugin</artifactId>
<version>3.5.0</version>
<configuration>
<configLocation>checkstyle.xml</configLocation>
<encoding>UTF-8</encoding>
<consoleOutput>true</consoleOutput>
<failsOnError>true</failsOnError>
<linkXRef>false</linkXRef>
</configuration>
<dependencies>
<dependency>
<groupId>com.puppycrawl.tools</groupId>
<artifactId>checkstyle</artifactId>
<version>8.45.1</version>
</dependency>
</dependencies>
<executions>
<execution>
<id>validate</id>
<phase>verify</phase>
<goals>
<goal>check</goal>
</goals>
</execution>
</executions>
</plugin>

<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-pmd-plugin</artifactId>
<version>3.25.0</version>
<configuration>
<excludeRoots>${basedir}/target/generated-sources/</excludeRoots>
</configuration>
<executions>
<execution>
<id>run-pmd</id>
<phase>verify</phase>
<goals>
<goal>check</goal>
</goals>
</execution>
</executions>
</plugin>

<plugin>
<groupId>com.github.spotbugs</groupId>
<artifactId>spotbugs-maven-plugin</artifactId>
<version>4.8.6.4</version>
<configuration>
<excludeFilterFile>spotbugs-exclusions.xml</excludeFilterFile>
<plugins>
<plugin>
<groupId>com.h3xstream.findsecbugs</groupId>
<artifactId>findsecbugs-plugin</artifactId>
<version>1.13.0</version>
</plugin>
</plugins>
</configuration>
<dependencies>
<!-- overwrite dependency on spotbugs if you want to specify the version of spotbugs -->
<dependency>
<groupId>com.github.spotbugs</groupId>
<artifactId>spotbugs</artifactId>
<version>4.8.6</version>
</dependency>
</dependencies>
<executions>
<execution>
<id>run-spotbugs</id>
<phase>verify</phase>
<goals>
<goal>check</goal>
</goals>
</execution>
</executions>
</plugin>

<!-- automatically derive a module name from the groupId and artifactId -->
<plugin>
Expand Down Expand Up @@ -357,28 +357,28 @@
</execution>
</executions>
</plugin>
<!-- <plugin>-->
<!-- <groupId>org.apache.maven.plugins</groupId>-->
<!-- <artifactId>maven-javadoc-plugin</artifactId>-->
<!-- <version>3.10.0</version>-->
<!-- <configuration>-->
<!-- <failOnWarnings>${javadoc.failOnWarnings}</failOnWarnings>-->
<!-- <sourceFileExcludes>-->
<!-- <sourceFileExclude>**/GoFeatureFlagProviderOptions.java</sourceFileExclude>-->
<!-- </sourceFileExcludes>-->
<!-- <excludePackageNames>dev.openfeature.flagd.grpc,dev.openfeature.contrib.providers.gofeatureflag.exception,dev.openfeature.contrib.providers.gofeatureflag.bean</excludePackageNames>-->
<!-- <doclint>all,-missing</doclint> &lt;!&ndash; ignore missing javadoc, these are enforced with more customizability in the checkstyle plugin &ndash;&gt;-->
<!-- </configuration>-->
<!-- <executions>-->
<!-- <execution>-->
<!-- <id>attach-javadocs</id>-->
<!-- <phase>verify</phase>-->
<!-- <goals>-->
<!-- <goal>jar</goal>-->
<!-- </goals>-->
<!-- </execution>-->
<!-- </executions>-->
<!-- </plugin>-->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>3.10.0</version>
<configuration>
<failOnWarnings>${javadoc.failOnWarnings}</failOnWarnings>
<sourceFileExcludes>
<sourceFileExclude>**/GoFeatureFlagProviderOptions.java</sourceFileExclude>
</sourceFileExcludes>
<excludePackageNames>dev.openfeature.flagd.grpc,dev.openfeature.contrib.providers.gofeatureflag.exception,dev.openfeature.contrib.providers.gofeatureflag.bean</excludePackageNames>
<doclint>all,-missing</doclint> <!-- ignore missing javadoc, these are enforced with more customizability in the checkstyle plugin -->
</configuration>
<executions>
<execution>
<id>attach-javadocs</id>
<phase>verify</phase>
<goals>
<goal>jar</goal>
</goals>
</execution>
</executions>
</plugin>
<!-- end source & javadoc -->

<!-- SBOM generation -->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public class MultiProvider extends EventProvider {
@Getter
private static final String NAME = "multiprovider";
private final Map<String, FeatureProvider> providers;
private final Strategy strategy;
private Strategy strategy;
private String metadataName;

/**
Expand All @@ -43,24 +43,16 @@ public MultiProvider(List<FeatureProvider> providers) {
*/
public MultiProvider(List<FeatureProvider> providers, Strategy strategy) {
this.providers = new LinkedHashMap<>(providers.size());
JSONObject json = new JSONObject();
json.put("name", NAME);
JSONObject providersMetadata = new JSONObject();
json.put("originalMetadata", providersMetadata);
for (FeatureProvider provider: providers) {
FeatureProvider prevProvider = this.providers.put(provider.getMetadata().getName(), provider);
if (prevProvider != null) {
log.warn("duplicated provider name: {}", provider.getMetadata().getName());
}
JSONObject providerMetadata = new JSONObject();
providerMetadata.put("name", provider.getMetadata().getName());
providersMetadata.put(provider.getMetadata().getName(), providerMetadata);
}
metadataName = json.toString();
if (strategy == null) {
this.strategy = new FirstMatchStrategy(this.providers);
} else {
if (strategy != null) {
this.strategy = strategy;
} else {
this.strategy = new FirstMatchStrategy(this.providers);
}
}

Expand All @@ -71,9 +63,17 @@ public MultiProvider(List<FeatureProvider> providers, Strategy strategy) {
*/
@Override
public void initialize(EvaluationContext evaluationContext) throws Exception {
JSONObject json = new JSONObject();
json.put("name", NAME);
JSONObject providersMetadata = new JSONObject();
json.put("originalMetadata", providersMetadata);
for (FeatureProvider provider: providers.values()) {
provider.initialize(evaluationContext);
JSONObject providerMetadata = new JSONObject();
providerMetadata.put("name", provider.getMetadata().getName());
providersMetadata.put(provider.getMetadata().getName(), providerMetadata);
}
metadataName = json.toString();
}

@Override
Expand Down

0 comments on commit dbf0c5c

Please sign in to comment.