[forge-issues] [JBoss JIRA] (FORGE-226) Support for Facets construct on Resources

Ken Finnigan (JIRA) jira-events at lists.jboss.org
Tue Nov 20 15:50:21 EST 2012


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

Ken Finnigan commented on FORGE-226:
------------------------------------

Discussion on irc:

(03:38:13 PM) lincolnthree: imagine you have a PomXmlResource (there is such a thing in Forge 1)
(03:38:16 PM) lincolnthree: you could say:
(03:38:31 PM) lincolnthree: pomResource.getFacet(ProfilesFacet.class)
(03:38:53 PM) lincolnthree: So in a sense, a project would just be a Resource!
(03:39:32 PM) kenfinnigan: so if I understand it..
(03:39:34 PM) lincolnthree: webXmlResource.getFacet(ServletsFacet.class)
(03:39:46 PM) kenfinnigan: JavaSourceResource.getFacet(EJBFacet.class).isBeanType(Type.MESSAGE_DRIVEN_BEAN)
(03:39:55 PM) lincolnthree: webXmlResource.hasFacet(ContextParamsFacet.class)
(03:39:56 PM) kenfinnigan: would return an EJB that was an MDB?
(03:40:01 PM) lincolnthree: right
(03:40:05 PM) kenfinnigan: ie the java source of the class that is
(03:40:10 PM) lincolnthree: well
(03:40:17 PM) lincolnthree: based on what you've written, i'd expect it to return a boolean
(03:40:18 PM) lincolnthree: but
(03:40:19 PM) lincolnthree: yes
(03:40:42 PM) lincolnthree: javaResource.hasFacet(ArquillianFacet.class)
(03:40:44 PM) lincolnthree: etc
(03:41:22 PM) kenfinnigan: ok, I was reading JavaSourceResource as a static, but from what you're saying in that example it would actually be an instance
(03:41:26 PM) kenfinnigan: correct?
(03:41:44 PM) kenfinnigan: so asking that java source instance if it's an MDB
(03:41:47 PM) lincolnthree: javaResource.getFacet(TransactionInterceptorFacet.class).getPropagationType();
(03:41:56 PM) lincolnthree: it would be an instance
(03:41:57 PM) lincolnthree: yes
(03:42:04 PM) kenfinnigan: ok
(03:42:21 PM) lincolnthree: so the facet would be able to inspect/install/remove certain pieces of information from java code in this case
(03:42:30 PM) lincolnthree: in a very granular/controlled manner
(03:42:55 PM) kenfinnigan: hmm, so where would that control lie, in the Facet or Resource, or bit of both?
(03:44:42 PM) lincolnthree: the resource would have no knowledge of the facets contained within
(03:44:54 PM) lincolnthree: facets would be responsible for inspecting the resource and determining their own installation sate
(03:44:56 PM) lincolnthree: state
(03:44:59 PM) lincolnthree: just like Project facets
(03:45:07 PM) aslak: kenfinnigan, what am i saying? :)
(03:45:24 PM) kenfinnigan: ok, so Resource just needs to provide the means that Facet can do the kinds of things aslak wants?
(03:45:29 PM) kenfinnigan: aslak: FORGE-226
(03:45:30 PM) jbossbot: jira [FORGE-226] Support for Facets construct on Resources [Open (Unresolved) Feature Request, Major, Unassigned] https://issues.jboss.org/browse/FORGE-226
(03:45:39 PM) lincolnthree: resource needs to provide a generic Facet API
(03:45:47 PM) lincolnthree: like the Project class in forge 1.x does
(03:45:47 PM) kenfinnigan: lincolnthree: ok
(03:46:18 PM) lincolnthree: https://github.com/forge/core/blob/master/shell-api/src/main/java/org/jboss/forge/project/Project.java
(03:46:31 PM) lincolnthree: something like that
(03:46:39 PM) aslak: kenfinnigan, aa.. the basic idea is.. you have Facets on a Project (capabilities for a given project), the similar thing you would have on Resource level
(03:47:15 PM) aslak: new XMLResource("arquillian.xml").getFacet(ArquillianFacet.class).addContainer()
(03:47:51 PM) kenfinnigan: aslak: ok, so then the ArquillianFacet "knows" the correct XML to add back to the resource for addContainer()?
(03:48:00 PM) aslak: yes
(03:48:30 PM) kenfinnigan: ok, so Facets do all the work of modifying Resource, but Resource needs to know what kind of Facet it can deal with
(03:48:33 PM) aslak: you need a 'supports(Facet)" or similar in ther ea swell
(03:48:47 PM) aslak: it's basically a way to share code on resource level instead of just project level
(03:48:59 PM) lincolnthree: yea
(03:48:59 PM) kenfinnigan: ok, think that makes sense
(03:49:18 PM) aslak: the EJB addon should know 'stuff' about a Class to determine if it's a EJB.. possible add EJB related annotations
                
> Support for Facets construct on Resources
> -----------------------------------------
>
>                 Key: FORGE-226
>                 URL: https://issues.jboss.org/browse/FORGE-226
>             Project: Forge
>          Issue Type: Feature Request
>            Reporter: Aslak Knutsen
>             Fix For: 2.0.0.Alpha1
>
>
> It would be handy to have Facets support for Resources so logic on recognizing/handling common resource related operations in one place. 
> e.g. 
> {code}
> JavaSourceResource.getFacet(EJBFacet.class)
>    .isBeanType(Type.MESSAGE_DRIVEN_BEAN)
> JavaSourceResource.getFacet(ArquillianFacet.class)
>    .addToDeployment(Class)
>    .getDeployments()
> {code}

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira


More information about the forge-issues mailing list