org.jboss.ha.singleton
Class HASingletonProfileActivator

java.lang.Object
  extended by org.jboss.ha.singleton.HASingletonProfileActivator
All Implemented Interfaces:
HASingletonProfileActivatorMBean
Direct Known Subclasses:
HASingletonProfileManager

public class HASingletonProfileActivator
extends Object
implements HASingletonProfileActivatorMBean

Bean that activates a configurable Profile when notified by a singleton controller, and releases it when notified. TODO rename and move to another package, as there is nothing HASingleton-specific about what this bean does; it just exposes an operation an HASingletonController can use.

Version:
$Revision: 86190 $
Author:
Brian Stansberry

Field Summary
static String DEFAULT_PROFILE_NAME
          Default value for getProfileName()
protected  Logger log
           
 
Constructor Summary
HASingletonProfileActivator()
          Create a new HASingletonProfileActivator.
 
Method Summary
 void activateProfile()
          Tells the ProfileService to activate the profile.
 String getProfileDomain()
          Gets the value that should be used for the domain portion of the singleton @{link Profile}'s ProfileKey.
 org.jboss.profileservice.spi.ProfileKey getProfileKey()
          Gets the key for the Profile that we activate and release.
 String getProfileName()
          Gets the value that should be used for the name portion of the singleton @{link Profile}'s ProfileKey.
 String getProfileServer()
          Gets the value that should be used for the server portion of the singleton @{link Profile}'s ProfileKey.
 org.jboss.profileservice.spi.ProfileService getProfileService()
          Gets the ProfileService.
protected  void handleNoSuchProfileException(org.jboss.profileservice.spi.NoSuchProfileException e)
          Handle a NoSuchProfileException thrown in activateProfile().
 boolean isActivated()
          Gets whether this object has activated its profile.
 void releaseProfile()
          Tells the ProfileService to release the profile.
 void setProfileDomain(String profileDomain)
          Sets the value that should be used for the domain portion of the singleton @{link Profile}'s ProfileKey.
 void setProfileName(String profileName)
          Sets the value that should be used for the name portion of the singleton @{link Profile}'s ProfileKey.
 void setProfileServer(String profileServer)
          Sets the value that should be used for the server portion of the singleton @{link Profile}'s ProfileKey.
 void setProfileService(org.jboss.profileservice.spi.ProfileService profileService)
          Sets the ProfileService reference.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_PROFILE_NAME

public static final String DEFAULT_PROFILE_NAME
Default value for getProfileName()

See Also:
Constant Field Values

log

protected final Logger log
Constructor Detail

HASingletonProfileActivator

public HASingletonProfileActivator()
Create a new HASingletonProfileActivator.

Method Detail

getProfileService

public org.jboss.profileservice.spi.ProfileService getProfileService()
Gets the ProfileService.

Returns:
the profileService.

setProfileService

public void setProfileService(org.jboss.profileservice.spi.ProfileService profileService)
Sets the ProfileService reference.

Parameters:
profileService - the profileService. Cannot be null
Throws:
IllegalArgumentException - if profileService is null

getProfileDomain

public String getProfileDomain()
Gets the value that should be used for the domain portion of the singleton @{link Profile}'s ProfileKey.

Specified by:
getProfileDomain in interface HASingletonProfileActivatorMBean
Returns:
the domain, or null if not set

setProfileDomain

public void setProfileDomain(String profileDomain)
Sets the value that should be used for the domain portion of the singleton @{link Profile}'s ProfileKey.

Parameters:
profileDomain - the domain, or null

getProfileServer

public String getProfileServer()
Gets the value that should be used for the server portion of the singleton @{link Profile}'s ProfileKey.

Specified by:
getProfileServer in interface HASingletonProfileActivatorMBean
Returns:
the server, or null if not set

setProfileServer

public void setProfileServer(String profileServer)
Sets the value that should be used for the server portion of the singleton @{link Profile}'s ProfileKey.

Parameters:
profileServer - the server, or null

getProfileName

public String getProfileName()
Gets the value that should be used for the name portion of the singleton @{link Profile}'s ProfileKey.

Specified by:
getProfileName in interface HASingletonProfileActivatorMBean
Returns:
the name, or #DEFAULT_PROFILE_NAME if not set

setProfileName

public void setProfileName(String profileName)
Sets the value that should be used for the name portion of the singleton @{link Profile}'s ProfileKey.

Parameters:
profileName - the name, or null

isActivated

public boolean isActivated()
Gets whether this object has activated its profile.

Specified by:
isActivated in interface HASingletonProfileActivatorMBean
Returns:
true if HASingletonProfileActivatorMBean.activateProfile() has successfully completed and HASingletonProfileActivatorMBean.releaseProfile() has not been called; false otherwise.

activateProfile

public void activateProfile()
                     throws Exception
Tells the ProfileService to activate the profile. Called by the HASingletonController when we become the singleton master.

Specified by:
activateProfile in interface HASingletonProfileActivatorMBean
Throws:
Exception

releaseProfile

public void releaseProfile()
                    throws Exception
Tells the ProfileService to release the profile. Called by the HASingletonController when we are no longer the singleton master.

Specified by:
releaseProfile in interface HASingletonProfileActivatorMBean
Throws:
Exception

getProfileKey

public org.jboss.profileservice.spi.ProfileKey getProfileKey()
Gets the key for the Profile that we activate and release.

Returns:
the key. Will not return null
See Also:
getProfileDomain(), getProfileServer(), getProfileName()

handleNoSuchProfileException

protected void handleNoSuchProfileException(org.jboss.profileservice.spi.NoSuchProfileException e)
Handle a NoSuchProfileException thrown in activateProfile(). This base implementation just logs a WARN.



Copyright © 2009 JBoss, a division of Red Hat, Inc.. All Rights Reserved.