4.3.1.7 Class ClusterJHelper

4.3.1.7.1 Synopsis
4.3.1.7.2 getBooleanProperty(String, String)
4.3.1.7.3 getServiceInstance(Class<T>)
4.3.1.7.4 getServiceInstance(Class<T>, ClassLoader)
4.3.1.7.5 getServiceInstance(Class<T>, String)
4.3.1.7.6 getServiceInstances(Class<T>, ClassLoader, StringBuffer)
4.3.1.7.7 getSessionFactory(Map)
4.3.1.7.8 getSessionFactory(Map, ClassLoader)
4.3.1.7.9 getStringProperty(String, String)
4.3.1.7.10 newDbug()

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

4.3.1.7.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 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.7.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.

Parameters

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.7.3 getServiceInstance(Class<T>)
public static getServiceInstance(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.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.

Parameters

cls

the class of the factory

loader

the class loader for the factory implementation

return

the service instance

4.3.1.7.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.

Parameters

cls

implementationClassName

return

the implementation instance for a service

4.3.1.7.6 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.

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.7 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.

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.8 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.

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

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

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

Parameters

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.7.10 newDbug()
public static Dbug newDbug();

Return a new Dbug instance.

Parameters

return

a new Dbug instance