4.3.1.7. Class ClusterJHelper

4.3.1.7.1. Synopsis
4.3.1.7.2. getServiceInstance(Class<T>)
4.3.1.7.3. getServiceInstance(Class<T>, ClassLoader)
4.3.1.7.4. getServiceInstance(Class<T>, String)
4.3.1.7.5. getServiceInstances(Class<T>, ClassLoader, StringBuffer)
4.3.1.7.6. getSessionFactory(Map)
4.3.1.7.7. getSessionFactory(Map, ClassLoader)

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

4.3.1.7.1. Synopsis
 public class com.mysql.clusterj.ClusterJHelper {
// Public Constructors  public ClusterJHelper();
// Public Static Methods  public static getServiceInstance(java.lang.Class<T> cls);
  public static getServiceInstance(java.lang.Class<T> cls,
                                     java.lang.ClassLoader loader);

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

  public static java.­util.­List<T> getServiceInstances(java.lang.Class<T> cls,
                                                        java.lang.ClassLoader loader,
                                                        java.lang.StringBuffer errorMessages);

  public static com.­mysql.­clusterj.­SessionFactory getSessionFactory(java.util.Map props);
  public static com.­mysql.­clusterj.­SessionFactory getSessionFactory(java.util.Map props,
                                                                       java.lang.ClassLoader loader);

}

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

4.3.1.7.2. getServiceInstance(Class<T>)
public static getServiceInstance(java.lang.Class<T> cls);

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

Parameters

cls

the class of the factory

return

the service instance

4.3.1.7.3. getServiceInstance(Class<T>, ClassLoader)
public static getServiceInstance(java.lang.Class<T> cls,
                                   java.lang.ClassLoader loader);

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

Parameters

cls

the class of the factory

loader

the class loader for the factory implementation

return

the service instance

4.3.1.7.4. getServiceInstance(Class<T>, String)
public static getServiceInstance(java.lang.Class<T> cls,
                                   java.lang.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.

Parameters

cls

implementationClassName

return

the implementation instance for a service

4.3.1.7.5. getServiceInstances(Class<T>, ClassLoader, StringBuffer)
public static java.­util.­List<T> getServiceInstances(java.lang.Class<T> cls,
                                                      java.lang.ClassLoader loader,
                                                      java.lang.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.

Parameters

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.7.6. getSessionFactory(Map)
public static com.­mysql.­clusterj.­SessionFactory getSessionFactory(java.util.Map props);

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

Parameters

props

properties of the session factory

return

the session factory

Exceptions

ClusterFatalUserException

if the connection to the cluster cannot be made

4.3.1.7.7. getSessionFactory(Map, ClassLoader)
public static com.­mysql.­clusterj.­SessionFactory getSessionFactory(java.util.Map props,
                                                                     java.lang.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.

Parameters

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