View Javadoc

1   /*
2    *  
3    *  Fosstrak LLRP Commander (www.fosstrak.org)
4    * 
5    *  Copyright (C) 2008 ETH Zurich
6    *
7    *  This program is free software: you can redistribute it and/or modify
8    *  it under the terms of the GNU General Public License as published by
9    *  the Free Software Foundation, either version 3 of the License, or
10   *  (at your option) any later version.
11   *
12   *  This program is distributed in the hope that it will be useful,
13   *  but WITHOUT ANY WARRANTY; without even the implied warranty of
14   *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15   *  GNU General Public License for more details.
16   *
17   *  You should have received a copy of the GNU General Public License
18   *  along with this program.  If not, see <http://www.gnu.org/licenses/> 
19   *
20   */
21  
22  package org.fosstrak.llrp.adaptor.exception;
23  
24  import org.fosstrak.llrp.client.LLRPExceptionHandlerTypeMap;
25  
26  /**
27   * Exception class. This class acts as the top level exception for 
28   * the llrp exception messages.
29   * @author sawielan
30   *
31   */
32  public class LLRPRuntimeException extends Exception {
33  	
34  	/**
35  	 * serial id.
36  	 */
37  	private static final long serialVersionUID = -174158847556608407L;
38  
39  	protected LLRPExceptionHandlerTypeMap exceptionType = LLRPExceptionHandlerTypeMap.EXCEPTION_UNKOWN;
40  	
41  	/**
42  	 * default constructor.
43  	 */
44  	public LLRPRuntimeException() {
45  		super();
46  	}
47  	
48  	/**
49  	 * constructor with exception message.
50  	 * @param message the exception message.
51  	 */
52  	public LLRPRuntimeException(String message) {
53  		super(message);
54  	}
55  	
56  	/**
57  	 * constructor with exception message and exception type.
58  	 * @param message the exception message.
59  	 * @param exceptionType the exception type.
60  	 */
61  	public LLRPRuntimeException(String message, LLRPExceptionHandlerTypeMap exceptionType) {
62  		super(message);
63  		this.exceptionType = exceptionType;
64  	}
65  	
66  	/**
67  	 * constructor from another exception.
68  	 * @param e the other exception.
69  	 */
70  	public LLRPRuntimeException(Exception e) {
71  		super(e);
72  	}
73  	
74  	/**
75  	 * sets the exception type.
76  	 * @param exceptionType the exception type.
77  	 */
78  	public void setExceptionType(LLRPExceptionHandlerTypeMap exceptionType) {
79  		this.exceptionType = exceptionType;
80  	}
81  	
82  	/**
83  	 * gets the exception type.
84  	 * @return the exception type.
85  	 */
86  	public LLRPExceptionHandlerTypeMap getExceptionType() {
87  		return exceptionType;
88  	}
89  }