Package org.jpox

Examples of org.jpox.ConnectionFactory


        if (cfElem != null)
        {
            txConnectionFactoryName = cfElem.getAttribute("name");
            try
            {
                ConnectionFactory cf = (ConnectionFactory)omfContext.getPluginManager().createExecutableExtension(
                    "org.jpox.store_connectionfactory",
                    new String[] {"datastore", "transactional"},
                    new String[] {storeManagerKey, "true"}, "class-name",
                    new Class[] {OMFContext.class, String.class},
                    new Object[] {omfContext, "tx"});
                omfContext.getConnectionFactoryRegistry().registerConnectionFactory(txConnectionFactoryName, cf);
                if (JPOXLogger.CONNECTION.isDebugEnabled())
                {
                    JPOXLogger.CONNECTION.debug(LOCALISER.msg("032018", txConnectionFactoryName));
                }
            }
            catch (Exception e)
            {
                throw new JPOXException("Error creating transactional connection factory", e).setFatal();
            }
        }
        else
        {
            throw new JPOXException("Error creating transactional connection factory. No connection factory plugin defined");
        }

        // Factory for connections - nontransactional
        cfElem = omfContext.getPluginManager().getConfigurationElementForExtension(
            "org.jpox.store_connectionfactory",
            new String[] {"datastore", "transactional"}, new String[] {storeManagerKey, "false"});
        if (cfElem != null)
        {
            nontxConnectionFactoryName = cfElem.getAttribute("name");
            try
            {
                ConnectionFactory cf = (ConnectionFactory)omfContext.getPluginManager().createExecutableExtension(
                    "org.jpox.store_connectionfactory",
                    new String[] {"datastore", "transactional"},
                    new String[] {storeManagerKey, "false"}, "class-name",
                    new Class[] {OMFContext.class, String.class},
                    new Object[] {omfContext, "nontx"});
View Full Code Here


     * @throws JPOXException Thrown if an error occurs getting the connection
     */
    public ManagedConnection getConnection(ObjectManager om)
    {
        ConnectionFactoryRegistry registry = om.getOMFContext().getConnectionFactoryRegistry();
        ConnectionFactory connFactory = registry.lookupConnectionFactory(txConnectionFactoryName);
        return connFactory.getConnection(om, null);
    }
View Full Code Here

        }
        else
        {
            enlisted = true;
        }
        ConnectionFactory cf = null;
        if (enlisted)
        {
            cf = getOMFContext().getConnectionFactoryRegistry().lookupConnectionFactory(txConnectionFactoryName);
        }
        else
        {
            cf = getOMFContext().getConnectionFactoryRegistry().lookupConnectionFactory(nontxConnectionFactoryName);
        }
        mc = cf.getConnection(enlisted?om:null, null); // Will throw exception if already locked

        // Lock the connection now that it is in use by the user
        mc.lock();

        return new JDOConnectionImpl(mc.getConnection(), new Runnable()
View Full Code Here

     */
    public ManagedConnection getConnection()
    throws SQLException
    {
        ConnectionFactoryRegistry registry = getOMFContext().getConnectionFactoryRegistry();
        ConnectionFactory connFactory = registry.lookupConnectionFactory(nontxConnectionFactoryName);
        return connFactory.getConnection(null, null);
    }
View Full Code Here

     */
    public ManagedConnection getConnection(int isolation_level)
    throws SQLException
    {
        ConnectionFactoryRegistry registry = omfContext.getConnectionFactoryRegistry();
        ConnectionFactory connFactory = registry.lookupConnectionFactory(nontxConnectionFactoryName);
        Map options = new HashMap();
        options.put("transaction.isolation", new Integer(isolation_level));
        return connFactory.getConnection(null, options);
      
    }
View Full Code Here

TOP

Related Classes of org.jpox.ConnectionFactory

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.