com.tangosol.internal.management.resources.ClustersResource Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of coherence Show documentation
Show all versions of coherence Show documentation
Oracle Coherence Community Edition
/*
* Copyright (c) 2000, 2022, Oracle and/or its affiliates.
*
* Licensed under the Universal Permissive License v 1.0 as shown at
* http://oss.oracle.com/licenses/upl.
*/
package com.tangosol.internal.management.resources;
import com.tangosol.internal.http.HttpRequest;
import com.tangosol.internal.http.RequestRouter;
import com.tangosol.internal.http.Response;
import com.tangosol.internal.management.EntityMBeanResponse;
import com.tangosol.util.Filter;
import com.tangosol.util.RegistrationBehavior;
import com.tangosol.util.ResourceRegistry;
import java.net.URI;
import java.util.ArrayList;
import java.util.Collections;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.function.Supplier;
import java.util.stream.Collectors;
import static com.tangosol.util.BuilderHelper.using;
/**
* The {@link ClustersResource} is the base resource for anything Coherence specific in a multi-cluster environment,
* for example in WebLogic Managed Coherence.
* All the resources wrt Coherence Management API will be a child of the clusters API.
*
* @author Jonathan Knight 2022.01.25
*/
public class ClustersResource
extends AbstractManagementResource
{
// ----- constructors ---------------------------------------------------
public ClustersResource(Supplier> supplierClusters)
{
f_supplierClusters = supplierClusters;
f_clusterResource = new ClusterResource();
}
// ----- Routes methods -------------------------------------------------
@Override
public void addRoutes(RequestRouter router, String sPathRoot)
{
router.addGet(sPathRoot, this::get);
router.addPost(sPathRoot + "/" + SEARCH, this::search);
router.addRoutes(sPathRoot + "/{" + CLUSTER_NAME + "}", f_clusterResource);
}
// ----- Clusters API ---------------------------------------------------
/**
* Return the attributes of all the cluster MBeans.
*
* @param request the http request
*
* @return the attributes of all the cluster MBeans
*/
public Response get(HttpRequest request)
{
Set setCluster = f_supplierClusters.get();
Filter filter = getLinksFilter(request);
EntityMBeanResponse mBeanResponse = new EntityMBeanResponse(request, filter);
List