Revision 40411 branches/v2_0_0_prep/frameworks/_fwAndami/src/org/gvsig/andami/PluginServices.java
PluginServices.java | ||
---|---|---|
55 | 55 |
import java.io.IOException; |
56 | 56 |
import java.lang.reflect.InvocationTargetException; |
57 | 57 |
import java.util.ArrayList; |
58 |
import java.util.Arrays; |
|
58 | 59 |
import java.util.HashMap; |
59 | 60 |
import java.util.Iterator; |
60 | 61 |
import java.util.Properties; |
... | ... | |
742 | 743 |
return PluginsLocator.getManager(); |
743 | 744 |
} |
744 | 745 |
|
746 |
private String[] getAllPluginNames() { |
|
747 |
String[] names = new String[this.alternativeNames.length+1]; |
|
748 |
names[0] = this.getPluginName(); |
|
749 |
for( int n=0; n<this.alternativeNames.length; n++ ) { |
|
750 |
names[n+1] = this.alternativeNames[n]; |
|
751 |
} |
|
752 |
return names; |
|
753 |
} |
|
754 |
|
|
745 | 755 |
public DynObject getPluginProperties() { |
746 | 756 |
if (this.pluginPersistence == null) { |
747 | 757 |
PersistenceManager manager = ToolsLocator.getPersistenceManager(); |
... | ... | |
751 | 761 |
new File(getManager().getPluginsDirectory().getAbsolutePath() |
752 | 762 |
+ File.separator + this.getPluginName() |
753 | 763 |
+ File.separator + "plugin-persistence.def"); |
754 |
try { |
|
755 |
dynStruct = manager.addDefinition(DynObject.class, |
|
756 |
this.getPluginName(), |
|
757 |
new FileInputStream(persistenceDefinitionFile), |
|
758 |
this.getClassLoader(), |
|
759 |
null, |
|
760 |
null); |
|
761 |
} catch (AddDefinitionException e) { |
|
762 |
throw new PluginPersistenceAddDefinitionException(this.getPluginName(), e); |
|
763 |
} catch (FileNotFoundException e) { |
|
764 |
throw new PluginPersistenceNeedDefinitionException(this.getPluginName(), e); |
|
764 |
String[] names = getAllPluginNames(); |
|
765 |
for( int i=0; i<names.length ; i++ ) { |
|
766 |
try { |
|
767 |
dynStruct = manager.addDefinition(DynObject.class, |
|
768 |
names[i], |
|
769 |
new FileInputStream(persistenceDefinitionFile), |
|
770 |
this.getClassLoader(), |
|
771 |
null, |
|
772 |
null); |
|
773 |
break; |
|
774 |
} catch (FileNotFoundException e) { |
|
775 |
throw new PluginPersistenceNeedDefinitionException(this.getPluginName(), e); |
|
776 |
} catch (AddDefinitionException e) { |
|
777 |
if( i+1 >= names.length ) { // Si ya no hay mas nombres peta |
|
778 |
throw new PluginPersistenceAddDefinitionException(this.getPluginName(), e); |
|
779 |
} |
|
780 |
} |
|
765 | 781 |
} |
766 | 782 |
} |
767 | 783 |
|
Also available in: Unified diff