SparkPlug: extend the plugin mechanism, make it more powerful (SPARK-1311)

[SPARK-1313] Enhance ability to overwrite spark properties values through plugin Created: 02/May/11  Updated: 28/Oct/20  Resolved: 14/Aug/11

Status: Closed
Project: Spark
Components: None
Affects versions: None
Fix versions: 2.7.0
Parent: SparkPlug: extend the plugin mechanism, make it more powerful

Type: Sub-task Priority: Major
Reporter: Mircea Carasel Assignee: Mircea Carasel
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original estimate: Not Specified

Attachments: Text File SPARK-1313.patch     Java Archive File testPlugin.jar    
Issue links:
Related to
is related to SPARK-1312 Load plugins before Login page and wo... Closed

 Description   

Define rule to permit plugins to overwrite spark properties values

Spark defines values like: Login Page image, background, Application name etc in
spark.properties or default.properties
By this task it should be allowed to overwrite such properties from plugin



 Comments   
Comment by Mircea Carasel [ 02/May/11 ]

The attached patch contains:

-improved Spark Resources management: SparkRes.java and Default.java
by adding a new SparkPropertyResourceBundle as a wrapper around resource bundles
instances from SparkRes or Default

When a property value is retrieved, first is looked in a specific plugin location.
If not found it falls back to the Spark default property value

You simply add spark.properties and default.properties with keys/values you want overwritten by plugin
inside plugin's .jar archive file

NOTE: this patch needs SPARK-1312 Closed attached patch

Please review
Thanks

Comment by Mircea Carasel [ 03/May/11 ]

I am attaching a test plugin as an example how spark properties values can be overwritten
The class plugin has no functionality (java source included in jar)

I changed the application name into: My Spark

APPLICATION_NAME = My Spark
in default.properties inside testPlugin.jar

Comment by Mircea Carasel [ 10/May/11 ]

The attached patch does not scale very well when many plugins are installed, some of the properties are not correctly overwritten in this schenario.

I will post a new patch that better handles resource props overriding

Comment by Mircea Carasel [ 10/May/11 ]

New patch attached
Patch description:

-load plugin resources into dedicated HashMaps at plugin loading phase
-in spark look for plugin key/value pair in hashmaps first. If not found - fall back to spark key-value pair

Comment by Mircea Carasel [ 14/Aug/11 ]

commited an improved version of the patch
we now are offering full spark resource overwriting support through plugin:
spark.properties, default.properties, spark_118n.properties (including localization) and preferences.properties to overwrite preferences defaults

r12573 = 8b197eb26154943ea40c9e68346e55fb5d92a889

Description:

-improved Spark Resources management: SparkRes.java, Default.java, Res.java, LocalPreferences.java
by adding a new PluginRes.java that contains hash maps with plugin resource values for
spark.properties, default.properties, spark_i18n.properties (and localization support), preferences.properties
that you want to be overwritten in plugin
The plugin can overwrite few preferences as well in preferences.properties:
toasterPopup
notifyOnOffline
notifyOnOnline
showTypingNotification
useAdHocRoom

PluginManager calls loadPluginResources() to load all plugin resources using the plugin' class loader
and puts them in dedicated hashMaps.
When a property value is retrieved, first is looked in the PluginRes corresponding's hashMap.
If not found it falls back to the Spark default property value

You simply add spark.properties, default.properties, spark_i18n.properties (and language specific spark_i18n_xx.proeprties),
preferences.properties with keys/values you want overwritten by plugin inside plugin's .jar archive file

Comment by Mircea Carasel [ 12/Sep/11 ]

commited

r12593 = 5154538af5f9667b329f2d8db5a474bbcd77f3bc

-make Spark user personal directory configurable through plugin (create dedicated properties key/value pairs in default.properties)

Comment by Walter Ebeling [ 24/Feb/13 ]

Mass closing of resolved issues

Generated at Fri Mar 29 13:56:21 UTC 2024 using Jira 1001.0.0-SNAPSHOT#100248-rev:6a03a54452e975225e04dfda06fdac6fd9e95b00.