[ 
https://issues.apache.org/jira/browse/GERONIMO-556?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12798676#action_12798676
 ] 

Peter H commented on GERONIMO-556:
----------------------------------

Actually it would be great if also gbean-ref in geronimo-web.xml etc would be 
able to match to resource-ref in web.xml etc.

Have the following example with Work Manager and the explanation below:

web.xml entry

<resource-ref>
  <res-ref-name>commonj/SomeWorkManager</res-ref-name>
  <res-type>commonj.work.WorkManager</res-type>
  <res-auth>Container</res-auth>
</resource-ref>


geronimo-web.xml entry:

<gbean-ref>
  <ref-name>commonj/SomeWorkManager</nam:ref-name>
  <ref-type>javax.resource.spi.work.WorkManager</nam:ref-type>
  <pattern>
    <name>SomeWorkManager</nam:name>
  </pattern>
</gbean-ref>


Then have the application externally configurable regarding the current 
implementation of WorkManager to be used
- on WAS/WLS set it to commonj - everything's fine
- on JBossAs (which can live invalid resource-ref entry so no problem with 
deploy) set it to JBoss JCA WorkManager implementation and use that - 
everything's fine except that the resource-ref isn't valid but as I wrote JBoss 
doesn't have much troubles with that
- on Geronimo (which is currently unable to deploy the same ear/war) set it to 
Geronimo's JCA WorkManager and uyse that - everything would be fine if. one of 
the following would be met:

1. gbean-ref in geronimo-web.xml would match the resource-ref in web.xml, 
overriding the ref-type from web.xml and pointing to the desired gbean, then we 
would lookup the mapped component and use it properly (by externally 
configuring application to use the JCA WorkManager instead of CommonJ)

2. the resource-ref in web.xml (which is incorrect on Geronimo) would be 
ignored completely, application would deploy with that, via gbean-ref in 
geronimo-web.xml we would make the desired gbean accessible via JNDI and by 
externally configuring the app to use JCA WorkManager we would access it

3. we would add a resource-ref to geronimo-web.xml pointing to a WorkManager 
explicitly exposed via JNDI (which is fortunately possible) and that would 
match the resource-ref in web.xml, overriding the ref-type again, with 
configuration setup for different case it should also work fine

4. the incorrect resource-ref in web.xml would be just ignored on Geronimo, we 
would expose the desired WorkManager via JNDI and access it directly via JNDI 
lookup without anything special in geronimo-web.xml


I think the first option would be the best, but others are also viable.

I'll leave this issue for couple of days and if there will be no activity I'll 
probably open a duplicate of this (this one is closed and I can't reopen it) 
with these proposals.

The whole thing about which all this is is to make an application deployable on 
various application servers without the need to modify the actual ear/war file.

> Optional resource refs
> ----------------------
>
>                 Key: GERONIMO-556
>                 URL: https://issues.apache.org/jira/browse/GERONIMO-556
>             Project: Geronimo
>          Issue Type: New Feature
>          Components: deployment
>            Reporter: David Jencks
>            Assignee: David Jencks
>             Fix For: Wish List
>
>
> Right now, all resource refs (and other jndi entries) specified in a spec-dd 
> must be resolved during deployment or building the configuration will fail.  
> It's possible that some resource refs are optional and that the app can 
> function to  some extent with them missing.
> We could support this by including an optional "optional" marker in the 
> geronimo plan. The simplest implementation would attempt to resolve the ref 
> to an object name present during deployment, and use it if the name is found, 
> and bind nothing if the name is not found.  Then the app would get a naming 
> exception at runtime if it tried to look up the missing resource.
> We should decide what should happen when the entire target object name is 
> supplied.  We could use it to bind a reference, or only bind a reference if 
> the gbean is present at deploy-time.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to