Coverage Report - nextgrid.api.builder.POMBuilder
 
Classes in this File Line Coverage Branch Coverage Complexity
POMBuilder
N/A
N/A
0
 
 1  
 /*
 2  
  Copyright (C) 2007 Grid Systems, S.A. and University of Southampton IT Innovation Centre
 3  
 
 4  
  This library is free software; you can redistribute it and/or
 5  
  modify it under the terms of the GNU Lesser General Public
 6  
  License as published by the Free Software Foundation; either
 7  
  version 2.1 of the License, or (at your option) any later version.
 8  
 
 9  
  This library is distributed in the hope that it will be useful,
 10  
  but WITHOUT ANY WARRANTY; without even the implied warranty of
 11  
  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 12  
  Lesser General Public License for more details.
 13  
 
 14  
  You should have received a copy of the GNU Lesser General Public
 15  
  License along with this library; if not, write to the Free Software
 16  
  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301 USA
 17  
 */
 18  
 package nextgrid.api.builder;
 19  
 
 20  
 import java.io.File;
 21  
 import java.io.IOException;
 22  
 import java.io.InputStream;
 23  
 import java.net.URI;
 24  
 import java.net.URL;
 25  
 import java.util.Collection;
 26  
 
 27  
 import nextgrid.api.pom.Process;
 28  
 
 29  
 /**
 30  
  * ProcessBuilder type.
 31  
  *
 32  
  * @author Rodrigo Ruiz
 33  
  * @param <T> The type used in the implementation methods
 34  
  */
 35  
 public interface POMBuilder<T extends Object> {
 36  
 
 37  
   /**
 38  
    * Gets the class of the supported model.
 39  
    * <p>
 40  
    * This method is used by the discovery mechanism to map model types to
 41  
    * builder implementations.
 42  
    *
 43  
    * @return A model class
 44  
    */
 45  
   Class<T> getModelType();
 46  
 
 47  
   /**
 48  
    * Gets an URI that allows builder lookup by "id".
 49  
    *
 50  
    * @return An URI for this builder type
 51  
    */
 52  
   URI getURI();
 53  
 
 54  
   /**
 55  
    * Converts a POM instance into another model type.
 56  
    * <p>
 57  
    * The model type is implementation dependent.
 58  
    *
 59  
    * @param process  The source POM instance
 60  
    * @return         The resulting model
 61  
    * @throws BuildException If an error occurs
 62  
    */
 63  
   T fromPOM(Process process) throws BuildException;
 64  
 
 65  
   /**
 66  
    * Converts a model into a POM instance.
 67  
    * <p>
 68  
    * The model type is implementation dependent.
 69  
    *
 70  
    * @param model The source model
 71  
    * @return      The resulting POM instance
 72  
    * @throws BuildException If an error occurs
 73  
    */
 74  
   Process toPOM(T model) throws BuildException;
 75  
 
 76  
   /**
 77  
    * Imports a POM from the given source.
 78  
    *
 79  
    * @param src The source to import
 80  
    * @return The POM workflow root process
 81  
    * @throws IOException If an error occurs while reading the file
 82  
    * @throws BuildException If an error occurs while translating the model
 83  
    */
 84  
   Process importFrom(File src) throws IOException, BuildException;
 85  
 
 86  
   /**
 87  
    * Imports a POM from the given source.
 88  
    *
 89  
    * @param src The source to import
 90  
    * @return The POM workflow root process
 91  
    * @throws IOException If an error occurs while reading the file
 92  
    * @throws BuildException If an error occurs while translating the model
 93  
    */
 94  
   Process importFrom(URL src) throws IOException, BuildException;
 95  
 
 96  
   /**
 97  
    * Imports a POM from the given source.
 98  
    *
 99  
    * @param src The source to import
 100  
    * @return The POM workflow root process
 101  
    * @throws IOException If an error occurs while reading the file
 102  
    * @throws BuildException If an error occurs while translating the model
 103  
    */
 104  
   Process importFrom(URI src) throws IOException, BuildException;
 105  
 
 106  
   /**
 107  
    * Imports a POM from an input stream.
 108  
    *
 109  
    * @param is A stream to read from
 110  
    * @return The POM workflow root process
 111  
    * @throws IOException If an error occurs while reading the file
 112  
    * @throws BuildException If an error occurs while translating the model
 113  
    */
 114  
   Process importFrom(InputStream is) throws IOException, BuildException;
 115  
 
 116  
   /**
 117  
    * Imports all processes contained in the given source.
 118  
    *
 119  
    * @param uri The source to import
 120  
    * @return A collection of POM workflow roots
 121  
    * @throws IOException If an I/O error occurs while reading the source
 122  
    * @throws BuildException If an error occurs while translating the models
 123  
    */
 124  
   Collection<Process> importAllFrom(URI uri) throws IOException, BuildException;
 125  
 
 126  
   /**
 127  
    * Imports all processes contained in the given source.
 128  
    *
 129  
    * @param is The source to import
 130  
    * @return A collection of POM workflow roots
 131  
    * @throws IOException If an I/O error occurs while reading the source
 132  
    * @throws BuildException If an error occurs while translating the models
 133  
    */
 134  
   Collection<Process> importAllFrom(InputStream is) throws IOException, BuildException;
 135  
 }