CADI.Server.Session
Class SessionTarget

java.lang.Object
  extended by CADI.Server.Session.SessionTarget

public class SessionTarget
extends java.lang.Object

This class is used to save information about a logical target that belongs to a session.

Version:
1.0 2007/10/26
Author:
Group on Interactive Coding of Images (GICI)

Field Summary
private  ServerCache cache
          Saves the server cache model of this logical target for all channels.
private  java.util.ArrayList<Channel> channels
          Contains the list of channels that are associated to this logical target.
private  java.lang.String tid
          Definition in TargetField.tid
 
Constructor Summary
SessionTarget()
          Constructor.
 
Method Summary
 void closeChannel(java.lang.String cid)
          Closes a channel.
 boolean contains(java.lang.String cid)
          Checks if the channel cid belongs to this session target.
 java.lang.String createSessionTarget(java.lang.String transport)
          Creates a channel.
 ServerCache getCache()
          Returns the cache object.
 java.lang.String getTid()
          Returns the tid.
 void list(java.io.PrintStream out)
          Prints this Session out to the specified output stream.
 int numOfChannels()
          Returns the number of opened channels.
 void remove()
          Removes all the attributes.
 void setCache(ServerCache cache)
          Sets the server cache.
 void setTid(java.lang.String tid)
          Sets the target identifier.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

tid

private java.lang.String tid
Definition in TargetField.tid


cache

private ServerCache cache
Saves the server cache model of this logical target for all channels.


channels

private java.util.ArrayList<Channel> channels
Contains the list of channels that are associated to this logical target.

Constructor Detail

SessionTarget

public SessionTarget()
Constructor.

Method Detail

createSessionTarget

public java.lang.String createSessionTarget(java.lang.String transport)
Creates a channel.

Parameters:
transport - definition in JPIPResponseFields.transport.
Returns:
the channel identifier.

setTid

public void setTid(java.lang.String tid)
Sets the target identifier. The tid only can be set once; so if this method is called and the tid has been set, an exception is thrown.

Parameters:
tid - the target identifier.

getTid

public java.lang.String getTid()
Returns the tid.

Returns:
the tid.

setCache

public void setCache(ServerCache cache)
Sets the server cache. This method only can be called once, another called to this method will thrown an exception.

Parameters:
cache - the servr cache.

getCache

public ServerCache getCache()
Returns the cache object.

Returns:
the cache object.

contains

public boolean contains(java.lang.String cid)
Checks if the channel cid belongs to this session target.

Parameters:
cid - the unique channel identifier.
Returns:
true if the channel belongs to this session target. Otherwise, returns false.

closeChannel

public void closeChannel(java.lang.String cid)
Closes a channel.

Parameters:
cid - the unique channel identifier.

numOfChannels

public int numOfChannels()
Returns the number of opened channels.

Returns:
the number of opened channels.

remove

public void remove()
Removes all the attributes.


toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

list

public void list(java.io.PrintStream out)
Prints this Session out to the specified output stream. This method is useful for debugging.

Parameters:
out - an output stream.


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)