mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-07-24 17:32:48 +00:00
Updates to AVM virtualization view for the latest layout with DATA and METADATA folders.
Fixes to AVM filesystem transaction handling. Made SrvSession.beginTransaction() private and added beginReadTransaction() and beginWriteTransaction(). git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@4580 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -468,6 +468,32 @@ public abstract class SrvSession
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a read transaction, if not already active
|
||||
*
|
||||
* @param transService TransactionService
|
||||
* @return boolean
|
||||
* @exception AlfrescoRuntimeException
|
||||
*/
|
||||
public final boolean beginReadTransaction( TransactionService transService)
|
||||
throws AlfrescoRuntimeException
|
||||
{
|
||||
return beginTransaction(transService, true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a write transaction, if not already active
|
||||
*
|
||||
* @param transService TransactionService
|
||||
* @return boolean
|
||||
* @exception AlfrescoRuntimeException
|
||||
*/
|
||||
public final boolean beginWriteTransaction( TransactionService transService)
|
||||
throws AlfrescoRuntimeException
|
||||
{
|
||||
return beginTransaction(transService, false);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create and start a transaction, if not already active
|
||||
*
|
||||
@@ -476,7 +502,7 @@ public abstract class SrvSession
|
||||
* @return boolean
|
||||
* @exception AlfrescoRuntimeException
|
||||
*/
|
||||
public final boolean beginTransaction(TransactionService transService, boolean readOnly)
|
||||
private final boolean beginTransaction(TransactionService transService, boolean readOnly)
|
||||
throws AlfrescoRuntimeException
|
||||
{
|
||||
boolean created = false;
|
||||
|
@@ -79,6 +79,19 @@ public class ClientInfo
|
||||
|
||||
private NodeRef m_homeNode;
|
||||
|
||||
// Group and user id
|
||||
|
||||
private int m_gid = -1;
|
||||
private int m_uid = -1;
|
||||
|
||||
// List of groups for this user
|
||||
|
||||
private int[] m_groups;
|
||||
|
||||
// NFS authentication type
|
||||
|
||||
private int m_nfsAuthType = -1;
|
||||
|
||||
/**
|
||||
* Default constructor
|
||||
*/
|
||||
@@ -331,6 +344,56 @@ public class ClientInfo
|
||||
return m_homeNode;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the group id
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public final int getGid()
|
||||
{
|
||||
return m_gid;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the user id
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public final int getUid()
|
||||
{
|
||||
return m_uid;
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine if the client has additional groups
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public final boolean hasGroupsList()
|
||||
{
|
||||
return m_groups != null ? true : false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the additional groups list
|
||||
*
|
||||
* @return int[]
|
||||
*/
|
||||
public final int[] getGroupsList()
|
||||
{
|
||||
return m_groups;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the NFS authentication type
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public final int getNFSAuthenticationType()
|
||||
{
|
||||
return m_nfsAuthType;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the remote users domain
|
||||
*
|
||||
@@ -454,6 +517,46 @@ public class ClientInfo
|
||||
m_homeNode = homeNode;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the group id
|
||||
*
|
||||
* @param gid int
|
||||
*/
|
||||
public final void setGid(int gid)
|
||||
{
|
||||
m_gid = gid;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the user id
|
||||
*
|
||||
* @param uid int
|
||||
*/
|
||||
public final void setUid(int uid)
|
||||
{
|
||||
m_uid = uid;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the groups list
|
||||
*
|
||||
* @param groups int[]
|
||||
*/
|
||||
public final void setGroupsList(int[] groups)
|
||||
{
|
||||
m_groups = groups;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the NFS authentication type
|
||||
*
|
||||
* @param type int
|
||||
*/
|
||||
public final void setNFSAuthenticationType(int type)
|
||||
{
|
||||
m_nfsAuthType = type;
|
||||
}
|
||||
|
||||
/**
|
||||
* Display the client information as a string
|
||||
*
|
||||
|
@@ -72,6 +72,8 @@ import org.alfresco.filesys.server.core.SharedDeviceList;
|
||||
import org.alfresco.filesys.server.filesys.DefaultShareMapper;
|
||||
import org.alfresco.filesys.server.filesys.DiskInterface;
|
||||
import org.alfresco.filesys.server.filesys.DiskSharedDevice;
|
||||
//import org.alfresco.filesys.server.oncrpc.DefaultRpcAuthenticator;
|
||||
//import org.alfresco.filesys.server.oncrpc.RpcAuthenticator;
|
||||
import org.alfresco.filesys.smb.ServerType;
|
||||
import org.alfresco.filesys.smb.TcpipSMB;
|
||||
import org.alfresco.filesys.smb.server.repo.ContentContext;
|
||||
@@ -107,6 +109,7 @@ public class ServerConfiguration extends AbstractLifecycleBean
|
||||
private static final String ConfigArea = "file-servers";
|
||||
private static final String ConfigCIFS = "CIFS Server";
|
||||
private static final String ConfigFTP = "FTP Server";
|
||||
private static final String ConfigNFS = "NFS Server";
|
||||
private static final String ConfigFilesystems = "Filesystems";
|
||||
private static final String ConfigSecurity = "Filesystem Security";
|
||||
|
||||
@@ -135,6 +138,11 @@ public class ServerConfiguration extends AbstractLifecycleBean
|
||||
|
||||
private static final String DefaultFTPAnonymousAccount = "anonymous";
|
||||
|
||||
// NFS server debug type strings
|
||||
|
||||
private static final String m_nfsDebugStr[] = { "RXDATA", "TXDATA", "DUMPDATA", "SEARCH", "INFO", "FILE",
|
||||
"FILEIO", "ERROR", "TIMING", "DIRECTORY", "SESSION" };
|
||||
|
||||
// Platform types
|
||||
|
||||
public enum PlatformType
|
||||
@@ -170,6 +178,7 @@ public class ServerConfiguration extends AbstractLifecycleBean
|
||||
|
||||
private boolean m_smbEnable = true;
|
||||
private boolean m_ftpEnable = true;
|
||||
private boolean m_nfsEnable = true;
|
||||
|
||||
// Server name
|
||||
|
||||
@@ -242,8 +251,8 @@ public class ServerConfiguration extends AbstractLifecycleBean
|
||||
// Flags to indicate if NetBIOS, native TCP/IP SMB and/or Win32 NetBIOS
|
||||
// should be enabled
|
||||
|
||||
private boolean m_netBIOSEnable = true;
|
||||
private boolean m_tcpSMBEnable = false;
|
||||
private boolean m_netBIOSEnable = false;
|
||||
private boolean m_tcpSMBEnable = false;
|
||||
private boolean m_win32NBEnable = false;
|
||||
|
||||
// Address to bind the SMB server to, if null all local addresses are used
|
||||
@@ -306,6 +315,43 @@ public class ServerConfiguration extends AbstractLifecycleBean
|
||||
|
||||
private int m_ftpDebug;
|
||||
|
||||
//--------------------------------------------------------------------------------
|
||||
// NFS specific configuration parameters
|
||||
//
|
||||
// Enable the port mapper server
|
||||
|
||||
private boolean m_nfsPortMapper;
|
||||
|
||||
// Port mapper port
|
||||
|
||||
private int m_portMapperPort;
|
||||
|
||||
// Mount server port
|
||||
|
||||
private int m_mountServerPort;
|
||||
|
||||
// NFS server port
|
||||
|
||||
private int m_nfsServerPort;
|
||||
|
||||
// NFS debug flags
|
||||
|
||||
private int m_nfsDebug;
|
||||
|
||||
// Port mapper and mount server debug enable
|
||||
|
||||
private boolean m_portMapDebug;
|
||||
private boolean m_mountServerDebug;
|
||||
|
||||
// Thread pool size and packet pool size
|
||||
|
||||
private int m_nfsThreadPoolSize;
|
||||
private int m_nfsPacketPoolSize;
|
||||
|
||||
// RPC authenticator implementation
|
||||
|
||||
// private RpcAuthenticator m_rpcAuthenticator;
|
||||
|
||||
// --------------------------------------------------------------------------------
|
||||
// Global server configuration
|
||||
//
|
||||
@@ -624,6 +670,26 @@ public class ServerConfiguration extends AbstractLifecycleBean
|
||||
|
||||
logger.error("FTP server configuration error, " + ex.getMessage(), ex);
|
||||
}
|
||||
|
||||
// Initialize the NFS server
|
||||
|
||||
try
|
||||
{
|
||||
// Process the NFS server configuration
|
||||
|
||||
config = configService.getConfig(ConfigNFS, configCtx);
|
||||
processNFSServerConfig(config);
|
||||
|
||||
// Log the successful startup
|
||||
|
||||
logger.info("NFS server started");
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
// Configuration error
|
||||
|
||||
logger.error("FTP server configuration error, " + ex.getMessage(), ex);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -1596,6 +1662,174 @@ public class ServerConfiguration extends AbstractLifecycleBean
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Process the NFS server configuration
|
||||
*
|
||||
* @param config Config
|
||||
*/
|
||||
private final void processNFSServerConfig(Config config)
|
||||
{
|
||||
/**
|
||||
// If the configuration section is not valid then NFS is disabled
|
||||
|
||||
if ( config == null)
|
||||
{
|
||||
setNFSServerEnabled(false);
|
||||
return;
|
||||
}
|
||||
|
||||
// Check if the port mapper is enabled
|
||||
|
||||
if ( config.getConfigElement("enablePortMapper") != null)
|
||||
m_nfsPortMapper = true;
|
||||
|
||||
// Check for the thread pool size
|
||||
|
||||
ConfigElement elem = config.getConfigElement("ThreadPool");
|
||||
|
||||
if ( elem != null) {
|
||||
|
||||
try {
|
||||
|
||||
// Convert the pool size value
|
||||
|
||||
int poolSize = Integer.parseInt(elem.getValue());
|
||||
|
||||
// Range check the pool size value
|
||||
|
||||
if ( poolSize < 4)
|
||||
throw new AlfrescoRuntimeException("NFS thread pool size is below minimum of 4");
|
||||
|
||||
// Set the thread pool size
|
||||
|
||||
m_nfsThreadPoolSize = poolSize;
|
||||
}
|
||||
catch (NumberFormatException ex) {
|
||||
throw new AlfrescoRuntimeException("Invalid NFS thread pool size setting, " + elem.getValue());
|
||||
}
|
||||
}
|
||||
|
||||
// NFS packet pool size
|
||||
|
||||
elem = config.getConfigElement("PacketPool");
|
||||
|
||||
if ( elem != null) {
|
||||
|
||||
try {
|
||||
|
||||
// Convert the packet pool size value
|
||||
|
||||
int pktPoolSize = Integer.parseInt(elem.getValue());
|
||||
|
||||
// Range check the pool size value
|
||||
|
||||
if ( pktPoolSize < 10)
|
||||
throw new AlfrescoRuntimeException("NFS packet pool size is below minimum of 10");
|
||||
|
||||
if ( pktPoolSize < getNFSThreadPoolSize() + 1)
|
||||
throw new AlfrescoRuntimeException("NFS packet pool must be at least thread pool size plus one");
|
||||
|
||||
// Set the packet pool size
|
||||
|
||||
m_nfsPacketPoolSize = pktPoolSize;
|
||||
}
|
||||
catch (NumberFormatException ex) {
|
||||
throw new AlfrescoRuntimeException("Invalid NFS packet pool size setting, " + elem.getValue());
|
||||
}
|
||||
}
|
||||
|
||||
// Check for a port mapper server port
|
||||
|
||||
elem = config.getConfigElement("PortMapperPort");
|
||||
if ( elem != null) {
|
||||
try {
|
||||
m_portMapperPort = Integer.parseInt(elem.getValue());
|
||||
if ( getPortMapperPort() <= 0 || getPortMapperPort() >= 65535)
|
||||
throw new AlfrescoRuntimeException("Port mapper server port out of valid range");
|
||||
}
|
||||
catch (NumberFormatException ex) {
|
||||
throw new AlfrescoRuntimeException("Invalid port mapper server port");
|
||||
}
|
||||
}
|
||||
|
||||
// Check for a mount server port
|
||||
|
||||
elem = config.getConfigElement("MountServerPort");
|
||||
if ( elem != null) {
|
||||
try {
|
||||
m_mountServerPort = Integer.parseInt(elem.getValue());
|
||||
if ( getMountServerPort() <= 0 || getMountServerPort() >= 65535)
|
||||
throw new AlfrescoRuntimeException("Mount server port out of valid range");
|
||||
}
|
||||
catch (NumberFormatException ex) {
|
||||
throw new AlfrescoRuntimeException("Invalid mount server port");
|
||||
}
|
||||
}
|
||||
|
||||
// Check for an NFS server port
|
||||
|
||||
elem = config.getConfigElement("NFSServerPort");
|
||||
if ( elem != null) {
|
||||
try {
|
||||
m_nfsServerPort = Integer.parseInt(elem.getValue());
|
||||
if ( getNFSServerPort() <= 0 || getNFSServerPort() >= 65535)
|
||||
throw new AlfrescoRuntimeException("NFS server port out of valid range");
|
||||
}
|
||||
catch (NumberFormatException ex) {
|
||||
throw new AlfrescoRuntimeException("Invalid NFS server port");
|
||||
}
|
||||
}
|
||||
|
||||
// Check if NFS debug is enabled
|
||||
|
||||
elem = config.getConfigElement("debug");
|
||||
if (elem != null) {
|
||||
|
||||
// Check for NFS debug flags
|
||||
|
||||
String flags = elem.getAttribute("flags");
|
||||
int nfsDbg = 0;
|
||||
|
||||
if ( flags != null) {
|
||||
|
||||
// Parse the flags
|
||||
|
||||
flags = flags.toUpperCase();
|
||||
StringTokenizer token = new StringTokenizer(flags,",");
|
||||
|
||||
while ( token.hasMoreTokens()) {
|
||||
|
||||
// Get the current debug flag token
|
||||
|
||||
String dbg = token.nextToken().trim();
|
||||
|
||||
// Find the debug flag name
|
||||
|
||||
int idx = 0;
|
||||
|
||||
while ( idx < m_nfsDebugStr.length && m_nfsDebugStr[idx].equalsIgnoreCase(dbg) == false)
|
||||
idx++;
|
||||
|
||||
if ( idx >= m_nfsDebugStr.length)
|
||||
throw new AlfrescoRuntimeException("Invalid NFS debug flag, " + dbg);
|
||||
|
||||
// Set the debug flag
|
||||
|
||||
nfsDbg += 1 << idx;
|
||||
}
|
||||
}
|
||||
|
||||
// Set the NFS debug flags
|
||||
|
||||
m_nfsDebug = nfsDbg;
|
||||
}
|
||||
|
||||
// Create the RPC authenticator
|
||||
|
||||
m_rpcAuthenticator = new DefaultRpcAuthenticator();
|
||||
**/
|
||||
}
|
||||
|
||||
/**
|
||||
* Process the filesystems configuration
|
||||
*
|
||||
@@ -2931,6 +3165,16 @@ public class ServerConfiguration extends AbstractLifecycleBean
|
||||
m_ftpEnable = ena;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the NFS server enabled state
|
||||
*
|
||||
* @param ena boolean
|
||||
*/
|
||||
public final void setNFSServerEnabled(boolean ena)
|
||||
{
|
||||
m_nfsEnable = ena;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the authenticator to be used to authenticate users and share connections for CIFS.
|
||||
*
|
||||
@@ -3445,6 +3689,118 @@ public class ServerConfiguration extends AbstractLifecycleBean
|
||||
m_ftpDebug = dbg;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if the NFS server is enabled
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public final boolean isNFSServerEnabled()
|
||||
{
|
||||
return m_nfsEnable;
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine if port mapper debug is enabled
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public final boolean hasPortMapperDebug()
|
||||
{
|
||||
return m_portMapDebug;
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine if mount server debug is enabled
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public final boolean hasMountServerDebug()
|
||||
{
|
||||
return m_mountServerDebug;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if the NFS port mapper is enabled
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public final boolean hasNFSPortMapper()
|
||||
{
|
||||
return m_nfsPortMapper;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the port for port mapper to use, or zero for the default port
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public final int getPortMapperPort()
|
||||
{
|
||||
return m_portMapperPort;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the port the mount server should use, or zero for the default port
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public final int getMountServerPort()
|
||||
{
|
||||
return m_mountServerPort;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the port the NFS server should use, or zero for the default port
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public final int getNFSServerPort()
|
||||
{
|
||||
return m_nfsServerPort;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the NFS debug flags
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public final int getNFSDebug()
|
||||
{
|
||||
return m_nfsDebug;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the NFS thread pool size
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public final int getNFSThreadPoolSize()
|
||||
{
|
||||
return m_nfsThreadPoolSize;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the NFS server packet pool size, or -1 for the default size
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public final int getNFSPacketPoolSize()
|
||||
{
|
||||
return m_nfsPacketPoolSize;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the authenticator object that is used to provide RPC authentication (for the portmapper, mount server and
|
||||
* NFS server)
|
||||
*
|
||||
* @return RpcAuthenticator
|
||||
*/
|
||||
/**
|
||||
public final RpcAuthenticator getRpcAuthenticator()
|
||||
{
|
||||
return m_rpcAuthenticator;
|
||||
}
|
||||
**/
|
||||
/**
|
||||
* Close the server configuration, used to close various components that are shared between protocol
|
||||
* handlers.
|
||||
|
@@ -38,17 +38,17 @@ public class FileInfo implements Serializable
|
||||
//
|
||||
// Set file information flags
|
||||
|
||||
public static final int SetFileSize = 0x0001;
|
||||
public static final int SetAllocationSize = 0x0002;
|
||||
public static final int SetAttributes = 0x0004;
|
||||
public static final int SetModifyDate = 0x0008;
|
||||
public static final int SetCreationDate = 0x0010;
|
||||
public static final int SetAccessDate = 0x0020;
|
||||
public static final int SetChangeDate = 0x0040;
|
||||
public static final int SetGid = 0x0080;
|
||||
public static final int SetUid = 0x0100;
|
||||
public static final int SetMode = 0x0200;
|
||||
public static final int SetDeleteOnClose = 0x0400;
|
||||
public static final int SetFileSize = 0x0001;
|
||||
public static final int SetAllocationSize = 0x0002;
|
||||
public static final int SetAttributes = 0x0004;
|
||||
public static final int SetModifyDate = 0x0008;
|
||||
public static final int SetCreationDate = 0x0010;
|
||||
public static final int SetAccessDate = 0x0020;
|
||||
public static final int SetChangeDate = 0x0040;
|
||||
public static final int SetGid = 0x0080;
|
||||
public static final int SetUid = 0x0100;
|
||||
public static final int SetMode = 0x0200;
|
||||
public static final int SetDeleteOnClose = 0x0400;
|
||||
|
||||
// File name string
|
||||
|
||||
@@ -108,10 +108,13 @@ public class FileInfo implements Serializable
|
||||
|
||||
private boolean m_deleteOnClose;
|
||||
|
||||
// File type
|
||||
|
||||
private int m_fileType;
|
||||
|
||||
// Set file information flags
|
||||
//
|
||||
// Used to indicate which values in the file information object are valid and should be used to
|
||||
// set
|
||||
// Used to indicate which values in the file information object are valid and should be used to set
|
||||
// the file information.
|
||||
|
||||
private int m_setFlags;
|
||||
@@ -527,6 +530,16 @@ public class FileInfo implements Serializable
|
||||
return (m_attr & FileAttribute.Archive) != 0 ? true : false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the file type
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public final int isFileType()
|
||||
{
|
||||
return m_fileType;
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine if the group id field has been set
|
||||
*
|
||||
@@ -833,6 +846,16 @@ public class FileInfo implements Serializable
|
||||
m_mode = mode;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the file type
|
||||
*
|
||||
* @param typ int
|
||||
*/
|
||||
public final void setFileType(int typ)
|
||||
{
|
||||
m_fileType = typ;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the set file information flags to indicated which values are to be set
|
||||
*
|
||||
|
@@ -101,6 +101,11 @@ public class FileOpenParams
|
||||
|
||||
private int m_mode = -1;
|
||||
|
||||
// File type and symbolic name
|
||||
|
||||
private int m_fileType;
|
||||
private String m_symName;
|
||||
|
||||
/**
|
||||
* Class constructor for Core SMB dialect Open SMB requests
|
||||
*
|
||||
@@ -454,6 +459,36 @@ public class FileOpenParams
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the file type
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public final int isFileType()
|
||||
{
|
||||
return m_fileType;
|
||||
}
|
||||
|
||||
/**
|
||||
* determine if the target of the create/open is a symbolic link
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public final boolean isSymbolicLink()
|
||||
{
|
||||
return isFileType() == FileType.SymbolicLink;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the symbolic link name
|
||||
*
|
||||
* @return String
|
||||
*/
|
||||
public final String getSymbolicLinkName()
|
||||
{
|
||||
return m_symName;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the shared access mode, zero equals allow any shared access
|
||||
*
|
||||
@@ -584,6 +619,27 @@ public class FileOpenParams
|
||||
m_createOptions = m_createOptions | flag;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the file type
|
||||
*
|
||||
* @param typ int
|
||||
*/
|
||||
public final void setFileType(int typ)
|
||||
{
|
||||
m_fileType = typ;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the symbolic link name
|
||||
*
|
||||
* @param name String
|
||||
*/
|
||||
public final void setSymbolicLink(String name)
|
||||
{
|
||||
m_symName = name;
|
||||
m_fileType = FileType.SymbolicLink;
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert a Core/LanMan access mode to an NT access mode
|
||||
*
|
||||
|
@@ -0,0 +1,72 @@
|
||||
/*
|
||||
* 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.server.filesys;
|
||||
|
||||
/*
|
||||
* FileType.java
|
||||
*
|
||||
* Copyright (c) Starlasoft 2006. All rights reserved.
|
||||
*/
|
||||
|
||||
/**
|
||||
* File Type Class
|
||||
*
|
||||
* <p>File type constants.
|
||||
*
|
||||
* @author GKSpencer
|
||||
*/
|
||||
public class FileType {
|
||||
|
||||
// File types
|
||||
|
||||
public static final int RegularFile = 1;
|
||||
public static final int Directory = 2;
|
||||
public static final int SymbolicLink = 3;
|
||||
public static final int HardLink = 4;
|
||||
public static final int Device = 5;
|
||||
|
||||
/**
|
||||
* Return a file type as a string
|
||||
*
|
||||
* @param typ int
|
||||
* @return String
|
||||
*/
|
||||
public final static String asString(int typ) {
|
||||
|
||||
String typStr = "Unknown";
|
||||
|
||||
switch (typ) {
|
||||
case RegularFile:
|
||||
typStr = "File";
|
||||
break;
|
||||
case Directory:
|
||||
typStr = "Directory";
|
||||
break;
|
||||
case SymbolicLink:
|
||||
typStr = "SymbolicLink";
|
||||
break;
|
||||
case HardLink:
|
||||
typStr = "HardLink";
|
||||
break;
|
||||
case Device:
|
||||
typStr = "Device";
|
||||
break;
|
||||
}
|
||||
|
||||
return typStr;
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user