View Javadoc

1   /**
2    * Copyright 2008 WebPhotos
3    *
4    * Licensed under the Apache License, Version 2.0 (the "License");
5    * you may not use this file except in compliance with the License.
6    * You may obtain a copy of the License at
7    *
8    *      http://www.apache.org/licenses/LICENSE-2.0
9    *
10   * Unless required by applicable law or agreed to in writing, software
11   * distributed under the License is distributed on an "AS IS" BASIS,
12   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   * See the License for the specific language governing permissions and
14   * limitations under the License.
15   */
16  package net.sf.webphotos;
17  
18  import java.io.PrintWriter;
19  import java.net.InetAddress;
20  import net.sf.webphotos.gui.util.FtpClient;
21  import net.sf.webphotos.util.Util;
22  import org.apache.derby.drda.NetworkServerControl;
23  
24  /**
25   *
26   * @author Guilherme
27   */
28  public class FtpClientTest {
29  
30      /**
31       * Execução separada do sistema. Serve, principalmente, para sincronizar as
32       * pastas entre o servidor e o cliente. Obtém o driver do db e url,
33       * configura esses valores para o banco de imagens e mostra a tela de login.
34       * Depois inicia uma thread de FtpClient.
35       *
36       * @param args args do método main.
37       */
38      public static void main(String[] args) {
39          try {
40              Util.loadSocksProxy();
41  
42              /**
43               * FIXEME: change this code to derby.drda.startNetworkServer=true
44               */
45              NetworkServerControl server = new NetworkServerControl(InetAddress.getByName(Util.getConfig().getString("derby.drda.host")), Util.getConfig().getInt("derby.drda.portNumber"));
46              server.start(new PrintWriter(Util.out));
47              server.setMaxThreads(100);
48              
49              BancoImagem.loadUIManager();
50              BancoImagem.loadDBDriver();
51              BancoImagem.login();
52              Thread cl = new Thread(new FtpClient());
53              cl.start();
54          } catch (Exception ex) {
55              Util.err.println(ex);
56          }
57      }
58  }