Go Back   TechArena Community > Software > Software Development
Become a Member!
Forgot your username/password?
Register Tags Active Topics RSS Search Mark Forums Read

Sponsored Links



Binding Java object to XML Datasource GWT

Software Development


Reply
 
Thread Tools Search this Thread
  #1  
Old 27-10-2009
Member
 
Join Date: Jun 2009
Posts: 56
Binding Java object to XML Datasource GWT
  

I need a little help on a java problem:

In one sentence: I want to present the user with the structure of a java object, ie each field values (a toString () will do), and the possibility to browse complex types (lists, maps, etc..).

roughly, the view "Variables" of Eclipse

I have some technical limitations:
JAVA objects (retrieved from a repository running on a jdk1.4)
rendering done in a GUI GWT (jdk1.6)
my items are quite complex and their structure is not known in advance

I begin just my thoughts and at first sight, I am tempted to approach the problem from this angle:
1) GWT likes the datasources in XML. So far I see GWT manipulate an XML describing the object that I must show (form name = attribute name, value = toString () attribute)
2) I must then find a java lib allowing me to generate XML on the fly from a java object passed as parameter, by introspection attributes (or possibly use getters).

Any idea?

Reply With Quote
  #2  
Old 27-10-2009
Member
 
Join Date: Feb 2008
Posts: 1,844
Re: Binding Java object to XML Datasource GWT

xstream, but it only works on server side
Reply With Quote
  #3  
Old 27-10-2009
Member
 
Join Date: Jun 2009
Posts: 56
Re: Binding Java object to XML Datasource GWT

The fact that it runs on the server side does not worry, the very opposite:

The manipulation will require a call server side to retrieve the full Java object, so as to make as much as the Transco java-> xml is done server side.

Thank you in any case.
Reply With Quote
  #4  
Old 27-10-2009
Member
 
Join Date: Jan 2008
Posts: 1,513
Re: Binding Java object to XML Datasource GWT

XStream is not bad, I also used JAXB 2 (included in J2EE) and it works very well too.
Reply With Quote
  #5  
Old 27-10-2009
Member
 
Join Date: Jun 2009
Posts: 56
Re: Binding Java object to XML Datasource GWT

OK, thank you, I started watching the side of XStream:

Not bad actually, and it can easily highlight the directory structure of a java object as XML.

Here, I encountered two limitations of GWT:

1) XML input grid is not an XML "standard" (with n levels) nested XML but a "flat" for each subject with a foreign key to its parent object.

Code:
<List>
−
<employee>
  <EmployeeId>4</EmployeeId>
  <ReportsTo>1</ReportsTo>
  <Name>Charles Madigan</Name>
  <Job>Chief Operating Officer</Job>
  <Phone>x10962</Phone>
  <Email>cmadigan@server.com</Email>
  <OrgUnit>Management</OrgUnit>
  <Salary>26200.00</Salary>
  <Gender>male</Gender>
  <MaritalStatus>married</MaritalStatus>
  <EmployeeType>full time</EmployeeType>
  <EmployeeStatus>active</EmployeeStatus>
</employee>
−
<employee>
  <EmployeeId>192</EmployeeId>
  <ReportsTo>4</ReportsTo>
  <Name>Ralph Brogan</Name>
  <Job>Mgr Software Client Supp</Job>
  <Phone>x32524</Phone>
  <Email>rbrogan@server.com</Email>
  <OrgUnit>Management</OrgUnit>
  <Salary>13700.00</Salary>
  <Gender>male</Gender>
  <MaritalStatus>married</MaritalStatus>
  <EmployeeType>full time</EmployeeType>
  <EmployeeStatus>active</EmployeeStatus>
</employee>
−
<employee>
  <EmployeeId>295</EmployeeId>
  <ReportsTo>192</ReportsTo>
  <Name>Bhushan Sambhus</Name>
  <Job>Line Worker</Job>
  <Phone>x12125</Phone>
  <Email>bsambhus@server.com</Email>
  <OrgUnit>Management</OrgUnit>
  <Salary>8300.00</Salary>
  <Gender>female</Gender>
  <MaritalStatus>married</MaritalStatus>
  <EmployeeType>part time</EmployeeType>
  <EmployeeStatus>active</EmployeeStatus>
</employee>
</List>
2) GWT expects that the fields are defined explicitly in order to render ... This is not my case, because the generated XML by XStream uses as a tag attribute names ...

In short, I must find a way to convert the XML into an XML XStream "GWT compliant" ... and it is not won
Reply With Quote
Reply

  TechArena Community > Software > Software Development
Tags: , , ,



Thread Tools Search this Thread
Search this Thread:

Advanced Search


Similar Threads for: "Binding Java object to XML Datasource GWT"
Thread Thread Starter Forum Replies Last Post
get classes and object in java preeti makkar Software Development 1 07-05-2012 11:08 AM
Adding an object in java Gunner 1 Software Development 5 27-02-2010 02:20 AM
How big is an Object in Java? Why Java neglects sizeof? KALINDA Software Development 4 10-11-2009 02:19 AM
How to create object in JAVA HP_Crook Software Development 3 09-10-2009 11:52 PM
Object test = new Object() <-- Java, best way in C++ ADISH Software Development 3 25-10-2008 02:32 PM


All times are GMT +5.5. The time now is 10:16 AM.