com.tangosol.coherence.management.internal.resources.ClustersResource Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of coherence-management Show documentation
Show all versions of coherence-management Show documentation
Oracle Coherence Community Edition
/*
* Copyright (c) 2000, 2020, 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.coherence.management.internal.resources;
import com.tangosol.coherence.management.internal.ClusterNameSupplier;
import com.tangosol.coherence.management.internal.EntityMBeanResponse;
import com.tangosol.util.Filter;
import javax.ws.rs.GET;
import javax.ws.rs.POST;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.ws.rs.Produces;
import javax.ws.rs.core.Response;
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.stream.Collectors;
/**
* The clusters resource is the base resource for anything Coherence specific. All the resources wrt Coherence
* Management API will be a child of the clusters API.
*/
public class ClustersResource
extends AbstractManagementResource
{
ClustersResource(AbstractManagementResource resource, ClusterNameSupplier supplierClusters)
{
super(resource);
f_supplierClusters = supplierClusters;
setDomainPartitionFilter(createDomainPartitionFilter());
}
@GET
@Produces(MEDIA_TYPES)
public Response get()
{
return response(getClustersResponse());
}
@POST
@Produces(MEDIA_TYPES)
@Path(SEARCH)
public Response search(Map entity)
{
if (entity == null)
{
entity = Collections.emptyMap();
}
return response(getSearchResponse(entity));
}
@Path("{" + CLUSTER_NAME + "}")
public Object getClusterResource(@PathParam(CLUSTER_NAME) String clusterName)
{
ClusterResource resource = new ClusterResource(this);
resource.setClusterName(clusterName);
return resource;
}
protected EntityMBeanResponse getClustersResponse()
{
Set setCluster = getRunningCoherenceClusterNames();
Filter filter = getLinksFilter();
EntityMBeanResponse response = new EntityMBeanResponse(getRequestContext(), filter);
List