* @throws OrmDriverException
*/
private static OrmDriver loadDriver(String dataSourceId, Workspace workspace) throws OrmDriverException
{
OrmDriver provider;
DataAgent conn = null;
try
{
// Genera la conexi�n
conn = DataFactory.getInstance(workspace, dataSourceId);
// Invoca el constructor del driver
Class<?> cls = Class.forName(conn.getCompatibleOrmDriver());
Constructor<?> cons = cls.getConstructor(DataAgent.class);
provider = (OrmDriver) cons.newInstance(conn);
return provider;
}
catch (NoSuchMethodException ex)
{
throw new OrmDriverException("CORM driver loader: NoSuchMethodException: " + (conn != null ? conn.getCompatibleOrmDriver() : "[unknown ORM driver]"), ex);
}
catch (InvocationTargetException ex)
{
throw new OrmDriverException("CORM driver loader: InvocationTargetException: " + (conn != null ? conn.getCompatibleOrmDriver() : "[unknown ORM driver]"), ex);
}
catch (ClassNotFoundException ex)
{
throw new OrmDriverException("CORM driver loader: ClassNotFoundException: " + (conn != null ? conn.getCompatibleOrmDriver() : "[unknown ORM driver]"), ex);
}
catch (InstantiationException ex)
{
throw new OrmDriverException("CORM driver loader: InstantiationException: " + (conn != null ? conn.getCompatibleOrmDriver() : "[unknown ORM driver]"), ex);
}
catch (IllegalAccessException ex)
{
throw new OrmDriverException("CORM driver loader: IllegalAccessException: " + (conn != null ? conn.getCompatibleOrmDriver() : "[unknown ORM driver]"), ex);
}
catch (DataException ex)
{
throw new OrmDriverException("CORM driver loader: " + (conn != null ? conn.getCompatibleOrmDriver() : "[unknown ORM driver]"), ex);
}
}