com.sun.xml.ws.api.ha
Enum HighAvailabilityProvider

java.lang.Object
  extended by java.lang.Enum<HighAvailabilityProvider>
      extended by com.sun.xml.ws.api.ha.HighAvailabilityProvider
All Implemented Interfaces:
Serializable, Comparable<HighAvailabilityProvider>

public enum HighAvailabilityProvider
extends Enum<HighAvailabilityProvider>

Singleton high-availability provider for Metro


Nested Class Summary
static class HighAvailabilityProvider.StoreType
          Enumeration of supported backing store factory types
 
Enum Constant Summary
INSTANCE
           
 
Method Summary
static void close(org.glassfish.ha.store.api.BackingStore<?,?> backingStore)
          Helper method that avoids the need for exception handling boilerplate code when closing a BackingStore instance.
<K extends Serializable,V extends Serializable>
org.glassfish.ha.store.api.BackingStore<K,V>
createBackingStore(org.glassfish.ha.store.api.BackingStoreFactory factory, String backingStoreName, Class<K> keyClass, Class<V> valueClass)
          Helper method that avoids the need for exception handling boilerplate code when creating a new BackingStore instance.
static void destroy(org.glassfish.ha.store.api.BackingStore<?,?> backingStore)
          Helper method that avoids the need for exception handling boilerplate code when destroying a BackingStore instance.
 org.glassfish.ha.store.api.BackingStoreFactory getBackingStoreFactory(HighAvailabilityProvider.StoreType type)
          Retrieves BackingStoreFactory implementation of the requested type.
<K extends Serializable,V extends Serializable>
org.glassfish.ha.store.api.BackingStoreConfiguration<K,V>
initBackingStoreConfiguration(String storeName, Class<K> keyClass, Class<V> valueClass)
          Creates BackingStoreConfiguration instance initialized with all mandatory fields.
 void initHaEnvironment(String clusterName, String instanceName)
          This method is not meant to be used directly by the user of the Metro HighAvailabilityProvider class.
 void initHaEnvironment(String clusterName, String instanceName, boolean disableJreplica)
           
 boolean isDisabledJreplica()
           
 boolean isHaEnvironmentConfigured()
          Provides information on whether there is a HA service available in the current JVM or not.
static
<K extends Serializable,V extends Serializable>
V
loadFrom(org.glassfish.ha.store.api.BackingStore<K,V> backingStore, K key, String version)
          Helper method that avoids the need for exception handling boilerplate code when loading data from a BackingStore instance.
static
<K extends Serializable>
void
removeExpired(org.glassfish.ha.store.api.BackingStore<K,?> backingStore)
          Helper method that avoids the need for exception handling boilerplate code when destroying a BackingStore instance.
static
<K extends Serializable,V extends Serializable>
void
removeFrom(org.glassfish.ha.store.api.BackingStore<K,V> backingStore, K key)
          Helper method that avoids the need for exception handling boilerplate code when removing data from a BackingStore instance.
static
<K extends Serializable,V extends Serializable>
String
saveTo(org.glassfish.ha.store.api.BackingStore<K,V> backingStore, K key, V value, boolean isNew)
          Helper method that avoids the need for exception handling boilerplate code when storing data into a BackingStore instance.
static HighAvailabilityProvider valueOf(String name)
          Returns the enum constant of this type with the specified name.
static HighAvailabilityProvider[] values()
          Returns an array containing the constants of this enum type, in the order they are declared.
 
Methods inherited from class java.lang.Enum
clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 

Enum Constant Detail

INSTANCE

public static final HighAvailabilityProvider INSTANCE
Method Detail

values

public static HighAvailabilityProvider[] values()
Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:
for (HighAvailabilityProvider c : HighAvailabilityProvider.values())
    System.out.println(c);

Returns:
an array containing the constants of this enum type, in the order they are declared

valueOf

public static HighAvailabilityProvider valueOf(String name)
Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)

Parameters:
name - the name of the enum constant to be returned.
Returns:
the enum constant with the specified name
Throws:
IllegalArgumentException - if this enum type has no constant with the specified name
NullPointerException - if the argument is null

initHaEnvironment

public void initHaEnvironment(String clusterName,
                              String instanceName)
This method is not meant to be used directly by the user of the Metro HighAvailabilityProvider class. It is primarily used by a container to inject the proper cluster name and instance name values that are later used to initialize all BackingStoreConfiguration instances created via initBackingStoreConfiguration(String, Class, Class) method

Parameters:
clusterName - name of the cluster
instanceName - name of the cluster instance

initHaEnvironment

public void initHaEnvironment(String clusterName,
                              String instanceName,
                              boolean disableJreplica)

isDisabledJreplica

public boolean isDisabledJreplica()

initBackingStoreConfiguration

public <K extends Serializable,V extends Serializable> org.glassfish.ha.store.api.BackingStoreConfiguration<K,V> initBackingStoreConfiguration(String storeName,
                                                                                                                                               Class<K> keyClass,
                                                                                                                                               Class<V> valueClass)
Creates BackingStoreConfiguration instance initialized with all mandatory fields. This instance can be used to create BackingStore instance.

Type Parameters:
K - backing store key type
V - backing store value type
Parameters:
storeName - name of the backing store
keyClass - backing store key class
valueClass - backing store value class
Returns:
initialized BackingStoreConfiguration instance

getBackingStoreFactory

public org.glassfish.ha.store.api.BackingStoreFactory getBackingStoreFactory(HighAvailabilityProvider.StoreType type)
                                                                      throws HighAvailabilityProviderException
Retrieves BackingStoreFactory implementation of the requested type. In case this method is executed outside an HA environment (e.g. standalone mode), StoreType.NOOP implementation is returned.

Parameters:
type - type of the BackingStoreFactory implementation to be retrieved
Returns:
BackingStoreFactory implementation of the requested type. When executed outside HA environment, StoreType.NOOP implementation is returned.
Throws:
HighAvailabilityProviderException - in case the method is executed inside HA environment and the requested BackingStoreFactory implementation is not available.

isHaEnvironmentConfigured

public boolean isHaEnvironmentConfigured()
Provides information on whether there is a HA service available in the current JVM or not.

Returns:
true in case there is a HA service available in the current JVM, false otherwise

createBackingStore

public <K extends Serializable,V extends Serializable> org.glassfish.ha.store.api.BackingStore<K,V> createBackingStore(org.glassfish.ha.store.api.BackingStoreFactory factory,
                                                                                                                       String backingStoreName,
                                                                                                                       Class<K> keyClass,
                                                                                                                       Class<V> valueClass)
Helper method that avoids the need for exception handling boilerplate code when creating a new BackingStore instance. The original checked BackingStoreException is wrapped into a new unchecked HighAvailabilityProviderException.

Type Parameters:
K - backing store key parameter type
V - backing store value parameter type
Parameters:
factory - BackingStoreFactory instance
backingStoreName - name of the backing store to be created
keyClass - backing store key class
valueClass - backing store value class
Returns:
newly created BackingStore instance.

loadFrom

public static <K extends Serializable,V extends Serializable> V loadFrom(org.glassfish.ha.store.api.BackingStore<K,V> backingStore,
                                                                         K key,
                                                                         String version)
Helper method that avoids the need for exception handling boilerplate code when loading data from a BackingStore instance. The original checked BackingStoreException is wrapped into a new unchecked HighAvailabilityProviderException.

Type Parameters:
K - backing store key parameter type
V - backing store data parameter type
Parameters:
backingStore - BackingStore instance
key - stored data identifier
version - stored data version
Returns:
stored data as specified by BackingStore.load(java.io.Serializable, String)

saveTo

public static <K extends Serializable,V extends Serializable> String saveTo(org.glassfish.ha.store.api.BackingStore<K,V> backingStore,
                                                                            K key,
                                                                            V value,
                                                                            boolean isNew)
Helper method that avoids the need for exception handling boilerplate code when storing data into a BackingStore instance. The original checked BackingStoreException is wrapped into a new unchecked HighAvailabilityProviderException.

Type Parameters:
K - backing store key parameter type
V - backing store value parameter type
Parameters:
backingStore - BackingStore instance
key - stored data identifier
value - data to be stored
isNew - See BackingStore.save(java.io.Serializable, java.io.Serializable, boolean)
Returns:
See BackingStore.save(java.io.Serializable, java.io.Serializable, boolean)

removeFrom

public static <K extends Serializable,V extends Serializable> void removeFrom(org.glassfish.ha.store.api.BackingStore<K,V> backingStore,
                                                                              K key)
Helper method that avoids the need for exception handling boilerplate code when removing data from a BackingStore instance. The original checked BackingStoreException is wrapped into a new unchecked HighAvailabilityProviderException.

Type Parameters:
K - backing store key parameter type
V - backing store data parameter type
Parameters:
backingStore - BackingStore instance
key - stored data identifier

close

public static void close(org.glassfish.ha.store.api.BackingStore<?,?> backingStore)
Helper method that avoids the need for exception handling boilerplate code when closing a BackingStore instance. The original checked BackingStoreException is wrapped into a new unchecked HighAvailabilityProviderException.

Parameters:
backingStore - BackingStore instance

destroy

public static void destroy(org.glassfish.ha.store.api.BackingStore<?,?> backingStore)
Helper method that avoids the need for exception handling boilerplate code when destroying a BackingStore instance. The original checked BackingStoreException is wrapped into a new unchecked HighAvailabilityProviderException.

Parameters:
backingStore - BackingStore instance

removeExpired

public static <K extends Serializable> void removeExpired(org.glassfish.ha.store.api.BackingStore<K,?> backingStore)
Helper method that avoids the need for exception handling boilerplate code when destroying a BackingStore instance. The original checked BackingStoreException is wrapped into a new unchecked HighAvailabilityProviderException.

Parameters:
backingStore - BackingStore instance


Copyright (c) 1997-2012 Oracle and/or its affiliates. All rights reserved.