org.griphyn.vdl.planner
Class Catalog

java.lang.Object
  extended byorg.griphyn.vdl.planner.Catalog

public class Catalog
extends Object

This class looks up in the transformation catalog and replica catalog. Both catalogs look similar, thus the same code is "recycled" for it.

Version:
$Revision: 1.6 $
Author:
Jens-S. V�ckler, Yong Zhao

Nested Class Summary
protected  class Catalog.Items
          Internal class to abstract the entries in a catalog.
 
Field Summary
private  String m_catName
          Name of the catalog.
private  String m_pool
          Name of the pool -- always local for the shell planner.
private  HashMap m_poolMap
          Contains the mapping from a logical TR to the physical app, or from the logical filename to the physical filename.
 
Constructor Summary
Catalog(String catName)
          Initializes the catalog with the file that contains it.
Catalog(String catName, String pool)
          Initializes the catalog location and default resource handle.
 
Method Summary
 boolean addEntry(String pool, String lfn, String pfn)
          Adds a triple to the catalog.
 void dump()
          Overwrites the existing (or not existing) catalogs with the new content in main memory.
 String getName()
          Gets the file location of the catalog.
private  void initialize()
          Reads the catalog and stores mappings in the internal map.
 String lookup_env(String pool, String lfn)
          Find the environment string for a logical entity.
 String lookup(String pool, String lfn)
          Find the physical entity for a logical entity and resource.
 String toString()
          Shows the contents of the in-memory catalog as one string.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

m_catName

private String m_catName
Name of the catalog.


m_pool

private String m_pool
Name of the pool -- always local for the shell planner.


m_poolMap

private HashMap m_poolMap
Contains the mapping from a logical TR to the physical app, or from the logical filename to the physical filename.

Constructor Detail

Catalog

public Catalog(String catName)
Initializes the catalog with the file that contains it.

Parameters:
catName - is the location of the catalog.

Catalog

public Catalog(String catName,
               String pool)
Initializes the catalog location and default resource handle.

Parameters:
catName - is the location of the catalog file.
pool - is the default resource handle (site).
Method Detail

initialize

private void initialize()
Reads the catalog and stores mappings in the internal map.


lookup

public String lookup(String pool,
                     String lfn)
Find the physical entity for a logical entity and resource.

Parameters:
pool - is the pool name.
lfn - is the logical entity to look up.
Returns:
the physical entity, or null if not found.

lookup_env

public String lookup_env(String pool,
                         String lfn)
Find the environment string for a logical entity. This only applies to a transformation catalog.

Parameters:
pool - is the pool name.
lfn - is the logical entity to look up.
Returns:
the physical entity, or null if not found.

addEntry

public boolean addEntry(String pool,
                        String lfn,
                        String pfn)
Adds a triple to the catalog.

Parameters:
pool - is the resource handle, should be "local".
lfn - is the logical entity
pfn - is the physical entity
Returns:
true, if something was added, false otherwise.

getName

public String getName()
Gets the file location of the catalog.

Returns:
the file location where the catalog is stored.

dump

public void dump()
          throws IOException
Overwrites the existing (or not existing) catalogs with the new content in main memory. Warning, this will probably break for parallel writes.

Throws:
IOException

toString

public String toString()
Shows the contents of the in-memory catalog as one string.

Returns:
the string with the complete catalog contents.


Copyright © 2003 The University of Chicago and The University of Southern California. All Rights Reserved.