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.geronimo.kernel;
018    
019    import java.util.Set;
020    
021    import org.apache.geronimo.gbean.AbstractName;
022    import javax.management.ObjectName;
023    
024    
025    /**
026     * @version $Rev: 519834 $ $Date: 2007-03-19 00:32:05 -0400 (Mon, 19 Mar 2007) $
027     */
028    public class GBeanNotFoundException extends KernelException {
029        private ObjectName gBeanName;
030        private AbstractName abstractName;
031        private Set<AbstractName> matches;
032    
033        public GBeanNotFoundException(ObjectName gBeanName) {
034            super(gBeanName+" not found");
035            this.gBeanName = gBeanName;
036        }
037    
038        public GBeanNotFoundException(ObjectName gBeanName, Throwable cause) {
039            super(gBeanName+" not found", cause);
040            this.gBeanName = gBeanName;
041        }
042    
043        public GBeanNotFoundException(AbstractName abstractName) {
044            super(abstractName + " not found");
045            this.abstractName = abstractName;
046        }
047    
048        public GBeanNotFoundException(String message, Set patterns, Set<AbstractName> matches) {
049            super(message + ": " + patterns);
050            this.matches = matches;
051        }
052    
053        public GBeanNotFoundException(String message, Throwable cause) {
054            super(message, cause);
055        }
056    
057        public ObjectName getGBeanName() {
058            return gBeanName;
059        }
060    
061        public AbstractName getAbstractName() {
062            return abstractName;
063        }
064    
065        public boolean isGBeanName() {
066            return gBeanName != null;
067        }
068    
069        public boolean isAbstractName() {
070            return abstractName != null;
071        }
072    
073        public Set<AbstractName> getMatches() {
074            return matches;
075        }
076    
077        public boolean hasMatches() {
078            return matches != null && matches.size() > 0;
079        }
080    }