Announcement

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

    Enhancement(?): Subclassed "IDACall"-equivalent for serverside requests

    Hello Isomorphic,

    is it possible to do something similar like subclassing IDACall on the server side?
    I managed to add criteria to all my client side requests using the code shown in http://forums.smartclient.com/showpo...96&postcount=4.

    Now all the requests coming from the browser have the criteria I want. Is there something similar possible for the serverside, e.g. overwrite the default implementations for fetch, update, remove and add, when there is no ServerObject given?

    Right now I found out that it is better to move the code I have in my IDACall in a separate static method class and use that from all my ds.xml with a ServerObject like:
    ds.xml:
    Code:
    	.....
    	<serverObject lookupStyle="new" className="com.lmscompany.lms.server.worker.T_LEADTEMPERATURE" />
    	<operationBindings>
    	</operationBindings>
    </DataSource>
    LEADTEMPERATURE.java:
    Code:
    public class T_LEADTEMPERATURE {
    	public DSResponse fetch(DSRequest dsRequest, HttpServletRequest servletRequest) throws Exception {
    		RequestModifier.modifyCriteria(dsRequest, servletRequest);
    		return dsRequest.execute();
    	}
    };
    RequestModifier.modifyCriteria() adds the criteria needed. I'd now add a ds-specific <serverObject> to every DS and overwrite fetch() there every time with boilerplate code. Even if I called a generic ServerObject-class from every DS, I'd still need the <serverObject>-tag in every .ds.xml.

    Is it already possible to pre-process all requests by one "per application"-ServerObject, before the ds.xml-processing starts or might this be a good enhancement idea?

    Best regards,
    Blama

    PS: Even if it's not possible, I still can solve my use-cases with so little code - perfect! Thank you, once again.

    #2
    Take a look at the ability to create a Custom DataSource via the serverConstructor attribute (see QuickStart Guide, search for "Custom DataSource").

    Your custom DataSource can be a subclass of SQLDataSource that you use in every .ds.xml file - this gives you the ability to add special behaviors to any operation on all of your DataSources, without needing the entire <operationBinding><serverObject> structure on each one.

    Comment


      #3
      Hi Isomorphic,

      thanks for the pointer. It works exactly as expected.

      Best regards,
      Blama

      Comment

      Working...
      X