Documentation Home
MySQL NDB Cluster API Developer Guide
Related Documentation Download this Manual
PDF (US Ltr) - 3.6Mb
PDF (A4) - 3.6Mb


4.3.1.8 ClusterJHelper

ClusterJHelper provides helper methods to bridge between the API and the implementation.

4.3.1.8.1 Synopsis
 public class ClusterJHelper {
// Public Constructors  public ClusterJHelper();
// Public Static Methods  public static boolean getBooleanProperty(String propertyName,
                                           String def);

  public static getServiceInstance(Class<T> cls);
  public static getServiceInstance(Class<T> cls,
                                     ClassLoader loader);

  public static getServiceInstance(Class<T> cls,
                                     String implementationClassName);

  public static getServiceInstance(Class<T> cls,
                                     String implementationClassName,
                                     ClassLoader loader);

  public static List<T> getServiceInstances(Class<T> cls,
                                            ClassLoader loader,
                                            StringBuffer errorMessages);

  public static SessionFactory getSessionFactory(Map props);
  public static SessionFactory getSessionFactory(Map props,
                                                 ClassLoader loader);

  public static String getStringProperty(String propertyName,
                                         String def);

  public static Dbug newDbug();
}

Methods inherited from java.lang.Object: equals , getClass , hashCode , notify , notifyAll , toString , wait

4.3.1.8.2 getBooleanProperty(String, String)
public static boolean getBooleanProperty(String propertyName,
                                         String def);

Get the named boolean property from either the environment or system properties. If the property is not 'true' then return false.

Table 4.5 getBooleanProperty(String, String)

Parameter Description
propertyName the name of the property
def the default if the property is not set
return the system property if it is set via -D or the system environment

4.3.1.8.3 getServiceInstance(Class<T>)
public static getServiceInstance(Class<T> cls);

Locate a service implementation by services lookup of the context class loader.

Table 4.6 getServiceInstance(Class<T>)

Parameter Description
cls the class of the factory
return the service instance

4.3.1.8.4 getServiceInstance(Class<T>, ClassLoader)
public static getServiceInstance(Class<T> cls,
                                   ClassLoader loader);

Locate a service implementation for a service by services lookup of a specific class loader. The first service instance found is returned.

Table 4.7 getServiceInstance(Class<T>, ClassLoader)

Parameter Description
cls the class of the factory
loader the class loader for the factory implementation
return the service instance

4.3.1.8.5 getServiceInstance(Class<T>, String)
public static getServiceInstance(Class<T> cls,
                                   String implementationClassName);

Locate a service implementation for a service. If the implementation name is not null, use it instead of looking up. If the implementation class is not loadable or does not implement the interface, throw an exception. Use the ClusterJHelper class loader to find the service.

Table 4.8 getServiceInstance(Class<T>, String)

Parameter Description
cls

implementationClassName

return the implementation instance for a service

4.3.1.8.6 getServiceInstance(Class<T>, String, ClassLoader)
public static getServiceInstance(Class<T> cls,
                                   String implementationClassName,
                                   ClassLoader loader);

Locate a service implementation for a service. If the implementation name is not null, use it instead of looking up. If the implementation class is not loadable or does not implement the interface, throw an exception.

Table 4.9 getServiceInstance(Class<T>, String, ClassLoader)

Parameter Description
cls

implementationClassName name of implementation class to load
loader the ClassLoader to use to find the service
return the implementation instance for a service

4.3.1.8.7 getServiceInstances(Class<T>, ClassLoader, StringBuffer)
public static List<T> getServiceInstances(Class<T> cls,
                                          ClassLoader loader,
                                          StringBuffer errorMessages);

Locate all service implementations by services lookup of a specific class loader. Implementations in the services file are instantiated and returned. Failed instantiations are remembered in the errorMessages buffer.

Table 4.10 getServiceInstances(Class<T>, ClassLoader, StringBuffer)

Parameter Description
cls the class of the factory
loader the class loader for the factory implementation
errorMessages a buffer used to hold the error messages
return the service instance

4.3.1.8.8 getSessionFactory(Map)
public static SessionFactory getSessionFactory(Map props);

Locate a SessionFactory implementation by services lookup. The class loader used is the thread's context class loader.

Table 4.11 getSessionFactory(Map)

Parameter Description
props properties of the session factory
return the session factory

Exceptions

ClusterFatalUserException

if the connection to the cluster cannot be made

4.3.1.8.9 getSessionFactory(Map, ClassLoader)
public static SessionFactory getSessionFactory(Map props,
                                               ClassLoader loader);

Locate a SessionFactory implementation by services lookup of a specific class loader. The properties are a Map that might contain implementation-specific properties plus standard properties.

Table 4.12 getSessionFactory(Map, ClassLoader)

Parameter Description
props the properties for the factory
loader the class loader for the factory implementation
return the session factory

Exceptions

ClusterFatalUserException

if the connection to the cluster cannot be made

4.3.1.8.10 getStringProperty(String, String)
public static String getStringProperty(String propertyName,
                                       String def);

Get the named String property from either the environment or system properties.

Table 4.13 getStringProperty(String, String)

Parameter Description
propertyName the name of the property
def the default if the property is not set
return the system property if it is set via -D or the system environment

4.3.1.8.11 newDbug()
public static Dbug newDbug();

Return a new Dbug instance.

Table 4.14 newDbug()

Parameter Description
return a new Dbug instance