org.keridwen.core.data.storage.packet
Class DataPacketSafe<ObjectType>

java.lang.Object
  extended by org.keridwen.core.data.storage.packet.DataPacket<ObjectType>
      extended by org.keridwen.core.data.storage.packet.DataPacketSafe<ObjectType>
Direct Known Subclasses:
FileDataPacket, MemoryDataPacketSafe

public abstract class DataPacketSafe<ObjectType>
extends DataPacket<ObjectType>

Author:
JeT - Artenum, Benoit Thiebault - Artenum This DataModel class is the storage space of any kind of data within Keridwen. It stores the data content, name, type and other kind of specific data used to track data life cycle (date, usages, requests ...)

Constructor Summary
DataPacketSafe(UniqueIdGenerator<DataPacketId> idGenerator)
          Constructor
 
Method Summary
abstract  boolean closeIn(InputStream in)
          close the input stream used to read data
abstract  boolean closeOut(OutputStream out)
          close the output stream used to write data
abstract  Class<?> getPacketDataType()
          Type of data managed by this packet
abstract  InputStream openIn()
          Create a new input stream used to read data.
abstract  OutputStream openOut()
          Open the only output stream used to write data TODO: manage concurrency (throw DataModelConcurrencyException ?)
 
Methods inherited from class org.keridwen.core.data.storage.packet.DataPacket
addDataPacketListener, fireDataPacketEvent, forceReadLockRelease, forceWriteLockRelease, getPacketId, isReadInProgress, isWriteInProgress, removeDataPacketListener
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DataPacketSafe

public DataPacketSafe(UniqueIdGenerator<DataPacketId> idGenerator)
Constructor

Parameters:
packetId -
Method Detail

getPacketDataType

public abstract Class<?> getPacketDataType()
Type of data managed by this packet

Specified by:
getPacketDataType in class DataPacket<ObjectType>
Returns:
the packetDataType

openIn

public abstract InputStream openIn()
                            throws DataIOException
Create a new input stream used to read data. The returned input stream must be closed afterward using InputStream.close() method

Returns:
a newly created input stream
Throws:
DataIOException

openOut

public abstract OutputStream openOut()
                              throws DataIOException
Open the only output stream used to write data TODO: manage concurrency (throw DataModelConcurrencyException ?) the output stream must be closed using DataPacket.closeOut() method

Returns:
the output stream
Throws:
DataIOException

closeOut

public abstract boolean closeOut(OutputStream out)
                          throws DataIOException
close the output stream used to write data

Throws:
DataIOException

closeIn

public abstract boolean closeIn(InputStream in)
                         throws DataIOException
close the input stream used to read data

Throws:
DataIOException


Copyright © 2010-2013 Artenum. All Rights Reserved.