001: /* ====================================================================
002: The Jicarilla Software License
003:
004: Copyright (c) 2003 Leo Simons.
005: All rights reserved.
006:
007: Permission is hereby granted, free of charge, to any person obtaining
008: a copy of this software and associated documentation files (the
009: "Software"), to deal in the Software without restriction, including
010: without limitation the rights to use, copy, modify, merge, publish,
011: distribute, sublicense, and/or sell copies of the Software, and to
012: permit persons to whom the Software is furnished to do so, subject to
013: the following conditions:
014:
015: The above copyright notice and this permission notice shall be
016: included in all copies or substantial portions of the Software.
017:
018: THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
019: EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
020: MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
021: IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
022: CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
023: TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
024: SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
025: ==================================================================== */
026: package org.jicarilla.container;
027:
028: import org.jicarilla.lang.Selector;
029:
030: /**
031: * A {@link JicarillaException} that is thrown by a {@link Container} if a
032: * provided selector is not supported by that container (if it is null, for
033: * example, or if it is not a
034: * {@link org.jicarilla.lang.CriterionExposingSelector} and the container
035: * requires it to be).
036: *
037: * @author <a href="mail at leosimons dot com">Leo Simons</a>
038: * @version $Id: IllegalSelectorException.java,v 1.5 2004/03/23 13:37:51 lsimons Exp $
039: */
040: public class IllegalSelectorException extends RegistrationException {
041: /** The selector that is illegal. */
042: protected Selector m_selector;
043:
044: /**
045: * Construct a new <code>IllegalSelectorException</code> instance.
046: *
047: * @param selector the selector that is illegal.
048: */
049: public IllegalSelectorException(final Selector selector) {
050: super (
051: "A selector '"
052: + selector
053: + "' was added, but this container does not support it!");
054: if (selector == null)
055: throw new NullPointerException("selector");
056: m_selector = selector;
057: }
058:
059: /**
060: * Construct a new <code>IllegalSelectorException</code> instance.
061: *
062: * @param selector the selector that is illegal.
063: * @param message the detail message for this exception.
064: */
065: public IllegalSelectorException(final Selector selector,
066: final String message) {
067: super (message);
068: if (selector == null)
069: throw new NullPointerException("selector");
070: m_selector = selector;
071: }
072:
073: /**
074: * Construct a new <code>IllegalSelectorException</code> instance.
075: *
076: * @param selector the selector that is illegal.
077: * @param throwable the root cause of the exception.
078: */
079: public IllegalSelectorException(final Selector selector,
080: final Throwable throwable) {
081: super (
082: "A selector '"
083: + selector
084: + "' was added, but this container does not support it!",
085: throwable);
086: if (selector == null)
087: throw new NullPointerException("selector");
088: m_selector = selector;
089: }
090:
091: /**
092: * Construct a new <code>IllegalSelectorException</code> instance.
093: *
094: * @param selector the selector that is illegal.
095: * @param message the detail message for this exception.
096: * @param throwable the root cause of the exception.
097: */
098: public IllegalSelectorException(final Selector selector,
099: final String message, final Throwable throwable) {
100: super (message, throwable);
101: if (selector == null)
102: throw new NullPointerException("selector");
103: m_selector = selector;
104: }
105:
106: /**
107: * Retrieve the illegal selector.
108: *
109: * @return the selector that is illegal.
110: */
111: public Selector getSelector() {
112: return m_selector;
113: }
114: }
|