au.edu.archer.services.icat
Class ClientLocationPair

java.lang.Object
  extended by au.edu.archer.services.icat.ClientLocationPair

public class ClientLocationPair
extends java.lang.Object

Contains a pairing of a location identifying a storage resource and a client which is configured to access the resource.

The ClientLocationPair also provides a registry for paths of interest on the storage resource identified by location and will call the registerPaths() and deregisterPaths() methods of the client as paths are added and removed.

The registry uses reference counting to ensure that no paths are deregistered early or re-registered unnecessarily.


Constructor Summary
ClientLocationPair()
          Creates a new ClientLocationPair, with the client and location set to null.
 
Method Summary
 void addPath(java.lang.String path, boolean updatePathRegistration)
          Adds a path to the registry and optionally updates the client.
 au.edu.jcu.hpc.srb.mcatext.client.Client getClient()
          Returns the client.
 java.lang.String getLocation()
          Gets the location.
 java.util.List<java.lang.String> getPaths()
          Returns the registered paths.
 boolean hasPath(java.lang.String path)
          Returns whether a path is registered with this ClientLocationPair.
 void registerPaths()
          Registers the paths in the registry with the client.
 void removePath(java.lang.String path, boolean updatePathRegistration)
          Removes a path from the registry and optionally updates the client.
 void setClient(au.edu.jcu.hpc.srb.mcatext.client.Client client)
          Sets the client.
 void setLocation(java.lang.String location)
          Sets the location.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ClientLocationPair

public ClientLocationPair()
Creates a new ClientLocationPair, with the client and location set to null.

Method Detail

setClient

public void setClient(au.edu.jcu.hpc.srb.mcatext.client.Client client)
Sets the client.

Parameters:
client - the client.

getClient

public au.edu.jcu.hpc.srb.mcatext.client.Client getClient()
Returns the client.

Returns:
the client.

setLocation

public void setLocation(java.lang.String location)
Sets the location.

The location parameter should fully identify the resource. For instance, when dealing with a location on an srb resource we'd expect the location to be of the form srb://[hostname]/[path to location in the srb instance].

Parameters:
location - the location.

getLocation

public java.lang.String getLocation()
Gets the location.

The location parameter fully identifies the resource. For instance, when dealing with a location on an srb resource we'd expect the location to be of the form srb://[hostname]/[path to location in the srb instance].

Returns:
the location.

hasPath

public boolean hasPath(java.lang.String path)
Returns whether a path is registered with this ClientLocationPair.

Parameters:
path - the path to check the registry for.
Returns:
whether a path is registerd.

addPath

public void addPath(java.lang.String path,
                    boolean updatePathRegistration)
Adds a path to the registry and optionally updates the client.

A reference to path is added to the path registry. If the path is already in the path registry then its reference count is increased. If the path was not in the path registry, updatePathRegistration is true and the client is not null then the path will be registered for the client.

Parameters:
path - the path to add to the path registry.
updatePathRegistration - whether to update the client.

removePath

public void removePath(java.lang.String path,
                       boolean updatePathRegistration)
Removes a path from the registry and optionally updates the client.

A reference to path is removed from the path registry. If there are other references in the path registry then its reference count is decreased. If there are no other references to the path in the path registry, updatePathRegistration is true and the client is not null then the path will be deregistered for the client.

Parameters:
path - the path to remove from the path registry.
updatePathRegistration - whether to update the client.

registerPaths

public void registerPaths()
Registers the paths in the registry with the client.

If the client is not null, registers the paths that have been added to this ClientLocationPair with the client. All paths registered at the client will be deregistered first, so after this method is called the paths in this ClientLocationPair will be the only paths registered with the client.


getPaths

public java.util.List<java.lang.String> getPaths()
Returns the registered paths.

Returns:
the registered paths.


Copyright © 2008 ARCHER - James Cook University. All Rights Reserved.