Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
  /*
   * Copyright (C) 2009 eXo Platform SAS.
   *
   * This is free software; you can redistribute it and/or modify it
   * under the terms of the GNU Lesser General Public License as
   * published by the Free Software Foundation; either version 2.1 of
   * the License, or (at your option) any later version.
   *
   * This software is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
  * License along with this software; if not, write to the Free
  * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
  * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
  */
 package org.exoplatform.services.jcr.ext.replication.test.priority;
 
Created by The eXo Platform SAS.

Author(s):
Alex Reshetnyak
Version:
$Id: BasePriorityTestCase.java 111 2008-11-11 11:11:11Z rainf0x $
 
 
 {

   
Logger.
 
    private static final Log log = ExoLogger.getLogger("exo.jcr.component.ext.BasePriorityTestCase");

   
The workspaceDataTransmitter will be used for getting the ChannelManager.
 
    protected WorkspaceDataTransmitter dataTransmitter;

   
BasePriorityTestCase constructor.

Parameters:
repositoryService the RepositoryService.
reposytoryName the repository name
workspaceName the workspace name
userName the user name
password the password
 
    public BasePriorityTestCase(RepositoryService repositoryServiceString reposytoryNameString workspaceName,
       String userNameString password)
    {
       super(repositoryServicereposytoryNameworkspaceNameuserNamepassword);
 
       WorkspaceContainerFacade wContainer =
 
    }

   
disconnectClusterNode.

Returns:
StringBuffer return the responds {'ok', 'fail'}
 
    {
       StringBuffer sb = new StringBuffer();
 
       try
       {
          ReplicationChannelManager channelManager = .getChannelManager();
          channelManager.setAllowConnect(false);
          channelManager.disconnect();
 
          channelManager.connect();
 
          sb.append("ok");
       }
       catch (Exception e)
       {
          .error("Can't disconnected node of cluster: "e);
          sb.append("fail");
      }
      return sb;
   }

   
disconnectClusterNode.

Parameters:
id the changed id
Returns:
StringBuffer return the responds {'ok', 'fail'}
   public StringBuffer disconnectClusterNode(int id)
   {
      StringBuffer sb = new StringBuffer();
      try
      {
         ReplicationChannelManager channelManager = .getChannelManager();
         channelManager.setAllowConnect(falseid);
         channelManager.disconnect();
         channelManager.connect();
         sb.append("ok");
      }
      catch (Exception e)
      {
         .error("Can't disconnected node of cluster: "e);
         sb.append("fail");
      }
      return sb;
   }

   
allowConnect.

Returns:
StringBuffer return the responds {'ok', 'fail'}
   public StringBuffer allowConnect()
   {
      StringBuffer sb = new StringBuffer();
      try
      {
         ReplicationChannelManager channelManager = .getChannelManager();
         channelManager.setAllowConnect(true);
         sb.append("ok");
      }
      catch (Exception e)
      {
         .error("Can't allowed connect node of cluster: "e);
         sb.append("fail");
      }
      return sb;
   }

   
allowConnectForced.

Returns:
StringBuffer return the responds {'ok', 'fail'}
   {
      StringBuffer sb = new StringBuffer();
      try
      {
         ReplicationChannelManager channelManager = .getChannelManager();
         channelManager.setAllowConnect(true);
         channelManager.disconnect();
         channelManager.connect();
         sb.append("ok");
      }
      catch (Exception e)
      {
         .error("Can't allowed connect node of cluster: "e);
         sb.append("fail");
      }
      return sb;
   }

   
isReadOnly.

Parameters:
workspaceName the workspace name
Returns:
StringBuffer return the responds {'ok', 'fail'}
   public StringBuffer isReadOnly(String workspaceName)
   {
      StringBuffer sb = new StringBuffer();
      try
      {
         WorkspaceContainerFacade wsFacade = ((RepositoryImpl)).getWorkspaceContainer(workspaceName);
         WorkspaceDataContainer dataContainer =
            (WorkspaceDataContainer)wsFacade.getComponent(WorkspaceDataContainer.class);
         PersistentDataManager dataManager = (PersistentDataManager)wsFacade.getComponent(PersistentDataManager.class);
         if (!dataManager.isReadOnly())
            throw new Exception("The workspace '" + dataContainer.getName() + "' was not read-only");
         sb.append("ok");
      }
      catch (Exception e)
      {
         .error("Read-only fail "e);
         sb.append("fail");
      }
      return sb;
   }
New to GrepCode? Check out our FAQ X