Package org.jpox.exceptions

Examples of org.jpox.exceptions.JPOXUserException


    {
        AbstractMemberMetaData fmd = (AbstractMemberMetaData)parent;
        if (fmd.getMap() == null)
        {
            // TODO Localise this
            throw new JPOXUserException("The field "+fmd.getFullFieldName()+" is defined with <value>, however no <map> definition was found.").setFatal();
        }

        String valueType = fmd.getMap().getValueType();
        Class valueTypeClass = null;
        try
View Full Code Here


                        {
                            String msg = LOCALISER.msg("013003",
                                StringUtils.toJVMIDString(pc), mmd.getName(),
                                StringUtils.toJVMIDString(newValue), relatedMmd.getName());
                            JPOXLogger.PERSISTENCE.error(msg);
                            throw new JPOXUserException(msg);
                        }
                        else
                        {
                            String msg = LOCALISER.msg("013002",
                                StringUtils.toJVMIDString(pc), mmd.getName(),
                                StringUtils.toJVMIDString(newValue), relatedMmd.getName(),
                                StringUtils.toJVMIDString(newValueFieldValue));
                            JPOXLogger.PERSISTENCE.error(msg);
                            throw new JPOXUserException(msg);
                        }
                    }
                }
            }
        }
View Full Code Here

            if (change.type == ADD_OBJECT)
            {
                if (ownerSM.getObjectManager().getApiAdapter().isDeleted(change.value))
                {
                    // The element was added but was then the element object was deleted!
                    throw new JPOXUserException(LOCALISER.msg("013008",
                        StringUtils.toJVMIDString(pc), mmd.getName(), StringUtils.toJVMIDString(change.value)));
                }
                else
                {
                    AbstractMemberMetaData relatedMmd = mmd.getRelatedMemberMetaData(clr)[0];
                    org.jpox.StateManager newElementSM = om.findStateManager(change.value);
                    if (newElementSM != null)
                    {
                        newElementSM.loadField(relatedMmd.getAbsoluteFieldNumber());
                        RelationshipManager newElementRelMgr = newElementSM.getRelationshipManager();
                        if (newElementRelMgr != null && newElementRelMgr.managesField(relatedMmd.getAbsoluteFieldNumber()))
                        {
                            // Element has had the owner set, so make sure it is set to this object
                            Object newValueFieldValue = newElementSM.provideField(relatedMmd.getAbsoluteFieldNumber());
                            if (newValueFieldValue != pc && newValueFieldValue != null)
                            {
                                // The element has a different owner than the PC with this collection
                                // This catches cases where the user has set the wrong owner, and also
                                // will catch cases where the user has added it to two collections
                                throw new JPOXUserException(LOCALISER.msg(
                                    "013009",
                                    StringUtils.toJVMIDString(pc), mmd.getName(),
                                    StringUtils.toJVMIDString(change.value),
                                    StringUtils.toJVMIDString(newValueFieldValue)));
                            }
                        }
                    }
                }
            }
            else if (change.type == REMOVE_OBJECT)
            {
                if (ownerSM.getObjectManager().getApiAdapter().isDeleted(change.value))
                {
                    // The element was removed and was then the element object was deleted so do nothing
                }
                else
                {
                    AbstractMemberMetaData relatedMmd = mmd.getRelatedMemberMetaData(clr)[0];
                    org.jpox.StateManager newElementSM = om.findStateManager(change.value);
                    if (newElementSM != null)
                    {
                        newElementSM.loadField(relatedMmd.getAbsoluteFieldNumber());
                        RelationshipManager newElementRelMgr = newElementSM.getRelationshipManager();
                        if (newElementRelMgr != null && newElementRelMgr.managesField(relatedMmd.getAbsoluteFieldNumber()))
                        {
                            // Element has had the owner set, so make sure it is not set to this object
                            Object newValueFieldValue = newElementSM.provideField(relatedMmd.getAbsoluteFieldNumber());
                            if (newValueFieldValue == pc)
                            {
                                // The element was removed from the collection, but was updated to have its owner
                                // set to the collection owner!
                                throw new JPOXUserException(LOCALISER.msg(
                                    "013010",
                                    StringUtils.toJVMIDString(pc), mmd.getName(),
                                    StringUtils.toJVMIDString(change.value)));
                            }
                        }
View Full Code Here

    {
        AbstractMemberMetaData fmd = (AbstractMemberMetaData)parent;
        if (fmd.getMap() == null)
        {
            // TODO Localise this
            throw new JPOXUserException("The field "+fmd.getFullFieldName()+" is defined with <key>, however no <map> definition was found.").setFatal();
        }

        String keyType = fmd.getMap().getKeyType();
        Class keyTypeClass = null;
        try
View Full Code Here

                handler = (DefaultHandler) mgr.getOMFContext().getPluginManager().createExecutableExtension("org.jpox.metadata_handler",
                    "name", handlerName, "class-name", argTypes, argValues);
                if (handler == null)
                {
                    // Plugin of this name not found
                    throw new JPOXUserException(LOCALISER.msg("044028", handlerName)).setFatal();
                }
            }
            catch (Exception e)
            {
                String msg = LOCALISER.msg("044029", handlerName, e.getMessage());
View Full Code Here

        String level1ClassName = getOMFContext().getPluginManager().getAttributeValueForExtension("org.jpox.cache_level1",
            "name", level1Type, "class-name");
        if (level1ClassName == null)
        {
            // Plugin of this name not found
            throw new JPOXUserException(LOCALISER.msg("003001", level1Type)).setFatal();
        }

        try
        {
            // Create an instance of the L1 Cache
            Class level1CacheClass = clr.classForName(level1ClassName,OMFContext.class.getClassLoader());
            cache = (Level1Cache) level1CacheClass.newInstance();
            if (JPOXLogger.CACHE.isDebugEnabled())
            {
                JPOXLogger.CACHE.debug(LOCALISER.msg("003003", level1Type));
            }
        }
        catch (Exception e)
        {
            // Class name for this L1 cache plugin is not found!
            throw new JPOXUserException(LOCALISER.msg("003002", level1Type, level1ClassName),e).setFatal();
        }
    }
View Full Code Here

            // Which calls "StateManager.getPersistenceManager(pc)".
            // That then calls "hereIsStateManager(sm, pc)" which sets "foundStateManager".
            ObjectManager om = ObjectManagerHelper.getObjectManager(pc);
            if (om != null && this != om)
            {
                throw new JPOXUserException(LOCALISER.msg("010007", getApiAdapter().getIdForObject(pc)));
            }
            sm = foundStateManager;
        }
        finally
        {
View Full Code Here

                        {
                            error.append(" -> ");
                        }
                    }

                    throw new JPOXUserException(error.toString()).setFatal();
                }
                else
                {
                    // Make recursive call to check for any nested dependencies.
                    // e.g A references B, B references C, C references A.
View Full Code Here

     * @param sm StateManager.
     * @return new LifeCycle state.
     **/
    public LifeCycleState transitionMakeNontransactional(StateManager sm)
    {
        throw new JPOXUserException(LOCALISER.msg("027011"),sm.getInternalObjectId());
    }
View Full Code Here

    {
        if (detachAllOnCommit)
        {
            return changeState(sm, TRANSIENT);
        }
        throw new JPOXUserException(LOCALISER.msg("027012"),sm.getInternalObjectId());
    }
View Full Code Here

TOP

Related Classes of org.jpox.exceptions.JPOXUserException

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.