Skip to content
This repository has been archived by the owner. It is now read-only.
Permalink
Browse files
CHUKWA-718. Updated Chukwa Agent REST API document and generation met…
…hod. (Eric Yang)

git-svn-id: https://svn.apache.org/repos/asf/chukwa/trunk@1611856 13f79535-47bb-0310-9956-ffa450edef68
  • Loading branch information
macroadster committed Jul 19, 2014
1 parent 0a2f924 commit 7d3c502c364ac9890ec98033141ecf254253babf
Showing 16 changed files with 1,557 additions and 513 deletions.
@@ -34,6 +34,8 @@ Release 0.6 - Unreleased

IMPROVEMENTS

CHUKWA-718. Updated Chukwa Agent REST API document and generation method. (Eric Yang)

CHUKWA-710. Set TCP socket reuse option for server sockets. (Shreyas Subramanya)

CHUKWA-698. Update RAT plugin to 0.10 release and fixed missing license header. (Eric Yang)
191 pom.xml
@@ -354,18 +354,6 @@
</resource>
</resources>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-site-plugin</artifactId>
<version>3.0</version>
<dependencies>
<dependency><!-- add support for ssh/scp -->
<groupId>org.apache.maven.wagon</groupId>
<artifactId>wagon-ssh</artifactId>
<version>1.0</version>
</dependency>
</dependencies>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
@@ -543,7 +531,7 @@
</goals>
<configuration>
<skip>false</skip>
<argLine>-Xmx1024m -Dtest.build.data=${test.build.data}</argLine>
<argLine>-Xmx1024m</argLine>
<reportsDirectory>${project.build.directory}/test-reports</reportsDirectory>
<forkMode>pertest</forkMode>
<redirectTestOutputToFile>true</redirectTestOutputToFile>
@@ -556,6 +544,7 @@
<exclude>**/*$*</exclude>
</excludes>
<systemPropertyVariables>
<test.build.data>${project.build.directory}/test/var</test.build.data>
<CHUKWA_LOG_DIR>${project.build.directory}/test/var/log</CHUKWA_LOG_DIR>
<CHUKWA_CONF_DIR>${project.build.directory}/test/conf</CHUKWA_CONF_DIR>
<CHUKWA_DATA_DIR>${project.build.directory}/test/var</CHUKWA_DATA_DIR>
@@ -707,6 +696,7 @@
<configuration>
<tasks>
<mkdir dir="${project.build.directory}/site" />
<mkdir dir="${basedir}/target/site/apidocs"/>
<exec executable="perl" input="CHANGES.txt" output="${project.build.directory}/site/changes.html" failonerror="true">
<arg value="src/site/resources/scripts/changes2html.pl" />
</exec>
@@ -1064,6 +1054,149 @@
</plugins>
</build>
</profile>
<profile>
<id>docs</id>
<activation>
<file>
<exists>/usr/bin/xsltproc</exists>
</file>
</activation>
<build>
<plugins>
<!-- Generate HTML version of REST API document -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-site-plugin</artifactId>
<version>3.0</version>
<dependencies>
<dependency><!-- add support for ssh/scp -->
<groupId>org.apache.maven.wagon</groupId>
<artifactId>wagon-ssh</artifactId>
<version>1.0</version>
</dependency>
</dependencies>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<executions>
<execution>
<id>agent-public-api</id>
<goals>
<goal>javadoc</goal>
</goals>
<phase>compile</phase>
<configuration>
<encoding>UTF-8</encoding>
<verbose>false</verbose>
<show>public</show>
<subpackages>org.apache.hadoop.chukwa.datacollection.agent.rest</subpackages>
<doclet>com.sun.jersey.wadl.resourcedoc.ResourceDocletJSON</doclet>
<!-- <docletPath>${path.separator}${project.build.outputDirectory}</docletPath> -->
<docletArtifacts>
<docletArtifact>
<groupId>com.atlassian.plugins.rest</groupId>
<artifactId>atlassian-rest-doclet</artifactId>
<version>2.8.0-m3</version>
</docletArtifact>
</docletArtifacts>
<useStandardDocletOptions>false</useStandardDocletOptions>
<additionalparam>-output ${project.build.outputDirectory}/agent-rest.xml</additionalparam>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>com.sun.jersey.contribs</groupId>
<artifactId>maven-wadl-plugin</artifactId>
<version>1.8</version>
<executions>
<execution>
<id>generate</id>
<goals>
<goal>generate</goal>
</goals>
<phase>compile</phase>
</execution>
</executions>
<configuration>
<wadlFile>${project.build.outputDirectory}/application.wadl</wadlFile>
<formatWadlFile>true</formatWadlFile>
<baseUri>http://[host]:[port]/rest/v2</baseUri>
<packagesResourceConfig>
<param>org.apache.hadoop.chukwa.datacollection.agent.rest</param>
</packagesResourceConfig>
<wadlGenerators>
<wadlGeneratorDescription>
<className>com.sun.jersey.server.wadl.generators.WadlGeneratorApplicationDoc</className>
<properties>
<property>
<name>applicationDocsFile</name>
<value>${basedir}/src/main/resources/agent-rest.xml</value>
</property>
</properties>
</wadlGeneratorDescription>
<wadlGeneratorDescription>
<className>com.sun.jersey.server.wadl.generators.WadlGeneratorGrammarsSupport</className>
<properties>
<property>
<name>grammarsFile</name>
<value>${basedir}/src/main/resources/application-grammars.xml</value>
</property>
</properties>
</wadlGeneratorDescription>
<wadlGeneratorDescription>
<className>com.sun.jersey.server.wadl.generators.resourcedoc.WadlGeneratorResourceDocSupport</className>
<properties>
<property>
<name>resourceDocFile</name>
<value>${project.build.outputDirectory}/agent-rest.xml</value>
</property>
</properties>
</wadlGeneratorDescription>
</wadlGenerators>
</configuration>
<dependencies>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
<version>2.5</version>
</dependency>
</dependencies>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>1.1</version>
<executions>
<execution>
<id>exec-xsltproc: target/application.html</id>
<goals>
<goal>exec</goal>
</goals>
<phase>package</phase>
<configuration>
<executable>xsltproc</executable>
<commandlineArgs>-o ${project.build.directory}/site/apidocs/agent-rest.html src/main/webapps/wadl.xsl target/classes/application.wadl</commandlineArgs>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>com.sun.jersey.contribs</groupId>
<artifactId>maven-wadl-plugin</artifactId>
<version>1.8</version>
</dependency>
<dependency>
<groupId>com.sun.jersey.contribs</groupId>
<artifactId>wadl-resourcedoc-doclet</artifactId>
<version>1.8</version>
</dependency>
</dependencies>
</profile>
</profiles>

<repositories>
@@ -1079,6 +1212,10 @@
<id>Apache</id>
<url>http://repo.maven.apache.org/maven2/</url>
</repository>
<repository>
<id>opencast</id>
<url>http://repository.opencastproject.org/nexus/content/repositories/public/</url>
</repository>
</repositories>

<dependencyManagement>
@@ -1146,6 +1283,34 @@
<report>javadoc</report>
</reports>
</reportSet>
<!-- <reportSet>
<id>restdoc</id>
<configuration>
<encoding>UTF-8</encoding>
<verbose>false</verbose>
<show>public</show>
<subpackages>org.apache.hadoop.chukwa.datacollection.agent.rest</subpackages>
<doclet>com.sun.jersey.wadl.resourcedoc.ResourceDoclet</doclet>
<docletPath>${path.separator}${project.build.outputDirectory}</docletPath>
<docletArtifacts>
<docletArtifact>
<groupId>com.sun.jersey.contribs</groupId>
<artifactId>wadl-resourcedoc-doclet</artifactId>
<version>1.8</version>
</docletArtifact>
<docletArtifact>
<groupId>xerces</groupId>
<artifactId>xercesImpl</artifactId>
<version>2.6.1</version>
</docletArtifact>
</docletArtifacts>
<useStandardDocletOptions>false</useStandardDocletOptions>
<additionalparam>-output ${project.build.outputDirectory}/agent-rest.xml</additionalparam>
</configuration>
<reports>
<report>javadoc</report>
</reports>
</reportSet> -->
</reportSets>
</plugin>
</plugins>
@@ -365,7 +365,7 @@ private void startHttpServer(Configuration conf) throws Exception {
jaxRsPackages.toString());

// Create the server context and add the servlet
Context root = new Context(jettyServer, "/rest/v1", Context.SESSIONS);
Context root = new Context(jettyServer, "/rest/v2", Context.SESSIONS);
root.setAttribute("ChukwaAgent", this);
root.addServlet(servletHolder, "/*");
root.setAllowNullPathInfo(false);
@@ -0,0 +1,58 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.hadoop.chukwa.datacollection.agent.rest;

import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlRootElement;

@XmlRootElement
@XmlAccessorType(XmlAccessType.PUBLIC_MEMBER)
public class AdaptorAveragedRate {
private double rate;
private long unit;

public AdaptorAveragedRate() {
rate = 0;
unit = 0;
}

public AdaptorAveragedRate(long unit, double rate) {
this.unit = unit;
this.rate = rate;
}

@XmlAttribute
public double getRate() {
return rate;
}

public void setRate(double rate) {
this.rate = rate;
}

@XmlAttribute
public long getIntervalInSeconds() {
return unit;
}

public void setIntervalInSeconds(long unit) {
this.unit = unit;
}
}
@@ -0,0 +1,82 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.hadoop.chukwa.datacollection.agent.rest;

import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlAccessType;

@XmlRootElement
@XmlAccessorType(XmlAccessType.PUBLIC_MEMBER)
public class AdaptorConfig {
private String id;
private String dataType;
private String adaptorClass;
private String adaptorParams;
private long offset;

public AdaptorConfig() {
}

@XmlElement
public String getId() {
return id;
}

public void setId(String id) {
this.id = id;
}

@XmlElement
public String getDataType() {
return dataType;
}

public void setDataType(String dataType) {
this.dataType = dataType;
}

@XmlElement
public String getAdaptorClass() {
return adaptorClass;
}

public void setAdaptorClass(String adaptorClass) {
this.adaptorClass = adaptorClass;
}

@XmlElement
public String getAdaptorParams() {
return adaptorParams;
}

public void setAdaptorParams(String adaptorParams) {
this.adaptorParams = adaptorParams;
}

@XmlElement
public long getOffset() {
return offset;
}

public void setOffset(long offset) {
this.offset = offset;
}
}

0 comments on commit 7d3c502

Please sign in to comment.