/* JFox, the OpenSource J2EE Application Server
 *
 * Distributable under GNU LGPL license by gun.org
 * more details please visit http://www.huihoo.org/jfox
 */

package org.jfox.jdbc.xa;

import javax.sql.XADataSource;

/**
 * @author <a href="mailto:young_yy@hotmail.com">Young Yang</a>
 */

public class ORACLEXADataSourceFactory extends AbstractXADataSource {

    public ORACLEXADataSourceFactory(String url) {
        super(url);
    }

    protected XADataSource init(String url) {
        try {
            XADataSource oracleXads = (XADataSource) this.getClass().getClassLoader().loadClass("oracle.jdbc.xa.client.OracleXADataSource").newInstance();
            oracleXads.getClass().getMethod("setURL", new Class[]{String.class})
                    .invoke(oracleXads, new Object[]{url});
            return oracleXads;
        }
        catch(Exception e) {
            e.printStackTrace();
            return null;
        }
    }

    public static void main(String[] args) {

    }
}