Package org.jpox

Examples of org.jpox.ClassLoaderResolver


        {
            throw new IllegalArgumentException(LOCALISER.msg("Query.NamedQueryNotFound", queryName));
        }

        // Find the Query for the specified class
        ClassLoaderResolver clr = om.getClassLoaderResolver();
        QueryMetaData qmd = om.getMetaDataManager().getMetaDataForQuery(null, clr, queryName);
        if (qmd == null)
        {
            throw new IllegalArgumentException(LOCALISER.msg("Query.NamedQueryNotFound", queryName));
        }
View Full Code Here


     */
    @SuppressWarnings("unchecked")
    private void invokeCallback(final Object pc, final Class callbackClass)
    {
        final ObjectManager om = ((AbstractPersistenceManager) ((PersistenceCapable) pc).jdoGetPersistenceManager()).getObjectManager();
        final ClassLoaderResolver clr = om.getClassLoaderResolver();

        AbstractClassMetaData acmd = om.getOMFContext().getMetaDataManager().getMetaDataForClass(pc.getClass(), clr);

        try
        {
            if (!acmd.isExcludeDefaultListeners())
            {
                // Global listeners for all classes
                List<EventListenerMetaData> listenerMetaData = om.getMetaDataManager().getListeners();
                if (listenerMetaData != null && listenerMetaData.size() > 0)
                {
                    // Files have listeners so go through them in the same order
                    Iterator<EventListenerMetaData> listenerIter = listenerMetaData.iterator();
                    while (listenerIter.hasNext())
                    {
                        EventListenerMetaData elmd = listenerIter.next();
                        Class listenerClass = clr.classForName(elmd.getClassName());
                        String methodName = elmd.getMethodNameForCallbackClass(callbackClass.getName());
                        if (methodName != null)
                        {
                            // Separate listener class taking the PC object as input
                            Object listener = listenerClass.newInstance();
                            invokeCallbackMethod(listener, methodName, pc, clr);
                        }
                    }
                }
            }

            // Class listeners for this class
            List<String> entityMethodsToInvoke = null;
            while (acmd != null)
            {
                List<EventListenerMetaData> listenerMetaData = acmd.getListeners();
                if (listenerMetaData != null && listenerMetaData.size() > 0)
                {
                    // Class has listeners so go through them in the same order
                    Iterator<EventListenerMetaData> listenerIter = listenerMetaData.iterator();
                    while (listenerIter.hasNext())
                    {
                        EventListenerMetaData elmd = listenerIter.next();
                        Class listenerClass = clr.classForName(elmd.getClassName());
                        String methodName = elmd.getMethodNameForCallbackClass(callbackClass.getName());
                        if (methodName != null)
                        {
                            if (elmd.getClassName().equals(acmd.getFullClassName()))
                            {
View Full Code Here

     * @return The field expression representing the required field of this object
     */
    public ScalarExpression accessField(String subfieldName, boolean innerJoin)
    {
        DatastoreContainerObject table;
        ClassLoaderResolver clr = qs.getClassLoaderResolver();
        try
        {
            if (mapping instanceof EmbeddedMapping)
            {
                // Any embedded fields can go straight to the main table if embedded there
View Full Code Here

     */
    public BooleanExpression instanceOf(ScalarExpression expr)
    {
        if (expr instanceof ClassExpression)
        {
            ClassLoaderResolver clr = qs.getClassLoaderResolver();
            Class instanceofClass = ((ClassExpression)expr).getCls();
            Class fieldClass = clr.classForName(mapping.getType());
            if (!fieldClass.isAssignableFrom(instanceofClass) && !instanceofClass.isAssignableFrom(fieldClass))
            {
                // Field type and instanceof type are totally incompatible, so just return false
                return new BooleanLiteral(qs, mapping, true).eq(new BooleanLiteral(qs, mapping, false));
            }
View Full Code Here

        StateManager sm = om.findStateManager(value);

        try
        {
            ClassLoaderResolver clr = om.getClassLoaderResolver();

            // Check if the field is attributed in the datastore
            boolean hasDatastoreAttributedPrimaryKeyValues = hasDatastoreAttributedPrimaryKeyValues(
                om.getMetaDataManager(), om.getStoreManager(), clr);
View Full Code Here

        {
            return new ObjectExpression(qs, this, te);
        }
        else
        {
            ClassLoaderResolver clr = qs.getClassLoaderResolver();
            MappedStoreManager srm = qs.getStoreManager();
            int relationType = fmd.getRelationType(clr);
            if (relationType == Relation.ONE_TO_ONE_BI)
            {
                // Create an expression joining to the related field in the related table
View Full Code Here

     * @param cmd the AbstractClassMetaData
     * @return the id
     */
    private Object getObjectForAbstractClass(ObjectManager om, final Object rs, int[] param, AbstractClassMetaData cmd)
    {
        ClassLoaderResolver clr = om.getClassLoaderResolver();

        // Abstract class, so we need to generate an AID before proceeding
        Class objectIdClass = clr.classForName(cmd.getObjectidClass());
        Class pcClass = clr.classForName(cmd.getFullClassName());
        Object id;
        if (cmd.usesSingleFieldIdentityClass())
        {
            id = createSingleFieldIdentity(om, rs, param, cmd, objectIdClass, pcClass);
        }
View Full Code Here

     * @param cmd the AbstractClassMetaData
     * @return the id
     */
    private Object getObjectForApplicationIdentity(ObjectManager om, final Object rs, int[] param, AbstractClassMetaData cmd)
    {
        ClassLoaderResolver clr = om.getClassLoaderResolver();

        // Abstract class
        if (((ClassMetaData)cmd).isAbstractPersistenceCapable() && cmd.getObjectidClass() != null)
        {
            return getObjectForAbstractClass(om,rs,param,cmd);
        }
       
       
        // Concrete class
        int totalFieldCount = cmd.getNoOfManagedMembers() + cmd.getNoOfInheritedManagedMembers();
        final StatementExpressionIndex[] statementExpressionIndex = new StatementExpressionIndex[totalFieldCount];
        int paramIndex = 0;

        final MappedStoreManager storeMgr = (MappedStoreManager)om.getStoreManager();
        DatastoreClass datastoreClass = storeMgr.getDatastoreClass(cmd.getFullClassName(), clr);
        final int[] pkFieldNumbers = cmd.getPKMemberPositions();

        for (int i=0; i<pkFieldNumbers.length; ++i)
        {
            AbstractMemberMetaData fmd = cmd.getMetaDataForManagedMemberAtAbsolutePosition(pkFieldNumbers[i]);
            JavaTypeMapping m = datastoreClass.getFieldMapping(fmd);
            statementExpressionIndex[fmd.getAbsoluteFieldNumber()] = new StatementExpressionIndex();
            statementExpressionIndex[fmd.getAbsoluteFieldNumber()].setMapping(m);
            int expressionsIndex[] = new int[m.getNumberOfDatastoreFields()];
            for (int j = 0; j < expressionsIndex.length; j++)
            {
                expressionsIndex[j] = param[paramIndex++];
            }
            statementExpressionIndex[fmd.getAbsoluteFieldNumber()].setExpressionIndex(expressionsIndex);
        }

        return om.findObjectUsingAID(clr.classForName(cmd.getFullClassName()),
            new FieldValues()
            {
            // StateManager calls the fetchFields method
            public void fetchFields(StateManager sm)
            {
View Full Code Here

        {
            // Has been set to null so nothing to do
            return;
        }

        ClassLoaderResolver clr = sm.getObjectManager().getClassLoaderResolver();
        AbstractMemberMetaData[] relatedMmds = fmd.getRelatedMemberMetaData(clr);
        int relationType = fmd.getRelationType(clr);
        if (pc != null)
        {
            if (relationType == Relation.ONE_TO_ONE_BI)
View Full Code Here

        if (pc != null)
        {
            StateManager otherSM = sm.getObjectManager().findStateManager(pc);
            if (otherSM == null)
            {
                ClassLoaderResolver clr = sm.getObjectManager().getClassLoaderResolver();
                int relationType = fmd.getRelationType(clr);
                if (relationType == Relation.ONE_TO_ONE_BI || relationType == Relation.MANY_TO_ONE_BI)
                {
                    // Related object is not yet persisted (e.g 1-1 with FK at other side) so persist it
                    sm.getObjectManager().persistObjectInternal(pc, null, null, -1, StateManager.PC);
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.