public static void mapDatasource(Map map,List props){
  String value=(String)map.get("type");
  String jndiName="";
  LogWriterI18n writer=TransactionUtils.getLogWriterI18n();
  Object ds=null;
  try {
    jndiName=(String)map.get("jndi-name");
    if (value.equals("PooledDataSource")) {
      ds=DataSourceFactory.getPooledDataSource(map,props);
      ctx.rebind("java:/" + jndiName,ds);
      dataSourceList.add(ds);
      if (writer.fineEnabled())       writer.fine("Bound java:/" + jndiName + " to Context");
    }
 else     if (value.equals("XAPooledDataSource")) {
      ds=DataSourceFactory.getTranxDataSource(map,props);
      ctx.rebind("java:/" + jndiName,ds);
      dataSourceList.add(ds);
      if (writer.fineEnabled())       writer.fine("Bound java:/" + jndiName + " to Context");
    }
 else     if (value.equals("SimpleDataSource")) {
      ds=DataSourceFactory.getSimpleDataSource(map,props);
      ctx.rebind("java:/" + jndiName,ds);
      if (writer.fineEnabled())       writer.fine("Bound java:/" + jndiName + " to Context");
    }
 else     if (value.equals("ManagedDataSource")) {
      ClientConnectionFactoryWrapper ds1=DataSourceFactory.getManagedDataSource(map,props);
      ctx.rebind("java:/" + jndiName,ds1.getClientConnFactory());
      dataSourceList.add(ds1);
      if (writer.fineEnabled())       writer.fine("Bound java:/" + jndiName + " to Context");
    }
 else {
      String exception="JNDIInvoker::mapDataSource::No correct type of DataSource";
      if (writer.fineEnabled())       writer.fine(exception);
      throw new DataSourceCreateException(exception);
    }
    ds=null;
  }
 catch (  NamingException ne) {
    if (writer.infoEnabled())     writer.info(LocalizedStrings.JNDIInvoker_JNDIINVOKER_MAPDATASOURCE_0_WHILE_BINDING_1_TO_JNDI_CONTEXT,new Object[]{"NamingException",jndiName});
  }
catch (  DataSourceCreateException dsce) {
    if (writer.infoEnabled())     writer.info(LocalizedStrings.JNDIInvoker_JNDIINVOKER_MAPDATASOURCE_0_WHILE_BINDING_1_TO_JNDI_CONTEXT,new Object[]{"DataSourceCreateException",jndiName});
  }
}

public static void mapDatasource ( Map map , List props ) { String value = ( String ) map . get ( "type" ) ; String jndiName = "" ; LogWriterI18n writer = TransactionUtils . getLogWriterI18n ( ) ; Object ds = null ; try { jndiName = ( String ) map . get ( "jndi-name" ) ; if ( value . equals ( "PooledDataSource" ) ) { ds = DataSourceFactory . getPooledDataSource ( map , props ) ; ctx . rebind ( "java:/" + jndiName , ds ) ; dataSourceList . add ( ds ) ; if ( writer . fineEnabled ( ) ) writer . fine ( "Bound java:/" + jndiName + " to Context" ) ; } else if ( value . equals ( "XAPooledDataSource" ) ) { ds = DataSourceFactory . getTranxDataSource ( map , props ) ; ctx . rebind ( "java:/" + jndiName , ds ) ; dataSourceList . add ( ds ) ; if ( writer . fineEnabled ( ) ) writer . fine ( "Bound java:/" + jndiName + " to Context" ) ; } else if ( value . equals ( "SimpleDataSource" ) ) { ds = DataSourceFactory . getSimpleDataSource ( map , props ) ; ctx . rebind ( "java:/" + jndiName , ds ) ; if ( writer . fineEnabled ( ) ) writer . fine ( "Bound java:/" + jndiName + " to Context" ) ; } else if ( value . equals ( "ManagedDataSource" ) ) { ClientConnectionFactoryWrapper ds1 = DataSourceFactory . getManagedDataSource ( map , props ) ; ctx . rebind ( "java:/" + jndiName , ds1 . getClientConnFactory ( ) ) ; dataSourceList . add ( ds1 ) ; if ( writer . fineEnabled ( ) ) writer . fine ( "Bound java:/" + jndiName + " to Context" ) ; } else { String exception = "JNDIInvoker::mapDataSource::No correct type of DataSource" ; if ( writer . fineEnabled ( ) ) writer . fine ( exception ) ; throw new DataSourceCreateException ( exception ) ; } ds = null ; } catch ( NamingException ne ) { if ( writer . infoEnabled ( ) ) writer . info ( LocalizedStrings . JNDIInvoker_JNDIINVOKER_MAPDATASOURCE_0_WHILE_BINDING_1_TO_JNDI_CONTEXT , new Object [ ] { "NamingException" , jndiName } ) ; } catch ( DataSourceCreateException dsce ) { if ( writer . infoEnabled ( ) ) writer . info ( LocalizedStrings . JNDIInvoker_JNDIINVOKER_MAPDATASOURCE_0_WHILE_BINDING_1_TO_JNDI_CONTEXT , new Object [ ] { "DataSourceCreateException" , jndiName } ) ; } }
binds a single datasource to the existing jndi tree . the jndi tree may be the datasource properties are contained in the map . the datasource implementation class is populated based on properties in the map .
