-
Notifications
You must be signed in to change notification settings - Fork 614
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #31746 from vespa-engine/jonmv/provide-filter-on-d…
…ata-plane-filters Jonmv/provide filter on data plane filters
- Loading branch information
Showing
12 changed files
with
181 additions
and
90 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
42 changes: 42 additions & 0 deletions
42
container-core/src/main/java/com/yahoo/component/chain/model/Chainable.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
package com.yahoo.component.chain.model; | ||
|
||
import com.yahoo.component.chain.dependencies.After; | ||
import com.yahoo.component.chain.dependencies.Before; | ||
import com.yahoo.component.chain.dependencies.Dependencies; | ||
import com.yahoo.component.chain.dependencies.Provides; | ||
|
||
import java.lang.annotation.Annotation; | ||
import java.util.LinkedHashSet; | ||
import java.util.List; | ||
import java.util.Set; | ||
|
||
/** | ||
* Components which can be chained together, and where dependency information is provided through annotations. | ||
* | ||
* @author jonmv | ||
*/ | ||
public interface Chainable { | ||
|
||
default Dependencies getAnnotatedDependencies() { | ||
Set<String> provides = new LinkedHashSet<>(); | ||
Set<String> before = new LinkedHashSet<>(); | ||
Set<String> after = new LinkedHashSet<>(); | ||
|
||
for (Annotation annotation : getClass().getAnnotations()) { | ||
if (annotation instanceof Provides p) provides.addAll(List.of(p.value())); | ||
if (annotation instanceof com.yahoo.yolean.chain.Provides p) provides.addAll(List.of(p.value())); | ||
|
||
if (annotation instanceof Before b) before.addAll(List.of(b.value())); | ||
if (annotation instanceof com.yahoo.yolean.chain.Before b) before.addAll(List.of(b.value())); | ||
|
||
if (annotation instanceof After a) after.addAll(List.of(a.value())); | ||
if (annotation instanceof com.yahoo.yolean.chain.After a) after.addAll(List.of(a.value())); | ||
} | ||
|
||
provides.add(getClass().getSimpleName()); | ||
provides.add(getClass().getName()); | ||
|
||
return new Dependencies(provides, before, after); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 3 additions & 1 deletion
4
container-core/src/main/java/com/yahoo/jdisc/http/filter/RequestFilterBase.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,11 @@ | ||
// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. | ||
package com.yahoo.jdisc.http.filter; | ||
|
||
import com.yahoo.component.chain.model.Chainable; | ||
|
||
/** | ||
* @author gjoranv | ||
* @since 2.4 | ||
*/ | ||
public interface RequestFilterBase { | ||
public interface RequestFilterBase extends Chainable { | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,7 +6,7 @@ | |
import com.yahoo.jdisc.SharedResource; | ||
|
||
/** | ||
* @author <a href="mailto:[email protected]">Einar M R Rosenvinge</a> | ||
* @author Einar M R Rosenvinge | ||
*/ | ||
public interface ResponseFilter extends SharedResource, ResponseFilterBase { | ||
|
||
|
4 changes: 3 additions & 1 deletion
4
container-core/src/main/java/com/yahoo/jdisc/http/filter/ResponseFilterBase.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,11 @@ | ||
// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. | ||
package com.yahoo.jdisc.http.filter; | ||
|
||
import com.yahoo.component.chain.model.Chainable; | ||
|
||
/** | ||
* @author gjoranv | ||
* @since 2.4 | ||
*/ | ||
public interface ResponseFilterBase { | ||
public interface ResponseFilterBase extends Chainable { | ||
} |
3 changes: 2 additions & 1 deletion
3
container-core/src/main/java/com/yahoo/jdisc/http/filter/SecurityRequestFilter.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 3 additions & 1 deletion
4
container-core/src/main/java/com/yahoo/jdisc/http/filter/SecurityResponseFilter.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.