Re: [LANG3] Issue with TypeUtils.isAssignableTo() using JDK ParameterizedType

2024-05-30 Thread Matt Benson
I am confused as to what could be wrong with determining that
Container is *not* assignable to Container. But are you
saying that the manually constructed parameterized Type *is* reported as
being assignable despite the obviously incompatible type parameters?

Matt

On Thu, May 30, 2024, 10:31 AM Sunny Chan 
wrote:

> I have an issue with TypeUtils.isAssignableTo and I would like to check
> whether this is expected or a bug.
>
> Consider we have a number of classes
>
> class Container {...}
>
> class ParameterizedConstructor {
>//consturctor that takes a container
>public ParameterizedConstructor(Container input) {..}
> }
>
> Then if I use TypeUtils to create some parameterized type for checking
> purposes:
>
> //The following will give you TypeVariable with Container
> var constructors = ParameterizedConstructor.class.getConstructors();
> var parameters = constructors[0].getGenericParameterTypes();
> Type assignableTo = parameters[0];
>
> // I want to check whether we can do a equals
> Type assignFrom = TypeUtils.parameterize(Container.class, Integer.class);
>
> //If you run this with lang 3 it will return true but I get a false here :
> TypeUtils.isAssignable(assignFrom, assignTo)
>
> Notice that if I use TypeUtils factory to create the parameterize type, it
> will return correct behaviour
>
> I am wondering whether we expect ParameterizedType from JDK is not expected
> to work here?
>
> Thanks
>


Re: Jxpath getting stuck on trying to do a getValue

2023-09-25 Thread Matt Benson
Not really in a way that makes sense for a publicly archived ML like this,
IMO. If you can "boil it down" to the essence of the problem you should be
able to convey the example without revealing anything private.
Alternatively, you can debug it yourself. If you want to report any problem
you find in this manner you'd still need to boil it down later but as
support is not guaranteed in community-run open source, DIY is always best.

Matt

On Mon, Sep 25, 2023, 12:23 AM Debraj Manna 
wrote:

> I can share a reproducible project but I would like to avoid doing it in a
> public link like in GitHub, etc. Is there a way to do that?
>
> On Mon, 25 Sep, 2023, 01:10 Matt Benson,  wrote:
>
> > TBH I'm somewhat surprised it doesn't already, but I haven't actually
> > ran/debugged your example.
> >
> > On Sun, Sep 24, 2023 at 2:32 PM Debraj Manna 
> > wrote:
> >
> > > Is there a way I can throw some error from jxpath when this situation
> > > arises instead of getting stuck in a never ending loop?
> > >
> > > On Sun, 24 Sep, 2023, 22:54 Matt Benson,  wrote:
> > >
> > > > Well, to be clear, you can have linked nodes. But if N had both
> `next`
> > > and
> > > > `previous` members is where you'd run into trouble.
> > > >
> > > > On Sun, Sep 24, 2023 at 12:22 PM Matt Benson 
> > > wrote:
> > > >
> > > > > If you're doing a search down the tree you'd need some way to keep
> > > JXPath
> > > > > from traversing these relationships, yes.
> > > > >
> > > > > On Sun, Sep 24, 2023 at 11:59 AM Debraj Manna <
> > > subharaj.ma...@gmail.com>
> > > > > wrote:
> > > > >
> > > > >> Are you saying that in JxPath we cannot use something like below?
> > > > >>
> > > > >> class A {
> > > > >> int n;
> > > > >> A next;
> > > > >> }
> > > > >>
> > > > >> On Sun, Sep 24, 2023 at 8:43 PM Matt Benson 
> > > wrote:
> > > > >>
> > > > >> > Is it possible the proto message (I'm not familiar with this
> API)
> > is
> > > > >> built
> > > > >> > with internal recursive references, i.e. some child has a
> property
> > > > that
> > > > >> > points, possibly indirectly, to its parent? That would be the
> most
> > > > >> probable
> > > > >> > explanation, particularly as you say feeding jxpath the known
> > > absolute
> > > > >> path
> > > > >> > works.
> > > > >> >
> > > > >> > Matt
> > > > >> >
> > > > >> > On Sun, Sep 24, 2023, 9:44 AM Debraj Manna <
> > > subharaj.ma...@gmail.com>
> > > > >> > wrote:
> > > > >> >
> > > > >> > > It looks like it is getting stuck in some infinite loop. The
> > > thread
> > > > >> stack
> > > > >> > > looks like below after ~ 8 hours from the start.
> > > > >> > >
> > > > >> > > main  Runnable CPU usage on sample: 979ms
> > > > >> > >   jdk.internal.reflect.GeneratedMethodAccessor640.invoke()
> > > > >> > >
> > > > >> > >
> > > > >> > >
> > > > >> >
> > > > >>
> > > >
> > >
> >
> jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
> > > > >> > >   java.lang.reflect.Method.invoke(Method.java:568)
> > > > >> > >
> > > > >>
> > > org.apache.commons.jxpath.util.ValueUtils.getValue(ValueUtils.java:367)
> > > > >> > >
> > > > >> > >
> > > > >> > >
> > > > >> >
> > > > >>
> > > >
> > >
> >
> org.apache.commons.jxpath.ri.model.beans.BeanPropertyPointer.getBaseValue(BeanPropertyPointer.java:120)
> > > > >> > >
> > > > >> > >
> > > > >> > >
> > > > >> >
> > > > >>
> > > >
> > >
> >
> org.apache.commons.jxpath.ri.model.beans.BeanPropertyPointer.getImmediateNode(BeanPropertyPointer.java:149)
> > > > 

Re: Jxpath getting stuck on trying to do a getValue

2023-09-24 Thread Matt Benson
TBH I'm somewhat surprised it doesn't already, but I haven't actually
ran/debugged your example.

On Sun, Sep 24, 2023 at 2:32 PM Debraj Manna 
wrote:

> Is there a way I can throw some error from jxpath when this situation
> arises instead of getting stuck in a never ending loop?
>
> On Sun, 24 Sep, 2023, 22:54 Matt Benson,  wrote:
>
> > Well, to be clear, you can have linked nodes. But if N had both `next`
> and
> > `previous` members is where you'd run into trouble.
> >
> > On Sun, Sep 24, 2023 at 12:22 PM Matt Benson 
> wrote:
> >
> > > If you're doing a search down the tree you'd need some way to keep
> JXPath
> > > from traversing these relationships, yes.
> > >
> > > On Sun, Sep 24, 2023 at 11:59 AM Debraj Manna <
> subharaj.ma...@gmail.com>
> > > wrote:
> > >
> > >> Are you saying that in JxPath we cannot use something like below?
> > >>
> > >> class A {
> > >> int n;
> > >> A next;
> > >> }
> > >>
> > >> On Sun, Sep 24, 2023 at 8:43 PM Matt Benson 
> wrote:
> > >>
> > >> > Is it possible the proto message (I'm not familiar with this API) is
> > >> built
> > >> > with internal recursive references, i.e. some child has a property
> > that
> > >> > points, possibly indirectly, to its parent? That would be the most
> > >> probable
> > >> > explanation, particularly as you say feeding jxpath the known
> absolute
> > >> path
> > >> > works.
> > >> >
> > >> > Matt
> > >> >
> > >> > On Sun, Sep 24, 2023, 9:44 AM Debraj Manna <
> subharaj.ma...@gmail.com>
> > >> > wrote:
> > >> >
> > >> > > It looks like it is getting stuck in some infinite loop. The
> thread
> > >> stack
> > >> > > looks like below after ~ 8 hours from the start.
> > >> > >
> > >> > > main  Runnable CPU usage on sample: 979ms
> > >> > >   jdk.internal.reflect.GeneratedMethodAccessor640.invoke()
> > >> > >
> > >> > >
> > >> > >
> > >> >
> > >>
> >
> jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
> > >> > >   java.lang.reflect.Method.invoke(Method.java:568)
> > >> > >
> > >>
> org.apache.commons.jxpath.util.ValueUtils.getValue(ValueUtils.java:367)
> > >> > >
> > >> > >
> > >> > >
> > >> >
> > >>
> >
> org.apache.commons.jxpath.ri.model.beans.BeanPropertyPointer.getBaseValue(BeanPropertyPointer.java:120)
> > >> > >
> > >> > >
> > >> > >
> > >> >
> > >>
> >
> org.apache.commons.jxpath.ri.model.beans.BeanPropertyPointer.getImmediateNode(BeanPropertyPointer.java:149)
> > >> > >
> > >> > >
> > >> > >
> > >> >
> > >>
> >
> org.apache.commons.jxpath.ri.model.beans.PropertyPointer.getImmediateValuePointer(PropertyPointer.java:161)
> > >> > >
> > >> > >
> > >> > >
> > >> >
> > >>
> >
> org.apache.commons.jxpath.ri.model.NodePointer.getValuePointer(NodePointer.java:297)
> > >> > >
> > >> > >
> > >> > >
> > >> >
> > >>
> >
> org.apache.commons.jxpath.ri.model.beans.PropertyIterator.getNodePointer(PropertyIterator.java:121)
> > >> > >
> > >> > >
> > >> > >
> > >> >
> > >>
> >
> org.apache.commons.jxpath.ri.axes.DescendantContext.nextNode(DescendantContext.java:115)
> > >> > >
> > >>
> org.apache.commons.jxpath.ri.EvalContext.nextSet(EvalContext.java:349)
> > >> > >
> > >> > >
> > >> > >
> > >> >
> > >>
> >
> org.apache.commons.jxpath.ri.axes.ChildContext.getSingleNodePointer(ChildContext.java:70)
> > >> > >
> > >>
> org.apache.commons.jxpath.ri.compiler.Path.searchForPath(Path.java:201)
> > >> > >
> > >> > >
> > >> > >
> > >> >
> > >>
> >
> org.apache.commons.jxpath.ri.compiler.Path.getSingleNodePointerForSteps(Path.java:176)
> > &g

Re: Jxpath getting stuck on trying to do a getValue

2023-09-24 Thread Matt Benson
Well, to be clear, you can have linked nodes. But if N had both `next` and
`previous` members is where you'd run into trouble.

On Sun, Sep 24, 2023 at 12:22 PM Matt Benson  wrote:

> If you're doing a search down the tree you'd need some way to keep JXPath
> from traversing these relationships, yes.
>
> On Sun, Sep 24, 2023 at 11:59 AM Debraj Manna 
> wrote:
>
>> Are you saying that in JxPath we cannot use something like below?
>>
>> class A {
>> int n;
>> A next;
>> }
>>
>> On Sun, Sep 24, 2023 at 8:43 PM Matt Benson  wrote:
>>
>> > Is it possible the proto message (I'm not familiar with this API) is
>> built
>> > with internal recursive references, i.e. some child has a property that
>> > points, possibly indirectly, to its parent? That would be the most
>> probable
>> > explanation, particularly as you say feeding jxpath the known absolute
>> path
>> > works.
>> >
>> > Matt
>> >
>> > On Sun, Sep 24, 2023, 9:44 AM Debraj Manna 
>> > wrote:
>> >
>> > > It looks like it is getting stuck in some infinite loop. The thread
>> stack
>> > > looks like below after ~ 8 hours from the start.
>> > >
>> > > main  Runnable CPU usage on sample: 979ms
>> > >   jdk.internal.reflect.GeneratedMethodAccessor640.invoke()
>> > >
>> > >
>> > >
>> >
>> jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
>> > >   java.lang.reflect.Method.invoke(Method.java:568)
>> > >
>>  org.apache.commons.jxpath.util.ValueUtils.getValue(ValueUtils.java:367)
>> > >
>> > >
>> > >
>> >
>> org.apache.commons.jxpath.ri.model.beans.BeanPropertyPointer.getBaseValue(BeanPropertyPointer.java:120)
>> > >
>> > >
>> > >
>> >
>> org.apache.commons.jxpath.ri.model.beans.BeanPropertyPointer.getImmediateNode(BeanPropertyPointer.java:149)
>> > >
>> > >
>> > >
>> >
>> org.apache.commons.jxpath.ri.model.beans.PropertyPointer.getImmediateValuePointer(PropertyPointer.java:161)
>> > >
>> > >
>> > >
>> >
>> org.apache.commons.jxpath.ri.model.NodePointer.getValuePointer(NodePointer.java:297)
>> > >
>> > >
>> > >
>> >
>> org.apache.commons.jxpath.ri.model.beans.PropertyIterator.getNodePointer(PropertyIterator.java:121)
>> > >
>> > >
>> > >
>> >
>> org.apache.commons.jxpath.ri.axes.DescendantContext.nextNode(DescendantContext.java:115)
>> > >
>>  org.apache.commons.jxpath.ri.EvalContext.nextSet(EvalContext.java:349)
>> > >
>> > >
>> > >
>> >
>> org.apache.commons.jxpath.ri.axes.ChildContext.getSingleNodePointer(ChildContext.java:70)
>> > >
>>  org.apache.commons.jxpath.ri.compiler.Path.searchForPath(Path.java:201)
>> > >
>> > >
>> > >
>> >
>> org.apache.commons.jxpath.ri.compiler.Path.getSingleNodePointerForSteps(Path.java:176)
>> > >
>> > >
>> > >
>> >
>> org.apache.commons.jxpath.ri.compiler.LocationPath.computeValue(LocationPath.java:87)
>> > >
>> > >
>> > >
>> >
>> org.apache.commons.jxpath.ri.JXPathContextReferenceImpl.getValue(JXPathContextReferenceImpl.java:353)
>> > >
>> > >
>> > >
>> >
>> org.apache.commons.jxpath.ri.JXPathContextReferenceImpl.getValue(JXPathContextReferenceImpl.java:313)
>> > >
>> > >
>> > >
>> >
>> com.spotnana.webhooks.isos.PNRListBuilderTest.testJxPathCtx(PNRListBuilderTest.java:366)
>> > >
>> > > On Sun, Sep 24, 2023 at 1:24 AM Debraj Manna <
>> subharaj.ma...@gmail.com>
>> > > wrote:
>> > >
>> > > > I am trying to search using JxPath on a proto message, My proto
>> message
>> > > is
>> > > > placed here
>> > > > <
>> https://gist.github.com/debraj-manna/4a8ded5d79dc9aee8d4c03d460327284
>> > >.
>> > > >
>> > > > val protoStr =
>> > > > getStringFromFile("classpath:BookingEnginePnrUpdateEventProto.txt");
>> > > > val msgBld = BookingEnginePNRUpdateEvent.newBuilder();
>> > > > TextFormat.getParser().merge(protoStr, msgBld);
>> > > > val msgCtx = JXPathContext.newContext(msgBld.build());
>> > > > System.out.println(msgCtx.getValue("//employeeId"));
>> > > >
>> > > > I am observing that  msgCtx.getValue("//employeeId") is taking a
>> lot of
>> > > > time. Thread dumps at various points are placed in the below gist.
>> > > >
>> > > >
>> https://gist.github.com/debraj-manna/47852fa190075abdacd527969f355cde
>> > > >
>> > > > If I specify the entire path like
>> > > >
>> > >
>> >
>> msgCtx.getValue("/metadata/bookerInfo/traveler/userBusinessInfo/employeeId").
>> > > > It is working fine.
>> > > >
>> > > > Can someone let me know what is going wrong? Is this expected?
>> > > >
>> > > >
>> > > >
>> > > >
>> > > >
>> > >
>> >
>>
>


Re: Jxpath getting stuck on trying to do a getValue

2023-09-24 Thread Matt Benson
If you're doing a search down the tree you'd need some way to keep JXPath
from traversing these relationships, yes.

On Sun, Sep 24, 2023 at 11:59 AM Debraj Manna 
wrote:

> Are you saying that in JxPath we cannot use something like below?
>
> class A {
> int n;
> A next;
> }
>
> On Sun, Sep 24, 2023 at 8:43 PM Matt Benson  wrote:
>
> > Is it possible the proto message (I'm not familiar with this API) is
> built
> > with internal recursive references, i.e. some child has a property that
> > points, possibly indirectly, to its parent? That would be the most
> probable
> > explanation, particularly as you say feeding jxpath the known absolute
> path
> > works.
> >
> > Matt
> >
> > On Sun, Sep 24, 2023, 9:44 AM Debraj Manna 
> > wrote:
> >
> > > It looks like it is getting stuck in some infinite loop. The thread
> stack
> > > looks like below after ~ 8 hours from the start.
> > >
> > > main  Runnable CPU usage on sample: 979ms
> > >   jdk.internal.reflect.GeneratedMethodAccessor640.invoke()
> > >
> > >
> > >
> >
> jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
> > >   java.lang.reflect.Method.invoke(Method.java:568)
> > >
>  org.apache.commons.jxpath.util.ValueUtils.getValue(ValueUtils.java:367)
> > >
> > >
> > >
> >
> org.apache.commons.jxpath.ri.model.beans.BeanPropertyPointer.getBaseValue(BeanPropertyPointer.java:120)
> > >
> > >
> > >
> >
> org.apache.commons.jxpath.ri.model.beans.BeanPropertyPointer.getImmediateNode(BeanPropertyPointer.java:149)
> > >
> > >
> > >
> >
> org.apache.commons.jxpath.ri.model.beans.PropertyPointer.getImmediateValuePointer(PropertyPointer.java:161)
> > >
> > >
> > >
> >
> org.apache.commons.jxpath.ri.model.NodePointer.getValuePointer(NodePointer.java:297)
> > >
> > >
> > >
> >
> org.apache.commons.jxpath.ri.model.beans.PropertyIterator.getNodePointer(PropertyIterator.java:121)
> > >
> > >
> > >
> >
> org.apache.commons.jxpath.ri.axes.DescendantContext.nextNode(DescendantContext.java:115)
> > >
>  org.apache.commons.jxpath.ri.EvalContext.nextSet(EvalContext.java:349)
> > >
> > >
> > >
> >
> org.apache.commons.jxpath.ri.axes.ChildContext.getSingleNodePointer(ChildContext.java:70)
> > >
>  org.apache.commons.jxpath.ri.compiler.Path.searchForPath(Path.java:201)
> > >
> > >
> > >
> >
> org.apache.commons.jxpath.ri.compiler.Path.getSingleNodePointerForSteps(Path.java:176)
> > >
> > >
> > >
> >
> org.apache.commons.jxpath.ri.compiler.LocationPath.computeValue(LocationPath.java:87)
> > >
> > >
> > >
> >
> org.apache.commons.jxpath.ri.JXPathContextReferenceImpl.getValue(JXPathContextReferenceImpl.java:353)
> > >
> > >
> > >
> >
> org.apache.commons.jxpath.ri.JXPathContextReferenceImpl.getValue(JXPathContextReferenceImpl.java:313)
> > >
> > >
> > >
> >
> com.spotnana.webhooks.isos.PNRListBuilderTest.testJxPathCtx(PNRListBuilderTest.java:366)
> > >
> > > On Sun, Sep 24, 2023 at 1:24 AM Debraj Manna  >
> > > wrote:
> > >
> > > > I am trying to search using JxPath on a proto message, My proto
> message
> > > is
> > > > placed here
> > > > <
> https://gist.github.com/debraj-manna/4a8ded5d79dc9aee8d4c03d460327284
> > >.
> > > >
> > > > val protoStr =
> > > > getStringFromFile("classpath:BookingEnginePnrUpdateEventProto.txt");
> > > > val msgBld = BookingEnginePNRUpdateEvent.newBuilder();
> > > > TextFormat.getParser().merge(protoStr, msgBld);
> > > > val msgCtx = JXPathContext.newContext(msgBld.build());
> > > > System.out.println(msgCtx.getValue("//employeeId"));
> > > >
> > > > I am observing that  msgCtx.getValue("//employeeId") is taking a lot
> of
> > > > time. Thread dumps at various points are placed in the below gist.
> > > >
> > > >
> https://gist.github.com/debraj-manna/47852fa190075abdacd527969f355cde
> > > >
> > > > If I specify the entire path like
> > > >
> > >
> >
> msgCtx.getValue("/metadata/bookerInfo/traveler/userBusinessInfo/employeeId").
> > > > It is working fine.
> > > >
> > > > Can someone let me know what is going wrong? Is this expected?
> > > >
> > > >
> > > >
> > > >
> > > >
> > >
> >
>


Re: Jxpath getting stuck on trying to do a getValue

2023-09-24 Thread Matt Benson
Is it possible the proto message (I'm not familiar with this API) is built
with internal recursive references, i.e. some child has a property that
points, possibly indirectly, to its parent? That would be the most probable
explanation, particularly as you say feeding jxpath the known absolute path
works.

Matt

On Sun, Sep 24, 2023, 9:44 AM Debraj Manna  wrote:

> It looks like it is getting stuck in some infinite loop. The thread stack
> looks like below after ~ 8 hours from the start.
>
> main  Runnable CPU usage on sample: 979ms
>   jdk.internal.reflect.GeneratedMethodAccessor640.invoke()
>
>
> jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
>   java.lang.reflect.Method.invoke(Method.java:568)
>   org.apache.commons.jxpath.util.ValueUtils.getValue(ValueUtils.java:367)
>
>
> org.apache.commons.jxpath.ri.model.beans.BeanPropertyPointer.getBaseValue(BeanPropertyPointer.java:120)
>
>
> org.apache.commons.jxpath.ri.model.beans.BeanPropertyPointer.getImmediateNode(BeanPropertyPointer.java:149)
>
>
> org.apache.commons.jxpath.ri.model.beans.PropertyPointer.getImmediateValuePointer(PropertyPointer.java:161)
>
>
> org.apache.commons.jxpath.ri.model.NodePointer.getValuePointer(NodePointer.java:297)
>
>
> org.apache.commons.jxpath.ri.model.beans.PropertyIterator.getNodePointer(PropertyIterator.java:121)
>
>
> org.apache.commons.jxpath.ri.axes.DescendantContext.nextNode(DescendantContext.java:115)
>   org.apache.commons.jxpath.ri.EvalContext.nextSet(EvalContext.java:349)
>
>
> org.apache.commons.jxpath.ri.axes.ChildContext.getSingleNodePointer(ChildContext.java:70)
>   org.apache.commons.jxpath.ri.compiler.Path.searchForPath(Path.java:201)
>
>
> org.apache.commons.jxpath.ri.compiler.Path.getSingleNodePointerForSteps(Path.java:176)
>
>
> org.apache.commons.jxpath.ri.compiler.LocationPath.computeValue(LocationPath.java:87)
>
>
> org.apache.commons.jxpath.ri.JXPathContextReferenceImpl.getValue(JXPathContextReferenceImpl.java:353)
>
>
> org.apache.commons.jxpath.ri.JXPathContextReferenceImpl.getValue(JXPathContextReferenceImpl.java:313)
>
>
> com.spotnana.webhooks.isos.PNRListBuilderTest.testJxPathCtx(PNRListBuilderTest.java:366)
>
> On Sun, Sep 24, 2023 at 1:24 AM Debraj Manna 
> wrote:
>
> > I am trying to search using JxPath on a proto message, My proto message
> is
> > placed here
> > .
> >
> > val protoStr =
> > getStringFromFile("classpath:BookingEnginePnrUpdateEventProto.txt");
> > val msgBld = BookingEnginePNRUpdateEvent.newBuilder();
> > TextFormat.getParser().merge(protoStr, msgBld);
> > val msgCtx = JXPathContext.newContext(msgBld.build());
> > System.out.println(msgCtx.getValue("//employeeId"));
> >
> > I am observing that  msgCtx.getValue("//employeeId") is taking a lot of
> > time. Thread dumps at various points are placed in the below gist.
> >
> > https://gist.github.com/debraj-manna/47852fa190075abdacd527969f355cde
> >
> > If I specify the entire path like
> >
> msgCtx.getValue("/metadata/bookerInfo/traveler/userBusinessInfo/employeeId").
> > It is working fine.
> >
> > Can someone let me know what is going wrong? Is this expected?
> >
> >
> >
> >
> >
>


Re: [collections] Adding a Table data structure?

2021-09-01 Thread Matt Benson
And how is the table type different from using e.g. a Commons lang Pair as
the key of a basic Map?

Matt

On Tue, Aug 31, 2021, 11:42 PM Gary Gregory  wrote:

> What's missing from Guava's version that you want to add here?
>
> Gary
>
> On Tue, Aug 31, 2021, 20:55 Will Herrmann  wrote:
>
> > I am wondering if it would be appropriate to add a Table (a.k.a. Matrix)
> > data structure to Commons Collections 4. Guava has one[1] and it seems
> like
> > it would fit in with this project.
> >
> > From the Guava Javadoc for Table
> >
> > > A collection that associates an ordered pair of keys, called a row key
> > and a column key, with a single value. A table may be sparse, with only a
> > small fraction of row key / column key pairs possessing a corresponding
> > value.
> >
> > Under the hood, a Table seems to be implemented as a Map > Map>, with concrete implementations backed by HashMaps or TreeMaps.
> >
> > If it would be appropriate to add such a data structure, what would be
> the
> > process of adding it to Commons Collections 4?
> >
> > [1]:
> > https://github.com/google/guava/wiki/NewCollectionTypesExplained#table
> > -
> > To unsubscribe, e-mail: user-unsubscr...@commons.apache.org
> > For additional commands, e-mail: user-h...@commons.apache.org
> >
> >
>


[ANNOUNCE] Apache Commons Weaver 2.0 released

2018-09-07 Thread Matt Benson
The Apache Commons Team is pleased to announce the availability of:

Apache Commons Weaver 2.0

Apache Commons Weaver provides an easy way to enhance compiled Java
classes by generating ("weaving") bytecode into those classes.

The release notes can be reviewed at:
http://www.apache.org/dist/commons/weaver/RELEASE-NOTES.txt

Distribution packages can be downloaded from:
https://commons.apache.org/proper/commons-weaver/download_weaver.cgi

When downloading, please verify signatures using the KEYS file available at:
http://www.apache.org/dist/commons

Maven artifacts are also available in the central Maven repository:

http://repo1.maven.org/maven2/org/apache/commons/

The Apache Commons Team


Re: [LANG] Object Merge Functionality

2016-11-30 Thread Matt Benson
There should be multiple existing open source Java libraries to do this
type of thing. Shameless* plug: one such is my own
https://github.com/mbenson/therian .

Agree this is out of scope for [lang] and that [beanutils] would be more
appropriate.

Matt

* Maybe there was a little shame.

On Nov 29, 2016 6:11 PM, "Anthony Bonafide" 
wrote:

Hello All,

 I was wondering if there is functionality within the commons-lang
library to merge two or more objects together. The desired functionality
would be, given a source and target object copy all the fields from the
source to the target where the destination’s fields are null. This is
similar to the behavior of Object.assign

found
in javascript. I think this is useful when dealing with hierarchies where
 objects inherit defaults from other objects higher in the hierarchy. If
this feature does not exist and you think it is useful, I would like to
submit a pull request. Any thoughts?


Thank you,


Anthony Bonafide


[ANNOUNCE] Apache Commons Weaver 1.3 Released

2016-10-18 Thread Matt Benson
The Apache Commons Team is pleased to announce the availability of:

Apache Commons Weaver 1.3

Apache Commons Weaver provides an easy way to enhance compiled Java
classes by generating ("weaving") bytecode into those classes.

The release notes can be reviewed at:
http://www.apache.org/dist/commons/weaver/RELEASE-NOTES.txt

Distribution packages can be downloaded from:
https://commons.apache.org/proper/commons-weaver/download_weaver.cgi

When downloading, please verify signatures using the KEYS file available at:
http://www.apache.org/dist/commons

Maven artifacts are also available in the central Maven repository:

http://repo1.maven.org/maven2/org/apache/commons/

The Apache Commons Team


[ANNOUNCE] Apache Commons Weaver 1.2 Released

2016-02-04 Thread Matt Benson
The Apache Commons Team is pleased to announce the availability of:

Apache Commons Weaver 1.2

Apache Commons Weaver provides an easy way to enhance compiled Java
classes by generating ("weaving") bytecode into those classes.

The release notes can be reviewed at:
http://www.apache.org/dist/commons/weaver/RELEASE-NOTES.txt

Distribution packages can be downloaded from:
https://commons.apache.org/proper/commons-weaver/download_weaver.cgi

When downloading, please verify signatures using the KEYS file available at:
http://www.apache.org/dist/commons

Maven artifacts are also available in the central Maven repository:

http://repo1.maven.org/maven2/org/apache/commons/

The Apache Commons Team

-
To unsubscribe, e-mail: user-unsubscr...@commons.apache.org
For additional commands, e-mail: user-h...@commons.apache.org



Re: Reflection Utils

2015-05-30 Thread Matt Benson
The recent release of Lang does provide a method to get fields with a
particular annotation.

Matt
On May 30, 2015 7:27 AM, Timo mailant...@gmx.de wrote:

 Thank you for the suggestions!

 Commons Weaver kind of has a way to do what I want, but it's... ehm...
 woven with the rest of the project (e.g. WeavableField). So I ended up
 implementing my own method and then using Lang's FieldUtils to read
 and write the fields.


 2015-05-28 23:20 GMT+02:00 Steven Siebert smsi...@gmail.com:
  also take a look at the weaver project...
  https://commons.apache.org/proper/commons-weaver/
 
 
 
  On Thu, May 28, 2015 at 4:55 PM, Timo mailant...@gmail.com wrote:
 
  Hello everyone,
 
  I was wondering if there is a utility somewhere in Commons with which
  I can get all fields of a class with a given Annotation. Something
  similar to Spring's (internal) ReflectionUtils.doWithFields(). I
  couldn't find anything in Lang or BeanUtils. Anywhere else I should
  take a look?
 
  Thanks
  Timo
 
  -
  To unsubscribe, e-mail: user-unsubscr...@commons.apache.org
  For additional commands, e-mail: user-h...@commons.apache.org
 
 

 -
 To unsubscribe, e-mail: user-unsubscr...@commons.apache.org
 For additional commands, e-mail: user-h...@commons.apache.org




Re: [codec] - change transitive dependency from commons-codec-1.3 to 1.6 or 1.9

2014-10-16 Thread Matt Benson
May I also suggest you read [1].

[1] http://semver.org/

Matt
On Oct 16, 2014 8:10 AM, Gary Gregory garydgreg...@gmail.com wrote:

 In theory, no, but you should read the release notes.

 Gary

 On Thu, Oct 16, 2014 at 7:17 AM, GIPA mbH Di Ly d...@gipa.de wrote:

  Our software has a transitive dependency to commons-codec-1.3. Is there
  any problem when I change the commons-codec-1.3 to 1.6 or 1.9?
 
 
 
  Thanks.
 
  Ly
 



 --
 E-Mail: garydgreg...@gmail.com | ggreg...@apache.org
 Java Persistence with Hibernate, Second Edition
 http://www.manning.com/bauer3/
 JUnit in Action, Second Edition http://www.manning.com/tahchiev/
 Spring Batch in Action http://www.manning.com/templier/
 Blog: http://garygregory.wordpress.com
 Home: http://garygregory.com/
 Tweet! http://twitter.com/GaryGregory



[ANNOUNCEMENT] Apache Commons Weaver 1.1 Released

2014-09-30 Thread Matt Benson
The Apache Commons team is pleased to announce the release of:

Apache Commons Weaver 1.1

Apache Commons Weaver provides an easy way to enhance compiled Java
classes by generating (weaving) bytecode into those classes.

The release notes can be reviewed at:
http://www.apache.org/dist/commons/weaver/RELEASE-NOTES.txt

Distribution packages can be downloaded from:
https://commons.apache.org/proper/commons-weaver/download_weaver.cgi

When downloading, please verify signatures using the KEYS file available at:
http://www.apache.org/dist/commons

The release is also available in the central Maven repository:
http://repo1.maven.org/maven2/org/apache/commons/

The Apache Commons Team


Re: [JXPATH] Am I doing something stupid here?

2014-04-25 Thread Matt Benson
Hi, John. Sorry for the long delay.

  The original authors of JXPath are long gone, but from what I can
reconstruct the intent of nested JXPathContexts is only to unify treatment
of things like variables, namespaces, and at a guess, functions. AFAICT
your test case appears to have overcomplicated the issue, although notably
my alternative does resort to some string concatentation to accomplish the
same apparent purpose of the test case. Certainly the whole JXPath codebase
could benefit from some modernization. In any event, I have:

@Test
public void anotherTest() throws Exception {
final InputStream is =

Thread.currentThread().getContextClassLoader().getResourceAsStream(jxpath/simple.pom.xml);

final Document document =
DocumentBuilderFactory.newInstance().newDocumentBuilder().parse(is);

final JXPathContext ctx = JXPathContext.newContext(document);

// not sure why this was done, but I have preserved it
document.getDocumentElement().removeAttribute(xmlns);

for (@SuppressWarnings(unchecked)
IteratorPointer ptrs =
ctx.iteratePointers(/project/dependencies/dependency); ptrs.hasNext();) {
final Pointer ptr = ptrs.next();
dump((Node) ptr.getNode());
System.out.printf(declared by project with groupId '%s'%n,
ctx.getValue(ptr.asPath() + /ancestor::project/groupId));
}
}

which yields output:

dependency
  groupIdorg.group/groupId
  artifactIdartifact-id/artifactId
  version2.6/version
/dependency

declared by project with groupId 'org.test'

Does this help?

Matt


On Mon, Apr 14, 2014 at 1:09 PM, John Casey jdca...@apache.org wrote:

 Hi all,

 I'm trying to learn how to use JXPath with DOM in order to speed up some
 code that uses a lot of xpath. I've seen blog posts suggesting it's about
 twice as fast as JAXP's XPath processor...

 The problem I'm running into is when I construct a JXPathContext around a
 node down in the DOM tree, then try to select a node elsewhere in the tree
 using the ancestor:: axis. I'm attaching a sample XML file and unit test
 that shows what I'm trying to do.

 I've run this through a debugger, and it appears that the 
 DOMNodePointer.getImmediateParent()
 doesn't even try to look at the Node.getParentNode()...if it doesn't have a
 pre-existing parent (from its ctor) then it just dumbly returns the null
 parent.

 I haven't done enough research yet to know how to get DOMNodePointer to
 populate its parent (using the public API, not the nuts-and-bolts impl
 details), but in the attached example you can see I try two approaches:

 1. the naive approach, which is also the last one in the code. IMO, this
 one should work!

 2. a brute-force alternative, where JXPathContext instances for each
 intermediate node are created to inherit in the right order, all the way
 back to the document itself. From my partial reading of the code, this
 should work even if the naive approach doesn't.

 Neither of these works, though. Can someone shed some light on it, or let
 me know if I've found a bug (seems like a common use case)...

 Thanks,

 -john

 --
 John Casey
 GitHub - http://github.com/jdcasey


 -
 To unsubscribe, e-mail: user-unsubscr...@commons.apache.org
 For additional commands, e-mail: user-h...@commons.apache.org



Re: [JXPATH] Am I doing something stupid here?

2014-04-25 Thread Matt Benson
Pointer is an interface that is considered part of the public API. Very
possibly the intent could have been more elegantly expressed by using the
NodePointer API, but this *would* be a case of relying on an implementation
detail, as NodePointer is the Pointer implementation used by
JXPathContextReferenceImpl.

Matt


On Fri, Apr 25, 2014 at 12:39 PM, John Casey jdca...@commonjava.org wrote:

  Yep, that makes a certain kind of sense, though I guess I wouldn't
 exactly call it intuitive. I can see how creating a new context each time
 could be a bad idea (and very inefficient, I suspect)...though it seems (to
 a newbie anyway) that the pointers are an implementation detail that leak
 out in this case.

 Or, maybe I just haven't read enough of the docs?

 At any rate, thanks for your reply. Maybe once this project I'm working on
 is done, I'll take a look at modernizing JXPath. It does seem faster than
 the built-in JAXP stuff.

 -john



 On 04/25/2014 12:33 PM, Matt Benson wrote:

 Hi, John. Sorry for the long delay.

The original authors of JXPath are long gone, but from what I can
 reconstruct the intent of nested JXPathContexts is only to unify treatment
 of things like variables, namespaces, and at a guess, functions. AFAICT
 your test case appears to have overcomplicated the issue, although notably
 my alternative does resort to some string concatentation to accomplish the
 same apparent purpose of the test case. Certainly the whole JXPath codebase
 could benefit from some modernization. In any event, I have:

  @Test
 public void anotherTest() throws Exception {
 final InputStream is =

 Thread.currentThread().getContextClassLoader().getResourceAsStream(jxpath/simple.pom.xml);

  final Document document =
 DocumentBuilderFactory.newInstance().newDocumentBuilder().parse(is);

  final JXPathContext ctx = JXPathContext.newContext(document);

  // not sure why this was done, but I have preserved it
 document.getDocumentElement().removeAttribute(xmlns);

  for (@SuppressWarnings(unchecked)
 IteratorPointer ptrs =
 ctx.iteratePointers(/project/dependencies/dependency); ptrs.hasNext();) {
 final Pointer ptr = ptrs.next();
 dump((Node) ptr.getNode());
 System.out.printf(declared by project with groupId '%s'%n,
 ctx.getValue(ptr.asPath() + /ancestor::project/groupId));
 }
 }

  which yields output:

  dependency
   groupIdorg.group/groupId
   artifactIdartifact-id/artifactId
   version2.6/version
 /dependency

  declared by project with groupId 'org.test'

  Does this help?

  Matt


 On Mon, Apr 14, 2014 at 1:09 PM, John Casey jdca...@apache.org wrote:

 Hi all,

 I'm trying to learn how to use JXPath with DOM in order to speed up some
 code that uses a lot of xpath. I've seen blog posts suggesting it's about
 twice as fast as JAXP's XPath processor...

 The problem I'm running into is when I construct a JXPathContext around a
 node down in the DOM tree, then try to select a node elsewhere in the tree
 using the ancestor:: axis. I'm attaching a sample XML file and unit test
 that shows what I'm trying to do.

 I've run this through a debugger, and it appears that the
 DOMNodePointer.getImmediateParent() doesn't even try to look at the
 Node.getParentNode()...if it doesn't have a pre-existing parent (from its
 ctor) then it just dumbly returns the null parent.

 I haven't done enough research yet to know how to get DOMNodePointer to
 populate its parent (using the public API, not the nuts-and-bolts impl
 details), but in the attached example you can see I try two approaches:

 1. the naive approach, which is also the last one in the code. IMO, this
 one should work!

 2. a brute-force alternative, where JXPathContext instances for each
 intermediate node are created to inherit in the right order, all the way
 back to the document itself. From my partial reading of the code, this
 should work even if the naive approach doesn't.

 Neither of these works, though. Can someone shed some light on it, or let
 me know if I've found a bug (seems like a common use case)...

 Thanks,

 -john

 --
 John Casey
 GitHub - http://github.com/jdcasey


 -
 To unsubscribe, e-mail: user-unsubscr...@commons.apache.org
 For additional commands, e-mail: user-h...@commons.apache.org



 --
 John Casey
 ---
 GitHub:  https://github.com/jdcasey/
 Twitter: http://twitter.com/buildchimp




[ANNOUNCEMENT] Apache Commons Weaver 1.0 Released

2014-03-17 Thread Matt Benson
The Apache Commons team is pleased to announce the release of:

Apache Commons Weaver 1.0

Apache Commons Weaver provides an easy way to enhance compiled Java
classes by generating (weaving) bytecode into those classes.

Distribution packages can be downloaded from:
https://commons.apache.org/proper/commons-weaver/download_weaver.cgi

When downloading, please verify signatures using the KEYS file available at:
http://www.apache.org/dist/commons

The release is also available in the central Maven repository:
http://repo1.maven.org/maven2/org/apache/commons/

The Apache Commons Team

-
To unsubscribe, e-mail: user-unsubscr...@commons.apache.org
For additional commands, e-mail: user-h...@commons.apache.org



Re: [imaging] Plan for 1.0.0 release

2013-10-22 Thread Matt Benson
At some point I had had it in mind that ImageFormat should be converted to
a proper enum type.  Can anyone offer any reasons this should not be done,
particularly before 1.0.0?

Matt


On Tue, Oct 22, 2013 at 1:44 PM, Damjan Jovanovic damjan@gmail.comwrote:

 Yes I agree, we might as well release trunk as 1.0.0. I am fixing the
 last few bugs in Jira, and then let's get started with the release
 :-). Support would be appreciated.

 Damjan

 On Tue, Oct 22, 2013 at 8:19 PM, Raul Kripalani r...@evosent.com wrote:
  Hello,
 
  @Gregory – many thanks for your input. You surely belong very valid
 points
  to the discussion.
 
  The issue I see is that Apache Sanselan 0.97 has such a wide adoption in
  the community that even in spite of the last public release being an
  Incubator one, it has earned itself the status of a de-facto library for
  image processing out there. It's quite mature and stable for the standard
  use cases. IMHO, release 0.97 has the status and bearing of a release
 1.0.0
  already.
 
  Want it or not, this means that you'll find yourself supporting the
 current
  API baseline for quite some time ;-) Bear in mind that the Sanselan use
  cases are typically quite static: once you've built your image processing
  functionality into your app, it'll probably remain untouched for a long
  time. So the user has some functional changes to make in your app, they
  won't consider upgrading, let alone investing the effort to adapt their
  code to an entirely new API just for the sake of it.
 
  So, in a nutshell, it seems adequate to publish the current trunk as
  version 1.0.0, as folks are indeed already treating it as such out there.
 
  @Damjan – what's your take? I can support you these days if you decide to
  push out 1.0.0 now!
 
  Regards,
 
  *Raúl Kripalani*
  Apache Camel PMC Member  Committer | Enterprise Architect, Open Source
  Integration specialist
  http://about.me/raulkripalani | http://www.linkedin.com/in/raulkripalani
  http://blog.raulkr.net | twitter: @raulvk
 
  On Mon, Oct 21, 2013 at 5:23 PM, Gary Gregory garydgreg...@gmail.com
 wrote:
 
  On Mon, Oct 21, 2013 at 10:30 AM, Gary Gregory garydgreg...@gmail.com
  wrote:
 
   On Mon, Oct 21, 2013 at 9:47 AM, Damjan Jovanovic dam...@apache.org
  wrote:
  
   Well as the only committer that's really working on the internals, I
   am wondering what to do myself now.
  
   I've been working on (and have almost finished) a very large change
   affecting virtually everything. When I commit it, the API will come
   apart at the seams :-/, and people will not be very happy with the
   rewrites of their own code they'll be doing.
  
   Which of the following would be best:
   1. Releasing what is in SVN trunk now (maybe minus another API
   breaking change from a few months ago) as 1.0, then adding my large
   API-breaking change which will eventually be released as version 2.0.
  
  
   Remember that you'll have to change the package name and Maven
  coordinates
   for 2.0.
  
 
  The good news is that version 0.97 is in the old package name
  org.apache.sanselan. This means no jar hell for 1.0
  (org.apache.commons.imaging) vs. 0.97. 1.0 which will co-exist with
 0.97 in
  the same class loader. With option (1), upgrading from 0.97 to 1.0 will
  mean AT LEAST updating all package imports, not that bad. Make sure you
  write good release notes ;)
 
  Let me also offer a bit of perspective for your consideration.
 Releasing an
  option (1) 1.0 means supporting it to some extent on the ML and with
  possible maintenance releases. Since 2.0 is incompatible, do you really
  want to take on maintaining two large code bases (or three if you count
  0.97)? Right now, there seems to be only one committer with deep domain
  knowledge, you ;) Another possibility -- your (3) -- would be to flush
  out another (last?) 0.x release to get trunk out there for 0.x users,
  then release 1.0 which would be the new API. It seems self-defeating to
  release a 1.0 knowing the API is not going to live going forward to 2.0.
  With option (2), you are saying, [imaging] has learned its lessons in
  alpha, it has now grown up to a 1.0-level releasable API. What I do not
  know is how close you are to the new API being done.
 
  In the end, you know the audience best and users that adopt a 0.x
 product
  should know that they are taking on a certain level of risk. In
 addition,
  no one is forcing them to update to 1.0. Since you are doing the work,
 I'll
  support your efforts with option (1). If you called for a [POLL] email
 on
  the user's ML, my guess is that users would be happy with a non-breaking
  1.0 release.
 
  I know that our release process is painful, you might have seen
 discussions
  about it recently, but keep on going, it seems we are close.
 
  Gary
 
 
 
   Gary
  
  
   2. Adding my large change now and API-breaking everything in trunk,
   then releasing that as 1.0.
   3. Releasing what is in SVN trunk now (maybe minus another API
   

Re: [imaging] Plan for 1.0.0 release

2013-10-22 Thread Matt Benson
If the API will be extensible, that's perhaps a different matter, although
in that case maybe the extensible part should be an interface implemented
by ImageFormat's constants. In this case we could convert ImageFormat to an
enum now and still make the API extensible later on.

Does this sound feasible?

Matt


On Tue, Oct 22, 2013 at 2:12 PM, Damjan Jovanovic dam...@apache.org wrote:

 I would like to avoid an enum there for later versions because I'd
 like to make the API extensible with user-defined image formats, but
 we can add it for 1.0.0.

 Damjan

 On Tue, Oct 22, 2013 at 9:00 PM, Matt Benson gudnabr...@gmail.com wrote:
  At some point I had had it in mind that ImageFormat should be converted
 to
  a proper enum type.  Can anyone offer any reasons this should not be
 done,
  particularly before 1.0.0?
 
  Matt
 
 
  On Tue, Oct 22, 2013 at 1:44 PM, Damjan Jovanovic damjan@gmail.com
 wrote:
 
  Yes I agree, we might as well release trunk as 1.0.0. I am fixing the
  last few bugs in Jira, and then let's get started with the release
  :-). Support would be appreciated.
 
  Damjan
 
  On Tue, Oct 22, 2013 at 8:19 PM, Raul Kripalani r...@evosent.com
 wrote:
   Hello,
  
   @Gregory – many thanks for your input. You surely belong very valid
  points
   to the discussion.
  
   The issue I see is that Apache Sanselan 0.97 has such a wide adoption
 in
   the community that even in spite of the last public release being an
   Incubator one, it has earned itself the status of a de-facto library
 for
   image processing out there. It's quite mature and stable for the
 standard
   use cases. IMHO, release 0.97 has the status and bearing of a release
  1.0.0
   already.
  
   Want it or not, this means that you'll find yourself supporting the
  current
   API baseline for quite some time ;-) Bear in mind that the Sanselan
 use
   cases are typically quite static: once you've built your image
 processing
   functionality into your app, it'll probably remain untouched for a
 long
   time. So the user has some functional changes to make in your app,
 they
   won't consider upgrading, let alone investing the effort to adapt
 their
   code to an entirely new API just for the sake of it.
  
   So, in a nutshell, it seems adequate to publish the current trunk as
   version 1.0.0, as folks are indeed already treating it as such out
 there.
  
   @Damjan – what's your take? I can support you these days if you
 decide to
   push out 1.0.0 now!
  
   Regards,
  
   *Raúl Kripalani*
   Apache Camel PMC Member  Committer | Enterprise Architect, Open
 Source
   Integration specialist
   http://about.me/raulkripalani |
 http://www.linkedin.com/in/raulkripalani
   http://blog.raulkr.net | twitter: @raulvk
  
   On Mon, Oct 21, 2013 at 5:23 PM, Gary Gregory garydgreg...@gmail.com
  wrote:
  
   On Mon, Oct 21, 2013 at 10:30 AM, Gary Gregory 
 garydgreg...@gmail.com
   wrote:
  
On Mon, Oct 21, 2013 at 9:47 AM, Damjan Jovanovic 
 dam...@apache.org
   wrote:
   
Well as the only committer that's really working on the
 internals, I
am wondering what to do myself now.
   
I've been working on (and have almost finished) a very large
 change
affecting virtually everything. When I commit it, the API will
 come
apart at the seams :-/, and people will not be very happy with the
rewrites of their own code they'll be doing.
   
Which of the following would be best:
1. Releasing what is in SVN trunk now (maybe minus another API
breaking change from a few months ago) as 1.0, then adding my
 large
API-breaking change which will eventually be released as version
 2.0.
   
   
Remember that you'll have to change the package name and Maven
   coordinates
for 2.0.
   
  
   The good news is that version 0.97 is in the old package name
   org.apache.sanselan. This means no jar hell for 1.0
   (org.apache.commons.imaging) vs. 0.97. 1.0 which will co-exist with
  0.97 in
   the same class loader. With option (1), upgrading from 0.97 to 1.0
 will
   mean AT LEAST updating all package imports, not that bad. Make sure
 you
   write good release notes ;)
  
   Let me also offer a bit of perspective for your consideration.
  Releasing an
   option (1) 1.0 means supporting it to some extent on the ML and with
   possible maintenance releases. Since 2.0 is incompatible, do you
 really
   want to take on maintaining two large code bases (or three if you
 count
   0.97)? Right now, there seems to be only one committer with deep
 domain
   knowledge, you ;) Another possibility -- your (3) -- would be to
 flush
   out another (last?) 0.x release to get trunk out there for 0.x
 users,
   then release 1.0 which would be the new API. It seems self-defeating
 to
   release a 1.0 knowing the API is not going to live going forward to
 2.0.
   With option (2), you are saying, [imaging] has learned its lessons in
   alpha, it has now grown up to a 1.0-level releasable API. What I do
 not
   know is how close

Re: What is 'jsvc' and how do I get rid of it?

2013-10-22 Thread Matt Benson
Are you running Java-based processes, e.g. Apache Tomcat or any derivative
thereof, on this VM?

Matt


On Tue, Oct 22, 2013 at 3:17 PM, Jay Vee jvsr...@gmail.com wrote:

 I have a BSD VM that I pay for.  I pay for memory usage and keep getting
 overage notices and have to pay a buck or two every week.

 I was told that the 'jsvc' process is taking up 60% of my daily cpu.


1. What is 'jsvc'?
2. How did I get it ( I do not remember buying it or installing it )?
3. How do I turn it off?
4. How do I get rid of it forever?
5. How do I make sure I never get it again?

 I seriously do not think I need it.  If I needed it, I would have installed
 it.

 These dollars add up and are now cutting into my burrito budget.
  seriously.



Re: What is 'jsvc' and how do I get rid of it?

2013-10-22 Thread Matt Benson
Our local Tomcat and [daemon] experts will probably be of more use.  You
can certainly run Tomcat without jsvc, but I don't know anything about your
setup, or what you'd be sacrificing by not using jsvc.

Matt


On Tue, Oct 22, 2013 at 3:49 PM, Jay Vee jvsr...@gmail.com wrote:

 I am running Apache and Tomcat.  I have a few simple html pages .html and
 no web apps at the moment.  If this is needed, is there an alternative?  If
 it is needed does it have to take up 60% of the cpu doing nothing all the
 time?  I have no web apps installed at the moment.

 thanks for the help.


 On Tue, Oct 22, 2013 at 2:41 PM, Matt Benson gudnabr...@gmail.com wrote:

 Are you running Java-based processes, e.g. Apache Tomcat or any derivative
 thereof, on this VM?

 Matt


 On Tue, Oct 22, 2013 at 3:17 PM, Jay Vee jvsr...@gmail.com wrote:

  I have a BSD VM that I pay for.  I pay for memory usage and keep getting
  overage notices and have to pay a buck or two every week.
 
  I was told that the 'jsvc' process is taking up 60% of my daily cpu.
 
 
 1. What is 'jsvc'?
 2. How did I get it ( I do not remember buying it or installing it )?
 3. How do I turn it off?
 4. How do I get rid of it forever?
 5. How do I make sure I never get it again?
 
  I seriously do not think I need it.  If I needed it, I would have
 installed
  it.
 
  These dollars add up and are now cutting into my burrito budget.
   seriously.
 





Re: [imaging] Plan for 1.0.0 release

2013-10-22 Thread Matt Benson
I thought we had been discussing possibly adding some breaking changes for
1.0.0.  That said, I would personally be -0 to imaging1, though I have to
skin in the game.

Matt


On Tue, Oct 22, 2013 at 4:10 PM, sebb seb...@gmail.com wrote:

 On 22 October 2013 21:34, Gary Gregory garydgreg...@gmail.com wrote:
  This might be too wacky but I thought I'd offer it up anyway.
 
  It looks like we are going to go with a 1.0 release from trunk RSN.
  We known 2.0 will break BC and will come in a o.a.c.imaging2 package.
  So, why not release 1.0 in a package o.a.c.imaging1?

 This will break compatibility with 0.9.7.
 I thought the idea was to release a compatible version?

  Gary
 
 
  On Tue, Oct 22, 2013 at 3:40 PM, Damjan Jovanovic dam...@apache.org
 wrote:
 
  Wow, that's a really good idea!
 
  Yes it's feasible. If you'd like to write and commit a patch for it,
 feel
  free.
 
  Damjan
 
  On Tue, Oct 22, 2013 at 9:23 PM, Matt Benson gudnabr...@gmail.com
 wrote:
   If the API will be extensible, that's perhaps a different matter,
  although
   in that case maybe the extensible part should be an interface
 implemented
   by ImageFormat's constants. In this case we could convert ImageFormat
 to
  an
   enum now and still make the API extensible later on.
  
   Does this sound feasible?
  
   Matt
  
  
   On Tue, Oct 22, 2013 at 2:12 PM, Damjan Jovanovic dam...@apache.org
  wrote:
  
   I would like to avoid an enum there for later versions because I'd
   like to make the API extensible with user-defined image formats, but
   we can add it for 1.0.0.
  
   Damjan
  
   On Tue, Oct 22, 2013 at 9:00 PM, Matt Benson gudnabr...@gmail.com
  wrote:
At some point I had had it in mind that ImageFormat should be
  converted
   to
a proper enum type.  Can anyone offer any reasons this should not
 be
   done,
particularly before 1.0.0?
   
Matt
   
   
On Tue, Oct 22, 2013 at 1:44 PM, Damjan Jovanovic 
  damjan@gmail.com
   wrote:
   
Yes I agree, we might as well release trunk as 1.0.0. I am fixing
 the
last few bugs in Jira, and then let's get started with the release
:-). Support would be appreciated.
   
Damjan
   
On Tue, Oct 22, 2013 at 8:19 PM, Raul Kripalani r...@evosent.com
 
   wrote:
 Hello,

 @Gregory – many thanks for your input. You surely belong very
 valid
points
 to the discussion.

 The issue I see is that Apache Sanselan 0.97 has such a wide
  adoption
   in
 the community that even in spite of the last public release
 being
  an
 Incubator one, it has earned itself the status of a de-facto
  library
   for
 image processing out there. It's quite mature and stable for the
   standard
 use cases. IMHO, release 0.97 has the status and bearing of a
  release
1.0.0
 already.

 Want it or not, this means that you'll find yourself supporting
 the
current
 API baseline for quite some time ;-) Bear in mind that the
 Sanselan
   use
 cases are typically quite static: once you've built your image
   processing
 functionality into your app, it'll probably remain untouched
 for a
   long
 time. So the user has some functional changes to make in your
 app,
   they
 won't consider upgrading, let alone investing the effort to
 adapt
   their
 code to an entirely new API just for the sake of it.

 So, in a nutshell, it seems adequate to publish the current
 trunk
  as
 version 1.0.0, as folks are indeed already treating it as such
 out
   there.

 @Damjan – what's your take? I can support you these days if you
   decide to
 push out 1.0.0 now!

 Regards,

 *Raúl Kripalani*
 Apache Camel PMC Member  Committer | Enterprise Architect, Open
   Source
 Integration specialist
 http://about.me/raulkripalani |
   http://www.linkedin.com/in/raulkripalani
 http://blog.raulkr.net | twitter: @raulvk

 On Mon, Oct 21, 2013 at 5:23 PM, Gary Gregory 
  garydgreg...@gmail.com
wrote:

 On Mon, Oct 21, 2013 at 10:30 AM, Gary Gregory 
   garydgreg...@gmail.com
 wrote:

  On Mon, Oct 21, 2013 at 9:47 AM, Damjan Jovanovic 
   dam...@apache.org
 wrote:
 
  Well as the only committer that's really working on the
   internals, I
  am wondering what to do myself now.
 
  I've been working on (and have almost finished) a very large
   change
  affecting virtually everything. When I commit it, the API
 will
   come
  apart at the seams :-/, and people will not be very happy
 with
  the
  rewrites of their own code they'll be doing.
 
  Which of the following would be best:
  1. Releasing what is in SVN trunk now (maybe minus another
 API
  breaking change from a few months ago) as 1.0, then adding
 my
   large
  API-breaking change which will eventually be released as
  version
   2.0.
 
 
  Remember that you'll have to change the package name and
 Maven

Re: [proxy] Remove Remoting Providers in 2.x...

2013-07-29 Thread Matt Benson
Guilty ;-)
On Jul 29, 2013 6:26 AM, James Carman ja...@carmanconsulting.com wrote:

 I did not intent to send it twice at all! :)  I actually sent it from
 two different accounts.  It didn't go through the first time, because
 the first account is not registered (someone must have moderated it
 through, though).

 On Mon, Jul 29, 2013 at 7:21 AM, Benedikt Ritter brit...@apache.org
 wrote:
  Okay so you intended to send it to the dev ML and the user ML once?
 Because
  it appears that you've send it to the user ML twice instead ;-)
 
  Benedikt
 
 
  2013/7/29 James Carman ja...@carmanconsulting.com
 
  Well, I wanted a broader audience, since it would impact users (if
  there are any).
 
  On Mon, Jul 29, 2013 at 7:10 AM, Benedikt Ritter brit...@apache.org
  wrote:
   Hi James,
  
   I guess this was supposed to go to the dev ML?
  
   Benedikt
  
  
   2013/7/28 James Carman jcar...@savoirtech.com
  
   All,
  
   I would doubt the remoting providers are really used by anyone, but
 we
   should probably ask before removing them.  We currently support the
   following remoting protocols:
  
   - Burlap
   - Hessian
   - Jax-RPC
   - RMI
   - Session Beans
  
   Are there any objections to removing them?  These technologies are
   somewhat outdated.
  
   Thanks,
  
   James
   -
   To unsubscribe, e-mail: user-unsubscr...@commons.apache.org
   For additional commands, e-mail: user-h...@commons.apache.org
  
  
  
  
   --
   http://people.apache.org/~britter/
   http://www.systemoutprintln.de/
   http://twitter.com/BenediktRitter
   http://github.com/britter
 
  -
  To unsubscribe, e-mail: user-unsubscr...@commons.apache.org
  For additional commands, e-mail: user-h...@commons.apache.org
 
 
 
 
  --
  http://people.apache.org/~britter/
  http://www.systemoutprintln.de/
  http://twitter.com/BenediktRitter
  http://github.com/britter

 -
 To unsubscribe, e-mail: user-unsubscr...@commons.apache.org
 For additional commands, e-mail: user-h...@commons.apache.org




Re: [math] Mean, Median but no Mode?

2013-07-04 Thread Matt Benson
I don't know about [math], but [lang] 3.x has mean, median and mode in
ObjectUtils.

Matt
On Jul 4, 2013 10:25 AM, Ben Titmarsh ben.titma...@hotmail.co.uk wrote:

 Hi,

 I am looking for a library that can provide the mode (
 http://en.wikipedia.org/wiki/Mode_%28statistics%29) of a set numbers.
 This is a simple arithmetic operation but I am unable to find a reference
 to this in the documentation.  Can anyone point it out to me, if not
 suggest why it is not supported?

 Thanks,
 Ben.



Re: [jxpath] querying an html file

2013-03-12 Thread Matt Benson
Can you put together a small test case that illustrates the problem?

Matt


On Tue, Mar 12, 2013 at 6:49 AM, MASTRELLA STEFANO smastre...@sogei.itwrote:


 Hi all,

 I'm trying to use jxpath-1.3 to query the content of some tags within an
 html fragment.
 Given the file 'html.frag.response.html' I want to explore all the TR
 tag in the document.

 For what I know I can do this stuff with the following lines of code:

   String tableFragment = loadfromthefile();

   JXPathContext context = JXPathContext.newContext(tableFragment);

   Iterator it = context.iteratePointers(//TR);

   while (it.hasNext()) {
  Pointer msgPointer = (Pointer) it.next();

  msgPointer.asPath();

  System.out.println(msgPointer);

 What I get is always an empty Iterator so there's nothing to iterate on,
 as there were no TR tag
 in the document.

 What am I doing wrong?

 TIA.

 ---
 Stefano


 -
 To unsubscribe, e-mail: user-unsubscr...@commons.apache.org
 For additional commands, e-mail: user-h...@commons.apache.org



Re: [JXPath] Can JXPath help me with processing collection based tree?

2012-11-02 Thread Matt Benson
As Jun suggests, a custom extension function [1] is probably in order
to keep your expressions reasonably (!) short.  Assuming you want to
use JXPath without modifying any of your existing code, I would
recommend trying to write a custom function that makes the call to
retrieve the name.  Then your expression might look like
.[mynode:getName() = 'nodeName1']/.[mynode:getName() = 'nodeName2']
etc.  ISTR JXPath having a bit of trouble processing a collection as
the root, so you might experiment with making your IMyNodeAggregate be
a property of your root, or even the value of a variable.

Thinking further, you might get some mileage out of doing some custom
interface implementations.  The discussion of maps [2] in the user
guide makes reference to the customization needed to treat any
arbitrary structure similarly to a map, which arguably your
IMyNodeAggregate is.

HTH,
Matt

[1] http://commons.apache.org/jxpath/users-guide.html#Custom_Extension_Functions
[2] http://commons.apache.org/jxpath/users-guide.html#Map_Element_Access

On Fri, Nov 2, 2012 at 11:59 AM, Jun Ouyang jouya...@mail.ccsf.edu wrote:
 Sorry I am on transit right now so i cant give u a full and proper.respond.
 But i think you can create your own jxpath function and invoke it to match
 your need. In this case the function shall check if names are equal?
 On Nov 2, 2012 9:47 AM, we9 w...@o2.pl wrote:


 I started to write some methods which process tree structure. The queries
 are based on XPath. And now, I discovered JXPath. I was reading user-guide,
 but I didn't find what I want.
 I must be sure that there is no posibility to do this with JXPath.

 I have the following interfaces:
 interface IMyNode
 interface IMyNodeAggregateC extends IMyNode implements CollectionC,
 IMyNode

 I want to pass some root (instance of IMyAggregate) and using XPath
 notation (eg. /nodeName1//nodeName2/**nodeName3) get proper IMyNode
 instances. Name of IMyNode is avaliable by calling
 myNode.someService().getName() so maybe some interface JXPath should be
 implemented?

 Please answer me if JXPath can help me?

 Thank you in advance,
 Kamil

 --**--**-
 To unsubscribe, e-mail: 
 user-unsubscribe@commons.**apache.orguser-unsubscr...@commons.apache.org
 For additional commands, e-mail: user-h...@commons.apache.org



-
To unsubscribe, e-mail: user-unsubscr...@commons.apache.org
For additional commands, e-mail: user-h...@commons.apache.org



Re: [jxpath] - Error trying to query boolean values

2012-07-05 Thread Matt Benson
On Tue, Jul 3, 2012 at 8:58 PM, Lucas Reginato lucas.regin...@gmail.com wrote:
 I will try to make this change (from is method to get method) tomorrow and
 will send the results.

 But imagine the scenario: you have a product (which was already shipped to
 customers) that has an API.
 And your product also presents the possibility to query values from XML
 using Xpath.
 What do you suggest for this specific product that was already shipped and
 now customer are using xpath to retrieve boolean values without success?

 Yes, we can use XSLT to get the boolean value, but I think apache should fix
 this.
 I mean, apache commons xpath should be able to work with get/set/is methods
 and not only get/set.

The thing is, [jxpath] works with Java bean style accessors, but
Boolean isFoo() is by definition not one such and is therefore by
default just another method.  I think you're saying that what you
want is a way to interact with the Java API you already have; in this
case I think your best best would be an extension function [1].  The
example of calling regular methods just might do the truck here.

Matt

[1] 
http://commons.apache.org/jxpath/users-guide.html#Standard_Extension_Functions


 Do you think it's possible to file a new issue for this?

 -Lucas


 On Tue, Jul 3, 2012 at 10:33 PM, Matt Benson gudnabr...@gmail.com wrote:

 Good call; yes, being an Object Boolean, the is idiom does not work.

 Matt

 On Tue, Jul 3, 2012 at 8:11 PM, Lucas Reginato lucas.regin...@gmail.com
 wrote:
  Yes,
 
  The example is incorrect, it should be lower case, my mistake.
  If you try to execute my example you will see this issue.
 
  Did you see the java code that was generated?
  Maybe if the is methods where change to get method, will it work?
 
  -Lucas
 
  On Tue, Jul 3, 2012 at 6:55 PM, Matt Benson gudnabr...@gmail.com
  wrote:
 
  Have you tried /isUsaResident?  Javabean property names typically
  begin with lower case.
 
  HTH,
  Matt
 
  On Tue, Jul 3, 2012 at 4:41 PM, Lucas Reginato
  lucas.regin...@gmail.com
  wrote:
   Hi,
  
  
  
   I’m facing a strange behavior using xPath to query boolean values.
  
   Every time I tried to query boolean values with xPath, I get an
   exception
   saying that no value was found.
  
  
   The exception is:
  
   org.apache.commons.jxpath.JXPathNotFoundException: No value for
   xpath:
   myXpath
  
  
   Let me present the complete example that I'm using:
  
  
   This is my schema:
  
   ?xml version=1.0?
   xs:schema xmlns:xs=http://www.w3.org/2001/XMLSchema; xmlns:xsi=
   http://www.w3.org/2001/XMLSchema-instance; xmlns=http://mySchema;
   xmlns:jaxb=http://java.sun.com/xml/ns/jaxb; xmlns:xjc=
   http://java.sun.com/xml/ns/jaxb/xjc;
   targetNamespace=http://mySchema;
   elementFormDefault=qualified jaxb:extensionBindingPrefixes=xjc
   jaxb:version=2.0
   xs:annotation
   xs:appinfo
   jaxb:globalBindings
   xjc:serializable/
   /jaxb:globalBindings
   /xs:appinfo
   /xs:annotation
   !-- Base type definitions--
   xs:complexType name=MyEntity
   xs:sequence
   xs:element name=Id type=xs:string minOccurs=0
   maxOccurs=1/
   xs:element name=Name type=xs:string minOccurs=0
   maxOccurs=1/
   xs:element name=IsUsaResident type=xs:boolean
   minOccurs=0 maxOccurs=1/
   xs:element name=AnotherBooleanValue type=xs:boolean
   minOccurs=0 maxOccurs=1/
   /xs:sequence
   /xs:complexType
   !--Root Element--
   xs:element name=MyEntity type=MyEntity/
   /xs:schema
  
  
   In order to generate my java classes based on the schema, I'm using
   the
   xjc
   ant tag.
  
   My generated class looks like this:
  
  
   package myschema;
   import java.io.Serializable;
   import javax.xml.bind.annotation.XmlAccessType;
   import javax.xml.bind.annotation.XmlAccessorType;
   import javax.xml.bind.annotation.XmlElement;
   import javax.xml.bind.annotation.XmlType;
   @XmlAccessorType(XmlAccessType.FIELD)
   @XmlType(name = MyEntity, propOrder = {
   id,
   name,
   isUsaResident,
   anotherBooleanValue
   })
   public class MyEntity implements Serializable{
   @XmlElement(name = Id)
   protected String id;
   @XmlElement(name = Name)
   protected String name;
   @XmlElement(name = IsUsaResident)
   protected Boolean isUsaResident;
   @XmlElement(name = AnotherBooleanValue)
   protected Boolean anotherBooleanValue;
   public String getId() { return id; }
   public void setId(String value) { this.id = value; }
   public String getName() { return name; }
   public void setName(String value) { this.name = value; }
   public Boolean isIsUsaResident() { return isUsaResident; }
   public void setIsUsaResident(Boolean value) { this.isUsaResident
   =
   value; }
   public Boolean isAnotherBooleanValue() { return
   anotherBooleanValue

Re: [jxpath] - Error trying to query boolean values

2012-07-05 Thread Matt Benson
On Thu, Jul 5, 2012 at 2:25 PM, Lucas Reginato lucas.regin...@yoppa.com wrote:
 I tried your suggestion without success. :(

 Using the xPath myschema.MyEntity.new() returns a new object. Cool.

 But using the xPath myschema.MyEntity.getName() I got the following
 exception:

 org.apache.commons.jxpath.JXPathInvalidAccessException: Cannot invoke public
 java.lang.String myschema.MyEntity.getName(); java.lang.NullPointerException
 at
 org.apache.commons.jxpath.functions.MethodFunction.invoke(MethodFunction.java:99)
 at
 org.apache.commons.jxpath.ri.compiler.ExtensionFunction.computeValue(ExtensionFunction.java:102)
 at
 org.apache.commons.jxpath.ri.JXPathContextReferenceImpl.getValue(JXPathContextReferenceImpl.java:353)
 at
 org.apache.commons.jxpath.ri.JXPathContextReferenceImpl.getValue(JXPathContextReferenceImpl.java:313)
 at Main.main(Main.java:20)
 Caused by: java.lang.NullPointerException
 at
 org.apache.commons.jxpath.functions.MethodFunction.invoke(MethodFunction.java:79)
 ... 4 more

 The same happen for myschema.MyEntity.isIsUsaResident()

 Am I missing something?

What *I* am missing is an example of what you've tried here ;P

Matt


 -Lucas


 On Thu, Jul 5, 2012 at 12:14 PM, Matt Benson gudnabr...@gmail.com wrote:

 On Tue, Jul 3, 2012 at 8:58 PM, Lucas Reginato lucas.regin...@gmail.com
 wrote:
  I will try to make this change (from is method to get method) tomorrow
  and
  will send the results.
 
  But imagine the scenario: you have a product (which was already shipped
  to
  customers) that has an API.
  And your product also presents the possibility to query values from XML
  using Xpath.
  What do you suggest for this specific product that was already shipped
  and
  now customer are using xpath to retrieve boolean values without success?
 
  Yes, we can use XSLT to get the boolean value, but I think apache should
  fix
  this.
  I mean, apache commons xpath should be able to work with get/set/is
  methods
  and not only get/set.

 The thing is, [jxpath] works with Java bean style accessors, but
 Boolean isFoo() is by definition not one such and is therefore by
 default just another method.  I think you're saying that what you
 want is a way to interact with the Java API you already have; in this
 case I think your best best would be an extension function [1].  The
 example of calling regular methods just might do the truck here.

 Matt

 [1]
 http://commons.apache.org/jxpath/users-guide.html#Standard_Extension_Functions

 
  Do you think it's possible to file a new issue for this?
 
  -Lucas
 
 
  On Tue, Jul 3, 2012 at 10:33 PM, Matt Benson gudnabr...@gmail.com
  wrote:
 
  Good call; yes, being an Object Boolean, the is idiom does not work.
 
  Matt
 
  On Tue, Jul 3, 2012 at 8:11 PM, Lucas Reginato
  lucas.regin...@gmail.com
  wrote:
   Yes,
  
   The example is incorrect, it should be lower case, my mistake.
   If you try to execute my example you will see this issue.
  
   Did you see the java code that was generated?
   Maybe if the is methods where change to get method, will it work?
  
   -Lucas
  
   On Tue, Jul 3, 2012 at 6:55 PM, Matt Benson gudnabr...@gmail.com
   wrote:
  
   Have you tried /isUsaResident?  Javabean property names typically
   begin with lower case.
  
   HTH,
   Matt
  
   On Tue, Jul 3, 2012 at 4:41 PM, Lucas Reginato
   lucas.regin...@gmail.com
   wrote:
Hi,
   
   
   
I’m facing a strange behavior using xPath to query boolean values.
   
Every time I tried to query boolean values with xPath, I get an
exception
saying that no value was found.
   
   
The exception is:
   
org.apache.commons.jxpath.JXPathNotFoundException: No value for
xpath:
myXpath
   
   
Let me present the complete example that I'm using:
   
   
This is my schema:
   
?xml version=1.0?
xs:schema xmlns:xs=http://www.w3.org/2001/XMLSchema; xmlns:xsi=
http://www.w3.org/2001/XMLSchema-instance; xmlns=http://mySchema;
xmlns:jaxb=http://java.sun.com/xml/ns/jaxb; xmlns:xjc=
http://java.sun.com/xml/ns/jaxb/xjc;
targetNamespace=http://mySchema;
elementFormDefault=qualified jaxb:extensionBindingPrefixes=xjc
jaxb:version=2.0
xs:annotation
xs:appinfo
jaxb:globalBindings
xjc:serializable/
/jaxb:globalBindings
/xs:appinfo
/xs:annotation
!-- Base type definitions--
xs:complexType name=MyEntity
xs:sequence
xs:element name=Id type=xs:string minOccurs=0
maxOccurs=1/
xs:element name=Name type=xs:string minOccurs=0
maxOccurs=1/
xs:element name=IsUsaResident type=xs:boolean
minOccurs=0 maxOccurs=1/
xs:element name=AnotherBooleanValue
type=xs:boolean
minOccurs=0 maxOccurs=1/
/xs:sequence
/xs:complexType
!--Root Element--
xs:element name

Re: [jxpath] - Error trying to query boolean values

2012-07-05 Thread Matt Benson
On Thu, Jul 5, 2012 at 2:25 PM, Lucas Reginato lucas.regin...@yoppa.com wrote:
 I tried your suggestion without success. :(

 Using the xPath myschema.MyEntity.new() returns a new object. Cool.

 But using the xPath myschema.MyEntity.getName() I got the following

Okay, I see you're saying you're actually trying the above as your
xpath, but that's more like the static method example.  I was thinking
along the lines of getName(.).  What does this give you?

Matt

 exception:

 org.apache.commons.jxpath.JXPathInvalidAccessException: Cannot invoke public
 java.lang.String myschema.MyEntity.getName(); java.lang.NullPointerException
 at
 org.apache.commons.jxpath.functions.MethodFunction.invoke(MethodFunction.java:99)
 at
 org.apache.commons.jxpath.ri.compiler.ExtensionFunction.computeValue(ExtensionFunction.java:102)
 at
 org.apache.commons.jxpath.ri.JXPathContextReferenceImpl.getValue(JXPathContextReferenceImpl.java:353)
 at
 org.apache.commons.jxpath.ri.JXPathContextReferenceImpl.getValue(JXPathContextReferenceImpl.java:313)
 at Main.main(Main.java:20)
 Caused by: java.lang.NullPointerException
 at
 org.apache.commons.jxpath.functions.MethodFunction.invoke(MethodFunction.java:79)
 ... 4 more

 The same happen for myschema.MyEntity.isIsUsaResident()

 Am I missing something?

 -Lucas


 On Thu, Jul 5, 2012 at 12:14 PM, Matt Benson gudnabr...@gmail.com wrote:

 On Tue, Jul 3, 2012 at 8:58 PM, Lucas Reginato lucas.regin...@gmail.com
 wrote:
  I will try to make this change (from is method to get method) tomorrow
  and
  will send the results.
 
  But imagine the scenario: you have a product (which was already shipped
  to
  customers) that has an API.
  And your product also presents the possibility to query values from XML
  using Xpath.
  What do you suggest for this specific product that was already shipped
  and
  now customer are using xpath to retrieve boolean values without success?
 
  Yes, we can use XSLT to get the boolean value, but I think apache should
  fix
  this.
  I mean, apache commons xpath should be able to work with get/set/is
  methods
  and not only get/set.

 The thing is, [jxpath] works with Java bean style accessors, but
 Boolean isFoo() is by definition not one such and is therefore by
 default just another method.  I think you're saying that what you
 want is a way to interact with the Java API you already have; in this
 case I think your best best would be an extension function [1].  The
 example of calling regular methods just might do the truck here.

 Matt

 [1]
 http://commons.apache.org/jxpath/users-guide.html#Standard_Extension_Functions

 
  Do you think it's possible to file a new issue for this?
 
  -Lucas
 
 
  On Tue, Jul 3, 2012 at 10:33 PM, Matt Benson gudnabr...@gmail.com
  wrote:
 
  Good call; yes, being an Object Boolean, the is idiom does not work.
 
  Matt
 
  On Tue, Jul 3, 2012 at 8:11 PM, Lucas Reginato
  lucas.regin...@gmail.com
  wrote:
   Yes,
  
   The example is incorrect, it should be lower case, my mistake.
   If you try to execute my example you will see this issue.
  
   Did you see the java code that was generated?
   Maybe if the is methods where change to get method, will it work?
  
   -Lucas
  
   On Tue, Jul 3, 2012 at 6:55 PM, Matt Benson gudnabr...@gmail.com
   wrote:
  
   Have you tried /isUsaResident?  Javabean property names typically
   begin with lower case.
  
   HTH,
   Matt
  
   On Tue, Jul 3, 2012 at 4:41 PM, Lucas Reginato
   lucas.regin...@gmail.com
   wrote:
Hi,
   
   
   
I’m facing a strange behavior using xPath to query boolean values.
   
Every time I tried to query boolean values with xPath, I get an
exception
saying that no value was found.
   
   
The exception is:
   
org.apache.commons.jxpath.JXPathNotFoundException: No value for
xpath:
myXpath
   
   
Let me present the complete example that I'm using:
   
   
This is my schema:
   
?xml version=1.0?
xs:schema xmlns:xs=http://www.w3.org/2001/XMLSchema; xmlns:xsi=
http://www.w3.org/2001/XMLSchema-instance; xmlns=http://mySchema;
xmlns:jaxb=http://java.sun.com/xml/ns/jaxb; xmlns:xjc=
http://java.sun.com/xml/ns/jaxb/xjc;
targetNamespace=http://mySchema;
elementFormDefault=qualified jaxb:extensionBindingPrefixes=xjc
jaxb:version=2.0
xs:annotation
xs:appinfo
jaxb:globalBindings
xjc:serializable/
/jaxb:globalBindings
/xs:appinfo
/xs:annotation
!-- Base type definitions--
xs:complexType name=MyEntity
xs:sequence
xs:element name=Id type=xs:string minOccurs=0
maxOccurs=1/
xs:element name=Name type=xs:string minOccurs=0
maxOccurs=1/
xs:element name=IsUsaResident type=xs:boolean
minOccurs=0 maxOccurs=1/
xs:element name=AnotherBooleanValue
type=xs:boolean
minOccurs=0

Re: [jxpath] - Error trying to query boolean values

2012-07-03 Thread Matt Benson
Have you tried /isUsaResident?  Javabean property names typically
begin with lower case.

HTH,
Matt

On Tue, Jul 3, 2012 at 4:41 PM, Lucas Reginato lucas.regin...@gmail.com wrote:
 Hi,



 I’m facing a strange behavior using xPath to query boolean values.

 Every time I tried to query boolean values with xPath, I get an exception
 saying that no value was found.


 The exception is:

 org.apache.commons.jxpath.JXPathNotFoundException: No value for xpath:
 myXpath


 Let me present the complete example that I'm using:


 This is my schema:

 ?xml version=1.0?
 xs:schema xmlns:xs=http://www.w3.org/2001/XMLSchema; xmlns:xsi=
 http://www.w3.org/2001/XMLSchema-instance; xmlns=http://mySchema;
 xmlns:jaxb=http://java.sun.com/xml/ns/jaxb; xmlns:xjc=
 http://java.sun.com/xml/ns/jaxb/xjc; targetNamespace=http://mySchema;
 elementFormDefault=qualified jaxb:extensionBindingPrefixes=xjc
 jaxb:version=2.0
 xs:annotation
 xs:appinfo
 jaxb:globalBindings
 xjc:serializable/
 /jaxb:globalBindings
 /xs:appinfo
 /xs:annotation
 !-- Base type definitions--
 xs:complexType name=MyEntity
 xs:sequence
 xs:element name=Id type=xs:string minOccurs=0
 maxOccurs=1/
 xs:element name=Name type=xs:string minOccurs=0
 maxOccurs=1/
 xs:element name=IsUsaResident type=xs:boolean
 minOccurs=0 maxOccurs=1/
 xs:element name=AnotherBooleanValue type=xs:boolean
 minOccurs=0 maxOccurs=1/
 /xs:sequence
 /xs:complexType
 !--Root Element--
 xs:element name=MyEntity type=MyEntity/
 /xs:schema


 In order to generate my java classes based on the schema, I'm using the xjc
 ant tag.

 My generated class looks like this:


 package myschema;
 import java.io.Serializable;
 import javax.xml.bind.annotation.XmlAccessType;
 import javax.xml.bind.annotation.XmlAccessorType;
 import javax.xml.bind.annotation.XmlElement;
 import javax.xml.bind.annotation.XmlType;
 @XmlAccessorType(XmlAccessType.FIELD)
 @XmlType(name = MyEntity, propOrder = {
 id,
 name,
 isUsaResident,
 anotherBooleanValue
 })
 public class MyEntity implements Serializable{
 @XmlElement(name = Id)
 protected String id;
 @XmlElement(name = Name)
 protected String name;
 @XmlElement(name = IsUsaResident)
 protected Boolean isUsaResident;
 @XmlElement(name = AnotherBooleanValue)
 protected Boolean anotherBooleanValue;
 public String getId() { return id; }
 public void setId(String value) { this.id = value; }
 public String getName() { return name; }
 public void setName(String value) { this.name = value; }
 public Boolean isIsUsaResident() { return isUsaResident; }
 public void setIsUsaResident(Boolean value) { this.isUsaResident =
 value; }
 public Boolean isAnotherBooleanValue() { return anotherBooleanValue; }
 public void setAnotherBooleanValue(Boolean value) {
 this.anotherBooleanValue = value; }
 }


 And I'm using the following code to query boolean values:
  MyEntity myEntity = new MyEntity();
 myEntity.setId(1);
 myEntity.setName(MyName);
 myEntity.setIsUsaResident(true);
 myEntity.setAnotherBooleanValue(false);
 Object result = ;
 JXPathContext context = JXPathContext.newContext(myEntity);
 try {
 result = context.getValue(/IsUsaResident);
 if (result == null) {
 result = ;
 }
 } catch (JXPathException exc) {
 exc.printStackTrace();
 }
 System.out.println(result.toString());

 Can someone help me with this?

 Thanks,
 -Lucas Reginato

-
To unsubscribe, e-mail: user-unsubscr...@commons.apache.org
For additional commands, e-mail: user-h...@commons.apache.org



Re: [jxpath] - Error trying to query boolean values

2012-07-03 Thread Matt Benson
Good call; yes, being an Object Boolean, the is idiom does not work.

Matt

On Tue, Jul 3, 2012 at 8:11 PM, Lucas Reginato lucas.regin...@gmail.com wrote:
 Yes,

 The example is incorrect, it should be lower case, my mistake.
 If you try to execute my example you will see this issue.

 Did you see the java code that was generated?
 Maybe if the is methods where change to get method, will it work?

 -Lucas

 On Tue, Jul 3, 2012 at 6:55 PM, Matt Benson gudnabr...@gmail.com wrote:

 Have you tried /isUsaResident?  Javabean property names typically
 begin with lower case.

 HTH,
 Matt

 On Tue, Jul 3, 2012 at 4:41 PM, Lucas Reginato lucas.regin...@gmail.com
 wrote:
  Hi,
 
 
 
  I’m facing a strange behavior using xPath to query boolean values.
 
  Every time I tried to query boolean values with xPath, I get an
  exception
  saying that no value was found.
 
 
  The exception is:
 
  org.apache.commons.jxpath.JXPathNotFoundException: No value for xpath:
  myXpath
 
 
  Let me present the complete example that I'm using:
 
 
  This is my schema:
 
  ?xml version=1.0?
  xs:schema xmlns:xs=http://www.w3.org/2001/XMLSchema; xmlns:xsi=
  http://www.w3.org/2001/XMLSchema-instance; xmlns=http://mySchema;
  xmlns:jaxb=http://java.sun.com/xml/ns/jaxb; xmlns:xjc=
  http://java.sun.com/xml/ns/jaxb/xjc; targetNamespace=http://mySchema;
  elementFormDefault=qualified jaxb:extensionBindingPrefixes=xjc
  jaxb:version=2.0
  xs:annotation
  xs:appinfo
  jaxb:globalBindings
  xjc:serializable/
  /jaxb:globalBindings
  /xs:appinfo
  /xs:annotation
  !-- Base type definitions--
  xs:complexType name=MyEntity
  xs:sequence
  xs:element name=Id type=xs:string minOccurs=0
  maxOccurs=1/
  xs:element name=Name type=xs:string minOccurs=0
  maxOccurs=1/
  xs:element name=IsUsaResident type=xs:boolean
  minOccurs=0 maxOccurs=1/
  xs:element name=AnotherBooleanValue type=xs:boolean
  minOccurs=0 maxOccurs=1/
  /xs:sequence
  /xs:complexType
  !--Root Element--
  xs:element name=MyEntity type=MyEntity/
  /xs:schema
 
 
  In order to generate my java classes based on the schema, I'm using the
  xjc
  ant tag.
 
  My generated class looks like this:
 
 
  package myschema;
  import java.io.Serializable;
  import javax.xml.bind.annotation.XmlAccessType;
  import javax.xml.bind.annotation.XmlAccessorType;
  import javax.xml.bind.annotation.XmlElement;
  import javax.xml.bind.annotation.XmlType;
  @XmlAccessorType(XmlAccessType.FIELD)
  @XmlType(name = MyEntity, propOrder = {
  id,
  name,
  isUsaResident,
  anotherBooleanValue
  })
  public class MyEntity implements Serializable{
  @XmlElement(name = Id)
  protected String id;
  @XmlElement(name = Name)
  protected String name;
  @XmlElement(name = IsUsaResident)
  protected Boolean isUsaResident;
  @XmlElement(name = AnotherBooleanValue)
  protected Boolean anotherBooleanValue;
  public String getId() { return id; }
  public void setId(String value) { this.id = value; }
  public String getName() { return name; }
  public void setName(String value) { this.name = value; }
  public Boolean isIsUsaResident() { return isUsaResident; }
  public void setIsUsaResident(Boolean value) { this.isUsaResident =
  value; }
  public Boolean isAnotherBooleanValue() { return anotherBooleanValue;
  }
  public void setAnotherBooleanValue(Boolean value) {
  this.anotherBooleanValue = value; }
  }
 
 
  And I'm using the following code to query boolean values:
   MyEntity myEntity = new MyEntity();
  myEntity.setId(1);
  myEntity.setName(MyName);
  myEntity.setIsUsaResident(true);
  myEntity.setAnotherBooleanValue(false);
  Object result = ;
  JXPathContext context = JXPathContext.newContext(myEntity);
  try {
  result = context.getValue(/IsUsaResident);
  if (result == null) {
  result = ;
  }
  } catch (JXPathException exc) {
  exc.printStackTrace();
  }
  System.out.println(result.toString());
 
  Can someone help me with this?
 
  Thanks,
  -Lucas Reginato

 -
 To unsubscribe, e-mail: user-unsubscr...@commons.apache.org
 For additional commands, e-mail: user-h...@commons.apache.org

 --
 Lucas Rosa Cruz Reginato



-
To unsubscribe, e-mail: user-unsubscr...@commons.apache.org
For additional commands, e-mail: user-h...@commons.apache.org



Re: Class metadata repository

2012-02-18 Thread Matt Benson
Hi Chas,
  Some of us have been planning to work on a component of this type.
Some of Simone Tripodi's ideas are in the [meiyo] sandbox project; the
[classscan] sandbox area has also been reserved, but we haven't yet
added anything here.  Feel free to join in/start the discussion and
submit patches, etc.

Regards,
Matt

On Sun, Feb 19, 2012 at 12:36 AM, Chas Honton c...@honton.org wrote:
 I need to find classes in a jar file marked with an @Entity annotation 
 without instantiating the classes.

 I have written similar functionality for a jdo implemention and for an IOC 
 container by using asm to read the class files.  Now I'm helping out with a 
 jpa implementation.

 Do I need to rewrite this once again or is there a commons component that 
 exposes this capability?  If not, what is a good component to donate such a 
 capability to?

 Thanks,
 Chas

 -
 To unsubscribe, e-mail: user-unsubscr...@commons.apache.org
 For additional commands, e-mail: user-h...@commons.apache.org


-
To unsubscribe, e-mail: user-unsubscr...@commons.apache.org
For additional commands, e-mail: user-h...@commons.apache.org



Re: [FUNCTOR] Location for source?

2012-01-03 Thread Matt Benson
On Tue, Jan 3, 2012 at 10:16 AM, Ed Beaty ebe...@luminexcorp.com wrote:
 Hi, all.  Is the Commons Functor source still available for download, or has 
 it been pulled in preparation for a formal release?  Currently (3 Jan 2012) 
 none of the links  (http://commons.apache.org/functor/download_functor.cgi or 
 http://svn.apache.org/viewvc/commons/sandbox/functor/trunk/ or 
 http://svn.apache.org/repos/asf/commons/sandbox/functor/trunk) are working.
 Thanks,
 Ed Beaty

Hi, [functor] has been moved to proper, but has not yet been released.
 We'll see about getting the site updated.  In the meantime you can
get the code from
http://svn.apache.org/repos/asf/commons/proper/functor/trunk/ , and
feel free to subscribe to our developer list if you'd like to take
part in the forthcoming discussions that will nail down the final
APIs, etc., preceding [functor]'s 1.0 release.

Thanks,
Matt

-
To unsubscribe, e-mail: user-unsubscr...@commons.apache.org
For additional commands, e-mail: user-h...@commons.apache.org



Re: commons lang3: NullArgumentException missing?

2011-12-22 Thread Matt Benson
On Wed, Dec 21, 2011 at 3:41 PM, Karsten Wutzke kwut...@web.de wrote:
 Wow, the Java/JDK is getting dirtier and dirtier with every release. The code

  public Foo(Bar bar) {
     this.bar = Objects.requireNonNull(bar);
  }
 looks really really awful to me.

As opposed to this.bar = Validate.notNull(bar) from commons-lang3? ;)

Matt


 IMO it's time to reimplement the JDK and throw away backward compatibility 
 than introduce patch after patch. At least a second clean API of the JDK 
 should be provided.

 I wonder what others are thinking about this.

 Karsten


 -Ursprüngliche Nachricht-
 Von: Paul Benedict pbened...@apache.org
 Gesendet: 21.12.2011 19:04:48
 An: Commons Users List user@commons.apache.org
 Betreff: Re: commons lang3: NullArgumentException missing?

The official standard in the JDK is to throw NPE for null arguments. Since
JDK 7, they have made API available for this in
java.util.Objects#requireNonNull(). Commons is following the official
direction.
On Dec 21, 2011 10:16 AM, kwut...@web.de wrote:


 ___
 SMS schreiben mit WEB.DE FreeMail - einfach, schnell und
 kostenguenstig. Jetzt gleich testen! http://f.web.de/?mc=021192

 -
 To unsubscribe, e-mail: user-unsubscr...@commons.apache.org
 For additional commands, e-mail: user-h...@commons.apache.org


-
To unsubscribe, e-mail: user-unsubscr...@commons.apache.org
For additional commands, e-mail: user-h...@commons.apache.org



Re: [jxpath] Issue in retrieving value jxpath

2011-09-23 Thread Matt Benson
On Wed, Sep 21, 2011 at 9:54 AM, Shamik Bandopadhyay sham...@gmail.com wrote:
 Hi,

  I'm having an issue in parsing the following XML using jxpath. Here's the
 sample XML.

  ?xml version=1.0 encoding=UTF-8?
 feed xmlns=http://www.w3.org/2005/Atom; xmlns:media=
 http://search.yahoo.com/mrss/; xmlns:openSearch=
 http://a9.com/-/spec/opensearchrss/1.0/; xmlns:gd=
 http://schemas.google.com/g/2005; xmlns:yt=
 http://gdata.youtube.com/schemas/2007;
  entry
    idhttp://gdata.youtube.com/feeds/api/videos/P1lDDu9L5YQ/id
    published2010-09-20T17:41:38.000Z/published
   /entry

    entry
       idhttp://gdata.youtube.com/feeds/api/videos/P1lDDu9L5YQ/id
         published2010-09-20T17:41:38.000Z/published
      /entry
 /feed


 I'm trying to read the contents of entry usig xpath. Heres my code
 snippet.

 String test = the_xml_example_above;

 ByteArrayInputStream is = new ByteArrayInputStream(test.getBytes(UTF-8));
 DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
 DocumentBuilder db = dbf.newDocumentBuilder();
 Document doc22 = db.parse(is);

 JXPathContext ctx = JXPathContext.newContext(doc22);
 List nodes = ctx.selectNodes(/feed/entry);

  Here the list is always 0. Now, if I remove the namespace attributes from
 feed, jxpath is able to resolve the entry nodes. Not sure what's the
 reason behind this.

 I'll appreciate if someone cane provide pointers to this issue.

You've most likely identified your issue yourself.  It should work for
you to choose a prefix to use in your xpath queries, and register that
prefix to the Atom namespace before querying.

Matt


 -Thanks


-
To unsubscribe, e-mail: user-unsubscr...@commons.apache.org
For additional commands, e-mail: user-h...@commons.apache.org



Re: [jxpath] JXPath 1.4 release date

2011-08-16 Thread Matt Benson
Hi, Martin.  No concrete plans as yet, but keep prodding and we'll see
what can be done.  :)

Matt

On Tue, Aug 16, 2011 at 8:25 AM, mainz...@bluewin.ch
mainz...@bluewin.ch wrote:
 Hello

 First of all: Thanks for JXPath, it is a wonderful library that helps us a 
 lot!

 I wanted to ask whether there
 are already plans for a release of JXPath 1.4. I ran into a bug that has 
 already been fixed on the trunk and would
 rather avoid depending on a snapshot release.

 Cheers,

 Martin

 -
 To unsubscribe, e-mail: user-unsubscr...@commons.apache.org
 For additional commands, e-mail: user-h...@commons.apache.org



-
To unsubscribe, e-mail: user-unsubscr...@commons.apache.org
For additional commands, e-mail: user-h...@commons.apache.org



Re: [jxpath] Passing casting information within a path-based setter?

2011-07-29 Thread Matt Benson
Quick potential suggestions:

- Set some property on the parent, and query it in your factory
- Subclass TheObject and override the dataArray accessors to TheChild[]
- Use a different factory instance that does what you want

Matt

On Fri, Jul 29, 2011 at 6:17 PM, Hippo Man hippo.mail...@gmail.com wrote:
 I'm fairly new to JXPath and I have a question for which I was unable to find
 an answer in any of the places I searched for on line. I ask you in advance to
 please forgive me if the answer to my question can be found in some
 easy-to-locate
 place that I happened to overlook.

 Is there a way to do casting within a path-based JXPath setter? I'd like to be
 able to optionally specify that the setting of an item gets done via a
 subclass that
 has more attributes than the parent, but I couldn't find out how to do this.

 I'm sure that my question is not completely clear, so as you read this
 discussion, please look at the Java fragments at the bottom of this message
 to see an illustration of what I'm trying to do.

 Consider the sample class (below) called TheObject. It has two attributes:
 a String called name, and an array of TheData objects.

 The TheData class (below) contains a single String attribute called item.

 There is a subclass of TheData called TheChild, and it contains a String
 attribute called varString, a Long attribute called varLong, and a Double
 attribute called varDouble.

 I want to use JXPath path-based setters to set the attributes within 
 TheObject.
 I have implemented an extension of AbstractFactory called ObjectFactory
 to aid in this procedure. ObjectFactory also appears below.

 In the main method of TheObject, I instantiate my JXPath context and attach
 my ObjectFactory, after which I set some attributes. As you can see in my
 example, this works fine as long as I want my dataArray to be instantiated
 as an array of TheData objects and then set the item attribute of one of
 these instances.

 But sometimes, I might want to instantiate dataArray with an array of 
 TheChild
 objects. I would like this instantiation to take place within
 createObject, and I'd
 like it to be able to determine at runtime via some sort of syntax in
 the path setter
 that createObject should instantiate with TheChild objects instead of 
 TheData
 objects.

 In other words, is there some sort of casting syntax that I can pass into 
 the
 path setter which I can then see within the name or pointer parameters to
 createObject which can tell me that I have to instantiate that array with
 TheChild objects instead of TheData objects?

 For the purpose of illustration, I gave an unworkable example of casting
 syntax within the main method of TheObject, below. That example shows
 exactly what I'm trying to do.

 Thanks in advance for any pointers to documentation or any other help that
 any of you might be able to give me.

 Here are the Java code fragments that I mentioned above ...

 public class TheObject {
    protected String      name      = null;
    protected TheData[]   dataArray = null;
    // constructor, getters, setters, and toString have been left out

    public static void main(String[] argv) {
        TheObject obj = new TheObject();
        JXPathContext context = JXPathContext.newContext(obj);
        context.setFactory(new ObjectFactory());

        context.createPathAndSetValue(/name, foo); // this works
        context.createPathAndSetValue(/dataArray[1]/item, bar);
 // this works

        // But instead of setting item as I did above, is there something
        // I can do syntactically in the path that I can see within the name
        // or pointer arguments that are passed to the createObject() method
        // of ObjectFactory, which would specify that dataArray should be
        // instantiated as an array of TheChild objects instead of as an array
        // of TheData objects?  Something analogous to this (I know this 
 doesn't
        // work; it's just for illustration) ...

        context.createPathAndSetValue(/{cast to
 TheChild}dataArray[1]/varString, quack);

        System.out.println(obj);

        System.exit(0);
    }
 }

 public class TheData {
    protected String item = null;
    // constructor, getters, setters, and toString have been left out
 }

 public class TheChild extends TheData {
    protected String varString = null;
    protected Long   varLong   = null;
    protected Double varDouble = null;
    // constructor, getters, setters, and toString have been left out
 }

 public class ObjectFactory extends AbstractFactory {

    @Override
    public boolean createObject(JXPathContext context, Pointer
 pointer, Object parent, String name, int index) {
        System.out.println(createObject: pointer:  + pointer + ,
 parent:  + parent.getClass().getName() + , name:  + name + ,
 index:  + index);

        if (parent instanceof TheObject) {

            // Is there something I can pass in via the path setter or that
            // I can access via pointer 

Fwd: Reminder: TAC Assistance to ApacheCon NA 2011 closes July 8th

2011-07-03 Thread Matt Benson
-- Forwarded message --
From: Gavin McDonald ga...@16degrees.com.au
Date: Sat, Jul 2, 2011 at 7:16 PM
Subject: Reminder: TAC Assistance to ApacheCon NA 2011 closes July 8th
To: p...@apache.org


PMCs, please re-post this reminder to your user and dev lists and anywhere
else you see fit.

-


Hi All,

Just a friendly (and final)  reminder that applications for financial help
to attend
ApacheCon NA 2011 in Vancouver close this coming Friday 8th July (2200 BST :
UTC+1)

Financial assistance is available for Travel (planes, trains, whatever) ,
Accomodation (at
the conference venue hotel) and Conference entrance fees. Dependant on your
circumstances will decide how much of that you would be given.

Please visit http://apache.org/travel for more information and a link to the
application
form.

Remember: We DO help people get to ApacheCon and other Apache events every
year,
we DO want to help people get there who otherwise could not, that is why we
exist.

Spread the word, you are welcome to tweet, blog, email, post, phone or smoke
signal
to anyone who you think might benefit from attending ApacheCon this year.

Kind Regards,

The Travel Assistance Committee.


-
To unsubscribe, e-mail: private-unsubscr...@commons.apache.org
For additional commands, e-mail: private-h...@commons.apache.org

-
To unsubscribe, e-mail: user-unsubscr...@commons.apache.org
For additional commands, e-mail: user-h...@commons.apache.org



Travel Assistance applications open for ApacheCon North America 2011

2011-06-06 Thread Matt Benson
The Apache Software Foundation (ASF)'s Travel Assistance Committee (TAC) is
now accepting applications for ApacheCon North America 2011, 7-11 November
in Vancouver BC, Canada.

The TAC is seeking individuals from the Apache community at-large --users,
developers, educators, students, Committers, and Members-- who would like to
attend ApacheCon, but need some financial support in order to be able to get
there. There are limited places available, and all applicants will be scored
on their individual merit.

Financial assistance is available to cover flights/trains, accommodation and
entrance fees either in part or in full, depending on circumstances.
However, the support available for those attending only the BarCamp (7-8
November) is less than that for those attending the entire event (Conference
+ BarCamp 7-11 November). The Travel Assistance Committee aims to support
all official ASF events, including cross-project activities; as such, it may
be prudent for those in Asia and Europe to wait for an event geographically
closer to them.

More information can be found at http://www.apache.org/travel/index.html
including a link to the online application and detailed instructions for
submitting.

Applications will close on 8 July 2011 at 22:00 BST (UTC/GMT +1).

We wish good luck to all those who will apply, and thank you in advance for
tweeting, blogging, and otherwise spreading the word.

Regards,
The Travel Assistance Committee

-
To unsubscribe, e-mail: user-unsubscr...@commons.apache.org
For additional commands, e-mail: user-h...@commons.apache.org



Re: [jxpath] Navigating across Lists

2011-05-16 Thread Matt Benson
On Mon, May 16, 2011 at 4:51 AM, Romain Rouvoy romain.rou...@lifl.fr wrote:
 Hi,

 I'm using JXPath to query a graph of beans, which are heavily using lists, 
 e.g.:
 public class A {
       ListB getB() {...}
 }

 public class B {
       String getName() {...}
       ListC getC() {...}
 }

 public class C {
       String getName() {...}
 }

 However, when I'm querying this graph of beans, the following request does 
 not match any elements (while it should return several elements):
 org.apache.commons.jxpath.JXPathContext.newContext(new A());
 context.getValue(b[@name='foo']/c/name);

 Any idea? Does JXPath support navigation within lists?


What should happen is that getValue(expr) returns the first value
specified by your expression, while iterate(expr) would be the way you
would retrieve multiple results.  If you can distill your problem down
to a failing JUnit test, please feel free to attach this to a JIRA
issue.

Matt

 Thanks for you help,
 Romain
 -
 To unsubscribe, e-mail: user-unsubscr...@commons.apache.org
 For additional commands, e-mail: user-h...@commons.apache.org



-
To unsubscribe, e-mail: user-unsubscr...@commons.apache.org
For additional commands, e-mail: user-h...@commons.apache.org



Re: [jxpath] Navigating across Lists

2011-05-16 Thread Matt Benson
On Mon, May 16, 2011 at 2:16 PM, Romain Rouvoy romain.rou...@lifl.fr wrote:
 On 16 mai 2011, at 16:06, Matt Benson wrote:
 On Mon, May 16, 2011 at 4:51 AM, Romain Rouvoy romain.rou...@lifl.fr wrote:
 I'm using JXPath to query a graph of beans, which are heavily using lists, 
 e.g.:
 public class A {
       ListB getB() {...}
 }

 public class B {
       String getName() {...}
       ListC getC() {...}
 }

 public class C {
       String getName() {...}
 }

 However, when I'm querying this graph of beans, the following request does 
 not match any elements (while it should return several elements):
 org.apache.commons.jxpath.JXPathContext.newContext(new A());
 context.getValue(b[@name='foo']/c/name);
 Any idea? Does JXPath support navigation within lists?
 What should happen is that getValue(expr) returns the first value specified 
 by your expression, while iterate(expr) would be the way you would retrieve 
 multiple results.  If you can distill your problem down to a failing JUnit 
 test, please feel free to attach this to a JIRA issue.

 Thanks Matt, actually I use Scala to develop my application:
 import scala.reflect.BeanProperty

 case class B(@BeanProperty val name:String)

 object a {
     @BeanProperty val b = List[B](new B(FOOs), new B(BARs))
 }

 The annotation @BeanProperty is used to generate getters at compile-time.


 scala val context = org.apache.commons.jxpath.JXPathContext.newContext(a)
 context: org.apache.commons.jxpath.JXPathContext = 
 org.apache.commons.jxpath.ri.JXPathContextReferenceImpl@132bb617

 scala context.getValue(b)
 res27: java.lang.Object = List(B(FOOs), B(BARs))

 This is an expected behavior...


 scala context.getValue(b/name)
 org.apache.commons.jxpath.JXPathNotFoundException: No value for xpath: b/name
       at 
 org.apache.commons.jxpath.ri.JXPathContextReferenceImpl.getValue(JXPathContextReferenceImpl.java:383)
       at 
 org.apache.commons.jxpath.ri.JXPathContextReferenceImpl.getValue(JXPathContextReferenceImpl.java:313)
       at .init(console:29)
       at .clinit(console)
       at RequestResult$.init(console:9)
       at RequestResult$.clinit(console)
       at RequestResult$scala_repl_result(console)
       at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
       at 
 sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
       at 
 sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
       at java.lang.reflect.Method.invoke(Method.java:597)
       at scala.tools.nsc.Interpreter$Request$$a...

 According to your answer, I should get a String (FOOs) and not an 
 exception...
 Ideally, I would have expected a collection of String containing FOOs and 
 BARs... :)


 scala val i = context.iterate(b/name)
 i: java.util.Iterator[_] = 
 org.apache.commons.jxpath.ri.compiler.Expression$ValueIterator@3b29642c

 scala i.hasNext
 res30: Boolean = false

 And even when using the context.iterate method, the returned iterator is 
 empty...

 Is that ok if I submit my Scala code except within JIRA?


It'd probably be best to first verify whether your example (or
something mostly like it) works in Java before proceeding on to
figuring out what, if anything, fails when doing the same thing in
Scala.  I personally don't have any experience with Scala, although
I've been interested to get my feet wet in that regard.

Matt

 Romain
 -
 To unsubscribe, e-mail: user-unsubscr...@commons.apache.org
 For additional commands, e-mail: user-h...@commons.apache.org



-
To unsubscribe, e-mail: user-unsubscr...@commons.apache.org
For additional commands, e-mail: user-h...@commons.apache.org



Re: [jxpath] Navigating across Lists

2011-05-16 Thread Matt Benson
On Mon, May 16, 2011 at 3:01 PM, Romain Rouvoy romain.rou...@lifl.fr wrote:
 On 16 mai 2011, at 21:38, Matt Benson wrote:
 On Mon, May 16, 2011 at 2:16 PM, Romain Rouvoy romain.rou...@lifl.fr wrote:
 On 16 mai 2011, at 16:06, Matt Benson wrote:
 On Mon, May 16, 2011 at 4:51 AM, Romain Rouvoy romain.rou...@lifl.fr 
 wrote:
 I'm using JXPath to query a graph of beans, which are heavily using 
 lists, e.g.:
 public class A {
       ListB getB() {...}
 }

 public class B {
       String getName() {...}
       ListC getC() {...}
 }

 public class C {
       String getName() {...}
 }

 However, when I'm querying this graph of beans, the following request 
 does not match any elements (while it should return several elements):
 org.apache.commons.jxpath.JXPathContext.newContext(new A());
 context.getValue(b[@name='foo']/c/name);
 Any idea? Does JXPath support navigation within lists?
 What should happen is that getValue(expr) returns the first value 
 specified by your expression, while iterate(expr) would be the way you 
 would retrieve multiple results.  If you can distill your problem down to 
 a failing JUnit test, please feel free to attach this to a JIRA issue.

 Thanks Matt, actually I use Scala to develop my application:
 import scala.reflect.BeanProperty

 case class B(@BeanProperty val name:String)

 object a {
     @BeanProperty val b = List[B](new B(FOOs), new B(BARs))
 }

 The annotation @BeanProperty is used to generate getters at compile-time.


 scala val context = org.apache.commons.jxpath.JXPathContext.newContext(a)
 context: org.apache.commons.jxpath.JXPathContext = 
 org.apache.commons.jxpath.ri.JXPathContextReferenceImpl@132bb617

 scala context.getValue(b)
 res27: java.lang.Object = List(B(FOOs), B(BARs))

 This is an expected behavior...


 scala context.getValue(b/name)
 org.apache.commons.jxpath.JXPathNotFoundException: No value for xpath: 
 b/name
       at 
 org.apache.commons.jxpath.ri.JXPathContextReferenceImpl.getValue(JXPathContextReferenceImpl.java:383)
       at 
 org.apache.commons.jxpath.ri.JXPathContextReferenceImpl.getValue(JXPathContextReferenceImpl.java:313)
       at .init(console:29)
       at .clinit(console)
       at RequestResult$.init(console:9)
       at RequestResult$.clinit(console)
       at RequestResult$scala_repl_result(console)
       at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
       at 
 sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
       at 
 sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
       at java.lang.reflect.Method.invoke(Method.java:597)
       at scala.tools.nsc.Interpreter$Request$$a...

 According to your answer, I should get a String (FOOs) and not an 
 exception...
 Ideally, I would have expected a collection of String containing FOOs and 
 BARs... :)


 scala val i = context.iterate(b/name)
 i: java.util.Iterator[_] = 
 org.apache.commons.jxpath.ri.compiler.Expression$ValueIterator@3b29642c

 scala i.hasNext
 res30: Boolean = false

 And even when using the context.iterate method, the returned iterator is 
 empty...

 Is that ok if I submit my Scala code except within JIRA?

 It'd probably be best to first verify whether your example (or something 
 mostly like it) works in Java before proceeding on to figuring out what, if 
 anything, fails when doing the same thing in Scala.  I personally don't have 
 any experience with Scala, although I've been interested to get my feet wet 
 in that regard.

 Well, the equivalent program in Java works perfectly with JXPath... Thus, it 
 sounds like the problems is due to the fact that JXPath cannot navigate 
 through Scala lists (which are not inheriting from the Java collection 
 framework).
 Do you think that such a support for the Scala collection library can be 
 easily integrated within JXPath? I can try to contribute if you help me to 
 get in :)


It would be nice if it were possible to make the two work together,
but... is nothing available that can wrap your Scala list for better
Java compatibility?

Matt

 Romain
 -
 To unsubscribe, e-mail: user-unsubscr...@commons.apache.org
 For additional commands, e-mail: user-h...@commons.apache.org



-
To unsubscribe, e-mail: user-unsubscr...@commons.apache.org
For additional commands, e-mail: user-h...@commons.apache.org



Re: [jxpath] Navigating across Lists

2011-05-16 Thread Matt Benson
On Mon, May 16, 2011 at 3:22 PM, Romain Rouvoy romain.rou...@lifl.fr wrote:
 On 16 mai 2011, at 22:10, Matt Benson wrote:
 On Mon, May 16, 2011 at 3:01 PM, Romain Rouvoy romain.rou...@lifl.fr wrote:
 On 16 mai 2011, at 21:38, Matt Benson wrote:
 On Mon, May 16, 2011 at 2:16 PM, Romain Rouvoy romain.rou...@lifl.fr 
 wrote:
 On 16 mai 2011, at 16:06, Matt Benson wrote:
 On Mon, May 16, 2011 at 4:51 AM, Romain Rouvoy romain.rou...@lifl.fr 
 wrote:
 I'm using JXPath to query a graph of beans, which are heavily using 
 lists, e.g.:
 public class A {
       ListB getB() {...}
 }

 public class B {
       String getName() {...}
       ListC getC() {...}
 }

 public class C {
       String getName() {...}
 }

 However, when I'm querying this graph of beans, the following request 
 does not match any elements (while it should return several elements):
 org.apache.commons.jxpath.JXPathContext.newContext(new A());
 context.getValue(b[@name='foo']/c/name);
 Any idea? Does JXPath support navigation within lists?
 What should happen is that getValue(expr) returns the first value 
 specified by your expression, while iterate(expr) would be the way you 
 would retrieve multiple results.  If you can distill your problem down 
 to a failing JUnit test, please feel free to attach this to a JIRA issue.

 Thanks Matt, actually I use Scala to develop my application:
 import scala.reflect.BeanProperty

 case class B(@BeanProperty val name:String)

 object a {
     @BeanProperty val b = List[B](new B(FOOs), new B(BARs))
 }

 The annotation @BeanProperty is used to generate getters at compile-time.


 scala val context = 
 org.apache.commons.jxpath.JXPathContext.newContext(a)
 context: org.apache.commons.jxpath.JXPathContext = 
 org.apache.commons.jxpath.ri.JXPathContextReferenceImpl@132bb617

 scala context.getValue(b)
 res27: java.lang.Object = List(B(FOOs), B(BARs))

 This is an expected behavior...


 scala context.getValue(b/name)
 org.apache.commons.jxpath.JXPathNotFoundException: No value for xpath: 
 b/name
       at 
 org.apache.commons.jxpath.ri.JXPathContextReferenceImpl.getValue(JXPathContextReferenceImpl.java:383)
       at 
 org.apache.commons.jxpath.ri.JXPathContextReferenceImpl.getValue(JXPathContextReferenceImpl.java:313)
       at .init(console:29)
       at .clinit(console)
       at RequestResult$.init(console:9)
       at RequestResult$.clinit(console)
       at RequestResult$scala_repl_result(console)
       at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
       at 
 sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
       at 
 sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
       at java.lang.reflect.Method.invoke(Method.java:597)
       at scala.tools.nsc.Interpreter$Request$$a...

 According to your answer, I should get a String (FOOs) and not an 
 exception...
 Ideally, I would have expected a collection of String containing FOOs 
 and BARs... :)


 scala val i = context.iterate(b/name)
 i: java.util.Iterator[_] = 
 org.apache.commons.jxpath.ri.compiler.Expression$ValueIterator@3b29642c

 scala i.hasNext
 res30: Boolean = false

 And even when using the context.iterate method, the returned iterator is 
 empty...

 Is that ok if I submit my Scala code except within JIRA?

 It'd probably be best to first verify whether your example (or something 
 mostly like it) works in Java before proceeding on to figuring out what, 
 if anything, fails when doing the same thing in Scala.  I personally don't 
 have any experience with Scala, although I've been interested to get my 
 feet wet in that regard.

 Well, the equivalent program in Java works perfectly with JXPath... Thus, 
 it sounds like the problems is due to the fact that JXPath cannot navigate 
 through Scala lists (which are not inheriting from the Java collection 
 framework).
 Do you think that such a support for the Scala collection library can be 
 easily integrated within JXPath? I can try to contribute if you help me to 
 get in :)

 It would be nice if it were possible to make the two work together, but... 
 is nothing available that can wrap your Scala list for better Java 
 compatibility?

 Not so easily, but I was thinking about registering specific Container or 
 TypeConverter (?) within the JXPathContext to enable navigation within Scala 
 collections

This might be possible, but quite honestly my head is pretty far from
JXPath these days.  If you figure something out let's keep talking
about what might be possible though.

Matt

 Romain
 -
 To unsubscribe, e-mail: user-unsubscr...@commons.apache.org
 For additional commands, e-mail: user-h...@commons.apache.org



-
To unsubscribe, e-mail: user-unsubscr...@commons.apache.org
For additional commands, e-mail: user-h...@commons.apache.org



Re: [beansutils] copyProperties when property names are different?

2010-08-18 Thread Matt Benson
I didn't want to say anything, but I can't in good conscience let somebody use 
Dozer without at least knowing Morph exists:  http://morph.sourceforge.net .  
-Matt

On Aug 18, 2010, at 2:42 AM, janne postilista wrote:

 Thanks. dozer seems great for my needs.
 
 On Tue, Aug 17, 2010 at 5:40 PM, Adrian Mitev
 adrian.mi...@googlemail.comwrote:
 
 Use more powerful tool like dozer.
 
 On Tue, Aug 17, 2010 at 5:13 PM, janne postilista 
 jannepostilis...@gmail.com wrote:
 
 Hi,
 
 AFAIK beansutils starts from the assumption that the properties are
 named identically.
 
 What if for some reason I have beans A and B and the property names,
 or some of them, are named differently (one has setLastName while
 other has setFamilyName)?
 
 Is there any easy-to-use helper to do this (in beansutils or
 elsewhere) or should I implement this myself?
 
 -
 To unsubscribe, e-mail: user-unsubscr...@commons.apache.org
 For additional commands, e-mail: user-h...@commons.apache.org
 
 
 
 
 --
 Although nobody can come back and make a new start, anyone can start now
 and
 make a new end
 


-
To unsubscribe, e-mail: user-unsubscr...@commons.apache.org
For additional commands, e-mail: user-h...@commons.apache.org



Re: RFC: Line Ending Conversion between Unix and Windows ....

2010-04-20 Thread Matt Benson
Echoing Sebastian, a possibility would be to port Ant's FixCrlfFilter  
(implements java.io.FilterReader) to [io].  Quite some changes would  
be needed, but this code has at least been heavily tested.


-Matt

On Apr 19, 2010, at 12:16 PM, Siegfried Goeschl wrote:


Hi folks,

I just had to type stupid code to do line ending conversion between  
Windows and Unix since I couldn't find existing code doing that.  
Would this be a useful contribution to Commons (e.g. lang, codec, io)


Thanks in advance,

Siegfried Goeschl

-
To unsubscribe, e-mail: user-unsubscr...@commons.apache.org
For additional commands, e-mail: user-h...@commons.apache.org




-
To unsubscribe, e-mail: user-unsubscr...@commons.apache.org
For additional commands, e-mail: user-h...@commons.apache.org



Re: how much JXPath 1.3 is compliant with XPath 2.0

2010-04-20 Thread Matt Benson


On Apr 20, 2010, at 4:23 AM, Nicolas Hernandez wrote:


Dear JXPath users,

does someone know how much JXPath 1.3 is compliant with XPath 2.0 ?

JXPath does not attempt to support anything that is specific to XPath  
2.0.



Does JXPath handle operators such as 'union', 'intersect', 'except' ?
Functions such as Regular expressions   (matches, replace, tokenize) ?



Off the top of my head, I know union is supported.  Whatever is in  
XPath 1.0.  :)


Is there a list somewhere of the operators and functions currently  
supported ?



The XPath 1.0 spec is linked from JXPath's user guide.

Thanks,
Matt


Thanks in advance

/Nicolas

-
To unsubscribe, e-mail: user-unsubscr...@commons.apache.org
For additional commands, e-mail: user-h...@commons.apache.org




-
To unsubscribe, e-mail: user-unsubscr...@commons.apache.org
For additional commands, e-mail: user-h...@commons.apache.org



Re: Adapting legacy request parameters into new POJO?

2010-04-15 Thread Matt Benson
Notwithstanding that I find the previous post confusing on many
levels, I would discourage this thread from continuing on the Commons
list(s), despite the fact that I am the one who brought it up.  Morph
is not a Commons project and has its own lists.

-Matt

On 4/14/10, Martin Gainty mgai...@hotmail.com wrote:

 Hi Folks

 took a while but i was able to run the morph testcase



 %MORPH_HOME%\target\classes

 java -classpath E:\MORPH\morph-1.1.1\target\
 classes;%CLASSPATH% net.sf.morph.MorphCommandlineTest
 log4j:WARN No appenders could be found for logger
 (net.sf.morph.transform.conver
 ters.TextToTimeConverter).
 log4j:WARN Please initialize the log4j system properly.
 Sun Jan 30 18:51:02 EET 2005
 1107103862000
 Sun Jan 30 18:51:02 EET 2005
 1107103862000
 true
 true
 true
 0



 Hint: morph implements Spring framework with generics to instrument the
 beans classes..
 most of the MORPH code uses the Spring 3.0 framework most notably HashMaps
 and ArrayLists but without required generic type parameters so with strict
 on the code wont compile



 I would post the clean code but i'm hearing that EMC bought spring? ..i'll
 beg off posting any code until i find an Apache Spring site that supports
 OSS (OpenSource)


 thanks,
 Martin Gainty
 __
 Verzicht und Vertraulichkeitanmerkung/Note de déni et de confidentialité

 Diese Nachricht ist vertraulich. Sollten Sie nicht der vorgesehene
 Empfaenger sein, so bitten wir hoeflich um eine Mitteilung. Jede unbefugte
 Weiterleitung oder Fertigung einer Kopie ist unzulaessig. Diese Nachricht
 dient lediglich dem Austausch von Informationen und entfaltet keine
 rechtliche Bindungswirkung. Aufgrund der leichten Manipulierbarkeit von
 E-Mails koennen wir keine Haftung fuer den Inhalt uebernehmen.

 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.





 From: mknut...@baselogic.com
 Date: Tue, 13 Apr 2010 06:20:50 -0400
 Subject: Re: Adapting legacy request parameters into new POJO?
 To: user@commons.apache.org

 the compiler plugin is implicit in Maven. You should have access to it
 automatically.
 But, if the examples are the same as the PDF document, then it is wrong as
 there is no DelegatingCopier anywhere and that is a main class that is
 used
 in that example. So if it is missing, then the examples will not compile
 anyways.

 ---
 Thank You…

 Mick Knutson, President

 BASE Logic, Inc.
 Enterprise Architecture, Design, Mentoring  Agile Consulting
 p. (866) BLiNC-411: (254-6241-1)
 f. (415) 685-4233

 Website: http://www.baselogic.com
 Blog: http://www.baselogic.com/blog/
 Linked IN: http://linkedin.com/in/mickknutson
 Twitter: http://twitter.com/mickknutson
 Vacation Rental: http://tahoe.baselogic.com
 ---



 On Mon, Apr 12, 2010 at 10:28 PM, Martin Gainty mgai...@hotmail.com
 wrote:

  for some reason the pom.xml that came with the morph project forgot the
  maven-compile plugin ( so you cannot compile the examples) here is my
  pom.xml for morph project
 
   
 _
 The New Busy think 9 to 5 is a cute idea. Combine multiple calendars with
 Hotmail.
 http://www.windowslive.com/campaign/thenewbusy?tile=multicalendarocid=PID28326::T:WLMTAGL:ON:WL:en-US:WM_HMP:042010_5

-
To unsubscribe, e-mail: user-unsubscr...@commons.apache.org
For additional commands, e-mail: user-h...@commons.apache.org



Re: XLink support in JXPath?

2010-03-18 Thread Matt Benson

On Mar 17, 2010, at 9:31 PM, Farrukh Najmi wrote:


Hi Guys,

Does JXPath support processing of xlink simple links? Thanks for  
any pointers on how to process documents with simple xlinks using  
JXPath.




No, I'm afraid JXPath contains no XLink support.  Is it specified  
anyplace that an XPath 1.0-supporting library should have some  
awareness of XLink?


Thanks,
Matt


--
Regards,
Farrukh

Web: http://www.wellfleetsoftware.com



-
To unsubscribe, e-mail: user-unsubscr...@commons.apache.org
For additional commands, e-mail: user-h...@commons.apache.org




-
To unsubscribe, e-mail: user-unsubscr...@commons.apache.org
For additional commands, e-mail: user-h...@commons.apache.org



Re: [Collections] Generics Support

2010-02-10 Thread Matt Benson
Much work has been done on the [collections] trunk; however noone has  
had time to finish it all up for a release.  Searching the  
d...@commons.apache.org archives may give you an idea of what remains  
(off the top of my head, I can only think of the task of addressing  
all JIRA issues filed for v4.0).


HTH,
Matt

On Feb 10, 2010, at 2:15 PM, Russell Collins wrote:

Are there any plans for the Collections library to support generics  
in the future?  If so, when can we expect that?




Russell Collins
Sr. Software Engineer
McLane Advanced Technology



CONFIDENTIALITY NOTICE: The information contained in this  
electronic mail (email) transmission (including attachments), is  
intended by MCLANE ADVANCED TECHNOLOGIES for the use of the named  
individual or entity to which it is addressed and may contain  
information that is privileged, confidential and/or protected as a  
trade secret. It is not intended for transmission to, or receipt  
by, any individual or entity other than the named addressee(s). If  
you have received this email in error, please delete it (including  
attachments) and any copies thereof without printing, copying or  
forwarding it, and notify the sender of the error by email reply  
immediately.



-
To unsubscribe, e-mail: user-unsubscr...@commons.apache.org
For additional commands, e-mail: user-h...@commons.apache.org



Re: FaltFile.jar

2010-01-05 Thread Matt Benson
FWIW, there is a [flatfile] M2 snapshot published at  
repository.apache.org.


-Matt

On Jan 5, 2010, at 6:44 AM, Ben Short wrote:


Hi,

The project page [1] says that the code is unreleased.

So you will need to build it yourself. The instructions are here [2].

Ben

[1] http://commons.apache.org/sandbox/flatfile/index.html
[2] http://commons.apache.org/sandbox/flatfile/building.html


2010/1/5 Emad Hamadaqa e...@hamadaqa.de:

Hi

I'd like to use FaltFile.jar but can't find it.

can any body help!

thanks.

Cheers,
Emad

--
Mit freundlichen Gren / With kind regards
Dipl Inf. Emad Hamadaqa
Goslarsche Str. 73
38118 Braunschweig

mailto: e...@hamadaqa.de

-
To unsubscribe, e-mail: user-unsubscr...@commons.apache.org
For additional commands, e-mail: user-h...@commons.apache.org




-
To unsubscribe, e-mail: user-unsubscr...@commons.apache.org
For additional commands, e-mail: user-h...@commons.apache.org




-
To unsubscribe, e-mail: user-unsubscr...@commons.apache.org
For additional commands, e-mail: user-h...@commons.apache.org



Re: collections 3.3 SNAPSHOT ?

2010-01-05 Thread Matt Benson
It would probably be collections 4.0 and there hasn't yet been a  
snapshot published, due to the as-yet unresolved questions of package  
renaming, etc.


-Matt

On Jan 5, 2010, at 5:31 AM, nicolas de loof wrote:


Hi

I'd like to use commons-collection 3.3 SNAPSHOT (to get Java5 syntax
support) but can't find it under
http://people.apache.org/repo/m2-snapshot-repository/ or *
http://repository.apache.org/snapshots http:// 
repository.apache.org/*


did I miss something ?

Cheers,
Nicolas



-
To unsubscribe, e-mail: user-unsubscr...@commons.apache.org
For additional commands, e-mail: user-h...@commons.apache.org



Re: [JXPath] Iterators and Pointers (on partial matches)

2009-06-04 Thread Matt Benson

Hi Andrew,
  I'm not sure if JXPath is necessarily really the right tool for this.  This 
almost just looks like a sort of hierarchical lookup.  I have a HierarchyTable 
we use at my $work for these type purposes; unfortunately I haven't yet gotten 
clearance to release it into the wild.  I plan someday to include it in 
[collections] but it may need rewriting before the Commons community would even 
agree to it, the reason being that it's somewhat heavy.  I suppose I can 
explain its implementation:  It stores hierarchical data a node per level, and 
its nodes it uses each hold a HashMap (the heavy part) to keep track of child 
nodes.  So you _could_ implement your own version of that.  If you are 
determined to use JXPath for this, for example if you just really need to be 
able to get at this information with an expression, you might be able to 
accomplish it with a custom function but I'm still afraid at some point you 
might have to parse the steps, or rely on JXPath RI
 packages/classes.

HTH,
Matt

--- On Wed, 6/3/09, Andrew Hughes ahhug...@gmail.com wrote:

 From: Andrew Hughes ahhug...@gmail.com
 Subject: [JXPath] Iterators and Pointers (on partial matches)
 To: Commons Users List user@commons.apache.org
 Date: Wednesday, June 3, 2009, 9:45 PM
 Hi Again,
 I'm trying to resolve an issue I have trying to step
 through object's
 slightly *different* to the JXPath ReferenceImpl.
 
 Say I have String expression =
 /Earth/Australia/NSW/Sydney/Utopia; Since
 Utopia is a mythical place that never exists I'll never
 get a result from
 selectNode(/Earth/Australia/NSW/Sydney/Utopia);
 
 Neither can I do this with an iterator:
 http://commons.apache.org/jxpath/apidocs/org/apache/commons/jxpath/JXPathContext.html#iteratePointers(java.lang.String)
 
 If the xpath matches no properties in the graph, the
 Iterator be empty, but
 not null.
 
 I've tested this is and when I look for Utopia, I get an
 empty iterator
 
 I need an iterator that allows me see just how close I can
 get to 'Utopia':
 
 Iterator step =
 jxpathContext.iterator(/Earth/Australia/NSW/Sydney/Utopia
 );
 system.out.println(step.next().toString());// '' the root
 object
 system.out.println(step.next().toString());// 'Earth'
 system.out.println(step.next().toString());// 'Australia'
 system.out.println(step.next().toString());// 'NSW'
 system.out.println(step.next().toString());// 'Sydney'
 system.out.println(step.next().toString());// THROWS AN
 EXCEPTION BECAUSE
 UTOPIA DOES NOT EXIST
 
 
 Thanks heaps for reading (again)  :)
 


  

-
To unsubscribe, e-mail: user-unsubscr...@commons.apache.org
For additional commands, e-mail: user-h...@commons.apache.org



Re: [JXPath] Custom Functions the Current Pointer

2009-04-21 Thread Matt Benson

Hi, Andrew.  Your example looks pretty good... what happens exactly when you 
try it?

-Matt

--- On Mon, 4/20/09, Andrew Hughes ahhug...@gmail.com wrote:

 From: Andrew Hughes ahhug...@gmail.com
 Subject: [JXPath] Custom Functions  the Current Pointer
 To: Commons Users List user@commons.apache.org
 Date: Monday, April 20, 2009, 11:31 PM
 Hi there, I think this is a really
 easy question... sorry for this...
 I have created my own function as below
 
 package com.blah.function;
 
 public class Calculate {
 public static Calculation
 doCalculation(ExpressionContext context, int
 x) {
 //stuff goes in here...
 }
 
 }
 
 
 I've  also registered it with the JXPathContext as
 below...
 
 jxPathContext.setFunctions(new
 PackageFunctions(com.blah.function.,
 jxpath));
 
 
 I see how this works programatically, but not in an
 expression. For example,
 if I want to find a node and then use that node in
 doCalculation... how?
 
 '/Something/I/CanFind' then I want to run
 'doCalculation(6)' on the result
 of the previous query's result.
 
 
 I would have thought this would be something like the
 following but I am
 obviously wrong...
 
 jxpath:Calculate.doCalculation(/Something/I/CanFind,6);
 
 /Something/I/CanFind[jxpath:Calculate.doCalculation(6)];
 
 
 Once an ExpressionContext is involved it no longer
 works.
 
 
 Any help would be much appreciated :)
 


  

-
To unsubscribe, e-mail: user-unsubscr...@commons.apache.org
For additional commands, e-mail: user-h...@commons.apache.org



RE: commons-apache-jxpath: TestCase entry point

2009-04-16 Thread Matt Benson

Are you using jxpath's own build.xml?  It declares the tests to run as all 
classes compiled from src/test/**/*Test.java .  You don't need any suites or 
entry point.

-Matt

--- On Thu, 4/16/09, Sullivan, Angela angela.sulli...@fmr.com wrote:

 From: Sullivan, Angela angela.sulli...@fmr.com
 Subject: RE: commons-apache-jxpath: TestCase entry point
 To: Commons Users List user@commons.apache.org
 Date: Thursday, April 16, 2009, 8:49 AM
 Hi Matt,
 
 I'm building from ant. My build.properties has a prop of
 test.entry = ?.
 In 1.2 is was JXPathTestSuite, however that's not the case
 now as it's
 changed. I can't see what's it changed to.
 
 
 Thanks
 Angela
 
  
 
 -Original Message-
 From: Matt Benson [mailto:gudnabr...@yahoo.com]
 
 Sent: Thursday, April 09, 2009 7:09 PM
 To: Commons Users List
 Subject: Re: commons-apache-jxpath: TestCase entry point
 
 
 There really isn't one.  You simply run the testcases
 en masse... in
 what context are you trying to run the tests?
 
 -Matt
 
 --- On Thu, 4/9/09, Sullivan, Angela angela.sulli...@fmr.com
 wrote:
 
  From: Sullivan, Angela angela.sulli...@fmr.com
  Subject: commons-apache-jxpath: TestCase entry point
  To: user@commons.apache.org
  Date: Thursday, April 9, 2009, 9:50 AM
  Hi 
  I am building commons-apache-jxpath 1.3 from source.
 The
  TestCase entry
  point in 1.2 was JXPathTestSuite, but it has changed
 for
  ver 1.3 and I
  can't seem to find what it's changed to. Does anybody
  know?
  
  Thanks
  Angela
  
 
 -
  To unsubscribe, e-mail: user-unsubscr...@commons.apache.org
  For additional commands, e-mail: user-h...@commons.apache.org
  
  
 
 
   
 
 -
 To unsubscribe, e-mail: user-unsubscr...@commons.apache.org
 For additional commands, e-mail: user-h...@commons.apache.org
 
 
 
 
 -
 To unsubscribe, e-mail: user-unsubscr...@commons.apache.org
 For additional commands, e-mail: user-h...@commons.apache.org
 
 


  

-
To unsubscribe, e-mail: user-unsubscr...@commons.apache.org
For additional commands, e-mail: user-h...@commons.apache.org



Re: commons-apache-jxpath: TestCase entry point

2009-04-09 Thread Matt Benson

There really isn't one.  You simply run the testcases en masse... in what 
context are you trying to run the tests?

-Matt

--- On Thu, 4/9/09, Sullivan, Angela angela.sulli...@fmr.com wrote:

 From: Sullivan, Angela angela.sulli...@fmr.com
 Subject: commons-apache-jxpath: TestCase entry point
 To: user@commons.apache.org
 Date: Thursday, April 9, 2009, 9:50 AM
 Hi 
 I am building commons-apache-jxpath 1.3 from source. The
 TestCase entry
 point in 1.2 was JXPathTestSuite, but it has changed for
 ver 1.3 and I
 can't seem to find what it's changed to. Does anybody
 know?
 
 Thanks
 Angela
 
 -
 To unsubscribe, e-mail: user-unsubscr...@commons.apache.org
 For additional commands, e-mail: user-h...@commons.apache.org
 
 


  

-
To unsubscribe, e-mail: user-unsubscr...@commons.apache.org
For additional commands, e-mail: user-h...@commons.apache.org



Re: [ANN] commons-exec 1.0 released

2009-03-26 Thread Matt Benson

Great job seeing this through, Siegfried!

-Matt

--- On Thu, 3/26/09, Siegfried Goeschl siegfried.goes...@it20one.at wrote:

 From: Siegfried Goeschl siegfried.goes...@it20one.at
 Subject: [ANN] commons-exec 1.0 released
 To: Jakarta Commons Developers List d...@commons.apache.org, Jakarta 
 Commons Users List user@commons.apache.org
 Date: Thursday, March 26, 2009, 1:34 PM
 The commons-exec-team is pleased to
 announce the commons-exec-1.0 release!
 
 A library to reliably execute external processes from
 within the JVM
 
 Changes in this version include:
 
 New features:
 -
 
 o Added one additional test :
 DefaultExecutorTest.testExecuteWithFancyArg  
   Issue: EXEC-26. Thanks to Benjamin Bentmann.
 o Added convinience method to add two parameters to the
 CommandLine
   using one method invocation.
 o Added test scripts for OpenVMS - he seems to be the last
 human having
   access to an OpenVMS box ... :-)
 o With the help of the Apache Commons community I added the
 first results
   of cross-OS testing. Thanks to Simone Gianni, Bindul
 Bhowmik,
   Niall Pemberton, Sebastian Bazley.
 o The regression tests now also works on Windows - so it
 should
   work now on Linux, Windows and Mac OS X
 o Added DebugUtils to improve cross-platform testing.
 o Made DefaultExecutor.launch() protected to enable
 mocking.  
   Issue: SANDBOX-62. Thanks to Jeremy Lacoste.
 o Made ProcessDestroyer optional and pluggable when using
 Executor.  
   Issue: SANDBOX-107. Thanks to Niklas Gustavsson.
 o CommandLine can now expand the given command line by a
 user-suppied
   map. This allows to execute something like
 ${JAVA_HOME}/bin/java -jar
 ${myapp}
 o Added methods to provide pre-quoted arguments.  
   Issue: SANDBOX-192. Thanks to Reinhold Fuereder.
 o Exposing a ExecuteWatchdog.destroy() to kill an
 asynchrounous process
   manually. This formalizes a workaround described in
 the JIRA  
   Issue: SANDBOX-193. Thanks to Reinhold Fuereder.
 o Extending exit value handling to support applications
 returning an error
   code.  Issue: SANDBOX-203.
 o Added a few regression tests for the watchdog since they
 were missing.  
   Issue: SANDBOX-204.
 
 Fixed Bugs:
 -
 
 o Removed useless synchronized statement in
  
 OpenVmsProcessingEnvironment.createProcEnvironment  
   Issue: EXEC-37. Thanks to Sebastien Bazley.
 o Using System.in for child process will actually hang your
 application -
   see JIRA for more details. Since there is no easy
 fix an
   IllegalRuntimeException is thrown when System.in is
 passed.  
   Issue: EXEC-33.
 o Fixing a few findbugs issues.  Issue: EXEC-35.
 Thanks to Luc Maisonobe.
 o Handle null streams consistently.  Issue: EXEC-32.
 Thanks to Marco
 Ferrante.
 o After a long discussion we decided to stick to following
 groupId
   org.apache.commons instead of commons-exec.
 o The Ant build now works even when junit is not on the
 classpath
   Thanks to Kevin Jackson.
 o Fixed broken groupId from org.apache.commons to
 commons-exec
 o Renamed EnvironmentUtil to EnvironmentUtils to align with
 other classes
   in this project and commons in general. Please note
 that this change
   could break existing clients (but would be rather
 unlikely).  
   Issue: EXEC-27. Thanks to Benjamin Bentmann.
 o Make environment variables respect casing rules of
 platforms. Under
 Windows
   PATH, Path and path would access the same
 environment variable
 whereas
   the real name is Path.  Issue: EXEC-30.
 Thanks to Benjamin Bentmann.
 o Invoking DefaultExecutor.execute(CommandLine command, Map
 environment)
 using
 a 'null' Map results in inheriting all environment
 variables of the current
   process while passing an empty map implies starting
 the new process
 with no
   environment variables. In short 'null' is not the
 same as an empty map.  
   Issue: EXEC-31. Thanks to Benjamin Bentmann.
 o Using variable substitution within CommandLine broke the
 regression tests
   under Windows. Found also another bug when calling
 CommandLine.getExecutable()
   the result was not substituted at all. As a general
 rule we do variable
   substitution and file separator fixing on the
 command line executable and
   variable substitution but NO file separator fixing
 for the command line
   arguments.  Issue: EXEC-25.
 o Implemented better regression test for OpenVMS affecting
 also
   the Executor and CommandLauncher interface.
 o Cleaned up the source code to get rid of javadoc errors
 and
   unused imports.  Issue: SANDBOX-204.
 
 
 Removed:
 o Removed commons-logging integration
 
 Have fun!
 
 -commons-exec-team
 
 
 -
 To unsubscribe, e-mail: user-unsubscr...@commons.apache.org
 For additional commands, e-mail: user-h...@commons.apache.org
 
 





Re: [JXPath][BeanUtils] External Bean PropertyDescriptor?

2009-03-17 Thread Matt Benson

Possibly you can get some love registering a DynamicPropertyHandler class via 
JXPathIntrospector.registerDynamicClass(...).

-Matt

--- On Mon, 3/16/09, Andrew Hughes ahhug...@gmail.com wrote:

 From: Andrew Hughes ahhug...@gmail.com
 Subject: [JXPath][BeanUtils] External Bean PropertyDescriptor?
 To: Commons Users List user@commons.apache.org
 Date: Monday, March 16, 2009, 9:53 PM
 Hi,
 I am trying to use JXPath on a not-so-bean complient
 Something.java class.
 The 
 JXBeanInfohttp://commons.apache.org/jxpath/apidocs/org/apache/commons/jxpath/JXPathBeanInfo.html#getDynamicPropertyHandlerClass()
 method
 getPropertyDescriptor stipulates that I return a
 PropertyDescriptorhttp://java.sun.com/j2se/1.3/docs/api/java/beans/PropertyDescriptor.html
 in
 order to allow JXPath to get/set the properties within
 Something.java. The
 problem is that the not-so-bean-complient Something.java
 class doesn't
 have get/set equivalent methods. It actually has iterator()
 and from that
 you can then iterate over all properties and work with
 them directly.
 
 Can I somehow inject a method implementation or proxy
 object outside of
 Something.java that will provide the required logic/code
 to perform the
 get/set operation on Something.java's properties?
 
 Any help would be much appreciated :)
 


  

-
To unsubscribe, e-mail: user-unsubscr...@commons.apache.org
For additional commands, e-mail: user-h...@commons.apache.org



Re: [JXPath] Whitespace in Expression/Property

2009-03-17 Thread Matt Benson

Maybe /Earth/Australia/@name='New South Wales']/Sydney?  :|

-Matt

--- On Mon, 3/16/09, Andrew Hughes ahhug...@gmail.com wrote:

 From: Andrew Hughes ahhug...@gmail.com
 Subject: [JXPath] Whitespace in Expression/Property
 To: Commons Users List user@commons.apache.org
 Date: Monday, March 16, 2009, 11:42 PM
 Hi Again,
 How can I access a property named 'New South Wales' if it
 has whitespace in
 it? Example Expression: '/Earth/Australia/New South
 Wales/Sydney'
 
 THANKS SO MUCH
 


  

-
To unsubscribe, e-mail: user-unsubscr...@commons.apache.org
For additional commands, e-mail: user-h...@commons.apache.org



Re: JXPath over Generic Collection?, How?

2009-03-11 Thread Matt Benson

For me:

context.selectNodes(/root/animal/dog/*[name])

selects

[LazyDynaBean {name=(BOXER)}, LazyDynaBean {name=(LABRADOR)}]

--- On Wed, 3/11/09, Andrew Hughes ahhug...@gmail.com wrote:

 From: Andrew Hughes ahhug...@gmail.com
 Subject: Re: JXPath over Generic Collection?, How?
 To: Commons Users List user@commons.apache.org
 Date: Wednesday, March 11, 2009, 1:12 AM
 A whirl and a win!
 I'm very close to a complete solution here (with loads of
 assistance from
 Matt, THANK YOU) based on Dyna Beans however there is one
 remaining problem
 (since we have duplicate elements).
 
 According to:  http://www.w3.org/TR/xpath#path-abbrev
 http://www.w3.org/TR/xpath#path-abbrev
 
 * selects all element children of the context node
 
 
 Expression: '/root/animal/dog/*' should return all dog's,
 instead it returns
 the first() dog (BOXER) only. I am unsure if this in an
 unrealistic
 requirement of JXPath and also where should I look to
 possibly 'fix' this if
 it indeed would compliment the current features?
 
 
 Thanks HEAPS!
 
 
 
 
 On Thu, Mar 5, 2009 at 3:05 AM, Matt Benson gudnabr...@yahoo.com
 wrote:
 
 
  Apparently the reason I was so ready to agree this was
 a bug that should be
  fixed is that I already fixed it as
  http://issues.apache.org/jira/browse/JXPATH-128 . 
 So since you're already
  experienced with building JXPath now you should be
 able to build from svn
  trunk and give that a whirl.
 
  -Matt
 
  --- On Wed, 3/4/09, Matt Benson gudnabr...@yahoo.com
 wrote:
 
   From: Matt Benson gudnabr...@yahoo.com
   Subject: Re: JXPath over Generic
 Collection?, How?
   To: Commons Users List user@commons.apache.org
   Date: Wednesday, March 4, 2009, 7:57 AM
  
   Hi Andrew,
     I agree that going through the
 list of properties
   should avoid the explicit class check problem
 (I think
   this is because you are using LazyDynaBeans
 instead of
   regular DynaBeans).  As for returning all
 matches vs.
   the first match, rather than selectValue(...) you
 need to
   selectNodes(...), or iterate(...).  There
 are other
   useful methods, e.g. those dealing with pointers,
 also
   available on JXPathContext.
  
   So as for your bug, yes it can/should be fixed,
 but you
   might also consider whether you can use non-lazy
 DynaBeans
   instead.
  
   Regards,
   Matt
  
   --- On Tue, 3/3/09, Andrew Hughes ahhug...@gmail.com
   wrote:
  
From: Andrew Hughes ahhug...@gmail.com
Subject: Re: JXPath over Generic
 Collection?,
   How?
To: Commons Users List user@commons.apache.org
Date: Tuesday, March 3, 2009, 5:37 PM
For efficiency reasons I can see why
you are using String[] here and not
List.add()...
Anyway, I have a fix (sort of) for this bug.
 The
   number of
names needs to be
calculated a little differently to what it
 currently
   is...
   
        public String[]
 getPropertyNames() {
            /*
 @todo do something about the
sorting - LIKE WHAT? - MJB */
            if
 (names == null) {
            
    DynaClass
dynaClass = dynaBean.getDynaClass();
            
    DynaProperty[]
properties = dynaClass.getDynaProperties();
            
    int count =
properties.length;
            
    boolean hasClass
= dynaClass.getDynaProperty(class) !=
 null;
   
            
    //count the
number of property names we have
            
    count = 0;
            
    for (int i = 0; i
 properties.length; i++) {
   
String name = properties[i].getName();
              
      if
(!hasClass || !name.equals(class)) {
   
        count++; //it's only
 a property is it's not a
class and
doesn't just have a class property.
              
      }
            
    }
            
    //read the
property names into a String[] to return
            
    names = new
String[count];
            
    for (int i = 0, j
= 0; i  properties.length; i++) {
   
String name = properties[i].getName();
              
      if
(!hasClass || !name.equals(class)) {
   
        names[j++] = name;
              
      }
            
    }
   
Arrays.sort(names);
            }
            return
 names;
        }
   
Now I can sort of sucessfully run all my
 expressions,
yippee!! However, I
now have a problem with multiple deep
 results. Queries
   like
//dog/* I would
expect to return all dog's[] but this just
 returns
   the
first one it finds.
Maybe this is asking a little too much of
 JXPath and
child/node
step-up/step-down traversal? Matt can
 probably tell me
   if
this is or is not
the case plase :)
   
   
   
   
   
On Wed, Mar 4, 2009 at 9:38 AM, Andrew
 Hughes ahhug...@gmail.com
wrote:
   
 Pretty sure this is a bug in JXPath -
 and it is
   not
tested by the current
 unit tests.
 I can't quite work out 100% of what's
 going on
   here...
but it has to do
 with gathering the property names from
 a
   DynaBean
child member of a (parent

Re: JXPath over Generic Collection?, How?

2009-03-04 Thread Matt Benson
 LazyDynaBean();
   LazyDynaBean dog = new LazyDynaBean();
   LazyDynaBean cat = new LazyDynaBean();
   LazyDynaBean boxer = new LazyDynaBean();
   LazyDynaBean labrador = new LazyDynaBean();
   LazyDynaBean tiger1 = new LazyDynaBean();
   LazyDynaBean tiger2 = new LazyDynaBean();
   LazyDynaBean tiger3 = new LazyDynaBean();
   LazyDynaBean lion = new LazyDynaBean();
   //set the @objectName property of each bean,
 user UPPER to make them
  distinct for examples.
   root.set(objectName,ROOT);
   animal.set(objectName,ANIMAL);
   dog.set(objectName,DOG);
   cat.set(objectName,CAT);
   boxer.set(objectName,BOXER);
   labrador.set(objectName,LABRADOR);
   tiger1.set(objectName,TIGER-ONE);
   tiger2.set(objectName,TIGER-TWO);
   tiger3.set(objectName,TIGER-THREE);
   lion.set(objectName,LION);
   //build the bean hierarchy.
   lazyDynaBean.set(root,0, root);
   root.set(animal,0, animal);
   animal.set(dog,0,dog);
   animal.set(cat,0,cat);
   dog.set(labrador,0,labrador);
   dog.set(boxer,0, boxer);
   cat.set(tiger,0,tiger1);//duplicate
   cat.set(tiger,1,tiger2);//duplicate
   cat.set(tiger,2,tiger3);//duplicate
   cat.set(lion,0,lion);
 
      
    JXPathContext context =
 JXPathContext.newContext(lazyDynaBean);
 
          //these all
 work
      
    runEvaluation(/root/animal/dog,
 context); //absolute  single
      
    runEvaluation(/root/animal/cat/tiger[2],
 context); //absolute 
  single
      
    runEvaluation(/root/animal/cat/tiger,
 context); //absolute 
  multiple
          //everything
 below fails
      
    runEvaluation(/root/animal/cat/tiger[last()],
 context);
  //absolute  single
      
    runEvaluation(/root/animal/dog/*,
 context); //absolute 
  multiple
      
    runEvaluation(//dog, context); //deep
 search
      
    runEvaluation(//dog/*, context);//deep
 multiple
      
    runEvaluation(//cat/*[objectName='LION'],
 context);//deep filter
 
  }
 
 
   public static void runEvaluation(String
 expression,JXPathContext
  context){
   log.info(About to evaulate the expression:
 +expression);
          try {
  Object value = context.getValue(expression);
   //we got a single result.
   if (value instanceof LazyDynaBean) {
   LazyDynaBean r =
 (LazyDynaBean)context.getValue(expression);
   log.info(Ran ' + expression + ' and got
 objectName=' +
  r.get(objectName) + ');
 
   }
   //we got multiple results
   else if (value instanceof ArrayList) {
   String titles = ;
   for (LazyDynaBean bean :
 ((ArrayListLazyDynaBean) value )){
   titles += (bean.get(objectName)+,);
   }
   log.info(Ran  + expression +  and got
 +((ArrayList)value).size()+
  results: +titles);
   }
   //we got a non-dyna bean.
   else {
   log.info(Ran ' + expression + ' and got a
 class ' +
  value.getClass().getName() + ' with toString() '
 +value.toString() + ');
   }
   } catch (Exception e) {
   // TODO Auto-generated catch block
   log.error(Failed to evaluate
 +expression,e);
   }
   }
  }
 
 
 
 
  On Fri, Feb 27, 2009 at 3:56 AM, Matt Benson
 gudnabr...@yahoo.comwrote:
 
 
  Those paths work for me.  Maybe something
 else is going awry?
 
  -Matt
 
  --- On Thu, 2/26/09, Andrew Hughes ahhug...@gmail.com
 wrote:
 
   From: Andrew Hughes ahhug...@gmail.com
   Subject: Re: JXPath over Generic
 Collection?, How?
   To: Commons Users List user@commons.apache.org
   Date: Thursday, February 26, 2009, 12:53
 AM
   Many queries don't work,  I
   can't get any results for the following
 (code
   taken from previous email)...
  
  
 runEvaluation(/root/animal/cat/tiger[last()], context);
   //absolute
single
  
   runEvaluation(/root/animal/dog/*,
 context); //absolute
multiple
       
    runEvaluation(//dog,
   context); //deep search
       
    runEvaluation(//dog/*,
   context);//deep multiple
  
  
 runEvaluation(//cat/*[objectName='LION'], context);//deep
   filter
  
   These are the really interesting benefits
 on xpath that I
   would dearly like
   to have.
  
   A Huge Thanks once again for your reply
 Matt!!! :)
  
  
  
   On Thu, Feb 26, 2009 at 10:55 AM, Matt
 Benson gudnabr...@yahoo.com
   wrote:
  
   
How so?  If you simply treat
 the name property as
   an element rather than an
attribute, you're done, no?
   
-Matt
   
--- On Wed, 2/25/09, Andrew Hughes
 ahhug...@gmail.com
   wrote:
   
 From: Andrew Hughes ahhug...@gmail.com
 Subject: Re: JXPath over
 Generic
   Collection?, How?
 To: Commons Users List user@commons.apache.org
 Date: Wednesday, February 25,
 2009, 6:22 PM
 Indeed Matt, you are correct
 and I do
 apologize... but I must say I
 find
 your emailed explanation much
 better. Kudos 
   Thanks!
 I'll (finally) get a chance to
 work on this
   tomorrow, but I
 think I am still
 stuck :'(


 Cheers for everything so
 far


 On Tue, Feb 24, 2009 at 1:43
 PM, Matt Benson
   gudnabr...@yahoo.com
 wrote:

 
  I won't get to look at
 this again at least
   before
 tomorrow (9PM for me

Re: JXPath over Generic Collection?, How?

2009-03-04 Thread Matt Benson

Apparently the reason I was so ready to agree this was a bug that should be 
fixed is that I already fixed it as 
http://issues.apache.org/jira/browse/JXPATH-128 .  So since you're already 
experienced with building JXPath now you should be able to build from svn trunk 
and give that a whirl.

-Matt

--- On Wed, 3/4/09, Matt Benson gudnabr...@yahoo.com wrote:

 From: Matt Benson gudnabr...@yahoo.com
 Subject: Re: JXPath over Generic Collection?, How?
 To: Commons Users List user@commons.apache.org
 Date: Wednesday, March 4, 2009, 7:57 AM
 
 Hi Andrew,
   I agree that going through the list of properties
 should avoid the explicit class check problem (I think
 this is because you are using LazyDynaBeans instead of
 regular DynaBeans).  As for returning all matches vs.
 the first match, rather than selectValue(...) you need to
 selectNodes(...), or iterate(...).  There are other
 useful methods, e.g. those dealing with pointers, also
 available on JXPathContext.
 
 So as for your bug, yes it can/should be fixed, but you
 might also consider whether you can use non-lazy DynaBeans
 instead.
 
 Regards,
 Matt
 
 --- On Tue, 3/3/09, Andrew Hughes ahhug...@gmail.com
 wrote:
 
  From: Andrew Hughes ahhug...@gmail.com
  Subject: Re: JXPath over Generic Collection?,
 How?
  To: Commons Users List user@commons.apache.org
  Date: Tuesday, March 3, 2009, 5:37 PM
  For efficiency reasons I can see why
  you are using String[] here and not
  List.add()...
  Anyway, I have a fix (sort of) for this bug. The
 number of
  names needs to be
  calculated a little differently to what it currently
 is...
  
      public String[] getPropertyNames() {
          /* @todo do something about the
  sorting - LIKE WHAT? - MJB */
          if (names == null) {
              DynaClass
  dynaClass = dynaBean.getDynaClass();
              DynaProperty[]
  properties = dynaClass.getDynaProperties();
              int count =
  properties.length;
              boolean hasClass
  = dynaClass.getDynaProperty(class) != null;
  
              //count the
  number of property names we have
              count = 0;
              for (int i = 0; i
   properties.length; i++) {
                 
  String name = properties[i].getName();
                  if
  (!hasClass || !name.equals(class)) {
                 
      count++; //it's only a property is it's not a
  class and
  doesn't just have a class property.
                  }
              }
              //read the
  property names into a String[] to return
              names = new
  String[count];
              for (int i = 0, j
  = 0; i  properties.length; i++) {
                 
  String name = properties[i].getName();
                  if
  (!hasClass || !name.equals(class)) {
                 
      names[j++] = name;
                  }
              }
             
  Arrays.sort(names);
          }
          return names;
      }
  
  Now I can sort of sucessfully run all my expressions,
  yippee!! However, I
  now have a problem with multiple deep results. Queries
 like
  //dog/* I would
  expect to return all dog's[] but this just returns
 the
  first one it finds.
  Maybe this is asking a little too much of JXPath and
  child/node
  step-up/step-down traversal? Matt can probably tell me
 if
  this is or is not
  the case plase :)
  
  
  
  
  
  On Wed, Mar 4, 2009 at 9:38 AM, Andrew Hughes ahhug...@gmail.com
  wrote:
  
   Pretty sure this is a bug in JXPath - and it is
 not
  tested by the current
   unit tests.
   I can't quite work out 100% of what's going on
 here...
  but it has to do
   with gathering the property names from a
 DynaBean
  child member of a (parent)
   DynaBean. Especially, when it try's to deal with
 the
  property named 'name'
   and 'class'.
  
   The problem with query '//dog' etc's
  'ArrayOutOfBoundsException 0' occurs
   below. And rightfully so, names[] is a zero
 length
  array and for some
   reason JXPath is trying to set a value for the
 first
  entry of a zero length
   array.  That aint ever going to work! But why
 is
  the array length zero?
   Because the properties.length==1, however the
  'hasClass==true' and it's
   count-- then negates the correct count calculated
 from
  properties.length. I
   think the problem is in the hasClass
 calculation...
  'boolean hasClass =
   dynaClass.getDynaProperty(class) != null;' 
 or
  the conditional 'if'
   statement. I don't understand the JXPath logic
 here
  completely, but I know
   it doesn't deal with the way I am using it and I
  genuinely feel this is a
   bug we can fix :'(
  
  
       public String[]
  getPropertyNames() {
           /* @todo do
  something about the sorting - LIKE WHAT? - MJB */
           if (names ==
  null) {
           
     DynaClass dynaClass =
  dynaBean.getDynaClass();
           
     DynaProperty[] properties =
  dynaClass.getDynaProperties();
    //returns one property 'name=root' (correct)
           
     int count = properties.length;
  //returns/set's

Re: [beanutils] converting HTTP params into an arbitrary object model

2009-02-24 Thread Matt Benson



--- On Tue, 2/24/09, Adam Hardy ahardy.str...@cyberspaceroad.com wrote:

 From: Adam Hardy ahardy.str...@cyberspaceroad.com
 Subject: Re: [beanutils] converting HTTP params into an arbitrary object model
 To: Commons Users List user@commons.apache.org
 Date: Tuesday, February 24, 2009, 3:19 AM
 Matt Benson on 23/02/09 16:23,
 wrote:
 --- On Sat, 2/21/09, Adam Hardy wrote:
I have spent a day researching and
 prototyping with various open-source 
  options available which facilitate converting an
 HTTP request's parameters into an object model of javabeans
 in a JPA persistence framework.
  
  
  You may want to check out Morph @ http://morph.sourceforge.net .  OOTB, it 
  can
 reflect ServletRequest parameters as bean properties and
 do a straight copy, as long as the servlet API is found on
 the classpath.
 
 I had a look at morph (following the link from the
 beanutils wiki) but their
 website didn't really enlighten me and what I did find
 didn't look very helpful,
 so I made a management decision not to pursue it.
 
 The problem is that there are that many little details to
 check for, e.g. can it handle sets, can it deduce the
 javabean items on generics, can it handle indexed lists of
 .0, .1, .2 notation etc
 

Morph is not generics-enabled; it can handle most of your basic non-generic 
constructs (e.g. Sets) right out of the box and just about anything else you 
can throw at it if you want to implement its API here and there for custom 
transformations, and while I am 100% sure it can handle [n] index notation I am 
about 90% sure it also handles indices as property names as you have described 
(.n)--if not, that is pluggable.  But this isn't the Morph list and, as you 
said, you made a management decision not to pursue it.  As a Morph team member 
I will take your documentation didn't look very helpful criticism under 
advisement as well.

Regards,
Matt

 Regards
 Adam
 
 -
 To unsubscribe, e-mail: user-unsubscr...@commons.apache.org
 For additional commands, e-mail: user-h...@commons.apache.org
 
 




-
To unsubscribe, e-mail: user-unsubscr...@commons.apache.org
For additional commands, e-mail: user-h...@commons.apache.org



Re: [beanutils] converting HTTP params into an arbitrary object model

2009-02-23 Thread Matt Benson

--- On Sat, 2/21/09, Adam Hardy ahardy.str...@cyberspaceroad.com wrote:

 From: Adam Hardy ahardy.str...@cyberspaceroad.com
 Subject: [beanutils] converting HTTP params into an arbitrary object model
 To: user@commons.apache.org
 Date: Saturday, February 21, 2009, 2:04 PM
 I have spent a day researching and
 prototyping with various open-source options available which
 facilitate converting an HTTP request's parameters into an
 object model of javabeans in a JPA persistence framework.
 
 I don't want to re-invent the wheel and I was quite
 confident that BeanUtils could handle it all, but I have now
 come across some areas where I need to code it myself.
 
 I just wanted to ask BeanUtils developers what the future
 holds in terms of my aims, as I'll take that as guidance on
 how much to code around BeanUtils and how much to compromise
 to get what I need, when there's a strong chance of being
 able to ditch the code I'll have to write now, to replace it
 with ideally just a couple of calls to BeanUtils.
 
 The main thing I have to work around is the inability of a
 custom Converter to know what class of entity beans belong
 in a list or set. If the Converter could see the entity bean
 owning the list (the parent in the parent-child entity
 relationship), then in Java 1.5+ it could work out by
 reflection how it has been parameterized with generics and
 which child entity bean belongs in the list.
 
 Just in case you were going to point me to OGNL to do this,
 thanks but I've been there and have some other issues with
 that.

You may want to check out Morph @ http://morph.sourceforge.net .  OOTB, it can 
reflect ServletRequest parameters as bean properties and do a straight copy, 
as long as the servlet API is found on the classpath.

HTH,
Matt

 
 Best regards
 Adam
 
 
 
 -
 To unsubscribe, e-mail: user-unsubscr...@commons.apache.org
 For additional commands, e-mail: user-h...@commons.apache.org
 
 


  

-
To unsubscribe, e-mail: user-unsubscr...@commons.apache.org
For additional commands, e-mail: user-h...@commons.apache.org



Re: JXPath over Generic Collection?, How?

2009-02-23 Thread Matt Benson

Andrew,
  I've been meaning to look into this but haven't yet.  If you have any 
ready-to-run code you can send to the list, that wouldn't hurt...

-Matt

--- On Mon, 2/23/09, Andrew Hughes ahhug...@gmail.com wrote:

 From: Andrew Hughes ahhug...@gmail.com
 Subject: Re: JXPath over Generic Collection?, How?
 To: Commons Users List user@commons.apache.org
 Date: Monday, February 23, 2009, 5:42 AM
 OK, email #19 to the list. I'm both
 incredibly patient and skeptical that
 this will ever work. I might try and run this in a debugger
 and track down
 how JXPath traverses the DynaBean but given the
 reflection involved
 that might be a painful task.
 --AH
 
 
 On Tue, Feb 17, 2009 at 1:11 PM, Andrew Hughes ahhug...@gmail.com
 wrote:
 
  Ping... if anyone can help with this JXPath 
 DynaBeans problem I'd be
  REALLY THANKFUL :)
 
 
  On Fri, Feb 13, 2009 at 1:55 PM, Andrew Hughes ahhug...@gmail.com
 wrote:
 
  Howdy,
  I've taken Matt's suggestion onboard and I have
 investigated DynaBeans.
  These look pretty good for all intestive purposes
 and there's a code
  examples below how to build the data structure:
 
  + root [...@name=ROOT]
      + animal [...@name=ANIMAL]
          + dog
 [...@name=DOG]
          
    + boxer [...@name=BOXER]
          
    + labrador [...@name=LABRADOR]
          + cat
 [...@name=CAT]
          
    + tiger [...@name=TIGER-ONE]
          
    + tiger [...@name=TIGER-TWO]
          
    + tiger [...@name=TIGER-THREE]
          
    + lion [...@name=LION]
 
 
  And the code looks like...
 
   LazyDynaBean lazyDynaBean = new
 LazyDynaBean(); //the transparent root.
   LazyDynaBean root = new LazyDynaBean();
  LazyDynaBean animal = new LazyDynaBean();
   LazyDynaBean dog = new LazyDynaBean();
  LazyDynaBean cat = new LazyDynaBean();
   LazyDynaBean boxer = new LazyDynaBean();
  LazyDynaBean labrador = new LazyDynaBean();
   LazyDynaBean tiger1 = new LazyDynaBean();
  LazyDynaBean tiger2 = new LazyDynaBean();
   LazyDynaBean tiger3 = new LazyDynaBean();
  LazyDynaBean lion = new LazyDynaBean();
   //set the @name property of each bean, user
 UPPER to make them distinct
  for examples.
  root.set(name,ROOT);
   animal.set(name,ANIMAL);
  dog.set(name,DOG);
   cat.set(name,CAT);
  boxer.set(name,BOXER);
   labrador.set(name,LABRADOR);
  tiger1.set(name,TIGER-ONE);
   tiger2.set(name,TIGER-TWO);
  tiger3.set(name,TIGER-THREE);
   lion.set(name,LION);
  //build the bean hierarchy.
   lazyDynaBean.set(root,0, root);
  root.set(animal,0, animal);
   animal.set(dog,0,dog);
  animal.set(cat,0,cat);
  dog.set(labrador,0,labrador);
   dog.set(boxer,0, boxer);
  cat.set(tiger,0,tiger1);//duplicate
   cat.set(tiger,1,tiger2);//duplicate
  cat.set(tiger,1,tiger3);//duplicate
   cat.set(lion,0,lion);
      
    JXPathContext context =
 JXPathContext.newContext(lazyDynaBean);
          String query
 = /root/animal/cat/tiger;
          Object value
 = context.getValue(query);
 
 
  But there's a problem with JXPath querying this
 also. Absolute Paths like
   '/root/animal/cat/tiger' or
 '/root/animal/cat/tiger'[2]' work perfectly.
  But I don't have anyluck doing deep searches.
 For examples the following
  just won't work.
  '//cat'
  //*...@name='LION']
  /root/animal/cat/tig...@name='TIGER-TWO']
 
  Things are looking up, but is this behavior to be
 expected?
 
   Cheers,
  --AH
 
 
  On Thu, Feb 12, 2009 at 6:43 AM, Matt Benson
 gudnabr...@yahoo.comwrote:
 
 
 
 
 
  --- On Wed, 2/11/09, Andrew Hughes ahhug...@gmail.com
 wrote:
 
   From: Andrew Hughes ahhug...@gmail.com
   Subject: Re: JXPath over Generic
 Collection?, How?
   To: Commons Users List user@commons.apache.org
   Date: Wednesday, February 11, 2009, 4:19
 AM
   Still No Luck, I have removed recursive
 generic collections
   and have tried
   the following code... this is becoming a
 marathon effort
   :'(
  
   public class Thing {
  
       public
 Thing(String name) {
       
    this.name = name;
       }
       private String
 name = ;
  
       public String
 getName() {
       
    return name;
       }
       private
 ArrayListThing children = new
   ArrayListThing();
  
       public
 ArrayListThing getChildren() {
       
    return children;
       }
  
   }
  
  
       public static
 void main(String[] args) {
       
    //get some same data
       
    Thing animal = new Thing(Animal);
       
    //Animal.Dog.*
       
    Thing dog = new Thing(Dog);
       
    dog.getChildren().add(new
   Thing(Labrador));
       
    dog.getChildren().add(new
   Thing(Boxer));
       
    animal.getChildren().add(dog);
       
    //Animal.Cat.*
       
    Thing cat = new Thing(Cat);
       
    cat.getChildren().add(new Thing(Lion));
       
    cat.getChildren().add(new
   Thing(Tiger));
       
    animal.getChildren().add(cat);
  
       
    //run a query on it
       
    JXPathContext context =
   JXPathContext.newContext(animal);
       
    String query = /Animal;
       
    Thing result = (Thing)
 context.getValue

Re: JXPath over Generic Collection?, How?

2009-02-23 Thread Matt Benson

And the answer is:

  In JXPath, a decision was made to overload the name attribute to refer to an 
element's property name WRT its parent.  The reason this was done was to 
support query maps with non-String keys in JXPath.  This means that anytime you 
actually want to refer to a property whose name literally is name, you must 
treat it as a child element rather than an attribute.  So in your case you 
could either change name to title and query [...@title='foo'] or simply use 
[name='foo'].

Regards,
Matt

--- On Mon, 2/23/09, Matt Benson gudnabr...@yahoo.com wrote:

 From: Matt Benson gudnabr...@yahoo.com
 Subject: Re: JXPath over Generic Collection?, How?
 To: Commons Users List user@commons.apache.org
 Date: Monday, February 23, 2009, 2:58 PM
 
 To follow up, the 'name' attribute in particular is what
 doesn't seem to be working here (change it to e.g. 'game'
 and it works fine)... if you could file a bug it would help
 me remember as I don't have time to do it myself right this
 minute.
 
 -Matt
 
 --- On Mon, 2/23/09, Matt Benson gudnabr...@yahoo.com
 wrote:
 
  From: Matt Benson gudnabr...@yahoo.com
  Subject: Re: JXPath over Generic Collection?,
 How?
  To: Commons Users List user@commons.apache.org
  Date: Monday, February 23, 2009, 12:27 PM
  
  Andrew,
    I've been meaning to look into this but haven't
  yet.  If you have any ready-to-run code you can send
 to
  the list, that wouldn't hurt...
  
  -Matt
  
  --- On Mon, 2/23/09, Andrew Hughes ahhug...@gmail.com
  wrote:
  
   From: Andrew Hughes ahhug...@gmail.com
   Subject: Re: JXPath over Generic
 Collection?,
  How?
   To: Commons Users List user@commons.apache.org
   Date: Monday, February 23, 2009, 5:42 AM
   OK, email #19 to the list. I'm both
   incredibly patient and skeptical that
   this will ever work. I might try and run this in
 a
  debugger
   and track down
   how JXPath traverses the DynaBean but given
 the
   reflection involved
   that might be a painful task.
   --AH
   
   
   On Tue, Feb 17, 2009 at 1:11 PM, Andrew Hughes
 ahhug...@gmail.com
   wrote:
   
Ping... if anyone can help with this JXPath
  
   DynaBeans problem I'd be
REALLY THANKFUL :)
   
   
On Fri, Feb 13, 2009 at 1:55 PM, Andrew
 Hughes
  ahhug...@gmail.com
   wrote:
   
Howdy,
I've taken Matt's suggestion onboard and
 I
  have
   investigated DynaBeans.
These look pretty good for all
 intestive
  purposes
   and there's a code
examples below how to build the data
  structure:
   
+ root [...@name=ROOT]
        + animal [...@name=ANIMAL]
            + dog
   [...@name=DOG]
            
      + boxer [...@name=BOXER]
            
      + labrador [...@name=LABRADOR]
            + cat
   [...@name=CAT]
            
      + tiger [...@name=TIGER-ONE]
            
      + tiger [...@name=TIGER-TWO]
            
      + tiger [...@name=TIGER-THREE]
            
      + lion [...@name=LION]
   
   
And the code looks like...
   
     LazyDynaBean lazyDynaBean = new
   LazyDynaBean(); //the transparent root.
     LazyDynaBean root = new
 LazyDynaBean();
LazyDynaBean animal = new
 LazyDynaBean();
     LazyDynaBean dog = new
 LazyDynaBean();
LazyDynaBean cat = new LazyDynaBean();
     LazyDynaBean boxer = new
 LazyDynaBean();
LazyDynaBean labrador = new
 LazyDynaBean();
     LazyDynaBean tiger1 = new
 LazyDynaBean();
LazyDynaBean tiger2 = new
 LazyDynaBean();
     LazyDynaBean tiger3 = new
 LazyDynaBean();
LazyDynaBean lion = new LazyDynaBean();
     //set the @name property of each
 bean,
  user
   UPPER to make them distinct
for examples.
root.set(name,ROOT);
     animal.set(name,ANIMAL);
dog.set(name,DOG);
     cat.set(name,CAT);
boxer.set(name,BOXER);
     labrador.set(name,LABRADOR);
tiger1.set(name,TIGER-ONE);
     tiger2.set(name,TIGER-TWO);
tiger3.set(name,TIGER-THREE);
     lion.set(name,LION);
//build the bean hierarchy.
     lazyDynaBean.set(root,0, root);
root.set(animal,0, animal);
     animal.set(dog,0,dog);
animal.set(cat,0,cat);
dog.set(labrador,0,labrador);
     dog.set(boxer,0, boxer);
cat.set(tiger,0,tiger1);//duplicate
     cat.set(tiger,1,tiger2);//duplicate
cat.set(tiger,1,tiger3);//duplicate
     cat.set(lion,0,lion);
        
      JXPathContext context =
   JXPathContext.newContext(lazyDynaBean);
            String query
   = /root/animal/cat/tiger;
            Object value
   = context.getValue(query);
   
   
But there's a problem with JXPath
 querying
  this
   also. Absolute Paths like
     '/root/animal/cat/tiger' or
   '/root/animal/cat/tiger'[2]' work perfectly.
But I don't have anyluck doing deep
  searches.
   For examples the following
just won't work.
'//cat'
//*...@name='LION']
   
 /root/animal/cat/tig...@name='TIGER-TWO']
   
Things are looking up, but is this
 behavior
  to be
   expected?
   
     Cheers,
--AH
   
   
On Thu, Feb 12, 2009 at 6:43 AM, Matt
 Benson
   gudnabr

Re: JXPath over Generic Collection?, How?

2009-02-23 Thread Matt Benson

I won't get to look at this again at least before tomorrow (9PM for me now and 
still have some late-night $work to look at), but I thought I would mention 
straight off that the @name feature actually IS mentioned in the userguide 
under the section about working with (java.util.)Maps.  If you have a 
suggestion of where in the guide would be another good place to mention it as a 
caveat and/or even the wording to use, feel free to open a documentation issue 
in JIRA for it.

TBC,
Matt

--- On Mon, 2/23/09, Andrew Hughes ahhug...@gmail.com wrote:

 From: Andrew Hughes ahhug...@gmail.com
 Subject: Re: JXPath over Generic Collection?, How?
 To: Commons Users List user@commons.apache.org
 Date: Monday, February 23, 2009, 6:24 PM
 Hi Matt,
 Thanks HEAPS for you reply, I am really really really
 grateful. I think that
 I have progressed just a little with this but there are
 still some BIG
 shortfalls with this. I've attached code that should run
 out the box and is
 based on previous emails. If I can get the expressions
 below to correctly
 evaluate I would be heaps happy.
 
 Thanks heaps again, hopefully this will work soon enough.
 
 p.s. I can understand the 'name' vs '@name', perhaps the
 userguide could
 mention this is about all I can add.
 
 
 code...
 
 package rnd;
 
 import java.util.ArrayList;
 
 import org.apache.commons.beanutils.LazyDynaBean;
 import org.apache.commons.jxpath.JXPathContext;
 import org.apache.log4j.Logger;
 
 public class Main {
 
 private static final Logger log =
 Logger.getLogger(Main.class);
 
 public static void main(String[] args) {
 log.info(Starting...);
 LazyDynaBean lazyDynaBean = new LazyDynaBean(); //the
 transparent root.
 LazyDynaBean root = new LazyDynaBean();
 LazyDynaBean animal = new LazyDynaBean();
 LazyDynaBean dog = new LazyDynaBean();
 LazyDynaBean cat = new LazyDynaBean();
 LazyDynaBean boxer = new LazyDynaBean();
 LazyDynaBean labrador = new LazyDynaBean();
 LazyDynaBean tiger1 = new LazyDynaBean();
 LazyDynaBean tiger2 = new LazyDynaBean();
 LazyDynaBean tiger3 = new LazyDynaBean();
 LazyDynaBean lion = new LazyDynaBean();
 //set the @objectName property of each bean, user UPPER to
 make them
 distinct for examples.
 root.set(objectName,ROOT);
 animal.set(objectName,ANIMAL);
 dog.set(objectName,DOG);
 cat.set(objectName,CAT);
 boxer.set(objectName,BOXER);
 labrador.set(objectName,LABRADOR);
 tiger1.set(objectName,TIGER-ONE);
 tiger2.set(objectName,TIGER-TWO);
 tiger3.set(objectName,TIGER-THREE);
 lion.set(objectName,LION);
 //build the bean hierarchy.
 lazyDynaBean.set(root,0, root);
 root.set(animal,0, animal);
 animal.set(dog,0,dog);
 animal.set(cat,0,cat);
 dog.set(labrador,0,labrador);
 dog.set(boxer,0, boxer);
 cat.set(tiger,0,tiger1);//duplicate
 cat.set(tiger,1,tiger2);//duplicate
 cat.set(tiger,2,tiger3);//duplicate
 cat.set(lion,0,lion);
         JXPathContext context =
 JXPathContext.newContext(lazyDynaBean);
 
         //these all work
        
 runEvaluation(/root/animal/dog, context); //absolute 
 single
        
 runEvaluation(/root/animal/cat/tiger[2], context);
 //absolute 
 single
        
 runEvaluation(/root/animal/cat/tiger, context); //absolute
 
 multiple
         //everything below fails
        
 runEvaluation(/root/animal/cat/tiger[last()], context);
 //absolute
  single
        
 runEvaluation(/root/animal/dog/*, context); //absolute
  multiple
         runEvaluation(//dog,
 context); //deep search
         runEvaluation(//dog/*,
 context);//deep multiple
        
 runEvaluation(//cat/*[objectName='LION'], context);//deep
 filter
 
 }
  public static void runEvaluation(String
 expression,JXPathContext context){
 log.info(About to evaulate the expression: +expression);
         try {
 Object value = context.getValue(expression);
 //we got a single result.
 if (value instanceof LazyDynaBean) {
 LazyDynaBean r =
 (LazyDynaBean)context.getValue(expression);
 log.info(Ran ' + expression + ' and got objectName=' +
 r.get(objectName) + ');
  }
 //we got multiple results
 else if (value instanceof ArrayList) {
 String titles = ;
 for (LazyDynaBean bean : ((ArrayListLazyDynaBean)
 value )){
 titles += (bean.get(objectName)+,);
 }
 log.info(Ran  + expression +  and got
 +((ArrayList)value).size()+
 results: +titles);
 }
 //we got a non-dyna bean.
 else {
 log.info(Ran ' + expression + ' and got a class ' +
 value.getClass().getName() + ' with toString() '
 +value.toString() + ');
 }
 } catch (Exception e) {
 log.error(e);
 }
 }
 }
 
 
 
 
 
 On Tue, Feb 24, 2009 at 8:58 AM, Matt Benson gudnabr...@yahoo.com
 wrote:
 
 
  And the answer is:
 
   In JXPath, a decision was made to overload the
 name attribute to refer to
  an element's property name WRT its parent.  The
 reason this was done was
  to support query maps with non-String keys in
 JXPath.  This means that
  anytime you actually want to refer to a property whose
 name literally is
  name, you must treat it as a child element rather
 than an attribute.  So
  in your case you

Re: [JXPath] Set a property in the whole graph

2009-02-11 Thread Matt Benson

String xpath = descendant-or-self::id;
for (IteratorPointer it = context.iteratePointers(xpath); it
.hasNext();) {
it.next().setValue(null);
}

HTH,
Matt

--- On Wed, 2/11/09, Adrian Mitev adrian.mi...@googlemail.com wrote:

 From: Adrian Mitev adrian.mi...@googlemail.com
 Subject: [JXPath] Set a property in the whole graph
 To: user@commons.apache.org
 Date: Wednesday, February 11, 2009, 5:43 AM
 Hi all! I'm new to JXPath. Is there an easy way to
 traverse the entire
 object graph and set all properties with name 'id'
 to null? Could not
 find something similar in the user's guide.
 
 -- 
 Although nobody can come back and make a new start, anyone
 can start
 now and make a new end
 
 -
 To unsubscribe, e-mail: user-unsubscr...@commons.apache.org
 For additional commands, e-mail:
 user-h...@commons.apache.org


  

-
To unsubscribe, e-mail: user-unsubscr...@commons.apache.org
For additional commands, e-mail: user-h...@commons.apache.org



Re: JXPath over Generic Collection?, How?

2009-02-11 Thread Matt Benson




--- On Wed, 2/11/09, Andrew Hughes ahhug...@gmail.com wrote:

 From: Andrew Hughes ahhug...@gmail.com
 Subject: Re: JXPath over Generic Collection?, How?
 To: Commons Users List user@commons.apache.org
 Date: Wednesday, February 11, 2009, 4:19 AM
 Still No Luck, I have removed recursive generic collections
 and have tried
 the following code... this is becoming a marathon effort
 :'(
 
 public class Thing {
 
 public Thing(String name) {
 this.name = name;
 }
 private String name = ;
 
 public String getName() {
 return name;
 }
 private ArrayListThing children = new
 ArrayListThing();
 
 public ArrayListThing getChildren() {
 return children;
 }
 
 }
 
 
 public static void main(String[] args) {
 //get some same data
 Thing animal = new Thing(Animal);
 //Animal.Dog.*
 Thing dog = new Thing(Dog);
 dog.getChildren().add(new
 Thing(Labrador));
 dog.getChildren().add(new
 Thing(Boxer));
 animal.getChildren().add(dog);
 //Animal.Cat.*
 Thing cat = new Thing(Cat);
 cat.getChildren().add(new Thing(Lion));
 cat.getChildren().add(new
 Thing(Tiger));
 animal.getChildren().add(cat);
 
 //run a query on it
 JXPathContext context =
 JXPathContext.newContext(animal);
 String query = /Animal;
 Thing result = (Thing) context.getValue(query);
 String path = context.getPointer(query).asPath();
 System.out.println(Ran ' + query +
 ' and got ' +
 result.getName() + ' on path ' + path +
 '.);
 }
 

What would you be trying to select?  If you want to know how to look for a 
given Thing in this graph, I can probably help.  If you want to know what graph 
will allow you to use a preconceived notion of the xpath you want to use, that 
will be harder.  You might use [beanutils] dynabeans in conjunction with 
[jxpath] to try and achieve the latter.

-Matt

 
 
 
 On Wed, Feb 11, 2009 at 3:08 PM, Andrew Hughes
 ahhug...@gmail.com wrote:
 
  Yeah, that makes sense. The part that was confusing me
 is that if I
  have...
 
  public class Thing {
 
 private ListThing children;
 
  }
 
  I was assuming I would need to prefix all of my
 expressions steps with
  '/children'. From what you said earlier this
 is not the case as collections
  are auto traversed/loaded.
 
  Thanks again matt! I won't get to test this out
 til later tonight be look
  foward to seeing it working!!!
 
  Andrew
 
 
  On Wed, Feb 11, 2009 at 2:57 PM, Matt Benson
 gudnabr...@yahoo.com wrote:
 
 
  It should be as simple as Thing _containing_ a
 ListThing rather than
  _being_ a ListThing.  Composition over
 inheritance, do you see?
 
  HTH,
  Matt
 
 
  --- On Tue, 2/10/09, Andrew Hughes
 ahhug...@gmail.com wrote:
 
   From: Andrew Hughes
 ahhug...@gmail.com
   Subject: Re: JXPath over Generic
 Collection?, How?
   To: Commons Users List
 user@commons.apache.org,
  gudnabr...@yahoo.com
   Date: Tuesday, February 10, 2009, 7:06 PM
   Matt, Thank You.
  
   Is there any other data structure I can use
 that would work
   with JXPath? My
   requirement is that... a Thing
 can have contain
   multiple child Thing(s)
   (and the children are allowed to be
 non-unique).
   This is equivalent to an XML element as it
 can contain
   multiple child
   elements, how do these guy's handle it I
 wonder?
  
   --Andrew
  
  
   On Wed, Feb 11, 2009 at 9:09 AM, Matt Benson
   gudnabr...@yahoo.com wrote:
  
   
I admit I hadn't looked at this with
 a highly
   critical eye, but this
business of Thing extending
 ArrayListThing
   seems quite strange to me.
 JXPath basically functions by
 opening up
   collections automatically, so
the very fact that Thing is itself a
 Collection
   implies that a Thing will be
opened up, and its children will be
 searched... but in
   this example, either
there are no children, at the leaves, or
 the children
   themselves are
(possibly empty) collections.  It looks
 as though
   you're trying to represent
a tree structure.  This may be a good
 example of a
   reason for the idea of
composition over inheritance.  I
 don't think
   you're going to get any
traction using JXPath with this object
 model.
   
Sorry for the bad news,
Matt
   
   
--- On Tue, 2/10/09, Andrew Hughes
   ahhug...@gmail.com wrote:
   
 From: Andrew Hughes
 ahhug...@gmail.com
 Subject: Re: JXPath over Generic
   Collection?, How?
 To: Commons Users List
   user@commons.apache.org
 Date: Tuesday, February 10, 2009,
 7:16 AM
 Still busted. Example is now
 simplified. As soon
   as a
 generic Collection
 becomes involved BOOM!

 The Main Method to exec:
 public class App {
 public static void main(
 String[] args ){
 JXPathContext context =
 JXPathContext.newContext(new
 ThingRoot());


  
 System.out.println(((Thing)context.getValue(/root

Re: JXPath over Generic Collection?, How?

2009-02-10 Thread Matt Benson
+');
 
  }
 
  }
 
 
 
  Above, should find one entry for
 'name=Tiger' but it does not, I get an
  exception. This still doesn't seem to traverse
 the Collection correctly. Any
  help would be most welcome.
  Exception in thread main
  org.apache.commons.jxpath.JXPathNotFoundException:
 No value for xpath:
  //hierarchypo...@name='Tiger']
 
  Thanks for reading,
  Andrew
 
 
 
  On Mon, Feb 9, 2009 at 10:24 PM, Andrew Hughes
 ahhug...@gmail.comwrote:
 
  Thanks Matt - I will test this out tomorrow
 when I am back in the
  office...
 
  Being constructive...
  Surely this should at least be a precondition
 check and throw a specific
  exception if it's not supported?
  Thank You
  --Andrew
 
 
  On Mon, Feb 9, 2009 at 2:27 PM, Matt Benson
 gudnabr...@yahoo.comwrote:
 
 
  Most likely your problem is not with
 generics, but simply with the fact
  that JXPath has a hard time using a
 collection as its root.  The easiest
  workaround is to use some parent object to
 hold a reference to your
  container.
 
  HTH,
  Matt
 
 
  --- On Sun, 2/8/09, Andrew Hughes
 ahhug...@gmail.com wrote:
 
   From: Andrew Hughes
 ahhug...@gmail.com
   Subject: JXPath over Generic
 Collection?, How?
   To: Commons Users List
 user@commons.apache.org
   Date: Sunday, February 8, 2009, 5:09
 PM
   Hi All,
   Hopefully the solution is as easy as
 the question. I would
   like to perform
   evaluation on a (very simple) generic
 collection... as you
   can see below
   (HeirarchyPojo). I should be able to
 ask for a
   HeirarchyPojo's with
   name='Bill' or the 3rd
 Child... The problem is that
   nothing ever evaluate on
   this data structure. What's the
 deal with Generic
   Collections and JXPath?
  
   p.s this is not in the userguide and
 would be a most
   welcomed addition (if
   we can nut this out with your help).
  
   Cheers.
  
  
   package xpath.and.generics;
  
   import java.util.ArrayList;
  
   public class HeirarchyPojo extends
   ArrayListHeirarchyPojo{
  
   public HeirarchyPojo(){}
  
   private String id;
   private String name;
  
   public String getId() {
   return id;
   }
  
   public void setId(String id) {
   this.id = id;
   }
  
   public String getName() {
   return name;
   }
  
   public void setName(String name)
 {
   this.name = name;
   }
  
   }
 
 
 
 
 
 -
  To unsubscribe, e-mail:
 user-unsubscr...@commons.apache.org
  For additional commands, e-mail:
 user-h...@commons.apache.org
 
 
 
 
 


  

-
To unsubscribe, e-mail: user-unsubscr...@commons.apache.org
For additional commands, e-mail: user-h...@commons.apache.org



Re: JXPath over Generic Collection?, How?

2009-02-10 Thread Matt Benson

It should be as simple as Thing _containing_ a ListThing rather than _being_ 
a ListThing.  Composition over inheritance, do you see?

HTH,
Matt


--- On Tue, 2/10/09, Andrew Hughes ahhug...@gmail.com wrote:

 From: Andrew Hughes ahhug...@gmail.com
 Subject: Re: JXPath over Generic Collection?, How?
 To: Commons Users List user@commons.apache.org, gudnabr...@yahoo.com
 Date: Tuesday, February 10, 2009, 7:06 PM
 Matt, Thank You.
 
 Is there any other data structure I can use that would work
 with JXPath? My
 requirement is that... a Thing can have contain
 multiple child Thing(s)
 (and the children are allowed to be non-unique).
 This is equivalent to an XML element as it can contain
 multiple child
 elements, how do these guy's handle it I wonder?
 
 --Andrew
 
 
 On Wed, Feb 11, 2009 at 9:09 AM, Matt Benson
 gudnabr...@yahoo.com wrote:
 
 
  I admit I hadn't looked at this with a highly
 critical eye, but this
  business of Thing extending ArrayListThing
 seems quite strange to me.
   JXPath basically functions by opening up
 collections automatically, so
  the very fact that Thing is itself a Collection
 implies that a Thing will be
  opened up, and its children will be searched... but in
 this example, either
  there are no children, at the leaves, or the children
 themselves are
  (possibly empty) collections.  It looks as though
 you're trying to represent
  a tree structure.  This may be a good example of a
 reason for the idea of
  composition over inheritance.  I don't think
 you're going to get any
  traction using JXPath with this object model.
 
  Sorry for the bad news,
  Matt
 
 
  --- On Tue, 2/10/09, Andrew Hughes
 ahhug...@gmail.com wrote:
 
   From: Andrew Hughes ahhug...@gmail.com
   Subject: Re: JXPath over Generic
 Collection?, How?
   To: Commons Users List
 user@commons.apache.org
   Date: Tuesday, February 10, 2009, 7:16 AM
   Still busted. Example is now simplified. As soon
 as a
   generic Collection
   becomes involved BOOM!
  
   The Main Method to exec:
   public class App {
   public static void main( String[] args ){
   JXPathContext context =
   JXPathContext.newContext(new ThingRoot());
  
  
 System.out.println(((Thing)context.getValue(/root)).getName());
   }
   }
  
   The (populated) context root I am using, where
 root is a
   single object
   holding a List of Thing's.
   package jxpathresearch;
  
   import java.util.ArrayList;
   import java.util.List;
  
   public class ThingRoot {
   private ListThing root new
 ArrayList(); //this
   will serve as the root.
   public ThingRoot() {
   Thing animal = new
 Thing(Animal);
   root.add(animal);//Animal
   Thing dog = new Thing(Dog);
   animal.add(dog);//Animal.Dog
   dog.add(new
  
 Thing(Labrador));//Animal.Dog.Labrador
   dog.add(new
   Thing(Boxer));//Animal.Dog.Boxer
   }
   public ListThing getRoot() { return
 root; }
   }
  
   Finally here's a very simple 'Thing'
 that
   contains a List of Thing(s):
   public class Thing extends ArrayListThing
 {
   public Thing(String name){this.name = name;}
   private String name = ;
   public String getName() {return name;}
   }
  
   I can't query anything beyond /root, it
 doesn't
   seem to ever get traversed.
   I would expect results for //Thing and
   //thi...@name='Labrador'] etc but I
   get no results only exceptions.
  
  
   My brain is hurting.
  
  
  
   On Tue, Feb 10, 2009 at 12:22 AM, Andrew Hughes
   ahhug...@gmail.com wrote:
  
I've noew tested a whole heap of
 expressions even
   //name='Tiger' nothing
works.
   
On Tue, Feb 10, 2009 at 12:01 AM, Andrew
 Hughes
   ahhug...@gmail.comwrote:
   
I got cracking on testing this out... no
 luck
   (yet). Here's my testing
code if some kind person could please
 take a
   look
First my generic collection hierarchy
 (which only
   contains a name and
children)...
   
package jxpathresearch;
   
import java.util.ArrayList;
   
public class HierarchyPojo extends
   ArrayListHierarchyPojo {
   
public HierarchyPojo(String name){
this.setName(name);
}
private String name = ;
   
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
   
}
   
   
Next, the wrapper for the root context
 (as Matt
   suggested) and populated
with animals...
   
package jxpathresearch;
   
   
public class CollectionRoot {
   
   
private HierarchyPojo hierarchyPojo;
   
   
public CollectionRoot(){
   
//Animal
   
hierarchyPojo = new
   HierarchyPojo(Animal);
   
//Animal.Dog
   
HierarchyPojo dog = new
   HierarchyPojo(Dog);
   
//Animal.Dog.Labrador
   
dog.add(new
   HierarchyPojo(Labrador));
   
//Animal.Dog.Boxer
   
dog.add(new

Re: JXPath - is JXPath dead in the water?

2009-02-02 Thread Matt Benson

--- Adrian Mitev adrian.mi...@googlemail.com wrote:

 On Mon, Feb 2, 2009 at 5:10 PM, Matt Benson
 gudnabr...@yahoo.com wrote:
 
  --- Andrew Hughes ahhug...@gmail.com wrote:
 
  Hi All,
  Is JXPath dead in the water? I can't find a post
  here in 2009 and very
  limited posts in 2008.
 
  Hi Andrew,
   JXPath is considered to be in maintenance mode.
  In general, this means that this component is
  considered to be more or less complete and that
 for
  the most part, changes to the code will target
 bugs.
  Specifically with regard to JXPath, any new
 features
  considered would address shortcomings with support
 for
  the XPath 1.0 specification.  If you encounter
 issues
  with JXPath feel free to post your questions to
 this
  list; if you don't get an answer the first time
 just
  keep pushing!  ;)
 
  HTH,
  Matt
 
 Will XPath2 be supported in the near future?

Originally that was under consideration, but to be
honest everything I personally know about XPath (1.0)
I learned in the course of supporting JXPath, so as
JXPath's primary maintainer I presently don't consider
myself capable of making such an upgrade.  There is an
open JIRA issue for XPath 2.0 support: 
http://issues.apache.org/jira/browse/JXPATH-67;
further if you or anyone else has ideas on this feel
free to start a discussion thread on
d...@commons.apache.org (the real convention on these
mailing lists is to preface your subject with the
component ID e.g. [jxpath] XPath 2 support).  A nice
start might be a boiled-down list of the basic
differences between versions 1 and 2.

-Matt

 

-
 To unsubscribe, e-mail:
 user-unsubscr...@commons.apache.org
 For additional commands, e-mail:
 user-h...@commons.apache.org
 
 



  

-
To unsubscribe, e-mail: user-unsubscr...@commons.apache.org
For additional commands, e-mail: user-h...@commons.apache.org



Re: [vfs] Copying byte[] to destination file

2009-01-23 Thread Matt Benson
Note that I have added the component ID to the subject
line:

I'm not sure I entirely understand the question.  If I
wanted to copy a byte[] to a VFS FileObject I would
use commons-io IOUtils to copy the byte[] to
fileObject.getContent().getOutputStream().  Does this
help?

-Matt

--- Walter, Patrick A
patrick.a.wal...@usa-spaceops.com wrote:

 Trying to find API to send in a byte[] to copy to
 destination. We build a byte[] that would normally
 be written to a file, BUT I thought it would be more
 efficient to just tell VFS API to send the data to
 the destination.
  
 Is there a way to do this, besides creating a file
 first???
  
 thanks
 



  

-
To unsubscribe, e-mail: user-unsubscr...@commons.apache.org
For additional commands, e-mail: user-h...@commons.apache.org



RE: [vfs] Copying byte[] to destination file

2009-01-23 Thread Matt Benson

--- Walter, Patrick A
patrick.a.wal...@usa-spaceops.com wrote:

 Thanks for your quick response!!!
 
 Ok so I would do some thing like this...
 
 void writeToFile(byte[] data, String outfilename) {
FileSystemManager fsm = VFS.getManager();
FileObject outFileObject =
 fsm.resolveFile(outfilename);
OutputStream os =
 outFileObject.getContent().getOutputStream();
os.write(data);
 }
 
 Does this look right?
 Will this work for all types of file output (FTP,
 Local, HTTP, HTTPS, SFTP, et.)?

I am not an authority on VFS, but that looks correct
(beyond that I would, as I stated before, use some
sort of buffering strategy in the write such as that
employed by IOUtils' copy(..) methods).

-Matt

 
 thanks
 
 
 
 
 -Original Message-
 From: Matt Benson [mailto:gudnabr...@yahoo.com] 
 Sent: Friday, January 23, 2009 12:01 PM
 To: Commons Users List
 Subject: Re: [vfs] Copying byte[] to destination
 file
 
 Note that I have added the component ID to the
 subject
 line:
 
 I'm not sure I entirely understand the question.  If
 I wanted to copy a byte[] to a VFS FileObject I
 would use commons-io IOUtils to copy the byte[] to
 fileObject.getContent().getOutputStream().  Does
 this help?
 
 -Matt
 
 --- Walter, Patrick A
 patrick.a.wal...@usa-spaceops.com wrote:
 
  Trying to find API to send in a byte[] to copy to
 destination. We 
  build a byte[] that would normally be written to a
 file, BUT I thought 
  it would be more efficient to just tell VFS API to
 send the data to 
  the destination.
   
  Is there a way to do this, besides creating a file
 first???
   
  thanks
  
 
 
 
   
 

-
 To unsubscribe, e-mail:
 user-unsubscr...@commons.apache.org
 For additional commands, e-mail:
 user-h...@commons.apache.org
 
 

-
 To unsubscribe, e-mail:
 user-unsubscr...@commons.apache.org
 For additional commands, e-mail:
 user-h...@commons.apache.org
 
 



  

-
To unsubscribe, e-mail: user-unsubscr...@commons.apache.org
For additional commands, e-mail: user-h...@commons.apache.org



RE: [vfs] Copying byte[] to destination file

2009-01-23 Thread Matt Benson

--- Walter, Patrick A
patrick.a.wal...@usa-spaceops.com wrote:

 OK... 
 Do you mean the IOUtil's from VFS or java? 

I meant from commons-io.

 There is a VFS FileUtil with a
 writeContent(FileObject file, java.io.OutputStream
 outstr) method. But what I want something like
 writeContent(byte[] data,
 java.io.OutputStream outstr) or
 writeContent(byte[] data, FileObject out) 
 
 What does VFS have for buffering?

Nothing I can see, but again, I don't have any
particular expertise with the API.

-Matt

 
 thanks
 
 
 
 -Original Message-
 From: Matt Benson [mailto:gudnabr...@yahoo.com] 
 Sent: Friday, January 23, 2009 12:37 PM
 To: Commons Users List
 Subject: RE: [vfs] Copying byte[] to destination
 file
 
 
 --- Walter, Patrick A
 patrick.a.wal...@usa-spaceops.com wrote:
 
  Thanks for your quick response!!!
  
  Ok so I would do some thing like this...
  
  void writeToFile(byte[] data, String outfilename)
 {
 FileSystemManager fsm = VFS.getManager();
 FileObject outFileObject =
  fsm.resolveFile(outfilename);
 OutputStream os =
  outFileObject.getContent().getOutputStream();
 os.write(data);
  }
  
  Does this look right?
  Will this work for all types of file output (FTP,
 Local, HTTP, HTTPS, 
  SFTP, et.)?
 
 I am not an authority on VFS, but that looks correct
 (beyond that I would, as I stated before, use some
 sort of buffering strategy in the write such as that
 employed by IOUtils' copy(..) methods).
 
 -Matt
 
  
  thanks
  
  
  
  
  -Original Message-
  From: Matt Benson [mailto:gudnabr...@yahoo.com]
  Sent: Friday, January 23, 2009 12:01 PM
  To: Commons Users List
  Subject: Re: [vfs] Copying byte[] to destination
 file
  
  Note that I have added the component ID to the
 subject
  line:
  
  I'm not sure I entirely understand the question. 
 If I wanted to copy 
  a byte[] to a VFS FileObject I would use
 commons-io IOUtils to copy 
  the byte[] to
 fileObject.getContent().getOutputStream().  Does
 this 
  help?
  
  -Matt
  
  --- Walter, Patrick A
  patrick.a.wal...@usa-spaceops.com wrote:
  
   Trying to find API to send in a byte[] to copy
 to
  destination. We
   build a byte[] that would normally be written to
 a
  file, BUT I thought
   it would be more efficient to just tell VFS API
 to
  send the data to
   the destination.

   Is there a way to do this, besides creating a
 file
  first???

   thanks
   
  
  
  

  
 

-
  To unsubscribe, e-mail:
  user-unsubscr...@commons.apache.org
  For additional commands, e-mail:
  user-h...@commons.apache.org
  
  
 

-
  To unsubscribe, e-mail:
  user-unsubscr...@commons.apache.org
  For additional commands, e-mail:
  user-h...@commons.apache.org
  
  
 
 
 
   
 

-
 To unsubscribe, e-mail:
 user-unsubscr...@commons.apache.org
 For additional commands, e-mail:
 user-h...@commons.apache.org
 
 

-
 To unsubscribe, e-mail:
 user-unsubscr...@commons.apache.org
 For additional commands, e-mail:
 user-h...@commons.apache.org
 
 



  

-
To unsubscribe, e-mail: user-unsubscr...@commons.apache.org
For additional commands, e-mail: user-h...@commons.apache.org



Re: [JXPATH] getting Containers in iteration (additional info)

2008-08-18 Thread Matt Benson
--- Harald Finster [EMAIL PROTECTED] wrote:

 Hello again,
 
 I would just like to add  an other observation:
 
 If I add
  MapT,T map ;
 to my 'Book', I get the 'expected' result for the
 map property ,
 i.e. iterating with /* as XPath results in the
 following:
 
 title  = Book Title
 authors[1] = First Author
 authors[2] = Second Author
 map= {key1=value1, key2=value2, key3=value3}
 
 This looks somewhat inconsistent to me?

Remember that JXPath more or less exposes the Java
object graph as an XML document, so the rules it uses
to do so may seem somewhat arbitrary.  There are some
comments at
https://issues.apache.org/jira/browse/JXPATH-86
relating to the idea of reading the list property
directly.  The upshot is that iteration e.g. /*
can't yield the collection directly, though you can
select it directly by name/path.  With regard to maps,
the decision was made in the beginning to implement
JXPath such that Maps are exposed as bare objects;
note that a Map is not a collection.  Consider that
unless a Map's keys are Strings there is no guarantee
that a reasonable path step could be interpolated for
a given Map entry; this is probably the most direct
reason I could speculate for the decision not to
handle Maps in any special way in JXPath.

HTH,
Matt

 
 Greetings Harald
 
 Harald Finster wrote:
  Hello,
  
  this is my first posting to this list, so forgive
 me, if I am
  asking dump questions. (At least I had a look at
 the archive.)
  
  I would like to ask, if it is possible to get
 containers
  (e.g. Lists) 'as they are' in an iteration.
  
  Consider the following bean:
  
  public class Book {
  String title;
  ListWriter authors;
  }
  
  Iterating this bean with
  
  JXPathContext context =
 JXPathContext.newContext(book);
  i = context.iteratePointers(/*);
  
  results in the following:
  
  title  = Book Title
  authors[1] = First Author
  authors[2] = Second Author
  ...
  
  i.e. the List is iterated instead of being
 returned as a List-Object.
  Obviously, each list-item is regarded as a direct
 child of the root
  of the Book object.
  
  Is there any way to avoid this behavior?
  i.e. is it possible to get something like
  
  title   = Book Title
  authors = [ First Author, Second Author ... ]
 i.e. ListAuthor
  
  
  
  In XML-notation the difference would be like this:
  
  The current behavior of 'iterate':
  
  book
  titleBook Title/title
  authorsFirst Author/authors
  authorsSecond Author/authors
  /book
  
  
  what I would like to see is an equivalent of:
  
  book
  titleBook Title/title
  authors
  1First Author/1
  2Second Author/2
  /authors
  /book
  
  
  By the way: in contrast to 'iterate'
 'getValue(authors) returns
  ListAuthor
  
  
  I would be grateful for any thoughts and
 suggestions.
  
  With kind regards
  
  Harald
  
  
 
 -- 
 Dr.-Ing. Harald Finster / Aachen Germany
 http://www.finster-stahlart.de industrial history
 and architecture
 http://www.astrid-aix.de   gallery: watercolours
 and oil paintings
 

-
 To unsubscribe, e-mail:
 [EMAIL PROTECTED]
 For additional commands, e-mail:
 [EMAIL PROTECTED]
 
 



  

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: [jxpath] JXPath 1.3 Status

2008-06-30 Thread Matt Benson
Yes, JXPath 1.3 has actually had three release
candidates cut; a fourth should come very soon.  So
JXPath 1.3 should be released sometime in July.

-Matt

--- Matt Accola [EMAIL PROTECTED] wrote:

 Is JXPath still an active project?  I see the last
 release was 1.2 in
 August 2004.  I see 46 of 46 JIRA issues for the 1.3
 release have been
 marked completed but no official 1.3 release.
 
 Is the nightly build stable enough for production
 use.
 
 The issue I am facing is that I am experiencing what
 appears to be a
 concurrency issue with JXPath and would like to test
 if the patches
 applied to 1.3 resolve the issue.
 
 
 Confidentiality Notice:
 **
 This E-mail and any attachments thereto, are
 intended only for use by the addressee(s) named
 herein and may contain legally privileged and/or
 confidential information. If you are not the
 intended recipient of this E-mail, you are hereby
 notified any dissemination, distribution or copying
 of this E-mail, and any attachments thereto, is
 strictly prohibited. If you receive this E-mail in
 error, please immediately notify me by reply E-mail
 or telephone at (218) 723-7887 and permanently
 delete the original and any copy of this E-mail, and
 any printout thereof. 
 

-
 To unsubscribe, e-mail:
 [EMAIL PROTECTED]
 For additional commands, e-mail:
 [EMAIL PROTECTED]
 
 



  

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: [JXPath] Can JXPath be combined with Xalan for processing templates?

2008-03-20 Thread Matt Benson

--- Rodrigo Ru’iz [EMAIL PROTECTED] wrote:

 Hi everybody,
 
 I would like to apply an XSLT transformation on an
 internal object 
 structure, instead of a DOM. Is there a way to do
 this with JXPath and 
 Xalan (or any other XSLT engine)?

I can't think how to do this with JXPath.  Jaxen might
give you some love, though.

-Matt

 
 
 Cheers,
 Rodrigo
 

-
 To unsubscribe, e-mail:
 [EMAIL PROTECTED]
 For additional commands, e-mail:
 [EMAIL PROTECTED]
 
 



  

Be a better friend, newshound, and 
know-it-all with Yahoo! Mobile.  Try it now.  
http://mobile.yahoo.com/;_ylt=Ahu06i62sR8HDtDypao8Wcj9tAcJ

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



RE: [JXPath] and Collections

2008-02-07 Thread Matt Benson

--- Jeffrey Puro [EMAIL PROTECTED] wrote:

 If I change this to a List, how do I set an element
 on it or add one to
 it?  
 
 context.setValue(myList/, New object on list);
 
 Do I have to specify a particular index or can
 setValue just add on its
 own?

You have to specify the index.  And unfortunately it
seems JXPath isn't smart enough to be able to take an
expression as an index.  Here's what I had to do here:

//given MyBean { List getList(){...} void
setList(List)}:

MyBean myBean = new MyBean();
myBean.getList().add(foo);
JXPathContext context =
JXPathContext.newContext(myBean);
context.setFactory(new AbstractFactory() {
public boolean createObject(JXPathContext
context, Pointer pointer,
Object parent, String name, int
index) {
if (pointer instanceof
PropertyPointer) {
Object baseValue =
((PropertyPointer) pointer).getBaseValue();
if (baseValue instanceof List) {
List list = (List) baseValue;
while (index = list.size()) {
list.add(null);
}
return true;
}
}
return false;
}
});
int listSize = ((Integer)
context.getValue(size(/list))).intValue();
context.createPathAndSetValue(/list[ +
(listSize + 1) + ], bar);

HTH,
Matt

 
 Thanks,
 
 Jeff
 
 -Original Message-
 From: Matt Benson [mailto:[EMAIL PROTECTED] 
 Sent: Wednesday, February 06, 2008 3:55 PM
 To: Jakarta Commons Users List
 Subject: Re: JXPath and Collections
 
 
 --- Jeffrey Puro [EMAIL PROTECTED] wrote:
 
  I have a pojo that has the following properties:
  
 
 Looks like a set is unsupported.  :(  Could you
 possibly use some kind of wrapper object, possibly
 returning asList() from a commons-collections
 ListOrderedSet from a getSetAsList() method or
 something similar?  JXPath can add an element to a
 list.
 
 -Matt
 
   
  
  Class MyPojo {
  
   
  
  private Set mySet;
  
   
  
  }
  
   
  
  Using JXPath, I am trying to add a new object to
 my
  Set object called
  mySet by using an expression as follows:
  
   
  
  context.setValue(mySet/, New object on set);
  
   
  
  However, this does not work when attempting to add
  elements to a
  collection (as it's trying to replace the Set
 object
  with my new
  String).  I'm not sure how one would do this with
  the setValue method,
  but any help would be appreciated.
  
   
  
  Regards,
  
   
  
  Jeff
  
  
  This email (and any attachments) is intended only
  for the use of the individual or entity named
 above
  and may contain information that is privileged and
  confidential. If you are not the intended
 recipient,
  or have unauthorized access, you are hereby
 notified
  that copying, disseminating, distributing or
 taking
  any action in reliance on this email is strictly
  prohibitedbr /
  
  Opinions, conclusions and other information in
 this
  message that do not relate to the official
 business
  of our firm shall be understood as neither given
 nor
  endorsed by it.
  
 
 
 
  


 
 Never miss a thing.  Make Yahoo your home page. 
 http://www.yahoo.com/r/hs
 

-
 To unsubscribe, e-mail:
 [EMAIL PROTECTED]
 For additional commands, e-mail:
 [EMAIL PROTECTED]
 
 
 This email (and any attachments) is intended only
 for the use of the individual or entity named above
 and may contain information that is privileged and
 confidential. If you are not the intended recipient,
 or have unauthorized access, you are hereby notified
 that copying, disseminating, distributing or taking
 any action in reliance on this email is strictly
 prohibitedbr /
 
 Opinions, conclusions and other information in this
 message that do not relate to the official business
 of our firm shall be understood as neither given nor
 endorsed by it.
 

-
 To unsubscribe, e-mail:
 [EMAIL PROTECTED]
 For additional commands, e-mail:
 [EMAIL PROTECTED]
 
 



  

Never miss a thing.  Make Yahoo your home page. 
http://www.yahoo.com/r/hs

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: JXPath and Collections

2008-02-06 Thread Matt Benson

--- Jeffrey Puro [EMAIL PROTECTED] wrote:

 I have a pojo that has the following properties:
 

Looks like a set is unsupported.  :(  Could you
possibly use some kind of wrapper object, possibly
returning asList() from a commons-collections
ListOrderedSet from a getSetAsList() method or
something similar?  JXPath can add an element to a
list.

-Matt

  
 
 Class MyPojo {
 
  
 
 private Set mySet;
 
  
 
 }
 
  
 
 Using JXPath, I am trying to add a new object to my
 Set object called
 mySet by using an expression as follows:
 
  
 
 context.setValue(mySet/, New object on set);
 
  
 
 However, this does not work when attempting to add
 elements to a
 collection (as it's trying to replace the Set object
 with my new
 String).  I'm not sure how one would do this with
 the setValue method,
 but any help would be appreciated.
 
  
 
 Regards,
 
  
 
 Jeff
 
 
 This email (and any attachments) is intended only
 for the use of the individual or entity named above
 and may contain information that is privileged and
 confidential. If you are not the intended recipient,
 or have unauthorized access, you are hereby notified
 that copying, disseminating, distributing or taking
 any action in reliance on this email is strictly
 prohibitedbr /
 
 Opinions, conclusions and other information in this
 message that do not relate to the official business
 of our firm shall be understood as neither given nor
 endorsed by it.
 



  

Never miss a thing.  Make Yahoo your home page. 
http://www.yahoo.com/r/hs

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: [JXPath] circular object graphs

2008-01-25 Thread Matt Benson

--- Warren Liang [EMAIL PROTECTED] wrote:

 Hi all,
 
 How does JXPath handle circular object paths?  My
 object graph is can
 have circular references to objects that are the
 same instance (i.e.
 obj1 == obj2), or are different instances but have
 equivalent values
 (i.e. obj1.equals(obj2))
 
 Right now, I'm evaluating JXPath expressions that do
 not match
 anything in the object graph and it seems like it's
 going through an
 infinite loop.  Some of my expressions use the
 match anywhere
 operator (i.e. //).

If you are encountering behavior that feels wrong to
you, feel welcome to open an issue in JIRA, preferably
with some sample code that can easily be turned into a
standalone JUnit test.

 
 Does JXPath use a breadth first search or a depth
 first search through
 the object graph?
 

In my experience, not being the original author of the
code, JXPath determines matching nodes for a given
level, then applies subsequent levels in
recursive-descent fashion to each node selected at the
current level.  So given:

a
  b
c /c /
  /b
  b
c /c /
  /b
  b
c /c /
  /b
/a

and path /a/b/c, JXPath will determine that a[1]
matches the first step and apply the next step.  Now
it determines that a[1]/b[1], a[1]/b[2] and a[1]/b[3]
match the second step.  Then it applies the third step
to a[1]/b[1], a[1]/b[2], and a[1]/b[3] in succession. 
I interpret this as being depth first.

 Ideally, I'd be able to tell JXPath to recurse a
 maximum depth, or to
 recognize that a node has already been traversed  
 Are there hooks for
 me to do this?
 

I suppose nothing would ever stop you from
implementing a custom I haven't seen this before
function to guard each step, but it might get a little
heavy at RT depending on the size of your graph.  Off
the top of my head I can't remember what, if any,
safeguards are built into JXPath to prevent infinite
recursion, hence my initial suggestion (and attempt to
put the onus onto you ;) ) that you submit reports for
problems encountered.

Is any of this helpful whatsoever?
-Matt

 Thanks,
 
 Warren Liang
 

-
 To unsubscribe, e-mail:
 [EMAIL PROTECTED]
 For additional commands, e-mail:
 [EMAIL PROTECTED]
 
 



  

Never miss a thing.  Make Yahoo your home page. 
http://www.yahoo.com/r/hs

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Filter properties when BeanUtils.copyProperties

2008-01-19 Thread Matt Benson
This is a little late, but Morph at sf.net is another
object transformation project similar to Dozer with a
different architecture, that comes with DynaBean
support.  If you try the current (old) release and
have any problems don't hesitate to ask on the mailing
lists for help or info.

-Matt

--- Sebastien Degardin [EMAIL PROTECTED]
wrote:

 Yes, I used Dozer in my last project.
 
 Dozer is fine, however, All my code is around
 DynaBean.
 
 for info, I've coded a Custon BeanUtilsBean which
 does the filtering in the
 copyProperty method.
 
 That's probably not perfect but it works for the
 moment.
 
 Cheers,
 
 On Jan 17, 2008 10:23 PM, Laurent Perez
 [EMAIL PROTECTED] wrote:
 
  I've never used Dynabeans, but maybe you could
 have a look at Dozer
  bean to bean mapper
 (http://dozer.sourceforge.net/) and its
  field-exclude settings.
 
  laurent
 
 
  2008/1/17, Sebastien Degardin
 [EMAIL PROTECTED]:
   Hi there,
  
   I'm trying to find a way to copy a Dynabean to a
 JavaBean using some
  kind of
   filter to only copy some properties.
  
   I tried to find on the archive .. sorry if it's
 a cross post.
  
   Tks.
  
   g
  
 
 
  --
  a

href=http://in-pocket.blogspot.com;http://in-pocket.blogspot.com
  - Mobile world, technology and more/a
 
 

-
  To unsubscribe, e-mail:
 [EMAIL PROTECTED]
  For additional commands, e-mail:
 [EMAIL PROTECTED]
 
 
 



  

Looking for last minute shopping deals?  
Find them fast with Yahoo! Search.  
http://tools.search.yahoo.com/newsearch/category.php?category=shopping

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



RE: [jxpath] Using JXPATH for dates

2008-01-15 Thread Matt Benson
Way to jump to the front of a 600-email queue.  I
actually intended for any prodding to take place on
the mail list.  And two might have been a little
extreme, for your education in dealing with volunteer
fora in the future.  That notwithstanding...

Quite simply, you are making an unfounded assumption: 
that JXPath has some intrinsic knowledge of how to
handle dates.  It doesn't.  None whatever.  In my
opinion the easiest way to use JXPath to compare
java.util.Date objects would be to compare their
time properties, i.e. invoking getTime() behind the
scenes, which as a long CAN be compared by JXPath.

-Matt

--- Desai, Jasmina [EMAIL PROTECTED] wrote:

 Hi Matt,
 
 Basically I have hundreds of java objects in memory
 and I need to filter
 out those objects using JXPATH.
 
 One of the objects has private Date
 enteredMarketDate;
 (java.util.Date).
 
 When I have an xpath sentence like
 /wirelessDevices[marketData/enteredMarketDate =
 xs:date:(2008-01-01)
 and marketData/enteredMarketDate =
 xs:date:(2008-01-14) ]
 
 Or
 
 /wirelessDevices[marketData/enteredMarketDate =
 2008-01-01 and
 marketData/enteredMarketDate = 2008-01-14 ]
 
 I get an Invalid xpath error.
 
 It basically cannot convert string to date and then
 filter the objects.
 How do I convert the string to java.util.date to
 make the actual jxpath
 query?
 
 
 
 Thanks
 Regards,
 Jasmina
  
 Programmer Analyst, Sr
 Direct: (858) 651-1132
 Ext: 11132
 
 -Original Message-
 From: Desai, Jasmina 
 Sent: Monday, January 14, 2008 2:57 PM
 To: 'Matt Benson'
 Subject: RE: [jxpath] Using JXPATH for dates
 
 Hi Matt,
 
 Thanks for the reply.
 
 Basically my code generates a xpath sentence as
 follows (forget about
 how it generates)
 
 /wirelessDevices[marketData/enteredMarketDate =
 xs:date:(2008-01-01)
 and marketData/enteredMarketDate =
 xs:date:(2008-01-14) ]
 
 Here wirelessDevices is the main object which has
 an instance of
 marketData object which in turn has a property
 Date
 enteredMarketDate.
 
 Basically this date comes form the client side where
 the user selects a
 date range from the calendar (just like any other
 web application).
 
 So what I do is, get these dates and generate an
 xpath sentence and
 execute it to get the results back from the
 database.
 
 In all other cases like String, Boolean, Numbers
 etc, a similar kind of
 xpath sentence works perfectly fine.
 
 For e.g.: The sentence below works and gets me the
 appropriate results
 back:
 

/wirelessDevices[marketData/operators/address/countryType/regionType/id=
 '10']
 
 Here the id (10) is a number and hence the sentence
 gets executed
 easily. But when I try to use a date it throws an
 Invalid XPATH error.
 
 I hope this explains you my problem. 
 
 Thanks
 Regards,
 Jasmina
 
 Thanks
 Regards,
 Jasmina
  
 Programmer Analyst, Sr
 Direct: (858) 651-1132
 Ext: 11132
 
 -Original Message-
 From: Matt Benson [mailto:[EMAIL PROTECTED] 
 Sent: Monday, January 14, 2008 2:43 PM
 To: Jakarta Commons Users List
 Subject: Re: [jxpath] Using JXPATH for dates
 
 Hi,
   To be quite honest I'm not sure where the xs:
 portions of your example, and question, are coming
 from.  Maybe if you provide a little more basic
 detail
 to describe how you got to the point you're at with
 JXPath, the list could be of more help.
 
 -Matt
 
 --- Desai, Jasmina [EMAIL PROTECTED] wrote:
 
  I am using JXPATH to build a java expression which
  can be used to get
  records from a table if its columns fall between a
  specific date range.
  
  Basically I have a client application which asks
 the
  end user to enter a
  date range.
  
  The application needs to get the results which
 fall
  between the
  specified date range.
  
   
  
  I have something like this for the lower value of
  the date range:
  
   
  
  if (criterion.getValue() instanceof Date) {
  
SimpleDateFormat dateFormat =
 new
  SimpleDateFormat(-MM-dd); // TODO
 01-DEC-2007
  i.e. dd-MM-
  
valueAsJXPath = xs:date:(' +
  dateFormat.format(((Date) criterion.getValue())) +
  )';  //DOES NOT
  WORK
  
  }
  
   
  
  Here the Date is of type java.util.Date.
  
   
  
  Then I have the following for the upper value:
  
   
  
  if (criterion.getUpperValue() instanceof Date) {
  
  SimpleDateFormat
 dateFormat
  = new
  SimpleDateFormat(-MM-dd);
  
  upperValueAsJXPath =
  xs:date:(' +
  dateFormat.format(((Date)
  criterion.getUpperValue())) + )'; 
  
}
  
   
  
   
  
  The xpath sentence that gets created is something
  like 
  
   
  
  marketData/enteredMarketDate =
  xs:date:('2008-01-01)' and
  marketData/enteredMarketDate =
  xs:date:('2008-01-15)'
  
   
  
  But I get an error which says:
  
   
  
  An Exception has occured:
  org.apache.commons.jxpath.JXPathException:
  Invalid XPath:
  '/wirelessDevices[marketData/enteredMarketDate =
  xs:date:(\'2008-01-01

Re: [jxpath] Using JXPATH for dates

2008-01-14 Thread Matt Benson
Hi,
  To be quite honest I'm not sure where the xs:
portions of your example, and question, are coming
from.  Maybe if you provide a little more basic detail
to describe how you got to the point you're at with
JXPath, the list could be of more help.

-Matt

--- Desai, Jasmina [EMAIL PROTECTED] wrote:

 I am using JXPATH to build a java expression which
 can be used to get
 records from a table if its columns fall between a
 specific date range.
 
 Basically I have a client application which asks the
 end user to enter a
 date range.
 
 The application needs to get the results which fall
 between the
 specified date range.
 
  
 
 I have something like this for the lower value of
 the date range:
 
  
 
 if (criterion.getValue() instanceof Date) {
 
   SimpleDateFormat dateFormat = new
 SimpleDateFormat(-MM-dd); // TODO 01-DEC-2007
 i.e. dd-MM-
 
   valueAsJXPath = xs:date:(' +
 dateFormat.format(((Date) criterion.getValue())) +
 )';  //DOES NOT
 WORK
 
 }
 
  
 
 Here the Date is of type java.util.Date.
 
  
 
 Then I have the following for the upper value:
 
  
 
 if (criterion.getUpperValue() instanceof Date) {
 
 SimpleDateFormat dateFormat
 = new
 SimpleDateFormat(-MM-dd);
 
 upperValueAsJXPath =
 xs:date:(' +
 dateFormat.format(((Date)
 criterion.getUpperValue())) + )'; 
 
   }
 
  
 
  
 
 The xpath sentence that gets created is something
 like 
 
  
 
 marketData/enteredMarketDate =
 xs:date:('2008-01-01)' and
 marketData/enteredMarketDate =
 xs:date:('2008-01-15)'
 
  
 
 But I get an error which says:
 
  
 
 An Exception has occured:
 org.apache.commons.jxpath.JXPathException:
 Invalid XPath:
 '/wirelessDevices[marketData/enteredMarketDate =
 xs:date:(\'2008-01-01)\' and
 marketData/enteredMarketDate =
 xs:date:(\'2008-01-15)\' ]'. Syntax error after:
 '/wirelessDevices[marketData/enteredMarketDate =
 xs:d' at

org.apache.commons.jxpath.ri.Parser.parseExpression(Parser.java:60)
 at

org.apache.commons.jxpath.ri.JXPathContextReferenceImpl.compileExpressio
 n(JXPathContextReferenceImpl.java:218) at

org.apache.commons.jxpath.ri.JXPathContextReferenceImpl.iterate(JXPathCo
 ntextReferenceImpl.java:384)
 
  
 
  
 
 I am a first time user of JXPATH. Kindly help me
 with this error.
 
  
 
 Also, I need to use the date as 01-DEC-2007 i.e.
 dd-MM- instead of
 -MM-dd.
 
 Will the xs:date accept the date in dd-MM-
 format?
 
  
 
 Thanks
 
 Regards,
 Jasmina
 
  
 
 Programmer Analyst, Sr
 
 Direct: (858) 651-1132
 
 Ext: 11132
 
  
 
 



  

Be a better friend, newshound, and 
know-it-all with Yahoo! Mobile.  Try it now.  
http://mobile.yahoo.com/;_ylt=Ahu06i62sR8HDtDypao8Wcj9tAcJ 


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: JXPath unexplained behaviour

2007-10-10 Thread Matt Benson
Followup:

Broadly, this is a usage error.  See
http://commons.apache.org/jxpath/users-guide.html#Map_Element_Access
, which says:

quote
Often you will need to use the alternative syntax for
accessing Map elements:
  

 String homeZipCode = (String)context.
getValue([EMAIL PROTECTED]'home']/zipCode);
 
Unlike a child name in XPath, the value of the name
attribute does not have to be a properly formed
identifier. Also, in this case the key can be an
expression, e.g. a variable.
/quote

I will leave the bug report open, however, because the
fact that selectSingleNode() behaved the way you
wanted it to is the actual bug (as I suspected might
be the case).  :)

-Matt

--- Matt Benson [EMAIL PROTECTED] wrote:

 
 --- Singh, Rupinder
 [EMAIL PROTECTED]
 wrote:
 
  Can somebody explain the unusual behaviour in the
  following code. The
  selectNodes method does not match anything but
  selectSingleNode does
  return the correct node for the same jxpath query.
  Are these two method
  supposed to behave differently ?
 
 Please do not cross-post to both the user and dev
 lists.  It seems you have uncovered some buggy
 behavior related to the fact that you are looking up
 keys in a map which have embedded colons, which
 normally indicate namespaced content in an XML
 context.  I'll have to think about what the proper
 behavior would be here.  I have created the
 following
 JIRA issue to track this:
 
 https://issues.apache.org/jira/browse/JXPATH-104
 
 Thanks,
 Matt
 
  
   
  
  Map child = new HashMap();
  
  child.put(fname, testfname);
  
  child.put(id, 1);
  
  child.put(lname, testlname);
  
  Map name = new HashMap();
  
  name.put(tns:name, child);
  
  Map data = new HashMap();
  
  data.put(person, name);
  
  JXPathContext context =
  JXPathContext.newContext(data);
  
  List l =
  context.selectNodes(person/tns:name/id);  //This
  returns
  nothing
  
 
 context.selectSingleNode(person/tns:name/id));
  //This returns
  the value 1
  
   
  
  Thanks
  
   
  
  Rupinder
  
  
 
 
 



 Looking for a deal? Find great prices on flights and
 hotels with Yahoo! FareChase.
 http://farechase.yahoo.com/
 

-
 To unsubscribe, e-mail:
 [EMAIL PROTECTED]
 For additional commands, e-mail:
 [EMAIL PROTECTED]
 
 



   

Yahoo! oneSearch: Finally, mobile search 
that gives answers, not web links. 
http://mobile.yahoo.com/mobileweb/onesearch?refer=1ONXIC

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]