Revision 45098
trunk/org.gvsig.desktop/org.gvsig.desktop.framework/org.gvsig.andami/src/main/resources-application/gvSIG.sh | ||
---|---|---|
38 | 38 |
#set -x |
39 | 39 |
set -e |
40 | 40 |
|
41 |
ARGS="$@" # Can't use ${@/ , use ${ARGS/ instead |
|
42 |
|
|
41 | 43 |
#if [ "$BASH_VERSION" = "" ] ; then |
42 | 44 |
# echo "gvSIG.sh is not running with a bash shell" |
43 | 45 |
# if type bash 2>/dev/null ; then |
... | ... | |
329 | 331 |
LOGGER_FILE="$GVSIG_HOME_FOLDER/${GVSIG_APPLICATION_NAME}-launcher.log" |
330 | 332 |
echo > "$LOGGER_FILE" |
331 | 333 |
|
334 |
CONSOLELOGGER=true |
|
335 |
if [ "${ARGS/*--consolelogger=false*/--consolelogger=false}" == "--consolelogger=false" ] ; then |
|
336 |
CONSOLELOGGER=false |
|
337 |
fi |
|
332 | 338 |
|
333 | 339 |
logger () { |
334 | 340 |
# level (INFO/WARNIG) message |
335 | 341 |
LOGGER_LEVEL="$1" |
336 | 342 |
shift |
337 |
echo "$LOGGER_LEVEL launch $@" |
|
343 |
if [ "$CONSOLELOGGER" == "true" ] ; then |
|
344 |
echo "$LOGGER_LEVEL launch $@" |
|
345 |
fi |
|
338 | 346 |
echo "$LOGGER_LEVEL launch $@" >> "$LOGGER_FILE" |
339 | 347 |
} |
340 | 348 |
|
... | ... | |
348 | 356 |
|
349 | 357 |
logger_cmd() { |
350 | 358 |
logger_info "$@" |
351 |
eval $@ 2>&1 | tee -a "$LOGGER_FILE" |
|
359 |
if [ "$CONSOLELOGGER" == "true" ] ; then |
|
360 |
eval $@ 2>&1 | tee -a "$LOGGER_FILE" |
|
361 |
else |
|
362 |
eval $@ 2>&1 > "$LOGGER_FILE" |
|
363 |
fi |
|
352 | 364 |
} |
353 | 365 |
|
354 | 366 |
logger_info "gvSIG Installation folder: $GVSIG_INSTALL_FOLDER" |
... | ... | |
614 | 626 |
# Java debug mode ? # |
615 | 627 |
##################### |
616 | 628 |
|
617 |
ARGS="$@" # Can't use ${@/ , use ${ARGS/ instead |
|
618 | 629 |
if [ "${ARGS/*--pause*/--pause}" == "--pause" ] ; then |
619 | 630 |
DEBUG_PAUSE="y" |
620 | 631 |
else |
trunk/org.gvsig.desktop/org.gvsig.desktop.framework/org.gvsig.andami/src/main/java/org/gvsig/andami/Launcher.java | ||
---|---|---|
447 | 447 |
public static Arguments getArguments() { |
448 | 448 |
return arguments; |
449 | 449 |
} |
450 |
|
|
450 |
|
|
451 | 451 |
public void doMain(String[] args) throws Exception { |
452 | 452 |
|
453 | 453 |
if (args.length < 1) { |
... | ... | |
596 | 596 |
SwingUtilities.invokeAndWait(new Runnable() { |
597 | 597 |
public void run() { |
598 | 598 |
frame.init(); |
599 |
frame.setVisible((boolean) arguments.get("showgui", true)); |
|
599 | 600 |
} |
600 | 601 |
}); |
601 | 602 |
ToolsSwingLocator.registerWindowManager(ToolsWindowManager.class); |
... | ... | |
697 | 698 |
if (launcherrors != null) { |
698 | 699 |
NotificationManager.addError(launcherrors); |
699 | 700 |
} |
700 |
org.apache.log4j.Logger.getRootLogger().addAppender( |
|
701 |
new NotificationAppender()); |
|
701 |
if( !arguments.contains("showgui", "false") ) { |
|
702 |
org.apache.log4j.Logger.getRootLogger().addAppender( |
|
703 |
new NotificationAppender()); |
|
704 |
} |
|
702 | 705 |
|
703 | 706 |
/* |
704 | 707 |
* Executes additional tasks required by plugins |
... | ... | |
889 | 892 |
RollingFileAppender fa = new RollingFileAppender(l, pathname, false); |
890 | 893 |
fa.setMaxFileSize("512KB"); |
891 | 894 |
fa.setMaxBackupIndex(3); |
892 |
org.apache.log4j.Logger.getRootLogger().addAppender(fa); |
|
895 |
|
|
896 |
org.apache.log4j.Logger rootLogger = org.apache.log4j.Logger.getRootLogger(); |
|
897 |
if( !(boolean) arguments.get("consolelogger", true) ) { |
|
898 |
rootLogger.removeAppender("stdout"); |
|
899 |
} |
|
900 |
rootLogger.addAppender(fa); |
|
901 |
|
|
893 | 902 |
logger.info("Loadded log4j.properties from " + config.toString()); |
894 | 903 |
if (StringUtils.isBlank(applicationClasifier)) { |
895 | 904 |
logger.info("Application " + appName); |
... | ... | |
2671 | 2680 |
terminationProcess.run(); |
2672 | 2681 |
} |
2673 | 2682 |
|
2683 |
public synchronized static void closeApplication(boolean quietly) { |
|
2684 |
TerminationProcess terminationProcess = (new Launcher()).new TerminationProcess(); |
|
2685 |
if( quietly ) { |
|
2686 |
terminationProcess.closeAndami(); |
|
2687 |
} else { |
|
2688 |
terminationProcess.run(); |
|
2689 |
} |
|
2690 |
} |
|
2691 |
|
|
2674 | 2692 |
static HashMap getClassesExtensions() { |
2675 | 2693 |
return classesExtensions; |
2676 | 2694 |
} |
trunk/org.gvsig.desktop/org.gvsig.desktop.framework/org.gvsig.andami/src/main/java/org/gvsig/andami/PluginServices.java | ||
---|---|---|
45 | 45 |
import javax.swing.KeyStroke; |
46 | 46 |
import javax.swing.SwingUtilities; |
47 | 47 |
import javax.swing.Timer; |
48 |
import org.apache.commons.lang3.StringUtils; |
|
48 | 49 |
|
49 | 50 |
import org.gvsig.andami.messages.NotificationManager; |
50 | 51 |
import org.gvsig.andami.plugins.ExclusiveUIExtension; |
... | ... | |
567 | 568 |
* @deprecated use PluginManager.getArguments |
568 | 569 |
*/ |
569 | 570 |
public static String getArgumentByName(String name) { |
571 |
name = StringUtils.removeStart(name, "-"); |
|
572 |
name = StringUtils.removeStart(name, "-"); |
|
570 | 573 |
for (int i = 2; i < PluginServices.arguments.length; i++) { |
571 |
String arg = PluginServices.arguments[i]; |
|
572 |
if( arg != null ) { |
|
573 |
int index = arg.indexOf(name + "="); |
|
574 |
if (index != -1) |
|
575 |
return arg.substring(index |
|
576 |
+ name.length() + 1); |
|
577 |
} |
|
574 |
String arg = PluginServices.arguments[i]; |
|
575 |
arg = StringUtils.removeStart(arg, "-"); |
|
576 |
arg = StringUtils.removeStart(arg, "-"); |
|
577 |
int n = arg.indexOf('='); |
|
578 |
if (n > 0) { |
|
579 |
String argname = arg.substring(0, n); |
|
580 |
if (StringUtils.equalsIgnoreCase(argname, name)) { |
|
581 |
if (n == arg.length()) { |
|
582 |
return ""; |
|
583 |
} |
|
584 |
return arg.substring(n + 1); |
|
585 |
} |
|
586 |
} else { |
|
587 |
if (StringUtils.equalsIgnoreCase(arg, name)) { |
|
588 |
return "true"; |
|
589 |
} |
|
590 |
} |
|
578 | 591 |
} |
579 | 592 |
return null; |
580 | 593 |
} |
trunk/org.gvsig.desktop/org.gvsig.desktop.framework/org.gvsig.andami/src/main/java/org/gvsig/andami/Arguments.java | ||
---|---|---|
8 | 8 |
|
9 | 9 |
public String get(String name); |
10 | 10 |
|
11 |
public Object get(String name, Object defaultValue); |
|
12 |
|
|
11 | 13 |
public boolean contains(String name); |
14 |
|
|
15 |
public boolean contains(String name, String value); |
|
12 | 16 |
|
13 | 17 |
public Map<String,String> flags(); |
14 | 18 |
|
trunk/org.gvsig.desktop/org.gvsig.desktop.framework/org.gvsig.andami/src/main/java/org/gvsig/andami/impl/DefaultArguments.java | ||
---|---|---|
1 | 1 |
package org.gvsig.andami.impl; |
2 | 2 |
|
3 |
import java.time.LocalDate; |
|
3 | 4 |
import java.util.ArrayList; |
4 | 5 |
import java.util.Collections; |
6 |
import java.util.Date; |
|
5 | 7 |
import java.util.HashMap; |
6 | 8 |
import java.util.Iterator; |
7 | 9 |
import java.util.List; |
8 | 10 |
import java.util.Map; |
11 |
import org.apache.commons.lang3.BooleanUtils; |
|
12 |
import org.apache.commons.lang3.StringUtils; |
|
9 | 13 |
import org.gvsig.andami.Arguments; |
14 |
import org.gvsig.tools.dataTypes.DataTypeUtils; |
|
10 | 15 |
|
11 | 16 |
public class DefaultArguments implements Arguments { |
12 | 17 |
|
... | ... | |
56 | 61 |
} |
57 | 62 |
|
58 | 63 |
@Override |
64 |
public Object get(String name, Object defaultValue) { |
|
65 |
String value = this.get(name); |
|
66 |
if( defaultValue == null ) { |
|
67 |
return value; |
|
68 |
} |
|
69 |
if( StringUtils.isBlank(value) ) { |
|
70 |
return defaultValue; |
|
71 |
} |
|
72 |
if( defaultValue instanceof CharSequence ) { |
|
73 |
return value; |
|
74 |
} |
|
75 |
if( defaultValue instanceof Integer ) { |
|
76 |
return DataTypeUtils.toInteger(value, (Integer) defaultValue); |
|
77 |
} |
|
78 |
if( defaultValue instanceof Long ) { |
|
79 |
return DataTypeUtils.toLong(value, (Long) defaultValue); |
|
80 |
} |
|
81 |
if( defaultValue instanceof Boolean ) { |
|
82 |
try { |
|
83 |
return DataTypeUtils.toBoolean(value, (Boolean) defaultValue); |
|
84 |
} catch(Throwable th) { |
|
85 |
return BooleanUtils.toBoolean(value); |
|
86 |
} |
|
87 |
} |
|
88 |
if( defaultValue instanceof Double ) { |
|
89 |
return DataTypeUtils.toDouble(value, (Double) defaultValue); |
|
90 |
} |
|
91 |
if( defaultValue instanceof Float ) { |
|
92 |
return DataTypeUtils.toDouble(value, (Float) defaultValue); |
|
93 |
} |
|
94 |
if( defaultValue instanceof Date ) { |
|
95 |
return DataTypeUtils.toDate(value, (Date) defaultValue); |
|
96 |
} |
|
97 |
return value; |
|
98 |
} |
|
99 |
|
|
100 |
@Override |
|
59 | 101 |
public boolean contains(String name) { |
60 | 102 |
return this.flags.containsKey(name); |
61 | 103 |
} |
62 | 104 |
|
63 | 105 |
@Override |
106 |
public boolean contains(String name, String value) { |
|
107 |
String x = this.flags.get(name); |
|
108 |
if( x==null ) { |
|
109 |
return false; |
|
110 |
} |
|
111 |
return StringUtils.equalsIgnoreCase(value, x); |
|
112 |
} |
|
113 |
|
|
114 |
@Override |
|
64 | 115 |
public List<String> parameters() { |
65 | 116 |
return Collections.unmodifiableList(parameters); |
66 | 117 |
} |
trunk/org.gvsig.desktop/org.gvsig.desktop.framework/org.gvsig.andami/src/main/java/org/gvsig/andami/ui/splash/MultiSplashWindow.java | ||
---|---|---|
46 | 46 |
import javax.swing.JWindow; |
47 | 47 |
import javax.swing.SwingUtilities; |
48 | 48 |
import javax.swing.Timer; |
49 |
import org.gvsig.andami.Launcher; |
|
49 | 50 |
|
50 | 51 |
import org.gvsig.andami.PluginServices; |
51 | 52 |
import org.gvsig.andami.messages.Messages; |
... | ... | |
81 | 82 |
private int[] fontSizes=null; |
82 | 83 |
private Color fontcolor=new Color(80,170,240); |
83 | 84 |
private Color[] fontColors=null; |
85 |
private final boolean showsplash; |
|
84 | 86 |
|
85 | 87 |
public MultiSplashWindow(Frame f, Theme theme, int progressBarStepCount) { |
86 | 88 |
super(f); |
89 |
this.showsplash = (boolean) Launcher.getArguments().get("splash",true); |
|
87 | 90 |
this.theme = theme; |
88 | 91 |
this.timers = theme.getTimers(); |
89 | 92 |
lblStatus = new JLabel(Messages.getString("SplashWindow.Iniciando")); |
... | ... | |
102 | 105 |
setLocation((screenSize.width / 2) - (splashDimension.width / 2), |
103 | 106 |
(screenSize.height / 2) - (splashDimension.height / 2)); |
104 | 107 |
index = 0; |
105 |
setVisible(true);
|
|
108 |
setVisible(this.showsplash);
|
|
106 | 109 |
this.addMouseListener(this); |
107 | 110 |
} |
108 | 111 |
|
trunk/org.gvsig.desktop/org.gvsig.desktop.plugin/org.gvsig.app/org.gvsig.app.mainplugin/src/main/java/org/gvsig/app/ApplicationManager.java | ||
---|---|---|
31 | 31 |
|
32 | 32 |
import org.cresques.cts.IProjection; |
33 | 33 |
import org.gvsig.about.AboutManager; |
34 |
import org.gvsig.andami.Arguments; |
|
34 | 35 |
import org.gvsig.andami.actioninfo.ActionInfo; |
35 | 36 |
import org.gvsig.andami.ui.mdiFrame.MainFrame; |
36 | 37 |
import org.gvsig.andami.ui.mdiFrame.ThreadSafeDialogs; |
... | ... | |
74 | 75 |
* |
75 | 76 |
* @return the version |
76 | 77 |
*/ |
77 |
public Version getVersion() ;
|
|
78 |
public Version getVersion() ;
|
|
78 | 79 |
|
79 | 80 |
/** |
81 |
* Close the application. |
|
82 |
* |
|
83 |
* @param quietly |
|
84 |
*/ |
|
85 |
public void close(boolean quietly); |
|
86 |
|
|
87 |
/** |
|
80 | 88 |
* Return the active window, IWindow, in the application. |
81 | 89 |
* |
82 | 90 |
* @return the active window |
... | ... | |
157 | 165 |
/** |
158 | 166 |
* Return the arguments passed to the application in the command line |
159 | 167 |
* |
160 |
* @return arguments as a string array
|
|
168 |
* @return arguments |
|
161 | 169 |
*/ |
162 |
public String[] getArguments();
|
|
170 |
public Arguments getArguments();
|
|
163 | 171 |
|
164 | 172 |
/** |
165 |
* Return the value of the argument passed in the command line by |
|
166 |
* the name indicated as the parameter. This is passed as: |
|
167 |
* <code> |
|
168 |
* application --name=value |
|
169 |
* </code> |
|
170 |
* @param name of the requested argument |
|
171 |
* @return value of the requested argument |
|
172 |
*/ |
|
173 |
public String getArgument(String name); |
|
174 |
|
|
175 |
/** |
|
176 | 173 |
* Get the value of the system clipboard as a string. |
177 | 174 |
* |
178 | 175 |
* @return the clipboard value |
trunk/org.gvsig.desktop/org.gvsig.desktop.plugin/org.gvsig.app/org.gvsig.app.mainplugin/src/main/java/org/gvsig/app/imp/DefaultApplicationManager.java | ||
---|---|---|
41 | 41 |
import org.cresques.cts.IProjection; |
42 | 42 |
import org.gvsig.about.AboutLocator; |
43 | 43 |
import org.gvsig.about.AboutManager; |
44 |
import org.gvsig.andami.Arguments; |
|
44 | 45 |
import org.gvsig.andami.Launcher; |
45 | 46 |
import org.gvsig.andami.PluginServices; |
46 | 47 |
import org.gvsig.andami.actioninfo.ActionInfo; |
... | ... | |
340 | 341 |
return ToolsSwingLocator.getIconThemeManager(); |
341 | 342 |
} |
342 | 343 |
|
343 |
public String getArgument(String name) { |
|
344 |
return PluginServices.getArgumentByName(name); |
|
344 |
@Override |
|
345 |
public Arguments getArguments() { |
|
346 |
return Launcher.getArguments(); |
|
345 | 347 |
} |
346 | 348 |
|
347 |
public String[] getArguments() { |
|
348 |
return PluginServices.getArguments(); |
|
349 |
} |
|
350 |
|
|
351 | 349 |
@Override |
352 | 350 |
public String getFromClipboard() { |
353 | 351 |
return PluginServices.getFromClipboard(); |
... | ... | |
376 | 374 |
public Version getVersion() { |
377 | 375 |
return version; |
378 | 376 |
} |
379 |
|
|
377 |
|
|
378 |
@Override |
|
379 |
public void close(boolean quietly) { |
|
380 |
Launcher.closeApplication(quietly); |
|
381 |
} |
|
382 |
|
|
380 | 383 |
public AboutManager getAbout() { |
381 | 384 |
AboutManager manager = AboutLocator.getManager(); |
382 | 385 |
return manager; |
Also available in: Unified diff