All Downloads are FREE. Search and download functionalities are using the official Maven repository.

ch.software_atelier.simpleflex.interfaces.file.FileInterfaceWriter Maven / Gradle / Ivy

There is a newer version: 2.2.2
Show newest version
/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package ch.software_atelier.simpleflex.interfaces.file;
import java.io.*;
import java.util.ArrayList;

public class FileInterfaceWriter {
    private final File _dst;
    private final ArrayList _commands = new ArrayList();
    private final long _timeout = 2000;
    private int _reason = 0;
    
    
    private final String _newline="\n";
    
    private static final String _STARTTAG="";
    private static final String _ENDTAG="";
    private static final String _KEY_CLASSPATH = "CLASSPATH";
    
    /**
     * returned by reason() if the timeout between writing and reading by the Server-Interface is expired.
     */
    public static int ERRORCODE_TIMEOUT_EXPIERD = 1;
    
    /**
     * returned by reason() if the file was already existing on calling execute().
     */
    public static int ERRORCODE_FILE_ALREADY_EXISTS = 2;
    
    /**
     * returned by reason() if 
     */
    public static int ERRORCODE_IOEXCEPTION = 3;
    
    /**
     * returned by reason() if everything was OK
     */
    public static int ERRORCODE_EVERYTHING_OK = 0;
    
    /**
     * Creates a New Instance of FileInterfaceWriter. 
* This class is used to simplify the write-process of
* standard interface commands. * * @param dst Where to white the File. It's the same Path as * specified in the main-config of simpleflex. */ public FileInterfaceWriter(File dst){ _dst = dst; } /** * Adds a Command that is needed to execute over FileInterface. * @param classPath The classpath to the needed fileinterface * @param args The arguments that */ public void addCommand(String classPath, String[][] args){ StringBuilder sb = new StringBuilder(); sb.append(_STARTTAG); sb.append(_newline); sb.append(_KEY_CLASSPATH); sb.append("="); sb.append(classPath); sb.append(_newline); if (args.length>0){ for (int i=0;i-->


© 2015 - 2024 Weber Informatics LLC | Privacy Policy