commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dmitri Plotnikov <dmi...@apache.org>
Subject Re: [JXPath] Serializing JXpath object - Long
Date Thu, 26 Jun 2003 01:29:11 GMT
Dmitry,

You are right - changing JXPathContext to implement Serializable has a
massive rippling effect.  I don't really know what to do.  Apart from a lot
of typing, I have two real issues:

1. What if somebody has implemented one of those APIs like Functions,
AbstractFactory, KeyManager, IdentityManager and their class is built on the
assumption that Serializability is not required.  Problem.

2. JXPathContext holds on to the root node object.  This effectively
introduces the need for the whole tree of target objects to be Serializable.
This feels like it's too much.

Perhaps your option 1 (use a memento for JXPathContext)  is the most
promising.

- Dmitri

----- Original Message ----- 
From: "Dmitri Plotnikov" <dplotnik@yahoo.com>
To: "Jakarta Commons Users List" <commons-user@jakarta.apache.org>
Sent: Monday, June 23, 2003 2:14 PM
Subject: Re: [JXPath] Serializing JXpath object - Long


> Good points.  I'll look into making the required JXPath objects
> serializable. Currently I don't see any serious problem with that.
>
> - Dmitri
>
> --- Dmitry Sklyut <Dmitry_Sklyut@orcom.com> wrote:
> > Hi All,
> >
> > I am looking for the best approach in using JXpath in the following
> > situation.
> >
> > Here is the explanation of the requirements :
> >
> > I must have all of the data encapsulated in the java beans.  Those
> > beans
> > must expose the following 3 APIs that accept Xpath expression to set,
> > get
> > and find data:
> > 1) set(path, object):void  -> maps to createPathAndSetValue of
> > JXpathContext
> > 2) get(path):Object    -> maps to getValue()
> > 3) find(path):Iterator    -> maps to iterate()
> >
> > I am also must decouple the actual Xpath implementation from the core
> > system, so it can be switched on the fly.
> > These APIs are used by the custom tags on the JSPs to get the data
> > from the
> > beans by building XPath expressions.
> > Here is an example:
> > <form name="LoginForm" action="./loginHandler" method="POST">
> > <tag:bean name="ParentBean" parent="true">
> > <tag:bean name="Child1">
> > <tag:input name="propterty1"/>
> > </tag:bean>
> > <tag:bean name="Child2">
> > <tag:bean name="GrandChild1">
> > <tag:input name="property"/>
> > <tag:bean>
> > </tag:bean>
> > </tag:bean>
> > </form>
> >
> > the above would render as:
> > <form name="LoginForm" action="./loginHandler" method="POST">
> > <input type="hidden" name="PAGE_BEAN" value="ParentBean"/>
> > <input type="text" name="/Child1/propterty1"/>
> > <input type="test" name="/Child2/GrandChild1/property"/>
> > </form>
> >
> > User actions can span multiple page invocations (request) so
> > HttpSession is
> > used to save the conversational state.
> > Custom Tags get the beans from the HttpSession and render the page
> > with the
> > data from the beans, and ControllerServlet reads the Xpath from the
> > HttpServletRequest parameters and constructs/populates beans upon
> > submission
> > of the request.
> >
> > To achieve all of these requirements I must access JXpathContext
> > through a
> > interface exposed by my data beans (get/set/find).  These beans also
> > must be
> > Serializable to be added to the HttpSession.  So by wrapping
> > JXpathContext
> > in the my bean I can have the pathing API working.  The problem is
> > that none
> > of the JXpath classes (except for the Pointers) are Serializable.
> > This
> > presents a problem when Serializing the bean.
> >
> > I see three solutions:
> > 1)  Make wrapped JXpathContext transient and provide lazy
> > initialization of
> > the JXpathContext.
> > 2)  Modify the code to add "implements Serializable" to most of the
> > JXpath
> > classes
> > 3)  Create new JXpathContext object with each get/set/find API
> > invocation.
> >
> > So far only option 1 (one) looks appealing.
> > Option 2 - I don't want to change the JXpath code (lazy and not sure
> > of the
> > impact, plus I want to be able to grab the jar of the web when in a
> > jam
> > without too much copy/paste/compile).
> > Option 3 - Just not something I am willing to do.
> >
> > Are there any other approaches that anyone can suggest?  Maybe there
> > is a
> > way to use Pointers or have only CompiledPaths?  But in any case that
> > I seen
> > so far - there is always a need for JXpathContext object.
> >
> > Thanks for reading this far :)
> >
> > Dmitry
> >
>
>
> __________________________________
> Do you Yahoo!?
> SBC Yahoo! DSL - Now only $29.95 per month!
> http://sbc.yahoo.com
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: commons-user-help@jakarta.apache.org
>
>
>
>


Mime
View raw message