simple-support Mailing List for Simple (Page 73)
Brought to you by:
niallg
You can subscribe to this list here.
| 2007 |
Jan
|
Feb
(2) |
Mar
(2) |
Apr
(13) |
May
(13) |
Jun
(27) |
Jul
(4) |
Aug
(14) |
Sep
(7) |
Oct
|
Nov
(6) |
Dec
(24) |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2008 |
Jan
|
Feb
(21) |
Mar
(10) |
Apr
(15) |
May
(24) |
Jun
(24) |
Jul
(30) |
Aug
(5) |
Sep
(19) |
Oct
(27) |
Nov
(16) |
Dec
(24) |
| 2009 |
Jan
(34) |
Feb
(24) |
Mar
(35) |
Apr
(26) |
May
(8) |
Jun
(17) |
Jul
(28) |
Aug
(31) |
Sep
(36) |
Oct
(35) |
Nov
(20) |
Dec
(16) |
| 2010 |
Jan
(40) |
Feb
(21) |
Mar
(47) |
Apr
(45) |
May
(34) |
Jun
(68) |
Jul
(46) |
Aug
(39) |
Sep
(47) |
Oct
(20) |
Nov
(42) |
Dec
(13) |
| 2011 |
Jan
(41) |
Feb
(16) |
Mar
(32) |
Apr
(44) |
May
(28) |
Jun
(35) |
Jul
(37) |
Aug
(33) |
Sep
(60) |
Oct
(20) |
Nov
(35) |
Dec
(23) |
| 2012 |
Jan
(34) |
Feb
(23) |
Mar
(34) |
Apr
(21) |
May
(48) |
Jun
(24) |
Jul
(31) |
Aug
(39) |
Sep
(25) |
Oct
(10) |
Nov
(27) |
Dec
(28) |
| 2013 |
Jan
(32) |
Feb
(24) |
Mar
(24) |
Apr
(9) |
May
(4) |
Jun
(6) |
Jul
(2) |
Aug
(5) |
Sep
|
Oct
(5) |
Nov
(1) |
Dec
(12) |
| 2014 |
Jan
(14) |
Feb
(16) |
Mar
(5) |
Apr
(3) |
May
(2) |
Jun
(8) |
Jul
(2) |
Aug
|
Sep
(6) |
Oct
|
Nov
(6) |
Dec
|
| 2015 |
Jan
(3) |
Feb
(15) |
Mar
(7) |
Apr
|
May
|
Jun
(1) |
Jul
|
Aug
|
Sep
(2) |
Oct
|
Nov
|
Dec
(1) |
| 2016 |
Jan
|
Feb
(6) |
Mar
(2) |
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
| 2017 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
(1) |
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
| 2018 |
Jan
(1) |
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
(1) |
Dec
|
| 2019 |
Jan
|
Feb
|
Mar
|
Apr
(1) |
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
|
From: Niall G. <gal...@ya...> - 2008-07-30 20:40:14
|
Hi,
I would like to add namespace support, unfortunately setting the name="foo:bar" will not work for deserialization. As the element or attribute name is "bar" and so it will not match. I was thinking of adding a namespace attribute to the annotations. For instance something like:
@Root(name="name", namespace="http://location/path")
public class Type {
@Element(name="blah", namespace="http://domain/path")
private String value;
}
And and a org.simpleframework.xml.stream.Namespace object to the org.simpleframework.xml.stream.Node object. This would then allow you to add custom prefixes or at the very least manipluate the namespaces if needed during serialization. Really not a big fix, and something I have planned for a while but have not really come up with an ideal solution yet.
Niall
--- On Wed, 7/30/08, Patrick Sturm <si...@ge...> wrote:
> From: Patrick Sturm <si...@ge...>
> Subject: [Simple-support] Namespace support
> To: sim...@li...
> Date: Wednesday, July 30, 2008, 5:24 AM
> I was not able to find documents that cover the topic of
> namespaces in
> simple. How would one implement namespaces such as foo:bar.
> I did come
> up with one idea, that involves
> @Element(name="foo:bar"),
> @Root(name="foo:bar") and @Attribute(name...) but
> I suppose that there
> might be a better way.
>
> regards siyb
>
>
> -------------------------------------------------------------------------
> This SF.Net email is sponsored by the Moblin Your Move
> Developer's challenge
> Build the coolest Linux based applications with Moblin SDK
> & win great prizes
> Grand prize is a trip for two to an Open Source event
> anywhere in the world
> http://moblin-contest.org/redirect.php?banner_id=100&url=/
> _______________________________________________
> Simple-support mailing list
> Sim...@li...
> https://lists.sourceforge.net/lists/listinfo/simple-support
|
|
From: Mireille M. <mir...@ya...> - 2008-07-30 20:32:07
|
They don't get the same id generated by Simple, that's the problem. But in the database it's the same unique identifier (it's the same object, but different instances). --- Em qua, 30/7/08, Niall Gallagher <gal...@ya...> escreveu: De: Niall Gallagher <gal...@ya...> Assunto: Re: [Simple-support] CycleStrategy and complex relationships Para: sim...@li..., "MireilleMoreira" <mir...@ya...> Data: Quarta-feira, 30 de Julho de 2008, 16:42 Hi, So how did the two elements get the same id? Was it serialized with the Persister or written by hand. Niall --- On Wed, 7/30/08, MireilleMoreira <mir...@ya...> wrote: > From: MireilleMoreira <mir...@ya...> > Subject: Re: [Simple-support] CycleStrategy and complex relationships > To: sim...@li... > Date: Wednesday, July 30, 2008, 5:28 AM > Thanks for the answer. > > I kinda figured out what's wrong. The problem is that I > get my beans from > the database, and the persistence framework initializes two > instances of the > same object, in that case, two instances of class A (the > instance of A > within class C is another one), and Simple XML doesn't > understand that they > are the same objects (although they have the same id and > the same > attributes, and the equals method is right implemented). It > causes an > infinite loop, then finally to StackOverflowError. :( > > > > Niall Gallagher-2 wrote: > > > > Hi, > > > > This does not look like a complicated relationship. > How have you annotated > > your classes? > > > > Niall > > > > > > --- On Tue, 7/29/08, MireilleMoreira > <mir...@ya...> wrote: > > > >> From: MireilleMoreira > <mir...@ya...> > >> Subject: [Simple-support] CycleStrategy and > complex relationships > >> To: sim...@li... > >> Date: Tuesday, July 29, 2008, 2:56 PM > >> Hello, > >> > >> I followed the Simple XML Tutorial > >> > (http://simple.sourceforge.net/download/stream/doc/tutorial/tutorial.php) > >> for serialization, but I have cyclic relationship > in my > >> beans. The example > >> in the tutorial only tells how to serialize it > with > >> CycleStrategy for a > >> simple cyclic relationship (Child has a Parent, > and a > >> Parent has a > >> collection of Child), and also tells that > CycleStrategy can > >> be used for > >> complex relationships. > >> I'd like to know how to do that (complex > >> relationships). I tried the simple > >> way and I got nothing. Does anyone have an > example? > >> > >> My cyclic relationship is like that: > >> > >> public class A { > >> private List< B> b; > >> ... > >> } > >> > >> public class B { > >> private C c; > >> ... > >> } > >> > >> public class C { > >> private A a; > >> ... > >> } > >> > >> > >> Thanks in advance! > >> -- > >> View this message in context: > >> > http://www.nabble.com/CycleStrategy-and-complex-relationships-tp18721852p18721852.html > >> Sent from the Simple XML Serialization mailing > list archive > >> at Nabble.com. > >> > >> > >> > ------------------------------------------------------------------------- > >> This SF.Net email is sponsored by the Moblin Your > Move > >> Developer's challenge > >> Build the coolest Linux based applications with > Moblin SDK > >> & win great prizes > >> Grand prize is a trip for two to an Open Source > event > >> anywhere in the world > >> > http://moblin-contest.org/redirect.php?banner_id=100&url=/ > >> _______________________________________________ > >> Simple-support mailing list > >> Sim...@li... > >> > https://lists.sourceforge.net/lists/listinfo/simple-support > > > > > > > > > > > ------------------------------------------------------------------------- > > This SF.Net email is sponsored by the Moblin Your Move > Developer's > > challenge > > Build the coolest Linux based applications with Moblin > SDK & win great > > prizes > > Grand prize is a trip for two to an Open Source event > anywhere in the > > world > > > http://moblin-contest.org/redirect.php?banner_id=100&url=/ > > _______________________________________________ > > Simple-support mailing list > > Sim...@li... > > > https://lists.sourceforge.net/lists/listinfo/simple-support > > > > > > -- > View this message in context: > http://www.nabble.com/CycleStrategy-and-complex-relationships-tp18721852p18732138.html > Sent from the Simple XML Serialization mailing list archive > at Nabble.com. > > > ------------------------------------------------------------------------- > This SF.Net email is sponsored by the Moblin Your Move > Developer's challenge > Build the coolest Linux based applications with Moblin SDK > & win great prizes > Grand prize is a trip for two to an Open Source event > anywhere in the world > http://moblin-contest.org/redirect.php?banner_id=100&url=/ > _______________________________________________ > Simple-support mailing list > Sim...@li... > https://lists.sourceforge.net/lists/listinfo/simple-support Novos endereços, o Yahoo! que você conhece. Crie um email novo com a sua cara @ymail.com ou @rocketmail.com. http://br.new.mail.yahoo.com/addresses |
|
From: Niall G. <gal...@ya...> - 2008-07-30 19:42:23
|
Hi, So how did the two elements get the same id? Was it serialized with the Persister or written by hand. Niall --- On Wed, 7/30/08, MireilleMoreira <mir...@ya...> wrote: > From: MireilleMoreira <mir...@ya...> > Subject: Re: [Simple-support] CycleStrategy and complex relationships > To: sim...@li... > Date: Wednesday, July 30, 2008, 5:28 AM > Thanks for the answer. > > I kinda figured out what's wrong. The problem is that I > get my beans from > the database, and the persistence framework initializes two > instances of the > same object, in that case, two instances of class A (the > instance of A > within class C is another one), and Simple XML doesn't > understand that they > are the same objects (although they have the same id and > the same > attributes, and the equals method is right implemented). It > causes an > infinite loop, then finally to StackOverflowError. :( > > > > Niall Gallagher-2 wrote: > > > > Hi, > > > > This does not look like a complicated relationship. > How have you annotated > > your classes? > > > > Niall > > > > > > --- On Tue, 7/29/08, MireilleMoreira > <mir...@ya...> wrote: > > > >> From: MireilleMoreira > <mir...@ya...> > >> Subject: [Simple-support] CycleStrategy and > complex relationships > >> To: sim...@li... > >> Date: Tuesday, July 29, 2008, 2:56 PM > >> Hello, > >> > >> I followed the Simple XML Tutorial > >> > (http://simple.sourceforge.net/download/stream/doc/tutorial/tutorial.php) > >> for serialization, but I have cyclic relationship > in my > >> beans. The example > >> in the tutorial only tells how to serialize it > with > >> CycleStrategy for a > >> simple cyclic relationship (Child has a Parent, > and a > >> Parent has a > >> collection of Child), and also tells that > CycleStrategy can > >> be used for > >> complex relationships. > >> I'd like to know how to do that (complex > >> relationships). I tried the simple > >> way and I got nothing. Does anyone have an > example? > >> > >> My cyclic relationship is like that: > >> > >> public class A { > >> private List< B> b; > >> ... > >> } > >> > >> public class B { > >> private C c; > >> ... > >> } > >> > >> public class C { > >> private A a; > >> ... > >> } > >> > >> > >> Thanks in advance! > >> -- > >> View this message in context: > >> > http://www.nabble.com/CycleStrategy-and-complex-relationships-tp18721852p18721852.html > >> Sent from the Simple XML Serialization mailing > list archive > >> at Nabble.com. > >> > >> > >> > ------------------------------------------------------------------------- > >> This SF.Net email is sponsored by the Moblin Your > Move > >> Developer's challenge > >> Build the coolest Linux based applications with > Moblin SDK > >> & win great prizes > >> Grand prize is a trip for two to an Open Source > event > >> anywhere in the world > >> > http://moblin-contest.org/redirect.php?banner_id=100&url=/ > >> _______________________________________________ > >> Simple-support mailing list > >> Sim...@li... > >> > https://lists.sourceforge.net/lists/listinfo/simple-support > > > > > > > > > > > ------------------------------------------------------------------------- > > This SF.Net email is sponsored by the Moblin Your Move > Developer's > > challenge > > Build the coolest Linux based applications with Moblin > SDK & win great > > prizes > > Grand prize is a trip for two to an Open Source event > anywhere in the > > world > > > http://moblin-contest.org/redirect.php?banner_id=100&url=/ > > _______________________________________________ > > Simple-support mailing list > > Sim...@li... > > > https://lists.sourceforge.net/lists/listinfo/simple-support > > > > > > -- > View this message in context: > http://www.nabble.com/CycleStrategy-and-complex-relationships-tp18721852p18732138.html > Sent from the Simple XML Serialization mailing list archive > at Nabble.com. > > > ------------------------------------------------------------------------- > This SF.Net email is sponsored by the Moblin Your Move > Developer's challenge > Build the coolest Linux based applications with Moblin SDK > & win great prizes > Grand prize is a trip for two to an Open Source event > anywhere in the world > http://moblin-contest.org/redirect.php?banner_id=100&url=/ > _______________________________________________ > Simple-support mailing list > Sim...@li... > https://lists.sourceforge.net/lists/listinfo/simple-support |
|
From: MireilleMoreira <mir...@ya...> - 2008-07-30 12:28:50
|
Thanks for the answer. I kinda figured out what's wrong. The problem is that I get my beans from the database, and the persistence framework initializes two instances of the same object, in that case, two instances of class A (the instance of A within class C is another one), and Simple XML doesn't understand that they are the same objects (although they have the same id and the same attributes, and the equals method is right implemented). It causes an infinite loop, then finally to StackOverflowError. :( Niall Gallagher-2 wrote: > > Hi, > > This does not look like a complicated relationship. How have you annotated > your classes? > > Niall > > > --- On Tue, 7/29/08, MireilleMoreira <mir...@ya...> wrote: > >> From: MireilleMoreira <mir...@ya...> >> Subject: [Simple-support] CycleStrategy and complex relationships >> To: sim...@li... >> Date: Tuesday, July 29, 2008, 2:56 PM >> Hello, >> >> I followed the Simple XML Tutorial >> (http://simple.sourceforge.net/download/stream/doc/tutorial/tutorial.php) >> for serialization, but I have cyclic relationship in my >> beans. The example >> in the tutorial only tells how to serialize it with >> CycleStrategy for a >> simple cyclic relationship (Child has a Parent, and a >> Parent has a >> collection of Child), and also tells that CycleStrategy can >> be used for >> complex relationships. >> I'd like to know how to do that (complex >> relationships). I tried the simple >> way and I got nothing. Does anyone have an example? >> >> My cyclic relationship is like that: >> >> public class A { >> private List< B> b; >> ... >> } >> >> public class B { >> private C c; >> ... >> } >> >> public class C { >> private A a; >> ... >> } >> >> >> Thanks in advance! >> -- >> View this message in context: >> http://www.nabble.com/CycleStrategy-and-complex-relationships-tp18721852p18721852.html >> Sent from the Simple XML Serialization mailing list archive >> at Nabble.com. >> >> >> ------------------------------------------------------------------------- >> This SF.Net email is sponsored by the Moblin Your Move >> Developer's challenge >> Build the coolest Linux based applications with Moblin SDK >> & win great prizes >> Grand prize is a trip for two to an Open Source event >> anywhere in the world >> http://moblin-contest.org/redirect.php?banner_id=100&url=/ >> _______________________________________________ >> Simple-support mailing list >> Sim...@li... >> https://lists.sourceforge.net/lists/listinfo/simple-support > > > > > ------------------------------------------------------------------------- > This SF.Net email is sponsored by the Moblin Your Move Developer's > challenge > Build the coolest Linux based applications with Moblin SDK & win great > prizes > Grand prize is a trip for two to an Open Source event anywhere in the > world > http://moblin-contest.org/redirect.php?banner_id=100&url=/ > _______________________________________________ > Simple-support mailing list > Sim...@li... > https://lists.sourceforge.net/lists/listinfo/simple-support > > -- View this message in context: http://www.nabble.com/CycleStrategy-and-complex-relationships-tp18721852p18732138.html Sent from the Simple XML Serialization mailing list archive at Nabble.com. |
|
From: Patrick S. <si...@ge...> - 2008-07-30 12:24:54
|
I was not able to find documents that cover the topic of namespaces in simple. How would one implement namespaces such as foo:bar. I did come up with one idea, that involves @Element(name="foo:bar"), @Root(name="foo:bar") and @Attribute(name...) but I suppose that there might be a better way. regards siyb |
|
From: Niall G. <gal...@ya...> - 2008-07-30 11:54:48
|
Hi, I accept any contributions, just send it in a mail. Probably best to send it to me directly in a zip file. Thanks, Niall --- On Sun, 7/13/08, Mike P. Mikhailov <mi...@ic...> wrote: > From: Mike P. Mikhailov <mi...@ic...> > Subject: [Simple-support] How to contribute ? > To: sim...@li... > Date: Sunday, July 13, 2008, 7:17 PM > I'm using this framework about 8 monthes and found it > very useful and > really simple. > > I've extended framework with custom strategy which help > me alot to > simplify beans cross references and to establish > parent/child bean > relashionships without any additional configuration in > source xml file. > > I will be glad to contribute this code if community is > interesting in > it. Is it possible/desired or prohibited by the author ? > > -- > WBR Mike > > mailto: mi...@si... > > > -- > Best regards, > Mike mailto:mi...@ic... > > > ------------------------------------------------------------------------- > This SF.Net email is sponsored by the Moblin Your Move > Developer's challenge > Build the coolest Linux based applications with Moblin SDK > & win great prizes > Grand prize is a trip for two to an Open Source event > anywhere in the world > http://moblin-contest.org/redirect.php?banner_id=100&url=/ > _______________________________________________ > Simple-support mailing list > Sim...@li... > https://lists.sourceforge.net/lists/listinfo/simple-support |
|
From: Niall G. <gal...@ya...> - 2008-07-30 11:52:54
|
Hi, Yes, I am going to write a maven sync script so that the latest version always appears on maven. Hopefully I should be able to put the latest version up shortly. Regards, Niall --- On Mon, 7/28/08, Andrey Morais Brüggemann <an...@ya...> wrote: > From: Andrey Morais Brüggemann <an...@ya...> > Subject: [Simple-support] Simple 1.7.2 not in Maven Repository > To: sim...@li... > Date: Monday, July 28, 2008, 4:35 AM > Hi > > I'm using SimpleXml 1.7.2 on a project that uses Maven > for build, but the last version of SimpleXml on maven > repositories are 1.6.2. > Could you send 1.7.2 version to there, please? > > Thanks. > > Andrey. > > > > Novos endereços, o Yahoo! que você conhece. Crie um > email novo com a sua cara @ymail.com ou @rocketmail.com. > http://br.new.mail.yahoo.com/addresses > > ------------------------------------------------------------------------- > This SF.Net email is sponsored by the Moblin Your Move > Developer's challenge > Build the coolest Linux based applications with Moblin SDK > & win great prizes > Grand prize is a trip for two to an Open Source event > anywhere in the world > http://moblin-contest.org/redirect.php?banner_id=100&url=/ > _______________________________________________ > Simple-support mailing list > Sim...@li... > https://lists.sourceforge.net/lists/listinfo/simple-support |
|
From: Niall G. <gal...@ya...> - 2008-07-29 22:16:11
|
Hi, This does not look like a complicated relationship. How have you annotated your classes? Niall --- On Tue, 7/29/08, MireilleMoreira <mir...@ya...> wrote: > From: MireilleMoreira <mir...@ya...> > Subject: [Simple-support] CycleStrategy and complex relationships > To: sim...@li... > Date: Tuesday, July 29, 2008, 2:56 PM > Hello, > > I followed the Simple XML Tutorial > (http://simple.sourceforge.net/download/stream/doc/tutorial/tutorial.php) > for serialization, but I have cyclic relationship in my > beans. The example > in the tutorial only tells how to serialize it with > CycleStrategy for a > simple cyclic relationship (Child has a Parent, and a > Parent has a > collection of Child), and also tells that CycleStrategy can > be used for > complex relationships. > I'd like to know how to do that (complex > relationships). I tried the simple > way and I got nothing. Does anyone have an example? > > My cyclic relationship is like that: > > public class A { > private List< B> b; > ... > } > > public class B { > private C c; > ... > } > > public class C { > private A a; > ... > } > > > Thanks in advance! > -- > View this message in context: > http://www.nabble.com/CycleStrategy-and-complex-relationships-tp18721852p18721852.html > Sent from the Simple XML Serialization mailing list archive > at Nabble.com. > > > ------------------------------------------------------------------------- > This SF.Net email is sponsored by the Moblin Your Move > Developer's challenge > Build the coolest Linux based applications with Moblin SDK > & win great prizes > Grand prize is a trip for two to an Open Source event > anywhere in the world > http://moblin-contest.org/redirect.php?banner_id=100&url=/ > _______________________________________________ > Simple-support mailing list > Sim...@li... > https://lists.sourceforge.net/lists/listinfo/simple-support |
|
From: MireilleMoreira <mir...@ya...> - 2008-07-29 21:56:22
|
Hello, I followed the Simple XML Tutorial (http://simple.sourceforge.net/download/stream/doc/tutorial/tutorial.php) for serialization, but I have cyclic relationship in my beans. The example in the tutorial only tells how to serialize it with CycleStrategy for a simple cyclic relationship (Child has a Parent, and a Parent has a collection of Child), and also tells that CycleStrategy can be used for complex relationships. I'd like to know how to do that (complex relationships). I tried the simple way and I got nothing. Does anyone have an example? My cyclic relationship is like that: public class A { private List< B> b; ... } public class B { private C c; ... } public class C { private A a; ... } Thanks in advance! -- View this message in context: http://www.nabble.com/CycleStrategy-and-complex-relationships-tp18721852p18721852.html Sent from the Simple XML Serialization mailing list archive at Nabble.com. |
|
From: Andrey M. B. <an...@ya...> - 2008-07-28 11:35:31
|
Hi
I'm using SimpleXml 1.7.2 on a project that uses Maven for build, but the last version of SimpleXml on maven repositories are 1.6.2.
Could you send 1.7.2 version to there, please?
Thanks.
Andrey.
Novos endereços, o Yahoo! que você conhece. Crie um email novo com a sua cara @ymail.com ou @rocketmail.com.
http://br.new.mail.yahoo.com/addresses
|
|
From: Johannes P. <joh...@we...> - 2008-07-28 09:01:33
|
Hi,
yes, superb, this works and helped. Many thanks for the quick reply.
So as first tactics I'll use the Strategy ... :-)
Best regards
Johannes
>Re: [Simple-support] Getting location context in validate(), commit()
methods
>From: Niall Gallagher <gallagher_niall@ya...> - 2008-07-25 19:17
>Hi,
>Yes, you can. You need to look at Strategy interface. There is an
>implementation
>org.simpleframework.xml.load.DefaultStrategy which provides a good
>template. In this method
>you can add the NodeMap object to the Map provided. For example
>
>public Type getElement(Class field, NodeMap node, Map map) {
>map.put("node", node);
return defaultStrategy.getElement(field, node, map);
>}
>
>Once you have done this the session map for serialization contains the
>node. So you can
>implement your commit and validate like so.
>
>@Commit
>private void doCommit(Map map) throws Exception {
>NodeMap node = map.get("node");
>InputNode element = (InputNode)node.getParent();
>Position line = element.getPosition();
>int lineNumber = line.getLine();
>
>// do whatever with the line number
>}
>
>The next release will contain a more straight forward Strategy which
>will allow you to do
>this kind of thing a little easier. There is a TestCase which provides
>more information on
>how to use the Strategy.
>
>
>http://simple.svn.sourceforge.net/viewvc/simple/trunk/download/stream/src/test/java/org/simpleframework/xml/load/StrategyTest.java
>
>Hope this helps,
>Niall
|
|
From: Niall G. <gal...@ya...> - 2008-07-25 19:17:12
|
Hi,
Yes, you can. You need to look at Strategy interface. There is an implementation org.simpleframework.xml.load.DefaultStrategy which provides a good template. In this method you can add the NodeMap object to the Map provided. For example
public Type getElement(Class field, NodeMap node, Map map) {
map.put("node", node);
return defaultStrategy.getElement(field, node, map);
}
Once you have done this the session map for serialization contains the node. So you can implement your commit and validate like so.
@Commit
private void doCommit(Map map) throws Exception {
NodeMap node = map.get("node");
InputNode element = (InputNode)node.getParent();
Position line = element.getPosition();
int lineNumber = line.getLine();
// do whatever with the line number
}
The next release will contain a more straight forward Strategy which will allow you to do this kind of thing a little easier. There is a TestCase which provides more information on how to use the Strategy.
http://simple.svn.sourceforge.net/viewvc/simple/trunk/download/stream/src/test/java/org/simpleframework/xml/load/StrategyTest.java
Hope this helps,
Niall
--- On Fri, 7/25/08, Johannes Plass <joh...@we...> wrote:
> From: Johannes Plass <joh...@we...>
> Subject: [Simple-support] Getting location context in validate(), commit() methods
> To: sim...@li...
> Date: Friday, July 25, 2008, 3:44 AM
> Hi there,
>
> is there a way to get a location context (line
> number/column number
> in XML file) inside an objects validate(), commit(),
> etc.methods
> (those tagged with @Validate, @Commit) ?
> The location of the object's element start would
> already suffice
> as a context for error reporting.
>
> Just in case there is no way to do it in the present
> version - is there
> some interest to provide this feature in a future version
> (I could
> prepare a first draft patch if volunteers are needed :-) ?
>
> Best regards and many thanks for this simply great tool
>
> Johannes
>
>
> -------------------------------------------------------------------------
> This SF.Net email is sponsored by the Moblin Your Move
> Developer's challenge
> Build the coolest Linux based applications with Moblin SDK
> & win great prizes
> Grand prize is a trip for two to an Open Source event
> anywhere in the world
> http://moblin-contest.org/redirect.php?banner_id=100&url=/
> _______________________________________________
> Simple-support mailing list
> Sim...@li...
> https://lists.sourceforge.net/lists/listinfo/simple-support
|
|
From: Johannes P. <joh...@we...> - 2008-07-25 14:41:55
|
Hi there, is there a way to get a location context (line number/column number in XML file) inside an objects validate(), commit(), etc.methods (those tagged with @Validate, @Commit) ? The location of the object's element start would already suffice as a context for error reporting. Just in case there is no way to do it in the present version - is there some interest to provide this feature in a future version (I could prepare a first draft patch if volunteers are needed :-) ? Best regards and many thanks for this simply great tool Johannes |
|
From: Johannes P. <joh...@we...> - 2008-07-25 06:13:39
|
Hi there, is there a way to get a location context (line number/column number in XML file) inside an objects validate(), commit(), etc.methods (those tagged with @Validate, @Commit) ? The location of the object's element start would already suffice as a context for error reporting. Just in case there is no way to do it in the present version - is there some interest to provide this feature in a future version (I could prepare a first draft patch if volunteers are needed :-) ? Best regards and many thanks for this simply great tool Johannes |
|
From: Andrey M. B. <an...@ya...> - 2008-07-24 13:15:03
|
Hi
I'm using SimpleXml 1.7.2 on a project that uses Maven for build, but the last version of SimpleXml on maven repositories are 1.6.2.
Could you send 1.7.2 version to there, please?
Thanks.
Andrey.
Novos endereços, o Yahoo! que você conhece. Crie um email novo com a sua cara @ymail.com ou @rocketmail.com.
http://br.new.mail.yahoo.com/addresses
|
|
From: Niall G. <gal...@ya...> - 2008-07-23 20:56:04
|
Hi,
The map entry element as follows:
<preselectedInterval section="OPERATION">
<timeUnit>DAY</timeUnit>
<offset>0</offset>
</preselectedInterval>
Should be:
<preselectedInterval section="OPERATION">
<timeSelection>
<timeUnit>DAY</timeUnit>
<offset>0</offset>
</timeSelection>
</preselectedInterval>
Of course you can name the timeSelection anything you like using the attribute value= in the ElementMap.
Niall
--- On Wed, 7/23/08, Hugo Schneggerich <hug...@gm...> wrote:
> From: Hugo Schneggerich <hug...@gm...>
> Subject: [Simple-support] Problems using ElementMap
> To: sim...@li...
> Date: Wednesday, July 23, 2008, 7:12 AM
> Hello,
>
> I'm trying to read some XML data using @ElementMap.
>
> Here's the XML:
>
> ...
> <time>
> <timeSelection>
>
> <maxSelectableInterval>500000</maxSelectableInterval>
>
> <defaultTimeSelectionMode>CUSTOM</defaultTimeSelectionMode>
> <preselectedIntervals>
> <preselectedInterval
> section="OPERATION">
> <timeUnit>DAY</timeUnit>
> <offset>0</offset>
> </preselectedInterval>
> <preselectedInterval
> section="DETAIL">
> <timeUnit>DAY</timeUnit>
> <offset>0</offset>
> </preselectedInterval>
> <preselectedInterval
> section="MAINTENANCE">
> <timeUnit>DAY</timeUnit>
> <offset>0</offset>
> </preselectedInterval>
> <preselectedInterval
> section="ADMIN">
> <timeUnit>DAY</timeUnit>
> <offset>0</offset>
> </preselectedInterval>
> </preselectedIntervals>
> </timeSelection>
> </time>
> ...
>
>
> Here's the Code:
>
> @Root(name = "time")
> public class Time
> {
> @Element
> public TimeSelectionEntries timeSelection;
> }
>
> public class TimeSelectionEntries
> {
> @Element
> public int maxSelectableInterval;
> @Element
> public TimeSelectionMode defaultTimeSelectionMode;
> @ElementMap(entry="preselectedInterval",
> key="section", attribute=true)
> public Map<SessionController.Sections,
> TimeSelection> preselectedIntervals;
> }
>
> public class TimeSelection
> {
> @Element
> TimeSelectionMode timeUnit;
> @Element
> int offset;
>
> // Further code not of interest here...
> }
>
> SessionController.Sections and TimeSelectionMode are
> enumerations. I tried using Strings instead of enumerations
> but also no success.
>
>
> Here's the Exception:
>
> org.simpleframework.xml.load.ValueRequiredException: Unable
> to satisfy @org.simpleframework.xml.Element(name=,
> data=false, required=true) on field 'timeUnit' for
> class ... .TimeSelection at line 125
> at
> org.simpleframework.xml.load.Composite.validate(Composite.java:389)
> at
> org.simpleframework.xml.load.Composite.readElements(Composite.java:252)
> at
> org.simpleframework.xml.load.Composite.read(Composite.java:194)
> at
> org.simpleframework.xml.load.Composite.read(Composite.java:140)
> ...
>
> I don't understand the Exception because as you can see
> the element timeUnit is definitively there. What am I doing
> wrong??
>
> Thank you!
>
> Hugo
>
>
> --
> GMX Kostenlose Spiele: Einfach online spielen und Spaß
> haben mit Pastry Passion!
> http://games.entertainment.gmx.net/de/entertainment/games/free/puzzle/6169196
>
> -------------------------------------------------------------------------
> This SF.Net email is sponsored by the Moblin Your Move
> Developer's challenge
> Build the coolest Linux based applications with Moblin SDK
> & win great prizes
> Grand prize is a trip for two to an Open Source event
> anywhere in the world
> http://moblin-contest.org/redirect.php?banner_id=100&url=/
> _______________________________________________
> Simple-support mailing list
> Sim...@li...
> https://lists.sourceforge.net/lists/listinfo/simple-support
|
|
From: Hugo S. <hug...@gm...> - 2008-07-23 14:12:19
|
Hello,
I'm trying to read some XML data using @ElementMap.
Here's the XML:
...
<time>
<timeSelection>
<maxSelectableInterval>500000</maxSelectableInterval>
<defaultTimeSelectionMode>CUSTOM</defaultTimeSelectionMode>
<preselectedIntervals>
<preselectedInterval section="OPERATION">
<timeUnit>DAY</timeUnit>
<offset>0</offset>
</preselectedInterval>
<preselectedInterval section="DETAIL">
<timeUnit>DAY</timeUnit>
<offset>0</offset>
</preselectedInterval>
<preselectedInterval section="MAINTENANCE">
<timeUnit>DAY</timeUnit>
<offset>0</offset>
</preselectedInterval>
<preselectedInterval section="ADMIN">
<timeUnit>DAY</timeUnit>
<offset>0</offset>
</preselectedInterval>
</preselectedIntervals>
</timeSelection>
</time>
...
Here's the Code:
@Root(name = "time")
public class Time
{
@Element
public TimeSelectionEntries timeSelection;
}
public class TimeSelectionEntries
{
@Element
public int maxSelectableInterval;
@Element
public TimeSelectionMode defaultTimeSelectionMode;
@ElementMap(entry="preselectedInterval", key="section", attribute=true)
public Map<SessionController.Sections, TimeSelection> preselectedIntervals;
}
public class TimeSelection
{
@Element
TimeSelectionMode timeUnit;
@Element
int offset;
// Further code not of interest here...
}
SessionController.Sections and TimeSelectionMode are enumerations. I tried using Strings instead of enumerations but also no success.
Here's the Exception:
org.simpleframework.xml.load.ValueRequiredException: Unable to satisfy @org.simpleframework.xml.Element(name=, data=false, required=true) on field 'timeUnit' for class ... .TimeSelection at line 125
at org.simpleframework.xml.load.Composite.validate(Composite.java:389)
at org.simpleframework.xml.load.Composite.readElements(Composite.java:252)
at org.simpleframework.xml.load.Composite.read(Composite.java:194)
at org.simpleframework.xml.load.Composite.read(Composite.java:140)
...
I don't understand the Exception because as you can see the element timeUnit is definitively there. What am I doing wrong??
Thank you!
Hugo
--
GMX Kostenlose Spiele: Einfach online spielen und Spaß haben mit Pastry Passion!
http://games.entertainment.gmx.net/de/entertainment/games/free/puzzle/6169196
|
|
From: Niall G. <gal...@ya...> - 2008-07-19 11:10:07
|
Hi,
In the CycleStrategy you can keep track of the depth by using the serialization session map.
setElement(Class field, Object value, NodeMap node, Map map)
A new map is created each time serialization is performed. Its used to store session data, which is also available in persister callbacks with @Commmit and @Validate. Anyway you could do this.
public boolean setElement(Class field, Object value, NodeMap node, Map map)
Integer depth = (Integer) map.get("depth");
if(depth == null) {
depth = new Integer(0);
}
map.put("depth", depth + 1);
// etc....
}
This should work fine.
Niall
--- On Fri, 7/18/08, Karl Garske <kar...@gm...> wrote:
> From: Karl Garske <kar...@gm...>
> Subject: Re: [Simple-support] Controlling Depth of Serialization
> To: gal...@ya...
> Cc: sim...@li...
> Date: Friday, July 18, 2008, 8:53 PM
> Hi Niall,
>
> So I've looked through CycleStrategy and I think I get
> the general idea of
> how it works. Right now I'm focused on just
> serialization, so I'm working
> with setElement and setRoot. But I'm still unclear on
> how I can achieve
> tracking of depth with the information available to me in
> setElement.
>
> CycleStrategy seems to keep track of the instances it has
> already seen. If
> found, it will only write a reference attribute, otherwise
> it writes all
> attributes of a node. DepthStrategy as I'm calling it
> would need to keep
> track of objects in a similar way, but it would also need
> to know what
> parent element it came from wouldn't it?
>
> Also, in the example you provided I think you may have
> meant:
>
> public Type getElement(....) {
> if(depth++ > 2) {
> return new EmptyType();
> }
>
>
> On Thu, Jul 17, 2008 at 5:05 AM, Niall Gallagher
> <gal...@ya...>
> wrote:
>
> > Hi,
> >
> > If you don't annotate the reference to C then it
> wont be serialized. There
> > is another way also. If you implement a Strategy you
> can return a Type such
> > that the Type.isReference == true then it wont
> serialize it. For instance in
> > your strategy implementation if you return the
> following.
> >
> > public Type setElement(....) {
> > if(depth++ > 2) {
> > return new EmptyType();
> > }
> > }
> >
> > To see exactly what is involved in this look at the
> cycle strategy.
> > However, I think what you are looking for is a
> reference to C in B that is
> > not annotated. For example
> >
> >
> > @Root
> > public class A {
> > @Element
> > private B b;
> > }
> >
> > @Root
> > public class B {
> > private C c;
> > }
> >
> > public class C {
> > }
> >
> > Here if you serialize A, only reference to b will be
> serialized. B's
> > reference to C will not be serialized as it is not
> annotated.
> >
> > Niall
> >
> > --- On Wed, 7/16/08, Karl Garske
> <kar...@gm...> wrote:
> >
> > > From: Karl Garske <kar...@gm...>
> > > Subject: [Simple-support] Controlling Depth of
> Serialization
> > > To: sim...@li...
> > > Date: Wednesday, July 16, 2008, 2:54 PM
> > > Hello, Is there any way to control the depth of
> > > serialization through
> > > something like the Persister? For example, my
> object graph
> > > might look
> > > something like A->B->C where A,B,C are
> objects and
> > > -> is the direction of
> > > reference. Is there a way to specify depth=2 and
> have it
> > > only serialize A
> > > and B, but not C? My apologies if this is
> documented
> > > somewhere, but I didn't
> > > see it in the tutorial.
> > >
> > >
> >
> Thanks!-------------------------------------------------------------------------
> > > This SF.Net email is sponsored by the Moblin Your
> Move
> > > Developer's challenge
> > > Build the coolest Linux based applications with
> Moblin SDK
> > > & win great prizes
> > > Grand prize is a trip for two to an Open Source
> event
> > > anywhere in the world
> > >
> >
> http://moblin-contest.org/redirect.php?banner_id=100&url=/_______________________________________________
> > > Simple-support mailing list
> > > Sim...@li...
> > >
> https://lists.sourceforge.net/lists/listinfo/simple-support
> >
> >
> >
> >
|
|
From: Karl G. <kar...@gm...> - 2008-07-19 03:53:42
|
Hi Niall,
So I've looked through CycleStrategy and I think I get the general idea of
how it works. Right now I'm focused on just serialization, so I'm working
with setElement and setRoot. But I'm still unclear on how I can achieve
tracking of depth with the information available to me in setElement.
CycleStrategy seems to keep track of the instances it has already seen. If
found, it will only write a reference attribute, otherwise it writes all
attributes of a node. DepthStrategy as I'm calling it would need to keep
track of objects in a similar way, but it would also need to know what
parent element it came from wouldn't it?
Also, in the example you provided I think you may have meant:
public Type getElement(....) {
if(depth++ > 2) {
return new EmptyType();
}
On Thu, Jul 17, 2008 at 5:05 AM, Niall Gallagher <gal...@ya...>
wrote:
> Hi,
>
> If you don't annotate the reference to C then it wont be serialized. There
> is another way also. If you implement a Strategy you can return a Type such
> that the Type.isReference == true then it wont serialize it. For instance in
> your strategy implementation if you return the following.
>
> public Type setElement(....) {
> if(depth++ > 2) {
> return new EmptyType();
> }
> }
>
> To see exactly what is involved in this look at the cycle strategy.
> However, I think what you are looking for is a reference to C in B that is
> not annotated. For example
>
>
> @Root
> public class A {
> @Element
> private B b;
> }
>
> @Root
> public class B {
> private C c;
> }
>
> public class C {
> }
>
> Here if you serialize A, only reference to b will be serialized. B's
> reference to C will not be serialized as it is not annotated.
>
> Niall
>
> --- On Wed, 7/16/08, Karl Garske <kar...@gm...> wrote:
>
> > From: Karl Garske <kar...@gm...>
> > Subject: [Simple-support] Controlling Depth of Serialization
> > To: sim...@li...
> > Date: Wednesday, July 16, 2008, 2:54 PM
> > Hello, Is there any way to control the depth of
> > serialization through
> > something like the Persister? For example, my object graph
> > might look
> > something like A->B->C where A,B,C are objects and
> > -> is the direction of
> > reference. Is there a way to specify depth=2 and have it
> > only serialize A
> > and B, but not C? My apologies if this is documented
> > somewhere, but I didn't
> > see it in the tutorial.
> >
> >
> Thanks!-------------------------------------------------------------------------
> > This SF.Net email is sponsored by the Moblin Your Move
> > Developer's challenge
> > Build the coolest Linux based applications with Moblin SDK
> > & win great prizes
> > Grand prize is a trip for two to an Open Source event
> > anywhere in the world
> >
> http://moblin-contest.org/redirect.php?banner_id=100&url=/_______________________________________________
> > Simple-support mailing list
> > Sim...@li...
> > https://lists.sourceforge.net/lists/listinfo/simple-support
>
>
>
>
|
|
From: Karl G. <kar...@gm...> - 2008-07-17 19:13:09
|
Hi Niall, Thanks for the reply. I had a feeling CycleStrategy might be
applicable here, but I'm afraid I'm not clear on how to implement the
proposed approach. I will need to dig deeper into the examples to get a feel
for it now that I know this is a potential solution.
This may be somewhat out of the ordinary, but B does need to serialize C if
the serialization process begins with B as the root. So, the annotations do
need to be in the class definitions. My temporary solution was to use a lazy
initialization of C from B, but I feel that having the serializer limit
traversal of the graph is still the best option.
On Thu, Jul 17, 2008 at 5:05 AM, Niall Gallagher <gal...@ya...>
wrote:
> Hi,
>
> If you don't annotate the reference to C then it wont be serialized. There
> is another way also. If you implement a Strategy you can return a Type such
> that the Type.isReference == true then it wont serialize it. For instance in
> your strategy implementation if you return the following.
>
> public Type setElement(....) {
> if(depth++ > 2) {
> return new EmptyType();
> }
> }
>
> To see exactly what is involved in this look at the cycle strategy.
> However, I think what you are looking for is a reference to C in B that is
> not annotated. For example
>
>
> @Root
> public class A {
> @Element
> private B b;
> }
>
> @Root
> public class B {
> private C c;
> }
>
> public class C {
> }
>
> Here if you serialize A, only reference to b will be serialized. B's
> reference to C will not be serialized as it is not annotated.
>
> Niall
>
> --- On Wed, 7/16/08, Karl Garske <kar...@gm...> wrote:
>
> > From: Karl Garske <kar...@gm...>
> > Subject: [Simple-support] Controlling Depth of Serialization
> > To: sim...@li...
> > Date: Wednesday, July 16, 2008, 2:54 PM
> > Hello, Is there any way to control the depth of
> > serialization through
> > something like the Persister? For example, my object graph
> > might look
> > something like A->B->C where A,B,C are objects and
> > -> is the direction of
> > reference. Is there a way to specify depth=2 and have it
> > only serialize A
> > and B, but not C? My apologies if this is documented
> > somewhere, but I didn't
> > see it in the tutorial.
> >
> >
> Thanks!-------------------------------------------------------------------------
> > This SF.Net email is sponsored by the Moblin Your Move
> > Developer's challenge
> > Build the coolest Linux based applications with Moblin SDK
> > & win great prizes
> > Grand prize is a trip for two to an Open Source event
> > anywhere in the world
> >
> http://moblin-contest.org/redirect.php?banner_id=100&url=/_______________________________________________
> > Simple-support mailing list
> > Sim...@li...
> > https://lists.sourceforge.net/lists/listinfo/simple-support
>
>
>
>
|
|
From: Niall G. <gal...@ya...> - 2008-07-17 12:05:28
|
Hi,
If you don't annotate the reference to C then it wont be serialized. There is another way also. If you implement a Strategy you can return a Type such that the Type.isReference == true then it wont serialize it. For instance in your strategy implementation if you return the following.
public Type setElement(....) {
if(depth++ > 2) {
return new EmptyType();
}
}
To see exactly what is involved in this look at the cycle strategy. However, I think what you are looking for is a reference to C in B that is not annotated. For example
@Root
public class A {
@Element
private B b;
}
@Root
public class B {
private C c;
}
public class C {
}
Here if you serialize A, only reference to b will be serialized. B's reference to C will not be serialized as it is not annotated.
Niall
--- On Wed, 7/16/08, Karl Garske <kar...@gm...> wrote:
> From: Karl Garske <kar...@gm...>
> Subject: [Simple-support] Controlling Depth of Serialization
> To: sim...@li...
> Date: Wednesday, July 16, 2008, 2:54 PM
> Hello, Is there any way to control the depth of
> serialization through
> something like the Persister? For example, my object graph
> might look
> something like A->B->C where A,B,C are objects and
> -> is the direction of
> reference. Is there a way to specify depth=2 and have it
> only serialize A
> and B, but not C? My apologies if this is documented
> somewhere, but I didn't
> see it in the tutorial.
>
> Thanks!-------------------------------------------------------------------------
> This SF.Net email is sponsored by the Moblin Your Move
> Developer's challenge
> Build the coolest Linux based applications with Moblin SDK
> & win great prizes
> Grand prize is a trip for two to an Open Source event
> anywhere in the world
> http://moblin-contest.org/redirect.php?banner_id=100&url=/_______________________________________________
> Simple-support mailing list
> Sim...@li...
> https://lists.sourceforge.net/lists/listinfo/simple-support
|
|
From: Karl G. <kar...@gm...> - 2008-07-16 21:54:53
|
Hello, Is there any way to control the depth of serialization through something like the Persister? For example, my object graph might look something like A->B->C where A,B,C are objects and -> is the direction of reference. Is there a way to specify depth=2 and have it only serialize A and B, but not C? My apologies if this is documented somewhere, but I didn't see it in the tutorial. Thanks! |
|
From: Mike P. M. <mi...@ic...> - 2008-07-14 02:20:33
|
I'm using this framework about 8 monthes and found it very useful and really simple. I've extended framework with custom strategy which help me alot to simplify beans cross references and to establish parent/child bean relashionships without any additional configuration in source xml file. I will be glad to contribute this code if community is interesting in it. Is it possible/desired or prohibited by the author ? -- WBR Mike mailto: mi...@si... -- Best regards, Mike mailto:mi...@ic... |
|
From: Niall G. <gal...@ya...> - 2008-07-11 19:39:30
|
Hi,
Did you try putting the jar in the JBoss core classpath lib directory. This may help, but interference like this is typical of J2EE. I would imagine you'd get better information from the JBoss mailing list. Also, this is not a class loading issue, it _must_ be byte manipulation/generation. Do you annotate an interface or an abstract class? If not you'd get a ClassNotFoundException when you try to serialize.
Niall
--- On Fri, 7/11/08, Quirino Zagarese <qu...@la...> wrote:
> From: Quirino Zagarese <qu...@la...>
> Subject: Re: [Simple-support] More on dropped annotations
> To: gal...@ya...
> Date: Friday, July 11, 2008, 2:08 AM
> Hi,
> thanks for the hint, but it seems I can't find a way to
> load classes
> correctly in J2EE setting.
> The class I was trying to serialize is an entity bean, but
> I found the same
> behavior with a POJO (serialization works perfectly in
> stand-alone setting).
> JBoss works on top of javassist to implement aop, but I
> don't know if
> classloading is also done in that way.
> I already found this problem with a framework I'm
> developing and I solved it
> using javassist annotation scanning.
> Maybe this could be a solution for Simple. An interesting
> and fast solution
> could be implemented using Scannotation (by Bill Burke).
> About my current
> issue....I feel lost.
>
>
> 2008/7/11 Niall Gallagher
> <gal...@ya...>:
>
> > Hi,
> >
> > This seems really strange that JBoss would do this,
> strange that it would
> > treat annotations differently to normal classes. What
> type of object are you
> > annotating? Is it CGLIB generated or something
> similar? Anyway, yes you can
> > tell Simple to do this. Simple always tries the
> > Thread.currentThread().getContextClassLoader(). So
> before write or read do
> > this.
> >
> > ClassLoader previousClassLoader =
> > Thread.currentThread().getContextClassLoader():
> > try {
> >
> Thread.currentThread().setContextClassLoader(myClassLoader);
> > persister.write(myObject, myStream);
> > }finally {
> >
> Thread.currentThread().setContextClassLoader(previousClassLoader);
> > }
> >
> > This will work for you with a custom class loader.
> However, I think there
> > has to be a better solution than this, either JBoss is
> manupulating the
> > class with CGLIB or something similar, or there is
> some other subtle issue
> > as to why JBoss drops annotations. If not then JBoss
> is just plain crap.
> >
> > Hope this helps,
> > Niall
> >
> >
> > --- On Thu, 7/10/08, Quirino Zagarese
> <qu...@la...> wrote:
> >
> > > From: Quirino Zagarese
> <qu...@la...>
> > > Subject: [Simple-support] More on dropped
> annotations
> > > To: sim...@li...
> > > Date: Thursday, July 10, 2008, 9:36 AM
> > > I'm trying to find a solution, but I
> can't get out
> > > of it for now.
> > > I toke a look at Simple serialization mechanism:
> maybe I
> > > lost some steps,
> > > but the key is:
> > >
> > > 1) I use persister.write(annotatedObject,
> > > anOutputStream,etc)
> > > 2) Persister calls Traverser which should be the
> root of
> > > all serialization
> > > operations
> > > 3) Traverser gets source-object's class and
> starts
> > > scanning process to find
> > > annotations and whatever
> > >
> > > Now, if JBoss drops annotations during class
> loading,
> > > it's impossible for
> > > Simple to find them.
> > > Anyway we could reload the class with a custom
> classloader
> > > and make Simple
> > > use the loaded Class object
> > > as annotation scanning map. So my question is:
> > > Is it possible to tell Persister to do something
> like
> > > write(Object source,
> > > Class reloadedClass, OutputStream stream) ?
> > >
> > > Thanks in advance
> > >
> > > --
> > > Quirino Zagarese
> > >
> > > LaszloItalia Founder (www.laszloitalia.org)
> > > Software Development Manager - Galilaeus s.r.l.
> > > (www.galilaeus.net
> >
> )-------------------------------------------------------------------------
> > > Sponsored by: SourceForge.net Community Choice
> Awards: VOTE
> > > NOW!
> > > Studies have shown that voting for your favorite
> open
> > > source project,
> > > along with a healthy diet, reduces your potential
> for
> > > chronic lameness
> > > and boredom. Vote Now at
> > >
> >
> http://www.sourceforge.net/community/cca08_______________________________________________
> > > Simple-support mailing list
> > > Sim...@li...
> > >
> https://lists.sourceforge.net/lists/listinfo/simple-support
> >
> >
> >
> >
>
>
> --
> Quirino Zagarese
>
> LaszloItalia Founder (www.laszloitalia.org)
> Software Development Manager - Galilaeus s.r.l.
> (www.galilaeus.net)
|
|
From: Niall G. <gal...@ya...> - 2008-07-11 06:10:19
|
Hi,
This seems really strange that JBoss would do this, strange that it would treat annotations differently to normal classes. What type of object are you annotating? Is it CGLIB generated or something similar? Anyway, yes you can tell Simple to do this. Simple always tries the Thread.currentThread().getContextClassLoader(). So before write or read do this.
ClassLoader previousClassLoader = Thread.currentThread().getContextClassLoader():
try {
Thread.currentThread().setContextClassLoader(myClassLoader);
persister.write(myObject, myStream);
}finally {
Thread.currentThread().setContextClassLoader(previousClassLoader);
}
This will work for you with a custom class loader. However, I think there has to be a better solution than this, either JBoss is manupulating the class with CGLIB or something similar, or there is some other subtle issue as to why JBoss drops annotations. If not then JBoss is just plain crap.
Hope this helps,
Niall
--- On Thu, 7/10/08, Quirino Zagarese <qu...@la...> wrote:
> From: Quirino Zagarese <qu...@la...>
> Subject: [Simple-support] More on dropped annotations
> To: sim...@li...
> Date: Thursday, July 10, 2008, 9:36 AM
> I'm trying to find a solution, but I can't get out
> of it for now.
> I toke a look at Simple serialization mechanism: maybe I
> lost some steps,
> but the key is:
>
> 1) I use persister.write(annotatedObject,
> anOutputStream,etc)
> 2) Persister calls Traverser which should be the root of
> all serialization
> operations
> 3) Traverser gets source-object's class and starts
> scanning process to find
> annotations and whatever
>
> Now, if JBoss drops annotations during class loading,
> it's impossible for
> Simple to find them.
> Anyway we could reload the class with a custom classloader
> and make Simple
> use the loaded Class object
> as annotation scanning map. So my question is:
> Is it possible to tell Persister to do something like
> write(Object source,
> Class reloadedClass, OutputStream stream) ?
>
> Thanks in advance
>
> --
> Quirino Zagarese
>
> LaszloItalia Founder (www.laszloitalia.org)
> Software Development Manager - Galilaeus s.r.l.
> (www.galilaeus.net)-------------------------------------------------------------------------
> Sponsored by: SourceForge.net Community Choice Awards: VOTE
> NOW!
> Studies have shown that voting for your favorite open
> source project,
> along with a healthy diet, reduces your potential for
> chronic lameness
> and boredom. Vote Now at
> http://www.sourceforge.net/community/cca08_______________________________________________
> Simple-support mailing list
> Sim...@li...
> https://lists.sourceforge.net/lists/listinfo/simple-support
|