Class CdiAgentCardRouter
java.lang.Object
org.a2aproject.sdk.extras.multitenancy.CdiAgentCardRouter
- All Implemented Interfaces:
AgentCardRouter
CDI-based
AgentCardRouter that resolves tenant-specific AgentCard beans.
Extended cards are resolved via @Tenant("x") @ExtendedAgentCard-qualified beans.
Tenant-specific public cards are resolved by matching beans that carry the
@Tenant("x") qualifier and either:
- carry
@PublicAgentCard(preferred — these cards are resolved before bare tenant cards, even if they also carry@ExtendedAgentCard), or - carry neither
@ExtendedAgentCardnor@PublicAgentCard(bare tenant card).
@Tenant("x") @PublicAgentCard on a tenant-specific bean is safe because
both the router's default-card lookup and the transport handler injection points use
CdiUtils.resolveDefault(Instance) to exclude
@Tenant-qualified beans when resolving the default card.
Returns the default public card from resolvePublicCard(String) when the tenant is
null or blank. Returns null when a non-blank tenant does not match
any registered tenant — the caller treats that as a 404.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription@Nullable AgentCardresolveExtendedCard(@Nullable String tenant) Resolves the extendedAgentCardfor the given tenant.@Nullable AgentCardresolvePublicCard(@Nullable String tenant) Resolves the publicAgentCardfor the given tenant.
-
Constructor Details
-
CdiAgentCardRouter
public CdiAgentCardRouter()
-
-
Method Details
-
resolveExtendedCard
Description copied from interface:AgentCardRouterResolves the extendedAgentCardfor the given tenant.- Specified by:
resolveExtendedCardin interfaceAgentCardRouter- Parameters:
tenant- the tenant identifier, may benull- Returns:
- the resolved extended agent card, or
nullif none is configured
-
resolvePublicCard
Description copied from interface:AgentCardRouterResolves the publicAgentCardfor the given tenant.Implementations should return the default public card when
tenantisnullor blank, the tenant-specific card when a match is found, andnullwhen a non-blank tenant has no matching card — the caller treats that as HTTP 404.The default implementation returns
null(no public-card routing configured).- Specified by:
resolvePublicCardin interfaceAgentCardRouter- Parameters:
tenant- the tenant identifier, may benull- Returns:
- the public agent card, or
nullif a non-blank tenant is unknown
-