01: package org.drools;
02:
03: /*
04: * Copyright 2005 JBoss Inc
05: *
06: * Licensed under the Apache License, Version 2.0 (the "License");
07: * you may not use this file except in compliance with the License.
08: * You may obtain a copy of the License at
09: *
10: * http://www.apache.org/licenses/LICENSE-2.0
11: *
12: * Unless required by applicable law or agreed to in writing, software
13: * distributed under the License is distributed on an "AS IS" BASIS,
14: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15: * See the License for the specific language governing permissions and
16: * limitations under the License.
17: */
18:
19: import org.drools.rule.Rule;
20:
21: /**
22: * Indicates an error integrating a <code>Rule</code> or <code>Package</code>
23: * into a <code>RuleBase</code>.
24: *
25: * @see RuleBase#addRule
26: * @see RuleBase#addPackage
27: *
28: * @author <a href="mailto:bob@eng.werken.com">bob mcwhirter </a>
29: *
30: * @version $Id: RuleIntegrationException.java,v 1.6 2004/09/17 00:14:06
31: * mproctor Exp $
32: */
33: public class RuleIntegrationException extends IntegrationException {
34: /**
35: *
36: */
37: private static final long serialVersionUID = 400L;
38: /** The rule. */
39: private final Rule rule;
40:
41: /**
42: * @see java.lang.Exception#Exception()
43: *
44: * @param rule
45: * The offending rule.
46: */
47: public RuleIntegrationException(final Rule rule) {
48: super (createMessage(rule));
49: this .rule = rule;
50: }
51:
52: /**
53: * @see java.lang.Exception#Exception(Throwable cause)
54: *
55: * @param rule
56: * The offending rule.
57: */
58: public RuleIntegrationException(final Rule rule,
59: final Throwable cause) {
60: super (createMessage(rule), cause);
61: this .rule = rule;
62: }
63:
64: /**
65: * Retrieve the <code>Rule</code>.
66: *
67: * @return The rule.
68: */
69: public Rule getRule() {
70: return this .rule;
71: }
72:
73: private static String createMessage(final Rule rule) {
74: return rule.getName() + " cannot be integrated";
75: }
76: }
|