com.tangosol.internal.management.resources.VersionsResource 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.internal.management.VersionUtils;
import com.tangosol.util.Filter;
import java.util.ArrayList;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.function.Supplier;
/**
*
* The versions resource contains information about the versions of the Coherence management REST interface that are
* active and supported in the current the WLS domain.
*
*
* For information about versions supported by the REST interface, see {@code version_indicator}.
*
*
* @author Jonathan Knight 2022.01.25
*/
public class VersionsResource
extends AbstractManagementResource
{
// ----- constructors ---------------------------------------------------
public VersionsResource(Supplier> f_supplierClusters)
{
this.f_supplierClusters = f_supplierClusters;
}
// ----- Routes methods -------------------------------------------------
@Override
public void addRoutes(RequestRouter router, String sPathRoot)
{
router.addGet(sPathRoot + "", this::get);
router.addRoutes(sPathRoot + "/" + VersionUtils.V1, new VersionResource(f_supplierClusters));
router.addRoutes(sPathRoot + "/" + VersionUtils.LATEST, new VersionResource(f_supplierClusters));
}
// ----- Versions API ---------------------------------------------------
/**
* The GET method on this resource returns information about each supported version of this REST interface.
*/
public Response get(HttpRequest request)
{
String sIncludeFields = request.getFirstQueryParameter(INCLUDE_FIELDS);
String sExcludeFields = request.getFirstQueryParameter(EXCLUDE_FIELDS);
Filter propertiesFilter = getAttributesFilter(sIncludeFields, sExcludeFields);
Filter linksFilter = getLinksFilter(request);
EntityMBeanResponse mBeanResponse = new EntityMBeanResponse(request, linksFilter);
List