Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

    Server side data source creation from xsd schema

    Hello,
    I'm new to SmartGWT and currently evaluating the possibilities.

    I'm using the SmartGWT EE eval version: 2.4

    So far I got dynamic data sources delivered from server side,
    basically by putting together a respective xml as string and
    do a DataSource.fromXML()
    This is fine.

    I also have seen that there is the possibility to turn an XSD schema into
    data sources, but this seems to be for the client side.

    So my question is:
    Is there an API supported possibility to turn an XSD into data sources on server side?

    I would like to do this, since I would need to further tweak the data source
    before delivering it to the client.

    I understand, I can do this with my current approach by parsing the XSD myself and turn it into a respective xml string.
    I'm just wondering if there is some helper API that makes this more convenient?

    Thank you,
    Daniel

    #2
    How dynamic does this need to be? There's client-side functionality (XMLTools.loadXMLSchema()) that will give you a live client-side DataSource - from this it would be a small amount of Java code to generate DataSource XML. But this would be something you'd do before deployment, not on the fly.

    Alternatively, under system/schema/schemaTranslator.xsl you can find an XSLT program that converts from XSD to an XML format that is essentially DataSource definitions, although different tags are used (XSElement, XSCompleteType which are internal subclasses of DataSource used to represent XML Schema). However this would be internal hacking.

    Finally, Isomorphic could add the feature via the Feature Sponsorship program , which would be fairly straightforward based on the XSLT functionality we already have.

    Comment


      #3
      Thank you for the quick response.

      Actually the xsd schema can be changed while the app server is running without any further deployment.

      As such, I would like to have the client app react in the same way,
      so changing the data source dynamically without any deployment.
      This would be the preferred way.

      If it is not feasible, a re-deployment might be ok as well, since the schema should not change that often.
      However, I want to check about a solution of the preferred requirement first.

      Speaking about that,
      I understand that as long as the datasource it requested via DataSource.get(), it will not reflect any schema changes, since it is delivered from some datasource cache, right ?

      As soon as a DataSource.load() with forceReload=true is issued,
      the updated data source is available to any *newly* instanciated UI components using this data source.

      Is this understanding correct ?

      In the meanwhile, I will have a look at the internal schema translator.

      Thank you,
      Daniel

      Comment


        #4
        Yes, your understand of client-side DataSource access is correct; DataSource.get() just returns already-loaded DataSources and DataSource.load() with forceReload will load a new DataSource but will not upgrade components that were using the old version of the DataSource.

        Comment


          #5
          Thank you for the confirmation!

          Comment

          Working...
          X