View source | View content page | Page history | Printable version   

Projects:Remove XStream/Specs

Back button.png   Back to Projects:Remove_XStream


Contents

Goal

The goal of this project is to remove the usage of the XStream library from Openbravo. The main reason is because this library is affected by illegal access warnings (shown since JDK9). See here for additional information.

Functional Requirements

This project will not add new functional features, the changes involved within this project should be transparent in terms of the functional behavior of the application.

Technical Specs

XStream library is used in Openbravo to serialize objects into JSON. It is mainly used internally by quartz which is the engine to run background processes, but there are also a few parts in the application making use of it.

The objective is to keep doing the object serialization but without using XStream. Note that by removing this library from core we are introducing an API Change for that code that could be making a direct usage of this library.

Process Context

This is the class used by the OBScheduler to provide the context to the DAL based processes.

This class was using XStream to deserialize a ProcessContext from its String representation in the AD_PROCESS_REQUEST window.

Instead of using XStream, that very same representation can be easily deserialized into a JSONObject using the Jettison library, and then use that JSONObject to set the properties of a new ProcessContext instance.

Process Bundle Parameters

XStream was also used to serialize and deserialize the map of parameters of a ProcessBundle. These are the parameters that are provided when executing an scheduled process.

To replace the XStream usage, a new class called ParameterSerializer will be created. This class will make use of the Jettison library to serialize and deserialize the map of parameters using a simpler representation than the one generated by XStream. Thus, for the moment just parameters of type String and JSONObject will be supported for the moment.

It has been verified if there are process in core or in the external modules that could be affected by this change. This is the only case affected by this change that has been found so far:

OBError

The OBError class was being serialized with XStream in several servlets in order to create a JSON String that is returned as part of the response sent to the client:

 
  OBError error = new OBError();
  error.setType("Error");
  error.setTitle("Error");
  XStream xs = new XStream(new JettisonMappedXmlDriver());
  xs.alias("OBError", OBError.class);
  String strResult = xs.toXML(error);

To replace the usage of XStream in such cases, the OBError will provide a method that returns its JSON representation, generated without using XStream:

 
  OBError error = new OBError();
  error.setType("Error");
  error.setTitle("Error");
  String strResult = error.toJSON().toString();

ApplyModulesResponse

This is a similar case than the OBError one. This class is used to notify information to the client side when rebuilding the application using the Module Management Console.

Note as part of the changes done for this class, another API change has been introduced, by reducing the visibility of the class.

Retrieved from "http://wiki.openbravo.com/wiki/Projects:Remove_XStream/Specs"

This page has been accessed 777 times. This page was last modified on 15 May 2019, at 08:41. Content is available under Creative Commons Attribution-ShareAlike 2.5 Spain License.