AbstractVersioningVFS.java :  » Content-Management-System » harmonise » org » openharmonise » vfs » Java Open Source

Java Open Source » Content Management System » harmonise 
harmonise » org » openharmonise » vfs » AbstractVersioningVFS.java
/*
 * The contents of this file are subject to the 
 * Mozilla Public License Version 1.1 (the "License"); 
 * you may not use this file except in compliance with the License. 
 * You may obtain a copy of the License at http://www.mozilla.org/MPL/
 *
 * Software distributed under the License is distributed on an "AS IS"
 * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. 
 * See the License for the specific language governing rights and 
 * limitations under the License.
 *
 * The Initial Developer of the Original Code is Simulacra Media Ltd.
 * Portions created by Simulacra Media Ltd are Copyright (C) Simulacra Media Ltd, 2004.
 *
 * All Rights Reserved.
 *
 * Contributor(s):
 */
package org.openharmonise.vfs;

import java.net.URI;

import org.openharmonise.vfs.authentication.*;
import org.openharmonise.vfs.status.*;


/**
 * This is the abstract class from which all Virtual File Systems which
 * implement versioning features should extend.
 * 
 * @author Matthew Large
 * @version $Revision: 1.1 $
 *
 */
public abstract class AbstractVersioningVFS extends AbstractVirtualFileSystem {

  /**
   * @param uri URI to locate the file system to be connected to
   */
  public AbstractVersioningVFS(URI uri) {
    super(uri);
  }

  /**
   * @param uri URI to locate the file system to be connected to
   * @param authInfo Authentication information for the file system to be connected to
   */
  public AbstractVersioningVFS(URI uri, AuthInfo authInfo) {
    super(uri, authInfo);
  }

  /**
   * @param uri URI to locate the file system to be connected to
   * @param authStore Authentication store to use to lookup authentication information for the file system to be connected to
   */
  public AbstractVersioningVFS(URI uri, AbstractAuthenticationStore authStore) {
    super(uri, authStore);
  }
  
  /**
   * Checks out a new version of the virtual file
   * 
   * @param sFullPath Full path to the file to be checked out
   * @return true if the method was successful
   */
  public abstract StatusData checkoutVirtualFile(String sFullPath);
  
  /**
   * Unchecks out the virtual file
   * 
   * @param sFullPath Full path to the file to be unchecked out
   * @return true if the method was successful
   */
  public abstract StatusData uncheckoutVirtualFile(String sFullPath);
  
  /**
   * Checks in the virtual file making this the current version
   * 
   * @param sFullPath Full path to the file to be checked in
   * @return true if the method was successful
   */
  public abstract StatusData checkinVirtualFile(String sFullPath);
  
  /**
   * Tags a virtual file
   * 
   * @param sFullPath Full path to the file to be tagged
   * @param sTag Tag to put in file
   * @return true if the method was successful
   */
  public abstract StatusData tagVirtualFile(String sFullPath, String sTag);
  
  /**
   * Reactives a version of a virtual file to be the current checked out virtual file.
   * This will fail if there is already a checked out version.
   * 
   * @param sFullPath Full path to the version to be reactived
   * @return true if the method was successful
   */
  public abstract StatusData reactivateVersion(String sFullPath);
  
  /**
   * Populates the list of historical versions for a virtual file. These
   * are typically not populated when a virtual file is first fetched.
   * 
   * @param vfFile Virtual file to have its history populated
   */
  protected abstract void fullyPopulateFileHistory(VersionedVirtualFile vfFile);

  /**
   * Provides access to the {@link VersionedVirtualFile#setHistoryPopulated(boolean)} method.
   * 
   * @param vfFile Virtual file to be used
   * @param bHistoryPopulated true to set the virtual file's history as populated
   */
  protected void setFileHistoryPopulated(VersionedVirtualFile vfFile, boolean bHistoryPopulated) {
    vfFile.setHistoryPopulated(bHistoryPopulated);
  }
  
  /**
   * Provides access to the {@link VersionedVirtualFile#addHistoricalVersion(String)} method.
   * 
   * @param vfFile Virtual file to be used
   * @param sPath Path to add to history
   */
  protected void addHistoricalVersionPath(VersionedVirtualFile vfFile, String sPath) {
    vfFile.addHistoricalVersion(sPath);
  }
  
  /**
   * Provides access to the {@link VersionedVirtualFile#setPendingVersionPath(String)} method.
   * 
   * @param vfFile Virtual file to be used
   * @param sPath Path to be set as the pending version path
   */
  protected void setFilePendingVersionPath(VersionedVirtualFile vfFile, String sPath) {
    vfFile.setPendingVersionPath(sPath);
  }
  
  /**
   * Provides access to the {@link VersionedVirtualFile#setLiveVersionPath(String)} method.
   * 
   * @param vfFile Virtual file to be used
   * @param sPath Path to be set as the live version path
   */
  protected void setFileLiveVersionPath(VersionedVirtualFile vfFile, String sPath) {
    vfFile.setLiveVersionPath(sPath);
  }
}
java2s.com  | Contact Us | Privacy Policy
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.