public final class RouterWebServiceUtil extends Object
Modifier and Type | Method and Description |
---|---|
static javax.ws.rs.core.Response |
clientResponseToResponse(com.sun.jersey.api.client.ClientResponse r) |
protected static com.sun.jersey.api.client.Client |
createJerseyClient(org.apache.hadoop.conf.Configuration conf)
Create a Jersey client instance.
|
static void |
createKerberosUserGroupInformation(javax.servlet.http.HttpServletRequest hsr) |
static org.apache.hadoop.yarn.server.resourcemanager.webapp.dao.NodesInfo |
deleteDuplicateNodesInfo(ArrayList<org.apache.hadoop.yarn.server.resourcemanager.webapp.dao.NodeInfo> nodes)
Deletes all the duplicate NodeInfo by discarding the old instances.
|
static org.apache.hadoop.security.token.Token<org.apache.hadoop.yarn.security.client.RMDelegationTokenIdentifier> |
extractToken(javax.servlet.http.HttpServletRequest request) |
static org.apache.hadoop.security.token.Token<org.apache.hadoop.yarn.security.client.RMDelegationTokenIdentifier> |
extractToken(String encodedToken)
Parse Token data.
|
static String |
generateWebTitle(String title,
String msg) |
protected static <T> T |
genericForward(String webApp,
javax.servlet.http.HttpServletRequest hsr,
Class<T> returnType,
HTTPMethods method,
String targetPath,
Object formParam,
Map<String,String[]> additionalParam,
org.apache.hadoop.conf.Configuration conf,
com.sun.jersey.api.client.Client client)
Creates and performs a REST call to a specific WebService.
|
static org.apache.hadoop.security.UserGroupInformation |
getKerberosUserGroupInformation(org.apache.hadoop.conf.Configuration conf,
javax.servlet.http.HttpServletRequest request)
Get Kerberos UserGroupInformation.
|
protected static <T> String |
getMediaTypeFromHttpServletRequest(javax.servlet.http.HttpServletRequest request,
Class<T> returnType)
Extract from HttpServletRequest the MediaType in output.
|
static void |
initForWritableEndpoints(org.apache.hadoop.conf.Configuration conf,
org.apache.hadoop.security.UserGroupInformation callerUGI)
initForWritableEndpoints does the init and acls verification for all
writable REST end points.
|
static org.apache.hadoop.yarn.server.resourcemanager.webapp.dao.ApplicationStatisticsInfo |
mergeApplicationStatisticsInfo(Collection<org.apache.hadoop.yarn.server.resourcemanager.webapp.dao.ApplicationStatisticsInfo> appStatistics) |
static org.apache.hadoop.yarn.server.resourcemanager.webapp.dao.AppsInfo |
mergeAppsInfo(ArrayList<org.apache.hadoop.yarn.server.resourcemanager.webapp.dao.AppInfo> appsInfo,
boolean returnPartialResult)
Merges a list of AppInfo grouping by ApplicationId.
|
static void |
mergeMetrics(org.apache.hadoop.yarn.server.resourcemanager.webapp.dao.ClusterMetricsInfo metrics,
org.apache.hadoop.yarn.server.resourcemanager.webapp.dao.ClusterMetricsInfo metricsResponse)
Adds all the values from the second ClusterMetricsInfo to the first one.
|
static org.apache.hadoop.yarn.server.resourcemanager.webapp.dao.NodeLabelsInfo |
mergeNodeLabelsInfo(Map<org.apache.hadoop.yarn.server.federation.store.records.SubClusterInfo,org.apache.hadoop.yarn.server.resourcemanager.webapp.dao.NodeLabelsInfo> paramMap) |
static org.apache.hadoop.yarn.server.resourcemanager.webapp.dao.NodeToLabelsInfo |
mergeNodeToLabels(Map<org.apache.hadoop.yarn.server.federation.store.records.SubClusterInfo,org.apache.hadoop.yarn.server.resourcemanager.webapp.dao.NodeToLabelsInfo> nodeToLabelsInfoMap) |
static void |
retrieveException(com.sun.jersey.api.client.ClientResponse response) |
protected static <T> T genericForward(String webApp, javax.servlet.http.HttpServletRequest hsr, Class<T> returnType, HTTPMethods method, String targetPath, Object formParam, Map<String,String[]> additionalParam, org.apache.hadoop.conf.Configuration conf, com.sun.jersey.api.client.Client client)
T
- Type of return object.webApp
- the address of the remote webapphsr
- the servlet requestreturnType
- the return type of the REST callmethod
- the HTTP method of the REST calltargetPath
- additional path to add to the webapp addressformParam
- the form parameters as input for a specific REST calladditionalParam
- the query parameters as input for a specific REST
call in case the call has no servlet requestconf
- configuration.client
- same client used to reduce number of clients createdpublic static javax.ws.rs.core.Response clientResponseToResponse(com.sun.jersey.api.client.ClientResponse r)
public static void retrieveException(com.sun.jersey.api.client.ClientResponse response)
public static org.apache.hadoop.yarn.server.resourcemanager.webapp.dao.AppsInfo mergeAppsInfo(ArrayList<org.apache.hadoop.yarn.server.resourcemanager.webapp.dao.AppInfo> appsInfo, boolean returnPartialResult)
appsInfo
- a list of AppInfo to mergereturnPartialResult
- if the merge AppsInfo should contain partial
result or notprotected static com.sun.jersey.api.client.Client createJerseyClient(org.apache.hadoop.conf.Configuration conf)
conf
- Configurationpublic static org.apache.hadoop.yarn.server.resourcemanager.webapp.dao.NodesInfo deleteDuplicateNodesInfo(ArrayList<org.apache.hadoop.yarn.server.resourcemanager.webapp.dao.NodeInfo> nodes)
nodes
- a list of NodeInfo to check for duplicatespublic static void mergeMetrics(org.apache.hadoop.yarn.server.resourcemanager.webapp.dao.ClusterMetricsInfo metrics, org.apache.hadoop.yarn.server.resourcemanager.webapp.dao.ClusterMetricsInfo metricsResponse)
metrics
- the ClusterMetricsInfo we want to updatemetricsResponse
- the ClusterMetricsInfo we want to add to the first
paramprotected static <T> String getMediaTypeFromHttpServletRequest(javax.servlet.http.HttpServletRequest request, Class<T> returnType)
T
- Generic Type T.request
- the servlet request.returnType
- the return type of the REST call.public static org.apache.hadoop.yarn.server.resourcemanager.webapp.dao.NodeToLabelsInfo mergeNodeToLabels(Map<org.apache.hadoop.yarn.server.federation.store.records.SubClusterInfo,org.apache.hadoop.yarn.server.resourcemanager.webapp.dao.NodeToLabelsInfo> nodeToLabelsInfoMap)
public static org.apache.hadoop.yarn.server.resourcemanager.webapp.dao.ApplicationStatisticsInfo mergeApplicationStatisticsInfo(Collection<org.apache.hadoop.yarn.server.resourcemanager.webapp.dao.ApplicationStatisticsInfo> appStatistics)
public static org.apache.hadoop.yarn.server.resourcemanager.webapp.dao.NodeLabelsInfo mergeNodeLabelsInfo(Map<org.apache.hadoop.yarn.server.federation.store.records.SubClusterInfo,org.apache.hadoop.yarn.server.resourcemanager.webapp.dao.NodeLabelsInfo> paramMap)
public static void initForWritableEndpoints(org.apache.hadoop.conf.Configuration conf, org.apache.hadoop.security.UserGroupInformation callerUGI) throws org.apache.hadoop.security.authorize.AuthorizationException
conf
- Configuration.callerUGI
- remote caller who initiated the request.org.apache.hadoop.security.authorize.AuthorizationException
- in case of no access to perfom this op.public static void createKerberosUserGroupInformation(javax.servlet.http.HttpServletRequest hsr) throws org.apache.hadoop.yarn.exceptions.YarnException
org.apache.hadoop.yarn.exceptions.YarnException
public static org.apache.hadoop.security.token.Token<org.apache.hadoop.yarn.security.client.RMDelegationTokenIdentifier> extractToken(String encodedToken)
encodedToken
- tokenDatapublic static org.apache.hadoop.security.token.Token<org.apache.hadoop.yarn.security.client.RMDelegationTokenIdentifier> extractToken(javax.servlet.http.HttpServletRequest request)
public static org.apache.hadoop.security.UserGroupInformation getKerberosUserGroupInformation(org.apache.hadoop.conf.Configuration conf, javax.servlet.http.HttpServletRequest request) throws org.apache.hadoop.security.authorize.AuthorizationException, org.apache.hadoop.yarn.exceptions.YarnException
conf
- Configuration.request
- the servlet request.org.apache.hadoop.security.authorize.AuthorizationException
- if Kerberos auth failed.org.apache.hadoop.yarn.exceptions.YarnException
- If Authentication Type verification fails.Copyright © 2008–2024 Apache Software Foundation. All rights reserved.