Package org.exoplatform.services.jcr.config

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


   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


   {
      boolean restored = true;
      RepositoryImpl repository = (RepositoryImpl)repositoryService.getRepository(repositoryName);
      try
      {
         RepositoryEntry reEntry = repository.getConfiguration();
         backupManager.restore(backupChainLog, reEntry.getName(), wEntry, false);
      }
      catch (InvalidItemStateException e)
      {
         restored = false;
         throw new WorkspaceRestoreExeption("Workspace '" + "/" + repositoryName + "/" + wEntry.getName()
View Full Code Here

    IBindingFactory factory = BindingDirectory.getFactory(RepositoryServiceConfiguration.class);
    IUnmarshallingContext uctx = factory.createUnmarshallingContext();
    RepositoryServiceConfiguration conf = (RepositoryServiceConfiguration) uctx.unmarshalDocument(wEntryStream,
                                                                                                  null);
    RepositoryEntry rEntry = conf.getRepositoryConfiguration(repositoryName);
   
    for (WorkspaceEntry wEntry : rEntry.getWorkspaceEntries())
      if (wEntry.getName().equals(workspaceName))
        wsEntry = wEntry;
   

    if (wsEntry == null)
View Full Code Here

   }

   private WorkspaceEntry getWorkspaceEntry(BackupConfig config,
            RepositoryServiceConfiguration repositoryServiceConfiguration) throws BackupOperationException
   {
      RepositoryEntry repository = null;
      try
      {
         repository = repositoryServiceConfiguration.getRepositoryConfiguration(config.getRepository());
      }
      catch (RepositoryConfigurationException e)
      {
         throw new BackupOperationException("Can not get repository \"" + config.getRepository() + "\"", e);
      }

      WorkspaceEntry wEntry = null;

      for (WorkspaceEntry entry : repository.getWorkspaceEntries())
      {
         if (entry.getName().equals(config.getWorkspace()))
         {
            wEntry = entry;
            break;
         }
      }

      if (wEntry == null)
      {
         throw new BackupOperationException("Worksapce \"" + config.getWorkspace()
                  + "\" was not exsisted in repository \"" + repository.getName() + "\".");
      }

      return wEntry;
   }
View Full Code Here

         IBindingFactory factory = BindingDirectory.getFactory(RepositoryServiceConfiguration.class);
         IUnmarshallingContext uctx = factory.createUnmarshallingContext();
         RepositoryServiceConfiguration conf =
                  (RepositoryServiceConfiguration) uctx.unmarshalDocument(new FileInputStream(configFile), null);

         RepositoryEntry repositoryEntry = conf.getRepositoryConfiguration(getBackupConfig().getRepository());

         if (repositoryEntry.getWorkspaceEntries().size() != 1)
         {
            throw new WorkspaceRestoreExeption(
                     "The oririginal configuration should be contains only one workspace entry :"
                              + configFile.getCanonicalPath());
         }

         if (!repositoryEntry.getWorkspaceEntries().get(0).getName().equals(getBackupConfig().getWorkspace()))
         {
            throw new WorkspaceRestoreExeption(
                     "The oririginal configuration should be contains only one workspace entry with name \""
                              + getBackupConfig().getWorkspace() + "\" :"
                              + configFile.getCanonicalPath());
         }

         return repositoryEntry.getWorkspaceEntries().get(0);
      }
View Full Code Here

                  new File(BackupChainLog.this.config.getBackupDir().getCanonicalPath()
                           + File.separator + "original-workspace-config.xml");
         config.createNewFile();
         OutputStream saveStream = new FileOutputStream(config);

         RepositoryEntry baseRepositoryEntry =
                  serviceConfiguration.getRepositoryConfiguration(BackupChainLog.this.config.getRepository());

         RepositoryEntry repositoryEntry = new RepositoryEntry();
         repositoryEntry.addWorkspace(originalWorkspaceEntry);
         repositoryEntry.setSystemWorkspaceName(baseRepositoryEntry.getSystemWorkspaceName());
         repositoryEntry.setAccessControl(baseRepositoryEntry.getAccessControl());
         repositoryEntry.setAuthenticationPolicy(baseRepositoryEntry.getAuthenticationPolicy());
         repositoryEntry.setDefaultWorkspaceName(baseRepositoryEntry.getDefaultWorkspaceName());
         repositoryEntry.setName(baseRepositoryEntry.getName());
         repositoryEntry.setSecurityDomain(baseRepositoryEntry.getSecurityDomain());
         repositoryEntry.setSessionTimeOut(baseRepositoryEntry.getSessionTimeOut());

         ArrayList<RepositoryEntry> repositoryEntries = new ArrayList<RepositoryEntry>();
         repositoryEntries.add(repositoryEntry);

         RepositoryServiceConfiguration newRepositoryServiceConfiguration =
View Full Code Here

   protected void restoreRepository() throws RepositoryRestoreExeption
   {
      try
      {
         // get current repository configuration
         RepositoryEntry repositoryEntry =
            repositoryService.getConfig().getRepositoryConfiguration(this.repositoryEntry.getName());

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

         boolean isDefault =
            repositoryService.getDefaultRepository().getConfiguration().getName().equals(repositoryEntry.getName());

         //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());
         }

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

         //clean database
         RepositoryEntry re = new RepositoryEntry();
         re.setWorkspaceEntries(workspaceList);
         dbCleanerService.cleanRepositoryData(re);

         //clean index
         for (WorkspaceEntry wEntry : workspaceList)
         {
View Full Code Here

      this.startTime = Calendar.getInstance();
      this.repositoryBackupId = repositoryBackupId;

      List<String> wsLogFilePathList = new ArrayList<String>();
     
      RepositoryEntry repository;
      try
      {
         repository = repositoryService.getConfig().getRepositoryConfiguration(config.getRepository());
      }
      catch (RepositoryConfigurationException e)
      {
         throw new BackupOperationException("Can not get repository \"" + config.getRepository() + "\"", e);
      }
     
      for (WorkspaceEntry workspaceEntry : repository.getWorkspaceEntries())
      {
         BackupConfig wsBackupConfig = new BackupConfig();
         wsBackupConfig.setRepository(config.getRepository());
         wsBackupConfig.setWorkspace(workspaceEntry.getName());
         wsBackupConfig.setBackupType(config.getBackupType());
         wsBackupConfig.setIncrementalJobNumber(config.getIncrementalJobNumber());
         wsBackupConfig.setIncrementalJobPeriod(config.getIncrementalJobPeriod());

         Calendar startTime = Calendar.getInstance();
         File dir =
                  FileNameProducer.generateBackupSetDir(wsBackupConfig.getRepository(), wsBackupConfig.getWorkspace(),
                           config.getBackupDir().getPath(), startTime);
         dir.mkdirs();
         wsBackupConfig.setBackupDir(dir);

         BackupChain bchain =
                  new BackupChainImpl(wsBackupConfig, wsBackupConfig.getBackupDir(), repositoryService, fullBackupType,
                           incrementalBackupType, IdGenerator.generate(), logDirectory, startTime);
        
         wsLogFilePathList.add(bchain.getLogFilePath());
         workspaceBackups.add(bchain);
      }
     
      this.repositoryChainLog = new RepositoryBackupChainLog(logDirectory,
                                                             this.config,
                                                             fullBackupType,
                                                             incrementalBackupType,
                                                             repository.getSystemWorkspaceName(),
                                                             wsLogFilePathList,
                                                             this.repositoryBackupId,
                                                             startTime,
                                                             repository,
                                                             repositoryService.getConfig());
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);
         parentContainer.unregisterComponent(repositoryContainer.getName());
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.