Skip to content

Commit 1591b82

Browse files
author
mthakkar
committed
[java] Updated with v12 java source
1 parent 13dc996 commit 1591b82

File tree

82 files changed

+4141
-175
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

82 files changed

+4141
-175
lines changed

java/api-docs.fmt

+160-47
Original file line numberDiff line numberDiff line change
@@ -1064,10 +1064,10 @@
10641064
A service is an abstract entity providing a capability in a cluster.
10651065
Examples of services are HDFS, MapReduce, YARN, and HBase. A service
10661066
is usually distributed, and contains a set of roles that physically
1067-
run on the cluster. A service has its own configuration, status,
1068-
metrics, and roles. You may issue commands against a service, or
1069-
against a set of roles in bulk. Additionally, an HDFS service has
1070-
nameservices, and a MapReduce service has activities.
1067+
run on the cluster. A service has its own configuration, status and
1068+
roles. You may issue commands against a service, or against a set
1069+
of roles in bulk. Additionally, an HDFS service has nameservices,
1070+
and a MapReduce service has activities.
10711071
<p>
10721072
All services belong to a cluster (except for the Cloudera Management
10731073
Service), and is uniquely identified by its name within a Cloudera
@@ -1083,8 +1083,8 @@
10831083
processes.) Once created, a role cannot be reassigned to a different
10841084
host. You need to delete and re-create it.
10851085
<p>
1086-
A role has its own configuration, status and metrics. API commands on
1087-
roles are always issued in bulk at the service level.
1086+
A role has its own configuration and status. API commands on roles
1087+
are always issued in bulk at the service level.
10881088
</dd>
10891089
<dt>Role Type</dt>
10901090
<dd>
@@ -1119,6 +1119,18 @@
11191119
The operation of this service is similar to other Hadoop services, except
11201120
that the Management Service does not belong to a cluster.
11211121
</dd>
1122+
<dt>Metrics</dt>
1123+
<dd>
1124+
<p>
1125+
A metric is a property that can be measured to quantify the state of an
1126+
entity or activity, such as the number of open file descriptors or CPU
1127+
utilization percentage. Full list of metric schema is available through
1128+
Cloudera Manager API /timeseries/schema endpoint.
1129+
<p>
1130+
Cloudera Manager enables retrieving of metric data using a launguage
1131+
called tsquery. Please see tsquery documentation for more details on
1132+
how to write a tsquery.
1133+
</dd>
11221134
</dl>
11231135

11241136
<h2>Debugging the API</h2>
@@ -1504,56 +1516,157 @@
15041516
}
15051517
}</code>
15061518

1507-
<h3>Metrics</h3>
1519+
<h3>Querying metric data</h3>
15081520

1509-
<p>In the Enterprise Edition, you can get metrics related to hosts,
1510-
services, roles and activities. The call by default fetches data points from
1511-
the last 5 minutes.
1521+
<p>
1522+
Getting dfs capacity metric data for service HDFS-1.
15121523
<code>
15131524
$ curl -u admin:admin \
1514-
'http://localhost:7180/api/v1/clusters/Cluster%201%20-%20CDH4/services/hdfs1/metrics?metrics=dfs_capacity_used_non_hdfs&amp;metrics=dfs_capacity'
1525+
'http://localhost:7180/api/v11/timeseries?query=select%20dfs_capacity,%20dfs_capacity_used,%20dfs_capacity_used_non_hdfs%20where%20entityName=HDFS-1'
15151526

15161527
{
15171528
"items" : [ {
1518-
"name" : "dfs_capacity_used_non_hdfs",
1519-
"context" : "hdfs1:nameservice1",
1520-
"data" : [ {
1521-
"value" : 0.0,
1522-
"timestamp" : "2012-05-06T10:25:46.000Z"
1523-
}, {
1524-
"value" : 0.0,
1525-
"timestamp" : "2012-05-06T10:26:46.000Z"
1526-
}, {
1527-
"value" : 0.0,
1528-
"timestamp" : "2012-05-06T10:27:46.000Z"
1529-
}, {
1530-
"value" : 0.0,
1531-
"timestamp" : "2012-05-06T10:28:46.000Z"
1532-
}, {
1533-
"value" : 0.0,
1534-
"timestamp" : "2012-05-06T10:29:46.000Z"
1535-
} ],
1536-
"unit" : "bytes"
1537-
}, {
1538-
"name" : "dfs_capacity",
1539-
"context" : "hdfs1:nameservice1",
1540-
"data" : [ {
1541-
"value" : 3.2103841792E10,
1542-
"timestamp" : "2012-05-06T10:25:46.000Z"
1543-
}, {
1544-
"value" : 3.2103841792E10,
1545-
"timestamp" : "2012-05-06T10:26:46.000Z"
1546-
}, {
1547-
"value" : 3.2103841792E10,
1548-
"timestamp" : "2012-05-06T10:27:46.000Z"
1529+
"timeSeries": [ {
1530+
"metadata": {
1531+
"metricName": "dfs_capacity",
1532+
"entityName": "HDFS-1",
1533+
"startTime": "2015-09-17T23:42:22.533Z",
1534+
"endTime": "2015-09-17T23:47:22.533Z",
1535+
"attributes": {
1536+
"clusterName": "Cluster 1",
1537+
"category": "SERVICE",
1538+
"clusterDisplayName": "Cluster 1",
1539+
"active": "true",
1540+
"serviceType": "HDFS",
1541+
"serviceDisplayName": "HDFS-1",
1542+
"version": "CDH 5.7.0",
1543+
"serviceName": "HDFS-1",
1544+
"entityName": "HDFS-1"
1545+
},
1546+
"unitNumerators": [
1547+
"bytes"
1548+
],
1549+
"unitDenominators": [],
1550+
"expression": "SELECT dfs_capacity WHERE entityName = \"HDFS-1\" AND category = SERVICE",
1551+
"metricCollectionFrequencyMs": 60000,
1552+
"rollupUsed": "RAW"
1553+
},
1554+
"data": [ {
1555+
"timestamp": "2015-09-17T23:43:10.599Z",
1556+
"value": 86909397813,
1557+
"type": "SAMPLE"
1558+
}, {
1559+
"timestamp": "2015-09-17T23:44:10.605Z",
1560+
"value": 86909397813,
1561+
"type": "SAMPLE"
1562+
}, {
1563+
"timestamp": "2015-09-17T23:45:10.608Z",
1564+
"value": 86909397813,
1565+
"type": "SAMPLE"
1566+
}, {
1567+
"timestamp": "2015-09-17T23:46:10.615Z",
1568+
"value": 86909397813,
1569+
"type": "SAMPLE"
1570+
}, {
1571+
"timestamp": "2015-09-17T23:47:15.613Z",
1572+
"value": 86909397813,
1573+
"type": "SAMPLE"
1574+
} ]
15491575
}, {
1550-
"value" : 3.2103841792E10,
1551-
"timestamp" : "2012-05-06T10:28:46.000Z"
1576+
"metadata": {
1577+
"metricName": "dfs_capacity_used",
1578+
"entityName": "HDFS-1",
1579+
"startTime": "2015-09-17T23:42:22.533Z",
1580+
"endTime": "2015-09-17T23:47:22.533Z",
1581+
"attributes": {
1582+
"clusterName": "Cluster 1",
1583+
"category": "SERVICE",
1584+
"clusterDisplayName": "Cluster 1",
1585+
"active": "true",
1586+
"serviceType": "HDFS",
1587+
"serviceDisplayName": "HDFS-1",
1588+
"version": "CDH 5.7.0",
1589+
"serviceName": "HDFS-1",
1590+
"entityName": "HDFS-1"
1591+
},
1592+
"unitNumerators": [
1593+
"bytes"
1594+
],
1595+
"unitDenominators": [],
1596+
"expression": "SELECT dfs_capacity_used WHERE entityName = \"HDFS-1\" AND category = SERVICE",
1597+
"metricCollectionFrequencyMs": 60000,
1598+
"rollupUsed": "RAW"
1599+
},
1600+
"data": [ {
1601+
"timestamp": "2015-09-17T23:43:10.599Z",
1602+
"value": 1728884736,
1603+
"type": "SAMPLE"
1604+
}, {
1605+
"timestamp": "2015-09-17T23:44:10.605Z",
1606+
"value": 1728884736,
1607+
"type": "SAMPLE"
1608+
}, {
1609+
"timestamp": "2015-09-17T23:45:10.608Z",
1610+
"value": 1728884736,
1611+
"type": "SAMPLE"
1612+
}, {
1613+
"timestamp": "2015-09-17T23:46:10.615Z",
1614+
"value": 1728884736,
1615+
"type": "SAMPLE"
1616+
}, {
1617+
"timestamp": "2015-09-17T23:47:15.613Z",
1618+
"value": 1728884736,
1619+
"type": "SAMPLE"
1620+
} ]
15521621
}, {
1553-
"value" : 3.2103841792E10,
1554-
"timestamp" : "2012-05-06T10:29:46.000Z"
1622+
"metadata": {
1623+
"metricName": "dfs_capacity_used_non_hdfs",
1624+
"entityName": "HDFS-1",
1625+
"startTime": "2015-09-17T23:42:22.533Z",
1626+
"endTime": "2015-09-17T23:47:22.533Z",
1627+
"attributes": {
1628+
"clusterName": "Cluster 1",
1629+
"category": "SERVICE",
1630+
"clusterDisplayName": "Cluster 1",
1631+
"active": "true",
1632+
"serviceType": "HDFS",
1633+
"serviceDisplayName": "HDFS-1",
1634+
"version": "CDH 5.7.0",
1635+
"serviceName": "HDFS-1",
1636+
"entityName": "HDFS-1"
1637+
},
1638+
"unitNumerators": [
1639+
"bytes"
1640+
],
1641+
"unitDenominators": [],
1642+
"expression": "SELECT dfs_capacity_used_non_hdfs WHERE entityName = \"HDFS-1\" AND category = SERVICE",
1643+
"metricCollectionFrequencyMs": 60000,
1644+
"rollupUsed": "RAW"
1645+
},
1646+
"data": [ {
1647+
"timestamp": "2015-09-17T23:43:10.599Z",
1648+
"value": 1610609973,
1649+
"type": "SAMPLE"
1650+
}, {
1651+
"timestamp": "2015-09-17T23:44:10.605Z",
1652+
"value": 1610609973,
1653+
"type": "SAMPLE"
1654+
}, {
1655+
"timestamp": "2015-09-17T23:45:10.608Z",
1656+
"value": 1610609973,
1657+
"type": "SAMPLE"
1658+
}, {
1659+
"timestamp": "2015-09-17T23:46:10.615Z",
1660+
"value": 1610609973,
1661+
"type": "SAMPLE"
1662+
}, {
1663+
"timestamp": "2015-09-17T23:47:15.613Z",
1664+
"value": 1610609973,
1665+
"type": "SAMPLE"
1666+
} ]
15551667
} ],
1556-
"unit" : "bytes"
1668+
"warnings": [],
1669+
"timeSeriesQuery": "select dfs_capacity, dfs_capacity_used, dfs_capacity_used_non_hdfs where entityName=HDFS-1"
15571670
} ]</code>
15581671

15591672
[/@boilerplate]

java/enunciate.xml

+3-3
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,18 @@
22
xsi:noNamespaceSchemaLocation="http://enunciate.codehaus.org/schemas/enunciate-1.27.xsd">
33

44
<api-classes>
5-
<include pattern="com.cloudera.api.v10.*"/>
5+
<include pattern="com.cloudera.api.v12.*"/>
66
</api-classes>
77

88
<services>
9-
<rest defaultRestSubcontext="/api/v10"/>
9+
<rest defaultRestSubcontext="/api/v12"/>
1010
</services>
1111

1212
<modules>
1313
<docs splashPackage="com.cloudera.api"
1414
copyright="Cloudera, Inc. All rights reserved."
1515
docsDir="apidocs"
16-
title="Cloudera Manager API v10"
16+
title="Cloudera Manager API v12"
1717
groupRestResources="byPath"
1818
freemarkerXMLProcessingTemplate="api-docs.fmt"
1919
css="static/cms/css/api-docs.css"

java/pom.xml

+33-3
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
<version>5.7.0</version>
99

1010
<properties>
11-
<cxf.version>2.7.5</cxf.version>
11+
<cxf.version>2.7.7</cxf.version>
1212
<guava.version>14.0</guava.version>
1313
<jackson2.version>2.1.0</jackson2.version>
1414
<joda.version>2.1</joda.version>
@@ -21,7 +21,7 @@
2121
<distributionManagement>
2222
<repository>
2323
<id>cdh.releases.repo</id>
24-
<url>http://maven.jenkins.cloudera.com:8081/artifactory/libs-release-local</url>
24+
<url>http://maven.jenkins.cloudera.com:8081/artifactory/cdh-staging-local</url>
2525
<name>CDH Releases Repository</name>
2626
</repository>
2727
<snapshotRepository>
@@ -114,6 +114,36 @@
114114
</plugins>
115115
</build>
116116
</profile>
117+
<profile>
118+
<!-- profile to use with Atlassian Clover for code coverage -->
119+
<id>clover</id>
120+
<properties>
121+
<clover.version>4.0.3</clover.version>
122+
<clover.generateHtml>true</clover.generateHtml>
123+
<clover.generateXml>true</clover.generateXml>
124+
</properties>
125+
<dependencies>
126+
<dependency>
127+
<groupId>com.atlassian.clover</groupId>
128+
<artifactId>clover</artifactId>
129+
<version>${clover.version}</version>
130+
</dependency>
131+
</dependencies>
132+
<build>
133+
<plugins>
134+
<plugin>
135+
<!-- Clover plugin to enable maven to create instantiated jars that will record code coverage -->
136+
<groupId>com.atlassian.maven.plugins</groupId>
137+
<artifactId>maven-clover2-plugin</artifactId>
138+
<version>${clover.version}</version>
139+
<configuration>
140+
<generateHtml>${clover.generateHtml}</generateHtml>
141+
<generateXml>${clover.generateXml}</generateXml>
142+
</configuration>
143+
</plugin>
144+
</plugins>
145+
</build>
146+
</profile>
117147
</profiles>
118148

119149
<build>
@@ -153,7 +183,7 @@
153183
<pattern>com.</pattern>
154184
<shadedPattern>${privateClassPath}.com.</shadedPattern>
155185
<includes>
156-
<include>com.google.guava.**</include>
186+
<include>com.google.common.**</include>
157187
<include>com.fasterxml.jackson.**</include>
158188
</includes>
159189
</relocation>

java/src/main/java/com/cloudera/api/ApiRootResource.java

+16-1
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,9 @@
1616
package com.cloudera.api;
1717

1818
import com.cloudera.api.v1.RootResourceV1;
19+
import com.cloudera.api.v10.RootResourceV10;
20+
import com.cloudera.api.v11.RootResourceV11;
21+
import com.cloudera.api.v12.RootResourceV12;
1922
import com.cloudera.api.v2.RootResourceV2;
2023
import com.cloudera.api.v3.RootResourceV3;
2124
import com.cloudera.api.v4.RootResourceV4;
@@ -24,7 +27,7 @@
2427
import com.cloudera.api.v7.RootResourceV7;
2528
import com.cloudera.api.v8.RootResourceV8;
2629
import com.cloudera.api.v9.RootResourceV9;
27-
import com.cloudera.api.v10.RootResourceV10;
30+
import com.cloudera.api.v12.RootResourceV12;
2831

2932
import javax.ws.rs.Consumes;
3033
import javax.ws.rs.GET;
@@ -101,6 +104,18 @@ public interface ApiRootResource {
101104
@Path("/v10")
102105
RootResourceV10 getRootV10();
103106

107+
/**
108+
* @return The v11 root resource.
109+
*/
110+
@Path("/v11")
111+
RootResourceV11 getRootV11();
112+
113+
/**
114+
* @return The v12 root resource.
115+
*/
116+
@Path("/v12")
117+
RootResourceV12 getRootV12();
118+
104119
/**
105120
* Fetch the current API version supported by the server.
106121
* <p>

java/src/main/java/com/cloudera/api/ApiUtils.java

+11
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,17 @@ public static void checkOffsetAndLimit(int offset, int limit) {
135135
"Limit should be greater than 0.");
136136
}
137137

138+
139+
/**
140+
* Check that the given limit is positive.
141+
*
142+
* @param limit Value to use as limit of a list's size.
143+
*/
144+
public static void checkLimit(int limit) {
145+
Preconditions.checkArgument(limit > 0,
146+
"Limit should be greater than 0.");
147+
}
148+
138149
private ApiUtils() { }
139150

140151
}

0 commit comments

Comments
 (0)