Class VersionedExternalizable
- java.lang.Object
-
- org.sakaiproject.component.gradebook.VersionedExternalizable
-
- All Implemented Interfaces:
Externalizable,Serializable
- Direct Known Subclasses:
GradebookDefinition
@Deprecated public abstract class VersionedExternalizable extends Object implements Externalizable
Deprecated.This is part of the import/export for gradebook1 which will be removed at some pointGeneric helper class for serializing Java objects to and from simply-formatted XML for archival and reconstitution across data definition versions.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.
- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classVersionedExternalizable.ConverterDeprecated.This XStream converter stores the externalizable version of the class as a Document-level attribute for easy access by translators.
-
Field Summary
Fields Modifier and Type Field Description static StringVERSION_ATTRIBUTEDeprecated.
-
Constructor Summary
Constructors Constructor Description VersionedExternalizable()Deprecated.
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Deprecated Methods Modifier and Type Method Description static ObjectfromXml(String xmlString)Deprecated.abstract StringgetExternalizableVersion()Deprecated.protected static com.thoughtworks.xstream.XStreamgetXStream()Deprecated.voidreadExternal(ObjectInput inputStream)Deprecated.static StringtoXml(Object obj)Deprecated.voidwriteExternal(ObjectOutput outputStream)Deprecated.
-
-
-
Field Detail
-
VERSION_ATTRIBUTE
public static String VERSION_ATTRIBUTE
Deprecated.
-
-
Method Detail
-
getExternalizableVersion
public abstract String getExternalizableVersion()
Deprecated.- Returns:
- non-null archivable version identifier for the object definition
-
getXStream
protected static com.thoughtworks.xstream.XStream getXStream()
Deprecated.
-
readExternal
public void readExternal(ObjectInput inputStream) throws IOException, ClassNotFoundException
Deprecated.- Specified by:
readExternalin interfaceExternalizable- Throws:
IOExceptionClassNotFoundException
-
writeExternal
public void writeExternal(ObjectOutput outputStream) throws IOException
Deprecated.- Specified by:
writeExternalin interfaceExternalizable- Throws:
IOException
-
toXml
public static String toXml(Object obj)
Deprecated.- Parameters:
obj- the Java object (usually a subclass of VersionedExternalizable) to describe as XML- Returns:
- XML describing the object
-
-