[jboss-jira] [JBoss JIRA] (WFCORE-1160) Definition of capabilities where the service return type is generic.

Brian Stansberry (JIRA) issues at jboss.org
Tue Nov 24 17:03:00 EST 2015


    [ https://issues.jboss.org/browse/WFCORE-1160?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13133534#comment-13133534 ] 

Brian Stansberry commented on WFCORE-1160:
------------------------------------------

[~dlofthouse] Is this not a use case for OperationContext.getCapabilityRuntimeApi() ?

{code}
public interace TheRuntimeAPI {
    /** Gets the ServiceName for a Service whose value type is SecurityFacotry<T> where 
      *  T is {@code outputType
      * @throw IllegalStateException if this capability does not support {@code outputType}
      */
    ServiceName getSecurityFactoryServiceName(Class<?> outputType);
}
{code}

When a RuntimeCapability is created and when a requiring capability uses the OperationContext, we don't have actual instances of SecurityFactory<T> to work with. (This isn't a case of casting.) All we have is instances of Class. Now we can try and come up with other parameters to add to RuntimeCapability.Builder and OperationContext.getCapabilityServiceName to try and do some other type of checking, but the capability author and the the requiror are going to have to have a mutual understanding of the relevant parameters. Which sounds like TheRuntimeAPI above.

Maybe as a convenience the kernel can make it easy to check SecurityFactory<T>, but what if what's wanted is SecurityFactory<T, U>?

> Definition of capabilities where the service return type is generic.
> --------------------------------------------------------------------
>
>                 Key: WFCORE-1160
>                 URL: https://issues.jboss.org/browse/WFCORE-1160
>             Project: WildFly Core
>          Issue Type: Enhancement
>          Components: Domain Management
>            Reporter: Darran Lofthouse
>            Assignee: Brian Stansberry
>              Labels: affects_elytron
>
> Within Elytron we have the following interface: -
> {code}
> public interface SecurityFactory<T> {}
> {code}
> It is desirable to define capabilities where the generic type is specified so that as we wire together the various services we can be sure the correct SecurityFactory services are injected in the correct locations.
> As it stands our only option is going to be a runtime check so incorrectly wired SecurityFactory references will only occur late.



--
This message was sent by Atlassian JIRA
(v6.4.11#64026)


More information about the jboss-jira mailing list