htiextension/com.nokia.s60tools.hticonnection/src/com/nokia/s60tools/hticonnection/exceptions/HTIException.java
changeset 0 61163b28edca
equal deleted inserted replaced
-1:000000000000 0:61163b28edca
       
     1 /*
       
     2 * Copyright (c) 2009 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 */
       
    17 
       
    18 package com.nokia.s60tools.hticonnection.exceptions;
       
    19 
       
    20 /**
       
    21  * Thrown when there are problems with HTI agent.
       
    22  */
       
    23 public class HTIException extends Exception{
       
    24 
       
    25 	/**
       
    26 	 * Serial version ID.
       
    27 	 */
       
    28 	private static final long serialVersionUID = 1L;
       
    29 	/**
       
    30 	 * More details about error.
       
    31 	 */
       
    32 	private HTIErrorDetails errorDetails = null;
       
    33 	/**
       
    34 	 * Boolean about is HTI initialized successfully. False means problems with HTI.
       
    35 	 */
       
    36 	private boolean isHtiInitialized = true;
       
    37 	/**
       
    38 	 * Boolean about was HTI request canceled. True if request was canceled. False otherwise.
       
    39 	 */
       
    40 	private boolean isHtiRequestCanceled = false;
       
    41 	
       
    42 	/**
       
    43 	 * Constructor.
       
    44 	 * @param message Informative message about the error causing the exception.
       
    45 	 * @param isHtiInitialized False if error arises because HTI is not initialized.
       
    46 	 * True otherwise.
       
    47 	 */
       
    48 	public HTIException(String message, boolean isHtiInitialized){
       
    49 		super(message);
       
    50 		this.isHtiInitialized = isHtiInitialized;
       
    51 	}
       
    52 	
       
    53 	/**
       
    54 	 * Constructor.
       
    55 	 * @param message Informative message about the error causing the exception.
       
    56 	 * @param isHtiInitialized False if error arises because HTI is not initialized.
       
    57 	 * True otherwise.
       
    58 	 * @param isHtiRequestCanceled True if request was canceled. false otherwise.
       
    59 	 */
       
    60 	public HTIException(String message, boolean isHtiInitialized, boolean isHtiRequestCanceled){
       
    61 		super(message);
       
    62 		this.isHtiInitialized = isHtiInitialized;
       
    63 		this.isHtiRequestCanceled = isHtiRequestCanceled;
       
    64 	}
       
    65 	
       
    66 	/**
       
    67 	 * Constructor.
       
    68 	 * @param message Informative message about the error causing the exception.
       
    69 	 * @param errorDetails Contains more details about error.
       
    70 	 */
       
    71 	public HTIException(String message, HTIErrorDetails errorDetails){
       
    72 		super(message);
       
    73 		this.errorDetails = errorDetails;
       
    74 	}
       
    75 	
       
    76 	/**
       
    77 	 * Gets if exception contains more detailed information about error.
       
    78 	 * @return True if exception contains more details about error.
       
    79 	 */
       
    80 	public boolean hasErrorDetails(){
       
    81 		return (errorDetails != null);
       
    82 	}
       
    83 	
       
    84 	/**
       
    85 	 * Gets more details about error.
       
    86 	 * @return More details about error.
       
    87 	 */
       
    88 	public HTIErrorDetails getErrorDetails(){
       
    89 		return errorDetails;
       
    90 	}
       
    91 	
       
    92 	/**
       
    93 	 * Gets if HTI has been initialized successfully. 
       
    94 	 * @return True if HTI has been initialized successfully. False if couldn't connect to HTI agent.
       
    95 	 */
       
    96 	public boolean isHtiInitialized(){
       
    97 		return isHtiInitialized;
       
    98 	}
       
    99 
       
   100 	/**
       
   101 	 * Gets if HTI request was canceled.
       
   102 	 * @return True if request was canceled. False otherwise.
       
   103 	 */
       
   104 	public boolean isHtiRequestCanceled() {
       
   105 		return isHtiRequestCanceled;
       
   106 	}
       
   107 	
       
   108 }