Revision 41916 trunk/org.gvsig.desktop/org.gvsig.desktop.framework/org.gvsig.andami/src/main/java/org/gvsig/andami/Launcher.java
Launcher.java | ||
---|---|---|
535 | 535 |
splashWindow.process(translate("SplashWindow.load_plugins_configuration")); |
536 | 536 |
try { |
537 | 537 |
logger.info("Load plugins information"); |
538 |
this.loadPlugins(); |
|
538 |
this.loadPluginConfigs(); |
|
539 |
if ( pluginsConfig.isEmpty() ) { |
|
540 |
logger.warn("No valid plugin was found."); |
|
541 |
System.exit(-1); |
|
542 |
} |
|
539 | 543 |
} catch (Throwable ex) { |
540 | 544 |
this.addError("Can't load plugins", ex); |
541 | 545 |
} |
... | ... | |
547 | 551 |
// Se configura el classloader del plugin |
548 | 552 |
splashWindow.process(translate("SplashWindow.setup_plugins_configuration")); |
549 | 553 |
try { |
550 |
logger.info("Configure plugins class loader");
|
|
551 |
this.pluginsClassLoaders();
|
|
554 |
logger.info("Configure plugins class loader");
|
|
555 |
this.loadPluginServices();
|
|
552 | 556 |
} catch (Throwable ex) { |
553 |
this.addError("Can't initialize plugin's classloaders ", ex);
|
|
557 |
logger.warn("Can't initialize plugin's classloaders ", ex);
|
|
554 | 558 |
} |
559 |
try { |
|
560 |
registerActions(); |
|
561 |
} catch (Throwable ex) { |
|
562 |
logger.warn("Can't register actions of plugins", ex); |
|
563 |
} |
|
555 | 564 |
|
556 | 565 |
initializeIdentityManagement(new File(andamiConfig.getPluginsDirectory()).getAbsoluteFile()); |
557 | 566 |
|
... | ... | |
838 | 847 |
*/ |
839 | 848 |
private void loadAndamiConfig(String pluginFolder) |
840 | 849 |
throws ConfigurationException { |
841 |
// Leer el fichero de configuraci�n de andami (andami-config.xsd) |
|
842 |
// locale |
|
843 |
// Buscar actualizaci�nes al comenzar |
|
844 |
// Andami |
|
845 |
// Plugins |
|
846 |
// Directorio de las extensiones |
|
847 | 850 |
andamiConfigPath = appHomeDir + File.separator + "andami-config.xml"; |
848 | 851 |
andamiConfigFromXML(andamiConfigPath); |
849 | 852 |
andamiConfig.setPluginsDirectory(pluginFolder); |
... | ... | |
2173 | 2176 |
return urls; |
2174 | 2177 |
} |
2175 | 2178 |
|
2176 |
private void pluginsClassLoaders() {
|
|
2179 |
private void loadPluginServices() {
|
|
2177 | 2180 |
Set<String> installed = new HashSet<String>(); |
2178 | 2181 |
|
2179 | 2182 |
// Se itera hasta que est�n todos instalados |
... | ... | |
2210 | 2213 |
if ( dependency.getOptional() ) { |
2211 | 2214 |
this.logger.info("Plugin '" + pluginName + "', optional dependency '" + dependencyName + "' not found"); |
2212 | 2215 |
} else { |
2213 |
this.addError(Messages.getString("Launcher.Dependencia_no_resuelta_en_plugin") |
|
2214 |
+ " " |
|
2216 |
logger.warn("Dependencia no resuelta en plugin " |
|
2215 | 2217 |
+ pluginName |
2216 | 2218 |
+ ": " |
2217 | 2219 |
+ dependencies[j].getPluginName()); |
... | ... | |
2249 | 2251 |
loader, |
2250 | 2252 |
PluginsConfig.getAlternativeNames(config) |
2251 | 2253 |
); |
2254 |
logger.info("Plugin '"+pluginName+"' created"); |
|
2252 | 2255 |
pluginsServices.put(ps.getPluginName(), ps); |
2253 | 2256 |
installed.add(pluginName); |
2254 | 2257 |
pluginsOrdered.add(pluginName); |
... | ... | |
2281 | 2284 |
i = pluginsConfig.keySet().iterator(); |
2282 | 2285 |
} |
2283 | 2286 |
} |
2284 |
registerActions(); |
|
2285 | 2287 |
} |
2286 | 2288 |
|
2287 | 2289 |
private void dumpPluginsDependencyInformation() { |
... | ... | |
2344 | 2346 |
} |
2345 | 2347 |
|
2346 | 2348 |
|
2347 |
private void loadPlugins() {
|
|
2349 |
private PluginsConfig loadPluginConfigs() {
|
|
2348 | 2350 |
InstallerManager installerManager = InstallerLocator.getInstallerManager(); |
2349 | 2351 |
List<File> repositoriesFolders = installerManager.getLocalAddonRepositories("plugin"); |
2350 | 2352 |
for ( File repositoryFolder : repositoriesFolders ) { |
2351 |
logger.info("Loading plugins from repository folder " + repositoryFolder.getAbsolutePath() + "."); |
|
2353 |
logger.info("Loading plugins configuration from repository folder " + repositoryFolder.getAbsolutePath() + ".");
|
|
2352 | 2354 |
|
2353 | 2355 |
if ( !repositoryFolder.exists() ) { |
2354 | 2356 |
logger.warn("Plugins repository folder not found '" + repositoryFolder.getAbsolutePath() + "'."); |
... | ... | |
2357 | 2359 |
|
2358 | 2360 |
File[] pluginsFolders = repositoryFolder.listFiles(); |
2359 | 2361 |
if ( pluginsFolders.length == 0 ) { |
2360 |
logger.warn("Plugins repository folder is empty '" + repositoryFolder.getAbsolutePath() + "'.");
|
|
2362 |
logger.info("Plugins repository folder is empty '" + repositoryFolder.getAbsolutePath() + "'.");
|
|
2361 | 2363 |
continue; |
2362 | 2364 |
} |
2363 | 2365 |
|
... | ... | |
2399 | 2401 |
} |
2400 | 2402 |
} |
2401 | 2403 |
} |
2402 |
if ( pluginsConfig.isEmpty() ) { |
|
2403 |
logger.warn("No valid plugin was found."); |
|
2404 |
System.exit(-1); |
|
2405 |
} |
|
2404 |
return pluginsConfig; |
|
2406 | 2405 |
} |
2407 | 2406 |
|
2408 | 2407 |
private static Locale getLocale(String language, String country, |
... | ... | |
2998 | 2997 |
localeStr = andamiConfig.getLocaleLanguage(); |
2999 | 2998 |
} |
3000 | 2999 |
localeStr = normalizeLanguageCode(localeStr); |
3001 |
locale = getLocale(localeStr, andamiConfig.getLocaleCountry(), |
|
3002 |
andamiConfig.getLocaleVariant()); |
|
3000 |
locale = getLocale( |
|
3001 |
localeStr, |
|
3002 |
andamiConfig.getLocaleCountry(), |
|
3003 |
andamiConfig.getLocaleVariant() |
|
3004 |
); |
|
3003 | 3005 |
org.gvsig.i18n.Messages.setCurrentLocale(locale); |
3004 | 3006 |
JComponent.setDefaultLocale(locale); |
3005 | 3007 |
/* |
... | ... | |
3543 | 3545 |
myArgs[2] = "language=" + line.getOptionValue("language"); |
3544 | 3546 |
} else { |
3545 | 3547 |
// prevent null |
3546 |
myArgs[2] = "";
|
|
3548 |
myArgs[2] = Locale.getDefault().toString();
|
|
3547 | 3549 |
} |
3548 | 3550 |
|
3549 | 3551 |
if ( line.hasOption("installURL") ) { |
... | ... | |
3570 | 3572 |
return; |
3571 | 3573 |
} |
3572 | 3574 |
} catch (ParseException exp) { |
3573 |
System.out.println("Unexpected exception:" + exp.getMessage());
|
|
3575 |
System.err.println("Unexpected exception:" + exp.getMessage());
|
|
3574 | 3576 |
System.exit(-1); |
3575 | 3577 |
} |
3576 | 3578 |
|
3577 | 3579 |
initializeApp(myArgs, "installer"); |
3578 |
initializeLibraries(); |
|
3579 | 3580 |
|
3580 |
AndamiConfig config = getAndamiConfig(); |
|
3581 |
config.setLocaleLanguage(locale.getLanguage()); |
|
3582 |
config.setLocaleCountry(locale.getCountry()); |
|
3583 |
config.setLocaleVariant(locale.getVariant()); |
|
3584 |
|
|
3581 |
new DefaultLibrariesInitializer().fullInitialize(true); |
|
3582 |
|
|
3585 | 3583 |
initializeInstallerManager(); |
3586 | 3584 |
|
3587 | 3585 |
InstallerManager installerManager = InstallerLocator.getInstallerManager(); |
3588 | 3586 |
|
3587 |
try { |
|
3588 |
logger.info("Loading plugins configurations"); |
|
3589 |
this.loadPluginConfigs(); |
|
3590 |
} catch (Throwable ex) { |
|
3591 |
logger.warn("Can't load plugins configurations", ex); |
|
3592 |
} |
|
3593 |
|
|
3594 |
try { |
|
3595 |
logger.info("Loading plugins"); |
|
3596 |
this.loadPluginServices(); |
|
3597 |
} catch (Throwable ex) { |
|
3598 |
logger.warn("Can't load plugins", ex); |
|
3599 |
} |
|
3600 |
|
|
3601 |
AndamiConfig config = getAndamiConfig(); |
|
3602 |
|
|
3603 |
initializeIdentityManagement(new File(config.getPluginsDirectory()).getAbsoluteFile()); |
|
3604 |
|
|
3605 |
initializeLibraries(); |
|
3606 |
|
|
3607 |
// config.setLocaleLanguage(locale.getLanguage()); |
|
3608 |
// config.setLocaleCountry(locale.getCountry()); |
|
3609 |
// config.setLocaleVariant(locale.getVariant()); |
|
3610 |
|
|
3589 | 3611 |
packageInfo = getPackageInfo(myArgs[1]); |
3590 | 3612 |
|
3591 | 3613 |
// set the gvSIG version to the install manager, to compose the download URL |
Also available in: Unified diff