1
1
/**
2
2
* Copyright (C) 2000 - 2009 Silverpeas
3
3
*
4
- * This program is free software: you can redistribute it and/or modify
5
- * it under the terms of the GNU Affero General Public License as
6
- * published by the Free Software Foundation, either version 3 of the
7
- * License, or (at your option) any later version.
4
+ * This program is free software: you can redistribute it and/or modify it under the terms of the
5
+ * GNU Affero General Public License as published by the Free Software Foundation, either version 3
6
+ * of the License, or (at your option) any later version.
8
7
*
9
- * As a special exception to the terms and conditions of version 3.0 of
10
- * the GPL, you may redistribute this Program in connection with Free/Libre
11
- * Open Source Software ("FLOSS") applications as described in Silverpeas's
12
- * FLOSS exception. You should have received a copy of the text describing
13
- * the FLOSS exception, and it is also available here:
8
+ * As a special exception to the terms and conditions of version 3.0 of the GPL, you may
9
+ * redistribute this Program in connection with Free/Libre Open Source Software ("FLOSS")
10
+ * applications as described in Silverpeas's FLOSS exception. You should have received a copy of the
11
+ * text describing the FLOSS exception, and it is also available here:
14
12
* "http://repository.silverpeas.com/legal/licensing"
15
13
*
16
- * This program is distributed in the hope that it will be useful,
17
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
18
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19
- * GNU Affero General Public License for more details.
14
+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without
15
+ * even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16
+ * Affero General Public License for more details.
20
17
*
21
- * You should have received a copy of the GNU Affero General Public License
22
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
18
+ * You should have received a copy of the GNU Affero General Public License along with this program.
19
+ * If not, see <http://www.gnu.org/licenses/>.
23
20
*/
24
-
25
21
package org .silverpeas .openoffice ;
26
22
27
23
import org .silverpeas .openoffice .util .MessageDisplayer ;
@@ -48,36 +44,36 @@ public class Launcher {
48
44
static final String LAUNCHER_VERSION = "2.12" ;
49
45
static final MimetypesFileTypeMap mimeTypes = new MimetypesFileTypeMap ();
50
46
static final Logger logger = Logger .getLogger (Launcher .class .getName ());
51
-
47
+
52
48
/**
53
49
* @param args the command line arguments
54
- * @throws OfficeNotFoundException
50
+ * @throws OfficeNotFoundException
55
51
*/
56
52
public static void main (final String [] args ) throws OfficeNotFoundException {
57
- logger .log (Level .INFO , "{0} version {1}" , new Object [] { MessageUtil .getMessage ("app.title" ),
58
- LAUNCHER_VERSION });
59
- logger .log (Level .INFO , "{0}{1}" , new Object [] { MessageUtil .getMessage ("info.url.encoded" ),
60
- args [0 ] });
53
+ logger .log (Level .INFO , "{0} version {1}" , new Object []{ MessageUtil .getMessage ("app.title" ),
54
+ LAUNCHER_VERSION });
55
+ logger .log (Level .INFO , "{0}{1}" , new Object []{ MessageUtil .getMessage ("info.url.encoded" ),
56
+ args [0 ]});
61
57
try {
62
58
String url = UrlExtractor .extractUrl (args [0 ]);
63
- logger .log (Level .INFO , "{0}{1}" , new Object [] { MessageUtil .getMessage ("info.url.decoded" ),
64
- url });
59
+ logger .log (Level .INFO , "{0}{1}" , new Object []{ MessageUtil .getMessage ("info.url.decoded" ),
60
+ url });
65
61
if (args [1 ] != null && !"" .equals (args [1 ].trim ())) {
66
- logger .log (Level .INFO , "{0} {1}" , new Object [] {
67
- MessageUtil .getMessage ("info.default.path" ), UrlExtractor .decodePath (args [1 ]) });
62
+ logger .log (Level .INFO , "{0} {1}" , new Object []{
63
+ MessageUtil .getMessage ("info.default.path" ), UrlExtractor .decodePath (args [1 ])});
68
64
MsOfficePathFinder .basePath = UrlExtractor .decodePath (args [1 ]);
69
65
}
66
+ boolean useDeconnectedMode = false ;
67
+ if (args .length >= 3 ) {
68
+ useDeconnectedMode = getBooleanValue (args [2 ]);
69
+ }
70
70
AuthenticationInfo authInfo = null ;
71
- if (args .length >= 4 ) {
72
- authInfo = PasswordManager .extractAuthenticationInfo (args [2 ], args [3 ]);
71
+ if (args .length >= 5 ) {
72
+ authInfo = PasswordManager .extractAuthenticationInfo (args [3 ], args [4 ]);
73
73
}
74
- boolean useDeconnectedMode = false ;
75
- if (args .length >= 5 ) {
76
- useDeconnectedMode = getBooleanValue (args [4 ]);
77
- }
78
74
MsOfficeType contentType = getContentType (UrlExtractor .decodeUrl (args [0 ]));
79
- logger .log (Level .FINE , "{0}{1}" , new Object [] { MessageUtil .getMessage ("info.document.type" ),
80
- contentType });
75
+ logger .log (Level .FINE , "{0}{1}" , new Object []{ MessageUtil .getMessage ("info.document.type" ),
76
+ contentType });
81
77
defineLookAndFeel ();
82
78
System .exit (OfficeLauncher .launch (contentType , url , authInfo , useDeconnectedMode ));
83
79
} catch (IOException ex ) {
@@ -95,11 +91,11 @@ public static void main(final String[] args) throws OfficeNotFoundException {
95
91
System .exit (0 );
96
92
}
97
93
}
98
-
94
+
99
95
protected static boolean getBooleanValue (final String expression ) {
100
96
return "true" .equalsIgnoreCase (expression ) || "yes" .equalsIgnoreCase (expression )
101
- || "y" .equalsIgnoreCase (expression ) || "oui" .equalsIgnoreCase (expression )
102
- || "1" .equalsIgnoreCase (expression );
97
+ || "y" .equalsIgnoreCase (expression ) || "oui" .equalsIgnoreCase (expression )
98
+ || "1" .equalsIgnoreCase (expression );
103
99
}
104
100
105
101
protected static void defineLookAndFeel () {
0 commit comments