summaryrefslogtreecommitdiffstats
path: root/src/main/java/org/openslx/imagemaster/ftp/MasterFtplet.java
blob: 5e12628e7246cbfa6df4700bc8ecb903ed60755e (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
package org.openslx.imagemaster.ftp;

import java.io.IOException;

import org.apache.ftpserver.ftplet.FtpException;
import org.apache.ftpserver.ftplet.FtpReply;
import org.apache.ftpserver.ftplet.FtpRequest;
import org.apache.ftpserver.ftplet.FtpSession;
import org.apache.ftpserver.ftplet.Ftplet;
import org.apache.ftpserver.ftplet.FtpletContext;
import org.apache.ftpserver.ftplet.FtpletResult;
import org.apache.log4j.Logger;

public class MasterFtplet implements Ftplet
{
	private static Logger log = Logger.getLogger( Ftplet.class );

	@Override
	public void init( FtpletContext ftpletContext ) throws FtpException
	{
		// not used
	}

	@Override
	public void destroy()
	{
		// not used
	}

	@Override
	public FtpletResult beforeCommand( FtpSession session, FtpRequest request )
			throws FtpException, IOException
	{
		if ( session.getUser() != null ) {
			log.info( session.getUser().getName() + " issued command: " + request.getRequestLine() );
		}
		return null;
	}

	@Override
	public FtpletResult afterCommand( FtpSession session, FtpRequest request,
			FtpReply reply ) throws FtpException, IOException
	{
		// not used
		return null;
	}

	@Override
	public FtpletResult onConnect( FtpSession session ) throws FtpException,
			IOException
	{
		if (session.getUser() != null) {
			log.info( session.getUser().getName() + " connected" );
		}
		return null;
	}

	@Override
	public FtpletResult onDisconnect( FtpSession session ) throws FtpException,
			IOException
	{
		// not used
		return null;
	}

}