tracefw/tracecompiler/src/com.nokia.tracecompiler/src/com/nokia/tracecompiler/model/TraceCompilerException.java
changeset 56 aa2539c91954
parent 54 a151135b0cf9
child 60 e54443a6878c
child 62 1c2bb2fc7c87
equal deleted inserted replaced
54:a151135b0cf9 56:aa2539c91954
     1 /*
       
     2 * Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies). 
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:
       
    15 *
       
    16 * Exceptions thrown by TraceCompiler engine
       
    17 *
       
    18 */
       
    19 package com.nokia.tracecompiler.model;
       
    20 
       
    21 /**
       
    22  * Exceptions thrown by TraceCompiler engine
       
    23  * 
       
    24  */
       
    25 public class TraceCompilerException extends Exception {
       
    26 
       
    27 	/**
       
    28 	 * Error codes for TraceCompiler exceptions
       
    29 	 * 
       
    30 	 */
       
    31 	public interface TraceCompilerExceptionCode {
       
    32 	}
       
    33 
       
    34 	/**
       
    35 	 * UID
       
    36 	 */
       
    37 	private static final long serialVersionUID = -2991616409482985157L; // CodForChk_Dis_Magic
       
    38 
       
    39 	/**
       
    40 	 * Error code
       
    41 	 */
       
    42 	private TraceCompilerExceptionCode errorCode;
       
    43 
       
    44 	/**
       
    45 	 * Error parameters
       
    46 	 */
       
    47 	private TraceCompilerErrorParameters parameters;
       
    48 
       
    49 	/**
       
    50 	 * Source object
       
    51 	 */
       
    52 	private Object source;
       
    53 
       
    54 	/**
       
    55 	 * Flag that defines will event related to exception posted to trace event view
       
    56 	 */
       
    57 	private boolean postEvent = true;
       
    58 	
       
    59 	/**
       
    60 	 * Constructor with error code
       
    61 	 * 
       
    62 	 * @param errorCode
       
    63 	 *            the error code
       
    64 	 */
       
    65 	public TraceCompilerException(TraceCompilerExceptionCode errorCode) {
       
    66 		this.errorCode = errorCode;
       
    67 	}
       
    68 	
       
    69 	/**
       
    70 	 * Constructor with error code and postEvent flag
       
    71 	 * 
       
    72 	 * @param errorCode
       
    73 	 *            the error code
       
    74 	 * @param postEvent
       
    75 	 *            flag that defines will event related to exception posted to trace event view   
       
    76 	 */
       
    77 	public TraceCompilerException(TraceCompilerExceptionCode errorCode, boolean postEvent) {
       
    78 		this.errorCode = errorCode;
       
    79 		this.postEvent = postEvent;
       
    80 	}
       
    81 
       
    82 	/**
       
    83 	 * Constructor with error code and parameters
       
    84 	 * 
       
    85 	 * @param errorCode
       
    86 	 *            the error code
       
    87 	 * @param parameters
       
    88 	 *            the error parameters
       
    89 	 */
       
    90 	public TraceCompilerException(TraceCompilerExceptionCode errorCode,
       
    91 			TraceCompilerErrorParameters parameters) {
       
    92 		this.errorCode = errorCode;
       
    93 		this.parameters = parameters;
       
    94 	}
       
    95 
       
    96 	/**
       
    97 	 * Constructor with error code, parameters and source object
       
    98 	 * 
       
    99 	 * @param errorCode
       
   100 	 *            the error code
       
   101 	 * @param parameters
       
   102 	 *            the error parameters
       
   103 	 * @param source
       
   104 	 *            the source object
       
   105 	 */
       
   106 	public TraceCompilerException(TraceCompilerExceptionCode errorCode,
       
   107 			TraceCompilerErrorParameters parameters, Object source) {
       
   108 		this.errorCode = errorCode;
       
   109 		this.parameters = parameters;
       
   110 		this.source = source;
       
   111 	}
       
   112 	
       
   113 	/**
       
   114 	 * Constructor with error code and root cause
       
   115 	 * 
       
   116 	 * @param errorCode
       
   117 	 *            the error code
       
   118 	 * @param cause
       
   119 	 *            the reason for this exception
       
   120 	 */
       
   121 	public TraceCompilerException(TraceCompilerExceptionCode errorCode,
       
   122 			Throwable cause) {
       
   123 		super(cause);
       
   124 		this.errorCode = errorCode;
       
   125 	}
       
   126 
       
   127 	/**
       
   128 	 * Gets the error code
       
   129 	 * 
       
   130 	 * @return error code
       
   131 	 */
       
   132 	public TraceCompilerExceptionCode getErrorCode() {
       
   133 		return errorCode;
       
   134 	}
       
   135 
       
   136 	/**
       
   137 	 * Gets the parameters related to the error
       
   138 	 * 
       
   139 	 * @return the parameters
       
   140 	 */
       
   141 	public TraceCompilerErrorParameters getErrorParameters() {
       
   142 		return parameters;
       
   143 	}
       
   144 
       
   145 	/**
       
   146 	 * Gets the source of this error
       
   147 	 * 
       
   148 	 * @return the source
       
   149 	 */
       
   150 	public Object getErrorSource() {
       
   151 		return source;
       
   152 	}
       
   153 
       
   154 	/**
       
   155 	 * Is event related to exception wanted to post to trace event view
       
   156 	 * 
       
   157 	 * @return true is event is wanted to post trace event view
       
   158 	 *         false is event is not wanted to post trace event view
       
   159 	 */
       
   160 	public boolean isEventWantedToPost() {
       
   161 		return postEvent;
       
   162 	}
       
   163 	
       
   164 }