Package org.gatein.management.api.controller

Examples of org.gatein.management.api.controller.ManagedResponse


      String operationName = request.getOperationName();
      PathAddress address = request.getAddress();
      try
      {
         ManagedResponse resp = controller.execute(request);
         if (resp == null)
         {
            return failure("No response returned.", operationName, Status.INTERNAL_SERVER_ERROR, contentType);
         }
View Full Code Here


        ManagementController controller = (ManagementController) PortalContainer.getComponent(ManagementController.class);
        PathAddress address = PathAddress.pathAddress("mop", type + "sites", name);

        ManagedRequest request = ManagedRequest.Factory.create(OperationNames.EXPORT_RESOURCE, address, ContentType.ZIP);
        ManagedResponse expResponse = controller.execute(request);
        if (expResponse.getOutcome().isSuccess()) {
            expResponse.writeResult(out, true);
        } else {
            throw new Exception(expResponse.getOutcome().getFailureDescription());
        }

        fctx.responseComplete();
    }
View Full Code Here

        Map<String, List<String>> attributes = new HashMap<String, List<String>>(1);
        attributes.put("importMode", Collections.singletonList(importMode));
        ManagedRequest request = ManagedRequest.Factory.create(OperationNames.IMPORT_RESOURCE,
                PathAddress.pathAddress("mop"), attributes, item.getInputStream(), ContentType.ZIP);
        try {
            ManagedResponse response = controller.execute(request);
            if (!response.getOutcome().isSuccess()) {
                addMessage(item.getName());
                log.error(response.getOutcome().getFailureDescription());
            }
        } catch (Exception e) {
            addMessage(item.getName());
            log.error("Error while processing" + item.getName(), e);
        }
View Full Code Here

                    ManagementController controller = getComponent(container, ManagementController.class);
                    PathAddress address = PathAddress.pathAddress("mop", type + "sites", name);

                    ManagedRequest request = ManagedRequest.Factory.create(OperationNames.EXPORT_RESOURCE, address,
                            ContentType.ZIP);
                    ManagedResponse response = controller.execute(request);
                    if (response.getOutcome().isSuccess()) {
                        response.writeResult(os);
                    } else {
                        throw new Exception(response.getOutcome().getFailureDescription());
                    }

                    return null;
                }
            });
View Full Code Here

    private TreeNode getSiteTypeNode(ManagementController controller, String siteType) throws Exception {
        try {
            ManagedRequest request = ManagedRequest.Factory.create(OperationNames.READ_RESOURCE,
                    PathAddress.pathAddress("mop", siteType + "sites"), ContentType.JSON);

            ManagedResponse response = controller.execute(request);
            if (!response.getOutcome().isSuccess()) {
                throw new Exception(response.getOutcome().getFailureDescription());
            }

            ReadResourceModel result = (ReadResourceModel) response.getResult();
            List<TreeNode> children = new ArrayList<TreeNode>(result.getChildren().size());
            for (String siteName : result.getChildren()) {
                TreeNode siteNode = new TreeNode(siteName);
                siteNode.setExportable(true);
                siteNode.setType(siteType);
View Full Code Here

                attributes.put("importMode", Collections.singletonList(importMode));

                ManagedRequest request = ManagedRequest.Factory.create(OperationNames.IMPORT_RESOURCE,
                        PathAddress.pathAddress("mop"), attributes, in, ContentType.ZIP);

                ManagedResponse response = controller.execute(request);
                if (!response.getOutcome().isSuccess()) {
                    throw new Exception(response.getOutcome().getFailureDescription());
                }

                return null;
            }
        });
View Full Code Here

TOP

Related Classes of org.gatein.management.api.controller.ManagedResponse

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.