01: /**
02: * LibreSource
03: * Copyright (C) 2004-2008 Artenum SARL / INRIA
04: * http://www.libresource.org - contact@artenum.com
05: *
06: * This file is part of the LibreSource software,
07: * which can be used and distributed under license conditions.
08: * The license conditions are provided in the LICENSE.TXT file
09: * at the root path of the packaging that enclose this file.
10: * More information can be found at
11: * - http://dev.libresource.org/home/license
12: *
13: * Initial authors :
14: *
15: * Guillaume Bort / INRIA
16: * Francois Charoy / Universite Nancy 2
17: * Julien Forest / Artenum
18: * Claude Godart / Universite Henry Poincare
19: * Florent Jouille / INRIA
20: * Sebastien Jourdain / INRIA / Artenum
21: * Yves Lerumeur / Artenum
22: * Pascal Molli / Universite Henry Poincare
23: * Gerald Oster / INRIA
24: * Mariarosa Penzi / Artenum
25: * Gerard Sookahet / Artenum
26: * Raphael Tani / INRIA
27: *
28: * Contributors :
29: *
30: * Stephane Bagnier / Artenum
31: * Amadou Dia / Artenum-IUP Blois
32: * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
33: */package org.libresource.so6.adapter.ls.exec.ui;
34:
35: import org.libresource.so6.adapter.ls.tools.LsClassicPropertiesEditor;
36: import org.libresource.so6.core.client.ClientI;
37: import org.libresource.so6.core.exec.UpdateWsConnection;
38:
39: import java.io.IOException;
40:
41: import java.util.Hashtable;
42:
43: import javax.swing.JOptionPane;
44:
45: /**
46: * @author smack
47: */
48: public class UpdateLibresourceReplica extends LsClassicPropertiesEditor {
49: private String basePath;
50: private String login;
51: private String password;
52: private String synchronizerUri;
53: private String wsName;
54:
55: public UpdateLibresourceReplica(String wscPath, String clientName)
56: throws IOException {
57: super ("Update Workspace internal informations");
58:
59: addTextPropertie("login", "Login :", "");
60: addPasswordPropertie("password", "Password :", "");
61:
62: Hashtable props = editProperties();
63:
64: if (props != null) {
65: try {
66: System.getProperties().setProperty(ClientI.SO6_LOGIN,
67: (String) props.get("login"));
68: System.getProperties().setProperty(
69: ClientI.SO6_PASSWORD,
70: (String) props.get("password"));
71: new UpdateWsConnection(wscPath, clientName).execute();
72: } catch (Exception e) {
73: e.printStackTrace();
74: JOptionPane.showMessageDialog(null,
75: "<html><b>Error while trying to update the replica</b><br>"
76: + e.getMessage() + "</html>");
77: System.exit(0);
78: }
79: } else {
80: System.exit(0);
81: }
82: }
83:
84: public static void main(String[] args) throws Exception {
85: if (args.length != 2) {
86: System.err.println("Usage: wscPath clientName");
87: System.err
88: .println(" (1) wscPath: file path of the workspace");
89: System.err
90: .println(" (2) clientName: name of the class that should be used for client");
91: } else {
92: new UpdateLibresourceReplica(args[0], args[1]);
93: JOptionPane.showMessageDialog(null,
94: "Your local replica has been updated.");
95: System.exit(0);
96: }
97: }
98: }
|