Moving to root below branch label

git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@2005 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Derek Hulley
2005-12-08 07:13:07 +00:00
commit e1e6508fec
1095 changed files with 230566 additions and 0 deletions

View File

@@ -0,0 +1,76 @@
/*
* Copyright (C) 2005 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.smb.server.ntfs;
import java.io.IOException;
import org.alfresco.filesys.server.SrvSession;
import org.alfresco.filesys.server.filesys.TreeConnection;
/**
* NTFS Streams Interface
* <p>
* Optional interface that a DiskInterface driver can implement to provide file streams support.
*/
public interface NTFSStreamsInterface
{
/**
* Determine if NTFS streams are enabled
*
* @param sess SrvSession
* @param tree TreeConnection
* @return boolean
*/
public boolean hasStreamsEnabled(SrvSession sess, TreeConnection tree);
/**
* Return stream information for the specified stream
*
* @param sess SrvSession
* @param tree TreeConnection
* @param streamInfo StreamInfo
* @return StreamInfo
* @exception IOException I/O error occurred
*/
public StreamInfo getStreamInformation(SrvSession sess, TreeConnection tree, StreamInfo streamInfo)
throws IOException;
/**
* Return a list of the streams for the specified file
*
* @param sess SrvSession
* @param tree TreeConnection
* @param fileName String
* @return StreamInfoList
* @exception IOException I/O error occurred
*/
public StreamInfoList getStreamList(SrvSession sess, TreeConnection tree, String fileName) throws IOException;
/**
* Rename a stream
*
* @param sess SrvSession
* @param tree TreeConnection
* @param oldName String
* @param newName String
* @param overWrite boolean
* @exception IOException
*/
public void renameStream(SrvSession sess, TreeConnection tree, String oldName, String newName, boolean overWrite)
throws IOException;
}

View File

@@ -0,0 +1,415 @@
/*
* Copyright (C) 2005 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.smb.server.ntfs;
/**
* File Stream Information Class
* <p>
* Contains the details of a file stream.
*/
public class StreamInfo
{
// Constants
public static final String StreamSeparator = ":";
// Set stream information flags
public static final int SetStreamSize = 0x0001;
public static final int SetAllocationSize = 0x0002;
public static final int SetModifyDate = 0x0004;
public static final int SetCreationDate = 0x0008;
public static final int SetAccessDate = 0x0010;
// File path and stream name
private String m_path;
private String m_name;
// Parent file id and stream id
private int m_fid;
private int m_stid;
// Stream size/allocation size
private long m_size;
private long m_allocSize;
// Stream creation, modification and access date/times
private long m_createDate;
private long m_modifyDate;
private long m_accessDate;
// Set stream information setter flags
private int m_setFlags;
/**
* Default constructor
*/
public StreamInfo()
{
}
/**
* Constructor
*
* @param path String
*/
public StreamInfo(String path)
{
// Parse the path to split into path and stream components
parsePath(path);
}
/**
* Constructor
*
* @param name String
* @param fid int
* @param stid int
*/
public StreamInfo(String name, int fid, int stid)
{
m_name = name;
m_fid = fid;
m_stid = stid;
}
/**
* Constructor
*
* @param name String
* @param fid int
* @param stid int
* @param size long
* @param alloc long
*/
public StreamInfo(String name, int fid, int stid, long size, long alloc)
{
m_name = name;
m_fid = fid;
m_stid = stid;
m_size = size;
m_allocSize = alloc;
}
/**
* Return the file path
*
* @return String
*/
public final String getPath()
{
return m_path;
}
/**
* Return the stream name
*
* @return String
*/
public final String getName()
{
return m_name;
}
/**
* Return the stream file id
*
* @return int
*/
public final int getFileId()
{
return m_fid;
}
/**
* Return the stream id
*
* @return int
*/
public final int getStreamId()
{
return m_stid;
}
/**
* Return the streams last access date/time.
*
* @return long
*/
public long getAccessDateTime()
{
return m_accessDate;
}
/**
* Return the stream creation date/time.
*
* @return long
*/
public long getCreationDateTime()
{
return m_createDate;
}
/**
* Return the modification date/time
*
* @return long
*/
public final long getModifyDateTime()
{
return m_modifyDate;
}
/**
* Return the stream size
*
* @return long
*/
public final long getSize()
{
return m_size;
}
/**
* Return the stream allocation size
*
* @return long
*/
public final long getAllocationSize()
{
return m_allocSize;
}
/**
* Determine if the last access date/time is available.
*
* @return boolean
*/
public boolean hasAccessDateTime()
{
return m_accessDate == 0L ? false : true;
}
/**
* Determine if the creation date/time details are available.
*
* @return boolean
*/
public boolean hasCreationDateTime()
{
return m_createDate == 0L ? false : true;
}
/**
* Determine if the modify date/time details are available.
*
* @return boolean
*/
public boolean hasModifyDateTime()
{
return m_modifyDate == 0L ? false : true;
}
/**
* Determine if the specified set stream information flags is enabled
*
* @param setFlag int
* @return boolean
*/
public final boolean hasSetFlag(int flag)
{
if ((m_setFlags & flag) != 0)
return true;
return false;
}
/**
* Return the set stream information flags
*
* @return int
*/
public final int getSetStreamInformationFlags()
{
return m_setFlags;
}
/**
* Set the path, if it contains the stream name the path will be split into file name and stream
* name components.
*
* @param path String
*/
public final void setPath(String path)
{
parsePath(path);
}
/**
* Set the stream name
*
* @param name String
*/
public final void setName(String name)
{
m_name = name;
}
/**
* Set the streams last access date/time.
*
* @param timesec long
*/
public void setAccessDateTime(long timesec)
{
// Create the access date/time
m_accessDate = timesec;
}
/**
* Set the creation date/time for the stream.
*
* @param timesec long
*/
public void setCreationDateTime(long timesec)
{
// Set the creation date/time
m_createDate = timesec;
}
/**
* Set the modifucation date/time for the stream.
*
* @param timesec long
*/
public void setModifyDateTime(long timesec)
{
// Set the date/time
m_modifyDate = timesec;
}
/**
* Set the file id
*
* @param id int
*/
public final void setFileId(int id)
{
m_fid = id;
}
/**
* Set the stream id
*
* @param id int
*/
public final void setStreamId(int id)
{
m_stid = id;
}
/**
* Set the stream size
*
* @param size long
*/
public final void setSize(long size)
{
m_size = size;
}
/**
* Set the stream allocation size
*
* @param alloc long
*/
public final void setAllocationSize(long alloc)
{
m_allocSize = alloc;
}
/**
* Set the set stream information flags to indicated which values are to be set
*
* @param setFlags int
*/
public final void setStreamInformationFlags(int setFlags)
{
m_setFlags = setFlags;
}
/**
* Parse a path to split into file name and stream name components
*
* @param path String
*/
protected final void parsePath(String path)
{
// Check if the file name contains a stream name
int pos = path.indexOf(StreamSeparator);
if (pos == -1)
{
m_path = path;
return;
}
// Split the main file name and stream name
m_path = path.substring(0, pos);
m_name = path.substring(pos + 1);
}
/**
* Return the stream information as a string
*
* @return String
*/
public String toString()
{
StringBuffer str = new StringBuffer();
str.append("[");
str.append(getName());
str.append(",");
str.append(getFileId());
str.append(":");
str.append(getStreamId());
str.append(",");
str.append(getSize());
str.append("/");
str.append(getAllocationSize());
str.append("]");
return str.toString();
}
}

View File

@@ -0,0 +1,168 @@
/*
* Copyright (C) 2005 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.smb.server.ntfs;
import java.util.Vector;
/**
* Stream Information List Class
*/
public class StreamInfoList
{
// List of stream information objects
private Vector<StreamInfo> m_list;
/**
* Default constructor
*/
public StreamInfoList()
{
m_list = new Vector<StreamInfo>();
}
/**
* Add an item to the list
*
* @param info StreamInfo
*/
public final void addStream(StreamInfo info)
{
m_list.add(info);
}
/**
* Return the stream details at the specified index
*
* @param idx int
* @return StreamInfo
*/
public final StreamInfo getStreamAt(int idx)
{
// Range check the index
if (idx < 0 || idx >= m_list.size())
return null;
// Return the required stream information
return m_list.get(idx);
}
/**
* Find a stream by name
*
* @param name String
* @return StreamInfo
*/
public final StreamInfo findStream(String name)
{
// Search for the required stream
for (int i = 0; i < m_list.size(); i++)
{
// Get the current stream information
StreamInfo sinfo = m_list.get(i);
// Check if the stream name matches
if (sinfo.getName().equals(name))
return sinfo;
}
// Stream not found
return null;
}
/**
* Return the count of streams in the list
*
* @return int
*/
public final int numberOfStreams()
{
return m_list.size();
}
/**
* Remove the specified stream from the list
*
* @param idx int
* @return StreamInfo
*/
public final StreamInfo removeStream(int idx)
{
// Range check the index
if (idx < 0 || idx >= m_list.size())
return null;
// Remove the required stream
return m_list.remove(idx);
}
/**
* Remove the specified stream from the list
*
* @param name String
* @return StreamInfo
*/
public final StreamInfo removeStream(String name)
{
// Search for the required stream
for (int i = 0; i < m_list.size(); i++)
{
// Get the current stream information
StreamInfo sinfo = m_list.get(i);
// Check if the stream name matches
if (sinfo.getName().equals(name))
{
// Remove the stream from the list
m_list.removeElementAt(i);
return sinfo;
}
}
// Stream not found
return null;
}
/**
* Remove all streams from the list
*/
public final void removeAllStreams()
{
m_list.removeAllElements();
}
}