the fellow who wrote it was writing code for at least 2 other projects
it may have been a case of where he accomplished 75% of what was needed then
some other task got moved to his front burner

still it is *unusual* that web.xml resource-ref is'nt read
Martin Gainty 
______________________________________________ 
Note de déni et de confidentialité
Ce message est confidentiel et peut être privilégié. Si vous n'êtes pas le 
destinataire prévu, nous te demandons avec bonté que pour satisfaire informez 
l'expéditeur. N'importe quelle diffusion non autorisée ou la copie de ceci est 
interdite. Ce message sert à l'information seulement et n'aura pas n'importe 
quel effet légalement obligatoire. Étant donné que les email peuvent facilement 
être sujets à la manipulation, nous ne pouvons accepter aucune responsabilité 
pour le contenu fourni.




> Date: Wed, 2 Sep 2009 01:11:41 +0200
> Subject: Re: Is resource-ref really needed?
> From: robert.wh...@gmail.com
> To: mgai...@hotmail.com; users@tomcat.apache.org
> 
> On Tue, Sep 1, 2009 at 5:07 AM, Martin Gainty<mgai...@hotmail.com> wrote:
> > both the entries <Context><Resource> and web.xml <resource-ref> reference
> > ContextResource
> >
> > //WebAnnotationSet.java
> >     protected static void addResource(Context context, Resource annotation)
> > {
> >
> > //if the annotation is
> > DataSource,ConnectionFactory,QueueConnectionFactory,TopicConnectionFactory,Session,URL
> > // then reference <Context><Resource> from applicationContext
> >          if
> > (annotation.type().getCanonicalName().equals("javax.sql.DataSource") ||
> >
> > annotation.type().getCanonicalName().equals("javax.jms.ConnectionFactory")
> > ||
> >                 annotation.type().getCanonicalName()
> >                 .equals("javax.jms.QueueConnectionFactory") ||
> >                 annotation.type().getCanonicalName()
> >                 .equals("javax.jms.TopicConnectionFactory") ||
> >
> > annotation.type().getCanonicalName().equals("javax.mail.Session") ||
> >                 annotation.type().getCanonicalName().equals("java.net.URL")
> > ||
> >                 annotation.type().getCanonicalName()
> >                 .equals("javax.resource.cci.ConnectionFactory") ||
> >
> > annotation.type().getCanonicalName().equals("org.omg.CORBA_2_3.ORB") ||
> >
> > annotation.type().getCanonicalName().endsWith("ConnectionFactory")) {
> >
> >             //Construct  <Context><Resource> from annotation input
> >             ContextResource resource = new ContextResource();
> >
> > /*The input annotation is used to populate the  <Context><Resource>
> > parameters */
> >
> >             resource.setName(annotation.name());
> >             resource.setType(annotation.type().getCanonicalName());
> >
> >             if (annotation.authenticationType()
> >                     == Resource.AuthenticationType.CONTAINER) {
> >                 resource.setAuth("Container");
> >             }
> >             else if (annotation.authenticationType()
> >                     == Resource.AuthenticationType.APPLICATION) {
> >                 resource.setAuth("Application");
> >             }
> >             resource.setScope(annotation.shareable() ? "Shareable" :
> > "Unshareable");
> >             resource.setProperty("mappedName", annotation.mappedName());
> >             resource.setDescription(annotation.description());
> >
> > //finally add it to ApplicationContext.xml here
> >             context.getNamingResources().addResource(resource);
> >
> > ///////////////////////////////web.xml
> > <resource-ref>///////////////////////////////////////////////////////////
> > web.xml <resource-ref> is created here on config init()
> > called in ContextConfiguration init()
> >     protected void init() {
> >         // Called from StandardContext.init()
> >
> >         if (webDigester == null){
> >             webDigester = createWebDigester();
> >             webDigester.getParser();
> >         }
> >
> >         if (contextDigester == null){
> >             contextDigester = createContextDigester();
> >             contextDigester.getParser();
> >         }
> >
> >         if (log.isDebugEnabled())
> >             log.debug(sm.getString("contextConfig.init"));
> >         context.setConfigured(false);
> >         ok = true;
> >
> >         contextConfig();
> >
> >         try {
> >             fixDocBase();
> >         } catch (IOException e) {
> >             log.error(sm.getString("contextConfig.fixDocBase"), e);
> >         }
> >
> >     }
> >
> > Digester.java calls CreateContextDigester
> >     /**
> >      * Create (if necessary) and return a Digester configured to process the
> >      * context configuration descriptor for an application.
> >      */
> >     protected Digester createContextDigester() {
> >         Digester digester = new Digester();
> >         digester.setValidating(false);
> >         RuleSet contextRuleSet = new ContextRuleSet("", false);
> >         digester.addRuleSet(contextRuleSet);
> >         RuleSet namingRuleSet = new NamingRuleSet("Context/");
> >         digester.addRuleSet(namingRuleSet);
> >         return digester;
> >     }
> >
> > called in Digester calls addRuleSet
> >     public void addRuleSet(RuleSet ruleSet) {
> >
> >         String oldNamespaceURI = getRuleNamespaceURI();
> >         String newNamespaceURI = ruleSet.getNamespaceURI();
> >         if (log.isDebugEnabled()) {
> >             if (newNamespaceURI == null) {
> >                 log.debug("addRuleSet() with no namespace URI");
> >             } else {
> >                 log.debug("addRuleSet() with namespace URI " +
> > newNamespaceURI);
> >             }
> >         }
> >         setRuleNamespaceURI(newNamespaceURI);
> >         ruleSet.addRuleInstances(this);
> >         setRuleNamespaceURI(oldNamespaceURI);
> >     }
> >
> > org.apache.catalina.startup.WebRuleSet.java
> >     public void addRuleInstances(Digester digester) {
> > ............
> >         digester.addObjectCreate(prefix + "web-app/resource-ref",
> >
> > "org.apache.catalina.deploy.ContextResource");
> >         digester.addRule(prefix + "web-app/resource-ref",
> >                 new SetNextNamingRule("addResource",
> >                             "org.apache.catalina.deploy.ContextResource"));
> >
> >         digester.addCallMethod(prefix + "web-app/resource-ref/description",
> >                                "setDescription", 0);
> >         digester.addCallMethod(prefix + "web-app/resource-ref/res-auth",
> >                                "setAuth", 0);
> >         digester.addCallMethod(prefix + "web-app/resource-ref/res-ref-name",
> >                                "setName", 0);
> >         digester.addCallMethod(prefix +
> > "web-app/resource-ref/res-sharing-scope",
> >                                "setScope", 0);
> >         digester.addCallMethod(prefix + "web-app/resource-ref/res-type",
> >                                "setType", 0);
> > ......
> >         }
> >
> > as far as I can see the web.xml <resource-ref> is never 'read'
> 
> That's a very good analysis! This is really interesting and remarkable
> that so many Tomcat developers always dutifully provided resource-ref
> (since the documentation and all examples basically said to use it),
> but as it appears the element is thus indeed ignored.
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
> For additional commands, e-mail: users-h...@tomcat.apache.org
> 

_________________________________________________________________
Get back to school stuff for them and cashback for you.
http://www.bing.com/cashback?form=MSHYCB&publ=WLHMTAG&crea=TEXT_MSHYCB_BackToSchool_Cashback_BTSCashback_1x1

Reply via email to