Merged V1.3 to HEAD (3021:3026)

svn merge svn://www.alfresco.org:3691/alfresco/BRANCHES/V1.3@3021 svn://www.alfresco.org:3691/alfresco/BRANCHES/V1.3@3026 .


git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@3338 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Derek Hulley
2006-07-18 15:08:26 +00:00
parent 77b51ec5dc
commit a05f525a7d
9 changed files with 158 additions and 48 deletions

View File

@@ -174,6 +174,10 @@ public class DiskDeviceContext extends DeviceContext
*/
public void CloseContext()
{
// Close the notify handler
if ( hasChangeHandler())
getChangeHandler().shutdownRequest();
// Call the base class

View File

@@ -28,17 +28,18 @@ public final class FileSystem
// Filesystem attributes
public static final int CaseSensitiveSearch = 0x00000001;
public static final int CasePreservedNames = 0x00000002;
public static final int UnicodeOnDisk = 0x00000004;
public static final int PersistentACLs = 0x00000008;
public static final int FileCompression = 0x00000010;
public static final int VolumeQuotas = 0x00000020;
public static final int SparseFiles = 0x00000040;
public static final int ReparsePoints = 0x00000080;
public static final int RemoteStorage = 0x00000100;
public static final int VolumeIsCompressed = 0x00008000;
public static final int ObjectIds = 0x00010000;
public static final int Encryption = 0x00020000;
public static final int CasePreservedNames = 0x00000002;
public static final int UnicodeOnDisk = 0x00000004;
public static final int PersistentACLs = 0x00000008;
public static final int FileCompression = 0x00000010;
public static final int VolumeQuotas = 0x00000020;
public static final int SparseFiles = 0x00000040;
public static final int ReparsePoints = 0x00000080;
public static final int RemoteStorage = 0x00000100;
public static final int LFNAPISupport = 0x00004000;
public static final int VolumeIsCompressed = 0x00008000;
public static final int ObjectIds = 0x00010000;
public static final int Encryption = 0x00020000;
// Filesystem type strings

View File

@@ -75,6 +75,10 @@ public abstract class HostAnnouncer extends Thread
private byte m_updateCount;
// Error count
private int m_errorCount;
// Shutdown flag, host announcer should remove the announced name as it shuts down
private boolean m_shutdown = false;
@@ -156,6 +160,16 @@ public abstract class HostAnnouncer extends Thread
return m_names.numberOfStrings();
}
/**
* Return the error count
*
* @return int
*/
protected final int getErrorCount()
{
return m_errorCount;
}
/**
* Return the specified host name being announced.
*
@@ -493,6 +507,24 @@ public abstract class HostAnnouncer extends Thread
m_srvtype = typ;
}
/**
* Increment the error count
*
* @return int
*/
protected final int incrementErrorCount()
{
return ++m_errorCount;
}
/**
* Clear the error count
*/
protected final void clearErrorCount()
{
m_errorCount = 0;
}
/**
* Shutdown the host announcer and remove the announced name from Network Neighborhood.
*/

View File

@@ -32,6 +32,10 @@ import org.alfresco.filesys.smb.server.win32.Win32NetBIOSSessionSocketHandler;
public class Win32NetBIOSHostAnnouncer extends HostAnnouncer
{
// Number of send errors before marking the LANA as offline
private static final int SendErrorCount = 3;
// Associated session handler
Win32NetBIOSSessionSocketHandler m_handler;
@@ -120,6 +124,36 @@ public class Win32NetBIOSHostAnnouncer extends HostAnnouncer
int sts = Win32NetBIOS.SendDatagram(getLana(), getNameNumber(), destName, buf, 0, len);
if ( sts != NetBIOS.NRC_GoodRet)
logger.debug("Win32NetBIOS host announce error " + NetBIOS.getErrorString( -sts) + " (LANA " + getLana() + ")");
{
// Log the error
if ( logger.isErrorEnabled())
logger.error("Host announce error " + NetBIOS.getErrorString( -sts) +
" (LANA " + getLana() + ")");
// Update the error count
if ( incrementErrorCount() == SendErrorCount)
{
// Mark the LANA as offline
m_handler.lanaStatusChange( getLana(), false);
// Clear the error count
clearErrorCount();
// Log the error
if ( logger.isErrorEnabled())
logger.error("Marked LANA as unavailable due to send errors");
}
}
else
{
// Clear the error count
clearErrorCount();
}
}
}

View File

@@ -16,6 +16,8 @@
*/
package org.alfresco.filesys.smb.mailslot;
import java.io.IOException;
import org.alfresco.filesys.netbios.NetBIOSName;
import org.alfresco.filesys.netbios.win32.NetBIOS;
import org.alfresco.filesys.netbios.win32.NetBIOSSocket;
@@ -34,6 +36,10 @@ import org.alfresco.filesys.smb.server.win32.Win32NetBIOSSessionSocketHandler;
*/
public class WinsockNetBIOSHostAnnouncer extends HostAnnouncer
{
// Number of send errors before marking the LANA as offline
private static final int SendErrorCount = 3;
// Associated session handler
private Win32NetBIOSSessionSocketHandler m_handler;
@@ -116,8 +122,49 @@ public class WinsockNetBIOSHostAnnouncer extends HostAnnouncer
// Send the host announce datagram via the Win32 Netbios() API call
int sts = m_dgramSocket.sendDatagram(destNbName, buf, 0, len);
if ( sts != len)
logger.debug("WinsockNetBIOS host announce error");
boolean txOK = false;
try
{
int sts = m_dgramSocket.sendDatagram(destNbName, buf, 0, len);
if ( sts == len)
txOK = true;
}
catch ( IOException ex)
{
// Log the error
if ( logger.isErrorEnabled())
logger.error("Host announce error, " + ex.getMessage() + ", (LANA " + getLana() + ")");
}
// Check if the send was successful
if ( txOK == false)
{
// Update the error count
if ( incrementErrorCount() == SendErrorCount)
{
// Mark the LANA as offline
m_handler.lanaStatusChange( getLana(), false);
// Clear the error count
clearErrorCount();
// Log the error
if ( logger.isErrorEnabled())
logger.error("Marked LANA as unavailable due to send errors, (LANA " + getLana() + ")");
}
}
else
{
// Clear the error count
clearErrorCount();
}
}
}

View File

@@ -40,24 +40,24 @@ class FindInfoPacker
// File information levels
public static final int InfoStandard = 1;
public static final int InfoQueryEASize = 2;
public static final int InfoQueryEAFromList = 3;
public static final int InfoDirectory = 0x101;
public static final int InfoFullDirectory = 0x102;
public static final int InfoNames = 0x103;
public static final int InfoDirectoryBoth = 0x104;
public static final int InfoMacHfsInfo = 0x302;
public static final int InfoStandard = 1;
public static final int InfoQueryEASize = 2;
public static final int InfoQueryEAFromList = 3;
public static final int InfoDirectory = 0x101;
public static final int InfoFullDirectory = 0x102;
public static final int InfoNames = 0x103;
public static final int InfoDirectoryBoth = 0x104;
public static final int InfoMacHfsInfo = 0x302;
// File information fixed lengths, includes nulls on strings.
public static final int InfoStandardLen = 24;
public static final int InfoQueryEASizeLen = 28;
public static final int InfoDirectoryLen = 64;
public static final int InfoFullDirectoryLen = 68;
public static final int InfoNamesLen = 12;
public static final int InfoDirectoryBothLen = 94;
public static final int InfoMacHfsLen = 120;
public static final int InfoStandardLen = 24;
public static final int InfoQueryEASizeLen = 28;
public static final int InfoDirectoryLen = 64;
public static final int InfoFullDirectoryLen = 68;
public static final int InfoNamesLen = 12;
public static final int InfoDirectoryBothLen = 94;
public static final int InfoMacHfsLen = 120;
/**
* Pack a file information object into the specified buffer, using information level 1 format.
@@ -426,7 +426,7 @@ class FindInfoPacker
// Align the buffer pointer and set the offset to the next file information entry
buf.longwordAlign();
buf.wordAlign();
int curPos = buf.getPosition();
buf.setPosition(startPos);
@@ -518,7 +518,7 @@ class FindInfoPacker
// Align the buffer pointer and set the offset to the next file information entry
buf.longwordAlign();
buf.wordAlign();
int curPos = buf.getPosition();
buf.setPosition(startPos);
@@ -615,7 +615,7 @@ class FindInfoPacker
// Align the buffer pointer and set the offset to the next file information entry
buf.longwordAlign();
buf.wordAlign();
int curPos = buf.getPosition();
buf.setPosition(startPos);
@@ -718,7 +718,7 @@ class FindInfoPacker
// Align the buffer pointer and set the offset to the next file information entry
buf.longwordAlign();
buf.wordAlign();
int curPos = buf.getPosition();
buf.setPosition(startPos);
@@ -839,7 +839,7 @@ class FindInfoPacker
// Align the buffer pointer and set the offset to the next file information entry
buf.longwordAlign();
buf.wordAlign();
int curPos = buf.getPosition();
buf.setPosition(startPos);

View File

@@ -78,7 +78,7 @@ public class SMBServer extends NetworkFileServer implements Runnable
// Server type flags, used when announcing the host
private int m_srvType = ServerType.WorkStation + ServerType.Server;
private int m_srvType = ServerType.WorkStation + ServerType.Server + ServerType.NTServer;
// Next available session id

View File

@@ -1344,7 +1344,7 @@ public class SMBSrvSession extends SrvSession implements Runnable
// We are using case sensitive pathnames and long file names
setDefaultFlags(SMBSrvPacket.FLG_CASELESS);
setDefaultFlags(0);
setDefaultFlags2(SMBSrvPacket.FLG2_LONGFILENAMES + SMBSrvPacket.FLG2_UNICODE);
// Access the authenticator for this server and determine if the server is in share or

View File

@@ -311,7 +311,8 @@ public class ContentDiskDriver implements DiskInterface, IOCtlInterface
// Set parameters
context.setFilesystemAttributes(FileSystem.CasePreservedNames);
context.setFilesystemAttributes(FileSystem.CasePreservedNames + FileSystem.UnicodeOnDisk +
FileSystem.CaseSensitiveSearch);
}
catch (Exception ex)
{
@@ -1468,15 +1469,6 @@ public class ContentDiskDriver implements DiskInterface, IOCtlInterface
" node: " + nodeRef);
}
}
catch (FileNotFoundException e)
{
// already gone
if (logger.isDebugEnabled())
{
logger.debug("Deleted file <alfready gone>: \n" +
" file: " + name);
}
}
catch (NodeLockedException ex)
{
// Debug