public class ClientSideSessionTarget extends SessionTarget
Associated with each logical target are: - A single image data return type - A model of client's cache - One or more JPIP channels
Usage example:
constructor
[setMethods]
[newChannel]
getMethdos
Further information, please see see ISO/IEC 15444-1 section B.2
Modifier and Type | Field and Description |
---|---|
protected boolean |
align
Definition in
ServerControlField.align . |
protected java.util.ArrayList<java.lang.String> |
allowedReturnTypes
Definition in
ServerControlField.type . |
protected java.util.Map<java.lang.String,ClientJPIPChannel> |
channels
Contains the channels which are asociated to this logical target.
|
protected java.lang.String |
debug |
protected int |
descriptorQualifier
Is a qualifier of the
descriptorType . |
protected int |
descriptorType
Is the descriptor form type to be used in cache signaling.
|
protected boolean |
extendedHeaders
Definition in
ServerControlField.type . |
protected java.util.concurrent.locks.ReentrantLock |
lock |
protected CADILog |
log
Is used to log client messages.
|
protected int |
managementPolicy |
protected int |
MAX_HISTORY_RECORDS |
protected long |
maxCacheSize
Is the size of the cache (in bytes).
|
protected long |
maxTargetLength |
protected int |
port |
protected java.util.ArrayList<java.lang.String> |
preferredTransportProtocols |
protected boolean |
recordWOIHistory |
protected ViewWindowField |
responseViewWindow
Contains a view window including those parameters modified by the server.
|
protected boolean |
reuseCache
Indicates whether the cache is used between two consecutive requests.
|
protected java.lang.String |
server
Is the server name where logical targets are located.
|
protected java.lang.String |
sid
Is an unique session identifier.
|
protected int[] |
subtarget |
protected java.lang.String |
target
Definition in
TargetField.target |
protected boolean |
useKeepAlive |
protected java.lang.String |
userAgent |
protected boolean |
wait
Definition in
ServerControlField.wait . |
protected java.util.ArrayList<ViewWindowField> |
woiHistory
This attribute is used to store a historic of WOIs requested by clients.
|
returnType, tid
Constructor and Description |
---|
ClientSideSessionTarget(java.lang.String server,
int port,
java.lang.String target,
java.util.ArrayList<java.lang.String> preferredTransportProtocols,
CADILog log) |
ClientSideSessionTarget(java.lang.String server,
int port,
java.lang.String target,
CADILog log) |
Modifier and Type | Method and Description |
---|---|
void |
addWOIHistory(ViewWindowField woi) |
void |
closeChannel(java.lang.String cid)
Closes a channel.
|
void |
closeSession()
Closes the session with the server.
|
boolean |
contains(java.lang.String cid)
Checks if the channel
cid belongs to this session target. |
protected void |
copyJPIPResponseFields(JPIPResponseFields jpipResponseFields) |
void |
fetchWindow(ViewWindowField requestViewWindow,
boolean recordWOI)
Fetch the compressed data belonging to the requestViewWindow
from the server.
|
private java.lang.String |
generateSID()
Generates a unique channel identifier.
|
protected java.lang.String |
generateUID()
Generates a unique identifier.
|
long |
getBytesJPIPMessageBody()
Returns the
#bytesJPIPMessageBody attribute. |
long |
getBytesJPIPMessageHeader()
Returns the
#bytesJPIPMessageHeader attribute. |
int |
getCacheDescriptorQualifier()
Returns the
descriptorQualifier attribute. |
int |
getCacheDescriptorType()
Return the
descriptorType attribute. |
long |
getDownloadedBytes()
Returns the total bytes downloaded for the actual logical target.
|
protected JPIPResponseFields |
getJPIPResponseFields() |
java.lang.String |
getLocalCID()
Returns a CID beloging to the session target.
|
java.util.Set<java.lang.String> |
getLocalCIDs()
Returns an one-dimensional array containing the available CIDs.
|
int |
getPort() |
java.lang.String |
getRequestedURI() |
java.lang.String |
getServer() |
java.lang.String |
getSessionID()
Returns the
sid attribute. |
java.lang.String |
getTarget() |
java.util.ArrayList<ViewWindowField> |
getWOIHistory()
Returns the
#woisHistory attribute. |
boolean |
isAvailable(long inClassIdentifier,
int layer) |
boolean |
isAvailable(ViewWindowField viewWindow) |
void |
list(java.io.PrintStream out)
Prints this Session out to the specified output stream.
|
void |
lock()
Gets the original image's window of interest defined by
requestViewWindow . |
java.lang.String |
newChannel(java.util.ArrayList<java.lang.String> preferredTransportProtocols,
CacheManagement cache) |
java.lang.String |
newChannel(java.util.ArrayList<java.lang.String> preferredTransportProtocols,
CacheManagement cache,
java.lang.String proxyServer,
int proxyPort) |
java.lang.String |
newChannel(CacheManagement cache) |
java.lang.String |
newChannel(java.lang.String transport,
CacheManagement cache) |
int |
numOfChannels()
Returns the number of opened channels.
|
void |
remove()
Removes all the attributes.
|
void |
resetJPIPMessagesCounters()
Sets the JPIP message counter to 0.
|
void |
reuseCache(boolean reuseCache)
Sets if the client cache must be used.
|
void |
setAlign(boolean align)
Sets the
align attribute. |
void |
setAllowedReturnTypes(java.util.ArrayList<java.lang.String> returnTypes,
boolean extendedHeaders)
Sets the return types allowed by the JPIP client to receive data from the
JPIP server.
|
void |
setCacheDescriptor(int type,
int qualifier)
Sets the cache descriptor form type and qualifier.
|
void |
setCacheDescriptorType(int descriptorType)
OBS: This method must be replaced by the
setCacheDescriptor(int, int) . |
void |
setDebug(java.lang.String debug) |
void |
setMaxTargetLength(long maxTargetLength) |
protected void |
setPort(int port) |
void |
setRecordWOIHistory(boolean recordWOIHistory) |
void |
setUseHTTPSession(boolean useHTTPSession) |
void |
setUseHTTPTCPSession(boolean useHTTPTCPSession) |
void |
setUseIndexRange(boolean useIndexRange)
OBS: This method must be replaced by the
setCacheDescriptor(int, int) . |
void |
setUseKeepAlive(boolean useKeepAlive) |
void |
setUseNumberOfBytes(boolean useNumberOfBytes)
OBS: This method must be replaced by the
setCacheDescriptor(int, int) . |
void |
setUseNumberOfLayers(boolean useNumberOfLayers)
OBS: This method must be replaced by the
setCacheDescriptor(int, int) . |
void |
setUserAgent(java.lang.String userAgent) |
void |
setUseWildcard(boolean useWildcard)
OBS: This method must be replaced by the
setCacheDescriptor(int, int) . |
void |
setWait(boolean wait)
Sets the
wait attribute. |
java.lang.String |
toString() |
void |
unlock() |
boolean |
useIndexRange() |
boolean |
useNumberOfBytes() |
boolean |
useNumberOfLayers() |
boolean |
useWildcard() |
getChannel, getCid, getCids, getReturnType, getTid, getTID, newChannel, newChannel, setTID
protected java.lang.String sid
protected java.lang.String target
TargetField.target
protected int[] subtarget
protected java.lang.String server
protected int port
protected java.util.ArrayList<java.lang.String> allowedReturnTypes
ServerControlField.type
.
Allowed return types to receive data from the JPIP server. Values are saved as a list of strings.
Allowed values: jpp-stream
.
protected ViewWindowField responseViewWindow
protected int descriptorType
Allowed values are:
DataBinsCacheManagement.NO_CACHE
,
DataBinsCacheManagement.EXPLICIT_FORM
,
DataBinsCacheManagement.IMPLICIT_FORM
protected int descriptorQualifier
descriptorType
.
Allowed values are:
DataBinsCacheManagement.INDEX_RANGE
,
DataBinsCacheManagement.NUMBER_OF_BYTES
,
DataBinsCacheManagement.NUMBER_OF_LAYERS
,
DataBinsCacheManagement.WILDCARD
.
protected long maxCacheSize
A 0
value means no limit.
protected int managementPolicy
protected boolean useKeepAlive
protected java.lang.String userAgent
protected java.lang.String debug
protected long maxTargetLength
protected boolean reuseCache
true
cached data is keep, meanwhile if it is false
cached data are deleted.protected boolean align
ServerControlField.align
.protected boolean wait
ServerControlField.wait
.protected boolean extendedHeaders
ServerControlField.type
.protected java.util.ArrayList<java.lang.String> preferredTransportProtocols
protected java.util.Map<java.lang.String,ClientJPIPChannel> channels
protected CADILog log
protected java.util.ArrayList<ViewWindowField> woiHistory
Its usefulness is to be used by the prefetching module.
protected boolean recordWOIHistory
protected int MAX_HISTORY_RECORDS
protected final java.util.concurrent.locks.ReentrantLock lock
public ClientSideSessionTarget(java.lang.String server, int port, java.lang.String target, CADILog log)
server
- port
- target
- log
- public ClientSideSessionTarget(java.lang.String server, int port, java.lang.String target, java.util.ArrayList<java.lang.String> preferredTransportProtocols, CADILog log)
server
- port
- target
- preferredTransportProtocols
- log
- public final java.lang.String getSessionID()
sid
attribute.public final java.lang.String getTarget()
public final java.lang.String getServer()
public final int getPort()
protected final void setPort(int port)
public final void setCacheDescriptor(int type, int qualifier)
type
- definition in descriptorType
.qualifier
- definition in #descritorQualifier
.public final void setCacheDescriptorType(int descriptorType)
setCacheDescriptor(int, int)
.descriptorType
- public final int getCacheDescriptorType()
descriptorType
attribute.descriptorQualifier
attribute.public final int getCacheDescriptorQualifier()
descriptorQualifier
attribute.descriptorQualifier
attribute.public final void setUseWildcard(boolean useWildcard)
setCacheDescriptor(int, int)
.useWildcard
- public final boolean useWildcard()
public final void setUseIndexRange(boolean useIndexRange)
setCacheDescriptor(int, int)
.useIndexRange
- public final boolean useIndexRange()
public final void setUseNumberOfLayers(boolean useNumberOfLayers)
setCacheDescriptor(int, int)
.useNumberOfLayers
- public final boolean useNumberOfLayers()
public final void setUseNumberOfBytes(boolean useNumberOfBytes)
setCacheDescriptor(int, int)
.useNumberOfBytes
- public final boolean useNumberOfBytes()
public final void setMaxTargetLength(long maxTargetLength)
public final void setUseKeepAlive(boolean useKeepAlive)
public final void reuseCache(boolean reuseCache)
reuseCache
- true
if the cache is reseted every time a
new target is requested.public final void setAlign(boolean align)
align
attribute.align
- definition in align
.public final void setWait(boolean wait)
wait
attribute.wait
- definition in wait
.public final void setAllowedReturnTypes(java.util.ArrayList<java.lang.String> returnTypes, boolean extendedHeaders)
returnTypes
- extendedHeaders
- public final void setUseHTTPSession(boolean useHTTPSession)
useHTTPSession
- public final void setUseHTTPTCPSession(boolean useHTTPTCPSession)
useHTTPTCPSession
- public final void setUserAgent(java.lang.String userAgent)
userAgent
- public final void setDebug(java.lang.String debug)
userAgent
- public void closeSession() throws ErrorException
ErrorException
ErrorException
- it an error occurs while the session is being
closed.public void remove()
remove
in class SessionTarget
public final int numOfChannels()
numOfChannels
in class SessionTarget
public final boolean contains(java.lang.String cid)
cid
belongs to this session target.contains
in class SessionTarget
cid
- the unique channel identifier.true
if the channel belongs to this session target.
Otherwise, returns false
.public final void closeChannel(java.lang.String cid)
closeChannel
in class SessionTarget
cid
- the unique channel identifier.public java.lang.String newChannel(CacheManagement cache)
public java.lang.String newChannel(java.lang.String transport, CacheManagement cache)
transport
- public java.lang.String newChannel(java.util.ArrayList<java.lang.String> preferredTransportProtocols, CacheManagement cache)
preferredTransportProtocols
- public java.lang.String newChannel(java.util.ArrayList<java.lang.String> preferredTransportProtocols, CacheManagement cache, java.lang.String proxyServer, int proxyPort)
preferredTransportProtocols
- public final java.lang.String getRequestedURI()
public final void resetJPIPMessagesCounters()
public final long getBytesJPIPMessageHeader()
#bytesJPIPMessageHeader
attribute.#bytesJPIPMessageHeader
attribute.public final long getBytesJPIPMessageBody()
#bytesJPIPMessageBody
attribute.#bytesJPIPMessageBody
attribute.public final long getDownloadedBytes()
public final java.lang.String getLocalCID()
public final java.util.Set<java.lang.String> getLocalCIDs()
public void setRecordWOIHistory(boolean recordWOIHistory)
recordWOIHistoric
- public void addWOIHistory(ViewWindowField woi)
woi
- public java.util.ArrayList<ViewWindowField> getWOIHistory()
#woisHistory
attribute.#woisHistory
.protected JPIPResponseFields getJPIPResponseFields()
protected void copyJPIPResponseFields(JPIPResponseFields jpipResponseFields)
public boolean isAvailable(long inClassIdentifier, int layer)
inClassIdentifier
- layer
- public boolean isAvailable(ViewWindowField viewWindow)
viewWindow
- public void fetchWindow(ViewWindowField requestViewWindow, boolean recordWOI) throws ErrorException
Data are fetch but not decoded.
requestViewWindow
- the target Window Of Interest to fetch.recordWOI
- ErrorException
- if an error occurs fetching the WOI.#getWindow(CADI.Common.Network.JPIP.ViewWindowField, boolean)}.
public final void lock()
requestViewWindow
.requestViewWindow
- the target Window Of Interest to fetch.recordWOI
- ErrorException
- if an error occurs fetching the WOI.public final void unlock()
public java.lang.String toString()
toString
in class SessionTarget
public void list(java.io.PrintStream out)
list
in class SessionTarget
out
- an output stream.protected java.lang.String generateUID()
NOTICE: this method must be improved adding the Rijndael (or another one), client information, etc. to improve the security.
private java.lang.String generateSID()
NOTICE: this method must be improved adding the Rijndael (or another one), client information, etc. to improve the security.
CADI - Copyright (C) 2007
This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
Group on Interactive Coding of Images (GICI) (contact)