Revision 41025

View differences:

trunk/org.gvsig.desktop/org.gvsig.desktop.framework/org.gvsig.andami/src/main/java/org/gvsig/andami/Launcher.java
61 61
import java.security.Policy;
62 62
import java.text.MessageFormat;
63 63
import java.util.ArrayList;
64
import java.util.Arrays;
64 65
import java.util.Comparator;
65 66
import java.util.Enumeration;
66 67
import java.util.HashMap;
......
195 196
		
196 197
		public abstract String[] getAliases(Item item);
197 198
		
198
		public Item get(Object key) {
199
		public boolean isAlias(String key) {
200
			return aliases.get(key)!=null ;
201
		}
202

  
203
		public String getMainKey(String key) {
199 204
			Item item = super.get(key);
200 205
			if( item != null ) {
206
				return key;
207
			}
208
			String alias = aliases.get(key);
209
			if( alias != null ) {
210
				return alias;
211
			}
212
			return null;
213
		}
214
		
215
		public Item get(Object key) { 
216
			Item item = super.get(key);
217
			if( item != null ) {
201 218
				return item;
202 219
			}
203 220
			String alias = aliases.get(key);
......
323 340
	protected static ListBaseException launcherrors = null;
324 341

  
325 342
	protected static Theme theme = null;
343
	
344
	private List<String> deprecatedPluginNames = null;
326 345

  
327 346
	private static final class ProxyAuth extends Authenticator {
328 347

  
......
402 421
		return PluginServices.getText(Launcher.class,msg);
403 422
	}
404 423
	
424
	private List<String> getDeprecatedPluginNames() {
425
		if( deprecatedPluginNames == null ) {
426
			String[] ss = new String[] {
427
					"org.gvsig.app",
428
					"org.gvsig.coreplugin",
429
					"org.gvsig.editing",
430
					"org.gvsig.installer.app.extension",
431
					"org.gvsig.exportto.app.extension"
432
			};
433
			deprecatedPluginNames = Arrays.asList(ss);
434
		}
435
		return deprecatedPluginNames;
436
	}
437
	
405 438
	public void doMain(String[] args) throws Exception {
406 439

  
407 440
		if (args.length < 1) {
......
2076 2109
				// Se obtienen las dependencias y sus class loaders
2077 2110
				boolean ready = true;
2078 2111
				Depends[] dependencies = config.getDepends();
2079
				PluginClassLoader[] loaders = new PluginClassLoader[dependencies.length];
2112
				List<PluginClassLoader> loaders = new ArrayList<PluginClassLoader>();
2080 2113

  
2081 2114
				for (int j = 0; j < dependencies.length; j++) {
2082 2115
					Depends dependency = dependencies[j];
2083 2116
					String dependencyName = dependency.getPluginName();
2084 2117
					PluginConfig dependencyPluginConfig = pluginsConfig.get(dependencyName);
2085
					PluginServices dependenyPluginService = pluginsServices.get(dependencyName);
2118
					PluginServices dependencyPluginService = pluginsServices.get(dependencyName);
2086 2119
					
2120
					if( getDeprecatedPluginNames().contains(dependencyName) ) {
2121
						logger.warn("Plugin '"+pluginName+"' use a deprecated plugin name '"+dependencyName+"' as dependency. Must use '"+pluginsConfig.getMainKey(dependencyName)+"'.");
2122
					}
2087 2123
					if ( dependencyPluginConfig == null) {
2088 2124
						if( dependency.getOptional() ) {
2089 2125
							this.logger.info("Plugin '"+pluginName+"', optional dependency '"+dependencyName+"' not found");
......
2095 2131
										+ dependencies[j].getPluginName());
2096 2132
						}
2097 2133
					} else {
2098
						if ( dependenyPluginService!=null && 
2099
							installed.contains(dependenyPluginService.getPluginName())) {
2100
							loaders[j] = (pluginsServices.get(dependencies[j]
2101
									.getPluginName())).getClassLoader();
2134
						if ( dependencyPluginService!=null && 
2135
							installed.contains(dependencyPluginService.getPluginName())) {
2136
							loaders.add(dependencyPluginService.getClassLoader());
2102 2137
						} else {
2103 2138
							if( !dependency.getOptional() ) {
2104 2139
								ready = false;
......
3064 3099
						+ " '" + name + "'");
3065 3100
	}
3066 3101

  
3067
	// public static void initIconThemes() {
3068
	// // load the iconTheme
3069
	// IconThemeManager iconManager = new IconThemeManager();
3070
	// PluginServices.setIconThemeManager(iconManager);
3071
	// IconThemeInfo selectedTheme = iconManager.readConfig();
3072
	// if (selectedTheme!=null) {
3073
	// iconManager.setDefault(selectedTheme);
3074
	// logger.info("Setting the icon theme: "+selectedTheme.toVerboseString());
3075
	// }
3076
	// else {
3077
	// // set the default dir and try to load the default theme
3078
	// try {
3079
	// iconManager.setThemesDir(new File("iconThemes"));
3080
	// IconThemeInfo[] list = iconManager.list();
3081
	//
3082
	// for (int i=0; i<list.length; i++) {
3083
	// if (list[i].getResourceName().equals("iconThemes/icons")) {
3084
	// iconManager.setDefault(list[i]);
3085
	// logger.info("Setting the default icon theme: "+list[i].toVerboseString());
3086
	// return;
3087
	// }
3088
	// }
3089
	// } catch (FileNotFoundException e) {
3090
	// logger.info("IconTheme basedir does not exist");
3091
	// }
3092
	// // create an empty theme
3093
	// IconThemeInfo info = new IconThemeInfo();
3094
	// info.setName("No theme loaded");
3095
	// info.setResource(null); // null resource means that no real theme is
3096
	// loaded
3097
	// info.setDescription("No theme loaded");
3098
	// info.setVersion("0");
3099
	// iconManager.setDefault(new IconTheme(info));
3100
	// logger.info("Setting an empty icon theme");
3101
	//
3102
	// }
3103
	// }
3104

  
3105 3102
	public static void initIconThemes() {
3106 3103
		PluginsManager pluginsManager = PluginsLocator.getManager();
3107 3104
		IconThemeManager iconManager = ToolsSwingLocator.getIconThemeManager();
trunk/org.gvsig.desktop/org.gvsig.desktop.framework/org.gvsig.andami/src/main/java/org/gvsig/andami/plugins/config/generate/PluginConfig.java
40 40
import java.io.Writer;
41 41
import java.util.Enumeration;
42 42
import java.util.Vector;
43

  
43 44
import org.exolab.castor.xml.MarshalException;
44 45
import org.exolab.castor.xml.Marshaller;
45 46
import org.exolab.castor.xml.Unmarshaller;
46 47
import org.exolab.castor.xml.ValidationException;
48
import org.slf4j.Logger;
49
import org.slf4j.LoggerFactory;
47 50
import org.xml.sax.ContentHandler;
48 51

  
49 52
/**
......
53 56
 */
54 57
public class PluginConfig implements java.io.Serializable {
55 58

  
59
	private static final Logger logger = LoggerFactory.getLogger(PluginConfig.class);
56 60

  
57 61
      //--------------------------/
58 62
     //- Class/Member Variables -/
......
129 133
        throws java.lang.IndexOutOfBoundsException
130 134
    {
131 135
        _dependsList.addElement(vDepends);
136
    	if( "org.gvsig.app".equals(vDepends.getPluginName())  ) {
137
    		logger.info("Deprecated dependency 'org.gvsig.app' add optional depdency with 'org.gvsig.shp.app.mainplugin' to ensure compatibility with gvSIG 2.0.");
138
    		org.gvsig.andami.plugins.config.generate.Depends dep2 = new org.gvsig.andami.plugins.config.generate.Depends();
139
    		dep2.setOptional(true);
140
    		dep2.setPluginName("org.gvsig.shp.app.mainplugin");
141
            _dependsList.addElement(dep2);
142
    	}
132 143
    } //-- void addDepends(com.iver.andami.plugins.config.generate.Depends) 
133 144

  
134 145
    /**
trunk/org.gvsig.desktop/org.gvsig.desktop.framework/org.gvsig.andami/src/main/java/org/gvsig/andami/plugins/PluginClassLoader.java
92 92
     * @throws IOException
93 93
     */
94 94
    public PluginClassLoader(URL[] jars, String baseDir, ClassLoader cl,
95
            List<PluginClassLoader> pluginLoaders) throws IOException {
96
    	this(jars, baseDir, cl, (PluginClassLoader[]) pluginLoaders.toArray(new PluginClassLoader[pluginLoaders.size()]) );
97
    }
98
    
99
    public PluginClassLoader(URL[] jars, String baseDir, ClassLoader cl,
95 100
        PluginClassLoader[] pluginLoaders) throws IOException {
96 101
        super(jars, cl);
97 102
        logger.debug("Creating PluginClassLoader for {}.", baseDir);
......
413 418
        	logger.info("Error getting resource {} in {}'", new Object[] {res,this.baseDir.toString()}, e);
414 419
        }
415 420
        if( ret == null ) {
416
        	logger.warn("Error getting resource {} in {}'", new Object[] {res,this.baseDir.toString()});
421
        	logger.info("Error getting resource {} in {}'", new Object[] {res,this.baseDir.toString()});
417 422
        }
418 423
        return ret;
419 424
    }

Also available in: Unified diff