Package org.exoplatform.services.jcr.impl.core

Examples of org.exoplatform.services.jcr.impl.core.RepositoryImpl


   private void fullRestore(String pathBackupFile, String repositoryName, String workspaceName,
      WorkspaceEntry workspaceEntry) throws FileNotFoundException, IOException, RepositoryException,
      RepositoryConfigurationException
   {

      RepositoryImpl defRep = (RepositoryImpl)repoService.getRepository(repositoryName);

      defRep.importWorkspace(workspaceEntry.getName(), new FileInputStream(pathBackupFile));
   }
View Full Code Here


   private void fullRestoreOverInitializer(String pathBackupFile, String repositoryName, WorkspaceEntry workspaceEntry)
      throws FileNotFoundException, IOException, RepositoryException, RepositoryConfigurationException
   {
      WorkspaceInitializerEntry wieOriginal = workspaceEntry.getInitializer();

      RepositoryImpl defRep = (RepositoryImpl)repoService.getRepository(repositoryName);

      // set the initializer SysViewWorkspaceInitializer
      WorkspaceInitializerEntry wiEntry = new WorkspaceInitializerEntry();
      wiEntry.setType(SysViewWorkspaceInitializer.class.getCanonicalName());

      List<SimpleParameterEntry> wieParams = new ArrayList<SimpleParameterEntry>();
      wieParams.add(new SimpleParameterEntry(SysViewWorkspaceInitializer.RESTORE_PATH_PARAMETER, pathBackupFile));

      wiEntry.setParameters(wieParams);

      workspaceEntry.setInitializer(wiEntry);

      //restore
      defRep.configWorkspace(workspaceEntry);
      defRep.createWorkspace(workspaceEntry.getName());

      //set original workspace initializer
      WorkspaceContainerFacade wcf = defRep.getWorkspaceContainer(workspaceEntry.getName());
      WorkspaceEntry createdWorkspaceEntry = (WorkspaceEntry)wcf.getComponent(WorkspaceEntry.class);
      createdWorkspaceEntry.setInitializer(wieOriginal);
   }
View Full Code Here

         validateWorkspaceName(repository, workspace);

         if (forceSessionClose)
            forceCloseSession(repository, workspace);

         RepositoryImpl repositoryImpl = (RepositoryImpl)repositoryService.getRepository(repository);
         repositoryImpl.removeWorkspace(workspace);
         repositoryService.getConfig().retain(); // save configuration to persistence (file or persister)

         return Response.ok().cacheControl(noCache).build();

      }
View Full Code Here

      try
      {
         for (int rIndex = 0; rIndex < repoNamesList.size(); rIndex++)
         {
            RepositoryImpl jcrRepository = (RepositoryImpl)repoService.getRepository(repoNamesList.get(rIndex));

            String[] workspaces = jcrRepository.getWorkspaceNames();

            if (enabled.equals("true"))
            {
               // set ownName & participantsClusterList for test mode
               if (testMode != null && "true".equals(testMode))
               {
                  ownName = (rIndex == 0 ? "cluster_node_1" : "cluster_node_2");
                  participantsClusterList = new ArrayList<String>();

                  if (rIndex == 0)
                  {
                     ownPriority = 100;
                     participantsClusterList.add("cluster_node_2");
                  }
                  else
                  {
                     ownPriority = 50;
                     participantsClusterList.add("cluster_node_1");
                  }
               }

               for (int wIndex = 0; wIndex < workspaces.length; wIndex++)
                  try
                  {
                     // create the recovery for workspace
                     File dir =
                        new File(recoveryDir.getAbsolutePath() + File.separator + repoNamesList.get(rIndex) + "_"
                           + workspaces[wIndex]);
                     dir.mkdirs();

                     String systemId = IdGenerator.generate();
                     String props = channelConfig.replaceAll(IP_ADRESS_TEMPLATE, bindIPAddress);

                     // get workspace container
                     WorkspaceContainer wContainer =
                        (WorkspaceContainer)jcrRepository.getSystemSession(workspaces[wIndex]).getContainer();

                     String uniqueNoame = jcrRepository.getName() + "_" + workspaces[wIndex];
                     if (testMode != null && "true".equals(testMode))
                        uniqueNoame = "Test_Channel234";

                     ReplicationChannelManager channelManager =
                        new ReplicationChannelManager(props, channelName + (channelName.equals("") ? "" : "_")
                           + uniqueNoame);

                     WorkspaceContainerFacade wsFacade = jcrRepository.getWorkspaceContainer(workspaces[wIndex]);
                     WorkspaceEntry wconf = (WorkspaceEntry)wsFacade.getComponent(WorkspaceEntry.class);

                     int maxBufferSize =
                        wconf.getContainer().getParameterInteger(WorkspaceDataContainer.MAXBUFFERSIZE_PROP,
                           WorkspaceDataContainer.DEF_MAXBUFFERSIZE);

                     WorkspaceFileCleanerHolder wfcleaner =
                        (WorkspaceFileCleanerHolder)wsFacade.getComponent(WorkspaceFileCleanerHolder.class);
                     FileCleaner fileCleaner = wfcleaner.getFileCleaner();

                     // create the RecoveryManager
                     RecoveryManager recoveryManager =
                        new RecoveryManager(dir, ownName, systemId, participantsClusterList, waitConfirmation,
                           jcrRepository.getName(), workspaces[wIndex], channelManager, fileCleaner, maxBufferSize,
                           new ReaderSpoolFileHolder());

                     PersistentDataManager dataManager =
                        (PersistentDataManager)wsFacade.getComponent(PersistentDataManager.class);
View Full Code Here

   {
      String errorMessage = new String();
      Status status;
      try
      {
         RepositoryImpl repository = (RepositoryImpl)repositoryService.getRepository(repositoryName);
         repository.configWorkspace(newWorkspace);
         repository.createWorkspace(newWorkspace.getName());
         repositoryService.getConfig().retain(); // save configuration to persistence (file or persister)
         return Response.ok().cacheControl(NO_CACHE).build();
      }
      catch (RepositoryException e)
      {
View Full Code Here

   {
      String errorMessage = new String();
      Status status;
      try
      {
         RepositoryImpl repository = (RepositoryImpl)repositoryService.getRepository(repositoryName);
         repository.configWorkspace(newWorkspace);
         repository.createWorkspace(newWorkspace.getName());
         repositoryService.getConfig().retain(); // save configuration to persistence (file or persister)
         return Response.ok().cacheControl(NO_CACHE).build();
      }
      catch (RepositoryException e)
      {
View Full Code Here

      try
      {
         for (int rIndex = 0; rIndex < repoNamesList.size(); rIndex++)
         {
            RepositoryImpl jcrRepository = (RepositoryImpl)repoService.getRepository(repoNamesList.get(rIndex));

            String[] workspaces = jcrRepository.getWorkspaceNames();

            if (enabled.equals("true"))
            {
               // set ownName & participantsClusterList for test mode
               if (testMode != null && "true".equals(testMode))
               {
                  ownName = (rIndex == 0 ? "cluster_node_1" : "cluster_node_2");
                  participantsClusterList = new ArrayList<String>();

                  if (rIndex == 0)
                  {
                     ownPriority = 100;
                     participantsClusterList.add("cluster_node_2");
                  }
                  else
                  {
                     ownPriority = 50;
                     participantsClusterList.add("cluster_node_1");
                  }
               }

               for (int wIndex = 0; wIndex < workspaces.length; wIndex++)
                  try
                  {
                     // create the recovery for workspace
                     File dir =
                        new File(recoveryDir.getAbsolutePath() + File.separator + repoNamesList.get(rIndex) + "_"
                           + workspaces[wIndex]);
                     dir.mkdirs();

                     String systemId = IdGenerator.generate();
                     String props = channelConfig.replaceAll(IP_ADRESS_TEMPLATE, bindIPAddress);

                     // get workspace container
                     WorkspaceContainer wContainer =
                        (WorkspaceContainer)jcrRepository.getSystemSession(workspaces[wIndex]).getContainer();

                     String uniqueNoame = jcrRepository.getName() + "_" + workspaces[wIndex];
                     if (testMode != null && "true".equals(testMode))
                        uniqueNoame = "Test_Channel234";

                     ReplicationChannelManager channelManager =
                        new ReplicationChannelManager(props, channelName + (channelName.equals("") ? "" : "_")
                           + uniqueNoame);

                     WorkspaceContainerFacade wsFacade = jcrRepository.getWorkspaceContainer(workspaces[wIndex]);
                     WorkspaceEntry wconf = (WorkspaceEntry)wsFacade.getComponent(WorkspaceEntry.class);

                     int maxBufferSize =
                        wconf.getContainer().getParameterInteger(WorkspaceDataContainer.MAXBUFFERSIZE_PROP,
                           WorkspaceDataContainer.DEF_MAXBUFFERSIZE);

                     FileCleanerHolder wfcleaner = (FileCleanerHolder)wsFacade.getComponent(FileCleanerHolder.class);
                     FileCleaner fileCleaner = wfcleaner.getFileCleaner();

                     // create the RecoveryManager
                     RecoveryManager recoveryManager =
                        new RecoveryManager(dir, ownName, systemId, participantsClusterList, waitConfirmation,
                           jcrRepository.getName(), workspaces[wIndex], channelManager, fileCleaner, maxBufferSize,
                           new ReaderSpoolFileHolder());

                     PersistentDataManager dataManager =
                        (PersistentDataManager)wsFacade.getComponent(PersistentDataManager.class);
View Full Code Here

   private void fullRestore(String pathBackupFile, String repositoryName, String workspaceName,
      WorkspaceEntry workspaceEntry) throws FileNotFoundException, IOException, RepositoryException,
      RepositoryConfigurationException
   {

      RepositoryImpl defRep = (RepositoryImpl)repoService.getRepository(repositoryName);

      defRep.importWorkspace(workspaceEntry.getName(), new FileInputStream(pathBackupFile));
   }
View Full Code Here

      String fBackupType) throws FileNotFoundException, IOException, RepositoryException,
      RepositoryConfigurationException, ClassNotFoundException
   {
      WorkspaceInitializerEntry wieOriginal = workspaceEntry.getInitializer();

      RepositoryImpl defRep = (RepositoryImpl)repoService.getRepository(repositoryName);

      WorkspaceInitializerEntry wiEntry = new WorkspaceInitializerEntry();

      if ((Class.forName(fBackupType).equals(FullBackupJob.class)))
      {
         // set the initializer SysViewWorkspaceInitializer
         wiEntry.setType(SysViewWorkspaceInitializer.class.getCanonicalName());

         List<SimpleParameterEntry> wieParams = new ArrayList<SimpleParameterEntry>();
         wieParams.add(new SimpleParameterEntry(SysViewWorkspaceInitializer.RESTORE_PATH_PARAMETER, pathBackupFile));

         wiEntry.setParameters(wieParams);
      }

      workspaceEntry.setInitializer(wiEntry);

      //restore
      defRep.configWorkspace(workspaceEntry);
      defRep.createWorkspace(workspaceEntry.getName());

      //set original workspace initializer
      WorkspaceContainerFacade wcf = defRep.getWorkspaceContainer(workspaceEntry.getName());
      WorkspaceEntry createdWorkspaceEntry = (WorkspaceEntry)wcf.getComponent(WorkspaceEntry.class);
      createdWorkspaceEntry.setInitializer(wieOriginal);
   }
View Full Code Here

      try
      {
         repositoryService.createRepository(repositoryEntry);

         //set original initializer to created workspace.
         RepositoryImpl defRep = (RepositoryImpl)repositoryService.getRepository(repositoryEntry.getName());
         WorkspaceContainerFacade wcf = defRep.getWorkspaceContainer(systemWorkspaceEntry.getName());
         WorkspaceEntry createdWorkspaceEntry = (WorkspaceEntry)wcf.getComponent(WorkspaceEntry.class);
         createdWorkspaceEntry.setInitializer(wieOriginal);

         // save configuration to persistence (file or persister)
         repositoryService.getConfig().retain();
View Full Code Here

TOP

Related Classes of org.exoplatform.services.jcr.impl.core.RepositoryImpl

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.