org.apache.directory.shared.ldap.message.spi
Class Provider

java.lang.Object
  extended byorg.apache.directory.shared.ldap.message.spi.Provider
Direct Known Subclasses:
TwixProvider

public abstract class Provider
extends java.lang.Object

Abstract Provider base class and factory for accessing berlib specific Provider implementations and their SPI implementation classes.

Version:
$Revision: 379008 $
Author:
Alex Karasulu, $Author: akarasulu $

Field Summary
static java.lang.String BERLIB_PROPFILE
          The default file searched for on CP to load default provider props.
static java.lang.String BERLIB_PROVIDER
          BER Library provider class name property
static java.lang.String DEFAULT_PROVIDER
          Default BER Library provider class name
static java.lang.String PROVIDER_MONITOR_KEY
          A provider monitor key.
static java.lang.String USING_DEFAULTS_MSG
          Message to use when using defaults
 
Constructor Summary
protected Provider(java.lang.String name, java.lang.String vendor)
          Creates an instance of a Provider.
 
Method Summary
abstract  ProviderDecoder getDecoder(java.util.Set binaries)
          Gets the decoder associated with this provider.
abstract  ProviderEncoder getEncoder()
          Gets the encoder associated with this provider.
static java.util.Properties getEnvironment()
          Loads the properties for the effective environment.
 java.lang.String getName()
          Gets the descriptive name for this Provider.
static Provider getProvider()
          Gets an instance of the configured Provider.
static Provider getProvider(java.util.Hashtable a_env)
          Gets an instance of the Provider specified by the asn.1.berlib.provider property value.
abstract  TransformerSpi getTransformer()
          Gets the transformer associated with this provider.
 java.lang.String getVendor()
          Gets this Providers vendor name if it was provided.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_PROVIDER

public static final java.lang.String DEFAULT_PROVIDER
Default BER Library provider class name

See Also:
Constant Field Values

BERLIB_PROVIDER

public static final java.lang.String BERLIB_PROVIDER
BER Library provider class name property

See Also:
Constant Field Values

BERLIB_PROPFILE

public static final java.lang.String BERLIB_PROPFILE
The default file searched for on CP to load default provider props.

See Also:
Constant Field Values

PROVIDER_MONITOR_KEY

public static final java.lang.String PROVIDER_MONITOR_KEY
A provider monitor key.

See Also:
Constant Field Values

USING_DEFAULTS_MSG

public static final java.lang.String USING_DEFAULTS_MSG
Message to use when using defaults

Constructor Detail

Provider

protected Provider(java.lang.String name,
                   java.lang.String vendor)
Creates an instance of a Provider.

Parameters:
name - a descriptive name for a provider
vendor - the berlib vendor used by the provider
Method Detail

getName

public final java.lang.String getName()
Gets the descriptive name for this Provider.

Returns:
the Provider's name.

getVendor

public final java.lang.String getVendor()
Gets this Providers vendor name if it was provided.

Returns:
the vendor name for this provider or the String 'UNKNOWN' if it is not known.

getEncoder

public abstract ProviderEncoder getEncoder()
                                    throws ProviderException
Gets the encoder associated with this provider.

Returns:
the provider's encoder.
Throws:
ProviderException - if the provider or its encoder cannot be found

getDecoder

public abstract ProviderDecoder getDecoder(java.util.Set binaries)
                                    throws ProviderException
Gets the decoder associated with this provider.

Returns:
the provider's decoder.
Throws:
ProviderException - if the provider or its decoder cannot be found

getTransformer

public abstract TransformerSpi getTransformer()
                                       throws ProviderException
Gets the transformer associated with this provider.

Returns:
the provider's transformer.
Throws:
ProviderException - if the provider or its transformer cannot be found

getProvider

public static Provider getProvider()
                            throws ProviderException
Gets an instance of the configured Provider. The configured provider is the classname specified by the asn.1.berlib.provider property. The property is searched for within berlib.properties files that are on the java.class.path. If at least one berlib.properties is not found the default provider is used. The resultant value (default or otherwise) for the property can be overridden by command line properties.

Returns:
a singleton instance of the configured ASN.1 BER Library Provider
Throws:
ProviderException - if the provider cannot be found

getProvider

public static Provider getProvider(java.util.Hashtable a_env)
                            throws ProviderException
Gets an instance of the Provider specified by the asn.1.berlib.provider property value. The property is searched for within properties object passed in as a parameter for this method only.

Parameters:
a_env - the environment used to locate the provider
Returns:
a singleton instance of the ASN.1 BER Library Provider
Throws:
ProviderException - if the provider cannot be found

getEnvironment

public static java.util.Properties getEnvironment()
Loads the properties for the effective environment. First searches class path for the default berlib.properties file. If it cannot find the file on the classpath it loads the defaults in the default berlib.properties file found in $JAVA_HOME/lib/berlib.properties. If the default file is not found and no berlib.properties are found on the classpath then the default provider is used. Once the property is set overriding values are searched for in the System's properties specified at startup using the -Dproperty=valuejava command-line arguments.

Returns:
the environment properties TODO why are we not throwing ProviderExceptions here?


Copyright © 2003-2006 . All Rights Reserved.