Package org.exoplatform.services.jcr.config

Examples of org.exoplatform.services.jcr.config.RepositoryEntry


   {
      this.parentContainer = container;
      List<RepositoryEntry> rEntries = config.getRepositoryConfigurations();
      for (int i = 0; i < rEntries.size(); i++)
      {
         RepositoryEntry rEntry = rEntries.get(i);
         // Making new repository container as portal's subcontainer
         createRepository(rEntry);
      }
   }
View Full Code Here


   public boolean canRemoveRepository(String name) throws RepositoryException
   {
      RepositoryImpl repo = (RepositoryImpl)getRepository(name);
      try
      {
         RepositoryEntry repconfig = config.getRepositoryConfiguration(name);

         for (WorkspaceEntry wsEntry : repconfig.getWorkspaceEntries())
         {
            // Check non system workspaces
            if (!repo.getSystemWorkspaceName().equals(wsEntry.getName()) && !repo.canRemoveWorkspace(wsEntry.getName()))
               return false;
         }
View Full Code Here

         throw new RepositoryException("Repository " + name + " in use. If you want to "
            + " remove repository close all open sessions");

      try
      {
         RepositoryEntry repconfig = config.getRepositoryConfiguration(name);
         RepositoryImpl repo = (RepositoryImpl)getRepository(name);
         for (WorkspaceEntry wsEntry : repconfig.getWorkspaceEntries())
         {
            repo.internalRemoveWorkspace(wsEntry.getName());
         }
         repconfig.getWorkspaceEntries().clear();
         RepositoryContainer repositoryContainer = repositoryContainers.get(name);
         repositoryContainer.stop();
         repositoryContainers.remove(name);
         config.getRepositoryConfigurations().remove(repconfig);
      }
View Full Code Here

   {
      this.parentContainer = container;
      List<RepositoryEntry> rEntries = config.getRepositoryConfigurations();
      for (int i = 0; i < rEntries.size(); i++)
      {
         RepositoryEntry rEntry = rEntries.get(i);
         // Making new repository container as portal's subcontainer
         createRepository(rEntry);
      }
   }
View Full Code Here

            makeWorkspaceEntry(wsEntry, newWorkspaceName, repoName, sourceName);

         wsEntries.add(newWSEntry);
      }

      RepositoryEntry newRepositoryEntry = new RepositoryEntry();

      newRepositoryEntry.setSystemWorkspaceName(workspaceMapping == null ? baseRepoEntry.getSystemWorkspaceName()
               : workspaceMapping.get(baseRepoEntry.getSystemWorkspaceName()));
      newRepositoryEntry.setAccessControl(baseRepoEntry.getAccessControl());
      newRepositoryEntry.setAuthenticationPolicy(baseRepoEntry.getAuthenticationPolicy());
      newRepositoryEntry.setDefaultWorkspaceName(workspaceMapping == null ? baseRepoEntry.getDefaultWorkspaceName()
               : workspaceMapping.get(baseRepoEntry.getDefaultWorkspaceName()));
      newRepositoryEntry.setName(repoName);
      newRepositoryEntry.setSecurityDomain(baseRepoEntry.getSecurityDomain());
      newRepositoryEntry.setSessionTimeOut(baseRepoEntry.getSessionTimeOut());

      newRepositoryEntry.setWorkspaceEntries(wsEntries);

      return newRepositoryEntry;
   }
View Full Code Here

   protected void restoreAndCheck(String workspaceName, String datasourceName, String backupLogFilePath, File backDir,
            int startIndex, int stopIndex) throws RepositoryConfigurationException, RepositoryException,
            BackupOperationException, BackupConfigurationException
   {
      // restore
      RepositoryEntry re =
               (RepositoryEntry) ws1Session.getContainer().getComponentInstanceOfType(RepositoryEntry.class);
      WorkspaceEntry ws1back = makeWorkspaceEntry(workspaceName, datasourceName);

      repository.configWorkspace(ws1back);

      File backLog = new File(backupLogFilePath);
      if (backLog.exists())
      {
         BackupChainLog bchLog = new BackupChainLog(backLog);
         backup.restore(bchLog, re.getName(), ws1back);

         // check
         SessionImpl back1 = null;
         try
         {
View Full Code Here

   }

   protected void removeRepositoryFully(String repositoryName) throws Exception
   {
      // get current repository configuration
      RepositoryEntry repositoryEntry = repositoryService.getConfig().getRepositoryConfiguration(repositoryName);

      if (repositoryEntry == null)
      {
         throw new RepositoryRestoreExeption("Current repository configuration " + repositoryName + " did not found");
      }

      //Create local copy of WorkspaceEntry for all workspaces
      ArrayList<WorkspaceEntry> workspaceList = new ArrayList<WorkspaceEntry>();
      workspaceList.addAll(repositoryEntry.getWorkspaceEntries());

      //close all session
      for (WorkspaceEntry wEntry : workspaceList)
      {
         forceCloseSession(repositoryEntry.getName(), wEntry.getName());
      }

      String systemWorkspaceName =
         repositoryService.getRepository(repositoryName).getConfiguration().getSystemWorkspaceName();

      //remove repository
      repositoryService.removeRepository(repositoryEntry.getName());

      // clean data
      for (WorkspaceEntry wEntry : workspaceList)
      {
         DBCleanService.cleanWorkspaceData(wEntry);
View Full Code Here

   public void testCreateRepository() throws Exception
   {
      String wsName = "ws_over_rest_1";
      String rName = "repo_over_rest";

      RepositoryEntry rDefault =
         repositoryService.getConfig().getRepositoryConfiguration(
            repositoryService.getConfig().getDefaultRepositoryName());

      RepositoryEntry rEntry = new RepositoryEntry();

      rEntry.setName(rName);
      rEntry.setSessionTimeOut(3600000);
      rEntry.setAuthenticationPolicy("org.exoplatform.services.jcr.impl.core.access.JAASAuthenticator");
      rEntry.setSecurityDomain("exo-domain");
      rEntry.setSystemWorkspaceName(wsName);
      rEntry.setDefaultWorkspaceName(wsName);

      WorkspaceEntry wEntry =
         makeWorkspaceEntry(rDefault.getWorkspaceEntries().get(0), rName, wsName, "jdbcjcr_to_rest_repo_1", true);
      rEntry.addWorkspace(wEntry);

      JsonGeneratorImpl generatorImpl = new JsonGeneratorImpl();
      JsonValue json = generatorImpl.createJsonObject(rEntry);

      MultivaluedMap<String, String> headers = new MultivaluedMapImpl();
View Full Code Here

   public void testCreateRepositoryWithInvalidChars() throws Exception
   {
      String wsName = "ws_over:?//\\__rest!!_1";
      String rName = "repo:?//\\_over:_re??st";

      RepositoryEntry rDefault =
         repositoryService.getConfig().getRepositoryConfiguration(
            repositoryService.getConfig().getDefaultRepositoryName());

      RepositoryEntry rEntry = new RepositoryEntry();

      rEntry.setName(rName);
      rEntry.setSessionTimeOut(3600000);
      rEntry.setAuthenticationPolicy("org.exoplatform.services.jcr.impl.core.access.JAASAuthenticator");
      rEntry.setSecurityDomain("exo-domain");
      rEntry.setSystemWorkspaceName(wsName);
      rEntry.setDefaultWorkspaceName(wsName);

      WorkspaceEntry wEntry =
         makeWorkspaceEntry(rDefault.getWorkspaceEntries().get(0), rName, wsName, "jdbcjcr_to_rest_repo_1", true);
      rEntry.addWorkspace(wEntry);

      JsonGeneratorImpl generatorImpl = new JsonGeneratorImpl();
      JsonValue json = generatorImpl.createJsonObject(rEntry);

      MultivaluedMap<String, String> headers = new MultivaluedMapImpl();
View Full Code Here

      String tenantName = "new_repository_mutli-db";
      String repoToken = creatorService.reserveRepositoryName(tenantName);

      // restore            
      RepositoryEntry newRE =
         helper.createRepositoryEntry(true, repository.getConfiguration().getSystemWorkspaceName(),
            IdGenerator.generate());
      newRE.setName(tenantName);

      WorkspaceEntry newWSEntry = helper.createWorkspaceEntry(true, IdGenerator.generate());
      newWSEntry.setName(wsEntry.getName());
      newRE.addWorkspace(newWSEntry);

      creatorService.createRepository(bch.getBackupId(), newRE, repoToken);

      // check
      ManageableRepository restoredRepository = repositoryService.getRepository(tenantName);
View Full Code Here

TOP

Related Classes of org.exoplatform.services.jcr.config.RepositoryEntry

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.