Package org.datanucleus.store

Examples of org.datanucleus.store.ExecutionContext


        {
            oldValue = null;
            exists = false;
        }

        ExecutionContext ec = sm.getExecutionContext();
        if (exists)
        {
            removeInternal(sm, key);
        }

        MapMetaData mapmd = ownerMemberMetaData.getMap();
        ApiAdapter api = ec.getApiAdapter();
        if (mapmd.isDependentKey() && !mapmd.isEmbeddedKey() && api.isPersistable(key))
        {
            // Delete the key if it is dependent
            ec.deleteObjectInternal(key);
        }

        if (mapmd.isDependentValue() && !mapmd.isEmbeddedValue() && api.isPersistable(oldValue))
        {
            if (!containsValue(sm, oldValue))
            {
                // Delete the value if it is dependent and is not keyed by another key
                ec.deleteObjectInternal(oldValue);
            }
        }

        return oldValue;
    }
View Full Code Here


        super(ownerSM, fieldName);

        // Set up our "delegate"
        this.delegate = new java.util.Hashtable();

        ExecutionContext ec = ownerSM.getExecutionContext();
        AbstractMemberMetaData fmd = ownerSM.getClassMetaData().getMetaDataForMember(fieldName);
        fieldNumber = fmd.getAbsoluteFieldNumber();
        queued = ec.isDelayDatastoreOperationsEnabled();
        useCache = SCOUtils.useContainerCache(ownerSM, fieldName);

        if (!SCOUtils.mapHasSerialisedKeysAndValues(fmd) &&
                fmd.getPersistenceModifier() == FieldPersistenceModifier.PERSISTENT)
        {
            ClassLoaderResolver clr = ec.getClassLoaderResolver();
            this.backingStore = (MapStore)
            ((BackedSCOStoreManager)ec.getStoreManager()).getBackingStoreForField(clr, fmd, java.util.Hashtable.class);
        }

        if (NucleusLogger.PERSISTENCE.isDebugEnabled())
        {
            NucleusLogger.PERSISTENCE.debug(SCOUtils.getContainerInfoMessage(ownerSM, fieldName, this,
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().keyIsPersistent() || fmd.getMap().valueIsPersistent()))
            {
                ExecutionContext ec = ownerSM.getExecutionContext();
                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().keyIsPersistent())
                    {
                        ObjectProvider objSM = ec.findObjectProvider(key);
                        if (objSM == null)
                        {
                            objSM = ObjectProviderFactory.newForEmbedded(ec, key, false, ownerSM, fieldNumber);
                        }
                    }
                    if (fmd.getMap().valueIsPersistent())
                    {
                        ObjectProvider objSM = ec.findObjectProvider(value);
                        if (objSM == null)
                        {
                            objSM = ObjectProviderFactory.newForEmbedded(ec,  value, false, ownerSM, fieldNumber);
                        }
                    }
View Full Code Here

    public boolean add(ObjectProvider sm, Object element, int size)
    {
        validateElementForWriting(sm, element, null);

        boolean modified = false;
        ExecutionContext ec = sm.getExecutionContext();

        try
        {
            ManagedConnection mconn = storeMgr.getConnection(ec);
            try
View Full Code Here

        while (iter.hasNext())
        {
            validateElementForWriting(sm, iter.next(), null);
        }

        ExecutionContext ec = sm.getExecutionContext();
        ManagedConnection mconn = storeMgr.getConnection(ec);
        try
        {
            // Loop through all elements to be added
            iter = elements.iterator();
View Full Code Here

            NucleusLogger.DATASTORE.debug("Attempt to remove element=" + StringUtils.toJVMIDString(element) + " but doesn't exist in this Set.");
            return false;
        }

        Object elementToRemove = element;
        ExecutionContext ec = sm.getExecutionContext();
        if (ec.getApiAdapter().isDetached(element))
        {
            // Element passed in is detached so find attached version (DON'T attach this object)
            elementToRemove = ec.findObject(ec.getApiAdapter().getIdForObject(element), true, false,
                element.getClass().getName());
        }

        boolean modified = getSpecialization().remove(sm, elementToRemove, size, this);
        CollectionMetaData collmd = ownerMemberMetaData.getCollection();
View Full Code Here

            }
        }

        try
        {
            ExecutionContext ec = sm.getExecutionContext();
            ManagedConnection mconn = storeMgr.getConnection(ec);
            try
            {
                Object element = null;
                iter = elements.iterator();
View Full Code Here

        {
            tx = new TransactionImpl(this);
        }

        // Notify ObjectManager/StoreManager when tx.begin(), commit(), rollback() called
        final ExecutionContext ec = this;
        tx.bindTransactionEventListener(new TransactionEventListener()
        {
            public void transactionStarted()
            {
                getStoreManager().transactionStarted(ec);
View Full Code Here

            foundStateManager = null;
            // We call "ObjectManagerHelper.getObjectManager(pc)".
            // This then calls "JDOHelper.getPersistenceManager(pc)".
            // Which calls "StateManager.getPersistenceManager(pc)".
            // That then calls "hereIsStateManager(sm, pc)" which sets "foundStateManager".
            ExecutionContext ec = getApiAdapter().getExecutionContext(pc);
            if (ec != null && this != ec)
            {
                throw new NucleusUserException(LOCALISER.msg("010007", getApiAdapter().getIdForObject(pc)));
            }
            sm = foundStateManager;
View Full Code Here

        Object id = null; // Id of the object that was persisted during this process (if any)
        try
        {
            clr.setPrimary(obj.getClass().getClassLoader());
            assertClassPersistable(obj.getClass());
            ExecutionContext ec = api.getExecutionContext(obj);
            if (ec != null && ec != this)
            {
                // Object managed by a different manager
                throw new NucleusUserException(LOCALISER.msg("010007", obj));
            }
View Full Code Here

TOP

Related Classes of org.datanucleus.store.ExecutionContext

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.