more TODOs in the code.
[xmlrouter] / config / src / main / java / org / wamblee / xmlrouter / config / Config.java
index 940b34622fcdd3d454c683cba5e083fca59ad6db..b12210b1b841a5ac52af7dec6cdcd9a1607eea67 100644 (file)
  */
 package org.wamblee.xmlrouter.config;
 
-import java.util.Collection;
+import java.util.List;
 
 import org.wamblee.xmlrouter.common.Id;
 
 /**
- * Configuration API for the XML router.
+ * Interface for managing a set of configuration items of a given type with
+ * unique ids.
  * 
  * @author Erik Brakkee
+ * 
+ * @param <T>
+ *            Type for which ids are generated.
  */
-public interface Config {
-
-    Id<DocumentType> addDocumentType(DocumentType aType);
-
-    void removeDocumentType(Id<DocumentType> aId);
-
-    Collection<DocumentType> getDocumentTypes();
-
-    Id<Transformation> addTransformation(Transformation aTransformation);
-
-    void removeTransformation(Id<Transformation> aId);
-
-    Collection<Transformation> getTransformations();
-
-    Id<Filter> addFilter(Filter aFilter);
-
-    void removeFilter(Id<Filter> aId);
-
-    Collection<Filter> getFilters();
-
-}
+public interface Config<T> extends Identifiable<Config> {
+
+    // TODO define what happens when there is a duplicate item.
+
+    /**
+     * Adds an item. No item with the same id may exist.
+     * 
+     * @param aT
+     *            item
+     */
+    void add(T aT);
+
+    /**
+     * Removes the item with a given id.
+     * 
+     * @param aId
+     *            Item id.
+     * @return true iff the item was removed.
+     */
+    boolean remove(Id<T> aId);
+
+    /**
+     * @return All available items.
+     */
+    List<T> values();
+}
\ No newline at end of file