You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by Magnus Kvalheim <ma...@kvalheim.dk> on 2008/12/06 23:15:48 UTC

Aegis databinding independently of CXF

Hi all,

I'm interested in trying Aegis over JAXB as a xml<->java mapping solution.

The user guide, http://cwiki.apache.org/CXF20DOC/aegis-21.html, indicates
this is possible, but I haven't been able to find any examples of such.

I've tried with a simple example:

public class MappingTest implements Serializable{

    private static final long serialVersionUID = 1L;
    private String text1;
    private Integer number1;
    private Boolean bool1;
    private int[] intArr1;
    public MappingTest() {
        text1 = "A testing string";
        number1 = 42;
        bool1 = true;
        intArr1 = new int[]{2,5,7,9,23,54};
    }
    public String getText1() {return text1;    }
    public Integer getNumber1() {return number1;}
    public Boolean getBool1() {return bool1;}
    public int[] getIntArr1() {return intArr1;}

    public static void main(String[] args) throws Exception {

        MappingTest test = new MappingTest();
        AegisContext ctx = new AegisContext();
        XMLOutputFactory factory = XMLOutputFactory.newInstance();
        OutputStream out = new FileOutputStream("data.xml");

        XMLStreamWriter xmlWriter = factory.createXMLStreamWriter(out);
        AegisWriter<XMLStreamWriter> aegisWriter =
ctx.createXMLStreamWriter();
        aegisWriter.write(test, new QName("test"), true, xmlWriter,
null);
    }
}
But get a nullpointerexception here:
Exception in thread "main" java.lang.NullPointerException
    at
org.apache.cxf.aegis.AegisXMLStreamDataWriter.write(AegisXMLStreamDataWriter.java:80)
    at
org.apache.cxf.aegis.AegisXMLStreamDataWriter.write(AegisXMLStreamDataWriter.java:33)
    at MappingTest.main(MappingTest.java:38)


What is required in order to serialize a bean with simple types?

Can anyone on the list tell me if I'm on the right track?

Thanks,
Magnus

Re: Aegis databinding independently of CXF

Posted by Magnus Kvalheim <ma...@kvalheim.dk>.
Great!

Yes, that will get me started.

Thanks again for your help
Magnus

2008/12/10 Benson Margulies <bi...@gmail.com>

> I just checked in a StandaloneWriteTest which should give you some
> help. I am thinking about how to go about adding a sample to our
> samples.
>
> On Sun, Dec 7, 2008 at 4:04 PM, Magnus Kvalheim <ma...@kvalheim.dk>
> wrote:
> > Have attached the sources and debugging into cxf, and found that it was
> > missing the aegistype. (I did initially give it null so thats only fair
> :-)
> > )
> >
> > Still having a bit of struggle figuring out how it's all connected so yes
> -
> > a write test would be great.
> >
> > Thanks
> >
> > 2008/12/7 Benson Margulies <bi...@gmail.com>
> >
> >> I might have forgotten to write one. I'll put some attention into this
> >> in the next few days.
> >>
> >> On Sun, Dec 7, 2008 at 4:33 AM, Magnus Kvalheim <ma...@kvalheim.dk>
> >> wrote:
> >> > Thanks for your reply Benson,
> >> >
> >> > I must admittedly say that I haden't...
> >> >
> >> > I took a quick look, and can find a read test, but no write :-|
> >> >
> >> > I'll look more into it later tonight.
> >> >
> >> > Thanks,
> >> > Magnus
> >> >
> >> > 2008/12/7 Benson Margulies <bi...@gmail.com>
> >> >
> >> >> Magnus, have you looked at the unit tests that test standalone Aegis?
> >> >>
> >> >> On Sat, Dec 6, 2008 at 5:15 PM, Magnus Kvalheim <ma...@kvalheim.dk>
> >> >> wrote:
> >> >> > Hi all,
> >> >> >
> >> >> > I'm interested in trying Aegis over JAXB as a xml<->java mapping
> >> >> solution.
> >> >> >
> >> >> > The user guide, http://cwiki.apache.org/CXF20DOC/aegis-21.html,
> >> >> indicates
> >> >> > this is possible, but I haven't been able to find any examples of
> >> such.
> >> >> >
> >> >> > I've tried with a simple example:
> >> >> >
> >> >> > public class MappingTest implements Serializable{
> >> >> >
> >> >> >    private static final long serialVersionUID = 1L;
> >> >> >    private String text1;
> >> >> >    private Integer number1;
> >> >> >    private Boolean bool1;
> >> >> >    private int[] intArr1;
> >> >> >    public MappingTest() {
> >> >> >        text1 = "A testing string";
> >> >> >        number1 = 42;
> >> >> >        bool1 = true;
> >> >> >        intArr1 = new int[]{2,5,7,9,23,54};
> >> >> >    }
> >> >> >    public String getText1() {return text1;    }
> >> >> >    public Integer getNumber1() {return number1;}
> >> >> >    public Boolean getBool1() {return bool1;}i
> >> >> >    public int[] getIntArr1() {return intArr1;}
> >> >> >
> >> >> >    public static void main(String[] args) throws Exception {
> >> >> >
> >> >> >        MappingTest test = new MappingTest();
> >> >> >        AegisContext ctx = new AegisContext();
> >> >> >        XMLOutputFactory factory = XMLOutputFactory.newInstance();
> >> >> >        OutputStream out = new FileOutputStream("data.xml");
> >> >> >
> >> >> >        XMLStreamWriter xmlWriter =
> factory.createXMLStreamWriter(out);
> >> >> >        AegisWriter<XMLStreamWriter> aegisWriter =
> >> >> > ctx.createXMLStreamWriter();
> >> >> >        aegisWriter.write(test, new QName("test"), true, xmlWriter,
> >> >> > null);
> >> >> >    }
> >> >> > }
> >> >> > But get a nullpointerexception here:
> >> >> > Exception in thread "main" java.lang.NullPointerException
> >> >> >    at
> >> >> >
> >> >>
> >>
> org.apache.cxf.aegis.AegisXMLStreamDataWriter.write(AegisXMLStreamDataWriter.java:80)
> >> >> >    at
> >> >> >
> >> >>
> >>
> org.apache.cxf.aegis.AegisXMLStreamDataWriter.write(AegisXMLStreamDataWriter.java:33)
> >> >> >    at MappingTest.main(MappingTest.java:38)
> >> >> >
> >> >> >
> >> >> > What is required in order to serialize a bean with simple types?
> >> >> >
> >> >> > Can anyone on the list tell me if I'm on the right track?
> >> >> >
> >> >> > Thanks,
> >> >> > Magnus
> >> >> >
> >> >>
> >> >
> >>
> >
>

Re: Aegis databinding independently of CXF

Posted by Benson Margulies <bi...@gmail.com>.
I just checked in a StandaloneWriteTest which should give you some
help. I am thinking about how to go about adding a sample to our
samples.

On Sun, Dec 7, 2008 at 4:04 PM, Magnus Kvalheim <ma...@kvalheim.dk> wrote:
> Have attached the sources and debugging into cxf, and found that it was
> missing the aegistype. (I did initially give it null so thats only fair :-)
> )
>
> Still having a bit of struggle figuring out how it's all connected so yes -
> a write test would be great.
>
> Thanks
>
> 2008/12/7 Benson Margulies <bi...@gmail.com>
>
>> I might have forgotten to write one. I'll put some attention into this
>> in the next few days.
>>
>> On Sun, Dec 7, 2008 at 4:33 AM, Magnus Kvalheim <ma...@kvalheim.dk>
>> wrote:
>> > Thanks for your reply Benson,
>> >
>> > I must admittedly say that I haden't...
>> >
>> > I took a quick look, and can find a read test, but no write :-|
>> >
>> > I'll look more into it later tonight.
>> >
>> > Thanks,
>> > Magnus
>> >
>> > 2008/12/7 Benson Margulies <bi...@gmail.com>
>> >
>> >> Magnus, have you looked at the unit tests that test standalone Aegis?
>> >>
>> >> On Sat, Dec 6, 2008 at 5:15 PM, Magnus Kvalheim <ma...@kvalheim.dk>
>> >> wrote:
>> >> > Hi all,
>> >> >
>> >> > I'm interested in trying Aegis over JAXB as a xml<->java mapping
>> >> solution.
>> >> >
>> >> > The user guide, http://cwiki.apache.org/CXF20DOC/aegis-21.html,
>> >> indicates
>> >> > this is possible, but I haven't been able to find any examples of
>> such.
>> >> >
>> >> > I've tried with a simple example:
>> >> >
>> >> > public class MappingTest implements Serializable{
>> >> >
>> >> >    private static final long serialVersionUID = 1L;
>> >> >    private String text1;
>> >> >    private Integer number1;
>> >> >    private Boolean bool1;
>> >> >    private int[] intArr1;
>> >> >    public MappingTest() {
>> >> >        text1 = "A testing string";
>> >> >        number1 = 42;
>> >> >        bool1 = true;
>> >> >        intArr1 = new int[]{2,5,7,9,23,54};
>> >> >    }
>> >> >    public String getText1() {return text1;    }
>> >> >    public Integer getNumber1() {return number1;}
>> >> >    public Boolean getBool1() {return bool1;}i
>> >> >    public int[] getIntArr1() {return intArr1;}
>> >> >
>> >> >    public static void main(String[] args) throws Exception {
>> >> >
>> >> >        MappingTest test = new MappingTest();
>> >> >        AegisContext ctx = new AegisContext();
>> >> >        XMLOutputFactory factory = XMLOutputFactory.newInstance();
>> >> >        OutputStream out = new FileOutputStream("data.xml");
>> >> >
>> >> >        XMLStreamWriter xmlWriter = factory.createXMLStreamWriter(out);
>> >> >        AegisWriter<XMLStreamWriter> aegisWriter =
>> >> > ctx.createXMLStreamWriter();
>> >> >        aegisWriter.write(test, new QName("test"), true, xmlWriter,
>> >> > null);
>> >> >    }
>> >> > }
>> >> > But get a nullpointerexception here:
>> >> > Exception in thread "main" java.lang.NullPointerException
>> >> >    at
>> >> >
>> >>
>> org.apache.cxf.aegis.AegisXMLStreamDataWriter.write(AegisXMLStreamDataWriter.java:80)
>> >> >    at
>> >> >
>> >>
>> org.apache.cxf.aegis.AegisXMLStreamDataWriter.write(AegisXMLStreamDataWriter.java:33)
>> >> >    at MappingTest.main(MappingTest.java:38)
>> >> >
>> >> >
>> >> > What is required in order to serialize a bean with simple types?
>> >> >
>> >> > Can anyone on the list tell me if I'm on the right track?
>> >> >
>> >> > Thanks,
>> >> > Magnus
>> >> >
>> >>
>> >
>>
>

Re: Aegis databinding independently of CXF

Posted by Magnus Kvalheim <ma...@kvalheim.dk>.
Have attached the sources and debugging into cxf, and found that it was
missing the aegistype. (I did initially give it null so thats only fair :-)
)

Still having a bit of struggle figuring out how it's all connected so yes -
a write test would be great.

Thanks

2008/12/7 Benson Margulies <bi...@gmail.com>

> I might have forgotten to write one. I'll put some attention into this
> in the next few days.
>
> On Sun, Dec 7, 2008 at 4:33 AM, Magnus Kvalheim <ma...@kvalheim.dk>
> wrote:
> > Thanks for your reply Benson,
> >
> > I must admittedly say that I haden't...
> >
> > I took a quick look, and can find a read test, but no write :-|
> >
> > I'll look more into it later tonight.
> >
> > Thanks,
> > Magnus
> >
> > 2008/12/7 Benson Margulies <bi...@gmail.com>
> >
> >> Magnus, have you looked at the unit tests that test standalone Aegis?
> >>
> >> On Sat, Dec 6, 2008 at 5:15 PM, Magnus Kvalheim <ma...@kvalheim.dk>
> >> wrote:
> >> > Hi all,
> >> >
> >> > I'm interested in trying Aegis over JAXB as a xml<->java mapping
> >> solution.
> >> >
> >> > The user guide, http://cwiki.apache.org/CXF20DOC/aegis-21.html,
> >> indicates
> >> > this is possible, but I haven't been able to find any examples of
> such.
> >> >
> >> > I've tried with a simple example:
> >> >
> >> > public class MappingTest implements Serializable{
> >> >
> >> >    private static final long serialVersionUID = 1L;
> >> >    private String text1;
> >> >    private Integer number1;
> >> >    private Boolean bool1;
> >> >    private int[] intArr1;
> >> >    public MappingTest() {
> >> >        text1 = "A testing string";
> >> >        number1 = 42;
> >> >        bool1 = true;
> >> >        intArr1 = new int[]{2,5,7,9,23,54};
> >> >    }
> >> >    public String getText1() {return text1;    }
> >> >    public Integer getNumber1() {return number1;}
> >> >    public Boolean getBool1() {return bool1;}i
> >> >    public int[] getIntArr1() {return intArr1;}
> >> >
> >> >    public static void main(String[] args) throws Exception {
> >> >
> >> >        MappingTest test = new MappingTest();
> >> >        AegisContext ctx = new AegisContext();
> >> >        XMLOutputFactory factory = XMLOutputFactory.newInstance();
> >> >        OutputStream out = new FileOutputStream("data.xml");
> >> >
> >> >        XMLStreamWriter xmlWriter = factory.createXMLStreamWriter(out);
> >> >        AegisWriter<XMLStreamWriter> aegisWriter =
> >> > ctx.createXMLStreamWriter();
> >> >        aegisWriter.write(test, new QName("test"), true, xmlWriter,
> >> > null);
> >> >    }
> >> > }
> >> > But get a nullpointerexception here:
> >> > Exception in thread "main" java.lang.NullPointerException
> >> >    at
> >> >
> >>
> org.apache.cxf.aegis.AegisXMLStreamDataWriter.write(AegisXMLStreamDataWriter.java:80)
> >> >    at
> >> >
> >>
> org.apache.cxf.aegis.AegisXMLStreamDataWriter.write(AegisXMLStreamDataWriter.java:33)
> >> >    at MappingTest.main(MappingTest.java:38)
> >> >
> >> >
> >> > What is required in order to serialize a bean with simple types?
> >> >
> >> > Can anyone on the list tell me if I'm on the right track?
> >> >
> >> > Thanks,
> >> > Magnus
> >> >
> >>
> >
>

Re: Aegis databinding independently of CXF

Posted by Benson Margulies <bi...@gmail.com>.
I might have forgotten to write one. I'll put some attention into this
in the next few days.

On Sun, Dec 7, 2008 at 4:33 AM, Magnus Kvalheim <ma...@kvalheim.dk> wrote:
> Thanks for your reply Benson,
>
> I must admittedly say that I haden't...
>
> I took a quick look, and can find a read test, but no write :-|
>
> I'll look more into it later tonight.
>
> Thanks,
> Magnus
>
> 2008/12/7 Benson Margulies <bi...@gmail.com>
>
>> Magnus, have you looked at the unit tests that test standalone Aegis?
>>
>> On Sat, Dec 6, 2008 at 5:15 PM, Magnus Kvalheim <ma...@kvalheim.dk>
>> wrote:
>> > Hi all,
>> >
>> > I'm interested in trying Aegis over JAXB as a xml<->java mapping
>> solution.
>> >
>> > The user guide, http://cwiki.apache.org/CXF20DOC/aegis-21.html,
>> indicates
>> > this is possible, but I haven't been able to find any examples of such.
>> >
>> > I've tried with a simple example:
>> >
>> > public class MappingTest implements Serializable{
>> >
>> >    private static final long serialVersionUID = 1L;
>> >    private String text1;
>> >    private Integer number1;
>> >    private Boolean bool1;
>> >    private int[] intArr1;
>> >    public MappingTest() {
>> >        text1 = "A testing string";
>> >        number1 = 42;
>> >        bool1 = true;
>> >        intArr1 = new int[]{2,5,7,9,23,54};
>> >    }
>> >    public String getText1() {return text1;    }
>> >    public Integer getNumber1() {return number1;}
>> >    public Boolean getBool1() {return bool1;}i
>> >    public int[] getIntArr1() {return intArr1;}
>> >
>> >    public static void main(String[] args) throws Exception {
>> >
>> >        MappingTest test = new MappingTest();
>> >        AegisContext ctx = new AegisContext();
>> >        XMLOutputFactory factory = XMLOutputFactory.newInstance();
>> >        OutputStream out = new FileOutputStream("data.xml");
>> >
>> >        XMLStreamWriter xmlWriter = factory.createXMLStreamWriter(out);
>> >        AegisWriter<XMLStreamWriter> aegisWriter =
>> > ctx.createXMLStreamWriter();
>> >        aegisWriter.write(test, new QName("test"), true, xmlWriter,
>> > null);
>> >    }
>> > }
>> > But get a nullpointerexception here:
>> > Exception in thread "main" java.lang.NullPointerException
>> >    at
>> >
>> org.apache.cxf.aegis.AegisXMLStreamDataWriter.write(AegisXMLStreamDataWriter.java:80)
>> >    at
>> >
>> org.apache.cxf.aegis.AegisXMLStreamDataWriter.write(AegisXMLStreamDataWriter.java:33)
>> >    at MappingTest.main(MappingTest.java:38)
>> >
>> >
>> > What is required in order to serialize a bean with simple types?
>> >
>> > Can anyone on the list tell me if I'm on the right track?
>> >
>> > Thanks,
>> > Magnus
>> >
>>
>

Re: Aegis databinding independently of CXF

Posted by Magnus Kvalheim <ma...@kvalheim.dk>.
Thanks for your reply Benson,

I must admittedly say that I haden't...

I took a quick look, and can find a read test, but no write :-|

I'll look more into it later tonight.

Thanks,
Magnus

2008/12/7 Benson Margulies <bi...@gmail.com>

> Magnus, have you looked at the unit tests that test standalone Aegis?
>
> On Sat, Dec 6, 2008 at 5:15 PM, Magnus Kvalheim <ma...@kvalheim.dk>
> wrote:
> > Hi all,
> >
> > I'm interested in trying Aegis over JAXB as a xml<->java mapping
> solution.
> >
> > The user guide, http://cwiki.apache.org/CXF20DOC/aegis-21.html,
> indicates
> > this is possible, but I haven't been able to find any examples of such.
> >
> > I've tried with a simple example:
> >
> > public class MappingTest implements Serializable{
> >
> >    private static final long serialVersionUID = 1L;
> >    private String text1;
> >    private Integer number1;
> >    private Boolean bool1;
> >    private int[] intArr1;
> >    public MappingTest() {
> >        text1 = "A testing string";
> >        number1 = 42;
> >        bool1 = true;
> >        intArr1 = new int[]{2,5,7,9,23,54};
> >    }
> >    public String getText1() {return text1;    }
> >    public Integer getNumber1() {return number1;}
> >    public Boolean getBool1() {return bool1;}i
> >    public int[] getIntArr1() {return intArr1;}
> >
> >    public static void main(String[] args) throws Exception {
> >
> >        MappingTest test = new MappingTest();
> >        AegisContext ctx = new AegisContext();
> >        XMLOutputFactory factory = XMLOutputFactory.newInstance();
> >        OutputStream out = new FileOutputStream("data.xml");
> >
> >        XMLStreamWriter xmlWriter = factory.createXMLStreamWriter(out);
> >        AegisWriter<XMLStreamWriter> aegisWriter =
> > ctx.createXMLStreamWriter();
> >        aegisWriter.write(test, new QName("test"), true, xmlWriter,
> > null);
> >    }
> > }
> > But get a nullpointerexception here:
> > Exception in thread "main" java.lang.NullPointerException
> >    at
> >
> org.apache.cxf.aegis.AegisXMLStreamDataWriter.write(AegisXMLStreamDataWriter.java:80)
> >    at
> >
> org.apache.cxf.aegis.AegisXMLStreamDataWriter.write(AegisXMLStreamDataWriter.java:33)
> >    at MappingTest.main(MappingTest.java:38)
> >
> >
> > What is required in order to serialize a bean with simple types?
> >
> > Can anyone on the list tell me if I'm on the right track?
> >
> > Thanks,
> > Magnus
> >
>

Re: Aegis databinding independently of CXF

Posted by Benson Margulies <bi...@gmail.com>.
Magnus, have you looked at the unit tests that test standalone Aegis?

On Sat, Dec 6, 2008 at 5:15 PM, Magnus Kvalheim <ma...@kvalheim.dk> wrote:
> Hi all,
>
> I'm interested in trying Aegis over JAXB as a xml<->java mapping solution.
>
> The user guide, http://cwiki.apache.org/CXF20DOC/aegis-21.html, indicates
> this is possible, but I haven't been able to find any examples of such.
>
> I've tried with a simple example:
>
> public class MappingTest implements Serializable{
>
>    private static final long serialVersionUID = 1L;
>    private String text1;
>    private Integer number1;
>    private Boolean bool1;
>    private int[] intArr1;
>    public MappingTest() {
>        text1 = "A testing string";
>        number1 = 42;
>        bool1 = true;
>        intArr1 = new int[]{2,5,7,9,23,54};
>    }
>    public String getText1() {return text1;    }
>    public Integer getNumber1() {return number1;}
>    public Boolean getBool1() {return bool1;}
>    public int[] getIntArr1() {return intArr1;}
>
>    public static void main(String[] args) throws Exception {
>
>        MappingTest test = new MappingTest();
>        AegisContext ctx = new AegisContext();
>        XMLOutputFactory factory = XMLOutputFactory.newInstance();
>        OutputStream out = new FileOutputStream("data.xml");
>
>        XMLStreamWriter xmlWriter = factory.createXMLStreamWriter(out);
>        AegisWriter<XMLStreamWriter> aegisWriter =
> ctx.createXMLStreamWriter();
>        aegisWriter.write(test, new QName("test"), true, xmlWriter,
> null);
>    }
> }
> But get a nullpointerexception here:
> Exception in thread "main" java.lang.NullPointerException
>    at
> org.apache.cxf.aegis.AegisXMLStreamDataWriter.write(AegisXMLStreamDataWriter.java:80)
>    at
> org.apache.cxf.aegis.AegisXMLStreamDataWriter.write(AegisXMLStreamDataWriter.java:33)
>    at MappingTest.main(MappingTest.java:38)
>
>
> What is required in order to serialize a bean with simple types?
>
> Can anyone on the list tell me if I'm on the right track?
>
> Thanks,
> Magnus
>