maiolum.xml
Class TemplatesPool

java.lang.Object
  extended byjava.util.Dictionary
      extended byjava.util.Hashtable
          extended bymaiolum.xml.TemplatesPool
All Implemented Interfaces:
java.lang.Cloneable, java.util.Map, java.io.Serializable

public class TemplatesPool
extends java.util.Hashtable

"Set"-like container for Templates instanced. This class extends standard Hashtable for storing (ID, Template) pairs. However, the storage is implemented in following manner: the pairs should be added to the pool using the add() methods - when in pool already exists a Templates object associated with specified ID, this object is returned by the add() method (i. e. no new Template object is created);. If it is required to reassign a Template object to given ID in the pool, either methods remove()() followed by add() method should be used, or you can use the Hashtable put() method.

See Also:
Serialized Form

Constructor Summary
TemplatesPool()
          Constructs new empty TemplatesPool.
 
Method Summary
 javax.xml.transform.Templates add(java.lang.String ID, java.lang.String xslID)
          Adds new Templates - based on the URI given in the first parameter - to the pool, with ID as the key.
 javax.xml.transform.Templates add(java.lang.String ID, javax.xml.transform.Templates t)
          Adds new Templates - the pool, with ID as the key.
 void clear()
          Removes all objects from the pool.
 boolean containsURI(java.lang.String URI)
          Checks, if any Templates based on the file with String URI parameter is in the pool.
 javax.xml.transform.Templates get(java.lang.String ID)
          Returns Template with given ID from the pool.
static void main(java.lang.String[] args)
           
 javax.xml.transform.Templates remove(java.lang.String ID)
          Removes the Template with given ID from the pool, if such Template exists.
 
Methods inherited from class java.util.Hashtable
clone, contains, containsKey, containsValue, elements, entrySet, equals, get, hashCode, isEmpty, keys, keySet, put, putAll, remove, size, toString, values
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

TemplatesPool

public TemplatesPool()
Constructs new empty TemplatesPool.

Method Detail

add

public javax.xml.transform.Templates add(java.lang.String ID,
                                         java.lang.String xslID)
                                  throws ParseException
Adds new Templates - based on the URI given in the first parameter - to the pool, with ID as the key. The Template is based on the XSLT template located in the file specified by the second String parameter.

Throws:
ParseException

add

public javax.xml.transform.Templates add(java.lang.String ID,
                                         javax.xml.transform.Templates t)
                                  throws ParseException
Adds new Templates - the pool, with ID as the key.

Throws:
ParseException

get

public javax.xml.transform.Templates get(java.lang.String ID)
Returns Template with given ID from the pool.

Returns:
null if no Template associated with given ID exists in pool.
Throws:
java.lang.NullPointerException - if String argument is null.

remove

public javax.xml.transform.Templates remove(java.lang.String ID)
Removes the Template with given ID from the pool, if such Template exists.

Returns:
the Template object with specified ID, which was removed from the pool, or null, if no such Template existed.

clear

public void clear()
Removes all objects from the pool.


containsURI

public boolean containsURI(java.lang.String URI)
Checks, if any Templates based on the file with String URI parameter is in the pool.

Returns:
true if there is Templates with given URL; false otherwise.

main

public static void main(java.lang.String[] args)
                 throws java.lang.Exception
Throws:
java.lang.Exception