/* * Copyright (C) 2006 Alfresco, Inc. * * Licensed under the Mozilla Public License version 1.1 * with a permitted attribution clause. You may obtain a * copy of the License at * * http://www.alfresco.org/legal/license.txt * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, * either express or implied. See the License for the specific * language governing permissions and limitations under the * License. */ package org.alfresco.filesys.avm; import org.alfresco.filesys.server.filesys.FileName; /** * AVM Path Class * *
Parses a share relative path into store, version and remaining path values.
*
* @author gkspencer
*/
public class AVMPath {
// Constants
//
// Invalid version id value
private static final int InvalidVersionId = -2;
// Version id string for the head version
private static final String VersionNameHead = "Head";
// AVM path seperator
public static final char AVM_SEPERATOR = '/';
// Store name
private String m_storeName;
// Version id
private int m_version = InvalidVersionId;
// Remaining path
private String m_path;
// AVM style path
private String m_avmPath;
/**
* Class constructor
*
* @param shrPath String
*/
public AVMPath(String shrPath)
{
// Parse the path
parsePath( shrPath);
}
/**
* Return the store name
*
* @return String
*/
public final String getStoreName()
{
return m_storeName;
}
/**
* Check if the version id was specified in the path
*
* @return boolean
*/
public final boolean hasVersion()
{
return m_version != InvalidVersionId ? true : false;
}
/**
* Return the version id
*
* @return int
*/
public final int getVersion()
{
return m_version;
}
/**
* Return the share relative path
*
* @return String
*/
public final String getRelativePath()
{
return m_path;
}
/**
* Return the AVM style path, in