Examples of CacheId


Examples of org.eclipse.persistence.internal.identitymaps.CacheId

        DOMRecord row = new DOMRecord((Element)node);
        row.setSession(session);
        Object pk = xmlDescriptor.getObjectBuilder().extractPrimaryKeyFromRow(row, session);
        if (xmlDescriptor.shouldPreserveDocument() || xmlDescriptor.getPrimaryKeyFieldNames().size() > 0) {
            if ((pk == null) || (((CacheId)pk).getPrimaryKey().length == 0)) {
                pk = new CacheId(new Object[]{ new WeakObjectWrapper(obj) });
            }
            CacheKey key = session.getIdentityMapAccessorInstance().acquireDeferredLock(pk, xmlDescriptor.getJavaClass(), xmlDescriptor);
            if ((xmlDescriptor).shouldPreserveDocument()) {
                key.setRecord(row);
            }
View Full Code Here

Examples of org.eclipse.persistence.internal.identitymaps.CacheId

        AbstractSession session = context.getSession(obj);
        XMLDescriptor xmlDescriptor = (XMLDescriptor)session.getDescriptor(obj);
        if(xmlDescriptor.shouldPreserveDocument()) {
            Object pk = xmlDescriptor.getObjectBuilder().extractPrimaryKeyFromObject(obj, session);
            if ((pk == null) || (pk instanceof CacheId) && (((CacheId)pk).getPrimaryKey().length == 0)) {
                pk = new CacheId(new Object[]{ new WeakObjectWrapper(obj) });
            }
            CacheKey cacheKey = session.getIdentityMapAccessorInstance().getCacheKeyForObject(pk, xmlDescriptor.getJavaClass(), xmlDescriptor,false);
            if(cacheKey != null && cacheKey.getRecord() != null) {
                return ((DOMRecord)cacheKey.getRecord()).getDOM();
            }
View Full Code Here

Examples of org.eclipse.persistence.internal.identitymaps.CacheId

            if (getDescriptor().getCacheKeyType() == CacheKeyType.ID_VALUE) {
                return fieldValue;
            }
            primaryKey[index] = fieldValue;
        }
        return new CacheId(primaryKey);
    }
View Full Code Here

Examples of org.eclipse.persistence.internal.identitymaps.CacheId

                    primaryKey = null;
                } else {
                    primaryKey = ((List)id).get(0);
                }
            } else {
                primaryKey = new CacheId(((List)id).toArray());
            }
        } else if (id instanceof CacheId) {
            primaryKey = id;
        } else {
            CMPPolicy policy = descriptor.getCMPPolicy();
View Full Code Here

Examples of org.teiid.dqp.internal.process.SessionAwareCache.CacheID

  @Test
  public void testSessionSpecfic() {
   
    SessionAwareCache<Cachable> cache = new SessionAwareCache<Cachable>();
   
    CacheID id = new CacheID(buildWorkContext(), new ParseInfo(), "SELECT * FROM FOO");
   
    Cachable result = Mockito.mock(Cachable.class);
   
    id = new CacheID(buildWorkContext(), new ParseInfo(), "SELECT * FROM FOO");
    cache.put(id, Determinism.SESSION_DETERMINISTIC, result, null);
   
    // make sure that in the case of session specific; we do not call prepare
    // as session is local only call for distributed
    Mockito.verify(result, times(0)).prepare((Cache)anyObject(), (BufferManager)anyObject());
View Full Code Here

Examples of org.teiid.dqp.internal.process.SessionAwareCache.CacheID

  @Test
  public void testUserSpecfic() {
   
    SessionAwareCache<Cachable> cache = new SessionAwareCache<Cachable>();
   
    CacheID id = new CacheID(buildWorkContext(), new ParseInfo(), "SELECT * FROM FOO");
   
    Cachable result = Mockito.mock(Cachable.class);
    Mockito.stub(result.prepare((Cache)anyObject(), (BufferManager)anyObject())).toReturn(true);
    Mockito.stub(result.restore((Cache)anyObject(), (BufferManager)anyObject())).toReturn(true);
       
    cache.put(id, Determinism.USER_DETERMINISTIC, result, null);
   
    // make sure that in the case of session specific; we do not call prepare
    // as session is local only call for distributed
    Mockito.verify(result, times(1)).prepare((Cache)anyObject(), (BufferManager)anyObject());
   
    id = new CacheID(buildWorkContext(), new ParseInfo(), "SELECT * FROM FOO");
   
    Object c = cache.get(id);
   
    Mockito.verify(result, times(1)).restore((Cache)anyObject(), (BufferManager)anyObject());   
   
View Full Code Here

Examples of org.teiid.dqp.internal.process.SessionAwareCache.CacheID

  @Test
  public void testNoScope() {
   
    SessionAwareCache<Cachable> cache = new SessionAwareCache<Cachable>();
   
    CacheID id = new CacheID(buildWorkContext(), new ParseInfo(), "SELECT * FROM FOO");
   
    Cachable result = Mockito.mock(Cachable.class);
    Mockito.stub(result.prepare((Cache)anyObject(), (BufferManager)anyObject())).toReturn(true);
    Mockito.stub(result.restore((Cache)anyObject(), (BufferManager)anyObject())).toReturn(true);   
   
    cache.put(id, Determinism.VDB_DETERMINISTIC, result, null);
   
    // make sure that in the case of session specific; we do not call prepare
    // as session is local only call for distributed
    Mockito.verify(result, times(1)).prepare((Cache)anyObject(), (BufferManager)anyObject());
   
    id = new CacheID(buildWorkContext(), new ParseInfo(), "SELECT * FROM FOO");
   
    Object c = cache.get(id);
   
    Mockito.verify(result, times(1)).restore((Cache)anyObject(), (BufferManager)anyObject());   
   
View Full Code Here

Examples of org.teiid.dqp.internal.process.SessionAwareCache.CacheID

  @Test
  public void testVDBRemoval() {
   
    SessionAwareCache<Cachable> cache = new SessionAwareCache<Cachable>();
   
    CacheID id = new CacheID(buildWorkContext(), new ParseInfo(), "SELECT * FROM FOO");
   
    Cachable result = Mockito.mock(Cachable.class);
    Mockito.stub(result.prepare((Cache)anyObject(), (BufferManager)anyObject())).toReturn(true);
    Mockito.stub(result.restore((Cache)anyObject(), (BufferManager)anyObject())).toReturn(true);   
   
    id = new CacheID(buildWorkContext(), new ParseInfo(), "SELECT * FROM FOO");
    cache.put(id, Determinism.VDB_DETERMINISTIC, result, null);
   
    Object c = cache.get(id);
   
    assertTrue(result==c);
View Full Code Here

Examples of org.teiid.dqp.internal.process.SessionAwareCache.CacheID

   
    //====Tests====//
    @Test public void testPutPreparedPlan(){
      SessionAwareCache<PreparedPlan> cache = new SessionAwareCache<PreparedPlan>();
     
      CacheID id = new CacheID(token, pi, EXAMPLE_QUERY + 1);
     
      //No PreparedPlan at the begining
      assertNull(cache.get(id));
      //create one
      cache.put(id, Determinism.SESSION_DETERMINISTIC, new PreparedPlan(), null);
View Full Code Here

Examples of org.teiid.dqp.internal.process.SessionAwareCache.CacheID

      SessionAwareCache<PreparedPlan> cache = new SessionAwareCache<PreparedPlan>();
      helpPutPreparedPlans(cache, token, 0, 10);
      helpPutPreparedPlans(cache, token2, 0, 15);
     
      //read an entry for session2 (token2)
      PreparedPlan pPlan = cache.get(new CacheID(token2, pi, EXAMPLE_QUERY + 12));
      assertNotNull("Unable to get prepared plan from cache", pPlan); //$NON-NLS-1$
      assertEquals("Error getting plan from cache", new RelationalPlan(new ProjectNode(12)).toString(), pPlan.getPlan().toString()); //$NON-NLS-1$
      assertEquals("Error getting command from cache", EXAMPLE_QUERY + 12, pPlan.getCommand().toString()); //$NON-NLS-1$
      assertNotNull("Error getting plan description from cache", pPlan.getAnalysisRecord()); //$NON-NLS-1$
      assertEquals("Error gettting reference from cache", new Reference(1), pPlan.getReferences().get(0)); //$NON-NLS-1$
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.