Package org.apache.batchee.spi
Interface DataRepresentationService
-
- All Superinterfaces:
BatchService
- All Known Implementing Classes:
DefaultDataRepresentationService
public interface DataRepresentationService extends BatchService
This SPI takes Data Objects from a JBatch artifact and transfers it into something which can be stored in a Blob in the Database (byte[] in Java). The Objects in question can be parameters passed to a job (jobProperties) or Checkpoint objects from an execution. This service of course also has to implement the other way around. It needs to be able to also read all the things stored in the database and transfer it back to Java objects. In the old days we simply used Java Serialisation to get this byte[]. But this has an obvious downside when it comes to migration, update scenarios and ease of use.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description <T> byte[]
toInternalRepresentation(T dataObject)
Convert the given dataObject into something which can be stored in a BLOB in the database.<T> T
toJavaRepresentation(byte[] internalRepresentation)
Convert the internal representation stored in thePersistenceManagerService
to the Java objects needed by the batch artifacts.-
Methods inherited from interface org.apache.batchee.spi.BatchService
init
-
-
-
-
Method Detail
-
toInternalRepresentation
<T> byte[] toInternalRepresentation(T dataObject)
Convert the given dataObject into something which can be stored in a BLOB in the database.- Type Parameters:
T
-- Parameters:
dataObject
- the object to store ornull
if no data is to be stored- Returns:
- the internal representation of the dataObject
-
toJavaRepresentation
<T> T toJavaRepresentation(byte[] internalRepresentation)
Convert the internal representation stored in thePersistenceManagerService
to the Java objects needed by the batch artifacts.- Type Parameters:
T
-- Parameters:
internalRepresentation
- the String representation which we store in the databas- Returns:
- the dataObject
-
-