org.nuiton.eugene.writer.ChainedFileWriter Maven / Gradle / Ivy
/*
* #%L
* EUGene :: EUGene
*
* $Id: ChainedFileWriter.java 906 2010-05-16 12:19:55Z tchemit $
* $HeadURL: http://svn.nuiton.org/svn/eugene/tags/eugene-2.1.1/eugene/src/main/java/org/nuiton/eugene/writer/ChainedFileWriter.java $
* %%
* Copyright (C) 2004 - 2010 CodeLutin
* %%
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Lesser Public License for more details.
*
* You should have received a copy of the GNU General Lesser Public
* License along with this program. If not, see
* .
* #L%
*/
package org.nuiton.eugene.writer;
import java.io.File;
import java.io.IOException;
import java.util.List;
import java.util.Map;
/**
* Contract to generate files from any incoming sources (zargo, xmi, ...) to any
* other ones.
*
* User: chemit Date: 27 nov. 2009 Time: 11:20:39
*
* @since 2.0.0
*/
public interface ChainedFileWriter {
/** @return the accepted incoming protocol */
String getInputProtocol();
/**
* Obtain the input protocol of this writer given the passed {@code
* modelType}.
*
* @param modelType the type of model used
* @return the input protocol or {@code null} if this writer does not accept
* the type of model
*/
String getInputProtocol(String modelType);
/**
* Obtain the output protocol of this writer given the passed {@code
* modelType}.
*
* @param modelType the type of model used
* @return the output protocol or {@code null} if should not be chained
*/
String getOutputProtocol(String modelType);
/**
* Test if a type of model can be treated by this writer.
*
* @param modelType model type to test
* @return {@code true} if this writer accept the given type of model,
* {@code false} otherwise.
*/
boolean acceptModel(String modelType);
/**
* Test in a entry can be treated by this writer.
*
* @param include the include to test
* @return {@code true} if the writer accept the entry, {@code false}
* otherwise.
*/
boolean acceptInclude(String include);
/**
* @return the default includes files to be treated by the writer (can be an
* ant-like expression)
*/
String getDefaultIncludes();
/** @return the defalt relative path where to pick files to treate. */
String getDefaultInputDirectory();
/**
* @return the defalt relative path where to pick files to treate on a test
* phase.
*/
String getDefaultTestInputDirectory();
/** @return the default relative path to add to output basedir */
String getDefaultOutputDirectory();
/**
* @return the default relative path to add to output basedir on a test
* phase.
*/
String getDefaultTestOutputDirectory();
/**
* Obtain the real directory where to write files.
*
* //FIXME-TC20091126 make this configurable (via the properties)
*
* @param outputBasedir the output base directory
* @param testPhase {@code true} if writer is used in a test phase
* @return the real output directory where to generate for this particular
* writer
*/
File getOutputDirectory(File outputBasedir, boolean testPhase);
/**
* Generates.
*
* @param configuration the share configuration of all writers.
* @throws IOException if any io pb.
*/
void generate(ChainedFileWriterConfiguration configuration)
throws IOException;
/** Clear all internal states */
void clear();
/**
* Add an entry to treate.
*
* @param entry the entry to add to writer
*/
void addEntry(ChainedFileWriterEntry entry);
/**
* @return the array of properties names authorized for the chained
* writer.
*/
String[] getAuthorizedPropertyNames();
/**
* @return the dictionnary of authorized property descriptions (keys are
* property names and values are descriptions).
*/
Map getAuthorizedPropertyDescriptions();
/**
* Obtain a writer extra property.
*
* @param key the key of required property
* @param type the type of property
* @param the type of property
* @return the property found or {@code null} if not found.
*/
T getProperty(String key, Class type);
/** @return the list of all entries registered */
List getEntries();
/** @return the writer report (to save generated file to later report) */
WriterReport getWriterReport();
void setWriterReport(WriterReport writerReport);
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy