    001/*
    002 * Licensed to the Apache Software Foundation (ASF) under one or more
    003 * contributor license agreements.  See the NOTICE file distributed with
    004 * this work for additional information regarding copyright ownership.
    005 * The ASF licenses this file to You under the Apache License, Version 2.0
    006 * (the "License"); you may not use this file except in compliance with
    007 * the License.  You may obtain a copy of the License at
    008 *
    009 *     http://www.apache.org/licenses/LICENSE-2.0
    010 *
    011 * Unless required by applicable law or agreed to in writing, software
    012 * distributed under the License is distributed on an "AS IS" BASIS,
    013 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    014 * See the License for the specific language governing permissions and
    015 * limitations under the License.
    016 */
    017package org.apache.commons.configuration2.resolver;
    018
    019import java.net.URL;
    020import java.util.Map;
    021
    022/**
    023 * Interface used for registering and retrieving PUBLICID to URL mappings.
    024 * @author <a
    025 * href="http://commons.apache.org/configuration/team-list.html">Commons
    026 * Configuration team</a>
    027 * @since 1.7
    028 * @version $Id: EntityRegistry.java 1624601 2014-09-12 18:04:36Z oheger $
    029 */
    030public interface EntityRegistry
    031{
    032    /**
    033     * <p>
    034     * Registers the specified URL for the specified public identifier.
    035     * </p>
    036     * <p>
    037     * This implementation maps {@code PUBLICID}'s to URLs (from which
    038     * the resource will be loaded). A common use case for this method is to
    039     * register local URLs (possibly computed at runtime by a class loader) for
    040     * DTDs and Schemas. This allows the performance advantage of using a local
    041     * version without having to ensure every {@code SYSTEM} URI on every
    042     * processed XML document is local. This implementation provides only basic
    043     * functionality. If more sophisticated features are required, either calling
    044     * {@code XMLConfiguration.setDocumentBuilder(DocumentBuilder)} to set a custom
    045     * {@code DocumentBuilder} (which also can be initialized with a
    046     * custom {@code EntityResolver}) or creating a custom entity resolver
    047     * and registering it with the XMLConfiguration is recommended.
    048     * </p>
    049     *
    050     * @param publicId Public identifier of the Entity to be resolved
    051     * @param entityURL The URL to use for reading this Entity
    052     * @throws IllegalArgumentException if the public ID is undefined
    053     */
    054    void registerEntityId(String publicId, URL entityURL);
    055
    056    /**
    057     * Returns a map with the entity IDs that have been registered using the
    058     * {@code registerEntityId()} method.
    059     *
    060     * @return a map with the registered entity IDs
    061     */
    062    Map<String, URL> getRegisteredEntities();
    063}