Package org.exoplatform.services.jcr.impl.clean.rdbms

Examples of org.exoplatform.services.jcr.impl.clean.rdbms.DBCleanerTool


      return dataDirsList;
   }

   private DBCleanerTool getDbCleaner(DataRestoreContext context, Connection jdbcConn) throws BackupException
   {
      DBCleanerTool dbCleaner;

      if (context.getObject(DataRestoreContext.DB_CLEANER) != null)
      {
         dbCleaner = (DBCleanerTool)context.getObject(DataRestoreContext.DB_CLEANER);
      }
View Full Code Here


         // define one common connection for all restores and cleaners for single db case
         Connection jdbcConn = null;
        
         // define one common database cleaner for all restores for single db case
         DBCleanerTool dbCleaner = null;
        
         DatabaseStructureType dbType = JDBCWorkspaceDataContainer.getDatabaseType(wsEntry);

         if (dbType.isShareSameDatasource())
         {
View Full Code Here

      {
         List<DataRestore> restorers = new ArrayList<DataRestore>();
         Map<String, TableTransformationRule> tables = new LinkedHashMap<String, TableTransformationRule>();

         Connection jdbcConn = getJdbcConnection(dataRestoreContext);
         DBCleanerTool dbCleaner = getDbCleaner(dataRestoreContext, jdbcConn);
         File storageDir = getStorageDir(dataRestoreContext);

         TableTransformationRuleGenerator tableTransformationRuleGenerator =
            new TableTransformationRuleGenerator(containerConfig, storageDir);
View Full Code Here

      return dataDirsList;
   }

   private DBCleanerTool getDbCleaner(DataRestoreContext context, Connection jdbcConn) throws BackupException
   {
      DBCleanerTool dbCleaner;

      if (context.getObject(DataRestoreContext.DB_CLEANER) != null)
      {
         dbCleaner = (DBCleanerTool)context.getObject(DataRestoreContext.DB_CLEANER);
      }
View Full Code Here

      {
         List<DataRestore> restorers = new ArrayList<DataRestore>();
         Map<String, TableTransformationRule> tables = new LinkedHashMap<String, TableTransformationRule>();

         Connection jdbcConn = getJdbcConnection(dataRestoreContext);
         DBCleanerTool dbCleaner = getDbCleaner(dataRestoreContext, jdbcConn);
         File storageDir = getStorageDir(dataRestoreContext);

         TableTransformationRuleGenerator tableTransformationRuleGenerator =
            new TableTransformationRuleGenerator(containerConfig, storageDir);
View Full Code Here

      return dataDirsList;
   }

   private DBCleanerTool getDbCleaner(DataRestoreContext context, Connection jdbcConn) throws BackupException
   {
      DBCleanerTool dbCleaner;

      if (context.getObject(DataRestoreContext.DB_CLEANER) != null)
      {
         dbCleaner = (DBCleanerTool)context.getObject(DataRestoreContext.DB_CLEANER);
      }
View Full Code Here

      try
      {
         if (repositoryName.equals("db3"))
         {
            DBCleanerTool repositoryDBCleaner =
               DBCleanService.getRepositoryDBCleaner(conn, repository.getConfiguration());

            // clean and rollback first
            repositoryDBCleaner.clean();

            conn.rollback();

            repositoryDBCleaner.rollback();

            conn.commit();

            checkConent(repositoryName);

            // clean
            repositoryDBCleaner.clean();
            repositoryDBCleaner.commit();

            conn.commit();
         }
         else
         {
            try
            {
               DBCleanerTool repositoryDBCleaner =
                  DBCleanService.getRepositoryDBCleaner(conn, repository.getConfiguration());
               fail("Exception should be thrown");
            }
            catch (DBCleanException e)
            {
            }
         }
      }
      finally
      {
         conn.close();
      }

      if (repositoryName.equals("db3"))
      {
         checkEmptyTables(repositoryName);
      }

      // restore
      restore(repositoryName, bch, backupManagerImpl);
      checkConent(repositoryName);

      // clean every workspace again via DBCleaner
      repository = repositoryService.getRepository(repositoryName);
      for (WorkspaceEntry wsEntry : repository.getConfiguration().getWorkspaceEntries())
      {
         ds =
            (DataSource)new InitialContext().lookup(wsEntry.getContainer().getParameterValue(
               JDBCWorkspaceDataContainer.SOURCE_NAME));

         conn = ds.getConnection();
         conn.setAutoCommit(false);

         DBCleanerTool workspaceDBCleaner = DBCleanService.getWorkspaceDBCleaner(conn, wsEntry);

         try
         {
            // clean and rollback first
            workspaceDBCleaner.clean();

            conn.rollback();

            workspaceDBCleaner.rollback();

            conn.commit();

            checkConent(repositoryName);

            // clean
            workspaceDBCleaner.clean();
            workspaceDBCleaner.commit();

            conn.commit();
         }
         finally
         {
View Full Code Here

      {
         List<DataRestore> restorers = new ArrayList<DataRestore>();
         Map<String, TableTransformationRule> tables = new LinkedHashMap<String, TableTransformationRule>();

         Connection jdbcConn = getJdbcConnection(dataRestoreContext);
         DBCleanerTool dbCleaner = getDbCleaner(dataRestoreContext, jdbcConn);
         File storageDir = getStorageDir(dataRestoreContext);

         TableTransformationRuleGenerator tableTransformationRuleGenerator =
            new TableTransformationRuleGenerator(containerConfig, storageDir);
View Full Code Here

      return dataDirsList;
   }

   private DBCleanerTool getDbCleaner(DataRestoreContext context, Connection jdbcConn) throws BackupException
   {
      DBCleanerTool dbCleaner;

      if (context.getObject(DataRestoreContext.DB_CLEANER) != null)
      {
         dbCleaner = (DBCleanerTool)context.getObject(DataRestoreContext.DB_CLEANER);
      }
View Full Code Here

      try
      {
         if (repositoryName.equals("db3"))
         {
            DBCleanerTool repositoryDBCleaner =
               DBCleanService.getRepositoryDBCleaner(conn, repository.getConfiguration());

            // clean and rollback first
            repositoryDBCleaner.clean();

            conn.rollback();

            repositoryDBCleaner.rollback();

            conn.commit();

            checkConent(repositoryName);

            // clean
            repositoryDBCleaner.clean();
            repositoryDBCleaner.commit();

            conn.commit();
         }
         else
         {
            try
            {
               DBCleanerTool repositoryDBCleaner =
                  DBCleanService.getRepositoryDBCleaner(conn, repository.getConfiguration());
               fail("Exception should be thrown");
            }
            catch (DBCleanException e)
            {
            }
         }
      }
      finally
      {
         conn.close();
      }

      if (repositoryName.equals("db3"))
      {
         checkEmptyTables(repositoryName);
      }

      // restore
      restore(repositoryName, bch, backupManagerImpl);
      checkConent(repositoryName);

      // clean every workspace again via DBCleaner
      repository = repositoryService.getRepository(repositoryName);
      for (WorkspaceEntry wsEntry : repository.getConfiguration().getWorkspaceEntries())
      {
         ds =
            (DataSource)new InitialContext().lookup(wsEntry.getContainer().getParameterValue(
               JDBCWorkspaceDataContainer.SOURCE_NAME));

         conn = ds.getConnection();
         conn.setAutoCommit(false);

         DBCleanerTool workspaceDBCleaner = DBCleanService.getWorkspaceDBCleaner(conn, wsEntry);

         try
         {
            // clean and rollback first
            workspaceDBCleaner.clean();

            conn.rollback();

            workspaceDBCleaner.rollback();

            conn.commit();

            checkConent(repositoryName);

            // clean
            workspaceDBCleaner.clean();
            workspaceDBCleaner.commit();

            conn.commit();
         }
         finally
         {
View Full Code Here

TOP

Related Classes of org.exoplatform.services.jcr.impl.clean.rdbms.DBCleanerTool

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.