Config no longer implements Identifiable because this was in violation of the contrac...
[xmlrouter] / impl / src / main / java / org / wamblee / xmlrouter / impl / XMLRouterConfiguration.java
index 25ae3313151cb70d2a7f6684ab231ce704f3e93a..600aac33a8f2564e37e50b0545276e27069fbcf3 100644 (file)
@@ -15,6 +15,8 @@
  */
 package org.wamblee.xmlrouter.impl;
 
+import org.wamblee.general.Pair;
+
 /**
  * The XML Router configuration contains both configuration data as well as
  * derived data used by the XML router. It is important that all this data is
@@ -27,44 +29,20 @@ package org.wamblee.xmlrouter.impl;
 public interface XMLRouterConfiguration {
 
     /**
-     * To be called before the configuration is updated. Corresponds to write
-     * lock acquire.
-     */
-    void startConfigurationChange();
-
-    /**
-     * To be called after the configuration is updated. Corresponds to write
-     * lock acquire.
-     */
-    void endConfigurationChange();
-
-    /**
-     * To be called before the configuration is used. Corresponds to read lock
-     * acquire.
-     */
-    void startPublishEvent();
-
-    /**
-     * To be called after the configuration is used. Corresponds to read lock
-     * release.
-     */
-    void endPublishEvent();
-
-    /**
-     * @return Configuration data.
+     * Atomically get the configuration. The XMLRouter uses this to get a
+     * snapshot of the configuration data for handling a single message. In this
+     * way a consistent configuration is used for each event.
+     * 
+     * @return Configuration.
      */
-    ExtendedRouterConfig getRouterConfig();
+    Pair<ExtendedRouterConfig, TransformationPaths> getConfig();
 
     /**
-     * Sets the configuration and updates derived data.
+     * Atomically sets the configuration and updates derived data. There will be
+     * a short time during which read attempts will fail.
      * 
      * @param aConfig
      *            Configuration to set.
      */
     void setRouterConfig(ExtendedRouterConfig aConfig);
-
-    /**
-     * @return Transformation paths (derived data).
-     */
-    TransformationPaths getTransformations();
 }