001/*
002 *  Licensed to the Apache Software Foundation (ASF) under one
003 *  or more contributor license agreements.  See the NOTICE file
004 *  distributed with this work for additional information
005 *  regarding copyright ownership.  The ASF licenses this file
006 *  to you under the Apache License, Version 2.0 (the
007 *  "License"); you may not use this file except in compliance
008 *  with the License.  You may obtain a copy of the License at
009 *  
010 *    http://www.apache.org/licenses/LICENSE-2.0
011 *  
012 *  Unless required by applicable law or agreed to in writing,
013 *  software distributed under the License is distributed on an
014 *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
015 *  KIND, either express or implied.  See the License for the
016 *  specific language governing permissions and limitations
017 *  under the License. 
018 *  
019 */
020package org.apache.directory.api.util;
021
022
023import java.util.List;
024
025
026/**
027 * Monitor used to track existence or duplication of components.
028 *
029 * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
030 */
031public interface ComponentsMonitor
032{
033
034    /**
035     * Use a component.
036     *
037     * @param component the component
038     * @return this components monitor
039     * @throws IllegalArgumentException if the component is already used
040     */
041    ComponentsMonitor useComponent( String component );
042
043
044    /**
045     * Check if all components are used.
046     *
047     * @return true if all components are used
048     */
049    boolean allComponentsUsed();
050
051
052    /**
053     * Checks if the final state is valid. That depends whether the components are mandatory
054     * or optional.
055     *
056     * @return true if the final state is valid
057     */
058    boolean finalStateValid();
059
060
061    /**
062     * Gets the remaining components.
063     *
064     * @return the remaining components
065     */
066    List<String> getRemainingComponents();
067
068}