Coverage Report - org.argouml.moduleloader.ModuleInterface
 
Classes in this File Line Coverage Branch Coverage Complexity
ModuleInterface
N/A
N/A
1
 
 1  
 /* $Id: ModuleInterface.java 17824 2010-01-12 18:48:34Z 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  
  *    linus
 11  
  *****************************************************************************
 12  
  *
 13  
  * Some portions of this file was previously release using the BSD License:
 14  
  */
 15  
 
 16  
 // Copyright (c) 2004-2006 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.moduleloader;
 40  
 
 41  
 /**
 42  
  * This is the interface that each module needs to implement in order to be
 43  
  * loadable into ArgoUML according to the new module loader API.
 44  
  *
 45  
  * @author Linus Tolke
 46  
  * @since 0.17.1
 47  
  */
 48  
 public interface ModuleInterface {
 49  
     /**
 50  
      * Method to enable the module.<p>
 51  
      *
 52  
      * If it cannot enable the module because some other module is
 53  
      * not enabled it can return <code>false</code>.
 54  
      * In that case the module loader will defer this attempt until
 55  
      * all other modules are loaded (or until some more of ArgoUML is loaded
 56  
      * if at startup). Eventually it is only this and some other modules
 57  
      * that is not loaded and they will then be listed as having problems.
 58  
      *
 59  
      * @return true if all went well
 60  
      */
 61  
     boolean enable();
 62  
 
 63  
     /**
 64  
      * Method to disable the module.<p>
 65  
      *
 66  
      * If we cannot disable the module because some other module relies
 67  
      * on it, we return false. This will then make it impossible to turn off.
 68  
      * (An error is signalled at the attempt).
 69  
      *
 70  
      * @return true if all went well.
 71  
      */
 72  
     boolean disable();
 73  
 
 74  
     /**
 75  
      * The name of the module.<p>
 76  
      *
 77  
      * This should be a short string. For the purpose of having the GUI
 78  
      * that turns on and off the module look nice there is no whitespace in
 79  
      * this string (no spaces, tabs or newlines).<p>
 80  
      *
 81  
      * This name is also used as the key internally when modules checks for
 82  
      * other modules, if they are available.
 83  
      *
 84  
      * @return the name (A String).
 85  
      */
 86  
     String getName();
 87  
 
 88  
     /**
 89  
      * The info about the module.<p>
 90  
      *
 91  
      * This returns texts with information about the module.<p>
 92  
      *
 93  
      * The possible informations are retrieved by giving any of the
 94  
      * arguments:<ul>
 95  
      * <li>{@link #DESCRIPTION}
 96  
      * <li>{@link #AUTHOR}
 97  
      * <li>{@link #VERSION}
 98  
      * <li>{@link #DOWNLOADSITE}
 99  
      * </ul>
 100  
      *
 101  
      * If a module does not provide a specific piece of information,
 102  
      * <code>null</code> can be returned. Hence the normal implementation
 103  
      * should be:<pre>
 104  
      * public String getInfo(int type) {
 105  
      *     switch (type) {
 106  
      *     case DESCRIPTION:
 107  
      *         return "This module does ...";
 108  
      *     case AUTHOR:
 109  
      *         return "Annie Coder";
 110  
      *     default:
 111  
      *         return null;
 112  
      * }
 113  
      * </pre>
 114  
      *
 115  
      * @param type The type of information.
 116  
      * @return The description. A String.
 117  
      */
 118  
     String getInfo(int type);
 119  
 
 120  
     /**
 121  
      * The description of the module.
 122  
      */
 123  
     int DESCRIPTION = 0;
 124  
 
 125  
     /**
 126  
      * The author of the module.
 127  
      */
 128  
     int AUTHOR = 1;
 129  
 
 130  
     /**
 131  
      * The version of the module.
 132  
      */
 133  
     int VERSION = 2;
 134  
 
 135  
     /**
 136  
      * The URL of the website stating information on where to download the
 137  
      * module.
 138  
      */
 139  
     int DOWNLOADSITE = 3;
 140  
 }