All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.foundationdb.sql.jdbc.xa.FDBXADataSourceFactory Maven / Gradle / Ivy

There is a newer version: 2.1-0-jdbc41
Show newest version
/*-------------------------------------------------------------------------
*
* Copyright (c) 2007-2011, PostgreSQL Global Development Group
*
*
*-------------------------------------------------------------------------
*/
package com.foundationdb.sql.jdbc.xa;

import com.foundationdb.sql.jdbc.ds.common.*;

import javax.naming.*;

import java.util.Hashtable;

/**
 * An ObjectFactory implementation for FDBXADataSource-objects. 
 */

public class FDBXADataSourceFactory extends FDBObjectFactory
{
    /* All the other PostgreSQL DataSource use FDBObjectFactory directly, but we
     * can't do that with FDBXADataSource because referencing FDBXADataSource
     * from FDBObjectFactory would break "JDBC2 Enterprise" edition build which
     * doesn't include FDBXADataSource.
     */

    public Object getObjectInstance(Object obj, Name name, Context nameCtx,
                                    Hashtable environment) throws Exception
    {
        Reference ref = (Reference)obj;
        String className = ref.getClassName();
        if (className.equals("com.foundationdb.sql.jdbc.xa.FDBXADataSource"))
        {
            return loadXADataSource(ref);
        }
	else 
	    return null;
    }

    private Object loadXADataSource(Reference ref)
    {
        FDBXADataSource ds = new FDBXADataSource();
        return loadBaseDataSource(ds, ref);
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy