Package org.jboss.dependency.spi

Examples of org.jboss.dependency.spi.ControllerState


         Object contextName = context.getName();
         String name = contextName.toString();
         Set<MissingDependency> dependencies = new HashSet<MissingDependency>();

         DependencyInfo dependsInfo = context.getDependencyInfo();
         ControllerState currentState = context.getState();
         ControllerState nextState = states.getNextState(currentState);

         for (DependencyItem item : dependsInfo.getUnresolvedDependencies(nextState))
         {
            if (item.isResolved() == false)
            {
               String dependency;
               ControllerState actualState = null;
               String actualStateString;

               Object iDependOn = item.getIDependOn();
               if (contextName.equals(iDependOn) == false && item.resolve(controller) == false)
               {
                  iDependOn = item.getIDependOn();

                  if (iDependOn == null)
                  {
                     dependency = "<UNKNOWN " + item.getName() + ">";
                     actualStateString = "** UNRESOLVED " + item.toHumanReadableString() + " **";
                  }
                  else
                  {
                     dependency = iDependOn.toString();
                     ControllerContext other = controller.getContext(iDependOn, null);
                     if (other == null)
                        actualStateString = "** NOT FOUND " + item.toHumanReadableString() + " **";
                     else
                     {
                        actualState = other.getState();
                        actualStateString = actualState.getStateString();
                     }
                  }

                  ControllerState requiredState = item.getWhenRequired();
                  String requiredStateString = requiredState.getStateString();
                  if (actualState == null || states.isAfterState(requiredState, actualState))
                  {
                     MissingDependency missing = new MissingDependency(name, dependency, requiredStateString, actualStateString);
                     dependencies.add(missing);
                  }
View Full Code Here


   }

   public void deploy(DeploymentUnit unit, DeploymentMetaData deployment) throws DeploymentException
   {
      DeploymentStage requiredStage = deployment.getRequiredStage();
      ControllerState state = ControllerState.getInstance(requiredStage.getName());

      if (throwException && deployment.isLazyResolve() && states.isAfterState(state, DESCRIBED))
         throw new DeploymentException("Required stage is after DESCRIBED with lazy resolve enabled: " + requiredStage);
      if (throwException && deployment.isLazyStart() && states.isAfterState(state, REAL))
         throw new DeploymentException("Required stage is after REAL with lazy start enabled: " + requiredStage);
View Full Code Here

      if(name == null)
         throw new IllegalArgumentException("null name");
      if(mapper == null)
         throw new IllegalArgumentException("null mapper");

      ControllerState current = ControllerState.NOT_INSTALLED;
     
      try
      {
         if (mbeanServer.isRegistered(new ObjectName(name.toString())))
            current = ControllerState.INSTALLED;
View Full Code Here

      KernelController controller = kernel.getController();
      ControllerContext context = controller.getContext(name, null);
      if (context == null)
         throw new IllegalStateException("Context not installed: " + name);

      ControllerState state = context.getState();
      return state.getStateString();
   }
View Full Code Here

      KernelController controller = kernel.getController();
      ControllerContext context = controller.getContext(name, null);
      if (context == null)
         throw new IllegalStateException("Context not installed: " + name);
     
      ControllerState requiredState = null;
      // FIXME
      if(context instanceof KernelRegistryEntry == false)
         requiredState = context.getRequiredState();
      return mapper.map(context.getState(), requiredState);
   }
View Full Code Here

      // Already done?
      String stageName = stage.getName();
      if (stages.containsKey(stageName))
         return;

      ControllerState preceeds = null;
      String before = stage.getBefore();
      String after = stage.getAfter();
      if (before != null || after != null)
      {
         // Determine where to put the stage
         List<ControllerState> states = controller.getStates();
         for (int i = 0; i < states.size(); ++i)
         {
            ControllerState state = states.get(i);
            String stateName = state.getStateString();
            if (before != null && before.equals(stateName))
            {
               preceeds = state;
               break;
            }
            if (after != null && after.equals(stateName))
            {
               if (i < states.size()-1)
               {
                  preceeds = states.get(i+1);
                  break;
               }
            }
         }
      }

      controller.addState(new ControllerState(stageName), preceeds);
      stages.put(stageName, stage);
      log.debug("Added stage " + stageName + " before " + preceeds);
   }
View Full Code Here

         // Go through the states in reverse order
         List<ControllerState> states = controller.getStates();
         for (int i = states.size()-1; i >= 0; --i)
         {
            ControllerState state = states.get(i);
            for (DeploymentControllerContext deploymentControllerContext : toUndeploy)
            {
               DeploymentContext context = deploymentControllerContext.getDeploymentContext();
               if (ControllerState.ERROR.equals(context.getState()) == false)
               {
View Full Code Here

         for (DependencyItem item : dependsInfo.getIDependOn(null))
         {
            if (item.isResolved() == false)
            {
               String dependency;
               ControllerState actualState = null;
               String actualStateString;
               Object iDependOn = item.getIDependOn();
               if (iDependOn == null)
               {
                  dependency = "<UNKNOWN>";
                  actualStateString = "** UNRESOLVED " + item.toHumanReadableString() + " **";
               }
               else
               {
                  dependency = iDependOn.toString();
                  ControllerContext other = controller.getContext(item.getIDependOn(), null);
                  if (other == null)
                     actualStateString = "** NOT FOUND **";
                  else
                  {
                     actualState = other.getState();
                     actualStateString = actualState.getStateString();
                  }
               }
               ControllerState requiredState = item.getWhenRequired();
               String requiredStateString = requiredState.getStateString();
               int required = states.indexOf(requiredState);
               int actual = actualState == null ? -1 : states.indexOf(actualState);
               if (required > actual)
               {
                  MissingDependency missing = new MissingDependency(name, dependency, requiredStateString, actualStateString);
View Full Code Here

   protected AbstractInstallMetaData createParametrizedMetaData(MethodInfo info, InstallMethod annotation)
   {
      AbstractInstallMetaData install = new AbstractInstallMetaData();
      install.setMethodName(info.getName());
      if (isAttributePresent(annotation.whenRequired()))
         install.setState(new ControllerState(annotation.whenRequired()));
      if (isAttributePresent(annotation.dependantState()))
         install.setDependentState(new ControllerState(annotation.dependantState()));
      return install;
   }
View Full Code Here

public class ControllerStateValueAdapter implements ValueAdapter
{
   @SuppressWarnings("unchecked")
   public Object cast(Object o, Class c)
   {
      return new ControllerState((String)o);
   }
View Full Code Here

TOP

Related Classes of org.jboss.dependency.spi.ControllerState

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.