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: /**
029: * A {@link JicarillaException} that is thrown by a {@link Container} if a
030: * provided adapter is not supported by that container (if it is null, for
031: * example, or if it is not of some subtype that the container requires).
032: *
033: * @author <a href="mail at leosimons dot com">Leo Simons</a>
034: * @version $Id: IllegalAdapterException.java,v 1.5 2004/01/11 11:49:26 lsimons Exp $
035: */
036: public class IllegalAdapterException extends RegistrationException {
037: /** The adapter that is illegal. */
038: protected Object m_adapter;
039:
040: /**
041: * Construct a new <code>IllegalAdapterException</code> instance.
042: *
043: * @param adapter the adapter that is illegal.
044: */
045: public IllegalAdapterException(final Object adapter) {
046: super (
047: "A selector '"
048: + adapter
049: + "' was added, but this container does not support it!");
050: if (adapter == null)
051: throw new NullPointerException("adapter");
052: m_adapter = adapter;
053: }
054:
055: /**
056: * Construct a new <code>IllegalAdapterException</code> instance.
057: *
058: * @param adapter the adapter that is illegal.
059: * @param message the detail message for this exception.
060: */
061: public IllegalAdapterException(final Object adapter,
062: final String message) {
063: super (message);
064: if (adapter == null)
065: throw new NullPointerException("adapter");
066: m_adapter = adapter;
067: }
068:
069: /**
070: * Construct a new <code>IllegalAdapterException</code> instance.
071: *
072: * @param adapter the adapter that is illegal.
073: * @param throwable the root cause of the exception.
074: */
075: public IllegalAdapterException(final Object adapter,
076: final Throwable throwable) {
077: super (
078: "A selector '"
079: + adapter
080: + "' was added, but this container does not support it!",
081: throwable);
082: if (adapter == null)
083: throw new NullPointerException("adapter");
084: m_adapter = adapter;
085: }
086:
087: /**
088: * Construct a new <code>IllegalAdapterException</code> instance.
089: *
090: * @param adapter the adapter that is illegal.
091: * @param message the detail message for this exception.
092: * @param throwable the root cause of the exception.
093: */
094: public IllegalAdapterException(final Object adapter,
095: final String message, final Throwable throwable) {
096: super (message, throwable);
097: if (adapter == null)
098: throw new NullPointerException("adapter");
099: m_adapter = adapter;
100: }
101:
102: /**
103: * Retrieve the illegal adapter.
104: *
105: * @return the adapter that is illegal.
106: */
107: public Object getAdapter() {
108: return m_adapter;
109: }
110: }
|