Package org.jboss.system

Examples of org.jboss.system.ServiceContext


   }

   void registerDependency(ObjectName needs, ObjectName used)
   {
      log.debug("recording that " + needs + " depends on " + used);
      ServiceContext needsCtx = createServiceContext(needs);
      ServiceContext usedCtx = createServiceContext(used);


      if (!needsCtx.iDependOn.contains(usedCtx))
      {
         // needsCtx depends on usedCtx
View Full Code Here


         mbeanName = instance.getObjectName();

         mbeans.add(mbeanName);
         if (mbeanName != null)
         {
            ServiceContext ctx = serviceController.createServiceContext(mbeanName);
            try
            {
               configure(mbeanName, loaderName, mbeanElement, mbeans);
               ctx.state = ServiceContext.CONFIGURED;
               ctx.problem = null;
View Full Code Here

            }
            mbeanElement.appendChild(attributeElement);
         }
      }

      ServiceContext sc = serviceController.getServiceContext(name);
      for (Iterator i = sc.iDependOn.iterator(); i.hasNext();)
      {
         ServiceContext needs = (ServiceContext) i.next();
         Element dependsElement = doc.createElement("depends");
         dependsElement.appendChild(doc.createTextNode(needs.objectName.toString()));
         mbeanElement.appendChild(dependsElement);
      }
View Full Code Here

      // Weed services that are waiting for other deployments
      Collection<ServiceContext> rootCause = new HashSet<ServiceContext>(waitingForDepends);
      Collection<ServiceContext> missing = new HashSet<ServiceContext>();
      for (Iterator i = rootCause.iterator(); i.hasNext();)
      {
         ServiceContext ctx = (ServiceContext) i.next();
         for (Iterator j = ctx.iDependOn.iterator(); j.hasNext(); )
         {
            ServiceContext dependee = (ServiceContext) j.next();
            if (dependee.state != ServiceContext.RUNNING)
            {
               // Add missing mbean
               if (allServices.contains(dependee) == false)
                  missing.add(dependee);
View Full Code Here

   protected void checkIncomplete(IncompleteDeploymentException e, ObjectName name, Class<? extends Throwable> expected) throws Exception
   {
      Collection incomplete = e.getMbeansWaitingForDepends();
      for (Iterator i = incomplete.iterator(); i.hasNext();)
      {
         ServiceContext ctx = (ServiceContext) i.next();
         if (name.equals(ctx.objectName))
         {
            Throwable problem = ctx.getProblem();
            if (e != null || expected != null)
            {
               if (expected != null && problem == null)
                  throw new AssertionFailedError("Did not get expected " + expected.getName() + " for " + ctx);
               if (expected == null && problem != null)
View Full Code Here

      return getController().getServiceContext(name);
   }
  
   protected void assertNoService(ObjectName name) throws Exception
   {
      ServiceContext ctx = getServiceContext(name);
      if (ctx != null && ctx.state != ServiceContext.NOTYETINSTALLED)
         throw new AssertionFailedError("Should not be a service context for " + ctx);
   }
View Full Code Here

      assertMBeanFailed(name, registered);
   }
  
   protected void assertServiceState(ObjectName name, int expectedState, boolean registered) throws Exception
   {
      ServiceContext ctx = getServiceContext(name);
      if (registered == false && ctx == null)
         return;
      if (ctx == null)
         throw new AssertionFailedError("Incorrect state for " + name + " expected " + ServiceContext.getStateString(expectedState) + " but there is no context/state");
      if (expectedState != ctx.state)
         throw new AssertionFailedError("Incorrect state for " + name + " expected " + ServiceContext.getStateString(expectedState) + " got " + ctx.getStateString());
   }
View Full Code Here

      assertServiceState(name, ServiceContext.DESTROYED, true);
   }
  
   protected void assertServiceState(ObjectName name, int expectedState) throws Exception
   {
      ServiceContext ctx = getServiceContext(name);
      assertTrue("Incorrect state for " + name + " expected " + ServiceContext.getStateString(expectedState) + " got " + ctx.getStateString(), expectedState == ctx.state);
   }
View Full Code Here

      getControllerDelegate().assertServiceState(name, expectedState, registered);
   }
  
   protected void assertNoService(ObjectName name) throws Exception
   {
      ServiceContext ctx = getServiceContext(name);
      assertNull("Should not be a service context for " + name, ctx);
   }
View Full Code Here

               ServiceControllerMBean.class, false);
   }

   public String getStateString(ObjectName serviceName)
   {
      ServiceContext ctx = scmb.getServiceContext(serviceName);
      return ctx.getStateString();
   }
View Full Code Here

TOP

Related Classes of org.jboss.system.ServiceContext

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.