org.jppf.server.scheduler.bundle.spi
Class JPPFBundlerFactory

java.lang.Object
  extended by org.jppf.server.scheduler.bundle.spi.JPPFBundlerFactory

public class JPPFBundlerFactory
extends Object

Factory class for JPPF load-balancing algorithms defined through the JPPFBundlerProvider service provider interface.

Author:
Laurent Cohen

Constructor Summary
JPPFBundlerFactory()
           
 
Method Summary
 TypedProperties convertJPPFConfiguration(String profileName, TypedProperties configuration)
          Convert a JPPF confgiguration map to a profile configuration by extracting the properties related to the specified profile and removing the JPPF-specific prefix from their name.
 Bundler createBundler(String name, TypedProperties configuration)
          Create an instance of the bundler with the specified name and parameters.
 Bundler createBundlerFromJPPFConfiguration()
          Create an instance of the bundler such as specified in the JPPF configuration file.
 TypedProperties extractJPPFConfiguration(String profileName, TypedProperties configuration)
          Extract the JPPF-prefixed load-balancing parameters from the specified configuration and based on the specified profile name.
 JPPFBundlerProvider getBundlerProvider(String name)
          Get the bundler provider with the specified name.
 List<String> getBundlerProviderNames()
          Get the names of all discovered bundler providers.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JPPFBundlerFactory

public JPPFBundlerFactory()
Method Detail

createBundler

public Bundler createBundler(String name,
                             TypedProperties configuration)
                      throws Exception
Create an instance of the bundler with the specified name and parameters.

Parameters:
name - the name of the bundler's algorithm, such as specified in the bundler provider and in the configuration.
configuration - a map of alogrithm parameters to their value.
Returns:
a new Bundler instance.
Throws:
Exception - if the bundler could not be created.

createBundlerFromJPPFConfiguration

public Bundler createBundlerFromJPPFConfiguration()
                                           throws Exception
Create an instance of the bundler such as specified in the JPPF configuration file.

Returns:
a new Bundler instance.
Throws:
Exception - if the bundler could not be created.

getBundlerProvider

public JPPFBundlerProvider getBundlerProvider(String name)
                                       throws Exception
Get the bundler provider with the specified name.
This method will trigger a lazy loading of the providers if they haven't been loaded yet.

Parameters:
name - the name of the bundler provider to retrieve.
Returns:
a JPPFBundlerProvider instance or null if the provider could not be found.
Throws:
Exception - if any error occurs while loading the providers.

getBundlerProviderNames

public List<String> getBundlerProviderNames()
                                     throws Exception
Get the names of all discovered bundler providers.

Returns:
a list of provider names.
Throws:
Exception - if any error occurs while loading the providers.

convertJPPFConfiguration

public TypedProperties convertJPPFConfiguration(String profileName,
                                                TypedProperties configuration)
Convert a JPPF confgiguration map to a profile configuration by extracting the properties related to the specified profile and removing the JPPF-specific prefix from their name.

Parameters:
profileName - - the name of the profile to extract.
configuration - - the JPPF configuration to extract from.
Returns:
a TypedProperties instance containing only the profile-specific parameters.

extractJPPFConfiguration

public TypedProperties extractJPPFConfiguration(String profileName,
                                                TypedProperties configuration)
Extract the JPPF-prefixed load-balancing parameters from the specified configuration and based on the specified profile name.

Parameters:
profileName - - the name of the profile to extract.
configuration - - the JPPF configuration to extract from.
Returns:
a TypedProperties instance containing only the profile-specific parameters.


Copyright © 2005-2010 JPPF Team.