commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dmitri Plotnikov <dmi...@apache.org>
Subject Re: [JXPATH] best approch for customization
Date Wed, 05 Jun 2002 23:52:22 GMT
Steve,

You don't actually need to implement NodePointer.  All you need to implement
is a NodePointerFactory, which is a very simple interface.

Try the following:

1. Create a class implementing NodePointerFactory.  In the
createNodePointer() methods (two implementations are required) check for the
token interface.

2. If the object passed to the factory implements the token interface,
return a DynamicPointer a la DynamicPointerFactory

3. If the object does not implement the token interface, return null -
that'll let other factories to do their usual job.

4. Very importantly, make the getOrder() method return a number that is less
than BeanPointerFactory.BEAN_POINTER_FACTORY_ORDER, so it would take
precedence over that one.

5. Register the new factory with JXPathContextReferenceImpl

I hope this helps.

- Dmitri


----- Original Message -----
From: "Stephen Bartlett" <sbartlett@versata.com.au>
To: "Jakarta Commons Developers List (E-mail)"
<commons-dev@jakarta.apache.org>
Sent: Wednesday, June 05, 2002 1:14 AM
Subject: [JXPATH] best approch for customization


> Hi, all,
>
> I have a question regarding the best approach for customizing JXPath. I
> looked at providing a NodePointer implementation but was not convinced
this
> was the right course and also deterred by the large interface.
>
> I like what JXPath provides out-of-the-box with regards to JavaBean
support,
> but instead of allowing clients unvetted access to the whole of my API I
> would prefer to restrict access.
>
> The initial idea was to provide a new JXPathIntospector implementation
that
> hands off to a 'GuardHandler' if the context object implements a
well-known
> tag interface, otherwise it would follow the normal JavaBean resolution.
>
> The 'GuardHandler' (implemtation of DynamicPropertyHandler) guards against
> using any methods not defined for the given bean.
>
> I then realised the JXPathIntrospector is not configurable which lead me
to
> the NodePointer. I'm now wondering the best approach.  Any guidance would
be
> much appreciated.
>
> cheers,
> steve.



--
To unsubscribe, e-mail:   <mailto:commons-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:commons-dev-help@jakarta.apache.org>


Mime
View raw message