01: /*
02: * $Id: NoSuchFunctionException.java,v 1.16 2007/03/16 09:55:00 agoubard Exp $
03: *
04: * Copyright 2003-2007 Orange Nederland Breedband B.V.
05: * See the COPYRIGHT file for redistribution and use restrictions.
06: */
07: package org.xins.server;
08:
09: import org.xins.common.MandatoryArgumentChecker;
10:
11: /**
12: * Exception that indicates that there is no function matching the request.
13: *
14: * @version $Revision: 1.16 $ $Date: 2007/03/16 09:55:00 $
15: * @author <a href="mailto:ernst@ernstdehaan.com">Ernst de Haan</a>
16: *
17: * @since XINS 1.0.0
18: */
19: public final class NoSuchFunctionException extends Exception {
20:
21: /**
22: * The name of the function.
23: */
24: private final String _functionName;
25:
26: /**
27: * Constructs a new <code>NoSuchFunctionException</code> for the specified
28: * function name.
29: *
30: * @param functionName
31: * the name, cannot be <code>null</code>.
32: *
33: * @throws IllegalArgumentException
34: * if <code>functionName == null</code>.
35: */
36: NoSuchFunctionException(String functionName)
37: throws IllegalArgumentException {
38: super (createMessage(functionName));
39: _functionName = functionName;
40: }
41:
42: /**
43: * Creates the error message for this exception.
44: *
45: * @param functionName
46: * the name of the function, or <code>null</code>.
47: *
48: * @return
49: * the error message, never <code>null</code>.
50: *
51: * @throws IllegalArgumentException
52: * if <code>functionName == null</code>.
53: */
54: private static String createMessage(String functionName)
55: throws IllegalArgumentException {
56:
57: // Function name specified
58: MandatoryArgumentChecker.check("functionName", functionName);
59:
60: return "The function \"" + functionName + "\" cannot be found.";
61: }
62:
63: /**
64: * Gets the name of the function.
65: *
66: * @return
67: * the name of the function, never <code>null</code>.
68: */
69: public String getFunctionName() {
70: return _functionName;
71: }
72: }
|