@Deprecated public abstract class VersionedExternalizable extends Object implements Externalizable
XStream is used to handle the marshalling and unmarshalling work. The main addition is an "externalizableVersion" attribute on the POJO's top-level element. That attribute can then be checked for incompatibilities before reconstitution, and used to convert old data into its new form. (Currently, if there's a version mismatch and nothing is done about it, this class throws a ConversionException.)
Translation to and from XML can be handled either with the static "toXML" and "fromXML" methods, or through the Externalizable interface. The chief benefit of the static methods is that they (theoretically) give subclasses the ability to translate across versions using XSLT, and possibly even return an object of a different class than the original.
TODO For the functionality being checked in (site-to-site migration), this class is not strictly necessary. It's here on a speculative basis for upcoming import/archive/merge development.
| Modifier and Type | Class and Description |
|---|---|
static class |
VersionedExternalizable.Converter
Deprecated.
This XStream converter stores the externalizable version of the
class as a Document-level attribute for easy access by translators.
|
| Modifier and Type | Field and Description |
|---|---|
static String |
VERSION_ATTRIBUTE
Deprecated.
|
| Constructor and Description |
|---|
VersionedExternalizable()
Deprecated.
|
| Modifier and Type | Method and Description |
|---|---|
static Object |
fromXml(String xmlString)
Deprecated.
|
abstract String |
getExternalizableVersion()
Deprecated.
|
protected static com.thoughtworks.xstream.XStream |
getXStream()
Deprecated.
|
void |
readExternal(ObjectInput inputStream)
Deprecated.
|
static String |
toXml(Object obj)
Deprecated.
|
void |
writeExternal(ObjectOutput outputStream)
Deprecated.
|
public static String VERSION_ATTRIBUTE
public abstract String getExternalizableVersion()
protected static com.thoughtworks.xstream.XStream getXStream()
public void readExternal(ObjectInput inputStream) throws IOException, ClassNotFoundException
readExternal in interface ExternalizableIOExceptionClassNotFoundExceptionpublic void writeExternal(ObjectOutput outputStream) throws IOException
writeExternal in interface ExternalizableIOExceptionpublic static String toXml(Object obj)
obj - the Java object (usually a subclass of VersionedExternalizable) to describe
as XMLCopyright © 2003–2022 Sakai Project. All rights reserved.