* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
- */
+ */
package org.wamblee.xmlrouter.config;
import java.util.Collection;
import org.wamblee.xmlrouter.common.Id;
/**
- * Configuration API for the XML router.
+ * Basic configuration 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);
+public interface Config<T> {
- Collection<Transformation> getTransformations();
+ /**
+ * Adds a item
+ *
+ * @param aT
+ * item
+ * @return Unique id.
+ */
+ Id<T> add(T aT);
- Id<Filter> addFilter(Filter aFilter);
+ /**
+ * Removes the item with a given id.
+ *
+ * @param aId
+ * Item id.
+ * @return true iff the item was removed.
+ */
+ boolean remove(Id<T> aId);
- void removeFilter(Id<Filter> aId);
+ /**
+ * @return All available ids.
+ */
+ Collection<Id<T>> ids();
- Collection<Filter> getFilters();
+ /**
+ * Gets the item for the given id.
+ *
+ * @param aId
+ * Item id.
+ * @return Item, or null if not found.
+ */
+ T get(Id<T> aId);
-}
+}
\ No newline at end of file