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

Examples of org.exoplatform.services.jcr.impl.core.SessionImpl


   }

   public synchronized void onCloseSession(ExtendedSession session)
   {
      // List<String> deadLocksList = new ArrayList<String>();
      SessionImpl sessionImpl = (SessionImpl)session;
      for (Iterator<Map.Entry<String, LockData>> entries = locks.entrySet().iterator(); entries.hasNext();)
      {
         Map.Entry<String, LockData> entry = entries.next();
         LockData lockData = entry.getValue();
         if (lockData.isLive())
         {
            if (lockData.isLockHolder(session.getId()))
            {
               if (lockData.isSessionScoped())
               {
                  // if no session currently holds lock except this
                  try
                  {
                     ((NodeImpl)sessionImpl.getTransientNodesManager().getItemByIdentifier(
                        lockData.getNodeIdentifier(), false)).unlock();
                  }
                  catch (UnsupportedRepositoryOperationException e)
                  {
                     log.error(e.getLocalizedMessage());
View Full Code Here


      // mix:versionable
      // we have to be sure that any versionable node somewhere in repository
      // doesn't refers to a VH of the node being deleted.
      for (String wsName : repository.getWorkspaceNames())
      {
         SessionImpl wsSession = repository.getSystemSession(wsName);
         try
         {
            for (PropertyData sref : wsSession.getTransientNodesManager().getReferencesData(vhID, false))
            {
               // Check if this VH isn't referenced from somewhere in workspace
               // or isn't contained in another one as a child history.
               // Ask ALL references incl. properties from version storage.
               if (sref.getQPath().isDescendantOf(Constants.JCR_VERSION_STORAGE_PATH))
               {
                  if (!sref.getQPath().isDescendantOf(vhnode.getQPath())
                     && (containingHistory != null ? !sref.getQPath().isDescendantOf(containingHistory) : true))
                     // has a reference to the VH in version storage,
                     // it's a REFERENCE property jcr:childVersionHistory of
                     // nt:versionedChild
                     // i.e. this VH is a child history in an another history.
                     // We can't remove this VH now.
                     return;
               }
               else if (!currentWorkspaceName.equals(wsName))
               {
                  // has a reference to the VH in traversed workspace,
                  // it's not a version storage, i.e. it's a property of versionable
                  // node somewhere in ws.
                  // We can't remove this VH now.
                  return;
               } // else -- if we has a references in workspace where the VH is being
               // deleted we can remove VH now.
            }
         }
         finally
         {
            wsSession.logout();
         }
      }

      // remove child versions from VH (if found)
      // ChildVersionRemoveVisitor cvremover = new
View Full Code Here

         try
         {
            TransactionChangesLog allChanges = new TransactionChangesLog();
            for (Map.Entry<PlainChangesLog, SessionImpl> entry : changes.entrySet())
            {
               SessionImpl session = entry.getValue();
               // first check if the tx was not too long
               if (session.hasExpired())
               {
                  // at least one session has expired so we abort the tx
                  throw new RepositoryException("The tx was too long, at least one session has expired.");
               }
               // Add the change following the chronology order
View Full Code Here

            Map<PlainChangesLog, SessionImpl> changes = xidCtx.getMapChanges();
            if (changes != null && !changes.isEmpty())
            {
               for (Map.Entry<PlainChangesLog, SessionImpl> entry : changes.entrySet())
               {
                  SessionImpl session = entry.getValue();
                  TransactionableDataManager txManager = session.getTransientNodesManager().getTransactManager();
                  // Remove the change from the tx change log. Please note that a simple reset cannot
                  // be done since the session could be enrolled in several tx, so each change need to
                  // be scoped to a given xid
                  txManager.removeLog(entry.getKey());
               }
View Full Code Here

         {

            PlainChangesLog subLog = logIterator.nextLog();
            String sessionId = subLog.getSessionId();

            SessionImpl userSession = sessionRegistry.getSession(sessionId);

            if (userSession != null)
               for (ItemState itemState : subLog.getAllStates())
               {
                  if (itemState.isEventFire())
                  {

                     ItemData item = itemState.getData();
                     try
                     {
                        int eventType = eventType(itemState);
                        if (eventType != SKIP_EVENT && isTypeMatch(criteria, eventType)
                           && isPathMatch(criteria, item, userSession) && isIdentifierMatch(criteria, item)
                           && isNodeTypeMatch(criteria, item, userSession, subLog)
                           && isSessionMatch(criteria, sessionId))
                        {

                           String path =
                              userSession.getLocationFactory().createJCRPath(item.getQPath()).getAsString(false);

                           events.add(new EventImpl(eventType, path, userSession.getUserID()));
                        }
                     }
                     catch (RepositoryException e)
                     {
                        log.error("Can not fire ActionLauncher.onSaveItems() for " + item.getQPath().getAsString()
View Full Code Here

         Thread.sleep(delayTime);

         log.info("The backup has been started : " + manageableRepository.getConfiguration().getName() + "@"
            + workspaceName);

         SessionImpl session = (SessionImpl)manageableRepository.getSystemSession(workspaceName);

         Calendar backupTime = Calendar.getInstance();
         String fileName =
            manageableRepository.getConfiguration().getName() + "_" + workspaceName + "_"
               + fileNameFactory.getStrDate(backupTime) + "_" + fileNameFactory.getStrTime(backupTime) + ".xml";

         File backupFile = new File(PrivilegedFileHelper.getCanonicalPath(backupDir) + File.separator + fileName);

         if (PrivilegedFileHelper.createNewFile(backupFile))
         {

            session.exportWorkspaceSystemView(PrivilegedFileHelper.fileOutputStream(backupFile), false, false);

            log.info("The backup has been finished : " + manageableRepository.getConfiguration().getName() + "@"
               + workspaceName);
         }
         else
View Full Code Here

         Thread.sleep(delayTime);

         log.info("The backup has been started : " + manageableRepository.getConfiguration().getName() + "@"
            + workspaceName);

         SessionImpl session = (SessionImpl)manageableRepository.getSystemSession(workspaceName);

         Calendar backupTime = Calendar.getInstance();
         String fileName =
            manageableRepository.getConfiguration().getName() + "_" + workspaceName + "_"
               + fileNameFactory.getStrDate(backupTime) + "_" + fileNameFactory.getStrTime(backupTime) + ".xml";

         File backupFile = new File(backupDir.getCanonicalPath() + File.separator + fileName);

         if (backupFile.createNewFile())
         {

            session.exportWorkspaceSystemView(new FileOutputStream(backupFile), false, false);

            log.info("The backup has been finished : " + manageableRepository.getConfiguration().getName() + "@"
               + workspaceName);
         }
         else
View Full Code Here

      try
      {
         pathBackupFile = getStorageURL().getFile();

         SessionImpl session = (SessionImpl)repository.getSystemSession(workspaceName);

         try
         {
            notifyListeners();
            FileOutputStream fos = new FileOutputStream(pathBackupFile);
            session.exportWorkspaceSystemView(fos, false, false);
         }
         finally
         {
            session.logout();
         }
      }
      catch (RepositoryException e)
      {
         log.error("Full backup failed " + getStorageURL().getPath(), e);
View Full Code Here

            Map<PlainChangesLog, SessionImpl> changes = xidCtx.getMapChanges();
            if (changes != null && !changes.isEmpty())
            {
               for (Map.Entry<PlainChangesLog, SessionImpl> entry : changes.entrySet())
               {
                  SessionImpl session = entry.getValue();
                  TransactionableDataManager txManager = session.getTransientNodesManager().getTransactManager();
                  // Remove the change from the tx change log. Please not that a simple reset cannot
                  // be done since the session could be enrolled in several tx, so each change need to
                  // be scoped to a given xid
                  txManager.removeLog(entry.getKey());
               }
View Full Code Here

         try
         {
            TransactionChangesLog allChanges = new TransactionChangesLog();
            for (Map.Entry<PlainChangesLog, SessionImpl> entry : changes.entrySet())
            {
               SessionImpl session = entry.getValue();
               // first check if the tx was not too long
               if (session.hasExpired())
               {
                  // at least one session has expired so we abort the tx
                  throw new RepositoryException("The tx was too long, at least one session has expired.");
               }
               // Add the change following the chronology order
View Full Code Here

TOP

Related Classes of org.exoplatform.services.jcr.impl.core.SessionImpl

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.