Package org.jpox.store.poid

Examples of org.jpox.store.poid.PoidManager


        this.autoStartMechanism = conf.getStringProperty("org.jpox.autoStartMechanism");

        // Register this StoreManager with the OMFContext
        omfContext.setStoreManager(this);

        this.poidManager = new PoidManager();

        if (omfContext.getManagement() != null)
        {
            // register MBean in MbeanServer
            ManagementServer mgntServer = omfContext.getManagement().getManagementServer();
View Full Code Here


            }
        }
        props.put("sequence-name", seqMetaData.getDatastoreSequence());

        // Get a PoidManager to create the generator
        PoidManager mgr = storeMgr.getPoidManager();
        final ObjectManager thisOM = objectMgr;

        PoidConnectionProvider connProvider = new PoidConnectionProvider()
        {
            ManagedConnection mconn;
            public ManagedConnection retrieveConnection()
            {
                mconn = storeMgr.getConnection(thisOM);
                return mconn;
            }

            public void releaseConnection()
            {
                this.mconn.release();
                this.mconn = null;
            }
        };

        Class cls = null;
        ConfigurationElement elem =
            objectMgr.getOMFContext().getPluginManager().getConfigurationElementForExtension(
                "org.jpox.store_valuegenerator",
                new String[]{"name", "datastore"},
                new String[] {poidGeneratorName, storeManager.getStoreManagerKey()});
        if (elem != null)
        {
            cls = objectMgr.getOMFContext().getPluginManager().loadClass(
                elem.getExtension().getPlugin().getSymbolicName(), elem.getAttribute("class-name"));
        }
        if (cls == null)
        {
            throw new JPOXException("Cannot create Poid Generator for strategy "+poidGeneratorName);
        }
        generator = mgr.createPoidGenerator(seqMetaData.getName(), cls, props, storeManager, connProvider);

        if (JPOXLogger.JDO.isDebugEnabled())
        {
            JPOXLogger.JDO.debug(LOCALISER.msg("017003", seqMetaData.getName(), poidGeneratorName));
        }
View Full Code Here

            // Use the provided name as the table name (what if it is null ?)
            props.put("sequence-name", seqMetaData.getDatastoreSequence());
        }

        // Get a PoidManager to create the generator
        PoidManager mgr = storeMgr.getPoidManager();

        PoidConnectionProvider connProvider = new PoidConnectionProvider()
            {
                ManagedConnection mconn;

                public ManagedConnection retrieveConnection()
                {
                    try
                    {
                        // Obtain a new connection
                        // Note : it may be worthwhile to use the PM's connection here however where a Sequence doesnt yet
                        // exist the connection would then be effectively dead until the end of the tx
                        // The way around this would be to find a way of checking for existence of the sequence
                        PersistenceConfiguration conf = om.getOMFContext().getPersistenceConfiguration();
                        int isolationLevel = TransactionUtils.getTransactionIsolationLevelForName(conf.getStringProperty("org.jpox.poid.transactionIsolation"));
                        this.mconn = ((RDBMSManager)storeManager).getConnection(isolationLevel);
                    }
                    catch (SQLException e)
                    {
                        String msg = LOCALISER.msg("017006", e);
                        JPOXLogger.JDO.error(msg);
                        throw new JDODataStoreException(msg,e);
                    }
                    return mconn;
                }

                public void releaseConnection()
                {
                    try
                    {
                        // Release the connection
                        mconn.close();
                    }
                    catch (JPOXException e)
                    {
                        String msg = LOCALISER.msg("017007", e);
                        JPOXLogger.JDO.error(msg);
                        throw new JDODataStoreException(msg, e);
                    }
                }
            };
        Class cls = null;
        ConfigurationElement elem =
            objectMgr.getOMFContext().getPluginManager().getConfigurationElementForExtension("org.jpox.store_valuegenerator",
                new String[]{"name", "datastore"}, new String[] {poidGeneratorName, storeManager.getStoreManagerKey()});
        if (elem != null)
        {
            cls = objectMgr.getOMFContext().getPluginManager().loadClass(elem.getExtension().getPlugin().getSymbolicName(), elem.getAttribute("class-name"));
        }
        if( cls == null )
        {
            throw new JPOXException("Cannot create Poid Generator for strategy "+poidGeneratorName);
        }
        generator = mgr.createPoidGenerator(seqMetaData.getName(), cls, props, storeManager, connProvider);

        if (JPOXLogger.JDO.isDebugEnabled())
        {
            JPOXLogger.JDO.debug(LOCALISER.msg("017003", seqMetaData.getName(), poidGeneratorName));
        }
View Full Code Here

TOP

Related Classes of org.jpox.store.poid.PoidManager

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.