// get the class responsible for creating the datasource
String adapterClass = config.getProvider().getAdapter();
// create a new instance of the adapter
DataSourceAdapter adapter = null;
try {
adapter = (DataSourceAdapter)Class.forName(adapterClass).newInstance();
} catch (Exception e) {
//throw new SQLConfigurationException("Invalid DataSourceAdapter class specified. Should be impossible error?");
throw new SQLMissingDependencyException("DataSourceAdapter '" + adapterClass + "' failed to load. Perhaps missing jar file?", e);
}
// delegate creating the new datasource to the adapter
ManagedDataSource mds = adapter.create(config);
// if the user requested this datasource to be added to jmx
if (config.getJmx()) {
// hmm... if jmx is turned on, let's register the MBean
MBeanServer mbs = ManagementFactory.getPlatformMBeanServer();