Package org.exoplatform.services.jcr.dataflow

Examples of org.exoplatform.services.jcr.dataflow.TransactionChangesLog


   /**
    * {@inheritDoc}
    */
   public void onSaveItems(ItemStateChangesLog isChangesLog)
   {
      TransactionChangesLog changesLog = (TransactionChangesLog)isChangesLog;
      if (changesLog.getSystemId() == null && !isSessionNull(changesLog))
      {
         changesLog.setSystemId(systemId);
         // broadcast messages
         try
         {
            // dump log
            if (log.isDebugEnabled())
            {
               ChangesLogIterator logIterator = changesLog.getLogIterator();
               while (logIterator.hasNextLog())
               {
                  PlainChangesLog pcl = logIterator.nextLog();
                  log.info(pcl.dump());
               }
            }

            String identifier = this.sendAsBinaryFile(changesLog);

            if (log.isDebugEnabled())
            {
               log.info("After send message: the owner systemId --> " + changesLog.getSystemId());
               log.info("After send message: --> " + systemId);
            }
         }
         catch (Exception e)
         {
View Full Code Here


    * @throws Exception
    *           will be generated the Exception
    */
   public void receive(ItemStateChangesLog itemStatechangesLog, String identifier) throws Exception
   {
      TransactionChangesLog changesLog = (TransactionChangesLog)itemStatechangesLog;
      if (changesLog.getSystemId() == null)
      {
         throw new Exception("Invalid or same systemId " + changesLog.getSystemId());
      }
      else if (!changesLog.getSystemId().equals(this.systemId))
      {

         if (state != RECOVERY_MODE)
         {
            // dump log
            if (log.isDebugEnabled())
            {
               ChangesLogIterator logIterator = changesLog.getLogIterator();
               while (logIterator.hasNextLog())
               {
                  PlainChangesLog pcl = logIterator.nextLog();
                  log.info(pcl.dump());
               }
            }

            dataKeeper.save(changesLog);

            Packet packet = new Packet(Packet.PacketType.ADD_OK, identifier, ownName);
            channelManager.sendPacket(packet);

            if (log.isDebugEnabled())
            {
               log.info("After save message: the owner systemId --> " + changesLog.getSystemId());
               log.info("After save message: --> " + systemId);
            }
         }
      }
   }
View Full Code Here

    * @throws Exception
    *           will be generated the Exception
    */
   private void saveChangesLog(ChangesFile fileDescriptor, String identifire) throws Exception
   {
      TransactionChangesLog transactionChangesLog =
         recoveryManager.getRecoveryReader().getChangesLog(
            PrivilegedFileHelper.getAbsolutePath(fileDescriptor.getFile()));

      if (log.isDebugEnabled())
      {
         log.debug("Save to JCR : " + PrivilegedFileHelper.getAbsolutePath(fileDescriptor.getFile()));
         log.debug("SystemID : " + transactionChangesLog.getSystemId());
      }

      // dump log
      if (log.isDebugEnabled())
      {
         ChangesLogIterator logIterator = transactionChangesLog.getLogIterator();
         while (logIterator.hasNextLog())
         {
            PlainChangesLog pcl = logIterator.nextLog();
            log.debug(pcl.dump());
         }
View Full Code Here

   public static TransactionChangesLog getAsItemDataChangesLog(byte[] byteArray) throws IOException,
      ClassNotFoundException
   {
      ByteArrayInputStream is = new ByteArrayInputStream(byteArray);
      ObjectInputStream ois = new ObjectInputStream(is);
      TransactionChangesLog objRead = (TransactionChangesLog)ois.readObject();

      return objRead;
   }
View Full Code Here

         if (lockOwner == null && lockIsDeep == null)
         {
            return;
         }

         dataManager.save(new TransactionChangesLog(changesLog));
      }
      catch (JCRInvalidItemStateException e)
      {
         //TODO EXOJCR-412, should be refactored in future.
         //Skip property not found in DB, because that lock property was removed in other node of cluster.
View Full Code Here

         {
            persistedLog = persister.save((PlainChangesLogImpl)changesLog);
         }
         else if (changesLog instanceof TransactionChangesLog)
         {
            TransactionChangesLog orig = (TransactionChangesLog)changesLog;

            TransactionChangesLog persisted = new TransactionChangesLog();
            persisted.setSystemId(orig.getSystemId());

            for (ChangesLogIterator iter = orig.getLogIterator(); iter.hasNextLog();)
            {
               persisted.addLog(persister.save(iter.nextLog()));
            }

            persistedLog = persisted;
         }
         else
View Full Code Here

         {
            persistedLog = persister.save((PlainChangesLogImpl)changesLog);
         }
         else if (changesLog instanceof TransactionChangesLog)
         {
            TransactionChangesLog orig = (TransactionChangesLog)changesLog;

            TransactionChangesLog persisted = new TransactionChangesLog();
            persisted.setSystemId(orig.getSystemId());

            for (ChangesLogIterator iter = orig.getLogIterator(); iter.hasNextLog();)
            {
               persisted.addLog(persister.save(iter.nextLog()));
            }

            persistedLog = persisted;
         }
         else
View Full Code Here

   @Override
   protected void save(ItemStateChangesLog persistentLog) throws IOException
   {

      TransactionChangesLog changesLog = (TransactionChangesLog)persistentLog;

      if (changesLog != null && !isSessionNull(changesLog))
      {
         long start = System.currentTimeMillis();

         writeExternal(oosFileData, changesLog, fileCleaner);

         long total = System.currentTimeMillis() - start;

         if (log.isDebugEnabled())
            log.debug("Time : " + total + " ms" + "    Itemstates count : " + changesLog.getAllStates().size());
      }
   }
View Full Code Here

                     for (ChangesFile fileDescriptor : fileDescriptorList)
                     {
                        try
                        {
                           TransactionChangesLog transactionChangesLog =
                              recoveryReader.getChangesLog(fileDescriptor.getFile().getAbsolutePath());

                           transactionChangesLog.setSystemId(fileDescriptor.getSystemId());

                           Calendar cLogTime = fileNameFactory.getDateFromFileName(fileDescriptor.getFile().getName());

                           if (log.isDebugEnabled())
                           {
                              log.debug("Save to JCR : " + fileDescriptor.getFile().getAbsolutePath());
                              log.debug("SystemID : " + transactionChangesLog.getSystemId());
                              log.debug("list size : " + fileDescriptorList.size());
                           }

                           // dump log
                           if (log.isDebugEnabled())
                           {
                              ChangesLogIterator logIterator = transactionChangesLog.getLogIterator();
                              while (logIterator.hasNextLog())
                              {
                                 PlainChangesLog pcl = logIterator.nextLog();
                                 log.debug(pcl.dump());
                              }
                           }

                           saveChangesLog(dataKeeper, transactionChangesLog, cLogTime);

                           if (log.isDebugEnabled())
                           {
                              log.debug("After save message: the owner systemId --> "
                                 + transactionChangesLog.getSystemId());
                              log.debug("After save message: --> " + systemId);
                           }

                        }
                        catch (Exception e)
View Full Code Here

   public static TransactionChangesLog getAsItemDataChangesLog(byte[] byteArray) throws IOException,
      ClassNotFoundException
   {
      ByteArrayInputStream is = new ByteArrayInputStream(byteArray);
      ObjectInputStream ois = new ObjectInputStream(is);
      TransactionChangesLog objRead = (TransactionChangesLog)ois.readObject();

      return objRead;
   }
View Full Code Here

TOP

Related Classes of org.exoplatform.services.jcr.dataflow.TransactionChangesLog

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.