uk.org.toot.service
Class ServiceProvider

java.lang.Object
  extended by uk.org.toot.service.ServiceProvider
Direct Known Subclasses:
AudioServerServiceProvider, AudioServerUIServiceProvider, AudioServiceProvider, ControlPanelServiceProvider, SynthChannelServiceProvider, SynthServiceProvider

public abstract class ServiceProvider
extends java.lang.Object

An abstract ServiceProvider. Extend this class for specific subject domains.


Constructor Summary
ServiceProvider(int providerId, java.lang.String providerName, java.lang.String description, java.lang.String version)
          Constructs an ServiceProvider with a given provider name and version identifier.
 
Method Summary
 void accept(ServiceVisitor v, java.lang.Class<?> clazz)
          Accepts a ServiceVisitor to visit all or specific services.
 java.lang.String getDescription(java.util.Locale locale)
          Returns a brief, human-readable description of this service provider and its associated implementation.
 int getProviderId()
          Constructs a blank ServiceProvider.
 java.lang.String getProviderName()
          Returns the name of the provider responsible for creating this service provider and its associated implementation.
 java.lang.String getVersion()
          Returns a string describing the version number of this service provider and its associated implementation.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ServiceProvider

public ServiceProvider(int providerId,
                       java.lang.String providerName,
                       java.lang.String description,
                       java.lang.String version)
Constructs an ServiceProvider with a given provider name and version identifier.

Parameters:
providerName - the provider name.
version - a version identifier.
Throws:
java.lang.IllegalArgumentException - if providerName is null.
java.lang.IllegalArgumentException - if version is null.
Method Detail

getProviderId

public int getProviderId()
Constructs a blank ServiceProvider. It is up to the subclass to initialize instance variables and/or override method implementations in order to ensure that the getProviderName and getVersion methods will return non-null values.


getProviderName

public java.lang.String getProviderName()
Returns the name of the provider responsible for creating this service provider and its associated implementation. Because the provider name may be used to select a service provider, it is not localized.

The default implementation returns the value of the providerName instance variable.

Returns:
a non-null String containing the name of the provider.

getVersion

public java.lang.String getVersion()
Returns a string describing the version number of this service provider and its associated implementation. Because the version may be used by transcoders to identify the service providers they understand, this method is not localized.

The default implementation returns the value of the version instance variable.

Returns:
a non-null String containing the version of this service provider.

getDescription

public java.lang.String getDescription(java.util.Locale locale)
Returns a brief, human-readable description of this service provider and its associated implementation. The resulting string should be localized for the supplied Locale, if possible.

Parameters:
locale - a Locale for which the return value should be localized.
Returns:
a String containing a description of this service provider.

accept

public void accept(ServiceVisitor v,
                   java.lang.Class<?> clazz)
Accepts a ServiceVisitor to visit all or specific services. If clazz is null all services are visited, otherwise the services specified by clazz are visited,


toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object


Copyright © 2004, 2005, 2006, 2007 Steve Taylor. All Rights Reserved.