CADI.Proxy.Cache
Class ProxyCacheLogicalTargets

java.lang.Object
  extended by CADI.Proxy.Cache.ProxyCacheLogicalTargets

public class ProxyCacheLogicalTargets
extends java.lang.Object

This class implements a list of cached logical targets. Logical targets are cached when a response from a server is sent to a client.

NOTICE: Methods are not synchronizced yet. It may be a problem with the threads.

Version:
1.0 2009/08/23
Author:
Group on Interactive Coding of Images (GICI)

Field Summary
private  java.util.Map<java.lang.String,ProxyCacheManagement> cacheManagement
          key: is a proxy target identifier (ProxyTID)
private  java.util.HashMap<java.lang.String,java.lang.String> targetToProxyTID
          Converts from a target to a proxyTID
 
Constructor Summary
ProxyCacheLogicalTargets()
          Constructor of ProxyCacheLogicalTargets.
 
Method Summary
 void add(ProxyCacheManagement logicalTarget)
          Appends the specific logical target to the list of logical targets.
 boolean equals(java.lang.String target, java.lang.String tid)
          Check if the logical target identified
 ProxyCacheManagement getByTarget(java.lang.String target)
          Gets a logical target from the list.
 ProxyCacheManagement getByTID(java.lang.String tid)
          Gets a logical target from the list.
 ProxyCacheManagement getTarget(java.lang.String target, java.lang.String tid)
          Gets a logical target from the list.
 boolean isEmpty()
          Returns true if the list contains no elements.
 void list(java.io.PrintStream out)
          Prints this Logical Target List fields out to the specified output stream.
 int size()
          Returns the number of elements in the list.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

cacheManagement

private java.util.Map<java.lang.String,ProxyCacheManagement> cacheManagement
key: is a proxy target identifier (ProxyTID)


targetToProxyTID

private java.util.HashMap<java.lang.String,java.lang.String> targetToProxyTID
Converts from a target to a proxyTID

Constructor Detail

ProxyCacheLogicalTargets

public ProxyCacheLogicalTargets()
Constructor of ProxyCacheLogicalTargets.

Method Detail

add

public void add(ProxyCacheManagement logicalTarget)
Appends the specific logical target to the list of logical targets.

Parameters:
logicalTarget - logical target to be appended to the list.

getByTID

public ProxyCacheManagement getByTID(java.lang.String tid)
Gets a logical target from the list. The logical target is idenfied by the target identifier (tid).

NOTICE: elmentents are not copied. Their reference is passed.

Parameters:
tid - definition in TargetField.target.
Returns:
an object which contains the logical target information. If the tid is not in the list, it returns null

getByTarget

public ProxyCacheManagement getByTarget(java.lang.String target)
Gets a logical target from the list. The logical target is idenfied by the target.

NOTICE: elmentents are not copied. Its reference is returned.

Parameters:
target - definition in TargetField.target.
Returns:
an object which contains the logical target information. If the target is not in the list, it returns null

getTarget

public ProxyCacheManagement getTarget(java.lang.String target,
                                      java.lang.String tid)
Gets a logical target from the list. The logical target is idenfied by the target and/or tid. If the target and tid parameters do not identify the same target an exception is thrown.

Parameters:
target - definition in TargetField.target.
tid - definition in TargetField.target.
Returns:
an object which contains the logical target information. If the target is not in the list, it returns null

equals

public boolean equals(java.lang.String target,
                      java.lang.String tid)
Check if the logical target identified

Parameters:
target - definition in TargetField.target.
tid - definition in TargetField.tid.
Returns:
true if the target belongs to the target identifier tid.

isEmpty

public boolean isEmpty()
Returns true if the list contains no elements. Otherwise, returns false.

Returns:
true if the list contains no elements.

size

public int size()
Returns the number of elements in the list.

Returns:
the number of elements in the list.

toString

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

list

public void list(java.io.PrintStream out)
Prints this Logical Target List fields 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)