Package org.gatein.management.api.operation

Examples of org.gatein.management.api.operation.OperationHandler


        }
    }

    private void executeHandlers(ManagedResource resource, final OperationContext operationContext, PathAddress address,
            String operationName, StepResultHandler<PageNavigation> stepResultHandler, PathTemplateFilter filter, boolean root) {
        OperationHandler handler = resource.getOperationHandler(address, operationName);
        if (handler != null && !root && address.accepts(filter)) {
            handler.execute(operationContext, stepResultHandler);
        } else {
            OperationHandler readResource = resource.getOperationHandler(address, OperationNames.READ_RESOURCE);
            BasicResultHandler readResourceResult = new BasicResultHandler();
            readResource.execute(new OperationContextDelegate(operationContext) {
                @Override
                public String getOperationName() {
                    return OperationNames.READ_RESOURCE;
                }
            }, readResourceResult);
View Full Code Here


        }
    }

    private void executeHandlers(ManagedResource resource, final OperationContext operationContext, PathAddress address,
            String operationName, StepResultHandler<PageNavigation> stepResultHandler, PathTemplateFilter filter, boolean root) {
        OperationHandler handler = resource.getOperationHandler(address, operationName);
        if (handler != null && !root && address.accepts(filter)) {
            handler.execute(operationContext, stepResultHandler);
        } else {
            OperationHandler readResource = resource.getOperationHandler(address, OperationNames.READ_RESOURCE);
            BasicResultHandler readResourceResult = new BasicResultHandler();
            readResource.execute(new OperationContextDelegate(operationContext) {
                @Override
                public String getOperationName() {
                    return OperationNames.READ_RESOURCE;
                }
            }, readResourceResult);
View Full Code Here

      if (root.getSubResource(address) == null)
      {
         throw new ResourceNotFoundException("Could not locate managed resource for address '" + address + "'");
      }

      OperationHandler operationHandler = root.getOperationHandler(address, operationName);
      if (operationHandler != null)
      {
         // Obtain binding provider given managed component.
         String componentName = (address.size() >= 1) ? address.get(0) : null;
         BindingProvider bindingProvider = managementService.getBindingProvider(componentName);

         // Execute operation for given registered operation handler
         BasicResultHandler resultHandler = new BasicResultHandler();
         operationHandler.execute(new OperationContextImpl(request, root, runtimeContext, bindingProvider), resultHandler);

         if (resultHandler.getFailureDescription() != null)
         {
            return new FailureResponse(resultHandler.getFailureDescription());
         }
View Full Code Here

      }
   }

   private void executeHandlers(ManagedResource resource, final OperationContext operationContext, PathAddress address, String operationName, StepResultHandler<PageNavigation> stepResultHandler, PathTemplateFilter filter, boolean root)
   {
      OperationHandler handler = resource.getOperationHandler(address, operationName);
      if (handler != null && !root && address.accepts(filter))
      {
         handler.execute(operationContext, stepResultHandler);
      }
      else
      {
         OperationHandler readResource = resource.getOperationHandler(address, OperationNames.READ_RESOURCE);
         BasicResultHandler readResourceResult = new BasicResultHandler();
         readResource.execute(new OperationContextDelegate(operationContext)
         {
            @Override
            public String getOperationName()
            {
               return OperationNames.READ_RESOURCE;
View Full Code Here

      if (root.getSubResource(address) == null)
      {
         throw new ResourceNotFoundException("Could not locate managed resource for address '" + address + "'");
      }

      OperationHandler operationHandler = root.getOperationHandler(address, operationName);
      if (operationHandler != null)
      {
         // Obtain binding provider given managed component.
         String componentName = (address.size() >= 1) ? address.get(0) : null;
         BindingProvider bindingProvider = managementService.getBindingProvider(componentName);

         // ModelProvider to use for de-typed models
         ModelProvider modelProvider = DmrModelProvider.INSTANCE;

         // Execute operation for given registered operation handler
         BasicResultHandler resultHandler = new BasicResultHandler();
         operationHandler.execute(new OperationContextImpl(request, root, runtimeContext, externalContext, bindingProvider, modelProvider), resultHandler);

         if (resultHandler.getFailureDescription() != null)
         {
            return new FailureResponse(modelProvider.newModel().set(resultHandler.getFailureDescription()));
         }
View Full Code Here

      return new ExportResourceModel(tasks);
   }

   private void executeHandlers(ManagedResource resource, final OperationContext operationContext, PathAddress address, String operationName, StepResultHandler<ExportResourceModel> stepResultHandler)
   {
      OperationHandler handler = resource.getOperationHandler(address, operationName);
      if (handler != null && handler != this)
      {
         List<String> filterAttributes = operationContext.getAttributes().getValues("filter");
         PathTemplateFilter filter;
         try
         {
            filter = PathTemplateFilter.parse(filterAttributes);
         }
         catch (ParseException e)
         {
            throw new OperationException(operationName, "Could not parse filter attributes.", e);
         }

         if (address.accepts(filter))
         {
            handler.execute(operationContext, stepResultHandler);
         }
      }
      else
      {
         ManagedResource found = resource.getSubResource(address);
         if (found == null)
         {
            throw new OperationException(operationName, "Could not locate resource at address " + address);
         }
        
         OperationHandler readResource = resource.getOperationHandler(address, OperationNames.READ_RESOURCE);
         BasicResultHandler readResourceResult = new BasicResultHandler();
         readResource.execute(operationContext, readResourceResult);
         if (readResourceResult.getFailureDescription() != null)
         {
            throw new OperationException(operationName, "Failure '" + readResourceResult.getFailureDescription() + "' encountered executing " + OperationNames.READ_RESOURCE);
         }
View Full Code Here

TOP

Related Classes of org.gatein.management.api.operation.OperationHandler

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.