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     */
017    package org.apache.xbean.kernel;
018    
019    /**
020     * Indicates that a kernel is already registerd with the KernelFactory under the specified name.
021     *
022     * @author Dain Sundstrom
023     * @version $Id$
024     * @since 2.0
025     */
026    public class KernelAlreadyExistsException extends RuntimeException {
027        private final String name;
028    
029        /**
030         * Creates a KernelAlreadyExistsException using the specified name.
031         *
032         * @param name the name of the kernel that was alredy registered
033         */
034        public KernelAlreadyExistsException(String name) {
035            super("A kernel is already registered with the name " + name);
036            if (name == null) throw new NullPointerException("name is null");
037            this.name = name;
038        }
039    
040        /**
041         * Gets the name of the kernel that already existed.
042         *
043         * @return the name of the kernel that already existed.
044         */
045        public String getName() {
046            return name;
047        }
048    }