/*
 * Created on 2004-5-4
 *
 * To change the template for this generated file go to
 * Window - Preferences - Java - Code Generation - Code and Comments
 */
package workflow.test;

import workflow.WorkflowException;
import workflow.store.SchemaContext;
import workflow.store.spi.SpiUserDatabase;

import com.zosatapo.commons.store.Store;
import com.zosatapo.workflow.store.DatabaseRegistry;

/**
 * @author zosatapo
 *
 * To change the template for this generated type comment go to
 * Window - Preferences - Java - Code Generation - Code and Comments
 */
public class UserDBTest
{
	public static void main(String[] args)
	{
    try
    {
      SchemaContext schemaContext=new SchemaContext("D:\\project\\workflow\\conf\\workflow-schema.properties");
  	  Store storeConfig=new Store("DriverManager","dbc:oracle:thin:@zosatapo:1521:workflow","workflow","workflow","oracle.jdbc.driver.OracleDriver");
      //SpiUserDatabaseImpl userDatabase=new SpiUserDatabaseImpl(schemaContext,storeConfig);
      SpiUserDatabase userDatabase=DatabaseRegistry.getUserDatabase(storeConfig.getDriverClass()); 
      userDatabase.setSchemaContext(schemaContext);
      userDatabase.setStore(storeConfig);
      
      userDatabase.start();
      
      //System.err.println(userDatabase);
      
      System.err.println(userDatabase.findParticipant("zosatapo"));
    }
    catch(WorkflowException ex)
    {
      ex.printStackTrace();
      if(ex.getRootCause()!=null)
      {
        System.err.println("----------------------root cause------------------");
        ex.getRootCause().printStackTrace();
      }
    }
  }
}
