*** N.B. Caveat: The XPages 8.5.3 release is only compatible with the version of Dojo which ships with XPages (i.e. 1.6.1).
There are known issues regarding compatibility with 1.7.
In the XPages 8.5.3 release, a new extension mechanism was introduced to allow for the dynamic contribution of Dojo resources via a plugin.
In order to take advantage of this new behaviour, create a plugin to contribute a class which extends "com.ibm.xsp.context.DojoLibraryFactory". The DojoLibraryFactory is the new extension mechanism introduced to provide dynamic Dojo contribution. This is the "plugin.xml" file for the new plugin just created.
<plugin>
<extension point="com.ibm.commons.Extension">
<service
class="xsp.dojo.dev.MyDojoLibraryFactory"
type="com.ibm.xsp.context.DojoLibraryFactory">
</service>
</extension>
</plugin>
Given this new class created called "MyDojoLibraryFactory", this class is responsible for specifying properties of the Dojo resources which this plugin provides. It does so by returning a Collection of one or more classes which extend from "com.ibm.xsp.context.BundleDojoLibrary". Each BundleDojoLibrary is passed three parameters. First, a reference to this bundle (or plugin), second is the version string of the Dojo being provided and last is the directory path under the plugin where the Dojo resources can be found.
import java.util.Collection;
import java.util.Collections;
import org.osgi.framework.Bundle;
import com.ibm.xsp.context.DojoLibrary;
import com.ibm.xsp.context.DojoLibraryFactory;
public class MyDojoLibraryFactory extends DojoLibraryFactory {
public Collection<DojoLibrary> getLibraries() {
Bundle bundle = MyActivator.instance.getBundle();
String versionString = "x.y.z.qualifier";
String bundleLocationPrefix = "/resources/dojo-version";
DojoLibrary lib = new MyBundleDojoLibrary(bundle, versionString, bundleLocationPrefix);
return Collections.singletonList(lib);
}
}
The version string is declared using the format "x.y.z.qualifier". This same format is used to explicitly specify which version of Dojo to use via an xsp.properties declaration either at an application or server-wide level.
xsp.client.script.dojo.version=x.y.z.qualifier
That is the infrastructure of the plugin taken care of so last requirement is to declare the DojoLibrary which specifies the behaviour that this plugin provides.
import org.osgi.framework.Bundle;
import com.ibm.xsp.context.BundleDojoLibrary;
public class MyBundleDojoLibrary extends BundleDojoLibrary {
public MyBundleDojoLibrary(Bundle bundle, String versionString, String bundleLocationPrefix) {
super(bundle, versionString, bundleLocationPrefix);
}
public boolean hasIbmModules() {
return false;
}
public boolean isDefaultIbmLibrary() {
return false;
}
public boolean isDefaultLibrary() {
return false;
}
}
This class which extends from "com.ibm.xsp.context.BundleDojoLibrary" declares functions altering the behaviour of how this DojoLibrary is registered with the runtime. In order for your plugin to be considered as the default library which will automatically be used by the runtime you must return true for the last function "isDefaultLibrary", then depending on whether it provides a later version computed based on the "versionString" parameter. If the library does not declare itself as a candidate for the default library then in order to use the particular version provided by the plugin, this must be explicitly specified using the xsp.properties option.
When completed, the new plugin providing the desired version of Dojo can be exported as a JAR to the location "domino\workspace\applications\eclipse\plugins" under the Domino Data directory path.
To verify whether your new plugin has been successfully registered with the runtime, issue the following command to the Domino console.
tell http osgi ss <my-dojo-plugin-name>
Furthermore, this can also be confirmed via the browser by hitting the following address.
http://<your-domino-server>/xsp/.ibmxspres/dojoroot-<versionString>/dojo/dojo.js
I hope this is of some help to everybody.