Package org.exoplatform.services.jcr.ext.common

Examples of org.exoplatform.services.jcr.ext.common.SessionProvider


   @DELETE
   @Path("/{entryPath:.+}")
   public Response removeEntry(@PathParam("entryPath") String entryPath)
   {

      SessionProvider sessionProvider = sessionProviderService.getSessionProvider(null);
      try
      {
         regService.removeEntry(sessionProvider, normalizePath(entryPath));
         return null; // minds status 204 'No content'
      }
View Full Code Here


    */
   protected Session session(String repoName, String wsName, List<String> lockTokens) throws Exception,
      NoSuchWorkspaceException
   {
      ManageableRepository repo = this.repositoryService.getRepository(repoName);
      SessionProvider sp = sessionProviderService.getSessionProvider(null);
      if (sp == null)
         throw new RepositoryException("SessionProvider is not properly set. Make the application calls"
            + "SessionProviderService.setSessionProvider(..) somewhere before ("
            + "for instance in Servlet Filter for WEB application)");

      Session session = sp.getSession(wsName, repo);
      if (lockTokens != null)
      {
         String[] presentLockTokens = session.getLockTokens();
         ArrayList<String> presentLockTokensList = new ArrayList<String>();
         for (int i = 0; i < presentLockTokens.length; i++)
View Full Code Here

 
  public void testStartupWithOldDataStructure() throws Exception {
     RegistryService registry = (RegistryService) container.getComponentInstanceOfType(RegistryService.class);
     String pathDefault = RegistryService.EXO_SERVICES + "/Audit/defaultIdentity";
     String pathAdmin = RegistryService.EXO_SERVICES + "/Audit/adminIdentity";
     SessionProvider sessionProvider = SessionProvider.createSystemProvider();
     try {
        // A value is expected for the default identity
        RegistryEntry registryEntry = registry.getEntry(sessionProvider, pathDefault);
        Document doc = registryEntry.getDocument();
        Element element = doc.getDocumentElement();
        String defaultIdentity;
        assertNotNull(defaultIdentity = element.getAttribute( "value"));
       
        // A value is expected for the admin identity
        registryEntry = registry.getEntry(sessionProvider, pathAdmin);
        doc = registryEntry.getDocument();
        element = doc.getDocumentElement();
        String adminIdentity;
        assertNotNull(adminIdentity = element.getAttribute( "value"));
       
        // We remove the new entry to simulate old data structure
        registry.removeEntry(sessionProvider, pathDefault);
       
        AuditServiceImpl as = (AuditServiceImpl) service;
        // We restart the service to make sure that it doesn't fail at startup
        as.stop();
        as.start();
       
        // The same value is expected for the default identity
        registryEntry = registry.getEntry(sessionProvider, pathDefault);
        doc = registryEntry.getDocument();
        element = doc.getDocumentElement();
        assertEquals(defaultIdentity, element.getAttribute( "value"));

        // The same value is expected for the admin identity
        registryEntry = registry.getEntry(sessionProvider, pathAdmin);
        doc = registryEntry.getDocument();
        element = doc.getDocumentElement();
        assertEquals(adminIdentity, element.getAttribute( "value"));
     }
     finally {
        sessionProvider.close();  
     }
  }
View Full Code Here

    String username = props.getProperty("username");
    String password = props.getProperty("password");
    String userId = authenticator.validateUser(new Credential[] { new UsernameCredential(username),
        new PasswordCredential(password) });

    sessionProvider = new SessionProvider(new ConversationState(authenticator.createIdentity(userId)));

  }
View Full Code Here

      Session ses = null;

      try
      {
         // JCR resource
         SessionProvider sp = sessionProviderService.getSessionProvider(null);
         if (sp == null)
            throw new RepositoryException("Access to JCR Repository denied. SessionProvider is null.");

         ses = sp.getSession(workspace, repositoryService.getRepository(repository));

         ExtendedNode node = (ExtendedNode)ses.getRootNode().getNode(resourcePath);

         if (isFile(node))
         {
View Full Code Here

    */
   public void start()
   {
      if (registryService != null && !registryService.getForceXMLConfigurationValue(initParams))
      {
         SessionProvider sessionProvider = SessionProvider.createSystemProvider();
         try
         {
            readParamsFromRegistryService(sessionProvider);
         }
         catch (Exception e)
         {
            readParamsFromFile();
            try
            {
               writeParamsToRegistryService(sessionProvider);
            }
            catch (Exception exc)
            {
               LOG.error("Cannot write init configuration to RegistryService.", exc);
            }
         }
         finally
         {
            sessionProvider.close();
         }
      }
      else
      {
         readParamsFromFile();
View Full Code Here

      }

      // start all scheduled before tasks
      if (registryService != null && !registryService.getForceXMLConfigurationValue(initParams))
      {
         SessionProvider sessionProvider = SessionProvider.createSystemProvider();
         try
         {
            readParamsFromRegistryService(sessionProvider);
         }
         catch (Exception e)
         {
            readParamsFromFile();
            try
            {
               writeParamsToRegistryService(sessionProvider);
            }
            catch (Exception exc)
            {
               log.error("Cannot write init configuration to RegistryService.", exc);
            }
         }
         finally
         {
            sessionProvider.close();
         }
      }
      else
      {
         readParamsFromFile();
View Full Code Here

    */
   public void start()
   {
      if (registryService != null && initParams != null && !registryService.getForceXMLConfigurationValue(initParams))
      {
         SessionProvider sessionProvider = SessionProvider.createSystemProvider();
         try
         {
            readParamsFromRegistryService(sessionProvider);
         }
         catch (Exception e)
         {
            readParamsFromFile();
            try
            {
               writeParamsToRegistryService(sessionProvider);
            }
            catch (Exception exc)
            {
               LOG.error("Cannot write init configuration to RegistryService.", exc);
            }
         }
         finally
         {
            sessionProvider.close();
         }
      }
      else
      {
         readParamsFromFile();
View Full Code Here

   @GET
   @Produces(MediaType.APPLICATION_XML)
   public Response getRegistry(@Context UriInfo uriInfo)
   {
      SessionProvider sessionProvider = sessionProviderService.getSessionProvider(null);
      try
      {
         RegistryNode registryEntry = regService.getRegistry(sessionProvider);
         if (registryEntry != null)
         {
View Full Code Here

   @Path("/{entryPath:.+}")
   @Produces(MediaType.APPLICATION_XML)
   public Response getEntry(@PathParam("entryPath") String entryPath)
   {

      SessionProvider sessionProvider = sessionProviderService.getSessionProvider(null);
      try
      {
         RegistryEntry entry;
         entry = regService.getEntry(sessionProvider, normalizePath(entryPath));
         return Response.ok(new DOMSource(entry.getDocument())).build();
View Full Code Here

TOP

Related Classes of org.exoplatform.services.jcr.ext.common.SessionProvider

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.