// Path: flyJenkins/src/main/java/org/flyJenkins/component/persistent/hsql/HSQLDriver.java
// public class HSQLDriver implements PersistentDriver {
// 	
// 	Connection conn = null; 
// 	Statement st = null;
// 	
// 	@Override
// 	public void initDevice() {
// 		try {
// 			Class.forName("org.hsqldb.jdbcDriver");
// 		} catch (ClassNotFoundException e) {
// 			e.printStackTrace();
// 		}
// 		try {
// 			conn = DriverManager.getConnection("jdbc:hsqldb:file:testdb", "sa", "");
// 			st = conn.createStatement();    // statements
// 		} catch (SQLException e) {
// 			e.printStackTrace();
// 		}
// 	}
// 	
// 	public void initSchema() {
// 		int i;
// 		try {
// 			i = st.executeUpdate("CREATE TABLE productions ( id INTEGER GENERATED BY DEFAULT AS IDENTITY (START WITH 1, INCREMENT BY 1) NOT NULL, job_id INTEGER, job_name VARCHAR(255), build INTEGER, output VARCHAR(255), create_at TIMESTAMP DEFAULT now() )");
// 			if (i == -1) {
// 		            System.out.println("db error : can't  create table productions " );
// 			 }
// 			
// 			i = st.executeUpdate("CREATE TABLE serviceGroups ( id INTEGER GENERATED BY DEFAULT AS IDENTITY (START WITH 1, INCREMENT BY 1) NOT NULL, group_name VARCHAR(255), create_at TIMESTAMP DEFAULT now() )");
// 			if (i == -1) {
// 		            System.out.println("db error : can't  create table serviceGroups " );
// 			 }
// 			
// 			i = st.executeUpdate("CREATE TABLE serviceMetas ( id INTEGER GENERATED BY DEFAULT AS IDENTITY (START WITH 1, INCREMENT BY 1) NOT NULL, group_id INTEGER, host VARCHAR(255), destination VARCHAR(255), service_type INTEGER, command VARCHAR(255), weight INTEGER, service_name VARCHAR(255), test_url VARCHAR(255),  create_at TIMESTAMP DEFAULT now() )");
// 			if (i == -1) {
// 		            System.out.println("db error : can't  create table serviceMetas " );
// 			 }
// 			
// 		} catch (SQLException e) {
// 			e.printStackTrace();
// 		}         
// 		
// 	}
// 
// 	public Connection getConn() {
// 		return conn;
// 	}
// 
// 	public Statement getStatement() {
// 		try {
// 			return conn.createStatement();
// 		} catch (SQLException e) {
// 			e.printStackTrace();
// 		}
// 		return null;
// 	}
// 
// }


import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.flyJenkins.component.persistent.hsql.HSQLDriver;
		if(instance == null)
			instance = new PersistentTemplate(driverClassName);
		instance.setDriverClassName(driverClassName);
		instance.getPersistentDriver();		
		return instance;
	}
	
	public String getDriverClassName() {
		return driverClassName;
	}

	public void setDriverClassName(String driverClassName) {
		this.driverClassName = driverClassName;
	}
	

	/***
	 * obtain persistent driver instance by class name
	 * @return PersistentDriver or null
	 */
	public PersistentDriver getPersistentDriver(){		
		if(driverClassName == null || driverClassName.length() == 0)
			return null;
		
		if(pDriver == null){
			try {
				pDriver =(HSQLDriver) Class.forName(driverClassName).newInstance();
				pDriver.initDevice();
				Package packageVal  = Class.forName(driverClassName).getPackage();
				settingQueryMap(packageVal);
// Path: flyJenkins/src/main/java/org/flyJenkins/component/persistent/hsql/HSQLDriver.java
// public class HSQLDriver implements PersistentDriver {
// 	
// 	Connection conn = null; 
// 	Statement st = null;
// 	
// 	@Override
// 	public void initDevice() {
// 		try {
// 			Class.forName("org.hsqldb.jdbcDriver");
// 		} catch (ClassNotFoundException e) {
// 			e.printStackTrace();
// 		}
// 		try {
// 			conn = DriverManager.getConnection("jdbc:hsqldb:file:testdb", "sa", "");
// 			st = conn.createStatement();    // statements
// 		} catch (SQLException e) {
// 			e.printStackTrace();
// 		}
// 	}
// 	
// 	public void initSchema() {
// 		int i;
// 		try {
// 			i = st.executeUpdate("CREATE TABLE productions ( id INTEGER GENERATED BY DEFAULT AS IDENTITY (START WITH 1, INCREMENT BY 1) NOT NULL, job_id INTEGER, job_name VARCHAR(255), build INTEGER, output VARCHAR(255), create_at TIMESTAMP DEFAULT now() )");
// 			if (i == -1) {
// 		            System.out.println("db error : can't  create table productions " );
// 			 }
// 			
// 			i = st.executeUpdate("CREATE TABLE serviceGroups ( id INTEGER GENERATED BY DEFAULT AS IDENTITY (START WITH 1, INCREMENT BY 1) NOT NULL, group_name VARCHAR(255), create_at TIMESTAMP DEFAULT now() )");
// 			if (i == -1) {
// 		            System.out.println("db error : can't  create table serviceGroups " );
// 			 }
// 			
// 			i = st.executeUpdate("CREATE TABLE serviceMetas ( id INTEGER GENERATED BY DEFAULT AS IDENTITY (START WITH 1, INCREMENT BY 1) NOT NULL, group_id INTEGER, host VARCHAR(255), destination VARCHAR(255), service_type INTEGER, command VARCHAR(255), weight INTEGER, service_name VARCHAR(255), test_url VARCHAR(255),  create_at TIMESTAMP DEFAULT now() )");
// 			if (i == -1) {
// 		            System.out.println("db error : can't  create table serviceMetas " );
// 			 }
// 			
// 		} catch (SQLException e) {
// 			e.printStackTrace();
// 		}         
// 		
// 	}
// 
// 	public Connection getConn() {
// 		return conn;
// 	}
// 
// 	public Statement getStatement() {
// 		try {
// 			return conn.createStatement();
// 		} catch (SQLException e) {
// 			e.printStackTrace();
// 		}
// 		return null;
// 	}
// 
// }


// Path: flyJenkins/src/main/java/org/flyJenkins/component/persistent/PersistentTemplate.java
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.flyJenkins.component.persistent.hsql.HSQLDriver;

		if(instance == null)
			instance = new PersistentTemplate(driverClassName);
		instance.setDriverClassName(driverClassName);
		instance.getPersistentDriver();		
		return instance;
	}
	
	public String getDriverClassName() {
		return driverClassName;
	}

	public void setDriverClassName(String driverClassName) {
		this.driverClassName = driverClassName;
	}
	

	/***
	 * obtain persistent driver instance by class name
	 * @return PersistentDriver or null
	 */
	public PersistentDriver getPersistentDriver(){		
		if(driverClassName == null || driverClassName.length() == 0)
			return null;
		
		if(pDriver == null){
			try {
				pDriver =(HSQLDriver) Class.forName(driverClassName).newInstance();
				pDriver.initDevice();
				Package packageVal  = Class.forName(driverClassName).getPackage();
				settingQueryMap(packageVal);
			} catch (InstantiationException e) {