xsl-list
[Top] [All Lists]

RE: [xsl] xslt extensions accessing spring application context

2010-03-10 06:41:59
The main reason why I'm interested in this functionality is 

Suppose you have some caching bean class 

----------------------------------------------------------------------------
public class CacheImpl implements Cache {
        
        private TimeConsumingJob job;
        private Map<Map<String, Object>, Result> resultMap;
        
        
        public CacheImpl () {
            this.resultMap = new HashMap<String, Result>();
        }

        public void setTimeConsumingJob (TimeConsumingJob job) {
                this.job = job;
        }
        
        public TimeConsumingJob getTimeConsumingJob () {
                return this.job;
        }
        
        public Result getResult (Map<String, Object> parameterMap) {
                if (!resultMap.containsKey(graphicId)) {
                        resultMap.put(parameterMap, 
job.getResult(parameterMap)); //let's assume job.getResult would take like 1 
minute to process
                }
                return resultMap.get(parameterMap);
        }
}

So if we would be able to invoke this bean like:

<xsl:stylesheet version="1.0" 
  xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
  xmlns:spring="http://www.springframework.org";
  extension-element-prefixes="spring">
  
  <xsl:param name="parameterMap"/>

  <xsl:template match="/" >
    <xsl:variable name="result" 
select="spring:bean:cacheBean:getResult($parameterMap)"/>  <!--just guessing 
what the syntax might become -->
  <xsl:template>
</xsl:stylesheet>

This would save us an enormous amount of time since the bean would check if it 
already had a cached result for that combination of parameters.


Kind regards,
Robby Pelssers


-----Original Message-----
From: Michael Kay [mailto:mike(_at_)saxonica(_dot_)com] 
Sent: Wednesday, March 10, 2010 1:11 PM
To: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
Subject: RE: [xsl] xslt extensions accessing spring application context


So are you saying that Saxon9.2 would support this feature?  

I think it should be possible to make this work under Saxon 9.2, but it's
not something I have done and it would require some investigation or
experiment.

Regards,

Michael Kay
http://www.saxonica.com/
http://twitter.com/michaelhkay 



Kind regards,
Robby

-----Original Message-----
From: Michael Kay [mailto:mike(_at_)saxonica(_dot_)com]
Sent: Wednesday, March 10, 2010 12:04 PM
To: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
Subject: RE: [xsl] xslt extensions accessing spring 
application context


Questions about Java extensibility are processor-specific 
questions that are
probably best asked on a processor-specific list.

One of the motivations behind the new "integrated extension function"
mechanism in Saxon 9.2 was to give you better control on how 
your extensions
integrate into your particular application environment: but I 
haven't worked
out a Spring example as a specific use case.

Regards,

Michael Kay
http://www.saxonica.com/
http://twitter.com/michaelhkay  

-----Original Message-----
From: Robby Pelssers [mailto:robby(_dot_)pelssers(_at_)ciber(_dot_)com] 
Sent: 10 March 2010 10:11
To: XSLT mailing list
Subject: [xsl] xslt extensions accessing spring application context


Hi all,

I know we can access java classes using extensions... but 
nowadays many developers use spring to configure beans where 
properties are configured in the applicationContext.

So instead of using the 'new' construct for instantiating a 
java object I would like to get access to a spring bean.  Are 
there solutions to accomplish this?

Kind regards,
Robby Pelssers


--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: 
<mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--



--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: 
<mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--


--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: 
<mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--



--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--


--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--

<Prev in Thread] Current Thread [Next in Thread>