Package org.datanucleus

Examples of org.datanucleus.ClassLoaderResolver


            return null;
        }

        RDBMSStoreManager storeMgr = (RDBMSStoreManager)ec.getStoreManager();
        SQLExpressionFactory exprFactory = storeMgr.getSQLExpressionFactory();
        ClassLoaderResolver clr = ec.getClassLoaderResolver();
        DatastoreClass primaryTable = storeMgr.getDatastoreClass(cmd.getFullClassName(), clr);

        // Form the query to find which one of these classes has the instance with this id
        DiscriminatorStatementGenerator stmtGen =
            new DiscriminatorStatementGenerator(storeMgr, clr, clr.classForName(cmd.getFullClassName()), true,
                null, null);
        stmtGen.setOption(StatementGenerator.OPTION_RESTRICT_DISCRIM);
        SQLStatement sqlStmt = stmtGen.getStatement();

        // Select the discriminator
View Full Code Here


            return null;
        }

        RDBMSStoreManager storeMgr = (RDBMSStoreManager)ec.getStoreManager();
        SQLExpressionFactory exprFactory = storeMgr.getSQLExpressionFactory();
        ClassLoaderResolver clr = ec.getClassLoaderResolver();

        // Form a query UNIONing all possible root candidates (and their subclasses)
        Iterator<AbstractClassMetaData> rootCmdIter = rootCmds.iterator();

        // Get UNION statement for primary root
        AbstractClassMetaData rootCmd = rootCmdIter.next();
        UnionStatementGenerator stmtGen =
            new UnionStatementGenerator(storeMgr, clr, clr.classForName(rootCmd.getFullClassName()), true,
                null, null);
        stmtGen.setOption(StatementGenerator.OPTION_SELECT_NUCLEUS_TYPE);
        SQLStatement sqlStmtMain = stmtGen.getStatement();

        while (rootCmdIter.hasNext())
        {
            // UNION to any other roots
            AbstractClassMetaData cmd = rootCmdIter.next();
            stmtGen = new UnionStatementGenerator(storeMgr, clr, clr.classForName(cmd.getFullClassName()), true,
                null, null);
            stmtGen.setOption(StatementGenerator.OPTION_SELECT_NUCLEUS_TYPE);
            SQLStatement sqlStmt = stmtGen.getStatement();

            sqlStmtMain.union(sqlStmt);
View Full Code Here

     */
    public void initialiseTypes(StoreSchemaHandler handler, ManagedConnection mconn)
    {
        // Initialise the mappings available. Load all possible, and remove unsupported for this datastore
        RDBMSStoreManager storeMgr = (RDBMSStoreManager)handler.getStoreManager();
        ClassLoaderResolver clr = storeMgr.getNucleusContext().getClassLoaderResolver(null);
        PluginManager pluginMgr = storeMgr.getNucleusContext().getPluginManager();
        MappingManager mapMgr = storeMgr.getMappingManager();
        mapMgr.loadDatastoreMapping(pluginMgr, clr, getVendorID());

        // Load the types from plugin(s)
View Full Code Here

        // FOREIGN KEY(col [,col] ) REFERENCES {TBL} (col [,col])
        if (supportsOption(FK_IN_END_CREATE_STATEMENTS))
        {
            StringBuffer fkConstraintStmt = new StringBuffer();
            ClassLoaderResolver clr = table.getStoreManager().getNucleusContext().getClassLoaderResolver(null);
            List<ForeignKey> fks = table.getExpectedForeignKeys(clr);
            if (fks != null && !fks.isEmpty())
            {
                for (ForeignKey fk : fks)
                {
View Full Code Here

            // Make sure the field java types are compatible
            Class fieldStoredJavaTypeClass = null;
            Class existingColStoredJavaTypeClass = null;
            try
            {
                ClassLoaderResolver clr = storeMgr.getNucleusContext().getClassLoaderResolver(null);
                fieldStoredJavaTypeClass = clr.classForName(storedJavaType);
                existingColStoredJavaTypeClass = clr.classForName(col.getStoredJavaType());
            }
            catch (RuntimeException cnfe)
            {
                // Do nothing
            }
View Full Code Here

                        }
                        else
                        {
                            // Parameter is for a particular column of the overall object/mapping
                            // so assume that the object is persistable (or id of persistable)
                            ClassLoaderResolver clr = ec.getClassLoaderResolver();
                            AbstractClassMetaData cmd =
                                ec.getMetaDataManager().getMetaDataForClass(mapping.getType(), clr);
                            if (cmd.getIdentityType() == IdentityType.DATASTORE)
                            {
                                colValue = mapping.getValueForDatastoreMapping(ec.getNucleusContext(),
View Full Code Here

     */
    protected SQLStatement getSQLStatementForIterator(ObjectProvider ownerSM)
    {
        SQLStatement sqlStmt = null;

        final ClassLoaderResolver clr = ownerSM.getExecutionContext().getClassLoaderResolver();
        final Class valueCls = clr.classForName(elementType);
        RDBMSStoreManager storeMgr = (RDBMSStoreManager)this.storeMgr;
        SQLTable containerSqlTbl = null;
        MapType mapType = getOwnerMemberMetaData().getMap().getMapType();
        if (emd != null && emd.getDiscriminatorStrategyForTable() != null &&
            emd.getDiscriminatorStrategyForTable() != DiscriminatorStrategy.NONE)
        {
            // Map<?, PC> where value has discriminator
            if (ClassUtils.isReferenceType(valueCls))
            {
                // Take the metadata for the first implementation of the reference type
                String[] clsNames = storeMgr.getNucleusContext().getMetaDataManager().getClassesImplementingInterface(elementType, clr);
                Class[] cls = new Class[clsNames.length];
                for (int j=0; j<clsNames.length; j++)
                {
                    cls[j] = clr.classForName(clsNames[j]);
                }
                StatementGenerator stmtGen = new DiscriminatorStatementGenerator(storeMgr, clr, cls, true, null, null);
                sqlStmt = stmtGen.getStatement();
            }
            else
View Full Code Here

        String dbURL = storeMgr.getConnectionURL();
        String dbUser = storeMgr.getConnectionUserName();
        String dbPassword = storeMgr.getConnectionPassword();

        // Load the database driver
        ClassLoaderResolver clr = storeMgr.getNucleusContext().getClassLoaderResolver(null);
        loadDriver(dbDriver, clr);

        // Check the existence of the necessary pooling classes
        ClassUtils.assertClassForJarExistsInClasspath(clr,
            "com.mchange.v2.c3p0.ComboPooledDataSource", "c3p0.jar");
View Full Code Here

        {
            dbPassword = ""; // Some RDBMS (e.g Postgresql) don't like null passwords
        }

        // Load the database driver
        ClassLoaderResolver clr = storeMgr.getNucleusContext().getClassLoaderResolver(null);
        loadDriver(dbDriver, clr);

        // Check the presence of commons-logging
        ClassUtils.assertClassForJarExistsInClasspath(clr,
            "org.apache.commons.logging.Log", "commons-logging.jar");
View Full Code Here

        {
            dbPassword = ""; // Some RDBMS (e.g Postgresql) don't like null passwords
        }

        // Load the database driver
        ClassLoaderResolver clr = storeMgr.getNucleusContext().getClassLoaderResolver(null);
        loadDriver(dbDriver, clr);

        // Create the actual pool of connections
        org.datanucleus.store.rdbms.datasource.dbcp.pool.ObjectPool connectionPool =
            new org.datanucleus.store.rdbms.datasource.dbcp.pool.impl.GenericObjectPool(null);
View Full Code Here

TOP

Related Classes of org.datanucleus.ClassLoaderResolver

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.