org.jafer.registry.uddi
Class TModelManager

java.lang.Object
  extended by org.jafer.registry.uddi.TModelManager

public class TModelManager
extends java.lang.Object

This class manages TModel instances in the registry it is connected to. These have to be initialised first for the user to perform any operations on service providers and their services. The TModels implement the registry protocol and category concepts. In order to create missing tmodels a user name and credential is required. Some applications do not want to expose these to the user hence the TModelManager can be created in two modes.

Read only - The manager will only attempt to load the tmodels throwing a RegistryNotInitialisedException if expected models are not found
Create - The manager will load and create any tmodels that are missing.


Field Summary
static java.lang.String CATEGORY_DDC
          Stores a reference to the DDC TMODEL key.
static java.lang.String CATEGORY_GENERAL_KEYWORDS
          Stores a reference to the general keywords TMODEL key.
static java.lang.String CATEGORY_LCSH
          Stores a reference to the LCSH TMODEL key.
protected static java.util.logging.Logger logger
          Stores a reference to the Logger
static java.lang.String PROTOCOL_SRW
          Stores a reference to the SRW TMODEL key.
static java.lang.String PROTOCOL_Z3950
          Stores a reference to the Z3950 TMODEL key.
static java.lang.String TMODEL_CONFIG_FILE
          Stores a reference to the configuration file location
private  java.util.HashMap tModels
          Stores a reference to the cache of available TModels.
 
Constructor Summary
TModelManager(org.uddi4j.client.UDDIProxy registryConnection)
          This constructor assumes that all TModels are set up already in the registry and hence searches to find the required keys only.
TModelManager(org.uddi4j.client.UDDIProxy registryConnection, java.lang.String username, java.lang.String credential)
          This constructor assumes that all TModels are not set up in the registry and hence attempts to define them if it is unable to locate them first.
 
Method Summary
private  void buildTModelCache(org.uddi4j.client.UDDIProxy registryConnection, java.lang.String username, java.lang.String credential, boolean createIfNotFound)
          This method is responsible for building the cache of available TMOdels.
private  TModel createJaferTModel(org.uddi4j.client.UDDIProxy registryConnection, java.lang.String username, java.lang.String credential, boolean createIfNotFound, org.w3c.dom.Node jaferTModelNode)
          Creates a complete Jafer TModel that encapsulates the set of defined UDDI TModels.
 TModel getCategoryTModel(CategoryType categoryType)
          This method returns a TModel representing the category type
 TModel getProtocolTModel(Protocol protocol)
          This method returns a TModel representing the protocol
 TModel getTModel(java.lang.String tModelName)
          Gets the specified TModel instance
private  org.uddi4j.datatype.tmodel.TModel publishTModel(org.uddi4j.client.UDDIProxy registryConnection, java.lang.String username, java.lang.String credential, java.lang.String name, java.lang.String description, java.lang.String docURL)
          This method creates the TModel in the registry and then returns it.
private  org.uddi4j.datatype.tmodel.TModel retrieveTModel(org.uddi4j.client.UDDIProxy registryConnection, java.lang.String key)
          This method creates the TModel by retrieving it from the UDDI registry
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

PROTOCOL_Z3950

public static final java.lang.String PROTOCOL_Z3950
Stores a reference to the Z3950 TMODEL key. This key must map exactly to a jafertmodel in the tmodels.xml configuration file.

See Also:
Constant Field Values

PROTOCOL_SRW

public static final java.lang.String PROTOCOL_SRW
Stores a reference to the SRW TMODEL key. This key must map exactly to a jafertmodel in the tmodels.xml configuration file.

See Also:
Constant Field Values

CATEGORY_DDC

public static final java.lang.String CATEGORY_DDC
Stores a reference to the DDC TMODEL key. This key must map exactly to a jafertmodel in the tmodels.xml configuration file.

See Also:
Constant Field Values

CATEGORY_LCSH

public static final java.lang.String CATEGORY_LCSH
Stores a reference to the LCSH TMODEL key. This key must map exactly to a jafertmodel in the tmodels.xml configuration file.

See Also:
Constant Field Values

CATEGORY_GENERAL_KEYWORDS

public static final java.lang.String CATEGORY_GENERAL_KEYWORDS
Stores a reference to the general keywords TMODEL key. This key must map exactly to a jafertmodel in the tmodels.xml configuration file.

See Also:
Constant Field Values

TMODEL_CONFIG_FILE

public static final java.lang.String TMODEL_CONFIG_FILE
Stores a reference to the configuration file location

See Also:
Constant Field Values

logger

protected static java.util.logging.Logger logger
Stores a reference to the Logger


tModels

private java.util.HashMap tModels
Stores a reference to the cache of available TModels.

Constructor Detail

TModelManager

public TModelManager(org.uddi4j.client.UDDIProxy registryConnection)
              throws RegistryNotInitialisedException,
                     RegistryException
This constructor assumes that all TModels are set up already in the registry and hence searches to find the required keys only. All keys must be found for construction to complete succesfully. It is provided to allow callers to initialise seperatley to their application so that user names and credentials do not have to be supplied when only providing a search interface.

Parameters:
registryConnection - The instance to use to comunicate with the registry
Throws:
RegistryNotInitialisedException
RegistryException

TModelManager

public TModelManager(org.uddi4j.client.UDDIProxy registryConnection,
                     java.lang.String username,
                     java.lang.String credential)
              throws RegistryException,
                     InvalidAuthorisationDetailsException
This constructor assumes that all TModels are not set up in the registry and hence attempts to define them if it is unable to locate them first.

Parameters:
registryConnection - The connection to the UDDI registry
username - The username of the user using the registry.
credential - The credential required to authenticate user
Throws:
RegistryNotInitialisedException - Signifies the registry has not been pre-initialised
RegistryInitialisationException
InvalidAuthorisationDetailsException
RegistryException
Method Detail

getTModel

public TModel getTModel(java.lang.String tModelName)
Gets the specified TModel instance

Parameters:
tModelName - The name of the TModel required
Returns:
The required TModel or NULL if it does not exist in cache

getCategoryTModel

public TModel getCategoryTModel(CategoryType categoryType)
                         throws RegistryException
This method returns a TModel representing the category type

Parameters:
categoryType - The category type to check against
Returns:
The TModel instance
Throws:
RegistryException

getProtocolTModel

public TModel getProtocolTModel(Protocol protocol)
                         throws RegistryException
This method returns a TModel representing the protocol

Parameters:
protocol - The protocol type to check against
Returns:
The TModel instance
Throws:
RegistryException

buildTModelCache

private void buildTModelCache(org.uddi4j.client.UDDIProxy registryConnection,
                              java.lang.String username,
                              java.lang.String credential,
                              boolean createIfNotFound)
                       throws RegistryNotInitialisedException,
                              RegistryException,
                              InvalidAuthorisationDetailsException
This method is responsible for building the cache of available TMOdels. It uses the tmodels.xml configuration file to specify the TModels it should search for as the construction information required if it is not found. This method will only create TModels if they are not found and the create if not found flag has been set.

Parameters:
registryConnection - The connection to the UDDI registry
username - The username of the user using the registry.
credential - The credential required to authenticate user
createIfNotFound - Flag to indicate if the the TModel should be created if not found
Throws:
RegistryNotInitialisedException
RegistryExceptionImpl
InvalidAuthorisationDetailsException
RegistryException

createJaferTModel

private TModel createJaferTModel(org.uddi4j.client.UDDIProxy registryConnection,
                                 java.lang.String username,
                                 java.lang.String credential,
                                 boolean createIfNotFound,
                                 org.w3c.dom.Node jaferTModelNode)
                          throws RegistryNotInitialisedException,
                                 RegistryException,
                                 JaferException,
                                 InvalidAuthorisationDetailsException
Creates a complete Jafer TModel that encapsulates the set of defined UDDI TModels.

Parameters:
registryConnection - The connection to the UDDI registry
username - The username of the user using the registry.
credential - The credential required to authenticate user
createIfNotFound - Flag to indicate if the the TModel should be created if not found
jaferTModelNode - The XML node representing a jafer tmodel in the configuration file
Returns:
The jafer TModel that encapsulates the UDDI TModels
Throws:
RegistryNotInitialisedException
RegistryExceptionImpl
JaferException
InvalidAuthorisationDetailsException
RegistryException

publishTModel

private org.uddi4j.datatype.tmodel.TModel publishTModel(org.uddi4j.client.UDDIProxy registryConnection,
                                                        java.lang.String username,
                                                        java.lang.String credential,
                                                        java.lang.String name,
                                                        java.lang.String description,
                                                        java.lang.String docURL)
                                                 throws RegistryException,
                                                        InvalidAuthorisationDetailsException
This method creates the TModel in the registry and then returns it.

Parameters:
registryConnection - The connection to the UDDI registry
username - The username of the user using the registry.
credential - The credential required to authenticate user
name - The name of the model to create
description - the description of the model to create
docURL - The url to the tmodel overview document
Returns:
The fully created TModel from the UDDI registry
Throws:
RegistryExceptionImpl
InvalidAuthorisationDetailsException
RegistryException

retrieveTModel

private org.uddi4j.datatype.tmodel.TModel retrieveTModel(org.uddi4j.client.UDDIProxy registryConnection,
                                                         java.lang.String key)
                                                  throws RegistryException
This method creates the TModel by retrieving it from the UDDI registry

Parameters:
registryConnection - The connection to the UDDI registry
key - The key for the TModel
Returns:
The fully created TModel from the UDDI registry
Throws:
RegistryExceptionImpl
RegistryException