Package org.jpox

Examples of org.jpox.ClassLoaderResolver


                }
                return;
            }
        }

        ClassLoaderResolver clr = sm.getObjectManager().getClassLoaderResolver();
        String className = sm.getObject().getClass().getName();
        DatastoreClass dc = storeMgr.getDatastoreClass(className, clr);
        if (dc == null)
        {
            AbstractClassMetaData cmd = storeMgr.getOMFContext().getMetaDataManager().getMetaDataForClass(className, clr);
View Full Code Here


                if (storeMgr.getRuntimeManager() != null)
                {
                    storeMgr.getRuntimeManager().incrementFetchCount();
                }

                ClassLoaderResolver clr = sm.getObjectManager().getClassLoaderResolver();
                DatastoreClass table = storeMgr.getDatastoreClass(sm.getObject().getClass().getName(), clr);
                FetchRequest req = getFetchRequest(table, fmds, sm.getObject().getClass(), clr);
                req.execute(sm);
            }
        }
View Full Code Here

            if (storeMgr.getRuntimeManager() != null)
            {
                storeMgr.getRuntimeManager().incrementUpdateCount();
            }

            ClassLoaderResolver clr = sm.getObjectManager().getClassLoaderResolver();
            DatastoreClass dc = storeMgr.getDatastoreClass(sm.getObject().getClass().getName(), clr);
            updateTable(dc, sm, clr, fmds);
        }
    }
View Full Code Here

        if (storeMgr.getRuntimeManager() != null)
        {
            storeMgr.getRuntimeManager().incrementDeleteCount();
        }

        ClassLoaderResolver clr = sm.getObjectManager().getClassLoaderResolver();
        DatastoreClass dc = storeMgr.getDatastoreClass(sm.getObject().getClass().getName(), clr);
        deleteTable(dc, sm, clr);
    }
View Full Code Here

     * @throws JPOXObjectNotFoundException if the object doesnt exist
     * @throws JPOXDataStoreException when an error occurs in the datastore communication
     */
    public void locateObject(StateManager sm)
    {
        ClassLoaderResolver clr = sm.getObjectManager().getClassLoaderResolver();
        DatastoreClass table = storeMgr.getDatastoreClass(sm.getObject().getClass().getName(), clr);
        LocateRequest req = getLocateRequest(table, sm.getObject().getClass().getName());
        req.execute(sm);
    }
View Full Code Here

        if (schemaDataOptions == null || schemaDataOptions.size() == 0 || id == null)
        {
            return null;
        }

        ClassLoaderResolver clr = om.getClassLoaderResolver();
        Class primaryClass = clr.classForName(((RDBMSStoreData)schemaDataOptions.get(0)).getName());
        Class objectClass = primaryClass;
        if (Modifier.isAbstract(primaryClass.getModifiers()))
        {
            // The primary class is abstract so find one that isnt. We only need a valid object type
            Iterator optionsIter = schemaDataOptions.iterator();
            while (optionsIter.hasNext())
            {
                RDBMSStoreData data = (RDBMSStoreData)optionsIter.next();
                Class dataClass = clr.classForName(data.getName());
                if (!Modifier.isAbstract(dataClass.getModifiers()))
                {
                    objectClass = dataClass;
                    break;
                }
View Full Code Here

     */
    public void testDatabaseProductNames() throws SQLException
    {
        OMFContext ctxt = new OMFContext(new PersistenceConfiguration(){});
        PluginManager pluginMgr = ctxt.getPluginManager();
        ClassLoaderResolver clr = ctxt.getClassLoaderResolver(null);

        RDBMSAdapterFactory factory = RDBMSAdapterFactory.getInstance();

        assertEquals("org.jpox.store.rdbms.adapter.DerbyAdapter", factory.getAdapterClass(pluginMgr, null, "Apache Derby", clr).getName());
        assertEquals("org.jpox.store.rdbms.adapter.DerbyAdapter", factory.getAdapterClass(pluginMgr, null, "Derby", clr).getName());
View Full Code Here

     * @param candidateAlias Alias for the candidate
     * @return The QueryStatement that will return the instances
     */
    public QueryExpression newQueryStatement(Class candidateClass, DatastoreIdentifier candidateAlias)
    {
        final ClassLoaderResolver clr = om.getClassLoaderResolver();
        QueryExpression query = null;

        if (tables == null)
        {
            return null;
        }

        // In the multiple table case we pass in the class of the table rather than the candidate class since
        // the instances of that table can only be of the tables type ("subclass-table" strategy)
        for (int i = 0; i < tables.length; i++)
        {
            final int tableNo = i;

            // Load using the class loader of the candidate class where possible - JDO spec 12.5
            Class cls = null;
            try
            {
                cls = clr.classForName(tables[tableNo].getType(), this.candidateClass.getClassLoader());
            }
            catch (ClassNotResolvedException cnfe)
            {
                throw new JPOXUserException(LOCALISER_RDBMS.msg("053002",
                    candidateClass.getName(), tables[tableNo].getType())).setFatal();
            }

            if (queryUsingDiscriminator())
            {
                // Use a single select with discrim since all in 1 table, and select the discrim column for identification
                Class[] candidates = null;
                if (storeMgr.getOMFContext().getTypeManager().isReferenceType(candidateClass))
                {
                    // Take the metadata for the first implementation of the reference type
                    String[] clsNames = storeMgr.getOMFContext().getMetaDataManager().getClassesImplementingInterface(candidateClass.getName(), clr);
                    candidates = new Class[clsNames.length];
                    for (int j=0; j<clsNames.length; j++)
                    {
                        candidates[j] = clr.classForName(clsNames[j]);
                    }
                }
                else
                {
                    candidates = new Class[] {candidateClass};
                }
                query = (new DiscriminatorIteratorStatement(clr,
                    candidates, subclasses, storeMgr, true)).getQueryStatement(candidateAlias);
            }
            else
            {
                // Use a UNION since we need to join across multiple tables
                boolean completeTableInheritance =
                    cmd.getInheritanceMetaData().getStrategyValue() == InheritanceStrategy.COMPLETE_TABLE;
                boolean useSubclassesInStatement = subclasses;
                if (completeTableInheritance)
                {
                    // "complete-table" so ignore subclasses since each table is just that class
                    useSubclassesInStatement = false;
                }

                QueryExpression query_table = new UnionIteratorStatement(clr,
                    multipleTableCase ? cls : candidateClass, useSubclassesInStatement, storeMgr,
                    clr.classForName(tables[tableNo].getType()),
                    tables[tableNo].getIDMapping(), tables[tableNo], false, Boolean.TRUE,
                    !completeTableInheritance, false).getQueryStatement(candidateAlias);
               
                if (query != null)
                {
View Full Code Here

    public DatastoreMapping createDatastoreMapping(JavaTypeMapping mapping, AbstractMemberMetaData fmd, int index,
            MappedStoreManager storeMgr, DatastoreField column)
    {
        Class datastoreMappingClass = null;

        ClassLoaderResolver clr = storeMgr.getOMFContext().getClassLoaderResolver(null);
        if (fmd.getColumnMetaData().length > 0)
        {
            // Use "datastore-mapping-class" extension if provided
            if (fmd.getColumnMetaData()[index].hasExtension("datastore-mapping-class"))
            {
                datastoreMappingClass = clr.classForName(fmd.getColumnMetaData()[index].getValueForExtension("datastore-mapping-class"));
            }
        }
        if (datastoreMappingClass == null)
        {
            String javaType = mapping.getJavaTypeForDatastoreMapping(index);
View Full Code Here

     * @param javaType The java type (isnt this stored in the java mapping ?)
     * @return The datastore mapping
     */
    public DatastoreMapping createDatastoreMapping(JavaTypeMapping mapping, MappedStoreManager storeMgr, DatastoreField column, String javaType)
    {
        ClassLoaderResolver clr = storeMgr.getOMFContext().getClassLoaderResolver(null);
        Column col = (Column)column;
        String jdbcType = null;
        String sqlType = null;
        if (col != null && col.getColumnMetaData() != null)
        {
View Full Code Here

TOP

Related Classes of org.jpox.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.