Package org.exoplatform.services.jcr.ext.resource

Examples of org.exoplatform.services.jcr.ext.resource.UnifiedNodeReference


   @Override
   protected URLConnection openConnection(URL url) throws IOException
   {
      try
      {
         UnifiedNodeReference nodeReference = new UnifiedNodeReference(url);

         // First try use user specified session provider, e.g.
         // ThreadLocalSessionProvider or System SessionProvider
         SessionProvider sessionProvider = threadLocalSessionProviderService.getSessionProvider(null);

         boolean closeSessionProvider = false;
         if (sessionProvider == null && ConversationState.getCurrent() != null)
         {
            sessionProvider =
               (SessionProvider)ConversationState.getCurrent().getAttribute(SessionProvider.SESSION_PROVIDER);
         }

         if (sessionProvider == null)
         {
            sessionProvider = SessionProvider.createAnonimProvider();
            closeSessionProvider = true;
         }

         String repositoryName = nodeReference.getRepository();
         if (repositoryName != null && repositoryName.length() > 0)
         {
            ManageableRepository repository = repositoryService.getRepository(repositoryName);
            sessionProvider.setCurrentRepository(repository);
         }

         String workspaceName = nodeReference.getWorkspace();
         if (workspaceName != null && workspaceName.length() > 0)
         {
            sessionProvider.setCurrentWorkspace(workspaceName);
         }
View Full Code Here


   @Override
   protected URLConnection openConnection(URL url) throws IOException
   {
      try
      {
         UnifiedNodeReference nodeReference = new UnifiedNodeReference(url);

         // First try use user specified session provider, e.g.
         // ThreadLocalSessionProvider or System SessionProvider
         SessionProvider sessionProvider = threadLocalSessionProviderService.getSessionProvider(null);

         boolean closeSessionProvider = false;
         if (sessionProvider == null && ConversationState.getCurrent() != null)
         {
            sessionProvider =
               (SessionProvider)ConversationState.getCurrent().getAttribute(SessionProvider.SESSION_PROVIDER);
         }

         if (sessionProvider == null)
         {
            sessionProvider = SessionProvider.createAnonimProvider();
            closeSessionProvider = true;
         }

         String repositoryName = nodeReference.getRepository();
         if (repositoryName != null && repositoryName.length() > 0)
         {
            ManageableRepository repository = repositoryService.getRepository(repositoryName);
            sessionProvider.setCurrentRepository(repository);
         }

         String workspaceName = nodeReference.getWorkspace();
         if (workspaceName != null && workspaceName.length() > 0)
         {
            sessionProvider.setCurrentWorkspace(workspaceName);
         }
View Full Code Here

         String repository = p.getProperty("repository");
         String workspace = p.getProperty("workspace");
         String path = p.getProperty("path");
         try
         {
            repos.add(new UnifiedNodeReference(repository, workspace, path).getURL());
         }
         catch (MalformedURLException e)
         {
            LOG.error("Failed add groovy script repository. " + e.getMessage());
         }
View Full Code Here

   @Override
   protected URLConnection openConnection(URL url) throws IOException
   {
      try
      {
         UnifiedNodeReference nodeReference = new UnifiedNodeReference(url);

         // First try use user specified session provider, e.g.
         // ThreadLocalSessionProvider or System SessionProvider
         SessionProvider sessionProvider = threadLocalSessionProviderService.getSessionProvider(null);

         if (sessionProvider == null && ConversationState.getCurrent() != null)
            sessionProvider =
               (SessionProvider)ConversationState.getCurrent().getAttribute(SessionProvider.SESSION_PROVIDER);

         // if still not set use anonymous session provider
         if (sessionProvider == null)
            sessionProvider = SessionProvider.createAnonimProvider();

         ManageableRepository repository;
         String repositoryName = nodeReference.getRepository();
         if (repositoryName == null || repositoryName.length() == 0)
            repository = sessionProvider.getCurrentRepository();
         else
            repository = repositoryService.getRepository(repositoryName);

         String workspaceName = nodeReference.getWorkspace();
         if (workspaceName == null || workspaceName.length() == 0)
            workspaceName = sessionProvider.getCurrentWorkspace();

         Session ses = sessionProvider.getSession(workspaceName, repository);
         JcrURLConnection conn = new JcrURLConnection(nodeReference, ses, nodeRepresentationService);
View Full Code Here

         String repository = p.getProperty("repository");
         String workspace = p.getProperty("workspace");
         String path = p.getProperty("path");
         try
         {
            repos.add(new UnifiedNodeReference(repository, workspace, path).getURL());
         }
         catch (MalformedURLException e)
         {
            LOG.error("Failed add groovy script repository. " + e.getMessage());
         }
View Full Code Here

      EnvironmentContext ctx = new EnvironmentContext();
      ctx.put(SecurityContext.class, adminSecurityContext);
      String path =
         "/script/groovy/load/db1/ws" + scriptPath //
            + "?file=" //
            + URLEncoder.encode(new UnifiedNodeReference(repository.getName(), workspace.getName(), user).getURL()
               .toString(), "UTF-8");
      int before = binder.getSize();
      ContainerResponse cres = launcher.service("POST", path, "", null, null, ctx);
      assertEquals(204, cres.getStatus());
      int after = binder.getSize();
View Full Code Here

      EnvironmentContext ctx = new EnvironmentContext();
      ctx.put(SecurityContext.class, adminSecurityContext);
      String path =
         "/script/groovy/load/db1/ws" + scriptPath //
            + "?sources=" //
            + URLEncoder.encode(new UnifiedNodeReference(repository.getName(), workspace.getName(), testRoot.getPath())
               .getURL().toString(), "UTF-8");
      int before = binder.getSize();
      ContainerResponse cres = launcher.service("POST", path, "", null, null, ctx);
      assertEquals(204, cres.getStatus());
      int after = binder.getSize();
View Full Code Here

         "package test.validate\n" + //
            "class User001 {def name}");
      // Specify source file location.
      String path =
         "/script/groovy/validate/Test?file=" //
            + URLEncoder.encode(new UnifiedNodeReference(repository.getName(), workspace.getName(), user).getURL()
               .toString(), "UTF-8");
      ContainerResponse cres = launcher.service("POST", path, "", headers, script.getBytes(), null);
      assertEquals(200, cres.getStatus());
   }
View Full Code Here

         "package test.validate\n" + //
            "class User002 {def name}");
      // Specify source folder location.
      String path =
         "/script/groovy/validate/Test?sources=" //
            + URLEncoder.encode(new UnifiedNodeReference(repository.getName(), workspace.getName(), testRoot.getPath())
               .getURL().toString(), "UTF-8");
      ContainerResponse cres = launcher.service("POST", path, "", headers, script.getBytes(), null);
      assertEquals(200, cres.getStatus());
   }
View Full Code Here

         {
            SecurityHelper.doPrivilegedExceptionAction(new PrivilegedExceptionAction<Void>()
            {
               public Void run() throws MalformedURLException
               {
                  repos.add(new UnifiedNodeReference(repository, workspace, path).getURL());
                  return null;
               }
            });
         }
         catch (PrivilegedActionException e)
View Full Code Here

TOP

Related Classes of org.exoplatform.services.jcr.ext.resource.UnifiedNodeReference

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.