Package org.exoplatform.services.jcr.core

Examples of org.exoplatform.services.jcr.core.ExtendedSession


      if (workspaceName == null)
      {
         throw new NullPointerException("Workspace Name is null");
      }

      ExtendedSession session = cache.get(key(repository, workspaceName));
      // create and cache new session

      if (session == null)
      {
         if (conversationState != null)
         {
            session =
                     (ExtendedSession) repository.getDynamicSession(workspaceName, conversationState.getIdentity()
                              .getMemberships());
         }
         else if (!isSystem)
         {
            session = (ExtendedSession)repository.login(workspaceName);
         }
         else
         {
            session = (ExtendedSession)repository.getSystemSession(workspaceName);
         }

         session.registerLifecycleListener(this);

         cache.put(key(repository, workspaceName), session);
      }

      return session;
View Full Code Here


      if (workspaceName == null)
      {
         throw new NullPointerException("Workspace Name is null");
      }

      ExtendedSession session = cache.get(key(repository, workspaceName));
      // create and cache new session

      if (session == null)
      {
         if (conversationState != null)
         {
            session = (ExtendedSession) repository.getDynamicSession(workspaceName, conversationState.getIdentity().getMemberships());
         }
         else if (!isSystem)
         {
            session = (ExtendedSession)repository.login(workspaceName);
         }
         else
         {
            session = (ExtendedSession)repository.getSystemSession(workspaceName);
         }

         session.registerLifecycleListener(this);

         cache.put(key(repository, workspaceName), session);
      }

      return session;
View Full Code Here

      if (workspaceName == null)
      {
         throw new IllegalArgumentException("Workspace Name is null");
      }

      ExtendedSession session = cache.get(key(repository, workspaceName));
      // create and cache new session

      if (session == null)
      {
         if (conversationState != null)
         {
            session =
                     (ExtendedSession) repository.getDynamicSession(workspaceName, conversationState.getIdentity()
                              .getMemberships());
         }
         else if (!isSystem)
         {
            session = (ExtendedSession)repository.login(workspaceName);
         }
         else
         {
            session = (ExtendedSession)repository.getSystemSession(workspaceName);
         }

         session.registerLifecycleListener(this);

         cache.put(key(repository, workspaceName), session);
      }

      return session;
View Full Code Here

         {

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

            ExtendedSession userSession;

            if (subLog.getSession() != null)
            {
               userSession = subLog.getSession();
            }
            else
            {
               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

      if (workspaceName == null)
      {
         throw new IllegalArgumentException("Workspace Name is null");
      }

      ExtendedSession session = cache.get(key(repository, workspaceName));
      // create and cache new session

      if (session == null)
      {
         if (conversationState != null)
         {
            session =
                     (ExtendedSession) repository.getDynamicSession(workspaceName, conversationState.getIdentity()
                              .getMemberships());
         }
         else if (!isSystem)
         {
            session = (ExtendedSession)repository.login(workspaceName);
         }
         else
         {
            session = (ExtendedSession)repository.getSystemSession(workspaceName);
         }

         session.registerLifecycleListener(this);

         cache.put(key(repository, workspaceName), session);
      }

      return session;
View Full Code Here

      if (workspaceName == null)
      {
         throw new IllegalArgumentException("Workspace Name is null");
      }

      ExtendedSession session = cache.get(key(repository, workspaceName));
      // create and cache new session

      if (session == null)
      {
         if (conversationState != null)
         {
            session =
                     (ExtendedSession) repository.getDynamicSession(workspaceName, conversationState.getIdentity()
                              .getMemberships());
         }
         else if (!isSystem)
         {
            session = (ExtendedSession)repository.login(workspaceName);
         }
         else
         {
            session = (ExtendedSession)repository.getSystemSession(workspaceName);
         }

         session.registerLifecycleListener(this);

         cache.put(key(repository, workspaceName), session);
      }

      return session;
View Full Code Here

    */
   protected void deserialize(Node importRoot, XmlSaveType saveType, boolean isImportedByStream, int uuidBehavior,
      InputStream is) throws RepositoryException, SAXException, IOException
   {

      ExtendedSession extendedSession = (ExtendedSession)importRoot.getSession();
      ExtendedWorkspace extendedWorkspace = (ExtendedWorkspace)extendedSession.getWorkspace();
      if (isImportedByStream)
      {
         if (saveType == XmlSaveType.SESSION)
         {
            extendedSession.importXML(importRoot.getPath(), is, uuidBehavior);
         }
         else if (saveType == XmlSaveType.WORKSPACE)
         {
            extendedWorkspace.importXML(importRoot.getPath(), is, uuidBehavior);
         }

      }
      else
      {
         XMLReader reader = XMLReaderFactory.createXMLReader();
         if (saveType == XmlSaveType.SESSION)
         {
            reader.setContentHandler(extendedSession.getImportContentHandler(importRoot.getPath(), uuidBehavior));

         }
         else if (saveType == XmlSaveType.WORKSPACE)
         {
            reader.setContentHandler(extendedWorkspace.getImportContentHandler(importRoot.getPath(), uuidBehavior));
View Full Code Here

    */
   protected byte[] serialize(Node exportRootNode, boolean isSystemView, boolean isStream) throws IOException,
      RepositoryException, SAXException, TransformerConfigurationException
   {

      ExtendedSession extendedSession = (ExtendedSession)exportRootNode.getSession();

      ByteArrayOutputStream outStream = new ByteArrayOutputStream();

      if (isSystemView)
      {

         if (isStream)
         {
            extendedSession.exportSystemView(exportRootNode.getPath(), outStream, false, false);
         }
         else
         {
            SAXTransformerFactory saxFact = (SAXTransformerFactory)TransformerFactory.newInstance();
            TransformerHandler handler = saxFact.newTransformerHandler();
            handler.setResult(new StreamResult(outStream));
            extendedSession.exportSystemView(exportRootNode.getPath(), handler, false, false);
         }
      }
      else
      {
         if (isStream)
         {
            extendedSession.exportDocumentView(exportRootNode.getPath(), outStream, false, false);
         }
         else
         {
            SAXTransformerFactory saxFact = (SAXTransformerFactory)TransformerFactory.newInstance();
            TransformerHandler handler = saxFact.newTransformerHandler();
            handler.setResult(new StreamResult(outStream));
            extendedSession.exportDocumentView(exportRootNode.getPath(), handler, false, false);
         }
      }
      outStream.close();
      return outStream.toByteArray();
   }
View Full Code Here

   protected File serializeToFile(Node exportRootNode, boolean isSystemView, boolean isStream) throws IOException,
                                                                                          RepositoryException,
                                                                                          SAXException,
                                                                                          TransformerConfigurationException {

     ExtendedSession extendedSession = (ExtendedSession) exportRootNode.getSession();

     File file = File.createTempFile("export", ".xml");
    
     FileOutputStream outStream = new FileOutputStream(file);

     if (isSystemView) {

       if (isStream) {
         extendedSession.exportSystemView(exportRootNode.getPath(), outStream, false, false);
       } else {
         SAXTransformerFactory saxFact = (SAXTransformerFactory) TransformerFactory.newInstance();
         TransformerHandler handler = saxFact.newTransformerHandler();
         handler.setResult(new StreamResult(outStream));
         extendedSession.exportSystemView(exportRootNode.getPath(), handler, false, false);
       }
     } else {
       if (isStream) {
         extendedSession.exportDocumentView(exportRootNode.getPath(), outStream, false, false);
       } else {
         SAXTransformerFactory saxFact = (SAXTransformerFactory) TransformerFactory.newInstance();
         TransformerHandler handler = saxFact.newTransformerHandler();
         handler.setResult(new StreamResult(outStream));
         extendedSession.exportDocumentView(exportRootNode.getPath(), handler, false, false);
       }
     }
     outStream.close();
     return file;
   }
View Full Code Here

   }

   protected void serialize(Node rootNode, boolean isSystemView, boolean isStream, File content) throws IOException,
      RepositoryException, SAXException, TransformerConfigurationException
   {
      ExtendedSession extendedSession = (ExtendedSession)rootNode.getSession();

      OutputStream outStream = new FileOutputStream(content);
      if (isSystemView)
      {

         if (isStream)
         {
            extendedSession.exportSystemView(rootNode.getPath(), outStream, false, false);
         }
         else
         {
            SAXTransformerFactory saxFact = (SAXTransformerFactory)TransformerFactory.newInstance();
            TransformerHandler handler = saxFact.newTransformerHandler();
            handler.setResult(new StreamResult(outStream));
            extendedSession.exportSystemView(rootNode.getPath(), handler, false, false);
         }
      }
      else
      {
         if (isStream)
         {
            extendedSession.exportDocumentView(rootNode.getPath(), outStream, false, false);
         }
         else
         {
            SAXTransformerFactory saxFact = (SAXTransformerFactory)TransformerFactory.newInstance();
            TransformerHandler handler = saxFact.newTransformerHandler();
            handler.setResult(new StreamResult(outStream));
            extendedSession.exportDocumentView(rootNode.getPath(), handler, false, false);
         }
      }
      outStream.close();

   }
View Full Code Here

TOP

Related Classes of org.exoplatform.services.jcr.core.ExtendedSession

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.