org.jafer.registry.uddi
Class ServiceManager

java.lang.Object
  extended by org.jafer.registry.uddi.ServiceManager
All Implemented Interfaces:
ServiceManager

public class ServiceManager
extends java.lang.Object
implements ServiceManager

This class maps the service manager interface onto the UDDI registry.


Field Summary
 java.lang.String credential
          Stores a reference to the credential for logging on to publish service
protected static java.util.logging.Logger logger
          Stores a reference to the Logger
private  org.uddi4j.client.UDDIProxy registryConnection
          Stores a reference to the UDDI4J Proxy manager that communicates with the registry
private  TModelManager tModelManager
          Stores a reference to the TModelManager that loads and initialises all the required TModels.
 java.lang.String username
          Stores a reference to the username for logging on to publish service
 
Constructor Summary
ServiceManager(org.uddi4j.client.UDDIProxy registryConnection, TModelManager tModelManager, java.lang.String username, java.lang.String credential)
          Constructor for the service manger.
 
Method Summary
static org.uddi4j.datatype.binding.BindingTemplate createBindingTemplate(TModelManager tModelManager, java.lang.String serviceKey, Protocol protocol, java.lang.String accessPointURL, java.lang.String accessPointType)
          static function that creates a Binding Template ready for registering with the UBR.
private  org.uddi4j.datatype.binding.BindingTemplate createBindingTemplateForAccessPoint(java.lang.String serviceKey, Protocol protocol, java.lang.String accessPointURL, java.lang.String accessPointType)
          This method creates a binding template object in the registry so that it can be attached to the service
 Contact createNewContact(java.lang.String name)
          Creates a new service provider contact.
 Contact createNewContact(java.lang.String name, java.lang.String desc, java.lang.String phone, java.lang.String email)
          Creates a new contact object specifying all the contacts details.
 void deleteService(Service service)
          Deletes the specified service from the registry.
 void deleteService(ServiceInfo serviceInfo)
          Deletes the specified service from the registry.
 void deleteService(java.lang.String id)
          Deletes the specified service from the registry.
 void deleteServiceProvider(ServiceProvider provider)
          Deletes the service provider details in the registry.
 void deleteServiceProvider(ServiceProviderInfo providerInfo)
          Deletes the service provider details in the registry.
 void deleteServiceProvider(java.lang.String id)
          Deletes the service provider details in the registry.
private  void discardAuthorisationToken(java.lang.String token)
          Discard authorisation token
private  java.lang.String getAuthorisationToken()
          Obtain a new authorisation token
 Service registerService(ServiceProvider provider, java.lang.String serviceName)
          This method registers a new service against a service provider.
 Service registerService(ServiceProvider provider, java.lang.String serviceName, Protocol protocol, java.lang.String accessPoint)
          This method registers a new service against a service provider.
 ServiceProvider registerServiceProvider(java.lang.String providerName)
          This method registers a new Service Provider to the registry.
 Service updateService(Service service)
          Updates the specified service in the registry.
 ServiceProvider updateServiceProvider(ServiceProvider provider)
          Updates the service provider details to the registry.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

tModelManager

private TModelManager tModelManager
Stores a reference to the TModelManager that loads and initialises all the required TModels. It is expected to have already been initialised when it is used by this class


username

public java.lang.String username
Stores a reference to the username for logging on to publish service


credential

public java.lang.String credential
Stores a reference to the credential for logging on to publish service


registryConnection

private org.uddi4j.client.UDDIProxy registryConnection
Stores a reference to the UDDI4J Proxy manager that communicates with the registry


logger

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

Constructor Detail

ServiceManager

public ServiceManager(org.uddi4j.client.UDDIProxy registryConnection,
                      TModelManager tModelManager,
                      java.lang.String username,
                      java.lang.String credential)
               throws RegistryException,
                      InvalidAuthorisationDetailsException
Constructor for the service manger. The supplied username and credential will be used to obtain an authorisation token per call and an initial test will be done to make sure they are valid

Parameters:
registryConnection - The connection to the UDDI registry
tModelManager - The tmodel manager for the registry being accessed by this manager
username - The username of the user using the registry.
credential - The credential required to authenticate user
Throws:
RegistryException
InvalidAuthorisationDetailsException
Method Detail

getAuthorisationToken

private java.lang.String getAuthorisationToken()
                                        throws RegistryException,
                                               InvalidAuthorisationDetailsException
Obtain a new authorisation token

Returns:
The new authorisation token
Throws:
RegistryException
InvalidAuthorisationDetailsException

discardAuthorisationToken

private void discardAuthorisationToken(java.lang.String token)
                                throws RegistryException
Discard authorisation token

Parameters:
token - the token to discard
Throws:
RegistryExceptionImpl
RegistryException

createNewContact

public Contact createNewContact(java.lang.String name)
                         throws InvalidNameException,
                                InvalidLengthException
Creates a new service provider contact. The name of the contact must always be supplied and can not be a blank string.

Specified by:
createNewContact in interface ServiceManager
Parameters:
name - The new contacts name
Returns:
An instance of a contact
Throws:
InvalidNameException
InvalidLengthException

createNewContact

public Contact createNewContact(java.lang.String name,
                                java.lang.String desc,
                                java.lang.String phone,
                                java.lang.String email)
                         throws InvalidNameException,
                                InvalidLengthException
Creates a new contact object specifying all the contacts details. The name of the contact must always be supplied and can not be a blank string. All other details can be empty strings.

Specified by:
createNewContact in interface ServiceManager
Parameters:
name - The contacts name (Can not be blank)
desc - The contacts description
phone - The contacts phone number
email - The contacts email
Throws:
InvalidNameException
InvalidLengthException

registerServiceProvider

public ServiceProvider registerServiceProvider(java.lang.String providerName)
                                        throws InvalidNameException,
                                               InvalidAuthorisationDetailsException,
                                               RegistryException
This method registers a new Service Provider to the registry.

Specified by:
registerServiceProvider in interface ServiceManager
Parameters:
providerName - The name of the new service provider
Returns:
The created business entity
Throws:
InvalidNameException
RegistryException
InvalidAuthorisationDetailsException

updateServiceProvider

public ServiceProvider updateServiceProvider(ServiceProvider provider)
                                      throws InvalidAuthorisationDetailsException,
                                             RegistryException
Updates the service provider details to the registry. Any service objects obtained from the provider will be invalidated once this call completes.
Note: Be aware that providers and services only represent the details in the registry at a point in time of retrieval. The information contained in this provider will overright any other changes that may have been made to the registry since the provider was obtained.

Specified by:
updateServiceProvider in interface ServiceManager
Parameters:
provider - The service provider to update
Returns:
The updated service provider
Throws:
InvalidAuthorisationDetailsException
RegistryException

deleteServiceProvider

public void deleteServiceProvider(ServiceProvider provider)
                           throws InvalidAuthorisationDetailsException,
                                  RegistryException
Deletes the service provider details in the registry. Any attached services will also be deleted when the provider is removed.
Note:Any instances of provider or services will be invalidated by this call and should no longer be used. Updating them seperatly to the registry will cause a synchronisation error to be thrown

Specified by:
deleteServiceProvider in interface ServiceManager
Parameters:
provider - The service provider to delete
Throws:
InvalidAuthorisationDetailsException
RegistryException

deleteServiceProvider

public void deleteServiceProvider(ServiceProviderInfo providerInfo)
                           throws InvalidAuthorisationDetailsException,
                                  RegistryException
Deletes the service provider details in the registry. Any attached services will also be deleted when the provider is removed.
Note:Any instances of provider or services will be invalidated by this call and should no longer be used. Updating them seperatly to the registry will cause a synchronisation error to be thrown

Specified by:
deleteServiceProvider in interface ServiceManager
Parameters:
providerInfo - The service provider to delete
Throws:
InvalidAuthorisationDetailsException
RegistryException

deleteServiceProvider

public void deleteServiceProvider(java.lang.String id)
                           throws InvalidAuthorisationDetailsException,
                                  RegistryException
Deletes the service provider details in the registry. Any attached services will also be deleted when the provider is removed.
Note:Any instances of provider or services will be invalidated by this call and should no longer be used. Updating them seperatly to the registry will cause a synchronisation error to be thrown

Specified by:
deleteServiceProvider in interface ServiceManager
Parameters:
id - The id of the service provider to delete
Throws:
InvalidAuthorisationDetailsException
RegistryException

registerService

public Service registerService(ServiceProvider provider,
                               java.lang.String serviceName,
                               Protocol protocol,
                               java.lang.String accessPoint)
                        throws InvalidAuthorisationDetailsException,
                               RegistryException,
                               InvalidNameException
This method registers a new service against a service provider.

Note: The registered service will not be reflected in the supplied provider. The provider must be refreshed from the registry to see the new service.

Warning: If the provider is not refreshed any update to that provider will cause the service to be deleted

Specified by:
registerService in interface ServiceManager
Parameters:
provider - The business entity to register the service agianst
serviceName - The name of the service being registered
protocol - The protocol type for the access point (eg Z3950 or SRW)
accessPoint - The access point for the service. This can not be an empty string
Returns:
The updated business entity object
Throws:
InvalidAuthorisationDetailsException
RegistryException
InvalidNameException

registerService

public Service registerService(ServiceProvider provider,
                               java.lang.String serviceName)
                        throws InvalidAuthorisationDetailsException,
                               RegistryException,
                               InvalidNameException
This method registers a new service against a service provider.

Note: The registered service will not be reflected in the supplied provider. The provider must be refreshed from the registry to see the new service.

Warning: If the provider is not refreshed any update to that provider will cause the service to be deleted

Specified by:
registerService in interface ServiceManager
Parameters:
provider - The business entity to register the service agianst
serviceName - The name of the service being registered
Returns:
The updated business entity object
Throws:
InvalidAuthorisationDetailsException
RegistryException
InvalidNameException

updateService

public Service updateService(Service service)
                      throws InvalidAuthorisationDetailsException,
                             RegistryException
Updates the specified service in the registry.

Note:Any provider instances that contain a reference to this service need to be refreshed to obtain these updates. Subsequent updates of that provider if it was not refreshed would cause the updated changes to be reversed

Specified by:
updateService in interface ServiceManager
Parameters:
service - The service to update
Returns:
The updated service
Throws:
InvalidAuthorisationDetailsException
RegistryException

deleteService

public void deleteService(Service service)
                   throws InvalidAuthorisationDetailsException,
                          RegistryException
Deletes the specified service from the registry.

Note: Any instances of service providers that contain the deleted service will be invalidated by this call and need to be refreshed. Subsequent updates of that provider if it was not refreshed would cause a synchronisation error to be thrown

Specified by:
deleteService in interface ServiceManager
Parameters:
service - The service to delete
Throws:
InvalidAuthorisationDetailsException
RegistryException

deleteService

public void deleteService(ServiceInfo serviceInfo)
                   throws InvalidAuthorisationDetailsException,
                          RegistryException
Deletes the specified service from the registry.

Note: Any instances of service providers that contain the deleted service will be invalidated by this call and need to be refreshed. Subsequent updates of that provider if it was not refreshed would cause a synchronisation error to be thrown

Specified by:
deleteService in interface ServiceManager
Parameters:
serviceInfo - The service to delete
Throws:
InvalidAuthorisationDetailsException
RegistryException

deleteService

public void deleteService(java.lang.String id)
                   throws InvalidAuthorisationDetailsException,
                          RegistryException
Deletes the specified service from the registry.

Note: Any instances of service providers that contain the deleted service will be invalidated by this call and need to be refreshed. Subsequent updates of that provider if it was not refreshed would cause a synchronisation error to be thrown

Specified by:
deleteService in interface ServiceManager
Parameters:
id - The id of the service to delete
Throws:
InvalidAuthorisationDetailsException
RegistryException

createBindingTemplateForAccessPoint

private org.uddi4j.datatype.binding.BindingTemplate createBindingTemplateForAccessPoint(java.lang.String serviceKey,
                                                                                        Protocol protocol,
                                                                                        java.lang.String accessPointURL,
                                                                                        java.lang.String accessPointType)
                                                                                 throws InvalidAuthorisationDetailsException,
                                                                                        RegistryException
This method creates a binding template object in the registry so that it can be attached to the service

Parameters:
serviceKey - The service to attach the binding template to
protocol - The protocol type Z3950, SRW for tmodels
accessPointURL - The url to the access point
accessPointType - The type of access point endpoint or wsdl file
Returns:
The instance of the binding template
Throws:
InvalidAuthorisationDetailsException
RegistryException

createBindingTemplate

public static org.uddi4j.datatype.binding.BindingTemplate createBindingTemplate(TModelManager tModelManager,
                                                                                java.lang.String serviceKey,
                                                                                Protocol protocol,
                                                                                java.lang.String accessPointURL,
                                                                                java.lang.String accessPointType)
                                                                         throws RegistryException
static function that creates a Binding Template ready for registering with the UBR. This is not exposed on the interface to the caller and therefore should not be used outside of this framework.

Parameters:
serviceKey - The service to attach the binding template to
protocol - The protocol type Z3950, SRW for tmodels
accessPointURL - The url to the access point
accessPointType - The type of access point endpoint or wsdl file
Returns:
The instance of the binding template
Throws:
RegistryException