Announcement

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

    Clientside RestDataSource loaded by DataSourceLoader possible?

    Hi Isomorphic,

    is it possible to get a RestDataSource via clientside static DataSource.get(String)? This means that the DataSource must have been loaded before using the DataSourceLoader-servlet.
    I'd like to define the fields and operation bindings as I'm used to in XML, then perhaps modify the DataSource (especially transformRequest() / transformResponse()) on the clientside.

    ​If so, is there some special documentation for this?

    I'm asking as neither the RestDataSource samples in the LGPL showcase nor the WSDL samples in EE showcase use this technique.

    Thank you & Best regards
    Blama

    #2
    What would be the point here? You want a server-side DataSource definition, but you want to have your SGWT application talk to it via the RestDataSource protocol? Why do that when it's just slower and lacks a few features?

    Comment


      #3
      Hi Isomorphic,

      I wanted to use the DataSourceLoader of the application sending the REST-requests so that I can configure (and localize the field titles) the DataSource in XML and not in Java, as I'm used to this (also more easy w.r.t. auto-complete and validation using a XSD schema).
      Also it seems that this would be less verbose in terms of lines used.

      Best regards
      Blama

      Comment


        #4
        Still not following this. If you have a .ds.xml file on the server then you can localize it using XML, as you are already familiar with, load it on the client with DataSourceLoader, and immediately use it with SGWT components with no further effort.

        All of this you've done before - what is the purpose of introducing RestDataSource into the system?

        Comment


          #5
          Hi Isomorphic,

          this is the bigger picture for "Why introducing RestDataSource into the system":
          • My application is used to work on opportunities a company generates.
          • Besides (mandatory) masterdata like name, given name, company, address, ... these opportunities have (mandatory) categorization data like campaign / type.
          • Now I want to import data from other systems, say a CRM. These systems do only provide the masterdata
          • My new connector application will get the data from the other system and add it to the existing system - the existing system therefore gets a REST API using your RestHandler servlet.
          • New opportunities will need to be amended with default values for categorization data like campaign / type.
          • In the connector application (that may or may not run on the same system) I need to configure with campaign / type to use as default value
          • So the connector application needs to access the existing application to get the possible values - as the existing application be remote, this is via RestDataSource.
          • Now I need to create RestDataSources - either via XML/DataSourceLoader or manually in Java. This is where my question comes from.
          Does this make sense to you?
          I do indeed think that it might be easier as well if I just used SQL Datasources for the connector, but this means that I will always have to run my system on the same machine (or at least in the same network, so that both databases are reachable). It seems more future proof to me to separate application and connector here but I agree that this is worth to think about.

          Best regards
          Blama

          Comment


            #6
            Here's the possible misstep:

            So the connector application needs to access the existing application to get the possible values - as the existing application be remote, this is via RestDataSource.
            You have multiple options to avoid having to switch protocols here, including document.domain settings or setting up CORS, or setting up a transparent proxy (not our HttpProxyServlet, which doesn't have that purpose). All of these are probably better than having your secondary application talk REST.

            Comment


              #7
              Hi Isomorphic,

              it's definitely worth a second thought if using SQL Datasources is not the better option - I wanted to have application and connector separated from a data point of view and also have the connector being read-only on the existing application.
              But perhaps I can solve this with different schemas in the database (have them already) and readonly-grants on the needed tables from the application-schema to the connector-dbuser.

              This way the data is separated, but access is easier. Even foreignKeys would be possible.
              The price to pay is that the application and connector need to reside on the same system - but perhaps that's a small price to pay for way easier development.

              Best regards
              Blama

              Comment


                #8
                FYI: Crossposting.

                Comment


                  #9
                  Hi Isomorphic,

                  Originally posted by Isomorphic View Post
                  All of these are probably better than having your secondary application talk REST.
                  Got it, thank you. I'll have a look at the options you mentioned and try to get it working without REST, which only should be used to connect to 3rd-party applications.

                  Thank you & Best regards
                  Blama

                  Comment

                  Working...
                  X