Package org.jpox

Examples of org.jpox.ObjectManager


     * @param callbackClass The callback type to call
     */
    @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())
View Full Code Here


    {
        boolean persisted = false;
        ApiAdapter api = om.getApiAdapter();
        if (api.isPersistable(object))
        {
            ObjectManager objectOM = ObjectManagerHelper.getObjectManager(object);
            if (objectOM != null && om != objectOM)
            {
                throw new JPOXUserException(
                    LOCALISER.msg("023009", StringUtils.toJVMIDString(object)),
                    api.getIdForObject(object));
View Full Code Here

                    // Transient object, so we need to persist it
                    requiresPersisting = true;
                }
                else
                {
                    ObjectManager pcPM = ObjectManagerHelper.getObjectManager(value);
                    if (pcPM != null && om != pcPM)
                    {
                        throw new JPOXUserException(LOCALISER.msg("041015"), id);
                    }
                }
View Full Code Here

                  // Transient object, so we need to persist it
                  requiresPersisting = true;
              }
              else
              {
                    ObjectManager valueOM = ObjectManagerHelper.getObjectManager(value);
                  if (valueOM != null && om != valueOM)
                  {
                      throw new JPOXUserException(LOCALISER.msg("041015"), id);
                  }
              }
View Full Code Here

    public void checkConsistency()
    {
        Set entries = fieldChanges.entrySet();
        Iterator iter = entries.iterator();
        AbstractClassMetaData cmd = ownerSM.getClassMetaData();
        ObjectManager om = ownerSM.getObjectManager();
        while (iter.hasNext())
        {
            Map.Entry entry = (Map.Entry)iter.next();
            int fieldNumber = ((Integer)entry.getKey()).intValue();
            AbstractMemberMetaData mmd = cmd.getMetaDataForManagedMemberAtAbsolutePosition(fieldNumber);
            ClassLoaderResolver clr = om.getClassLoaderResolver();
            Object oldValue = entry.getValue();
            int relationType = mmd.getRelationType(clr);
            if (relationType == Relation.ONE_TO_ONE_BI)
            {
                // 1-1 bidirectional
View Full Code Here

    public void process()
    {
        Set entries = fieldChanges.entrySet();
        Iterator iter = entries.iterator();
        AbstractClassMetaData cmd = ownerSM.getClassMetaData();
        ObjectManager om = ownerSM.getObjectManager();
        while (iter.hasNext())
        {
            Map.Entry entry = (Map.Entry)iter.next();
            int fieldNumber = ((Integer)entry.getKey()).intValue();
            AbstractMemberMetaData mmd = cmd.getMetaDataForManagedMemberAtAbsolutePosition(fieldNumber);
            ClassLoaderResolver clr = om.getClassLoaderResolver();
            Object oldValue = entry.getValue();
            int relationType = mmd.getRelationType(clr);
            if (relationType == Relation.ONE_TO_ONE_BI)
            {
                // 1-1 bidirectional
View Full Code Here

        while (iter.hasNext())
        {
            LifecycleListenerForClass listener = (LifecycleListenerForClass) iter.next();
            if (listener.forClass(pc.getClass()) && listener.getListener() instanceof StoreLifecycleListener)
            {
                ObjectManager om = ObjectManagerHelper.getObjectManager((PersistenceCapable)pc);
                String[] fieldNames = null;
                // PRE_STORE will return the fields being stored (JPOX extension)
                StateManager sm = om.findStateManager(pc);
                fieldNames = sm.getDirtyFieldNames();
                if (fieldNames == null)
                {
                    // Must be persisting so just return all loaded fields
                    fieldNames = sm.getLoadedFieldNames();
View Full Code Here

            // Check for the case of serialised maps, and assign StateManagers to any PC keys/values without
            AbstractMemberMetaData fmd = ownerSM.getClassMetaData().getMetaDataForMember(fieldName);
            if (SCOUtils.mapHasSerialisedKeysAndValues(fmd) &&
                (fmd.getMap().getKeyClassMetaData() != null || fmd.getMap().getValueClassMetaData() != null))
            {
                ObjectManager om = ownerSM.getObjectManager();
                Iterator iter = m.entrySet().iterator();
                while (iter.hasNext())
                {
                    Map.Entry entry = (Map.Entry)iter.next();
                    Object key = entry.getKey();
                    Object value = entry.getValue();
                    if (fmd.getMap().getKeyClassMetaData() != null)
                    {
                        StateManager objSM = om.findStateManager(key);
                        if (objSM == null)
                        {
                            objSM = StateManagerFactory.newStateManagerForEmbedded(om, key, false);
                            objSM.addEmbeddedOwner(ownerSM, fieldNumber);
                        }
                    }
                    if (fmd.getMap().getValueClassMetaData() != null)
                    {
                        StateManager objSM = om.findStateManager(value);
                        if (objSM == null)
                        {
                            objSM = StateManagerFactory.newStateManagerForEmbedded(om, value, false);
                            objSM.addEmbeddedOwner(ownerSM, fieldNumber);
                        }
View Full Code Here

        {
            // Check for the case of serialised PC elements, and assign StateManagers to the elements without
            AbstractMemberMetaData fmd = ownerSM.getClassMetaData().getMetaDataForMember(fieldName);
            if (SCOUtils.collectionHasSerialisedElements(fmd) && fmd.getCollection().getElementClassMetaData() != null)
            {
                ObjectManager om = ownerSM.getObjectManager();
                Iterator iter = c.iterator();
                while (iter.hasNext())
                {
                    Object pc = iter.next();
                    StateManager objSM = om.findStateManager(pc);
                    if (objSM == null)
                    {
                        objSM = StateManagerFactory.newStateManagerForEmbedded(om, pc, false);
                        objSM.addEmbeddedOwner(ownerSM, fieldNumber);
                    }
View Full Code Here

            // Check for the case of serialised maps, and assign StateManagers to any PC keys/values without
            AbstractMemberMetaData fmd = ownerSM.getClassMetaData().getMetaDataForMember(fieldName);
            if (SCOUtils.mapHasSerialisedKeysAndValues(fmd) &&
                (fmd.getMap().getKeyClassMetaData() != null || fmd.getMap().getValueClassMetaData() != null))
            {
                ObjectManager om = ownerSM.getObjectManager();
                Iterator iter = m.entrySet().iterator();
                while (iter.hasNext())
                {
                    Map.Entry entry = (Map.Entry)iter.next();
                    Object key = entry.getKey();
                    Object value = entry.getValue();
                    if (fmd.getMap().getKeyClassMetaData() != null)
                    {
                        StateManager objSM = om.findStateManager(key);
                        if (objSM == null)
                        {
                            objSM = StateManagerFactory.newStateManagerForEmbedded(om, key, false);
                            objSM.addEmbeddedOwner(ownerSM, fieldNumber);
                        }
                    }
                    if (fmd.getMap().getValueClassMetaData() != null)
                    {
                        StateManager objSM = om.findStateManager(value);
                        if (objSM == null)
                        {
                            objSM = StateManagerFactory.newStateManagerForEmbedded(om, value, false);
                            objSM.addEmbeddedOwner(ownerSM, fieldNumber);
                        }
View Full Code Here

TOP

Related Classes of org.jpox.ObjectManager

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.