Package org.gatein.management.api

Examples of org.gatein.management.api.PathAddress


      {
         log.warn(OperationNames.READ_CONFIG_AS_XML + " is deprecated. Please use " + OperationNames.READ_CONFIG + " instead with proper content type.");
         request = new DeprecatedManagedRequest(request);
      }

      PathAddress address = request.getAddress();
      String operationName = request.getOperationName();

      boolean debug = log.isDebugEnabled();
      if (debug)
      {
         log.debug("Executing request for operation " + operationName + " at address " + address);
      }
     
      ManagedResource root = getRootResource();
      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;
View Full Code Here


   {
      @Override
      public ReadResourceModel execute(OperationContext operationContext)
      {
         ManagedResource resource = operationContext.getManagedResource();
         PathAddress address = operationContext.getAddress();

         Set<String> children = resource.getSubResourceNames(address);
         ReadResourceModel readResourceModel = new ReadResourceModel("Available operations and children (sub-resources).", children);

         // Set children descriptions
         for (String child : children)
         {
            ManagedDescription desc = resource.getResourceDescription(address.append(child));
            readResourceModel.setChildDescription(child, desc.getDescription());
         }

         // Set operation descriptions
         Map<String, ManagedDescription> descriptions = resource.getOperationDescriptions(address);
View Full Code Here

{
   @Override
   protected ExportResourceModel execute(OperationContext operationContext) throws ResourceNotFoundException, OperationException
   {
      ManagedResource resource = operationContext.getManagedResource();
      final PathAddress address = operationContext.getAddress();
      final String operationName = operationContext.getOperationName();

      StepResultHandler<ExportResourceModel> exportResultHandler = new StepResultHandler<ExportResourceModel>(address)
      {
         @Override
         public void failed(String failureDescription)
         {
            if (address.equals(getCurrentAddress()))
            {
               throw new OperationException(operationName, "Export operation failed. Reason: " + failureDescription);
            }
            else
            {
View Full Code Here

            throw new RuntimeException("Was expecting " + ReadResourceModel.class + " to be returned for operation " + OperationNames.READ_RESOURCE + " at address " + address);
         }

         for (String child : ((ReadResourceModel) model).getChildren())
         {
            final PathAddress childAddress = address.append(child);
            OperationContext childContext = new OperationContextDelegate(operationContext)
            {
               @Override
               public PathAddress getAddress()
               {
View Full Code Here

        response.reset();
        response.setContentType("application/zip");
        response.setProperty("Content-disposition", "attachment; filename=\"" + filename + "\"");

        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);
View Full Code Here

        try {
            doInRequest(portalContainerName, new ContainerCallback<Void>() {

                public Void doInContainer(ExoContainer container) throws Exception {
                    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()) {
View Full Code Here

        return new User(managedUser.getUserName());
    }

    private void setCurrentPortalRequest(OperationContext context) {
        final ManagedUser managedUser = context.getUser();
        final PathAddress address = context.getAddress();

        // Retrieve siteId from address (can be null)
        SiteId siteId = getSiteId(address);

        // Retrieve nodePath from address (can be null)
View Full Code Here

        return null;
    }

    static PathAddress getSiteAddress(SiteId siteId) {
        PathAddress address = PathAddress.pathAddress("api");
        switch (siteId.getType()) {
            case SITE:
                address = address.append("sites");
                break;
            case SPACE:
                address = address.append("spaces");
                break;
            case DASHBOARD:
                address = address.append("dashboards");
                break;
            default:
                throw new AssertionError();
        }

        return address.append(siteId.getName());
    }
View Full Code Here

    }

    private ModelObject populateNavigationModel(Node rootNode, int scope, OperationContext context) {
        ModelObject model = modelProvider.newModel(ModelObject.class);

        PathAddress address = context.getAddress();

        // Populate navigation fields
        model.set("priority", navigation.getPriority());
        model.set("siteType", navigation.getSiteId().getType().getName());
        model.set("siteName", navigation.getSiteId().getName());
        ModelList nodesModel = model.get("nodes").setEmptyList();
        if (rootNode.isChildrenLoaded()) {
            for (Node child : rootNode) {
                Model childModel = nodesModel.add();
                PathAddress childAddress = address.append(child.getName());
                if (scope > 0 || scope < 0) // Continue populating nodes in response
                {
                    populateNode(child, scope - 1, childModel.setEmptyObject(), childAddress);
                } else { // Populate node reference which can be followed
                    ModelReference nodeRef = childModel.set(childAddress);
View Full Code Here

        // Children nodes
        ModelList children = model.get("children", ModelList.class);
        if (node.isChildrenLoaded()) {
            for (Node child : node) {
                Model childModel = children.add();
                PathAddress childAddress = address.append(child.getName());
                if (scope > 0 || scope < 0) // Continue populating nodes in response
                {
                    populateNode(child, scope - 1, childModel.setEmptyObject(), childAddress);
                } else { // Populate node reference which can be followed
                    ModelReference nodeRef = childModel.set(childAddress);
                    nodeRef.set("name", child.getName());
                }
            }
        }
        // Page reference
        ModelReference pageRef = model.get("page").asValue(ModelReference.class);
        if (node.getPageId() != null) {
            PageId pageId = node.getPageId();
            pageRef.set("pageName", pageId.getPageName());
            pageRef.set("siteName", pageId.getSiteId().getName());
            pageRef.set("siteType", pageId.getSiteId().getType().getName());

            // Set the address for the ref
            PathAddress pageAddress = getPagesAddress(pageId.getSiteId()).append(pageId.getPageName());
            pageRef.set(pageAddress);
        }
    }
View Full Code Here

TOP

Related Classes of org.gatein.management.api.PathAddress

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.