com.smartgwt.client.docs

## Interface DsFacade

-     public interface DsFacade

  ### DataSource Facade pattern

  The DataSource Facade pattern means implementing a DataSource that fulfills its `DSRequests` by passing them on to another DataSource.

  This can be useful for:

  - various testing purposes, such as introducing long delays or intermittent failures to see how your code responds
  - implementing application-specific caching behaviors that go beyond `DataSource.cacheAllData` or automatic caching done by `ResultSet`
  - providing DSResponses that make use of data from two or more DataSources, by sending DSRequests to those other DataSources, waiting for both to respond, then combining the response data (note that for something like a SQL join, you should instead use `DataSourceField.includeFrom` if you have Smart GWT Pro or better)
  - slight modifications of data returned by another DataSource (although consider just using `OperationBinding.operationId` for this)

  This facade pattern can be implemented either server-side or client-side:

  - server-side (Smart GWT Pro or better), implement a custom DataSource (see QuickStart Guide) and implement the server-side API DataSource.execute() by calling DataSource.execute() on some other DataSource, then return the DSResponse that results.
  - client-side, use `dataProtocol:"clientCustom"`. The `FacadeDataSource` provides a specific implementation that is useful for testing purposes. Alternative, the code below shows the simplest possible code for the facade pattern when implemented client-side via `dataProtocol:"clientCustom"` - requests are forwarded to another DataSource, and the responses are returned completely unchanged.

        final DataSource facadeDataSource = new DataSource() {
            {
                setDataProtocol(DSProtocol.CLIENTCUSTOM);
                setInheritsFrom(ItemSupplyXmlDS.getInstance());
            }

            @Override
            public Object transformRequest(final DSRequest dsRequest) {
                final DataSource superDS = DataSource.get(getInheritsFrom()),
                        selfDS = this;

                final DSRequest derivedDSRequest = cloneDSRequest(dsRequest);
                derivedDSRequest.setShowPrompt(false);
                derivedDSRequest.setCallback(new DSCallback() {
                    @Override
                 public void execute(DSResponse dsResponse, Object data, DSRequest derivedDSRequest) {
                selfDS.processResponse(dsRequest.getRequestId(), superDS.cloneDSResponse(dsResponse));
                    }
                });

                superDS.execute(derivedDSRequest);

                return dsRequest.getData();
            }
        };