[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

RE: xslt extensions accessing spring application conte

Subject: RE: xslt extensions accessing spring application context
From: "Robby Pelssers" <robby.pelssers@xxxxxxxxx>
Date: Wed, 10 Mar 2010 13:43:42 +0100
RE:  xslt extensions accessing spring application conte
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@xxxxxxxxxxxx]
Sent: Wednesday, March 10, 2010 1:11 PM
To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
Subject: RE:  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@xxxxxxxxxxxx]
> Sent: Wednesday, March 10, 2010 12:04 PM
> To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> Subject: RE:  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.pelssers@xxxxxxxxx]
> > Sent: 10 March 2010 10:11
> > To: XSLT mailing list
> > Subject:  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

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.