You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cayenne.apache.org by nt...@apache.org on 2018/07/27 15:21:54 UTC

cayenne git commit: Documentation update

Repository: cayenne
Updated Branches:
  refs/heads/master 8339c1995 -> bdcd78a90


Documentation update


Project: http://git-wip-us.apache.org/repos/asf/cayenne/repo
Commit: http://git-wip-us.apache.org/repos/asf/cayenne/commit/bdcd78a9
Tree: http://git-wip-us.apache.org/repos/asf/cayenne/tree/bdcd78a9
Diff: http://git-wip-us.apache.org/repos/asf/cayenne/diff/bdcd78a9

Branch: refs/heads/master
Commit: bdcd78a9067d221919d9731b5228789b2b1328eb
Parents: 8339c19
Author: Nikita Timofeev <st...@gmail.com>
Authored: Fri Jul 27 18:09:41 2018 +0300
Committer: Nikita Timofeev <st...@gmail.com>
Committed: Fri Jul 27 18:09:41 2018 +0300

----------------------------------------------------------------------
 .../_cayenne-guide/part2/customize.adoc         |  7 +++--
 .../_cayenne-guide/part2/including.adoc         |  7 +++++
 .../_cayenne-guide/part2/lifecycle.adoc         | 29 ++++++++------------
 .../_cayenne-guide/serviceCollections.adoc      |  4 ---
 4 files changed, 24 insertions(+), 23 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cayenne/blob/bdcd78a9/docs/asciidoc/cayenne-guide/src/docs/asciidoc/_cayenne-guide/part2/customize.adoc
----------------------------------------------------------------------
diff --git a/docs/asciidoc/cayenne-guide/src/docs/asciidoc/_cayenne-guide/part2/customize.adoc b/docs/asciidoc/cayenne-guide/src/docs/asciidoc/_cayenne-guide/part2/customize.adoc
index 924a160..a9b1149 100644
--- a/docs/asciidoc/cayenne-guide/src/docs/asciidoc/_cayenne-guide/part2/customize.adoc
+++ b/docs/asciidoc/cayenne-guide/src/docs/asciidoc/_cayenne-guide/part2/customize.adoc
@@ -451,9 +451,12 @@ As shown in the example above, ExtendedTypes are stored by DbAdapter. In fact Db
 
 Factory that returns `javax.sql.DataSource` object based on the configuration provided in the "nodeDescriptor".
 
-===== DataChannelFilter
+===== DataChannelSyncFilter and DataChannelQueryFilter
 
-An interface of a filter that allows to intercept DataChannel operations. Filters allow to implement chains of custom processors around a DataChannel, that can be used for security, monitoring, business logic, providing context to lifecycle event listeners, etc.
+Interfaces of filters that allow to intercept DataChannel operations.
+Filters allow to implement chains of custom processors around a DataChannel,
+that can be used for security, monitoring, business logic,
+providing context to lifecycle event listeners, etc.
 
 ===== QueryCache
 

http://git-wip-us.apache.org/repos/asf/cayenne/blob/bdcd78a9/docs/asciidoc/cayenne-guide/src/docs/asciidoc/_cayenne-guide/part2/including.adoc
----------------------------------------------------------------------
diff --git a/docs/asciidoc/cayenne-guide/src/docs/asciidoc/_cayenne-guide/part2/including.adoc b/docs/asciidoc/cayenne-guide/src/docs/asciidoc/_cayenne-guide/part2/including.adoc
index 94e48eb..dcda5bb 100644
--- a/docs/asciidoc/cayenne-guide/src/docs/asciidoc/_cayenne-guide/part2/including.adoc
+++ b/docs/asciidoc/cayenne-guide/src/docs/asciidoc/_cayenne-guide/part2/including.adoc
@@ -292,6 +292,11 @@ Example - creating a DB schema on a local HSQLDB database:
 .^|Yes
 .^|DataMap XML file which is the destination of the schema import. Can be an existing file. If this file does not exist, it is created when cdbimport is executed. E.g. `${project.basedir}/src/main/resources/my.map.xml`. If "overwrite" is true (the default), an existing DataMap will be used as a template for the new imported DataMap, i.e. all its entities will be cleared and recreated, but its common settings, such as default Java package, will be preserved (unless changed explicitly in the plugin configuration).
 
+.^|cayenneProject
+.^|File
+.^|No
+.^|Project XML file which will be used. Can be an existing file, in this case data map will be added to project if it's not already there. If this file does not exist, it is created when cdbimport is executed. E.g. `${project.basedir}/src/main/resources/cayenne-project.xml`.
+
 .^|adapter
 .^|String
 .^|No
@@ -526,6 +531,8 @@ Here is example of configuration for cdbimport task:
 cdbimport {
     // map can be skipped if it is defined in cayenne.defaultDataMap
     map 'datamap.map.xml'
+    // optional project file, will be created if missing
+    cayenneProject 'cayenne-project.xml'
 
     dataSource {
         driver 'com.mysql.cj.jdbc.Driver'

http://git-wip-us.apache.org/repos/asf/cayenne/blob/bdcd78a9/docs/asciidoc/cayenne-guide/src/docs/asciidoc/_cayenne-guide/part2/lifecycle.adoc
----------------------------------------------------------------------
diff --git a/docs/asciidoc/cayenne-guide/src/docs/asciidoc/_cayenne-guide/part2/lifecycle.adoc b/docs/asciidoc/cayenne-guide/src/docs/asciidoc/_cayenne-guide/part2/lifecycle.adoc
index 4457ef3..55fe453 100644
--- a/docs/asciidoc/cayenne-guide/src/docs/asciidoc/_cayenne-guide/part2/lifecycle.adoc
+++ b/docs/asciidoc/cayenne-guide/src/docs/asciidoc/_cayenne-guide/part2/lifecycle.adoc
@@ -134,7 +134,7 @@ ServerRuntime runtime = ServerRuntime.builder()
        // ..
        .addModule(binder ->
             ServerModule.contributeDomainListeners()
-                .add(new Listener1())
+                .add(Listener1.class)
                 .add(new Listener2())
        )
        // ..
@@ -208,29 +208,24 @@ public class MyEntity2 extends _MyEntity2 {
 ----
 
 
-==== Combining Listeners with DataChannelFilters
+==== Combining Listeners with DataChannel filters
 
-A final touch in the listeners design is preserving the state of the listener within a single select or commit, so that events generated by multiple objects can be collected and processed all together. To do that you will need to implement a `DataChannelFilter`, and add some callback methods to it. They will store their state in a ThreadLocal variable of the filter. Here is an example filter that does something pretty meaningless - counts how many total objects were committed. However it demonstrates the important pattern of aggregating multiple events and presenting a combined result:
+A final touch in the listeners design is preserving the state of the listener within a single select or commit,
+so that events generated by multiple objects can be collected and processed all together.
+To do that you will need to implement a `DataChannelSyncFilter` (and/or `DataChannelQueryFilter`), and add some callback methods to it.
+They will store their state in a `ThreadLocal` variable of the filter.
+Here is an example filter that does something pretty meaningless - counts how many total objects were committed.
+However it demonstrates the important pattern of aggregating multiple events and presenting a combined result:
 
 [source, Java]
 ----
-public class CommittedObjectCounter implements DataChannelFilter {
+public class CommittedObjectCounter implements DataChannelSyncFilter {
 
-    private ThreadLocal<int[]> counter;
-
-    @Override
-    public void init(DataChannel channel) {
-        counter = new ThreadLocal<int[]>();
-    }
-
-    @Override
-    public QueryResponse onQuery(ObjectContext originatingContext, Query query, DataChannelFilterChain filterChain) {
-        return filterChain.onQuery(originatingContext, query);
-    }
+    private ThreadLocal<int[]> counter = new ThreadLocal<int[]>();
 
     @Override
     public GraphDiff onSync(ObjectContext originatingContext, GraphDiff changes, int syncType,
-            DataChannelFilterChain filterChain) {
+            DataChannelSyncFilterChain filterChain) {
 
         // init the counter for the current commit
         counter.set(new int[1]);
@@ -262,7 +257,7 @@ Now since this is both a filter and a listener, it needs to be registered as suc
 ServerRuntime runtime = ServerRuntime.builder()
         // ..
         .addModule(b ->
-                ServerModule.contributeDomainFilters(b)
+                ServerModule.contributeDomainSyncFilters(b)
                         .add(CommittedObjectCounter.class)
         )
         // ..

http://git-wip-us.apache.org/repos/asf/cayenne/blob/bdcd78a9/docs/asciidoc/cayenne-guide/src/docs/asciidoc/_cayenne-guide/serviceCollections.adoc
----------------------------------------------------------------------
diff --git a/docs/asciidoc/cayenne-guide/src/docs/asciidoc/_cayenne-guide/serviceCollections.adoc b/docs/asciidoc/cayenne-guide/src/docs/asciidoc/_cayenne-guide/serviceCollections.adoc
index 6678865..2430360 100644
--- a/docs/asciidoc/cayenne-guide/src/docs/asciidoc/_cayenne-guide/serviceCollections.adoc
+++ b/docs/asciidoc/cayenne-guide/src/docs/asciidoc/_cayenne-guide/serviceCollections.adoc
@@ -30,10 +30,6 @@ Note that the collection keys below are defined as constants in `org.apache.caye
 .^|`List<DbAdapterDetector>`
 .^|Contains objects that can discover the type of current database and install the correct DbAdapter in runtime.
 
-.^|`cayenne.server.domain_filters`
-.^|`List<DataChannelFilter>`
-.^|Stores DataDomain filters.
-
 .^|`cayenne.server.domain_listeners`
 .^|`List<Object>`
 .^|Stores DataDomain listeners.