Package org.jboss.dependency.spi

Examples of org.jboss.dependency.spi.DependencyInfo


      MockClassLoadingMetaData a = new MockClassLoadingMetaData("a");
      a.setPathsAndPackageNames(A.class);
      KernelControllerContext contextA = install(a);
      try
      {
         DependencyInfo infoA = contextA.getDependencyInfo();

         MockClassLoadingMetaData b = new MockClassLoadingMetaData("b");
         b.setPathsAndPackageNames(B.class);
         ClassLoadingMetaDataFactory factory = ClassLoadingMetaDataFactory.getInstance();
         Requirement requirement = factory.createRequirePackage(A.class.getPackage().getName());
         b.setRequirements(Collections.singletonList(requirement));

         KernelControllerContext contextB = install(b);
         try
         {
            Set<DependencyItem> items = infoA.getDependsOnMe(null);
            assertEquals(1, items.size());
         }
         finally
         {
            uninstall(contextB);
            Set<DependencyItem> items = infoA.getDependsOnMe(null);
            assertEquals(0, items.size());
         }
      }
      finally
      {
View Full Code Here


      return aliases != null ? Collections.unmodifiableSet(aliases) : null;
   }

   public DependencyInfo getDependencyInfo()
   {
      DependencyInfo dependencyInfo = delegate.getDependencyInfo();
      return dependencyInfo != null ? new UnmodifiableDependencyInfo(dependencyInfo) : null;
   }
View Full Code Here

      {
         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)
            {
               ControllerState actualState = null;
               String actualStateString;
View Full Code Here

         if (trace)
            log.trace("Installing " + context.toShortString());

         context.setController(this);
         DependencyInfo dependencies = context.getDependencyInfo();
         if (trace)
         {
            String dependsOn = "[]";
            if (dependencies != null)
            {
               try
               {
                  Set<DependencyItem> set = dependencies.getIDependOn(null);
                  if (set != null)
                     dependsOn = set.toString();
               }
               catch (Throwable t)
               {
View Full Code Here

    * @param state The state we want to move to
    * @return true if the dependencies are resolved
    */
   private boolean resolveDependencies(ControllerContext ctx, ControllerState state)
   {
      DependencyInfo dependencies = ctx.getDependencyInfo();
      return dependencies == null || dependencies.resolveDependencies(this, state);
   }
View Full Code Here

      Set<ControllerContext> fromContexts = fromController.getContextsByState(fromState);
      if (fromContexts == null || fromContexts.remove(context) == false)
         throw new Error("INTERNAL ERROR: context not found in previous state " + fromState.getStateString() + " context=" + context.toShortString(), new Exception("STACKTRACE"));

      DependencyInfo dependencies = context.getDependencyInfo();
      if (dependencies != null)
      {
         try
         {
            Set<DependencyItem> dependsOnMe = dependencies.getDependsOnMe(null);
            if (dependsOnMe.isEmpty() == false)
            {
               for (DependencyItem item : dependsOnMe)
               {
                  if (item.isResolved())
View Full Code Here

   protected void uninstallUnusedOnDemandContexts(ControllerContext context, boolean trace)
   {
      lockWrite();
      try
      {
         DependencyInfo dependencies = context.getDependencyInfo();
         if (dependencies != null)
         {
            Set<DependencyItem> iDependOn = dependencies.getIDependOn(null);
            if (iDependOn.isEmpty() == false)
            {
               for (DependencyItem item : iDependOn)
               {
                  if (item.isResolved()) //TODO Is this check necessary
                  {
                     Object name = item.getIDependOn();
                     if (name == null)
                        continue;
  
                     ControllerContext other = getContext(name, null);
                     if (other == null)
                     {
                        log.warn("Could not find dependency while uninstalling on demand contexts for " + item);
                        continue;
                     }
                     if (other.getMode() != ControllerMode.ON_DEMAND)
                        continue;
  
                     DependencyInfo otherDependencies = other.getDependencyInfo();
                     if (otherDependencies == null)
                        continue;
                    
                     Set<DependencyItem> dependsOnOther = otherDependencies.getDependsOnMe(null);
                     boolean isRequired = false;
                     for (DependencyItem dependsOnOtherItem : dependsOnOther)
                     {
                        ControllerContext dependsContext = getContext(dependsOnOtherItem.getName(), null);
                        if (dependsContext == null)
View Full Code Here

    * @param isInstallPhase install or uninstall phase
    * @return callback items from dependency info
    */
   protected Set<CallbackItem<?>> getDependencyCallbacks(ControllerContext context, boolean isInstallPhase)
   {
      DependencyInfo di = context.getDependencyInfo();
      if (di != null)
      {
         return isInstallPhase ? di.getInstallItems() : di.getUninstallItems();
      }
      return null;
   }
View Full Code Here

         resolveCallbacks(installs, state, isInstallPhase, isInstallPhase, true);
         Set<CallbackItem<?>> uninstalls = getDependencyCallbacks(context, false);
         resolveCallbacks(uninstalls, state, isInstallPhase == false, isInstallPhase, false);

         // change callbacks, applied only if context is autowire candidate
         DependencyInfo dependencyInfo = context.getDependencyInfo();
         if (dependencyInfo != null && dependencyInfo.isAutowireCandidate())
         {
            // match callbacks by name
            Set<CallbackItem<?>> existingCallbacks = new HashSet<CallbackItem<?>>();
            existingCallbacks.addAll(getCallbacks(context.getName(), isInstallPhase));
            // match by classes
View Full Code Here

    * @param install is it install or uninstall
    * @throws Throwable for any error
    */
   protected void handleLifecycleCallbacks(ControllerContext context, ControllerState state, boolean install) throws Throwable
   {
      DependencyInfo di = context.getDependencyInfo();
      if (di != null)
      {
         List<LifecycleCallbackItem> callbacks = di.getLifecycleCallbacks();
         for (LifecycleCallbackItem callback : callbacks)
         {
            if (callback.getWhenRequired().equals(state))
            {
               if (install)
View Full Code Here

TOP

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

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.