Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Merge branch 'develop' into resolver-config
  • Loading branch information
jfallows committed Jan 23, 2024
commit f94b2b89d024d2e0d8d9a723de8381809ae02c37
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
public class EnvironmentResolverFactorySpi implements ResolverFactorySpi
{
@Override
public String name()
public String type()
{
return "env";
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,12 @@
*/
package io.aklivity.zilla.runtime.engine.resolver;

import static io.aklivity.zilla.runtime.common.feature.FeatureFilter.filter;
import static java.util.Collections.unmodifiableMap;
import static java.util.Objects.requireNonNull;
import static java.util.ServiceLoader.load;

import java.util.HashMap;
import java.util.Map;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
Expand All @@ -35,7 +38,7 @@ public final class Resolver
public static Resolver instantiate(
Configuration config)
{
return instantiate(config, load(ResolverFactorySpi.class));
return instantiate(config, filter(load(ResolverFactorySpi.class)));
}

public String resolve(
Expand All @@ -56,10 +59,10 @@ private String resolve(

private static Resolver instantiate(

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since there is only one call to this method can we consolidate

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, but I'm keeping the pattern consistent in case we can reuse the FactorySpi later.

Configuration config,
ServiceLoader<ResolverFactorySpi> factories)
Iterable<ResolverFactorySpi> factories)
{
Map<String, ResolverSpi> resolversByName = new HashMap<>();
factories.forEach(f -> resolversByName.put(f.name(), f.create(config)));
factories.forEach(f -> resolversByName.put(f.type(), f.create(config)));
return new Resolver(unmodifiableMap(resolversByName));
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,10 @@
package io.aklivity.zilla.runtime.engine.resolver;

import io.aklivity.zilla.runtime.engine.Configuration;
import io.aklivity.zilla.runtime.engine.factory.FactorySpi;

public interface ResolverFactorySpi
public interface ResolverFactorySpi extends FactorySpi
{
String name();

ResolverSpi create(
Configuration config);
}
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
public class TestResolverFactorySpi implements ResolverFactorySpi
{
@Override
public String name()
public String type()
{
return "test";
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@

public class TestResolverSpi implements ResolverSpi
{
@Override
public String resolve(
String var)
{
Expand Down
You are viewing a condensed version of this merge commit. You can view the full changes here.