Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance. Project price only 1 $
You can buy this project and download/modify it how often you want.
/*
* Copyright (c) 2000, 2021, 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.EntityMBeanResponse;
import com.tangosol.coherence.management.internal.MBeanResponse;
import com.tangosol.net.management.MBeanAccessor;
import com.tangosol.net.management.MBeanAccessor.QueryBuilder;
import com.tangosol.net.CacheFactory;
import com.tangosol.util.Filter;
import java.net.URI;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.Set;
import java.util.function.Predicate;
import java.util.stream.Collectors;
import javax.management.ObjectName;
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.WebApplicationException;
import javax.ws.rs.core.Response;
/**
* Handles management API requests for services in a cluster.
*
* @author sr 2017.08.29
* @since 12.2.1.4.0
*/
public class ServicesResource extends AbstractManagementResource
{
// ----- constructors ---------------------------------------------------
/**
* Construct a ServicesResource.
*
* @param resource the {@link AbstractManagementResource} to be used to initialize the context
*/
public ServicesResource(AbstractManagementResource resource)
{
super(resource);
}
// ----- GET API --------------------------------------------------------
/**
* Return the list of services in a cluster.
*
* @return the response object
*/
@GET
@Produces(MEDIA_TYPES)
public Response get()
{
EntityMBeanResponse response = getResponseBodyForMBeanCollection(getQuery(), new ServiceResource(this),
NAME, null, getParentUri(), getCurrentUri(), null);
if (response == null && getService() != null)
{
return Response.status(Response.Status.NOT_FOUND).build();
}
return response == null
? response(new EntityMBeanResponse())
: response(response);
}
/**
* Returns the list of all ServiceMBean members in the cluster.
*
* @return the response object.
*/
@GET
@Produces(MEDIA_TYPES)
@Path(MEMBERS)
public Response getAllServiceMembers()
{
return response(getResponseBodyForMBeanCollection(getQuery(), null,
getParentUri(), getCurrentUri()));
}
/**
* Returns the list of all ServiceMBean members in the cluster.
*
* @return the response object.
*/
@GET
@Produces(MEDIA_TYPES)
@Path(PROXY + "/" + MEMBERS)
public Response getAllProxyMembers()
{
QueryBuilder bldrQuery = createQueryBuilder().withBaseQuery(CONNECTION_MANAGERS_QUERY);
return response(getResponseBodyForMBeanCollection(bldrQuery, null,
getParentUri(), getCurrentUri()));
}
/**
* Issues a "createSnapshot" operation on the PersistenceManagerMBean for
* all persistence enabled services.
*
* Note: the implementation does not (currently) perform a "safe" snapshot
* across all services (i.e. all or nothing).
*
* @return the response object
*/
@POST
@Produces(MEDIA_TYPES)
@Path("persistence/snapshots/{" + SNAPSHOT_NAME + "}")
public Response executeSnapshotOperationAllServices(@PathParam(SNAPSHOT_NAME) String sSnapshotName)
{
String[] asSignature = {String.class.getName()};
Object[] aoArguments = {sSnapshotName};
// get the list of services enabled for persistence
EntityMBeanResponse response = getResponseBodyForMBeanCollection(instantiatePersistentServicesQuery(), null,
getParentUri(), getCurrentUri());
List