You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mina.apache.org by ng...@apache.org on 2008/08/17 21:52:49 UTC
svn commit: r686637 [6/16] - in /mina/ftpserver/trunk:
core/src/main/java/org/apache/ftpserver/
core/src/main/java/org/apache/ftpserver/command/
core/src/main/java/org/apache/ftpserver/config/spring/
core/src/main/java/org/apache/ftpserver/filesystem/ ...
Modified: mina/ftpserver/trunk/core/src/main/java/org/apache/ftpserver/config/spring/SpringUtil.java
URL: http://svn.apache.org/viewvc/mina/ftpserver/trunk/core/src/main/java/org/apache/ftpserver/config/spring/SpringUtil.java?rev=686637&r1=686636&r2=686637&view=diff
==============================================================================
--- mina/ftpserver/trunk/core/src/main/java/org/apache/ftpserver/config/spring/SpringUtil.java (original)
+++ mina/ftpserver/trunk/core/src/main/java/org/apache/ftpserver/config/spring/SpringUtil.java Sun Aug 17 12:52:42 2008
@@ -15,7 +15,7 @@
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
- */
+ */
package org.apache.ftpserver.config.spring;
@@ -36,167 +36,217 @@
/**
* Various util methods for the Spring config parsing and configuration
+ *
+ * @author The Apache MINA Project (dev@mina.apache.org)
+ * @version $Rev$, $Date$
*/
public class SpringUtil {
/**
* Get all child elements for the element
- * @param elm The element for which to locate children
+ *
+ * @param elm
+ * The element for which to locate children
* @return All children
*/
public static List<Element> getChildElements(final Element elm) {
List<Element> elements = new ArrayList<Element>();
NodeList childs = elm.getChildNodes();
- for(int i = 0; i<childs.getLength(); i++) {
+ for (int i = 0; i < childs.getLength(); i++) {
Node child = childs.item(i);
-
- if(child instanceof Element) {
+
+ if (child instanceof Element) {
elements.add((Element) child);
}
}
-
+
return elements;
}
-
+
/**
* Get the first child element matching the local name and namespace
- * @param parent The element for which to locate the child
- * @param ns The namespace to match, or null for any namespace
- * @param localName The local name to match, or null for any local name
+ *
+ * @param parent
+ * The element for which to locate the child
+ * @param ns
+ * The namespace to match, or null for any namespace
+ * @param localName
+ * The local name to match, or null for any local name
* @return The first child matching the criteria
*/
- public static Element getChildElement(final Element parent, final String ns, final String localName) {
+ public static Element getChildElement(final Element parent,
+ final String ns, final String localName) {
List<Element> elements = getChildElements(parent);
-
- for(Element element : elements) {
- if((ns == null || ns.equals(element.getNamespaceURI()) &&
- (localName == null || localName.equals(element.getLocalName())))) {
+
+ for (Element element : elements) {
+ if ((ns == null || ns.equals(element.getNamespaceURI())
+ && (localName == null || localName.equals(element
+ .getLocalName())))) {
return element;
}
}
-
+
return null;
}
/**
- * Get the text context of first child element matching the local name and namespace
- * @param parent The element for which to locate the child
- * @param ns The namespace to match, or null for any namespace
- * @param localName The local name to match, or null for any local name
- * @return The text content of the first child matching the criteria
- * or null if element not found
+ * Get the text context of first child element matching the local name and
+ * namespace
+ *
+ * @param parent
+ * The element for which to locate the child
+ * @param ns
+ * The namespace to match, or null for any namespace
+ * @param localName
+ * The local name to match, or null for any local name
+ * @return The text content of the first child matching the criteria or null
+ * if element not found
*/
- public static String getChildElementText(final Element parent, final String ns, final String localName) {
+ public static String getChildElementText(final Element parent,
+ final String ns, final String localName) {
List<Element> elements = getChildElements(parent);
-
- for(Element element : elements) {
- if((ns == null || ns.equals(element.getNamespaceURI()) &&
- (localName == null || localName.equals(element.getLocalName())))) {
+
+ for (Element element : elements) {
+ if ((ns == null || ns.equals(element.getNamespaceURI())
+ && (localName == null || localName.equals(element
+ .getLocalName())))) {
return DomUtils.getTextValue(element);
}
}
-
+
return null;
}
-
-
-
+
/**
* Parse specific Spring elements, bean and ref
- * @param parent The element in which we will look for Spring elements
- * @param parserContext The Spring parser context
- * @param builder The Spring bean definition builder
+ *
+ * @param parent
+ * The element in which we will look for Spring elements
+ * @param parserContext
+ * The Spring parser context
+ * @param builder
+ * The Spring bean definition builder
* @return The Spring bean definition
*/
- public static Object parseSpringChildElement(final Element parent, final ParserContext parserContext, final BeanDefinitionBuilder builder) {
+ public static Object parseSpringChildElement(final Element parent,
+ final ParserContext parserContext,
+ final BeanDefinitionBuilder builder) {
Element springElm = getChildElement(parent, null, null);
-
+
String ln = springElm.getLocalName();
- if("bean".equals(ln)) {
- return parserContext.getDelegate().parseBeanDefinitionElement(springElm, builder.getBeanDefinition());
- } else if("ref".equals(ln)) {
- return parserContext.getDelegate().parsePropertySubElement(springElm, builder.getBeanDefinition());
+ if ("bean".equals(ln)) {
+ return parserContext.getDelegate().parseBeanDefinitionElement(
+ springElm, builder.getBeanDefinition());
+ } else if ("ref".equals(ln)) {
+ return parserContext.getDelegate().parsePropertySubElement(
+ springElm, builder.getBeanDefinition());
} else {
- throw new FtpServerConfigurationException("Unknown spring element " + ln);
+ throw new FtpServerConfigurationException("Unknown spring element "
+ + ln);
}
}
/**
- * Parses a attribute value into a boolean.
- * If the attribute is missing or has no content, a default value is returned
- * @param parent The element
- * @param attrName The attribute name
- * @param defaultValue The default value
+ * Parses a attribute value into a boolean. If the attribute is missing or
+ * has no content, a default value is returned
+ *
+ * @param parent
+ * The element
+ * @param attrName
+ * The attribute name
+ * @param defaultValue
+ * The default value
* @return The value, or the default value
*/
- public static boolean parseBoolean(final Element parent, final String attrName, final boolean defaultValue) {
- if(StringUtils.hasText(parent.getAttribute(attrName))) {
+ public static boolean parseBoolean(final Element parent,
+ final String attrName, final boolean defaultValue) {
+ if (StringUtils.hasText(parent.getAttribute(attrName))) {
return Boolean.parseBoolean(parent.getAttribute(attrName));
}
return defaultValue;
}
-
+
/**
- * Parses a attribute value into an integer.
- * @param parent The element
- * @param attrName The attribute name
+ * Parses a attribute value into an integer.
+ *
+ * @param parent
+ * The element
+ * @param attrName
+ * The attribute name
* @return The value
- * @throws NumberFormatException If the attribute does not contain a number
+ * @throws NumberFormatException
+ * If the attribute does not contain a number
*/
public static int parseInt(final Element parent, final String attrName) {
return Integer.parseInt(parent.getAttribute(attrName));
}
-
+
/**
- * Parses a attribute value into an integer.
- * If the attribute is missing or has no content, a default value is returned
- * @param parent The element
- * @param attrName The attribute name
- * @param defaultValue The default value
+ * Parses a attribute value into an integer. If the attribute is missing or
+ * has no content, a default value is returned
+ *
+ * @param parent
+ * The element
+ * @param attrName
+ * The attribute name
+ * @param defaultValue
+ * The default value
* @return The value, or the default value
*/
- public static int parseInt(final Element parent, final String attrName, final int defaultValue) {
- if(StringUtils.hasText(parent.getAttribute(attrName))) {
+ public static int parseInt(final Element parent, final String attrName,
+ final int defaultValue) {
+ if (StringUtils.hasText(parent.getAttribute(attrName))) {
return Integer.parseInt(parent.getAttribute(attrName));
}
return defaultValue;
}
-
+
/**
- * Return the string value of an attribute, or null if the attribute is missing
- * @param parent The element
- * @param attrName The attribute name
+ * Return the string value of an attribute, or null if the attribute is
+ * missing
+ *
+ * @param parent
+ * The element
+ * @param attrName
+ * The attribute name
* @return The attribute string value
*/
public static String parseString(final Element parent, final String attrName) {
- if(parent.hasAttribute(attrName)) {
+ if (parent.hasAttribute(attrName)) {
return parent.getAttribute(attrName);
} else {
return null;
}
}
-
+
/**
* Return an attribute value as a {@link File}
- * @param parent The element
- * @param attrName The attribute name
+ *
+ * @param parent
+ * The element
+ * @param attrName
+ * The attribute name
* @return The file representing the path used in the attribute
*/
public static File parseFile(final Element parent, final String attrName) {
- if(StringUtils.hasText(parent.getAttribute(attrName))) {
+ if (StringUtils.hasText(parent.getAttribute(attrName))) {
return new File(parent.getAttribute(attrName));
}
return null;
}
-
+
/**
* Return an attribute value as an {@link InetAddress}
- * @param parent The element
- * @param attrName The attribute name
+ *
+ * @param parent
+ * The element
+ * @param attrName
+ * The attribute name
* @return The attribute value parsed into a {@link InetAddress}
*/
- public static InetAddress parseInetAddress(final Element parent, final String attrName) {
- if(StringUtils.hasText(parent.getAttribute(attrName))) {
+ public static InetAddress parseInetAddress(final Element parent,
+ final String attrName) {
+ if (StringUtils.hasText(parent.getAttribute(attrName))) {
try {
return InetAddress.getByName(parent.getAttribute(attrName));
} catch (UnknownHostException e) {
Modified: mina/ftpserver/trunk/core/src/main/java/org/apache/ftpserver/config/spring/UserManagerBeanDefinitionParser.java
URL: http://svn.apache.org/viewvc/mina/ftpserver/trunk/core/src/main/java/org/apache/ftpserver/config/spring/UserManagerBeanDefinitionParser.java?rev=686637&r1=686636&r2=686637&view=diff
==============================================================================
--- mina/ftpserver/trunk/core/src/main/java/org/apache/ftpserver/config/spring/UserManagerBeanDefinitionParser.java (original)
+++ mina/ftpserver/trunk/core/src/main/java/org/apache/ftpserver/config/spring/UserManagerBeanDefinitionParser.java Sun Aug 17 12:52:42 2008
@@ -15,7 +15,7 @@
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
- */
+ */
package org.apache.ftpserver.config.spring;
@@ -29,14 +29,18 @@
import org.w3c.dom.Element;
/**
- * Parses the FtpServer "file-user-manager" or "db-user-manager" elements into a Spring
- * bean graph
+ * Parses the FtpServer "file-user-manager" or "db-user-manager" elements into a
+ * Spring bean graph
+ *
+ * @author The Apache MINA Project (dev@mina.apache.org)
+ * @version $Rev$, $Date$
*/
-public class UserManagerBeanDefinitionParser extends AbstractSingleBeanDefinitionParser {
-
+public class UserManagerBeanDefinitionParser extends
+ AbstractSingleBeanDefinitionParser {
+
@Override
protected Class<? extends UserManager> getBeanClass(final Element element) {
- if(element.getLocalName().equals("file-user-manager")) {
+ if (element.getLocalName().equals("file-user-manager")) {
return PropertiesUserManager.class;
} else {
return DbUserManager.class;
@@ -44,43 +48,55 @@
}
@Override
- protected void doParse(final Element element, final ParserContext parserContext, final BeanDefinitionBuilder builder) {
- if(getBeanClass(element) == PropertiesUserManager.class) {
+ protected void doParse(final Element element,
+ final ParserContext parserContext,
+ final BeanDefinitionBuilder builder) {
+ if (getBeanClass(element) == PropertiesUserManager.class) {
builder.addPropertyValue("propFile", element.getAttribute("file"));
- if(StringUtils.hasText(element.getAttribute("encrypt-passwords")) &&
- element.getAttribute("encrypt-passwords").equals("true")) {
+ if (StringUtils.hasText(element.getAttribute("encrypt-passwords"))
+ && element.getAttribute("encrypt-passwords").equals("true")) {
builder.addPropertyValue("encryptPasswords", true);
}
builder.setInitMethodName("configure");
} else {
- Element dsElm = SpringUtil.getChildElement(element,
+ Element dsElm = SpringUtil.getChildElement(element,
FtpServerNamespaceHandler.FTPSERVER_NS, "data-source");
-
+
// schema ensure we get the right type of element
Element springElm = SpringUtil.getChildElement(dsElm, null, null);
Object o;
- if("bean".equals(springElm.getLocalName())) {
- o = parserContext.getDelegate().parseBeanDefinitionElement(springElm, builder.getBeanDefinition());
+ if ("bean".equals(springElm.getLocalName())) {
+ o = parserContext.getDelegate().parseBeanDefinitionElement(
+ springElm, builder.getBeanDefinition());
} else {
// ref
- o = parserContext.getDelegate().parsePropertySubElement(springElm, builder.getBeanDefinition());
+ o = parserContext.getDelegate().parsePropertySubElement(
+ springElm, builder.getBeanDefinition());
}
builder.addPropertyValue("dataSource", o);
-
- builder.addPropertyValue("sqlUserInsert", getSql(element, "insert-user"));
- builder.addPropertyValue("sqlUserUpdate", getSql(element, "update-user"));
- builder.addPropertyValue("sqlUserDelete", getSql(element, "delete-user"));
- builder.addPropertyValue("sqlUserSelect", getSql(element, "select-user"));
- builder.addPropertyValue("sqlUserSelectAll", getSql(element, "select-all-users"));
- builder.addPropertyValue("sqlUserAdmin", getSql(element, "is-admin"));
- builder.addPropertyValue("sqlUserAuthenticate", getSql(element, "authenticate"));
-
+
+ builder.addPropertyValue("sqlUserInsert", getSql(element,
+ "insert-user"));
+ builder.addPropertyValue("sqlUserUpdate", getSql(element,
+ "update-user"));
+ builder.addPropertyValue("sqlUserDelete", getSql(element,
+ "delete-user"));
+ builder.addPropertyValue("sqlUserSelect", getSql(element,
+ "select-user"));
+ builder.addPropertyValue("sqlUserSelectAll", getSql(element,
+ "select-all-users"));
+ builder.addPropertyValue("sqlUserAdmin",
+ getSql(element, "is-admin"));
+ builder.addPropertyValue("sqlUserAuthenticate", getSql(element,
+ "authenticate"));
+
builder.setInitMethodName("configure");
}
}
-
+
private String getSql(final Element element, final String elmName) {
- return SpringUtil.getChildElementText(element, FtpServerNamespaceHandler.FTPSERVER_NS, elmName);
+ return SpringUtil.getChildElementText(element,
+ FtpServerNamespaceHandler.FTPSERVER_NS, elmName);
}
}
Modified: mina/ftpserver/trunk/core/src/main/java/org/apache/ftpserver/filesystem/NameEqualsFileFilter.java
URL: http://svn.apache.org/viewvc/mina/ftpserver/trunk/core/src/main/java/org/apache/ftpserver/filesystem/NameEqualsFileFilter.java?rev=686637&r1=686636&r2=686637&view=diff
==============================================================================
--- mina/ftpserver/trunk/core/src/main/java/org/apache/ftpserver/filesystem/NameEqualsFileFilter.java (original)
+++ mina/ftpserver/trunk/core/src/main/java/org/apache/ftpserver/filesystem/NameEqualsFileFilter.java Sun Aug 17 12:52:42 2008
@@ -15,7 +15,7 @@
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
- */
+ */
package org.apache.ftpserver.filesystem;
@@ -24,30 +24,37 @@
/**
* FileFilter used for simple file name matching
+ *
+ * @author The Apache MINA Project (dev@mina.apache.org)
+ * @version $Rev$, $Date$
*/
public class NameEqualsFileFilter implements FileFilter {
- private String nameToMatch;
- private boolean caseInsensitive = false;
+ private String nameToMatch;
+
+ private boolean caseInsensitive = false;
- /**
- * Constructor
- *
- * @param nameToMatch The exact file name to match
- * @param caseInsensitive Wether that match should be case insensitive
- */
- public NameEqualsFileFilter(final String nameToMatch, final boolean caseInsensitive) {
- this.nameToMatch = nameToMatch;
- this.caseInsensitive = caseInsensitive;
- }
-
- public boolean accept(final File file) {
-
- if(caseInsensitive) {
- return file.getName().equalsIgnoreCase(nameToMatch);
- } else {
- return file.getName().equals(nameToMatch);
- }
- }
+ /**
+ * Constructor
+ *
+ * @param nameToMatch
+ * The exact file name to match
+ * @param caseInsensitive
+ * Wether that match should be case insensitive
+ */
+ public NameEqualsFileFilter(final String nameToMatch,
+ final boolean caseInsensitive) {
+ this.nameToMatch = nameToMatch;
+ this.caseInsensitive = caseInsensitive;
+ }
+
+ public boolean accept(final File file) {
+
+ if (caseInsensitive) {
+ return file.getName().equalsIgnoreCase(nameToMatch);
+ } else {
+ return file.getName().equals(nameToMatch);
+ }
+ }
}
Modified: mina/ftpserver/trunk/core/src/main/java/org/apache/ftpserver/filesystem/NativeFileObject.java
URL: http://svn.apache.org/viewvc/mina/ftpserver/trunk/core/src/main/java/org/apache/ftpserver/filesystem/NativeFileObject.java?rev=686637&r1=686636&r2=686637&view=diff
==============================================================================
--- mina/ftpserver/trunk/core/src/main/java/org/apache/ftpserver/filesystem/NativeFileObject.java (original)
+++ mina/ftpserver/trunk/core/src/main/java/org/apache/ftpserver/filesystem/NativeFileObject.java Sun Aug 17 12:52:42 2008
@@ -36,6 +36,9 @@
/**
* This class wraps native file object.
+ *
+ * @author The Apache MINA Project (dev@mina.apache.org)
+ * @version $Rev$, $Date$
*/
public class NativeFileObject implements FileObject {
@@ -51,7 +54,8 @@
/**
* Constructor.
*/
- protected NativeFileObject(final String fileName, final File file, final User user) {
+ protected NativeFileObject(final String fileName, final File file,
+ final User user) {
if (fileName == null) {
throw new IllegalArgumentException("fileName can not be null");
}
@@ -300,7 +304,8 @@
/**
* Create output stream for writing.
*/
- public OutputStream createOutputStream(final long offset) throws IOException {
+ public OutputStream createOutputStream(final long offset)
+ throws IOException {
// permission check
if (!hasWritePermission()) {
@@ -314,10 +319,8 @@
// The IBM jre needs to have both the stream and the random access file
// objects closed to actually close the file
- return new FileOutputStream(raf.getFD())
- {
- public void close() throws IOException
- {
+ return new FileOutputStream(raf.getFD()) {
+ public void close() throws IOException {
super.close();
raf.close();
}
@@ -340,10 +343,8 @@
// The IBM jre needs to have both the stream and the random access file
// objects closed to actually close the file
- return new FileInputStream(raf.getFD())
- {
- public void close() throws IOException
- {
+ return new FileInputStream(raf.getFD()) {
+ public void close() throws IOException {
super.close();
raf.close();
}
@@ -373,13 +374,14 @@
* @return The return string will always begin with the root directory. It
* will never be null.
*/
- public final static String getPhysicalName(final String rootDir, final String currDir,
- final String fileName) {
+ public final static String getPhysicalName(final String rootDir,
+ final String currDir, final String fileName) {
return getPhysicalName(rootDir, currDir, fileName, false);
}
- public final static String getPhysicalName(final String rootDir, final String currDir,
- final String fileName, final boolean caseInsensitive) {
+ public final static String getPhysicalName(final String rootDir,
+ final String currDir, final String fileName,
+ final boolean caseInsensitive) {
// get the starting directory
String normalizedRootDir = normalizeSeparateChar(rootDir);
@@ -441,7 +443,8 @@
// ~ => home directory (in this case the root directory)
if (tok.equals("~")) {
- resArg = normalizedRootDir.substring(0, normalizedRootDir.length() - 1);
+ resArg = normalizedRootDir.substring(0, normalizedRootDir
+ .length() - 1);
continue;
}
@@ -463,7 +466,8 @@
}
// final check
- if (!resArg.regionMatches(0, normalizedRootDir, 0, normalizedRootDir.length())) {
+ if (!resArg.regionMatches(0, normalizedRootDir, 0, normalizedRootDir
+ .length())) {
resArg = normalizedRootDir;
}
Modified: mina/ftpserver/trunk/core/src/main/java/org/apache/ftpserver/filesystem/NativeFileSystemManager.java
URL: http://svn.apache.org/viewvc/mina/ftpserver/trunk/core/src/main/java/org/apache/ftpserver/filesystem/NativeFileSystemManager.java?rev=686637&r1=686636&r2=686637&view=diff
==============================================================================
--- mina/ftpserver/trunk/core/src/main/java/org/apache/ftpserver/filesystem/NativeFileSystemManager.java (original)
+++ mina/ftpserver/trunk/core/src/main/java/org/apache/ftpserver/filesystem/NativeFileSystemManager.java Sun Aug 17 12:52:42 2008
@@ -15,7 +15,7 @@
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
- */
+ */
package org.apache.ftpserver.filesystem;
@@ -30,53 +30,57 @@
/**
* Native file system manager. It uses the OS file system.
+ *
+ * @author The Apache MINA Project (dev@mina.apache.org)
+ * @version $Rev$, $Date$
*/
-public
-class NativeFileSystemManager implements FileSystemManager {
+public class NativeFileSystemManager implements FileSystemManager {
+
+ private final Logger LOG = LoggerFactory
+ .getLogger(NativeFileSystemManager.class);
- private final Logger LOG = LoggerFactory.getLogger(NativeFileSystemManager.class);
-
private boolean createHome;
+
private boolean caseInsensitive;
-
+
public boolean isCreateHome() {
- return createHome;
- }
+ return createHome;
+ }
+
+ public void setCreateHome(boolean createHome) {
+ this.createHome = createHome;
+ }
+
+ public boolean isCaseInsensitive() {
+ return caseInsensitive;
+ }
- public void setCreateHome(boolean createHome) {
- this.createHome = createHome;
- }
-
- public boolean isCaseInsensitive() {
- return caseInsensitive;
- }
-
- public void setCaseInsensitive(boolean caseInsensitive) {
- this.caseInsensitive = caseInsensitive;
- }
+ public void setCaseInsensitive(boolean caseInsensitive) {
+ this.caseInsensitive = caseInsensitive;
+ }
-
/**
* Create the appropriate user file system view.
*/
public FileSystemView createFileSystemView(User user) throws FtpException {
// create home if does not exist
- if(createHome) {
+ if (createHome) {
String homeDirStr = user.getHomeDirectory();
File homeDir = new File(homeDirStr);
- if(homeDir.isFile()) {
+ if (homeDir.isFile()) {
LOG.warn("Not a directory :: " + homeDirStr);
throw new FtpException("Not a directory :: " + homeDirStr);
}
- if( (!homeDir.exists()) && (!homeDir.mkdirs()) ) {
+ if ((!homeDir.exists()) && (!homeDir.mkdirs())) {
LOG.warn("Cannot create user home :: " + homeDirStr);
- throw new FtpException("Cannot create user home :: " + homeDirStr);
+ throw new FtpException("Cannot create user home :: "
+ + homeDirStr);
}
}
-
+
FileSystemView fsView = new NativeFileSystemView(user, caseInsensitive);
return fsView;
}
-
+
}
Modified: mina/ftpserver/trunk/core/src/main/java/org/apache/ftpserver/filesystem/NativeFileSystemView.java
URL: http://svn.apache.org/viewvc/mina/ftpserver/trunk/core/src/main/java/org/apache/ftpserver/filesystem/NativeFileSystemView.java?rev=686637&r1=686636&r2=686637&view=diff
==============================================================================
--- mina/ftpserver/trunk/core/src/main/java/org/apache/ftpserver/filesystem/NativeFileSystemView.java (original)
+++ mina/ftpserver/trunk/core/src/main/java/org/apache/ftpserver/filesystem/NativeFileSystemView.java Sun Aug 17 12:52:42 2008
@@ -15,7 +15,7 @@
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
- */
+ */
package org.apache.ftpserver.filesystem;
@@ -27,125 +27,130 @@
import org.apache.ftpserver.ftplet.User;
/**
- * File system view based on native file system. Here the root directory
- * will be user virtual root (/).
+ * File system view based on native file system. Here the root directory will be
+ * user virtual root (/).
+ *
+ * @author The Apache MINA Project (dev@mina.apache.org)
+ * @version $Rev$, $Date$
*/
-public
-class NativeFileSystemView implements FileSystemView {
-
+public class NativeFileSystemView implements FileSystemView {
+
// the root directory will always end with '/'.
private String rootDir;
-
+
// the first and the last character will always be '/'
// It is always with respect to the root directory.
private String currDir;
-
+
private User user;
-
- //private boolean writePermission;
- private boolean caseInsensitive = false;
-
+ // private boolean writePermission;
+
+ private boolean caseInsensitive = false;
+
/**
* Constructor - set the user object.
*/
protected NativeFileSystemView(User user) throws FtpException {
this(user, false);
}
-
+
/**
* Constructor - set the user object.
*/
- protected NativeFileSystemView(User user, boolean caseInsensitive) throws FtpException {
- if(user == null) {
+ protected NativeFileSystemView(User user, boolean caseInsensitive)
+ throws FtpException {
+ if (user == null) {
throw new IllegalArgumentException("user can not be null");
}
- if(user.getHomeDirectory() == null) {
- throw new IllegalArgumentException("User home directory can not be null");
+ if (user.getHomeDirectory() == null) {
+ throw new IllegalArgumentException(
+ "User home directory can not be null");
}
-
- this.caseInsensitive = caseInsensitive;
-
+
+ this.caseInsensitive = caseInsensitive;
+
// add last '/' if necessary
String rootDir = user.getHomeDirectory();
rootDir = NativeFileObject.normalizeSeparateChar(rootDir);
- if(!rootDir.endsWith("/")) {
+ if (!rootDir.endsWith("/")) {
rootDir += '/';
}
this.rootDir = rootDir;
-
+
this.user = user;
-
+
currDir = "/";
}
-
+
/**
- * Get the user home directory. It would be the file system root
- * for the user.
+ * Get the user home directory. It would be the file system root for the
+ * user.
*/
public FileObject getHomeDirectory() {
return new NativeFileObject("/", new File(rootDir), user);
}
-
+
/**
* Get the current directory.
*/
public FileObject getCurrentDirectory() {
FileObject fileObj = null;
- if(currDir.equals("/")) {
- fileObj = new NativeFileObject("/", new File(rootDir), user);
- }
- else {
+ if (currDir.equals("/")) {
+ fileObj = new NativeFileObject("/", new File(rootDir), user);
+ } else {
File file = new File(rootDir, currDir.substring(1));
fileObj = new NativeFileObject(currDir, file, user);
-
+
}
return fileObj;
}
-
+
/**
* Get file object.
*/
public FileObject getFileObject(String file) {
-
+
// get actual file object
- String physicalName = NativeFileObject.getPhysicalName(rootDir, currDir, file);
+ String physicalName = NativeFileObject.getPhysicalName(rootDir,
+ currDir, file);
File fileObj = new File(physicalName);
-
+
// strip the root directory and return
String userFileName = physicalName.substring(rootDir.length() - 1);
return new NativeFileObject(userFileName, fileObj, user);
}
-
+
/**
* Change directory.
*/
public boolean changeDirectory(String dir) {
-
+
// not a directory - return false
- dir = NativeFileObject.getPhysicalName(rootDir, currDir, dir, caseInsensitive);
+ dir = NativeFileObject.getPhysicalName(rootDir, currDir, dir,
+ caseInsensitive);
File dirObj = new File(dir);
- if(!dirObj.isDirectory()) {
+ if (!dirObj.isDirectory()) {
return false;
}
-
+
// strip user root and add last '/' if necessary
dir = dir.substring(rootDir.length() - 1);
- if(dir.charAt(dir.length() - 1) != '/') {
+ if (dir.charAt(dir.length() - 1) != '/') {
dir = dir + '/';
}
-
+
currDir = dir;
return true;
}
-
+
/**
* Is the file content random accessible?
*/
public boolean isRandomAccessible() {
- return true;
+ return true;
}
-
+
/**
* Dispose file system view - does nothing.
*/
Modified: mina/ftpserver/trunk/core/src/main/java/org/apache/ftpserver/filter/FtpLoggingFilter.java
URL: http://svn.apache.org/viewvc/mina/ftpserver/trunk/core/src/main/java/org/apache/ftpserver/filter/FtpLoggingFilter.java?rev=686637&r1=686636&r2=686637&view=diff
==============================================================================
--- mina/ftpserver/trunk/core/src/main/java/org/apache/ftpserver/filter/FtpLoggingFilter.java (original)
+++ mina/ftpserver/trunk/core/src/main/java/org/apache/ftpserver/filter/FtpLoggingFilter.java Sun Aug 17 12:52:42 2008
@@ -15,7 +15,7 @@
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
- */
+ */
package org.apache.ftpserver.filter;
@@ -24,76 +24,80 @@
import org.apache.mina.filter.logging.LoggingFilter;
/**
- * Specialized @see {@link LoggingFilter} that optionally
- * masks FTP passwords.
+ * Specialized @see {@link LoggingFilter} that optionally masks FTP passwords.
+ *
+ * @author The Apache MINA Project (dev@mina.apache.org)
+ * @version $Rev$, $Date$
*/
public class FtpLoggingFilter extends LoggingFilter {
- private boolean maskPassword = true;
-
- /**
- * @see LoggingFilter#LoggingFilter()
- */
- public FtpLoggingFilter() {
- super();
- }
-
- /**
- * @see LoggingFilter#LoggingFilter(Class)
- */
- public FtpLoggingFilter(Class<?> clazz) {
- super(clazz);
- }
-
- /**
- * @see LoggingFilter#LoggingFilter(String)
- */
- public FtpLoggingFilter(String name) {
- super(name);
- }
-
- /**
- * @see LoggingFilter#messageReceived(org.apache.mina.core.IoFilter.NextFilter, IoSession, Object)
- */
- @Override
- public void messageReceived(NextFilter nextFilter, IoSession session,
- Object message) throws Exception {
- String request = (String) message;
-
- String logMessage;
- if(maskPassword) {
-
- request = request.trim().toUpperCase();
-
- if(request.startsWith("PASS ")) {
- logMessage = "PASS *****";
- } else {
- logMessage = request;
- }
- } else {
- logMessage = request;
- }
-
+ private boolean maskPassword = true;
+
+ /**
+ * @see LoggingFilter#LoggingFilter()
+ */
+ public FtpLoggingFilter() {
+ super();
+ }
+
+ /**
+ * @see LoggingFilter#LoggingFilter(Class)
+ */
+ public FtpLoggingFilter(Class<?> clazz) {
+ super(clazz);
+ }
+
+ /**
+ * @see LoggingFilter#LoggingFilter(String)
+ */
+ public FtpLoggingFilter(String name) {
+ super(name);
+ }
+
+ /**
+ * @see LoggingFilter#messageReceived(org.apache.mina.core.IoFilter.NextFilter,
+ * IoSession, Object)
+ */
+ @Override
+ public void messageReceived(NextFilter nextFilter, IoSession session,
+ Object message) throws Exception {
+ String request = (String) message;
+
+ String logMessage;
+ if (maskPassword) {
+
+ request = request.trim().toUpperCase();
+
+ if (request.startsWith("PASS ")) {
+ logMessage = "PASS *****";
+ } else {
+ logMessage = request;
+ }
+ } else {
+ logMessage = request;
+ }
+
log(IoEventType.MESSAGE_RECEIVED, "RECEIVED: {}", logMessage);
nextFilter.messageReceived(session, message);
- }
+ }
- /**
- * Are password masked?
- * @return true if passwords are masked
- */
- public boolean isMaskPassword() {
- return maskPassword;
- }
-
- /**
- * Mask password in log messages
- * @param maskPassword true if passwords should be masked
- */
- public void setMaskPassword(boolean maskPassword) {
- this.maskPassword = maskPassword;
- }
+ /**
+ * Are password masked?
+ *
+ * @return true if passwords are masked
+ */
+ public boolean isMaskPassword() {
+ return maskPassword;
+ }
+
+ /**
+ * Mask password in log messages
+ *
+ * @param maskPassword
+ * true if passwords should be masked
+ */
+ public void setMaskPassword(boolean maskPassword) {
+ this.maskPassword = maskPassword;
+ }
-
-
}
Modified: mina/ftpserver/trunk/core/src/main/java/org/apache/ftpserver/ftplet/DefaultFtpletContainer.java
URL: http://svn.apache.org/viewvc/mina/ftpserver/trunk/core/src/main/java/org/apache/ftpserver/ftplet/DefaultFtpletContainer.java?rev=686637&r1=686636&r2=686637&view=diff
==============================================================================
--- mina/ftpserver/trunk/core/src/main/java/org/apache/ftpserver/ftplet/DefaultFtpletContainer.java (original)
+++ mina/ftpserver/trunk/core/src/main/java/org/apache/ftpserver/ftplet/DefaultFtpletContainer.java Sun Aug 17 12:52:42 2008
@@ -15,7 +15,7 @@
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
- */
+ */
package org.apache.ftpserver.ftplet;
@@ -29,58 +29,62 @@
/**
* This ftplet calls other ftplet methods and returns appropriate return value.
+ *
+ * @author The Apache MINA Project (dev@mina.apache.org)
+ * @version $Rev$, $Date$
*/
public class DefaultFtpletContainer implements FtpletContainer {
-
- private final Logger LOG = LoggerFactory.getLogger(DefaultFtpletContainer.class);
-
+
+ private final Logger LOG = LoggerFactory
+ .getLogger(DefaultFtpletContainer.class);
+
private Map<String, Ftplet> ftplets = new ConcurrentHashMap<String, Ftplet>();
public void dispose() {
-
- for(Entry<String, Ftplet> entry : ftplets.entrySet()) {
+
+ for (Entry<String, Ftplet> entry : ftplets.entrySet()) {
try {
entry.getValue().destroy();
- }
- catch(Exception ex) {
+ } catch (Exception ex) {
LOG.error(entry.getKey() + " :: FtpletHandler.destroy()", ex);
}
}
ftplets.clear();
}
-
+
public void addFtplet(String name, Ftplet ftplet) {
- if(getFtplet(name) != null) {
- throw new IllegalArgumentException("Ftplet with name \"" + name + "\" already registred with container");
+ if (getFtplet(name) != null) {
+ throw new IllegalArgumentException("Ftplet with name \"" + name
+ + "\" already registred with container");
}
-
+
ftplets.put(name, ftplet);
}
public Ftplet removeFtplet(String name) {
Ftplet ftplet = ftplets.get(name);
-
- if(ftplet != null) {
+
+ if (ftplet != null) {
ftplets.remove(name);
return ftplet;
} else {
return null;
}
}
-
+
/**
* Get Ftplet for the given name.
*/
public Ftplet getFtplet(String name) {
- if(name == null) {
+ if (name == null) {
return null;
}
-
+
return ftplets.get(name);
}
public void init(FtpletContext ftpletContext) throws FtpException {
- // dummy, forced by Ftplet API
+ // dummy, forced by Ftplet API
}
/**
@@ -97,28 +101,27 @@
this.ftplets = ftplets;
}
-
-
/**
* Destroy all ftplets.
*/
public void destroy() {
dispose();
}
-
+
/**
* Call ftplet onConnect.
*/
- public FtpletEnum onConnect(FtpSession session) throws FtpException, IOException {
+ public FtpletEnum onConnect(FtpSession session) throws FtpException,
+ IOException {
FtpletEnum retVal = FtpletEnum.RET_DEFAULT;
- for(Entry<String, Ftplet> entry : ftplets.entrySet()) {
+ for (Entry<String, Ftplet> entry : ftplets.entrySet()) {
retVal = entry.getValue().onConnect(session);
- if(retVal == null) {
+ if (retVal == null) {
retVal = FtpletEnum.RET_DEFAULT;
}
-
+
// proceed only if the return value is FtpletEnum.RET_DEFAULT
- if(retVal != FtpletEnum.RET_DEFAULT) {
+ if (retVal != FtpletEnum.RET_DEFAULT) {
break;
}
}
@@ -128,57 +131,58 @@
/**
* Call ftplet onDisconnect.
*/
- public FtpletEnum onDisconnect(FtpSession session) throws FtpException, IOException {
+ public FtpletEnum onDisconnect(FtpSession session) throws FtpException,
+ IOException {
FtpletEnum retVal = FtpletEnum.RET_DEFAULT;
- for(Entry<String, Ftplet> entry : ftplets.entrySet()) {
+ for (Entry<String, Ftplet> entry : ftplets.entrySet()) {
retVal = entry.getValue().onDisconnect(session);
- if(retVal == null) {
+ if (retVal == null) {
retVal = FtpletEnum.RET_DEFAULT;
}
-
+
// proceed only if the return value is FtpletEnum.RET_DEFAULT
- if(retVal != FtpletEnum.RET_DEFAULT) {
+ if (retVal != FtpletEnum.RET_DEFAULT) {
break;
}
}
return retVal;
}
-
- public FtpletEnum afterCommand(FtpSession session, FtpRequest request) throws FtpException, IOException {
+ public FtpletEnum afterCommand(FtpSession session, FtpRequest request)
+ throws FtpException, IOException {
FtpletEnum retVal = FtpletEnum.RET_DEFAULT;
- for(Entry<String, Ftplet> entry : ftplets.entrySet()) {
+ for (Entry<String, Ftplet> entry : ftplets.entrySet()) {
retVal = entry.getValue().afterCommand(session, request);
- if(retVal == null) {
+ if (retVal == null) {
retVal = FtpletEnum.RET_DEFAULT;
}
-
+
// proceed only if the return value is FtpletEnum.RET_DEFAULT
- if(retVal != FtpletEnum.RET_DEFAULT) {
+ if (retVal != FtpletEnum.RET_DEFAULT) {
break;
}
}
- return retVal;
+ return retVal;
}
- public FtpletEnum beforeCommand(FtpSession session, FtpRequest request) throws FtpException, IOException {
+ public FtpletEnum beforeCommand(FtpSession session, FtpRequest request)
+ throws FtpException, IOException {
FtpletEnum retVal = FtpletEnum.RET_DEFAULT;
- for(Entry<String, Ftplet> entry : ftplets.entrySet()) {
+ for (Entry<String, Ftplet> entry : ftplets.entrySet()) {
retVal = entry.getValue().beforeCommand(session, request);
- if(retVal == null) {
+ if (retVal == null) {
retVal = FtpletEnum.RET_DEFAULT;
}
-
+
// proceed only if the return value is FtpletEnum.RET_DEFAULT
- if(retVal != FtpletEnum.RET_DEFAULT) {
+ if (retVal != FtpletEnum.RET_DEFAULT) {
break;
}
}
return retVal;
}
-
}
Modified: mina/ftpserver/trunk/core/src/main/java/org/apache/ftpserver/ftplet/FtpletContainer.java
URL: http://svn.apache.org/viewvc/mina/ftpserver/trunk/core/src/main/java/org/apache/ftpserver/ftplet/FtpletContainer.java?rev=686637&r1=686636&r2=686637&view=diff
==============================================================================
--- mina/ftpserver/trunk/core/src/main/java/org/apache/ftpserver/ftplet/FtpletContainer.java (original)
+++ mina/ftpserver/trunk/core/src/main/java/org/apache/ftpserver/ftplet/FtpletContainer.java Sun Aug 17 12:52:42 2008
@@ -15,58 +15,70 @@
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
- */
+ */
package org.apache.ftpserver.ftplet;
import java.util.Map;
/**
- * Interface describing an Ftplet container.
- * Ftplet containers extend the {@link Ftplet} interface and
- * forward any events to the Ftplets hosted by the container.
+ * Interface describing an Ftplet container. Ftplet containers extend the
+ * {@link Ftplet} interface and forward any events to the Ftplets hosted by the
+ * container.
+ *
+ * @author The Apache MINA Project (dev@mina.apache.org)
+ * @version $Rev$, $Date$
*/
public interface FtpletContainer extends Ftplet {
/**
* Add an {@link Ftplet} to the container.
*
- * @param name The name of the Ftplet to be added
- * @param ftplet The Ftplet
- * @throws IllegalArgumentException If an Ftplet with the same
- * name already exist within the container
+ * @param name
+ * The name of the Ftplet to be added
+ * @param ftplet
+ * The Ftplet
+ * @throws IllegalArgumentException
+ * If an Ftplet with the same name already exist within the
+ * container
*/
void addFtplet(String name, Ftplet ftplet);
/**
- * Remove the {@link Ftplet} identified by the name (as
- * provided in the {@link #addFtplet(String, Ftplet)} method.
+ * Remove the {@link Ftplet} identified by the name (as provided in the
+ * {@link #addFtplet(String, Ftplet)} method.
*
- * @param name The name of the Ftplet to be removed
- * @return The removed Ftplet if found, or null if the name is
- * unknown to the container.
+ * @param name
+ * The name of the Ftplet to be removed
+ * @return The removed Ftplet if found, or null if the name is unknown to
+ * the container.
*/
Ftplet removeFtplet(String name);
-
+
/**
- * Retrive the {@link Ftplet} identified by the name (as
- * provided in the {@link #addFtplet(String, Ftplet)} method.
- * @param name The name of the Ftplet to retrive
- * @return The Ftplet if found, or null if the name is
- * unknown to the container.
+ * Retrive the {@link Ftplet} identified by the name (as provided in the
+ * {@link #addFtplet(String, Ftplet)} method.
+ *
+ * @param name
+ * The name of the Ftplet to retrive
+ * @return The Ftplet if found, or null if the name is unknown to the
+ * container.
*/
Ftplet getFtplet(String name);
/**
* Retrive all Ftplets registered with this container
+ *
* @return A map of all Ftplets with their name as the key
*/
Map<String, Ftplet> getFtplets();
-
+
/**
- * Set the Ftplets for this container. Will remove all
- * previously registred Ftplets in this container
- * @param ftplets A map of all Ftplets with their name as the key
+ * Set the Ftplets for this container. Will remove all previously registred
+ * Ftplets in this container
+ *
+ * @param ftplets
+ * A map of all Ftplets with their name as the key
*/
void setFtplets(Map<String, Ftplet> ftplets);
}
\ No newline at end of file
Modified: mina/ftpserver/trunk/core/src/main/java/org/apache/ftpserver/interfaces/Command.java
URL: http://svn.apache.org/viewvc/mina/ftpserver/trunk/core/src/main/java/org/apache/ftpserver/interfaces/Command.java?rev=686637&r1=686636&r2=686637&view=diff
==============================================================================
--- mina/ftpserver/trunk/core/src/main/java/org/apache/ftpserver/interfaces/Command.java (original)
+++ mina/ftpserver/trunk/core/src/main/java/org/apache/ftpserver/interfaces/Command.java Sun Aug 17 12:52:42 2008
@@ -15,7 +15,7 @@
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
- */
+ */
package org.apache.ftpserver.interfaces;
@@ -25,18 +25,22 @@
import org.apache.ftpserver.ftplet.FtpRequest;
/**
- * This interface encapsulates all the FTP commands.
+ * This interface encapsulates all the FTP commands.
+ *
+ * @author The Apache MINA Project (dev@mina.apache.org)
+ * @version $Rev$, $Date$
*/
-public
-interface Command {
+public interface Command {
/**
* Execute command.
- * @param session TODO
- * @param context TODO
+ *
+ * @param session
+ * TODO
+ * @param context
+ * TODO
*/
- void execute(FtpIoSession session,
- FtpServerContext context,
- FtpRequest request) throws IOException, FtpException;
-
+ void execute(FtpIoSession session, FtpServerContext context,
+ FtpRequest request) throws IOException, FtpException;
+
}
Modified: mina/ftpserver/trunk/core/src/main/java/org/apache/ftpserver/interfaces/CommandFactory.java
URL: http://svn.apache.org/viewvc/mina/ftpserver/trunk/core/src/main/java/org/apache/ftpserver/interfaces/CommandFactory.java?rev=686637&r1=686636&r2=686637&view=diff
==============================================================================
--- mina/ftpserver/trunk/core/src/main/java/org/apache/ftpserver/interfaces/CommandFactory.java (original)
+++ mina/ftpserver/trunk/core/src/main/java/org/apache/ftpserver/interfaces/CommandFactory.java Sun Aug 17 12:52:42 2008
@@ -15,57 +15,56 @@
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
- */
+ */
package org.apache.ftpserver.interfaces;
-
-
/**
* Command factory interface.
+ *
+ * @author The Apache MINA Project (dev@mina.apache.org)
+ * @version $Rev$, $Date$
*/
-public
-interface CommandFactory {
+public interface CommandFactory {
/**
* Get the command instance.
*/
Command getCommand(String commandName);
-
+
/**
* Get the registered SITE commands
- * @return Active site commands, the key is
- * the site command name, used in FTP
- * sessions as SITE <command name>
+ *
+ * @return Active site commands, the key is the site command name, used in
+ * FTP sessions as SITE <command name>
*/
-// Map<String, Command> getSiteCommands();
-
+ // Map<String, Command> getSiteCommands();
/**
- * Register SITE commands. The map can replace or
- * append to the default SITE commands provided
- * by FtpServer depending on the value of
- * {@see CommandFactory#isUseDefaultSiteCommands()}
- * @param siteCommands Active site commands, the key is
- * the site command name, used in FTP
- * sessions as SITE <command name>. The value is the
- * command
+ * Register SITE commands. The map can replace or append to the default SITE
+ * commands provided by FtpServer depending on the value of {@see
+ * CommandFactory#isUseDefaultSiteCommands()}
+ *
+ * @param siteCommands
+ * Active site commands, the key is the site command name, used
+ * in FTP sessions as SITE <command name>. The value is the
+ * command
*/
-// void setSiteCommands(Map<String, Command> siteCommands);
-
+ // void setSiteCommands(Map<String, Command> siteCommands);
/**
- * Should custom site commands append to or replace
- * the default commands provided by FtpServer?.
- * The default is to append
- * @return true if custom commands should append to the default,
- * false if they should replace
+ * Should custom site commands append to or replace the default commands
+ * provided by FtpServer?. The default is to append
+ *
+ * @return true if custom commands should append to the default, false if
+ * they should replace
*/
-// boolean isUseDefaultSiteCommands();
-
+ // boolean isUseDefaultSiteCommands();
/**
- * Should custom site commands append to or replace
- * the default commands provided by FtpServer?.
- * @param useDefaultSiteCommands true if custom commands should append to the default,
- * false if they should replace
+ * Should custom site commands append to or replace the default commands
+ * provided by FtpServer?.
+ *
+ * @param useDefaultSiteCommands
+ * true if custom commands should append to the default, false if
+ * they should replace
*/
-// void setUseDefaultSiteCommands(boolean useDefaultSiteCommands);
+ // void setUseDefaultSiteCommands(boolean useDefaultSiteCommands);
}
Modified: mina/ftpserver/trunk/core/src/main/java/org/apache/ftpserver/interfaces/DataConnectionConfiguration.java
URL: http://svn.apache.org/viewvc/mina/ftpserver/trunk/core/src/main/java/org/apache/ftpserver/interfaces/DataConnectionConfiguration.java?rev=686637&r1=686636&r2=686637&view=diff
==============================================================================
--- mina/ftpserver/trunk/core/src/main/java/org/apache/ftpserver/interfaces/DataConnectionConfiguration.java (original)
+++ mina/ftpserver/trunk/core/src/main/java/org/apache/ftpserver/interfaces/DataConnectionConfiguration.java Sun Aug 17 12:52:42 2008
@@ -15,7 +15,7 @@
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
- */
+ */
package org.apache.ftpserver.interfaces;
@@ -25,83 +25,89 @@
/**
* Data connection configuration interface.
+ *
+ * @author The Apache MINA Project (dev@mina.apache.org)
+ * @version $Rev$, $Date$
*/
-public
-interface DataConnectionConfiguration {
+public interface DataConnectionConfiguration {
/**
* Get the maximum idle time in seconds.
*/
int getIdleTime();
-
+
/**
* Is active data connection enabled?
*/
boolean isActiveEnabled();
-
+
/**
* Check the PORT IP with the client IP?
*/
boolean isActiveIpCheck();
-
+
/**
* Get the active data connection local host.
*/
InetAddress getActiveLocalAddress();
-
+
/**
* Get the active data connection local port.
*/
- int getActiveLocalPort();
-
+ int getActiveLocalPort();
+
/**
* Get passive server address. null, if not set in the configuration.
*/
InetAddress getPassiveAddress();
-
+
/**
- * Get the passive address that will be returned to clients on the
- * PASV command.
+ * Get the passive address that will be returned to clients on the PASV
+ * command.
+ *
* @return The passive address to be returned to clients, null if not
- * configured.
+ * configured.
*/
InetAddress getPassiveExernalAddress();
-
+
/**
- * Set the passive ports to be used for data connections.
- * Ports can be defined as single ports, closed or open ranges.
- * Multiple definitions can be separated by commas, for example:
+ * Set the passive ports to be used for data connections. Ports can be
+ * defined as single ports, closed or open ranges. Multiple definitions can
+ * be separated by commas, for example:
* <ul>
- * <li>2300 : only use port 2300 as the passive port</li>
- * <li>2300-2399 : use all ports in the range</li>
- * <li>2300- : use all ports larger than 2300</li>
- * <li>2300, 2305, 2400- : use 2300 or 2305 or any port larger than 2400</li>
+ * <li>2300 : only use port 2300 as the passive port</li>
+ * <li>2300-2399 : use all ports in the range</li>
+ * <li>2300- : use all ports larger than 2300</li>
+ * <li>2300, 2305, 2400- : use 2300 or 2305 or any port larger than 2400</li>
* </ul>
*
* Defaults to using any available port
+ *
* @return The passive ports string
*/
String getPassivePorts();
-
+
/**
- * Set the allowed passive ports.
- * @see DataConnectionConfiguration#getPassivePorts() for details on the allowed format.
- * If set to null, the passive port with be assigned from any available port
- * @param passivePorts The passive ports to use for this data connection
+ * Set the allowed passive ports.
+ *
+ * @see DataConnectionConfiguration#getPassivePorts() for details on the
+ * allowed format. If set to null, the passive port with be assigned
+ * from any available port
+ * @param passivePorts
+ * The passive ports to use for this data connection
*/
void setPassivePorts(String passivePorts);
-
/**
* Request a passive port
*/
int requestPassivePort();
-
+
/**
* Release passive port.
*/
void releasePassivePort(int port);
-
+
/**
* Get SSL configuration for this data connection.
*/
Modified: mina/ftpserver/trunk/core/src/main/java/org/apache/ftpserver/interfaces/FileObserver.java
URL: http://svn.apache.org/viewvc/mina/ftpserver/trunk/core/src/main/java/org/apache/ftpserver/interfaces/FileObserver.java?rev=686637&r1=686636&r2=686637&view=diff
==============================================================================
--- mina/ftpserver/trunk/core/src/main/java/org/apache/ftpserver/interfaces/FileObserver.java (original)
+++ mina/ftpserver/trunk/core/src/main/java/org/apache/ftpserver/interfaces/FileObserver.java Sun Aug 17 12:52:42 2008
@@ -15,7 +15,7 @@
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
- */
+ */
package org.apache.ftpserver.interfaces;
@@ -23,33 +23,35 @@
/**
* This is the file related activity observer.
+ *
+ * @author The Apache MINA Project (dev@mina.apache.org)
+ * @version $Rev$, $Date$
*/
-public
-interface FileObserver {
+public interface FileObserver {
/**
* User file upload notification.
*/
void notifyUpload(FtpIoSession session, FileObject file, long size);
-
+
/**
* User file download notification.
*/
void notifyDownload(FtpIoSession session, FileObject file, long size);
-
+
/**
* User file delete notification.
*/
void notifyDelete(FtpIoSession session, FileObject file);
-
+
/**
* User make directory notification.
*/
void notifyMkdir(FtpIoSession session, FileObject file);
-
+
/**
* User remove directory notification.
*/
void notifyRmdir(FtpIoSession session, FileObject file);
-
+
}