Merged 1.4 to HEAD

svn merge svn://svn.alfresco.com:3691/alfresco/BRANCHES/V1.4@4192 svn://svn.alfresco.com:3691/alfresco/BRANCHES/V1.4@4197 .
   svn merge svn://svn.alfresco.com:3691/alfresco/BRANCHES/V1.4@4205 svn://svn.alfresco.com:3691/alfresco/BRANCHES/V1.4@4206 .
   svn resolved root\projects\repository\source\java\org\alfresco\filesys\server\config\ServerConfiguration.java
   svn revert root\projects\repository\config\alfresco\version.properties
   svn merge svn://svn.alfresco.com:3691/alfresco/BRANCHES/V1.4@4219 svn://svn.alfresco.com:3691/alfresco/BRANCHES/V1.4@4224 .


git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@4631 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Derek Hulley
2006-12-18 11:58:55 +00:00
parent df4fd38e52
commit ff07ea1e7d
18 changed files with 1411 additions and 149 deletions

View File

@@ -68,8 +68,10 @@ public class FTPCommand
public final static int XRmd = 39;
public final static int XCup = 40;
public final static int XCwd = 41;
public final static int MLst = 42;
public final static int MLsd = 43;
public final static int MaxId = 41;
public final static int MaxId = 43;
public final static int InvalidCmd = -1;
@@ -78,7 +80,7 @@ public class FTPCommand
private static final String[] _cmds = { "USER", "PASS", "ACCT", "CWD", "CDUP", "SMNT", "REIN", "QUIT", "PORT",
"PASV", "TYPE", "STRU", "MODE", "RETR", "STOR", "STOU", "APPE", "ALLO", "REST", "RNFR", "RNTO", "ABOR",
"DELE", "RMD", "MKD", "PWD", "LIST", "NLST", "SITE", "SYST", "STAT", "HELP", "NOOP", "MDTM", "SIZE",
"OPTS", "FEAT", "XPWD", "XMKD", "XRMD", "XCUP", "XCWD" };
"OPTS", "FEAT", "XPWD", "XMKD", "XRMD", "XCUP", "XCWD", "MLST", "MLSD" };
/**
* Convert an FTP command to an id

View File

@@ -16,6 +16,7 @@
*/
package org.alfresco.filesys.ftp;
import java.text.SimpleDateFormat;
import java.util.*;
/**
@@ -37,6 +38,11 @@ public class FTPDate
protected final static String[] _months = { "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct",
"Nov", "Dec" };
// Machine listing date/time formatters
protected final static SimpleDateFormat _mlstFormat = new SimpleDateFormat( "yyyyMMddHHmmss");
protected final static SimpleDateFormat _mlstFormatLong = new SimpleDateFormat( "yyyyMMddHHmmss.SSS");
/**
* Pack a date string in Unix format The format is 'Mmm dd hh:mm' if the file is less than six
* months old, else the format is 'Mmm dd yyyy'.
@@ -104,4 +110,26 @@ public class FTPDate
buf.append(min);
}
}
/**
* Return a machine listing date/time, in the format 'YYYYMMDDHHSS'.
*
* @param dateTime long
* @return String
*/
public final static String packMlstDateTime( long dateTime)
{
return _mlstFormat.format( new Date( dateTime));
}
/**
* Return a machine listing date/time, in the format 'YYYYMMDDHHSS.sss'.
*
* @param dateTime long
* @return String
*/
public final static String packMlstDateTimeLong( long dateTime)
{
return _mlstFormatLong.format( new Date( dateTime));
}
}

View File

@@ -21,6 +21,7 @@ import java.net.InetAddress;
import java.net.ServerSocket;
import java.net.Socket;
import java.net.SocketException;
import java.nio.charset.Charset;
import java.util.Enumeration;
import org.alfresco.filesys.server.ServerListener;
@@ -46,8 +47,8 @@ public class FTPNetworkServer extends NetworkFileServer implements Runnable
// Constants
//
// Session Thread group
private static final ThreadGroup THREAD_GROUP_SESSION = new ThreadGroup("FTP_SESSION_GROUP");
// Listen backlog for the server socket
@@ -86,6 +87,14 @@ public class FTPNetworkServer extends NetworkFileServer implements Runnable
private String m_localFTPaddress;
// SITE command interface
private FTPSiteInterface m_siteInterface;
// Default character encoding to use for file names
private String m_charSet;
/**
* Class constructor
*
@@ -122,6 +131,12 @@ public class FTPNetworkServer extends NetworkFileServer implements Runnable
logger.error(ex);
}
}
// Set the default character set
m_charSet = config.getFTPCharacterSet();
if ( m_charSet == null)
m_charSet = Charset.defaultCharset().name();
}
/**
@@ -333,6 +348,16 @@ public class FTPNetworkServer extends NetworkFileServer implements Runnable
return m_rootPath;
}
/**
* Get the character set to use for file name encoding/decoding
*
* @return String
*/
public final String getCharacterSet()
{
return m_charSet;
}
/**
* Notify the server that a user has logged on.
*
@@ -357,6 +382,8 @@ public class FTPNetworkServer extends NetworkFileServer implements Runnable
if (logger.isDebugEnabled() && hasDebug())
{
logger.debug("FTP Server starting on port " + getPort());
if ( getCharacterSet() != null)
logger.debug( "Using character set " + getCharacterSet());
}
// Create a server socket to listen for incoming FTP session requests
@@ -582,4 +609,34 @@ public class FTPNetworkServer extends NetworkFileServer implements Runnable
fireServerEvent(ServerListener.ServerStartup);
}
/**
* Check if the site interface is valid
*
* @return boolean
*/
public final boolean hasSiteInterface()
{
return m_siteInterface != null ? true : false;
}
/**
* Return the site interface
*
* @return FTPSiteInterface
*/
public final FTPSiteInterface getSiteInterface()
{
return m_siteInterface;
}
/**
* Set the site specific commands interface
*
* @param siteInterface FTPSiteInterface
*/
public final void setSiteInterface( FTPSiteInterface siteInterface)
{
m_siteInterface = siteInterface;
}
}

View File

@@ -0,0 +1,34 @@
/*
* 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.ftp;
/**
* FTP SITE Command Interface
*
* <p>Optional interface that is used to provide processing for the FTP SITE command.
*/
public interface FTPSiteInterface {
/**
* Process an FTP SITE specific command
*
* @param sess FTPSrvSession
* @param req FTPRequest
*/
void processFTPSiteCommand( FTPSrvSession sess, FTPRequest req);
}

File diff suppressed because it is too large Load Diff