Coverage Report - org.argouml.uml.reveng.ImportInterface
 
Classes in this File Line Coverage Branch Coverage Complexity
ImportInterface
N/A
N/A
1
ImportInterface$ImportException
0%
0/6
N/A
1
 
 1  
 /* $Id: ImportInterface.java 17870 2010-01-12 20:49:32Z linus $
 2  
  *****************************************************************************
 3  
  * Copyright (c) 2009 Contributors - see below
 4  
  * All rights reserved. This program and the accompanying materials
 5  
  * are made available under the terms of the Eclipse Public License v1.0
 6  
  * which accompanies this distribution, and is available at
 7  
  * http://www.eclipse.org/legal/epl-v10.html
 8  
  *
 9  
  * Contributors:
 10  
  *    tfmorris
 11  
  *****************************************************************************
 12  
  *
 13  
  * Some portions of this file was previously release using the BSD License:
 14  
  */
 15  
 
 16  
 // Copyright (c) 2006-2008 The Regents of the University of California. All
 17  
 // Rights Reserved. Permission to use, copy, modify, and distribute this
 18  
 // software and its documentation without fee, and without a written
 19  
 // agreement is hereby granted, provided that the above copyright notice
 20  
 // and this paragraph appear in all copies. This software program and
 21  
 // documentation are copyrighted by The Regents of the University of
 22  
 // California. The software program and documentation are supplied "AS
 23  
 // IS", without any accompanying services from The Regents. The Regents
 24  
 // does not warrant that the operation of the program will be
 25  
 // uninterrupted or error-free. The end-user understands that the program
 26  
 // was developed for research purposes and is advised not to rely
 27  
 // exclusively on the program for any reason. IN NO EVENT SHALL THE
 28  
 // UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR DIRECT, INDIRECT,
 29  
 // SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, INCLUDING LOST PROFITS,
 30  
 // ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF
 31  
 // THE UNIVERSITY OF CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF
 32  
 // SUCH DAMAGE. THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY
 33  
 // WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
 34  
 // MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE
 35  
 // PROVIDED HEREUNDER IS ON AN "AS IS" BASIS, AND THE UNIVERSITY OF
 36  
 // CALIFORNIA HAS NO OBLIGATIONS TO PROVIDE MAINTENANCE, SUPPORT,
 37  
 // UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
 38  
 
 39  
 package org.argouml.uml.reveng;
 40  
 
 41  
 import java.io.File;
 42  
 import java.util.Collection;
 43  
 import java.util.List;
 44  
 
 45  
 import org.argouml.kernel.Project;
 46  
 import org.argouml.moduleloader.ModuleInterface;
 47  
 import org.argouml.taskmgmt.ProgressMonitor;
 48  
 import org.argouml.util.SuffixFilter;
 49  
 
 50  
 /**
 51  
  * An interface which identifies an ArgoUML plug-in which imports 
 52  
  * source language modules and creates UML model elements in our model.
 53  
  * <p>
 54  
  * This interface is GUI independent and must not have any dependency on
 55  
  * Swing/AWT or SWT.
 56  
  * 
 57  
  * @author Tom Morris
 58  
  * @since 0.23.2
 59  
  */
 60  
 
 61  
 public interface ImportInterface extends ModuleInterface {
 62  
 
 63  
     /**
 64  
      * The name of the TagDefinition which types the TaggedValues used store the
 65  
      * source path of a ModelElement. Used for round trip engineering purposes.
 66  
      * Set during reverse engineering and used during code generation.
 67  
      */
 68  
     public static final String SOURCE_PATH_TAG = "src_path";
 69  
 
 70  
     /**
 71  
      * The name of the TagDefinition which types the TaggedValues used store
 72  
      * information about a ModelElement which can't be stored in the model. Used
 73  
      * for round trip engineering purposes. Set during reverse engineering and
 74  
      * used during code generation.
 75  
      */
 76  
     public static final String SOURCE_MODIFIERS_TAG = "src_modifiers";
 77  
 
 78  
     /**
 79  
      * Provides an array of suffix filters for the module.
 80  
      * 
 81  
      * @return SuffixFilter[] suffixes for processing
 82  
      */
 83  
     SuffixFilter[] getSuffixFilters();
 84  
 
 85  
     /**
 86  
      * Tells if the object is parseable or not.  It's is up to the module
 87  
      * to decide whether it does something simple like verify that the file
 88  
      * has the correct extension, or something more complicated.
 89  
      * 
 90  
      * @param file
 91  
      *            object to be tested.
 92  
      * @return true if parseable, false if not.
 93  
      */
 94  
     boolean isParseable(File file);
 95  
 
 96  
     /**
 97  
      * Parse a collection of source files. The collection includes the full set
 98  
      * of files selected by the user.
 99  
      * <p>
 100  
      * If the import module needs multiple parsing passes to resolve identifiers
 101  
      * or for other reasons it needs to implement that internally. In previous
 102  
      * versions of ArgoUML the multipass behavior was implemented both in the
 103  
      * calling code and in some import modules. It is now solely the
 104  
      * responsibility of the module.
 105  
      * 
 106  
      * @param p
 107  
      *            the current project
 108  
      * @param files
 109  
      *            Collection of files to be parsed
 110  
      * @param settings
 111  
      *            Use this object to get common settings.
 112  
      * @param monitor
 113  
      *            ProgressMonitor which will be updated as files are parsed and
 114  
      *            checked for user requests to cancel. It is mandatory for the
 115  
      *            module to both update progress and check for cancel requests.
 116  
      * @return a collection of model elements parsed from the given files
 117  
      * @throws ImportException
 118  
      *             if an error occurs, this will contain the nested exception
 119  
      *             that was originally thrown
 120  
      */
 121  
     Collection parseFiles(Project p, final Collection<File> files,
 122  
             ImportSettings settings, ProgressMonitor monitor)
 123  
         throws ImportException;
 124  
 
 125  
     /**
 126  
      * Returns a list with objects that represent settings for this import.
 127  
      * These objects implement the SettingsTypes.* interfaces.
 128  
      * <p>
 129  
      * The caller must determine what interface an object is implementing
 130  
      * iterating the interfaces SettingsTypes.*
 131  
      * <p>
 132  
      * This is done this way to eliminate the need to use GUI elements. The
 133  
      * settings can easily be mapped into any GUI elements, this way we are
 134  
      * independent from the type of GUI.
 135  
      * 
 136  
      * @return the list of settings that are required by this particular import
 137  
      */
 138  
     List<SettingsTypes.Setting> getImportSettings();
 139  
     
 140  
     
 141  
     /**
 142  
      * Import subsystem exception to wrap any nested exceptions with when
 143  
      * thrown.
 144  
      */
 145  
     public class ImportException extends Exception {
 146  
 
 147  
         /**
 148  
          * Construct an ImportException with a wrapped Throwable.
 149  
          * 
 150  
          * @param message message indicating error that occurred
 151  
          * @param cause the wrapped Exception
 152  
          */
 153  
         public ImportException(String message, Throwable cause) {
 154  0
             super("Import Exception : " + message, cause);
 155  0
         }
 156  
         
 157  
         public ImportException(String message) {
 158  0
             super(message);
 159  0
         }
 160  
 
 161  
         public ImportException(Throwable cause) {
 162  0
             super("Import Exception", cause);
 163  0
         }
 164  
         
 165  
     }
 166  
 
 167  
 }