Package org.exoplatform.services.jcr.core

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


    *           will be generate RepositoryException
    */
   private int forceCloseSession(String repositoryName, String workspaceName) throws RepositoryException,
      RepositoryConfigurationException
   {
      ManageableRepository mr = repositoryService.getRepository(repositoryName);
      WorkspaceContainerFacade wc = mr.getWorkspaceContainer(workspaceName);

      SessionRegistry sessionRegistry = (SessionRegistry)wc.getComponent(SessionRegistry.class);

      return sessionRegistry.closeSessions(workspaceName);
   }
View Full Code Here


      addNamespaces(rEntry.getName());
      registerNodeTypes(rEntry.getName());

      // turn on Repository ONLINE
      ManageableRepository mr =
         (ManageableRepository)repositoryContainer.getComponentInstanceOfType(ManageableRepository.class);
      mr.setState(ManageableRepository.ONLINE);
   }
View Full Code Here

   }

   private void addNamespaces(String repositoryName) throws RepositoryException
   {

      ManageableRepository repository = getRepository(repositoryName);
      NamespaceRegistry nsRegistry = repository.getNamespaceRegistry();

      for (int j = 0; j < addNamespacesPlugins.size(); j++)
      {
         AddNamespacesPlugin plugin = (AddNamespacesPlugin)addNamespacesPlugins.get(j);
         Map<String, String> namespaces = plugin.getNamespaces();
View Full Code Here

    * @return current session
    * @throws Exception {@link Exception}
    */
   protected Session session(String repoName, String wsName, List<String> lockTokens) throws Exception
   {
      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)");
View Full Code Here

      }

      registerNodeTypes(rEntry.getName());

      // turn on Repository ONLINE
      ManageableRepository mr =
         (ManageableRepository)repositoryContainer.getComponentInstanceOfType(ManageableRepository.class);
      mr.setState(ManageableRepository.ONLINE);
   }
View Full Code Here

      if (rs == null)
      {
         throw new ResourceException("No RepositoryService could be found in the container "
            + container.getContext().getName());
      }
      ManageableRepository mRepository = getRepository(rs);
      SessionRequestInfo sri = (SessionRequestInfo)cxRequestInfo;
      String workspaceName = sri.getWorkspace();
      if (LOG.isDebugEnabled())
      {
         LOG.debug("createManagedConnection: workspace = " + (workspaceName == null ? "'default'" : workspaceName));
      }
      Credentials credentials = getCredentials(subject, sri);
      SessionImpl session = null;
      try
      {
         session = (SessionImpl)mRepository.login(credentials, workspaceName);
      }
      catch (Exception e)
      {
         throw new ResourceException("Could not login to the workspace " + (workspaceName == null ? "'default'" : workspaceName), e);
      }
View Full Code Here

    * has been defined in the configuration of the {@link ManagedSessionFactory}
    * it will try to get it otherwise it will get the current repository
    */
   private ManageableRepository getRepository(RepositoryService rs) throws ResourceException
   {
      ManageableRepository mRepository = null;
      try
      {
         mRepository = repository == null ? rs.getCurrentRepository() : rs.getRepository(repository);
      }
      catch (Exception e)
View Full Code Here

    * @return current session
    * @throws Exception {@link Exception}
    */
   protected Session session(String repoName, String wsName, List<String> lockTokens) throws Exception
   {
      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)");
View Full Code Here

                  {
                     if (e.getMessage().indexOf("not found") > 0)
                     {
                        // check in JNDI
                        LOG.warn("Repository '" + repositoryName + "' is not local. Trying JNDI lookup with the name.");
                        ManageableRepository jndiRepo;
                        try
                        {
                           InitialContext ctx = new InitialContext();
                           Object obj = ctx.lookup(repositoryName);
                           if (obj instanceof ManageableRepository)
                           {
                              jndiRepo = (ManageableRepository)obj;
                           }
                           else
                           {
                              obj = ctx.lookup("java:comp/env/" + repositoryName);
                              if (obj instanceof ManageableRepository)
                              {
                                 jndiRepo = (ManageableRepository)obj;
                              }
                              else
                              {
                                 LOG.warn("Can't cast object " + obj + " as ManageableRepository class object");
                                 jndiRepo = null;
                              }
                           }
                           if (jndiRepo == null)
                              jcrBrowser.addError(e);
                           else
                              jcrBrowser.setRepository(jndiRepo);
                        }
                        catch (NamingException jndie)
                        {
                           LOG.warn("Repository not bound in JNDI with one of names '" + repositoryName
                              + "', 'java:comp/env/" + repositoryName + "' or can't be connected.", jndie);
                           try
                           {
                              InitialContext ctx = new InitialContext();
                              Object obj = ctx.lookup("java:comp/env/jcr/" + repositoryName);
                              if (obj instanceof ManageableRepository)
                              {
                                 jndiRepo = (ManageableRepository)obj;
                              }
                              else
                              {
                                 LOG.warn("Can't cast object " + obj + " as ManageableRepository class object");
                                 jndiRepo = null;
                              }
                              if (jndiRepo == null)
                              {
                                 jcrBrowser.addError(e);
                                 jcrBrowser.addError(jndie);
                              }
                              else
                                 jcrBrowser.setRepository(jndiRepo);
                           }
                           catch (NamingException jndie1)
                           {
                              LOG.warn("Repository not bound in JNDI with name 'java:comp/env/jcr/" + repositoryName
                                 + "' or can't be connected.", jndie1);
                              jcrBrowser.addError(e);
                              jcrBrowser.addError(jndie);
                              jcrBrowser.addError(jndie1);
                           }
                        }
                     }
                  }
               }

               if (jcrBrowser.getRepository() != null)
               {

                  if (workspaceName != null && !jcrBrowser.getSession().getWorkspace().getName().equals(workspaceName))
                  {
                     jcrBrowser.setSession(sessionProviderService.getSessionProvider(null).getSession(workspaceName,
                        jcrBrowser.getRepository()));
                  }

                  // Navigation
                  String path = (String)httpRequest.getParameter("goParent");
                  if (path != null)
                  {
                     jcrBrowser.setNode(jcrBrowser.getNode().getNode(path));
                  }
                  else
                  {
                     path = (String)httpRequest.getParameter("goNodePath");
                     if (path != null)
                        jcrBrowser.setNode((Node)jcrBrowser.getSession().getItem(path));
                     // else seems nothing changed in JCR navigation
                  }

                  // Synchronization
                  String doSynchronize = (String)httpRequest.getParameter("synchronize");
                  if (doSynchronize != null && doSynchronize.equals("run"))
                  {
                     jcrBrowser.runSynchronization();
                  }

               }
            }
            else
            {
               // start from root node

               ManageableRepository repository = repositoryService.getDefaultRepository();

               Session jcrSession =
                  sessionProviderService.getSessionProvider(null).getSession(
                     repository.getConfiguration().getDefaultWorkspaceName(), repository);

               if (jcrBrowser == null)
               {
                  jcrBrowser = new JCRBrowser();
                  jcrBrowser.setRepositoryService(repositoryService);
View Full Code Here

    *           will be generate RepositoryException
    */
   private int forceCloseSession(String repositoryName, String workspaceName) throws RepositoryException,
      RepositoryConfigurationException
   {
      ManageableRepository mr = repositoryService.getRepository(repositoryName);
      WorkspaceContainerFacade wc = mr.getWorkspaceContainer(workspaceName);

      SessionRegistry sessionRegistry = (SessionRegistry)wc.getComponent(SessionRegistry.class);

      return sessionRegistry.closeSessions(workspaceName);
   }
View Full Code Here

TOP

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

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.