package org.reldb.rel;

import java.io.IOException;
import java.io.InputStream;

import org.reldb.rel.exceptions.DatabaseFormatVersionException;

/** Convenient access point for running an embedded or stand-alone interpreter. */

public class Rel {

	private org.reldb.rel.v0.engine.Rel rel;
	
	private static void buildClasspath() throws IOException {
		ClassPathHack.addFile("relshared.jar");
		ClassPathHack.addFile("rel0000.jar");		
	}
	
	/** Convenient runner for a stand-alone Rel interpreter. 
	 * @throws IOException */
	public static void main(String[] args) throws IOException {
		buildClasspath();
		org.reldb.rel.v0.engine.Rel.main(args);
	}
	
	/** Establish a connection with this server. */
	public Rel(String databaseDir, boolean createDbAllowed, String[] additionalJars) throws IOException, DatabaseFormatVersionException {
		buildClasspath();
		rel = new org.reldb.rel.v0.engine.Rel(databaseDir, createDbAllowed, additionalJars);
	}
	
	public InputStream getServerResponseInputStream() throws IOException {
		return rel.getServerResponseInputStream();
	}
	
	public void sendEvaluate(String source) throws IOException {
		rel.sendEvaluate(source);
	}
	
	public void sendExecute(String source) throws IOException {
		rel.sendExecute(source);
	}

	public void reset() {
		rel.reset();
	}
	
}

@@ -76,16 +76,45 @@
 Stream;%0D
+%0Aimport java.io.PrintStream;%0D
 %0A%0D%0Aimpor
@@ -699,24 +699,520 @@
 s);%0D%0A%09%7D%0D%0A%09%0D%0A
+%09/** Convert this database to the latest format, if necessary.  Throw exception if not necessary.  Normally only needed if invoking%0D%0A%09 * the constructor throws DatabaseFormatVersionException. */%0D%0A%09public static void convertToLatestFormat(String databaseDir, PrintStream conversionOutput, String%5B%5D additionalJars) throws DatabaseFormatVersionException, IOException %7B%0D%0A%09%09buildClasspath();%0D%0A%09%09org.reldb.rel.v0.engine.Rel.convertToLatestFormat(databaseDir, conversionOutput, additionalJars);%0D%0A%09%7D%0D%0A%09%0D%0A
 %09/** Establi

Add convertToLastestFormat()