733b6f39efabfc34353f4d2fdacce49a7aa26ce6
[jpim.git] / src / de / j32 / pimstuff / Main.java
1 package de.j32.pimstuff;
2
3 import java.io.IOException;
4
5 import de.j32.pimstuff.conduit.Conduit;
6 import de.j32.pimstuff.conduit.ConduitException;
7 import de.j32.pimstuff.conduit.Exporter;
8 import de.j32.pimstuff.conduit.Importer;
9 import de.j32.pimstuff.conduit.Registry;
10 import de.j32.pimstuff.data.Addressbook;
11 import de.j32.util.Util;
12
13 public class Main
14 {
15
16     public static void main(String[] args)
17     {
18         try {
19             Addressbook ab = new Addressbook();
20             Conduit conduit = Registry.get("fritzbox");
21
22             Importer i = null;
23             try {
24                 i = conduit.importer();
25                 i.sendTo(ab);
26                 i.close();
27                 i = null;
28             }
29             finally {
30                 Util.nothrowClose(i);
31             }
32
33             Exporter e = null;
34             try {
35                 e = conduit.exporter();
36                 ab.sendTo(e);
37                 e.close();
38                 e = null;
39             }
40             finally {
41                 Util.nothrowClose(e);
42             }
43         }
44         catch (ConduitException e) {
45             e.printStackTrace();
46         }
47         catch (IOException e) {
48             e.printStackTrace();
49         }
50     }
51 }