|
@@ -66,6 +66,9 @@ public class PluginInfo implements Comparable<PluginInfo> {
|
66
|
66
|
|
67
|
67
|
/** Last Error Message. */
|
68
|
68
|
private String lastError = "No Error";
|
|
69
|
+
|
|
70
|
+ /** Are we trying to load? */
|
|
71
|
+ private boolean isLoading = false;
|
69
|
72
|
|
70
|
73
|
/**
|
71
|
74
|
* Create a new PluginInfo.
|
|
@@ -166,7 +169,7 @@ public class PluginInfo implements Comparable<PluginInfo> {
|
166
|
169
|
}
|
167
|
170
|
}
|
168
|
171
|
|
169
|
|
- if (isPersistant() && loadAll()) { loadEntirePlugin(); }
|
|
172
|
+ if (isPersistent() && loadAll()) { loadEntirePlugin(); }
|
170
|
173
|
} else {
|
171
|
174
|
lastError = "One or more requirements not met ("+requirementsError+")";
|
172
|
175
|
throw new PluginException("Plugin "+filename+" was not loaded. "+lastError);
|
|
@@ -572,22 +575,31 @@ public class PluginInfo implements Comparable<PluginInfo> {
|
572
|
575
|
* Load the plugin files.
|
573
|
576
|
*/
|
574
|
577
|
public void loadPlugin() {
|
|
578
|
+ System.out.println("["+getName()+"] loadPlugin called");
|
575
|
579
|
if (isTempLoaded()) {
|
576
|
580
|
tempLoaded = false;
|
|
581
|
+ System.out.println("["+getName()+"] temp -> full");
|
|
582
|
+ System.out.println("["+getName()+"] loadingRequirements");
|
577
|
583
|
loadRequired();
|
|
584
|
+ System.out.println("["+getName()+"] calling onLoad");
|
578
|
585
|
plugin.onLoad();
|
|
586
|
+ System.out.println("["+getName()+"] onLoad Result: "+lastError);
|
579
|
587
|
} else {
|
580
|
|
- if (isLoaded() || metaData == null) {
|
581
|
|
- lastError = "Not Loading: ("+isLoaded()+"||"+(metaData == null)+")";
|
|
588
|
+ if (isLoaded() || metaData == null || isLoading) {
|
|
589
|
+ lastError = "Not Loading: ("+isLoaded()+"||"+(metaData == null)+"||"+isLoading+")";
|
|
590
|
+ System.out.println("["+getName()+"] loadPlugin failed: "+lastError);
|
582
|
591
|
return;
|
583
|
592
|
}
|
584
|
|
-
|
|
593
|
+ isLoading = true;
|
|
594
|
+ System.out.println("["+getName()+"] loadingRequirements");
|
585
|
595
|
loadRequired();
|
586
|
|
-
|
|
596
|
+ System.out.println("["+getName()+"] loading Main class");
|
587
|
597
|
loadClass(getMainClass());
|
|
598
|
+ System.out.println("["+getName()+"] load Result: "+lastError);
|
588
|
599
|
if (isLoaded()) {
|
589
|
600
|
ActionManager.processEvent(CoreActionType.PLUGIN_LOADED, null, this);
|
590
|
601
|
}
|
|
602
|
+ isLoading = false;
|
591
|
603
|
}
|
592
|
604
|
}
|
593
|
605
|
|
|
@@ -667,7 +679,7 @@ public class PluginInfo implements Comparable<PluginInfo> {
|
667
|
679
|
* Unload the plugin if possible.
|
668
|
680
|
*/
|
669
|
681
|
public void unloadPlugin() {
|
670
|
|
- if (!isPersistant() && (isLoaded() || isTempLoaded())) {
|
|
682
|
+ if (!isPersistent() && (isLoaded() || isTempLoaded())) {
|
671
|
683
|
if (!isTempLoaded()) {
|
672
|
684
|
try {
|
673
|
685
|
plugin.onUnload();
|
|
@@ -761,27 +773,27 @@ public class PluginInfo implements Comparable<PluginInfo> {
|
761
|
773
|
}
|
762
|
774
|
|
763
|
775
|
/**
|
764
|
|
- * Is this a persistant plugin?
|
|
776
|
+ * Is this a persistent plugin?
|
765
|
777
|
*
|
766
|
|
- * @return true if persistant, else false
|
|
778
|
+ * @return true if persistent, else false
|
767
|
779
|
*/
|
768
|
|
- public boolean isPersistant() {
|
769
|
|
- final String persistance = metaData.getProperty("persistant","no");
|
770
|
|
- return persistance.equalsIgnoreCase("true") || persistance.equalsIgnoreCase("yes");
|
|
780
|
+ public boolean isPersistent() {
|
|
781
|
+ final String persistence = metaData.getProperty("persistent","no");
|
|
782
|
+ return persistence.equalsIgnoreCase("true") || persistence.equalsIgnoreCase("yes");
|
771
|
783
|
}
|
772
|
784
|
|
773
|
785
|
/**
|
774
|
|
- * Does this plugin contain any persistant classes?
|
|
786
|
+ * Does this plugin contain any persistent classes?
|
775
|
787
|
*
|
776
|
|
- * @return true if this plugin contains any persistant classes, else false
|
|
788
|
+ * @return true if this plugin contains any persistent classes, else false
|
777
|
789
|
*/
|
778
|
|
- public boolean hasPersistant() {
|
779
|
|
- final String persistance = metaData.getProperty("persistant","no");
|
780
|
|
- if (persistance.equalsIgnoreCase("true")) {
|
|
790
|
+ public boolean hasPersistent() {
|
|
791
|
+ final String persistence = metaData.getProperty("persistent","no");
|
|
792
|
+ if (persistence.equalsIgnoreCase("true")) {
|
781
|
793
|
return true;
|
782
|
794
|
} else {
|
783
|
795
|
for (Object keyObject : metaData.keySet()) {
|
784
|
|
- if (keyObject.toString().toLowerCase().startsWith("persistant-")) {
|
|
796
|
+ if (keyObject.toString().toLowerCase().startsWith("persistent-")) {
|
785
|
797
|
return true;
|
786
|
798
|
}
|
787
|
799
|
}
|
|
@@ -790,14 +802,14 @@ public class PluginInfo implements Comparable<PluginInfo> {
|
790
|
802
|
}
|
791
|
803
|
|
792
|
804
|
/**
|
793
|
|
- * Get a list of all persistant classes in this plugin
|
|
805
|
+ * Get a list of all persistent classes in this plugin
|
794
|
806
|
*
|
795
|
|
- * @return List of all persistant classes in this plugin
|
|
807
|
+ * @return List of all persistent classes in this plugin
|
796
|
808
|
*/
|
797
|
|
- public List<String> getPersistantClasses() {
|
|
809
|
+ public List<String> getPersistentClasses() {
|
798
|
810
|
final List<String> result = new ArrayList<String>();
|
799
|
|
- final String persistance = metaData.getProperty("persistant","no");
|
800
|
|
- if (persistance.equalsIgnoreCase("true")) {
|
|
811
|
+ final String persistence = metaData.getProperty("persistent","no");
|
|
812
|
+ if (persistence.equalsIgnoreCase("true")) {
|
801
|
813
|
try {
|
802
|
814
|
ResourceManager res = getResourceManager();
|
803
|
815
|
|
|
@@ -811,7 +823,7 @@ public class PluginInfo implements Comparable<PluginInfo> {
|
811
|
823
|
}
|
812
|
824
|
} else {
|
813
|
825
|
for (Object keyObject : metaData.keySet()) {
|
814
|
|
- if (keyObject.toString().toLowerCase().startsWith("persistant-")) {
|
|
826
|
+ if (keyObject.toString().toLowerCase().startsWith("persistent-")) {
|
815
|
827
|
result.add(keyObject.toString().substring(11));
|
816
|
828
|
}
|
817
|
829
|
}
|
|
@@ -820,17 +832,17 @@ public class PluginInfo implements Comparable<PluginInfo> {
|
820
|
832
|
}
|
821
|
833
|
|
822
|
834
|
/**
|
823
|
|
- * Is this a persistant class?
|
|
835
|
+ * Is this a persistent class?
|
824
|
836
|
*
|
825
|
|
- * @param classname class to check persistance of
|
826
|
|
- * @return true if file (or whole plugin) is persistant, else false
|
|
837
|
+ * @param classname class to check persistence of
|
|
838
|
+ * @return true if file (or whole plugin) is persistent, else false
|
827
|
839
|
*/
|
828
|
|
- public boolean isPersistant(final String classname) {
|
829
|
|
- if (isPersistant()) {
|
|
840
|
+ public boolean isPersistent(final String classname) {
|
|
841
|
+ if (isPersistent()) {
|
830
|
842
|
return true;
|
831
|
843
|
} else {
|
832
|
|
- final String persistance = metaData.getProperty("persistant-"+classname,"no");
|
833
|
|
- return persistance.equalsIgnoreCase("true") || persistance.equalsIgnoreCase("yes");
|
|
844
|
+ final String persistence = metaData.getProperty("persistent-"+classname,"no");
|
|
845
|
+ return persistence.equalsIgnoreCase("true") || persistence.equalsIgnoreCase("yes");
|
834
|
846
|
}
|
835
|
847
|
}
|
836
|
848
|
|