/**
* Speedo: an implementation of JDO compliant personality on top of JORM generic
* I/O sub-system.
* Copyright (C) 2001-2004 France Telecom R&D
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*
*
* Contact: speedo@objectweb.org
*
* Authors: S.Chassande-Barrioz.
*
*/
package org.objectweb.speedo.mapper.rdb;
import java.util.Properties;
import org.objectweb.jorm.api.PException;
import org.objectweb.jorm.mapper.rdb.lib.ConnectionSpecJDBC;
import org.objectweb.speedo.api.SpeedoProperties;
import org.objectweb.speedo.mapper.api.ConnectionSpecFactory;
import org.objectweb.speedo.pm.api.POManagerFactoryItf;
/**
* @author S.Chassande-Barrioz
*/
public class JdbcConnectionSpecFactory implements ConnectionSpecFactory {
public Object getConnectionSpec(POManagerFactoryItf pmf,
String user,
String password) {
Properties p = pmf.getProperties();
try {
return new ConnectionSpecJDBC(
p.getProperty(SpeedoProperties.JDO_OPTION_CONNECTION_URL),
p.getProperty(SpeedoProperties.JDO_OPTION_CONNECTION_DRIVER_NAME),
user,
password);
} catch (PException e) {
return null;
}
}
}