* default methods. The PackageCompilationData holds a reference to the generated bytecode; which must be restored before any Rules.
* A custom ObjectInputStream, able to resolve classes against the bytecode, is used to restore the Rules.
*/
public void readExternal( ObjectInput stream ) throws IOException,
ClassNotFoundException {
KeyStoreHelper helper = new KeyStoreHelper();
boolean signed = stream.readBoolean();
if (helper.isSigned() != signed) {
throw new RuntimeDroolsException( "This environment is configured to work with " +
( helper.isSigned() ? "signed" : "unsigned" ) +
" serialized objects, but the given object is " +
( signed ? "signed" : "unsigned" ) + ". Deserialization aborted." );
}
String pubKeyAlias = null;
if (signed) {
pubKeyAlias = (String) stream.readObject();
if (helper.getPubKeyStore() == null) {
throw new RuntimeDroolsException(
"The package was serialized with a signature. Please configure a public keystore with the public key to check the signature. Deserialization aborted." );
}
}