1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21 package goldengate.ftp.exec;
22
23 import goldengate.common.file.filesystembased.FilesystemBasedDirImpl;
24 import goldengate.common.file.filesystembased.FilesystemBasedFileParameterImpl;
25 import goldengate.common.file.filesystembased.specific.FilesystemBasedDirJdk5;
26 import goldengate.common.file.filesystembased.specific.FilesystemBasedDirJdk6;
27 import goldengate.common.logging.GgInternalLogger;
28 import goldengate.common.logging.GgInternalLoggerFactory;
29 import goldengate.common.logging.GgSlf4JLoggerFactory;
30 import goldengate.ftp.core.config.FtpConfiguration;
31 import goldengate.ftp.core.exception.FtpNoConnectionException;
32 import goldengate.ftp.exec.config.FileBasedConfiguration;
33 import goldengate.ftp.exec.control.ExecBusinessHandler;
34 import goldengate.ftp.exec.data.FileSystemBasedDataBusinessHandler;
35 import goldengate.ftp.exec.exec.AbstractExecutor;
36
37 import openr66.protocol.configuration.Configuration;
38
39 import org.jboss.netty.logging.InternalLoggerFactory;
40
41
42
43
44
45
46
47
48 public class ExecGatewayFtpServer {
49
50
51
52 private static GgInternalLogger logger = null;
53
54
55
56
57
58
59 public static void main(String[] args) {
60 if (args.length < 1) {
61 System.err.println("Usage: " +
62 ExecGatewayFtpServer.class.getName() + " <config-file> [<r66config-file>]");
63 return;
64 }
65 InternalLoggerFactory.setDefaultFactory(new GgSlf4JLoggerFactory(null));
66 logger = GgInternalLoggerFactory
67 .getLogger(ExecGatewayFtpServer.class);
68 String config = args[0];
69 FileBasedConfiguration configuration = new FileBasedConfiguration(
70 ExecGatewayFtpServer.class, ExecBusinessHandler.class,
71 FileSystemBasedDataBusinessHandler.class,
72 new FilesystemBasedFileParameterImpl());
73 if (!configuration.setConfigurationServerFromXml(config)) {
74 System.err.println("Bad main configuration");
75 return;
76 }
77 Configuration.configuration.useLocalExec = configuration.useLocalExec;
78
79 if (FtpConfiguration.USEJDK6) {
80 FilesystemBasedDirImpl.initJdkDependent(new FilesystemBasedDirJdk6());
81 } else {
82 FilesystemBasedDirImpl.initJdkDependent(new FilesystemBasedDirJdk5());
83 }
84 if (AbstractExecutor.useDatabase) {
85
86 if (args.length > 1) {
87 if (! openr66.configuration.FileBasedConfiguration.setSubmitClientConfigurationFromXml(Configuration.configuration,
88 args[1])) {
89
90 System.err.println("Bad R66 configuration");
91 return;
92 }
93 } else {
94
95 System.err.println("No R66PrepareTransfer configuration file");
96 }
97 }
98 FileBasedConfiguration.fileBasedConfiguration = configuration;
99
100 configuration.configureLExec();
101 configuration.serverStartup();
102 configuration.configureHttps();
103 configuration.configureConstraint();
104 try {
105 configuration.configureSnmp();
106 } catch (FtpNoConnectionException e) {
107 System.err.println("Cannot start SNMP support: "+e.getMessage());
108 }
109 logger.warn("FTP started");
110 }
111
112 }