Package org.exoplatform.services.jcr.impl.dataflow.persistent

Examples of org.exoplatform.services.jcr.impl.dataflow.persistent.CacheableWorkspaceDataManager


   public void setUp() throws Exception
   {
      super.setUp();

      WorkspaceContainerFacade wsc = repository.getWorkspaceContainer(session.getWorkspace().getName());
      CacheableWorkspaceDataManager dm =
         (CacheableWorkspaceDataManager)wsc.getComponent(CacheableWorkspaceDataManager.class);
      dm.addItemPersistenceListener(this);
   }
View Full Code Here


   {
      MyWorkspaceStorageConnection con = new MyWorkspaceStorageConnection();
      WorkspaceDataContainer wdc = new MyWorkspaceDataContainer(con);
      WorkspaceContainerFacade wsc = repository.getWorkspaceContainer("ws");
      WorkspaceEntry wconf = (WorkspaceEntry)wsc.getComponent(WorkspaceEntry.class);
      final CacheableWorkspaceDataManager cwdm =
         new CacheableWorkspaceDataManager(wconf, wdc, getCacheImpl(), new SystemDataContainerHolder(wdc));
      String idNode = "foo1";
      executeConcurrentReadNWrite(con, cwdm, Mode.READ_FIRST, idNode);
      assertNotNull(cwdm.getItemData(idNode));
      idNode = "foo2";
      executeConcurrentReadNWrite(con, cwdm, Mode.WRITE_FIRST, idNode);
      assertNotNull(cwdm.getItemData(idNode));
   }
View Full Code Here

   public void setUp() throws Exception
   {
      super.setUp();

      WorkspaceContainerFacade wsc = repository.getWorkspaceContainer(session.getWorkspace().getName());
      CacheableWorkspaceDataManager dm =
         (CacheableWorkspaceDataManager)wsc.getComponent(CacheableWorkspaceDataManager.class);
      dm.addItemPersistenceListener(this);
   }
View Full Code Here

      root.getNode("childNodeDefNode").remove();
      session.save();

      // Unregister the listener in order to make it available to the GC
      WorkspaceContainerFacade wsc = repository.getWorkspaceContainer(session.getWorkspace().getName());
      CacheableWorkspaceDataManager dm =
         (CacheableWorkspaceDataManager)wsc.getComponent(CacheableWorkspaceDataManager.class);
      dm.removeItemPersistenceListener(this);

      super.tearDown();
   }
View Full Code Here

      // remove lock properties from JCR tables
      JDBCWorkspaceDataContainer container =
         (JDBCWorkspaceDataContainer)repository.getWorkspaceContainer("ws").getComponent(
            JDBCWorkspaceDataContainer.class);
      CacheableWorkspaceDataManager dataManager =
         (CacheableWorkspaceDataManager)repository.getWorkspaceContainer("ws").getComponent(
            CacheableWorkspaceDataManager.class);

      System.setProperty(AbstractCacheableLockManager.LOCKS_FORCE_REMOVE, "true");
      try
      {
         // Remove info from the db
         container.start();
         // Remove info from the cache
         dataManager.start();
      }
      finally
      {
         System.setProperty(AbstractCacheableLockManager.LOCKS_FORCE_REMOVE, "false");
      }
View Full Code Here

   {
      MyWorkspaceStorageConnection con = new MyWorkspaceStorageConnection();
      WorkspaceDataContainer wdc = new MyWorkspaceDataContainer(con);
      WorkspaceContainerFacade wsc = repository.getWorkspaceContainer("ws");
      WorkspaceEntry wconf = (WorkspaceEntry)wsc.getComponent(WorkspaceEntry.class);
      final CacheableWorkspaceDataManager cwdm =
         new CacheableWorkspaceDataManager(wconf, wdc, getCacheImpl(), new SystemDataContainerHolder(wdc));
      String idNode = "foo1";
      executeConcurrentReadNWrite(con, cwdm, Mode.READ_FIRST, idNode);
      assertNotNull(cwdm.getItemData(idNode));
      idNode = "foo2";
      executeConcurrentReadNWrite(con, cwdm, Mode.WRITE_FIRST, idNode);
      assertNotNull(cwdm.getItemData(idNode));
   }
View Full Code Here

   {
      MyWorkspaceStorageConnection con = new MyWorkspaceStorageConnection();
      WorkspaceDataContainer wdc = new MyWorkspaceDataContainer(con);
      WorkspaceContainerFacade wsc = repository.getWorkspaceContainer("ws");
      WorkspaceEntry wconf = (WorkspaceEntry)wsc.getComponent(WorkspaceEntry.class);
      final CacheableWorkspaceDataManager cwdm =
         new CacheableWorkspaceDataManager(wconf, wdc, getCacheImpl(), new SystemDataContainerHolder(wdc));
      final NodeData parentNode =
         new PersistedNodeData("testGetChildNodesCount", QPath.makeChildPath(Constants.ROOT_PATH, new InternalQName(null,
            "getChildNodesCount")), null, 0, 1, null, null, null);
      assertEquals(0, con.getChildNodesCountCalls.get());
      int result = cwdm.getChildNodesCount(parentNode);
      assertEquals(0, result);
      assertEquals(1, con.getChildNodesCountCalls.get());
      result = cwdm.getChildNodesCount(parentNode);
      assertEquals(0, result);
      assertEquals(1, con.getChildNodesCountCalls.get());
      PlainChangesLog chlog = new PlainChangesLogImpl();
      chlog.add(ItemState.createAddedState(new PersistedNodeData("id-node" + parentNode.getIdentifier(), QPath
         .makeChildPath(parentNode.getQPath(), new InternalQName(null, "node")), parentNode.getIdentifier(), 1, 0,
         Constants.NT_UNSTRUCTURED, new InternalQName[0], null)));
      cwdm.save(new TransactionChangesLog(chlog));
      result = cwdm.getChildNodesCount(parentNode);
      assertEquals(1, result);
      assertEquals(2, con.getChildNodesCountCalls.get());
   }
View Full Code Here

      MyWorkspaceStorageConnection con = new MyWorkspaceStorageConnection();
      con.childNodesCount = 1;
      WorkspaceDataContainer wdc = new MyWorkspaceDataContainer(con);
      WorkspaceContainerFacade wsc = repository.getWorkspaceContainer("ws");
      WorkspaceEntry wconf = (WorkspaceEntry)wsc.getComponent(WorkspaceEntry.class);
      final CacheableWorkspaceDataManager cwdm =
         new CacheableWorkspaceDataManager(wconf, wdc, getCacheImpl(), new SystemDataContainerHolder(wdc));
      final NodeData parentNode =
         new PersistedNodeData("testGetChildNodesCount2", QPath.makeChildPath(Constants.ROOT_PATH, new InternalQName(null,
            "getChildNodesCount")), null, 0, 1, null, null, null);
      assertEquals(0, con.getChildNodesCountCalls.get());
      int result = cwdm.getChildNodesCount(parentNode);
      assertEquals(1, result);
      assertEquals(1, con.getChildNodesCountCalls.get());
      result = cwdm.getChildNodesCount(parentNode);
      assertEquals(1, result);
      assertEquals(1, con.getChildNodesCountCalls.get());
      PlainChangesLog chlog = new PlainChangesLogImpl();
      chlog.add(ItemState.createAddedState(new PersistedNodeData("id-node" + parentNode.getIdentifier(), QPath
         .makeChildPath(parentNode.getQPath(), new InternalQName(null, "node")), parentNode.getIdentifier(), 1, 0,
         Constants.NT_UNSTRUCTURED, new InternalQName[0], null)));
      cwdm.save(new TransactionChangesLog(chlog));
      result = cwdm.getChildNodesCount(parentNode);
      assertEquals(2, result);
      assertEquals(2, con.getChildNodesCountCalls.get());
   }
View Full Code Here

      // Clear cache
      ManageableRepository repository = repositoryService.getDefaultRepository();
      WorkspaceContainerFacade wsc = repository.getWorkspaceContainer("ws");

      CacheableWorkspaceDataManager dm =
         (CacheableWorkspaceDataManager)wsc.getComponent(CacheableWorkspaceDataManager.class);
      WorkspaceStorageCache cache = dm.getCache();
      if (cache.isEnabled() && cache instanceof Backupable)
      {
         ((Backupable)cache).clean();
      }
View Full Code Here

   public void setUp() throws Exception
   {
      super.setUp();

      WorkspaceContainerFacade wsc = repository.getWorkspaceContainer(session.getWorkspace().getName());
      CacheableWorkspaceDataManager dm =
         (CacheableWorkspaceDataManager)wsc.getComponent(CacheableWorkspaceDataManager.class);
      dm.addItemPersistenceListener(this);
   }
View Full Code Here

TOP

Related Classes of org.exoplatform.services.jcr.impl.dataflow.persistent.CacheableWorkspaceDataManager

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.