[ 
https://issues.apache.org/jira/browse/CAY-1508?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Andrus Adamchik updated CAY-1508:
---------------------------------

    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.

  was:
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. 

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.


> Support for DataChannel filters
> -------------------------------
>
>                 Key: CAY-1508
>                 URL: https://issues.apache.org/jira/browse/CAY-1508
>             Project: Cayenne
>          Issue Type: Task
>          Components: Core Library
>    Affects Versions: 3.1M1
>            Reporter: Andrus Adamchik
>            Assignee: Andrus Adamchik
>             Fix For: 3.1M1
>
>
> 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.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to