Java code changes

PolicyCenter 8.0 made significant changes to how you write and deploy Java code, including Java implementations of plugin interfaces. The Java API from previous releases is deprecated in version 8.0.

If you deployed Java code in previous releases:

  • Your legacy code that uses the deprecated Java API runs with no changes in PolicyCenter 8.0.
  • To regenerate the libraries for the legacy API, continue to use the same gwpc regen-java-api command as in previous releases. However, there you must add an additional flag on the tool to generate the deprecated Java libraries in addition to the 8.0 Java API libraries. Also, PolicyCenter generates the libraries and Javadoc for the deprecated API in a slightly different location. See Java library generation in version 8.0.
  • Although the older API is deprecated, you can continue to use the deprecated API in this release while you start to upgrade your code to the new API.
  • You can use Java code from the deprecated API and code using the new API at the same time for different plugin interfaces. Be sure that for each plugin interface and Java class, you follow deploy requirements for each API style (deprecated API or new API).
  • The location on disk of a Java class or library determines whether PolicyCenter expects the deprecated Java API or the version 8.0 Java API.
    • For the 8.0 Java API, deploy classes in the locations defined in Deploying non-OSGi Java classes and JAR files. Most notably, you must deploy all classes and JAR files in directories that have /basic/ in the path. Any other locations are unsupported with the 8.0 Java API.
    • For the deprecated Java API, deploy classes and JARs in a plugin directory as defined in previous releases of PolicyCenter. PolicyCenter loads the class with the legacy class loader and does the external entity conversion and legacy conversion of containers (collections and lists). In general, it is incorrect to put any classes or libraries that use the deprecated Java API into any plugins/PLUGINDIR/basic/lib folder or plugins/PLUGINDIR/basic/classes subdirectories. The PLUGINDIR value represents the plugin directory as specified for that plugin implementation in the Studio Plugins editor. See Add an implementation to a Plugins Registry item. The one exception is if you have classes or libraries that do not use Guidewire entity data and previously were in the plugins/shared/basic subdirectory.
    • For a complete reference, see Where to deploy your Java classes and libraries.
    • For more about plugin directories, see Add an implementation to a Plugins Registry item.