|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.ObjectCADI.Common.Cache.DataBinsCacheManagement
CADI.Client.Cache.ClientCacheManagement
public class ClientCacheManagement
| Field Summary | |
|---|---|
private long |
cacheSize
This attributes is used to save the size of the cached data. |
private int |
codestreamType
1 - JPC 2 - JP2 3 - JPK 4 - JPX |
private java.util.ArrayList<java.lang.Long> |
dataBinsList
Is a list used to save the data-bins identifiers. |
static int |
FIFO
|
private JPCParameters |
jpcParameters
Definition in JPCParameters. |
static int |
LRU
|
protected int |
managementPolicy
Indicates which is the cache management policy. |
protected long |
maxCacheSize
Indicates which is the maximum size (in bytes) which is allowed for the cached data. |
static int |
NONE
|
private java.util.ArrayList<java.lang.Long> |
removedDataBins
Contains the data-bins which has been removed from the cache. |
| Fields inherited from class CADI.Common.Cache.DataBinsCacheManagement |
|---|
codParameters, EXPLICIT_FORM, IMPLICIT_FORM, INDEX_RANGE, mainHeaderDataBin, NUMBER_OF_BYTES, NUMBER_OF_LAYERS, precinctsDataBins, sizParameters, type, WILDCARD |
| Constructor Summary | |
|---|---|
ClientCacheManagement()
|
|
ClientCacheManagement(int codestreamType)
|
|
ClientCacheManagement(java.lang.String fileName)
This constructor must be used if the client cache is mapped to a file. |
|
| Method Summary | |
|---|---|
void |
addJPIPMessage(byte[] jpipMessageBody,
int classIdentifier,
long inClassIdentifier,
boolean completeDataBin,
long offset,
int aux)
|
void |
addJPIPMessage(JPIPMessage jpipMessage)
|
private byte[] |
ArrayListToArray(java.util.ArrayList<byte[]> src)
|
int |
getCodestreamType()
|
byte[] |
getDataBin(long inClassIdentifier)
Returns the byte array of the data-bin idientified by
inClassIdentifier. |
int |
getManagementPolicy()
Returns the managementPolicy attribute. |
long |
getMaxCacheSize()
Returns the maxCacheSize attribute. |
boolean |
isReady()
Check if the cache parameters has been initialized. |
void |
list(java.io.PrintStream out)
Prints this cache out to the specified output stream. |
void |
manage()
|
private static void |
printByteStream(byte[] buffer)
Useful method for printing out a ByteStream. |
void |
reset()
Sets the attributes to its initial values. |
void |
setJPCParameters(JPCParameters jpcParameters)
Sets the jpcParameters attribute. |
void |
setManagementPolicy(int managementPolicy)
Sets the managementPolicy attribute. |
void |
setMaxCacheSize(long maxCacheSize)
Sets the maxCacheSize attribute. |
java.lang.String |
toString()
|
private void |
updateLists(int classIdentifier,
long inClassIdentifier)
|
| Methods inherited from class CADI.Common.Cache.DataBinsCacheManagement |
|---|
explicitForm, explicitForm, getCacheDescriptor, getDataBin, getMainHeader, getPrecinctDataBin, getPrecinctDataBins, implicitForm, isCompleteMainHeader, isInCache, setSIZAndCODParamters |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
private JPCParameters jpcParameters
JPCParameters.
protected long maxCacheSize
protected int managementPolicy
Two cache management policies has been defined.
LRU (Last Recent Used): value, see LRU
FIFO (First In, First Out): value see FIFO
public static final int NONE
public static final int LRU
public static final int FIFO
private java.util.ArrayList<java.lang.Long> dataBinsList
private java.util.ArrayList<java.lang.Long> removedDataBins
private long cacheSize
maxCacheSize.
private int codestreamType
| Constructor Detail |
|---|
public ClientCacheManagement()
public ClientCacheManagement(int codestreamType)
public ClientCacheManagement(java.lang.String fileName)
OBS:It is not being used yet.
fileName - | Method Detail |
|---|
public final void setManagementPolicy(int managementPolicy)
managementPolicy attribute.
managementPolicy - definition in managementPolicy.public final int getManagementPolicy()
managementPolicy attribute.
managementPolicy attribute.public void setJPCParameters(JPCParameters jpcParameters)
jpcParameters attribute.
jpcParameters - definition in jpcParameters.public int getCodestreamType()
public final void setMaxCacheSize(long maxCacheSize)
maxCacheSize attribute.
maxCacheSize - is the maximum size (in bytes) allowed for the
cached data. Only positive values are allowed, a value of 0
means unlimited.public final long getMaxCacheSize()
maxCacheSize attribute.
maxCacheSize attribute.public void addJPIPMessage(JPIPMessage jpipMessage)
addJPIPMessage in class DataBinsCacheManagement
public final void addJPIPMessage(byte[] jpipMessageBody,
int classIdentifier,
long inClassIdentifier,
boolean completeDataBin,
long offset,
int aux)
addJPIPMessage in class DataBinsCacheManagementjpipMessageBody - definition in JPIPMessage.messageBodyclassIdentifier - definition in CADI.Common.Cache.CacheDescriptor#ClassinClassIdentifier - definition in JPIPMessageHeader.inClassIdentifiercompleteDataBin - definition in JPIPMessageHeader.isLastByteoffset - definition in JPIPMessageHeader.msgOffsetaux - definition in JPIPMessageHeader.Auxpublic final byte[] getDataBin(long inClassIdentifier)
inClassIdentifier. If the data-bin is not in the cache, a
null pointer is returned.
inClassIdentifier - definition in JPIPMessageHeader.inClassIdentifier
null pointer if
the data-bin is not in the cache.public void reset()
reset in class DataBinsCacheManagementpublic final boolean isReady()
true if the cache is ready. Otherwise, return
false.public void manage()
public java.lang.String toString()
toString in class DataBinsCacheManagementpublic void list(java.io.PrintStream out)
list in class DataBinsCacheManagementout - an output stream.
private void updateLists(int classIdentifier,
long inClassIdentifier)
classIdentifier - inClassIdentifier - private byte[] ArrayListToArray(java.util.ArrayList<byte[]> src)
private static void printByteStream(byte[] buffer)
buffer - the byte array to be printed.
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||