001    /**
002     * <copyright>
003     *
004     * Copyright (c) 2004-2006 IBM Corporation and others.
005     * All rights reserved.   This program and the accompanying materials
006     * are made available under the terms of the Eclipse Public License v1.0
007     * which accompanies this distribution, and is available at
008     * http://www.eclipse.org/legal/epl-v10.html
009     *
010     * Contributors:
011     *   IBM - Initial API and implementation
012     *
013     * </copyright>
014     *
015     * $Id: Diagnostic.java,v 1.5 2006/12/05 20:19:56 emerks Exp $
016     */
017    package org.eclipse.emf.common.util;
018    
019    
020    import java.util.List;
021    
022    
023    /**
024     *  Information about the outcome of some activity.
025     */
026    public interface Diagnostic
027    {
028      /**
029       * The bit mask value <code>0x0</code> for a {@link #getSeverity severity} indicating everything is okay.
030       */
031      int OK = 0x0;
032    
033      /**
034       * The bit mask value <code>0x1</code> for a {@link #getSeverity severity} indicating there is an informational message.
035       */
036      int INFO = 0x1;
037    
038      /**
039       * The bit mask value <code>0x2</code> for a {@link #getSeverity severity} indicating there is warning message.
040       */
041      int WARNING = 0x2;
042    
043      /**
044       * The bit mask value <code>0x1</code> for a {@link #getSeverity severity} indicating there is an error message.
045       */
046      int ERROR = 0x4;
047    
048      /**
049       * The bit mask value <code>0x1</code> for a {@link #getSeverity severity} indicating that the diagnosis was canceled.
050       */
051      int CANCEL = 0x8;
052    
053      /**
054       * Returns an indicator of the severity of the problem.
055       */
056      int getSeverity();
057    
058      /**
059       * Returns a message describing the situation.
060       */
061      String getMessage();
062    
063      /**
064       * Returns the unique identifier of the source.
065       */
066      String getSource();
067    
068      /**
069       * Returns {@link #getSource source-specific} identity code.
070       */
071      int getCode();
072      
073      /**
074       * Returns the relevant low-level exception, or <code>null</code> if none. 
075       */  
076      Throwable getException();  
077    
078      /**
079       * Returns the arbitrary associated list of data.
080       * The first element is typically the object that is the primary source of the problem;
081       * the second element is typically some object describing the problematic feature or aspect of the primary source,
082       * and the remaining elements are additional objects associated with or describing the problem.
083       */
084      List<?> getData();
085    
086      /**
087       * Returns the list of child {@link Diagnostic diagnostics}.
088       */
089      List<Diagnostic> getChildren();
090    
091      /**
092       * A diagnostic indicating that everything is okay.
093       */
094      Diagnostic OK_INSTANCE = 
095        new BasicDiagnostic
096          (OK, "org.eclipse.emf.common", 0, org.eclipse.emf.common.CommonPlugin.INSTANCE.getString("_UI_OK_diagnostic_0"), null);
097    
098      /**
099       * A diagnostic indicating that the diagnosis was canceled.
100       */
101      Diagnostic CANCEL_INSTANCE = 
102        new BasicDiagnostic
103          (CANCEL, "org.eclipse.emf.common", 0, org.eclipse.emf.common.CommonPlugin.INSTANCE.getString("_UI_Cancel_diagnostic_0"), null);
104    }