Details
-
Task
-
Status: Closed
-
Major
-
Resolution: Fixed
-
3.1M1
-
None
Description
Support for DataChannel filters with API similar to ServletFilters, only adapted for Cayenne (i.e. it will be mirroring DataChannel onQuery and onSync methods) :
public interface DataChannelFilter {
void init(DataChannel channel);
QueryResponse onQuery(
ObjectContext originatingContext,
Query query,
DataChannelFilterChain filterChain);
GraphDiff onSync(
ObjectContext originatingContext,
GraphDiff changes,
int syncType,
DataChannelFilterChain filterChain);
}
One difference with ServletFilter is the absence of "destroy" method in DataChannelFilter. Destroy is achieved via @BeforeScopeEnd annotation per filter.
DataChannelFilters may be good for tying multiple object lifecycle events together in one context, monitoring performance at the ObjectContext-level, and other good things.
TODO: One possible consequence of this feature is that channel decorators will provide no advantage as a design pattern, and relationships between ObjectContext and its parent DataChannel may not require such a high-level of abstraction (a leaky abstraction for that matter). E.g. we may get rid of DataDomainQuery, returning parent domain the old way via API calls.