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

Examples of org.exoplatform.services.jcr.impl.dataflow.serialization.ZipObjectWriter


   /**
    * Backups data to define file.
    */
   protected void doBackup(File backupFile) throws BackupException
   {
      ZipObjectWriter out = null;
      try
      {
         out = new ZipObjectWriter(PrivilegedFileHelper.zipOutputStream(backupFile));
         quotaPersister.backupWorkspaceData(rName, wsName, out);
      }
      catch (IOException e)
      {
         throw new BackupException(e);
      }
      finally
      {
         if (out != null)
         {
            try
            {
               out.close();
            }
            catch (IOException e)
            {
               LOG.error("Can't close output stream", e);
            }
View Full Code Here


    */
   public static void backup(File storageDir, Connection jdbcConn, Map<String, String> scripts) throws BackupException
   {
      Exception exc = null;

      ZipObjectWriter contentWriter = null;
      ZipObjectWriter contentLenWriter = null;

      try
      {
         contentWriter =
            new ZipObjectWriter(PrivilegedFileHelper.zipOutputStream(new File(storageDir, CONTENT_ZIP_FILE)));

         contentLenWriter =
            new ZipObjectWriter(PrivilegedFileHelper.zipOutputStream(new File(storageDir, CONTENT_LEN_ZIP_FILE)));

         for (Entry<String, String> entry : scripts.entrySet())
         {
            dumpTable(jdbcConn, entry.getKey(), entry.getValue(), storageDir, contentWriter, contentLenWriter);
         }
      }
      catch (IOException e)
      {
         exc = e;
         throw new BackupException(e);
      }
      catch (SQLException e)
      {
         exc = e;
         throw new BackupException("SQL Exception: " + JDBCUtils.getFullMessage(e), e);
      }
      finally
      {
         if (jdbcConn != null)
         {
            try
            {
               jdbcConn.close();
            }
            catch (SQLException e)
            {
               if (exc != null)
               {
                  LOG.error("Can't close connection", e);
                  throw new BackupException(exc);
               }
               else
               {
                  throw new BackupException(e);
               }
            }
         }

         try
         {
            if (contentWriter != null)
            {
               contentWriter.close();
            }

            if (contentLenWriter != null)
            {
               contentLenWriter.close();
            }
         }
         catch (IOException e)
         {
            if (exc != null)
View Full Code Here

TOP

Related Classes of org.exoplatform.services.jcr.impl.dataflow.serialization.ZipObjectWriter

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.