package com.splicemachine.derby.impl.db;

import java.util.Properties;
import org.apache.derby.iapi.error.StandardException;
import org.apache.derby.iapi.services.context.ContextManager;
import org.apache.derby.iapi.services.monitor.Monitor;
import org.apache.derby.iapi.services.property.PropertyFactory;
import org.apache.derby.iapi.sql.conn.LanguageConnectionContext;
import org.apache.derby.iapi.sql.execute.ExecutionFactory;
import org.apache.derby.iapi.store.access.AccessFactory;
import org.apache.derby.iapi.store.access.TransactionController;
import org.apache.derby.impl.db.BasicDatabase;
import org.apache.derby.shared.common.sanity.SanityManager;
import org.apache.log4j.Logger;
import com.splicemachine.derby.error.SpliceStandardLogUtils;
import com.splicemachine.derby.impl.store.access.SpliceAccessManager;
import com.splicemachine.utils.SpliceLogUtils;
import com.splicemachine.utils.ZkUtils;

public class SpliceDatabase extends BasicDatabase {
	private static Logger LOG = Logger.getLogger(SpliceDatabase.class);
	public void boot(boolean create, Properties startParams) throws StandardException {
		System.setProperty("derby.language.logQueryPlan", Boolean.toString(true));
        System.setProperty("derby.language.logStatementText", Boolean.toString(true));
        System.setProperty("derby.connection.requireAuthentication","false");
        /*
         * This value is set to ensure that result sets are not materialized into memory, because
         * they may be materialized over the wire and it won't work right. DO NOT CHANGE THIS SETTING.
         * See Bug #292 for more information.
         */
        System.setProperty("derby.language.maxMemoryPerTable",Integer.toString(-1));
	    SanityManager.DEBUG_SET("ByteCodeGenInstr");
	    SanityManager.DEBUG_SET("DumpClassFile");
      SanityManager.DEBUG_SET("DumpOptimizedTree");
		try {
			create = !ZkUtils.isSpliceLoaded();
		} catch (Exception e) {
			throw SpliceStandardLogUtils.logAndReturnStandardException(LOG, "isSpliceLoadedOnBoot failure", e);
		}
		
		if (create)
			SpliceLogUtils.info(LOG,"Creating the Splice Machine");
		else {  
			SpliceLogUtils.info(LOG,"Booting the Splice Machine");
		}
		super.boot(create, startParams);
        TransactionKeepAlive.start();
	}
		@Override
		protected void bootValidation(boolean create, Properties startParams) throws StandardException {
			SpliceLogUtils.trace(LOG,"bootValidation create %s, startParams %s",create,startParams);
			pf = (PropertyFactory) Monitor.bootServiceModule(create, this,org.apache.derby.iapi.reference.Module.PropertyFactory, startParams);
		}

		protected void bootStore(boolean create, Properties startParams) throws StandardException {
			SpliceLogUtils.trace(LOG,"bootStore create %s, startParams %s",create,startParams);
			af = (AccessFactory) Monitor.bootServiceModule(create, this, AccessFactory.MODULE, startParams);
		}
		
		public LanguageConnectionContext generateLanguageConnectionContext(String transactionID, ContextManager cm, String user, String drdaID, String dbname) throws StandardException {
			TransactionController tc = ((SpliceAccessManager) af).marshallTransaction(cm, transactionID);
			cm.setLocaleFinder(this);
			pushDbContext(cm);
			LanguageConnectionContext lctx = lcf.newLanguageConnectionContext(cm, tc, lf, this, user, drdaID, dbname);
			pushClassFactoryContext(cm, lcf.getClassFactory());
			ExecutionFactory ef = lcf.getExecutionFactory();
			ef.newExecutionContext(cm);
			lctx.initialize();		
			return lctx;
		}
		
		
}

@@ -1111,16 +1111,18 @@
 ion %7B%0A%09%09
+//
 System.s
@@ -1188,32 +1188,34 @@
 true));%0A        
+//
 System.setProper
@@ -1707,32 +1707,34 @@
 ring(-1));%0A%09    
+//
 SanityManager.DE
@@ -1763,24 +1763,26 @@
 str%22);%0A%09    
+//
 SanityManage
@@ -1817,16 +1817,20 @@
 ;%0A      
+  //
 SanityMa

Remove output