Package org.exoplatform.services.jcr.impl

Examples of org.exoplatform.services.jcr.impl.WorkspaceContainer


                     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);

                     ConnectionFailDetector failDetector =
                        new ConnectionFailDetector(channelManager, dataManager, recoveryManager, ownPriority,
                           participantsClusterList, ownName, priprityType, workspaces[wIndex]);
                     channelManager.addStateListener(failDetector);

                     // add data transmitter
                     wContainer.registerComponentImplementation(WorkspaceDataTransmitter.class);
                     WorkspaceDataTransmitter dataTransmitter =
                        (WorkspaceDataTransmitter)wContainer.getComponentInstanceOfType(WorkspaceDataTransmitter.class);
                     dataTransmitter.init(/* disp */channelManager, systemId, ownName, recoveryManager);

                     // add data receiver
                     AbstractWorkspaceDataReceiver dataReceiver = null;

                     if (mode.equals(PROXY_MODE))
                     {
                        wContainer.registerComponentImplementation(WorkspaceDataManagerProxy.class);
                        wContainer.registerComponentImplementation(ProxyWorkspaceDataReceiver.class);
                        dataReceiver =
                           (ProxyWorkspaceDataReceiver)wContainer
                              .getComponentInstanceOfType(ProxyWorkspaceDataReceiver.class);
                     }
                     else if (mode.equals(PERSISTENT_MODE))
                     {
                        wContainer.registerComponentImplementation(PersistentWorkspaceDataReceiver.class);
                        dataReceiver =
                           (PersistentWorkspaceDataReceiver)wContainer
                              .getComponentInstanceOfType(PersistentWorkspaceDataReceiver.class);
                     }

                     recoveryManager.setDataKeeper(dataReceiver.getDataKeeper());
                     dataReceiver.init(channelManager, systemId, ownName, recoveryManager);
View Full Code Here


                     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);

                     ConnectionFailDetector failDetector =
                        new ConnectionFailDetector(channelManager, dataManager, recoveryManager, ownPriority,
                           participantsClusterList, ownName, priprityType, workspaces[wIndex]);
                     channelManager.addStateListener(failDetector);

                     // add data transmitter
                     wContainer.registerComponentImplementation(WorkspaceDataTransmitter.class);
                     WorkspaceDataTransmitter dataTransmitter =
                        (WorkspaceDataTransmitter)wContainer.getComponentInstanceOfType(WorkspaceDataTransmitter.class);
                     dataTransmitter.init(/* disp */channelManager, systemId, ownName, recoveryManager);

                     // add data receiver
                     AbstractWorkspaceDataReceiver dataReceiver = null;

                     if (mode.equals(PROXY_MODE))
                     {
                        wContainer.registerComponentImplementation(WorkspaceDataManagerProxy.class);
                        wContainer.registerComponentImplementation(ProxyWorkspaceDataReceiver.class);
                        dataReceiver =
                           (ProxyWorkspaceDataReceiver)wContainer
                              .getComponentInstanceOfType(ProxyWorkspaceDataReceiver.class);
                     }
                     else if (mode.equals(PERSISTENT_MODE))
                     {
                        wContainer.registerComponentImplementation(PersistentWorkspaceDataReceiver.class);
                        dataReceiver =
                           (PersistentWorkspaceDataReceiver)wContainer
                              .getComponentInstanceOfType(PersistentWorkspaceDataReceiver.class);
                     }

                     recoveryManager.setDataKeeper(dataReceiver.getDataKeeper());
                     dataReceiver.init(channelManager, systemId, ownName, recoveryManager);
View Full Code Here

      {
         repositoryContainer.registerWorkspace(wsConfig);
      }
      catch (RepositoryConfigurationException e)
      {
         WorkspaceContainer workspaceContainer = repositoryContainer.getWorkspaceContainer(wsConfig.getName());
         repositoryContainer.unregisterComponentByInstance(workspaceContainer);
         repositoryContainer.unregisterComponent(wsConfig.getName());
         throw new RepositoryConfigurationException(e);
      }
      catch (RepositoryException e)
      {
         WorkspaceContainer workspaceContainer = repositoryContainer.getWorkspaceContainer(wsConfig.getName());
         repositoryContainer.unregisterComponentByInstance(workspaceContainer);
         repositoryContainer.unregisterComponent(wsConfig.getName());
         throw new RepositoryException(e);
      }
   }
View Full Code Here

      {
         LOG.warn("Workspace '" + workspaceName + "' is presumably initialized. config canceled");
         return;
      }

      WorkspaceContainer wsContainer = repositoryContainer.getWorkspaceContainer(workspaceName);

      if (wsContainer == null)
         throw new RepositoryException("Workspace " + workspaceName
            + " is not configured. Use RepositoryImpl.configWorkspace() method");

      repositoryContainer.getWorkspaceContainer(workspaceName).getWorkspaceInitializer().initWorkspace();

      wsContainer.start();

      LOG.info("Workspace " + workspaceName + "@" + this.name + " is initialized");
   }
View Full Code Here

   public SessionImpl getSystemSession(String workspaceName) throws RepositoryException
   {
      if (getState() == OFFLINE)
         LOG.warn("Repository " + getName() + " is OFFLINE.");

      WorkspaceContainer workspaceContainer = repositoryContainer.getWorkspaceContainer(workspaceName);
      if (workspaceContainer == null || !workspaceContainer.getWorkspaceInitializer().isWorkspaceInitialized())
      {
         throw new RepositoryException("Workspace " + workspaceName + " not found or workspace is not initialized");
      }

      SessionFactory sessionFactory = workspaceContainer.getSessionFactory();

      return sessionFactory.createSession(authenticationPolicy.authenticate(SYSTEM_CREDENTIALS));
   }
View Full Code Here

    * @param workspaceName workspace name
    * @throws RepositoryException error of remove
    */
   public void internalRemoveWorkspace(String workspaceName) throws RepositoryException
   {
      WorkspaceContainer workspaceContainer = null;
      if (isWorkspaceInitialized(workspaceName))
      {
         workspaceContainer = repositoryContainer.getWorkspaceContainer(workspaceName);
         try
         {
            workspaceContainer.stop();
         }
         catch (Exception e)
         {
            throw new RepositoryException(e);
         }
View Full Code Here

            }
         }
      }
      catch (RepositoryConfigurationException e)
      {
         WorkspaceContainer workspaceContainer = repositoryContainer.getWorkspaceContainer(wsConfig.getName());
         repositoryContainer.unregisterComponentByInstance(workspaceContainer);
         repositoryContainer.unregisterComponent(wsConfig.getName());
         throw new RepositoryConfigurationException(e);
      }
      catch (RepositoryException e)
      {
         WorkspaceContainer workspaceContainer = repositoryContainer.getWorkspaceContainer(wsConfig.getName());
         repositoryContainer.unregisterComponentByInstance(workspaceContainer);
         repositoryContainer.unregisterComponent(wsConfig.getName());
         throw new RepositoryException(e);
      }
   }
View Full Code Here

      {
         LOG.warn("Workspace '" + workspaceName + "' is presumably initialized. config canceled");
         return;
      }

      final WorkspaceContainer wsContainer = repositoryContainer.getWorkspaceContainer(workspaceName);

      if (wsContainer == null)
         throw new RepositoryException("Workspace " + workspaceName
            + " is not configured. Use RepositoryImpl.configWorkspace() method");

      repositoryContainer.getWorkspaceContainer(workspaceName).getWorkspaceInitializer().initWorkspace();

      PrivilegedAction<Object> action = new PrivilegedAction<Object>()
      {
         public Object run()
         {
            wsContainer.start();
            return null;
         }
      };

      AccessController.doPrivileged(action);
View Full Code Here

   {

      if (getState() == OFFLINE)
         LOG.warn("Repository " + getName() + " is OFFLINE.");

      WorkspaceContainer workspaceContainer = repositoryContainer.getWorkspaceContainer(workspaceName);
      if (workspaceContainer == null || !workspaceContainer.getWorkspaceInitializer().isWorkspaceInitialized())
      {
         throw new RepositoryException("Workspace " + workspaceName + " not found or workspace is not initialized");
      }

      SessionFactory sessionFactory = workspaceContainer.getSessionFactory();

      return sessionFactory.createSession(authenticationPolicy.authenticate(SYSTEM_CREDENTIALS));
   }
View Full Code Here

      if (security != null)
      {
         security.checkPermission(JCRRuntimePermissions.MANAGE_REPOSITORY_PERMISSION);
      }

      WorkspaceContainer workspaceContainer = null;
      if (isWorkspaceInitialized(workspaceName))
      {
         workspaceContainer = repositoryContainer.getWorkspaceContainer(workspaceName);
         try
         {
            workspaceContainer.stop();
         }
         catch (Exception e)
         {
            throw new RepositoryException(e);
         }
View Full Code Here

TOP

Related Classes of org.exoplatform.services.jcr.impl.WorkspaceContainer

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.