Package org.exoplatform.services.jcr.impl.core.query

Examples of org.exoplatform.services.jcr.impl.core.query.IndexRecovery


   private boolean recoveryIndexFromCoordinator() throws FileNotFoundException, RepositoryException, IOException,
      SuspendException
   {
      try
      {
         IndexRecovery indexRecovery = handler.getContext().getIndexRecovery();
         // check if index not ready
         if (!indexRecovery.checkIndexReady())
         {
            return false;
         }
         indexRecovery.setIndexOffline();

         File indexDirectory = new File(handler.getContext().getIndexDirectory());
         for (String filePath : indexRecovery.getIndexList())
         {
            File indexFile = new File(indexDirectory, filePath);
            if (!PrivilegedFileHelper.exists(indexFile.getParentFile()))
            {
               PrivilegedFileHelper.mkdirs(indexFile.getParentFile());
            }

            // transfer file
            InputStream in = indexRecovery.getIndexFile(filePath);
            OutputStream out = PrivilegedFileHelper.fileOutputStream(indexFile);
            try
            {
               byte[] buf = new byte[2048];
               int len;

               while ((len = in.read(buf)) > 0)
               {
                  out.write(buf, 0, len);
               }
            }
            finally
            {
               if (in != null)
               {
                  in.close();
               }

               if (out != null)
               {
                  out.close();
               }
            }

            indexRecovery.setIndexOnline();
         }
      }
      finally
      {
      }
View Full Code Here


   private boolean recoveryIndexFromCoordinator() throws FileNotFoundException, RepositoryException, IOException,
      SuspendException
   {
      try
      {
         IndexRecovery indexRecovery = handler.getContext().getIndexRecovery();
         // check if index not ready
         if (!indexRecovery.checkIndexReady())
         {
            return false;
         }
         indexRecovery.setIndexOffline();

         File indexDirectory = new File(handler.getContext().getIndexDirectory());
         for (String filePath : indexRecovery.getIndexList())
         {
            File indexFile = new File(indexDirectory, filePath);
            if (!PrivilegedFileHelper.exists(indexFile.getParentFile()))
            {
               PrivilegedFileHelper.mkdirs(indexFile.getParentFile());
            }

            // transfer file
            InputStream in = indexRecovery.getIndexFile(filePath);
            OutputStream out = PrivilegedFileHelper.fileOutputStream(indexFile);
            try
            {
               byte[] buf = new byte[2048];
               int len;

               while ((len = in.read(buf)) > 0)
               {
                  out.write(buf, 0, len);
               }
            }
            finally
            {
               if (in != null)
               {
                  in.close();
               }

               if (out != null)
               {
                  out.close();
               }
            }

            indexRecovery.setIndexOnline();
         }
      }
      finally
      {
      }
View Full Code Here

   private boolean recoveryIndexFromCoordinator() throws FileNotFoundException, RepositoryException, IOException,
      SuspendException
   {
      try
      {
         IndexRecovery indexRecovery = handler.getContext().getIndexRecovery();
         // check if index not ready
         if (!indexRecovery.checkIndexReady())
         {
            return false;
         }
         indexRecovery.setIndexOffline();

         File indexDirectory = new File(handler.getContext().getIndexDirectory());
         for (String filePath : indexRecovery.getIndexList())
         {
            File indexFile = new File(indexDirectory, filePath);
            if (!PrivilegedFileHelper.exists(indexFile.getParentFile()))
            {
               PrivilegedFileHelper.mkdirs(indexFile.getParentFile());
            }

            // transfer file
            InputStream in = indexRecovery.getIndexFile(filePath);
            OutputStream out = PrivilegedFileHelper.fileOutputStream(indexFile);
            try
            {
               byte[] buf = new byte[2048];
               int len;

               while ((len = in.read(buf)) > 0)
               {
                  out.write(buf, 0, len);
               }
            }
            finally
            {
               if (in != null)
               {
                  in.close();
               }

               if (out != null)
               {
                  out.close();
               }
            }

            indexRecovery.setIndexOnline();
         }
      }
      finally
      {
      }
View Full Code Here

   private boolean recoveryIndexFromCoordinator() throws FileNotFoundException, RepositoryException, IOException,
      SuspendException
   {
      try
      {
         IndexRecovery indexRecovery = handler.getContext().getIndexRecovery();
         // check if index not ready
         if (!indexRecovery.checkIndexReady())
         {
            return false;
         }
         indexRecovery.setIndexOffline();

         File indexDirectory = new File(handler.getContext().getIndexDirectory());
         for (String filePath : indexRecovery.getIndexList())
         {
            File indexFile = new File(indexDirectory, filePath);
            if (!PrivilegedFileHelper.exists(indexFile.getParentFile()))
            {
               PrivilegedFileHelper.mkdirs(indexFile.getParentFile());
            }

            // transfer file
            InputStream in = indexRecovery.getIndexFile(filePath);
            OutputStream out = PrivilegedFileHelper.fileOutputStream(indexFile);
            try
            {
               byte[] buf = new byte[2048];
               int len;

               while ((len = in.read(buf)) > 0)
               {
                  out.write(buf, 0, len);
               }
            }
            finally
            {
               if (in != null)
               {
                  in.close();
               }

               if (out != null)
               {
                  out.close();
               }
            }

            indexRecovery.setIndexOnline();
         }
      }
      finally
      {
      }
View Full Code Here

   private boolean recoveryIndexFromCoordinator() throws FileNotFoundException, RepositoryException, IOException,
      SuspendException
   {
      try
      {
         IndexRecovery indexRecovery = handler.getContext().getIndexRecovery();
         // check if index not ready
         if (!indexRecovery.checkIndexReady())
         {
            return false;
         }
         indexRecovery.setIndexOffline();

         File indexDirectory = new File(handler.getContext().getIndexDirectory());
         for (String filePath : indexRecovery.getIndexList())
         {
            File indexFile = new File(indexDirectory, filePath);
            if (!PrivilegedFileHelper.exists(indexFile.getParentFile()))
            {
               PrivilegedFileHelper.mkdirs(indexFile.getParentFile());
            }

            // transfer file
            InputStream in = indexRecovery.getIndexFile(filePath);
            OutputStream out = PrivilegedFileHelper.fileOutputStream(indexFile);
            try
            {
               byte[] buf = new byte[2048];
               int len;

               while ((len = in.read(buf)) > 0)
               {
                  out.write(buf, 0, len);
               }
            }
            finally
            {
               if (in != null)
               {
                  in.close();
               }

               if (out != null)
               {
                  out.close();
               }
            }

            indexRecovery.setIndexOnline();
         }
      }
      finally
      {
      }
View Full Code Here

   private boolean recoveryIndexFromCoordinator() throws FileNotFoundException, RepositoryException, IOException,
      SuspendException
   {
      try
      {
         IndexRecovery indexRecovery = handler.getContext().getIndexRecovery();
         // check if index not ready
         if (!indexRecovery.checkIndexReady())
         {
            return false;
         }
         indexRecovery.setIndexOffline();

         File indexDirectory = new File(handler.getContext().getIndexDirectory());
         for (String filePath : indexRecovery.getIndexList())
         {
            File indexFile = new File(indexDirectory, filePath);
            if (!PrivilegedFileHelper.exists(indexFile.getParentFile()))
            {
               PrivilegedFileHelper.mkdirs(indexFile.getParentFile());
            }

            // transfer file
            InputStream in = indexRecovery.getIndexFile(filePath);
            OutputStream out = PrivilegedFileHelper.fileOutputStream(indexFile);
            try
            {
               byte[] buf = new byte[2048];
               int len;

               while ((len = in.read(buf)) > 0)
               {
                  out.write(buf, 0, len);
               }
            }
            finally
            {
               if (in != null)
               {
                  in.close();
               }

               if (out != null)
               {
                  out.close();
               }
            }

            indexRecovery.setIndexOnline();
         }
      }
      finally
      {
      }
View Full Code Here

   {
      File indexDirectory = new File(handler.getContext().getIndexDirectory());

      try
      {
         IndexRecovery indexRecovery = handler.getContext().getIndexRecovery();
         // check if index not ready
         if (!indexRecovery.checkIndexReady())
         {
            return false;
         }
         indexRecovery.setIndexOffline();

         for (String filePath : indexRecovery.getIndexList())
         {
            File indexFile = new File(indexDirectory, filePath);
            if (!PrivilegedFileHelper.exists(indexFile.getParentFile()))
            {
               PrivilegedFileHelper.mkdirs(indexFile.getParentFile());
            }

            // transfer file
            InputStream in = indexRecovery.getIndexFile(filePath);
            OutputStream out = PrivilegedFileHelper.fileOutputStream(indexFile);
            try
            {
               DirectoryHelper.transfer(in, out);
            }
            finally
            {
               DirectoryHelper.safeClose(in);
               DirectoryHelper.safeClose(out);
            }

            indexRecovery.setIndexOnline();
         }

         return true;
      }
      catch (RepositoryException e)
View Full Code Here

   private boolean recoveryIndexFromCoordinator() throws FileNotFoundException, RepositoryException, IOException,
      SuspendException
   {
      try
      {
         IndexRecovery indexRecovery = handler.getContext().getIndexRecovery();
         // check if index not ready
         if (!indexRecovery.checkIndexReady())
         {
            return false;
         }
         indexRecovery.setIndexOffline();

         File indexDirectory = new File(handler.getContext().getIndexDirectory());
         for (String filePath : indexRecovery.getIndexList())
         {
            File indexFile = new File(indexDirectory, filePath);
            if (!PrivilegedFileHelper.exists(indexFile.getParentFile()))
            {
               PrivilegedFileHelper.mkdirs(indexFile.getParentFile());
            }

            // transfer file
            InputStream in = indexRecovery.getIndexFile(filePath);
            OutputStream out = PrivilegedFileHelper.fileOutputStream(indexFile);
            try
            {
               byte[] buf = new byte[2048];
               int len;

               while ((len = in.read(buf)) > 0)
               {
                  out.write(buf, 0, len);
               }
            }
            finally
            {
               if (in != null)
               {
                  in.close();
               }

               if (out != null)
               {
                  out.close();
               }
            }

            indexRecovery.setIndexOnline();
         }
      }
      finally
      {
      }
View Full Code Here

   private boolean recoveryIndexFromCoordinator() throws FileNotFoundException, RepositoryException, IOException,
      SuspendException
   {
      try
      {
         IndexRecovery indexRecovery = handler.getContext().getIndexRecovery();
         // check if index not ready
         if (!indexRecovery.checkIndexReady())
         {
            return false;
         }
         indexRecovery.setIndexOffline();

         File indexDirectory = new File(handler.getContext().getIndexDirectory());
         for (String filePath : indexRecovery.getIndexList())
         {
            File indexFile = new File(indexDirectory, filePath);
            if (!PrivilegedFileHelper.exists(indexFile.getParentFile()))
            {
               PrivilegedFileHelper.mkdirs(indexFile.getParentFile());
            }

            // transfer file
            InputStream in = indexRecovery.getIndexFile(filePath);
            OutputStream out = PrivilegedFileHelper.fileOutputStream(indexFile);
            try
            {
               byte[] buf = new byte[2048];
               int len;

               while ((len = in.read(buf)) > 0)
               {
                  out.write(buf, 0, len);
               }
            }
            finally
            {
               if (in != null)
               {
                  in.close();
               }

               if (out != null)
               {
                  out.close();
               }
            }

            indexRecovery.setIndexOnline();
         }
      }
      finally
      {
      }
View Full Code Here

   {
      File indexDirectory = new File(handler.getContext().getIndexDirectory());

      try
      {
         IndexRecovery indexRecovery = handler.getContext().getIndexRecovery();
         // check if index not ready
         if (!indexRecovery.checkIndexReady())
         {
            return false;
         }
         indexRecovery.setIndexOffline();

         for (String filePath : indexRecovery.getIndexList())
         {
            File indexFile = new File(indexDirectory, filePath);
            if (!PrivilegedFileHelper.exists(indexFile.getParentFile()))
            {
               PrivilegedFileHelper.mkdirs(indexFile.getParentFile());
            }

            // transfer file
            InputStream in = indexRecovery.getIndexFile(filePath);
            OutputStream out = PrivilegedFileHelper.fileOutputStream(indexFile);
            try
            {
               DirectoryHelper.transfer(in, out);
            }
            finally
            {
               DirectoryHelper.safeClose(in);
               DirectoryHelper.safeClose(out);
            }

            indexRecovery.setIndexOnline();
         }

         return true;
      }
      catch (RepositoryException e)
View Full Code Here

TOP

Related Classes of org.exoplatform.services.jcr.impl.core.query.IndexRecovery

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.