Revision 41696 trunk/org.gvsig.desktop/org.gvsig.desktop.framework/org.gvsig.andami/src/main/java/org/gvsig/andami/Launcher.java
Launcher.java | ||
---|---|---|
76 | 76 |
import java.util.Properties; |
77 | 77 |
import java.util.Set; |
78 | 78 |
import java.util.TreeSet; |
79 |
import java.util.logging.Level; |
|
79 | 80 |
import java.util.prefs.Preferences; |
80 | 81 |
|
81 | 82 |
import javax.swing.ImageIcon; |
... | ... | |
94 | 95 |
import org.apache.commons.cli.Options; |
95 | 96 |
import org.apache.commons.cli.ParseException; |
96 | 97 |
import org.apache.commons.cli.PosixParser; |
98 |
import org.apache.commons.configuration.PropertiesConfiguration; |
|
97 | 99 |
import org.apache.commons.io.FileUtils; |
98 | 100 |
import org.apache.commons.lang3.JavaVersion; |
99 | 101 |
import org.apache.commons.lang3.SystemUtils; |
... | ... | |
107 | 109 |
import org.exolab.castor.xml.ValidationException; |
108 | 110 |
import org.gvsig.andami.actioninfo.ActionInfo; |
109 | 111 |
import org.gvsig.andami.actioninfo.ActionInfoManager; |
110 |
import org.gvsig.andami.authentication.IAuthentication; |
|
111 | 112 |
import org.gvsig.andami.config.generate.Andami; |
112 | 113 |
import org.gvsig.andami.config.generate.AndamiConfig; |
113 | 114 |
import org.gvsig.andami.config.generate.Plugin; |
... | ... | |
159 | 160 |
import org.gvsig.installer.swing.api.execution.AbstractInstallPackageWizard; |
160 | 161 |
import org.gvsig.installer.swing.api.wizard.InstallerWizardActionListener; |
161 | 162 |
import org.gvsig.installer.swing.api.wizard.InstallerWizardPanel; |
163 |
import org.gvsig.tools.ToolsLocator; |
|
162 | 164 |
import org.gvsig.tools.exception.ListBaseException; |
163 | 165 |
import org.gvsig.tools.library.impl.DefaultLibrariesInitializer; |
164 | 166 |
import org.gvsig.tools.swing.api.ToolsSwingLocator; |
... | ... | |
481 | 483 |
} catch (Exception ex) { |
482 | 484 |
this.addError("Can't register icons", ex); |
483 | 485 |
} |
484 |
validate(); |
|
485 | 486 |
|
486 | 487 |
// Obtener la personalizaci�n de la aplicacion. |
487 | 488 |
try { |
... | ... | |
513 | 514 |
|
514 | 515 |
// Initialize andami libraries |
515 | 516 |
splashWindow.process(translate("SplashWindow.initialize_install_manager")); |
516 |
|
|
517 |
File defaultAddonsRepository = PluginsLocator.getManager() |
|
518 |
.getPluginsFolder(); |
|
519 |
InstallerManager installerManager = InstallerLocator |
|
520 |
.getInstallerManager(); |
|
521 |
installerManager.addLocalAddonRepository(defaultAddonsRepository,"plugin"); |
|
522 |
installerManager.setDefaultLocalAddonRepository(defaultAddonsRepository); |
|
517 |
PluginsManager pluginmgr = PluginsLocator.getManager(); |
|
518 |
File defaultAddonsRepository = pluginmgr.getPluginsFolder(); |
|
519 |
InstallerManager installerManager = InstallerLocator.getInstallerManager(); |
|
520 |
installerManager.setDefaultLocalAddonRepository(defaultAddonsRepository,"plugin"); |
|
523 | 521 |
|
524 | 522 |
splashWindow.process(translate("SplashWindow.initialize_list_of_addons_installeds")); |
525 | 523 |
// --------------------------------------------- |
526 | 524 |
// Get the list of installed packages |
527 |
PluginsManager pluginmgr = PluginsLocator.getManager(); |
|
528 |
InstallerManager installmgr = InstallerLocator.getInstallerManager(); |
|
529 |
|
|
525 |
|
|
530 | 526 |
PackageInfo[] installedPackages = null; |
531 | 527 |
try { |
532 |
installedPackages = installmgr.getInstalledPackages(
|
|
528 |
installedPackages = installerManager.getInstalledPackages(
|
|
533 | 529 |
pluginmgr.getPluginsFolder() |
534 | 530 |
); |
535 | 531 |
} catch (MakePluginPackageServiceException e) { |
... | ... | |
553 | 549 |
splashWindow.process(translate("SplashWindow.check_incompatible_plugins")); |
554 | 550 |
fixIncompatiblePlugins(installedPackages); |
555 | 551 |
|
552 |
|
|
556 | 553 |
// Se configura el classloader del plugin |
557 | 554 |
splashWindow.process(translate("SplashWindow.setup_plugins_configuration")); |
558 | 555 |
try { |
... | ... | |
561 | 558 |
} catch (Throwable ex) { |
562 | 559 |
this.addError("Can't initialize plugin's classloaders ", ex); |
563 | 560 |
} |
561 |
|
|
562 |
initializeIdentityManagement(new File(andamiConfig.getPluginsDirectory()).getAbsoluteFile()); |
|
564 | 563 |
|
565 | 564 |
// Initialize libraries |
566 | 565 |
splashWindow.process(translate("SplashWindow.initialize_plugins_libraries")); |
... | ... | |
2896 | 2895 |
} |
2897 | 2896 |
} |
2898 | 2897 |
|
2899 |
/** |
|
2900 |
* validates the user before starting gvsig |
|
2901 |
* |
|
2902 |
*/ |
|
2903 |
private static void validate() { |
|
2904 |
|
|
2905 |
IAuthentication session = null; |
|
2906 |
try { |
|
2907 |
session = (IAuthentication) Class.forName( |
|
2908 |
"com.iver.andami.authentication.Session").newInstance(); |
|
2909 |
|
|
2910 |
} catch (ClassNotFoundException e) { |
|
2911 |
return; |
|
2912 |
} catch (InstantiationException e) { |
|
2913 |
return; |
|
2914 |
} catch (IllegalAccessException e) { |
|
2915 |
return; |
|
2916 |
} |
|
2917 |
|
|
2918 |
session.setPluginDirectory(andamiConfig.getPluginsDirectory()); |
|
2919 |
if (session.validationRequired()) { |
|
2920 |
if (session.Login()) { |
|
2921 |
logger.info("You are logged in"); |
|
2922 |
} else { |
|
2923 |
JOptionPane.showMessageDialog((Component) PluginServices |
|
2924 |
.getMainFrame(), "You are not logged in"); |
|
2925 |
} |
|
2926 |
PluginServices.setAuthentication(session); |
|
2927 |
} |
|
2928 |
} |
|
2929 |
|
|
2930 | 2898 |
public static String getDefaultLookAndFeel() { |
2931 | 2899 |
String osName = (String) System.getProperty("os.name"); |
2932 | 2900 |
|
... | ... | |
3982 | 3950 |
return values; |
3983 | 3951 |
} |
3984 | 3952 |
} |
3953 |
|
|
3954 |
|
|
3955 |
private void initializeIdentityManagement(File pluginsFolder) { |
|
3956 |
File identityManagementConfigFile = null; |
|
3957 |
PluginServices plugin = null; |
|
3958 |
Iterator<Entry<String, PluginConfig>> it = pluginsConfig.entrySet().iterator(); |
|
3959 |
while ( it.hasNext() ) { |
|
3960 |
Entry<String, PluginConfig> entry = it.next(); |
|
3961 |
File pluginFolder = new File(pluginsFolder,entry.getKey()); |
|
3962 |
File f = new File(pluginFolder,"identity-management.ini"); |
|
3963 |
if( f.exists() ) { |
|
3964 |
if( identityManagementConfigFile!=null ) { |
|
3965 |
logger.warn("Too many identity-managemnt plugins. Disable all."); |
|
3966 |
} else { |
|
3967 |
identityManagementConfigFile = f; |
|
3968 |
plugin = PluginServices.getPluginServices(entry.getKey()); |
|
3969 |
} |
|
3970 |
} |
|
3971 |
} |
|
3972 |
if( identityManagementConfigFile==null || plugin==null ) { |
|
3973 |
return; |
|
3974 |
} |
|
3975 |
if (!identityManagementConfigFile.canRead()) { |
|
3976 |
return ; |
|
3977 |
} |
|
3978 |
PropertiesConfiguration identityManagementConfig = null; |
|
3979 |
try { |
|
3980 |
identityManagementConfig = new PropertiesConfiguration(identityManagementConfigFile); |
|
3981 |
} catch (Exception ex) { |
|
3982 |
logger.warn("Can't open identity management config file '" + identityManagementConfigFile.getAbsolutePath() + "'.", ex); |
|
3983 |
return; |
|
3984 |
} |
|
3985 |
String identityManagerClassName = identityManagementConfig.getString("IdentityManager", null); |
|
3986 |
String identityManagementInitializerClassName = identityManagementConfig.getString("IdentityManagementInitializer", null); |
|
3987 |
try { |
|
3988 |
if( identityManagerClassName != null ) { |
|
3989 |
Class identityManagerClass = plugin.getClassLoader().loadClass(identityManagerClassName); |
|
3990 |
ToolsLocator.registerIdentityManager(identityManagerClass); |
|
3991 |
} else { |
|
3992 |
logger.info("Entry IdentityManager not found in identity management config file '" + identityManagementConfigFile.getAbsolutePath() + "'."); |
|
3993 |
} |
|
3994 |
|
|
3995 |
if( identityManagementInitializerClassName != null ) { |
|
3996 |
Class identityManagerInitializerClass = plugin.getClassLoader().loadClass(identityManagementInitializerClassName); |
|
3997 |
Runnable identityManagerInitializer = (Runnable) identityManagerInitializerClass.newInstance(); |
|
3998 |
identityManagerInitializer.run(); |
|
3999 |
} else { |
|
4000 |
logger.info("Entry IdentityManagementInitializer not found in identity management config file '" + identityManagementConfigFile.getAbsolutePath() + "'."); |
|
4001 |
} |
|
4002 |
|
|
4003 |
} catch (Exception ex) { |
|
4004 |
logger.warn("Can't initialize the identity manager from '"+identityManagementConfigFile.getAbsolutePath()+".",ex); |
|
4005 |
return; |
|
4006 |
} |
|
4007 |
logger.info("Loaded a identity manager from plugin '"+plugin.getPluginName()+"."); |
|
4008 |
} |
|
4009 |
|
|
4010 |
|
|
3985 | 4011 |
} |
Also available in: Unified diff