org.jboss.system.server.profileservice.repository
Class AbstractProfileService

java.lang.Object
  extended by org.jboss.system.server.profileservice.repository.AbstractProfileService
All Implemented Interfaces:
org.jboss.dependency.spi.ControllerContextActions, org.jboss.profileservice.spi.ProfileService

public class AbstractProfileService
extends Object
implements org.jboss.profileservice.spi.ProfileService, org.jboss.dependency.spi.ControllerContextActions

The ProfileService.

Version:
$Revision: 86216 $
Author:
Emanuel Muckenhuber

Field Summary
static org.jboss.dependency.spi.ControllerState DEPLOY_STATE
          The deploy state
 
Constructor Summary
AbstractProfileService(org.jboss.dependency.plugins.AbstractController controller)
           
 
Method Summary
 void activateProfile(org.jboss.profileservice.spi.ProfileKey key)
          Activate a registered profile.
 void create()
          Create the profile service actions.
 void deactivateProfile(org.jboss.profileservice.spi.ProfileKey key)
          Deactivate the profile.
 void destroy()
          Destroy the profileService.
 org.jboss.profileservice.spi.Profile getActiveProfile(org.jboss.profileservice.spi.ProfileKey key)
          Obtain the active profile for the key.
 Collection<org.jboss.profileservice.spi.ProfileKey> getActiveProfileKeys()
           
 org.jboss.profileservice.spi.ProfileKey getDefaultProfile()
           
 MainDeployerAdapter getDeployer()
           
 org.jboss.deployers.spi.management.deploy.DeploymentManager getDeploymentManager()
           
 String[] getDomains()
           
 org.jboss.profileservice.spi.Profile getProfile(org.jboss.profileservice.spi.ProfileKey key)
          Obtain the registered profile for the key.
 String[] getProfileDeploymentNames(org.jboss.profileservice.spi.ProfileKey key)
           
 Collection<org.jboss.profileservice.spi.ProfileKey> getProfileKeys()
           
 org.jboss.deployers.spi.management.ManagementView getViewManager()
           
 void install(org.jboss.dependency.spi.ControllerContext context, org.jboss.dependency.spi.ControllerState fromState, org.jboss.dependency.spi.ControllerState toState)
           
protected  void internalValidateContext(org.jboss.dependency.spi.ControllerContext ctx, Set<String> errors, Map<Object,String> incomplete)
          Validate the context and create the error messages if needed.
protected  void logErrors(Set<String> errors, Collection<String> incomplete)
          This method just groups the errors and incomplete messages and throws an Exception if there are errors or missing dependencies.
 void registerProfile(org.jboss.profileservice.spi.Profile profile)
          Register a Profile.
 void setDefaultProfile(org.jboss.profileservice.spi.ProfileKey defaultProfile)
           
 void setDeployer(MainDeployerAdapter deployer)
           
 void setDeploymentManager(org.jboss.deployers.spi.management.deploy.DeploymentManager deploymentManager)
           
 void setViewManager(org.jboss.deployers.spi.management.ManagementView managementView)
           
 void uninstall(org.jboss.dependency.spi.ControllerContext context, org.jboss.dependency.spi.ControllerState fromState, org.jboss.dependency.spi.ControllerState toState)
           
 void unregisterProfile(org.jboss.profileservice.spi.Profile profile)
          Delegates to unregisterProfile(ProfileKey)
 void unregisterProfile(org.jboss.profileservice.spi.ProfileKey key)
          Unregister a profile.
protected  void validate(org.jboss.dependency.spi.ControllerContext context)
          Check if all dependencies are satisfied and the profile was installed successfully.
 void validateProfile(org.jboss.profileservice.spi.ProfileKey key)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEPLOY_STATE

public static final org.jboss.dependency.spi.ControllerState DEPLOY_STATE
The deploy state

Constructor Detail

AbstractProfileService

public AbstractProfileService(org.jboss.dependency.plugins.AbstractController controller)
Method Detail

getDefaultProfile

public org.jboss.profileservice.spi.ProfileKey getDefaultProfile()

setDefaultProfile

public void setDefaultProfile(org.jboss.profileservice.spi.ProfileKey defaultProfile)

getDeployer

public MainDeployerAdapter getDeployer()

setDeployer

public void setDeployer(MainDeployerAdapter deployer)

getDeploymentManager

public org.jboss.deployers.spi.management.deploy.DeploymentManager getDeploymentManager()
Specified by:
getDeploymentManager in interface org.jboss.profileservice.spi.ProfileService

setDeploymentManager

public void setDeploymentManager(org.jboss.deployers.spi.management.deploy.DeploymentManager deploymentManager)

getViewManager

public org.jboss.deployers.spi.management.ManagementView getViewManager()
Specified by:
getViewManager in interface org.jboss.profileservice.spi.ProfileService

setViewManager

public void setViewManager(org.jboss.deployers.spi.management.ManagementView managementView)

getDomains

public String[] getDomains()
Specified by:
getDomains in interface org.jboss.profileservice.spi.ProfileService

getProfileDeploymentNames

public String[] getProfileDeploymentNames(org.jboss.profileservice.spi.ProfileKey key)
                                   throws org.jboss.profileservice.spi.NoSuchProfileException
Throws:
org.jboss.profileservice.spi.NoSuchProfileException

getProfileKeys

public Collection<org.jboss.profileservice.spi.ProfileKey> getProfileKeys()
Specified by:
getProfileKeys in interface org.jboss.profileservice.spi.ProfileService

getProfile

public org.jboss.profileservice.spi.Profile getProfile(org.jboss.profileservice.spi.ProfileKey key)
                                                throws org.jboss.profileservice.spi.NoSuchProfileException
Obtain the registered profile for the key.

Specified by:
getProfile in interface org.jboss.profileservice.spi.ProfileService
Parameters:
key - - the key for the profile
Returns:
the matching profile.
Throws:
org.jboss.profileservice.spi.NoSuchProfileException - if there is no such profile registered.

getActiveProfileKeys

public Collection<org.jboss.profileservice.spi.ProfileKey> getActiveProfileKeys()
Specified by:
getActiveProfileKeys in interface org.jboss.profileservice.spi.ProfileService

getActiveProfile

public org.jboss.profileservice.spi.Profile getActiveProfile(org.jboss.profileservice.spi.ProfileKey key)
                                                      throws org.jboss.profileservice.spi.NoSuchProfileException
Obtain the active profile for the key.

Specified by:
getActiveProfile in interface org.jboss.profileservice.spi.ProfileService
Parameters:
key - - the key for the profile
Returns:
the matching active profile.
Throws:
org.jboss.profileservice.spi.NoSuchProfileException - if there is no such profile active.

create

public void create()
            throws Exception
Create the profile service actions.

Throws:
Exception

destroy

public void destroy()
Destroy the profileService.


registerProfile

public void registerProfile(org.jboss.profileservice.spi.Profile profile)
                     throws Exception
Register a Profile.

Specified by:
registerProfile in interface org.jboss.profileservice.spi.ProfileService
Parameters:
profile - the profile.
Throws:
Exception

activateProfile

public void activateProfile(org.jboss.profileservice.spi.ProfileKey key)
                     throws Exception
Activate a registered profile.

Specified by:
activateProfile in interface org.jboss.profileservice.spi.ProfileService
Parameters:
key - the profile key.
Throws:
org.jboss.profileservice.spi.NoSuchProfileException - if there is no such profile registered.
Exception

validateProfile

public void validateProfile(org.jboss.profileservice.spi.ProfileKey key)
                     throws Exception
Specified by:
validateProfile in interface org.jboss.profileservice.spi.ProfileService
Throws:
Exception

validate

protected void validate(org.jboss.dependency.spi.ControllerContext context)
                 throws Exception
Check if all dependencies are satisfied and the profile was installed successfully.

Parameters:
context - the context to validate
Throws:
Exception

install

public void install(org.jboss.dependency.spi.ControllerContext context,
                    org.jboss.dependency.spi.ControllerState fromState,
                    org.jboss.dependency.spi.ControllerState toState)
             throws Throwable
Specified by:
install in interface org.jboss.dependency.spi.ControllerContextActions
Throws:
Throwable

uninstall

public void uninstall(org.jboss.dependency.spi.ControllerContext context,
                      org.jboss.dependency.spi.ControllerState fromState,
                      org.jboss.dependency.spi.ControllerState toState)
Specified by:
uninstall in interface org.jboss.dependency.spi.ControllerContextActions

deactivateProfile

public void deactivateProfile(org.jboss.profileservice.spi.ProfileKey key)
                       throws org.jboss.profileservice.spi.NoSuchProfileException
Deactivate the profile.

Specified by:
deactivateProfile in interface org.jboss.profileservice.spi.ProfileService
Parameters:
key - the profile key.
Throws:
org.jboss.profileservice.spi.NoSuchProfileException - if the profile is not active.

unregisterProfile

public void unregisterProfile(org.jboss.profileservice.spi.ProfileKey key)
                       throws org.jboss.profileservice.spi.NoSuchProfileException
Unregister a profile.

Specified by:
unregisterProfile in interface org.jboss.profileservice.spi.ProfileService
Parameters:
key - the profile key
Throws:
org.jboss.profileservice.spi.NoSuchProfileException - if the profile is not registered.

unregisterProfile

public void unregisterProfile(org.jboss.profileservice.spi.Profile profile)
                       throws org.jboss.profileservice.spi.NoSuchProfileException
Delegates to unregisterProfile(ProfileKey)

Parameters:
profile -
Throws:
org.jboss.profileservice.spi.NoSuchProfileException - if the profile is not registered.

internalValidateContext

protected void internalValidateContext(org.jboss.dependency.spi.ControllerContext ctx,
                                       Set<String> errors,
                                       Map<Object,String> incomplete)
Validate the context and create the error messages if needed. TODO maybe recurse into dependent contexts.

Parameters:
ctx - the context to validate
errors - a set of errors
incomplete - a set of incomplete contexts

logErrors

protected void logErrors(Set<String> errors,
                         Collection<String> incomplete)
                  throws Exception
This method just groups the errors and incomplete messages and throws an Exception if there are errors or missing dependencies.

Parameters:
errors - a set of errors
incomplete - a set of missing dependencies
Throws:
Exception - in case there are errors or missing dependencies


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