incubator-ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ey...@apache.org
Subject svn commit: r1177880 - in /incubator/ambari/trunk: agent/src/main/python/ambari_agent/ controller/ controller/src/main/java/org/apache/ambari/controller/ controller/src/main/java/org/apache/ambari/controller/rest/agent/ controller/src/main/java/org/apa...
Date Sat, 01 Oct 2011 01:42:26 GMT
Author: eyang
Date: Sat Oct  1 01:42:25 2011
New Revision: 1177880

URL: http://svn.apache.org/viewvc?rev=1177880&view=rev
Log:
AMBARI-23. Renamed agent API to /agent, and public API to /rest. (Eric Yang)
AMBARI-28. Clean up html encoded javadoc. (Eric Yang)

Added:
    incubator/ambari/trunk/controller/src/main/java/org/apache/ambari/controller/rest/agent/
    incubator/ambari/trunk/controller/src/main/java/org/apache/ambari/controller/rest/agent/AgentJAXBContextResolver.java
    incubator/ambari/trunk/controller/src/main/java/org/apache/ambari/controller/rest/agent/ControllerApplication.java
    incubator/ambari/trunk/controller/src/main/java/org/apache/ambari/controller/rest/agent/ControllerResource.java
    incubator/ambari/trunk/controller/src/main/java/org/apache/ambari/controller/rest/agent/WadlResource.java
    incubator/ambari/trunk/controller/src/main/java/org/apache/ambari/controller/rest/config/PrivateWadlGeneratorConfig.java
    incubator/ambari/trunk/controller/src/main/resources/application-agent-doc.xml
Removed:
    incubator/ambari/trunk/controller/src/main/java/org/apache/ambari/controller/rest/resources/AgentJAXBContextResolver.java
    incubator/ambari/trunk/controller/src/main/java/org/apache/ambari/controller/rest/resources/ControllerResource.java
Modified:
    incubator/ambari/trunk/agent/src/main/python/ambari_agent/Controller.py
    incubator/ambari/trunk/controller/pom.xml
    incubator/ambari/trunk/controller/src/main/java/org/apache/ambari/controller/Controller.java
    incubator/ambari/trunk/controller/src/main/java/org/apache/ambari/controller/rest/resources/BlueprintResource.java
    incubator/ambari/trunk/controller/src/main/java/org/apache/ambari/controller/rest/resources/BlueprintsResource.java
    incubator/ambari/trunk/controller/src/main/java/org/apache/ambari/controller/rest/resources/ClusterResource.java
    incubator/ambari/trunk/controller/src/main/java/org/apache/ambari/controller/rest/resources/ClustersResource.java
    incubator/ambari/trunk/controller/src/main/java/org/apache/ambari/controller/rest/resources/NodesResource.java
    incubator/ambari/trunk/controller/src/main/java/org/apache/ambari/controller/rest/resources/StacksResource.java

Modified: incubator/ambari/trunk/agent/src/main/python/ambari_agent/Controller.py
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/agent/src/main/python/ambari_agent/Controller.py?rev=1177880&r1=1177879&r2=1177880&view=diff
==============================================================================
--- incubator/ambari/trunk/agent/src/main/python/ambari_agent/Controller.py (original)
+++ incubator/ambari/trunk/agent/src/main/python/ambari_agent/Controller.py Sat Oct  1 01:42:25 2011
@@ -43,7 +43,7 @@ class Controller(threading.Thread):
     self.lock = threading.Lock()
     self.safeMode = True
     self.credential = credential
-    self.url = url + '/v1/controller/agent/' + socket.gethostname()
+    self.url = url + '/agent/' + socket.gethostname()
 
   def start(self):
     self.actionQueue = ActionQueue()

Modified: incubator/ambari/trunk/controller/pom.xml
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/controller/pom.xml?rev=1177880&r1=1177879&r2=1177880&view=diff
==============================================================================
--- incubator/ambari/trunk/controller/pom.xml (original)
+++ incubator/ambari/trunk/controller/pom.xml Sat Oct  1 01:42:25 2011
@@ -52,39 +52,74 @@
             <artifactId>maven-javadoc-plugin</artifactId>
             <executions>
               <execution>
+                <id>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.ambari.controller.rest.resources</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>com.sun.jersey</groupId>
+                      <artifactId>jersey-server</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}/resourcedoc.xml</additionalparam>
+                </configuration>
+              </execution>
+              <execution>
+                <id>private-api</id>
+                <goals>
+                  <goal>javadoc</goal>
+                </goals>
+                <phase>compile</phase>
+                <configuration>
+                  <encoding>UTF-8</encoding>
+                  <verbose>false</verbose>
+                  <show>public</show>
+                  <subpackages>org.apache.ambari.controller.rest.agent</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>com.sun.jersey</groupId>
+                      <artifactId>jersey-server</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}/resourcedoc-agent.xml</additionalparam>
+                </configuration>
               </execution>
             </executions>
-            <configuration>
-              <encoding>UTF-8</encoding>
-              <verbose>false</verbose>
-              <show>public</show>
-              <subpackages>org.apache.ambari.controller.rest.resources</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>com.sun.jersey</groupId>
-                  <artifactId>jersey-server</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}/resourcedoc.xml</additionalparam>
-            </configuration>
           </plugin>
       </plugins>
     </build>

Modified: incubator/ambari/trunk/controller/src/main/java/org/apache/ambari/controller/Controller.java
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/controller/src/main/java/org/apache/ambari/controller/Controller.java?rev=1177880&r1=1177879&r2=1177880&view=diff
==============================================================================
--- incubator/ambari/trunk/controller/src/main/java/org/apache/ambari/controller/Controller.java (original)
+++ incubator/ambari/trunk/controller/src/main/java/org/apache/ambari/controller/Controller.java Sat Oct  1 01:42:25 2011
@@ -78,9 +78,19 @@ public class Controller {
         "org.apache.ambari.controller.rest.resources");
       sh.setInitParameter("com.sun.jersey.config.property.WadlGeneratorConfig", 
         "org.apache.ambari.controller.rest.config.ExtendedWadlGeneratorConfig");
-      root.addServlet(sh, "/v1/*");
+      root.addServlet(sh, "/rest/*");
       sh.setInitOrder(2);
-      
+
+      ServletHolder agent = new ServletHolder(ServletContainer.class);
+      agent.setInitParameter("com.sun.jersey.config.property.resourceConfigClass", 
+        "com.sun.jersey.api.core.PackagesResourceConfig");
+      agent.setInitParameter("com.sun.jersey.config.property.packages", 
+        "org.apache.ambari.controller.rest.agent");
+      agent.setInitParameter("com.sun.jersey.config.property.WadlGeneratorConfig", 
+        "org.apache.ambari.controller.rest.config.PrivateWadlGeneratorConfig");
+      root.addServlet(agent, "/agent/*");
+      agent.setInitOrder(3);
+
       Constraint constraint = new Constraint();
       constraint.setName(Constraint.__BASIC_AUTH);;
       constraint.setRoles(new String[]{"user","admin","moderator"});
@@ -88,7 +98,7 @@ public class Controller {
        
       ConstraintMapping cm = new ConstraintMapping();
       cm.setConstraint(constraint);
-      cm.setPathSpec("/v1/controller/*");
+      cm.setPathSpec("/agent/*");
       
       SecurityHandler security = new SecurityHandler();
       security.setUserRealm(new HashUserRealm("Controller",

Added: incubator/ambari/trunk/controller/src/main/java/org/apache/ambari/controller/rest/agent/AgentJAXBContextResolver.java
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/controller/src/main/java/org/apache/ambari/controller/rest/agent/AgentJAXBContextResolver.java?rev=1177880&view=auto
==============================================================================
--- incubator/ambari/trunk/controller/src/main/java/org/apache/ambari/controller/rest/agent/AgentJAXBContextResolver.java (added)
+++ incubator/ambari/trunk/controller/src/main/java/org/apache/ambari/controller/rest/agent/AgentJAXBContextResolver.java Sat Oct  1 01:42:25 2011
@@ -0,0 +1,76 @@
+/**
+ * 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.ambari.controller.rest.agent;
+
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Map;
+import java.util.Set;
+
+import javax.ws.rs.ext.ContextResolver;
+import javax.ws.rs.ext.Provider;
+import javax.xml.bind.JAXBContext;
+import com.sun.jersey.api.json.JSONJAXBContext;
+import org.apache.ambari.common.rest.entities.agent.Command;
+import org.apache.ambari.common.rest.entities.agent.HeartBeat;
+import org.apache.ambari.common.rest.entities.agent.ControllerResponse;
+import org.apache.ambari.common.rest.entities.agent.Action;
+import org.apache.ambari.common.rest.entities.agent.ActionResult;
+
+@Provider
+public class AgentJAXBContextResolver implements ContextResolver<JAXBContext> {
+  private JAXBContext context;
+  private Set<Class<?>> types;
+  private Class<?>[] classTypes = {
+      Command.class, 
+      HeartBeat.class, 
+      ControllerResponse.class, 
+      ActionResult.class,
+      Action.class };
+  protected Set<String> jsonArray = new HashSet<String>() {
+    {
+      add("commandResults");
+      add("cleanUpCommandResults");
+      add("actionResults");
+      add("serversStatus");
+      add("cmd");
+      add("commands");
+      add("cleanUpCommands");
+    }
+  };
+  
+  public AgentJAXBContextResolver() throws Exception {
+    Map<String, Object> props = new HashMap<String, Object>();
+    props.put(JSONJAXBContext.JSON_NOTATION, JSONJAXBContext.JSONNotation.MAPPED);
+    props.put(JSONJAXBContext.JSON_ROOT_UNWRAPPING, Boolean.TRUE);
+    props.put(JSONJAXBContext.JSON_ARRAYS, jsonArray);
+    this.types = new HashSet<Class<?>>(Arrays.asList(classTypes));
+    this.context = new JSONJAXBContext(classTypes, props);
+  }
+
+  public JAXBContext getContext(Class<?> objectType) {
+    for(Class<?> c : types) {
+      if(c==objectType) {
+        return context;
+      }
+    }
+    return null;
+  }
+}

Added: incubator/ambari/trunk/controller/src/main/java/org/apache/ambari/controller/rest/agent/ControllerApplication.java
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/controller/src/main/java/org/apache/ambari/controller/rest/agent/ControllerApplication.java?rev=1177880&view=auto
==============================================================================
--- incubator/ambari/trunk/controller/src/main/java/org/apache/ambari/controller/rest/agent/ControllerApplication.java (added)
+++ incubator/ambari/trunk/controller/src/main/java/org/apache/ambari/controller/rest/agent/ControllerApplication.java Sat Oct  1 01:42:25 2011
@@ -0,0 +1,19 @@
+package org.apache.ambari.controller.rest.agent;
+
+import java.util.HashSet;
+import java.util.Set;
+
+import javax.ws.rs.core.Application;
+
+import org.apache.ambari.controller.rest.config.ExtendedWadlGeneratorConfig;
+
+public class ControllerApplication extends Application {
+  @Override
+  public Set<Class<?>> getClasses() {
+      final Set<Class<?>> classes = new HashSet<Class<?>>();
+      // register root resources/providers
+      classes.add(ControllerResource.class);
+      classes.add(ExtendedWadlGeneratorConfig.class);
+      return classes;
+  }
+}

Added: incubator/ambari/trunk/controller/src/main/java/org/apache/ambari/controller/rest/agent/ControllerResource.java
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/controller/src/main/java/org/apache/ambari/controller/rest/agent/ControllerResource.java?rev=1177880&view=auto
==============================================================================
--- incubator/ambari/trunk/controller/src/main/java/org/apache/ambari/controller/rest/agent/ControllerResource.java (added)
+++ incubator/ambari/trunk/controller/src/main/java/org/apache/ambari/controller/rest/agent/ControllerResource.java Sat Oct  1 01:42:25 2011
@@ -0,0 +1,248 @@
+/*
+ * 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.ambari.controller.rest.agent;
+
+import java.net.InetAddress;
+import java.net.UnknownHostException;
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.ws.rs.Consumes;
+import javax.ws.rs.DefaultValue;
+import javax.ws.rs.GET;
+import javax.ws.rs.POST;
+import javax.ws.rs.Path;
+import javax.ws.rs.Produces;
+import javax.ws.rs.QueryParam;
+import javax.ws.rs.WebApplicationException;
+import javax.ws.rs.core.MediaType;
+
+import org.apache.ambari.common.rest.entities.agent.Action;
+import org.apache.ambari.common.rest.entities.agent.Action.Kind;
+import org.apache.ambari.common.rest.entities.agent.Action.Signal;
+import org.apache.ambari.common.rest.entities.agent.ActionResult;
+import org.apache.ambari.common.rest.entities.agent.Command;
+import org.apache.ambari.common.rest.entities.agent.CommandResult;
+import org.apache.ambari.common.rest.entities.agent.ControllerResponse;
+import org.apache.ambari.common.rest.entities.agent.HardwareProfile;
+import org.apache.ambari.common.rest.entities.agent.HeartBeat;
+import org.apache.ambari.common.rest.entities.agent.ServerStatus;
+
+/** 
+ * Controller Resource represents Ambari controller.
+ * It provides API for Ambari agents to get the cluster configuration changes
+ * as well as report the node attributes and state of services running the on 
+ * the cluster nodes
+ */
+@Path(value = "/controller")
+public class ControllerResource {
+	
+  /** 
+   * Update state of the node (Internal API to be used by Ambari agent).
+   *  
+   * @response.representation.200.doc This API is invoked by Ambari agent running
+   *  on a cluster to update the state of various services running on the node.
+   * @response.representation.200.mediaType application/json
+   * @response.representation.500.doc Error in accepting heartbeat message
+   * @param message Heartbeat message
+   */
+  @Path(value = "/agent/{hostname}")
+  @POST
+  @Consumes(MediaType.APPLICATION_JSON)
+  @Produces({MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML})
+  public ControllerResponse heartbeat(HeartBeat message) {
+    ControllerResponse controllerResponse = new ControllerResponse();
+    controllerResponse.setResponseId("id-00002");    
+    List<Command> commands = new ArrayList<Command>();
+    String[] cmd = { "ls", "-l" };
+    commands.add(new Command("root", cmd));
+    commands.add(new Command("root", cmd));
+    commands.add(new Command("root", cmd));
+
+    List<Command> cleanUps = new ArrayList<Command>();
+    String[] cleanUpCmd = { "ls", "-t" };
+    cleanUps.add(new Command("hdfs", cleanUpCmd));
+    cleanUps.add(new Command("hdfs", cleanUpCmd));
+    
+    Action action = new Action();
+    action.setUser("hdfs");
+    action.setComponent("hdfs");
+    action.setRole("datanode");
+    action.setKind(Kind.STOP_ACTION);
+    action.setSignal(Signal.KILL);
+    action.setClusterId("cluster-001");
+    action.setId("action-001");
+
+    Action action2 = new Action();
+    action2.setUser("hdfs");
+    action2.setKind(Kind.START_ACTION);
+    action2.setId("action-002");
+    action2.setClusterId("cluster-002");
+    action2.setCommands(commands);
+    action2.setCleanUpCommands(cleanUps);
+    action2.setComponent("hdfs");
+    action2.setRole("datanode");
+
+    Action action3 = new Action();
+    action3.setUser("hdfs");
+    action3.setKind(Kind.RUN_ACTION);
+    action3.setId("action-003");
+    action3.setClusterId("cluster-003");
+    action3.setCommands(commands);
+    action3.setCleanUpCommands(cleanUps);
+
+    List<Action> actions = new ArrayList<Action>();
+    actions.add(action);
+    actions.add(action2);
+    actions.add(action3);
+    controllerResponse.setActions(actions);
+    return controllerResponse;
+  }
+
+  /**
+   * Sample Ambari heartbeat message
+   * 
+   * @response.representation.200.doc Print example of Ambari heartbeat message
+   * @response.representation.200.mediaType application/json
+   * @param stackId Stack ID
+   * @return Heartbeat message
+   */
+  @Path("agent/heartbeat/sample")
+  @GET
+  @Produces(MediaType.APPLICATION_JSON)
+  public HeartBeat getHeartBeat(@DefaultValue("stack-123") 
+                                @QueryParam("stackId") String stackId) {
+    try {
+      InetAddress addr = InetAddress.getLocalHost();
+      List<ActionResult> actionResults = new ArrayList<ActionResult>();      
+
+      List<CommandResult> commandResults = new ArrayList<CommandResult>();
+      commandResults.add(new CommandResult(0, "stdout", "stderr"));
+      List<CommandResult> cleanUpResults = new ArrayList<CommandResult>();
+      cleanUpResults.add(new CommandResult(0, "stdout", "stderr"));
+      ActionResult actionResult = new ActionResult();
+      actionResult.setId("action-001");
+      actionResult.setClusterId("cluster-001");
+      actionResult.setKind(Kind.STOP_ACTION);
+
+      ActionResult actionResult2 = new ActionResult();
+      actionResult2.setClusterId("cluster-002");
+      actionResult2.setCommandResults(commandResults);
+      actionResult2.setCleanUpResults(cleanUpResults);
+      actionResult2.setKind(Kind.START_ACTION);
+      actionResult2.setComponent("hadoop");
+      actionResult2.setRole("datanode");
+
+      actionResults.add(actionResult);
+      actionResults.add(actionResult2);
+
+      HardwareProfile hp = new HardwareProfile();
+      hp.setCoreCount(8);
+      hp.setCpuFlags("fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm syscall nx lm constant_tsc pni monitor ds_cpl vmx est tm2 ssse3 cx16 xtpr sse4_1 lahf_lm");
+      hp.setCpuSpeed(2003);
+      hp.setDiskCount(4);
+      hp.setNetSpeed(1000);
+      hp.setRamSize(16442752);
+      
+      HeartBeat hb = new HeartBeat();
+      hb.setResponseId("unknown");
+      hb.setClusterId("cluster-123");
+      hb.setTimestamp(System.currentTimeMillis());
+      hb.setHostname(addr.getHostName());
+      hb.setStackId(stackId);
+      hb.setActionResults(actionResults);
+      hb.setHardwareProfile(hp);
+      List<ServerStatus> serversStatus = new ArrayList<ServerStatus>();
+      serversStatus.add(new ServerStatus("hdfs","datanode", 
+          ServerStatus.State.STARTED));
+      serversStatus.add(new ServerStatus("hdfs","tasktracker", 
+          ServerStatus.State.STARTED));
+      hb.setServersStatus(serversStatus);
+      hb.setIdle(false);
+      return hb;
+    } catch (UnknownHostException e) {
+      throw new WebApplicationException(e);
+    }
+  }
+  
+  /**
+   * Sample controller to agent response message
+   * 
+   * @response.representation.200.doc Print an example of Controller Response to Agent
+   * @response.representation.200.mediaType application/json
+   * @return ControllerResponse A list of command to execute on agent
+   */
+  @Path("response/sample")
+  @GET
+  @Produces("application/json")
+  public ControllerResponse getControllerResponse() {
+    ControllerResponse controllerResponse = new ControllerResponse();
+    controllerResponse.setResponseId("id-00002");    
+    List<Command> commands = new ArrayList<Command>();
+    String[] cmd = { "top" };
+    commands.add(new Command("root", cmd));
+
+    List<Command> cleanUps = new ArrayList<Command>();
+    String[] cleanUpCmd = { "ls", "-t" };
+    cleanUps.add(new Command("hdfs", cleanUpCmd));
+    cleanUps.add(new Command("hdfs", cleanUpCmd));
+    
+    Action action = new Action();
+    action.setUser("hdfs");
+    action.setComponent("hdfs");
+    action.setRole("datanode");
+    action.setKind(Kind.STOP_ACTION);
+    action.setSignal(Signal.KILL);
+    action.setClusterId("cluster-001");
+    action.setId("action-001");
+
+    Action action2 = new Action();
+    action2.setUser("hdfs");
+    action2.setKind(Kind.START_ACTION);
+    action2.setId("action-002");
+    action2.setClusterId("cluster-002");
+    action2.setCommands(commands);
+    action2.setCleanUpCommands(cleanUps);
+    action2.setComponent("hdfs");
+    action2.setRole("datanode");
+    
+    Action action3 = new Action();
+    action3.setUser("hdfs");
+    action3.setKind(Kind.RUN_ACTION);
+    action3.setId("action-003");
+    action3.setClusterId("cluster-002");
+    List<Command> configFiles = new ArrayList<Command>();
+    String[] writeFile = { 
+        "ambari-write-file",
+        "hdfs",
+        "hadoop",
+        "0700",
+        "/tmp/test",
+        "content of file"
+        };
+    configFiles.add(new Command("hdfs", writeFile));
+    action3.setCommands(configFiles);
+    List<Action> actions = new ArrayList<Action>();
+    actions.add(action);
+    actions.add(action2);
+    actions.add(action3);
+    controllerResponse.setActions(actions);
+    return controllerResponse;
+  }
+}

Added: incubator/ambari/trunk/controller/src/main/java/org/apache/ambari/controller/rest/agent/WadlResource.java
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/controller/src/main/java/org/apache/ambari/controller/rest/agent/WadlResource.java?rev=1177880&view=auto
==============================================================================
--- incubator/ambari/trunk/controller/src/main/java/org/apache/ambari/controller/rest/agent/WadlResource.java (added)
+++ incubator/ambari/trunk/controller/src/main/java/org/apache/ambari/controller/rest/agent/WadlResource.java Sat Oct  1 01:42:25 2011
@@ -0,0 +1,80 @@
+/*
+ * 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.ambari.controller.rest.agent;
+
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+
+import javax.ws.rs.GET;
+import javax.ws.rs.Path;
+import javax.ws.rs.Produces;
+import javax.ws.rs.core.Context;
+import javax.ws.rs.core.Response;
+import javax.ws.rs.core.UriInfo;
+import javax.xml.bind.Marshaller;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import com.sun.jersey.server.wadl.WadlApplicationContext;
+import com.sun.jersey.spi.resource.Singleton;
+import com.sun.research.ws.wadl.Application;
+
+@Produces({"application/vnd.sun.wadl+xml", "application/xml"})
+@Singleton
+@Path("wadl")
+public class WadlResource {
+ 
+    private static final Log LOG = LogFactory.getLog(WadlResource.class);
+ 
+    private static final String XML_HEADERS = "com.sun.xml.bind.xmlHeaders";
+ 
+    private WadlApplicationContext wadlContext;
+ 
+    private Application application;
+ 
+    private byte[] wadlXmlRepresentation;
+ 
+    public WadlResource(@Context WadlApplicationContext wadlContext) {
+        this.wadlContext = wadlContext;
+        this.application = wadlContext.getApplication();
+    }
+ 
+    @GET
+    public synchronized Response getWadl(@Context UriInfo uriInfo) {
+        if (wadlXmlRepresentation == null) {
+            if (application.getResources().getBase() == null) {
+                application.getResources().setBase(uriInfo.getBaseUri().toString());
+            }
+            try {
+                final Marshaller marshaller = wadlContext.getJAXBContext().createMarshaller();
+                marshaller.setProperty(XML_HEADERS, "<?xml-stylesheet type='text/xsl' href='/wadl.xsl'?>");
+                marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, true);
+                final ByteArrayOutputStream os = new ByteArrayOutputStream();
+                marshaller.marshal(application, os);
+                wadlXmlRepresentation = os.toByteArray();
+                os.close();
+            } catch (Exception e) {
+                LOG.warn("Could not marshal wadl Application.");
+                return javax.ws.rs.core.Response.ok(application).build();
+            }
+        }
+        return Response.ok(new ByteArrayInputStream(wadlXmlRepresentation)).build();
+    }
+}

Added: incubator/ambari/trunk/controller/src/main/java/org/apache/ambari/controller/rest/config/PrivateWadlGeneratorConfig.java
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/controller/src/main/java/org/apache/ambari/controller/rest/config/PrivateWadlGeneratorConfig.java?rev=1177880&view=auto
==============================================================================
--- incubator/ambari/trunk/controller/src/main/java/org/apache/ambari/controller/rest/config/PrivateWadlGeneratorConfig.java (added)
+++ incubator/ambari/trunk/controller/src/main/java/org/apache/ambari/controller/rest/config/PrivateWadlGeneratorConfig.java Sat Oct  1 01:42:25 2011
@@ -0,0 +1,46 @@
+/*
+ * 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.ambari.controller.rest.config;
+
+import java.util.List;
+
+import com.sun.jersey.api.wadl.config.WadlGeneratorConfig;
+import com.sun.jersey.api.wadl.config.WadlGeneratorDescription;
+import com.sun.jersey.server.wadl.WadlGenerator;
+import com.sun.jersey.server.wadl.generators.WadlGeneratorApplicationDoc;
+import com.sun.jersey.server.wadl.generators.WadlGeneratorGrammarsSupport;
+import com.sun.jersey.server.wadl.generators.resourcedoc.WadlGeneratorResourceDocSupport;
+
+/**
+ * This subclass of {@link WadlGeneratorConfig} defines/configures 
+ * {@link WadlGenerator}s to be used for generating WADL.
+ */
+public class PrivateWadlGeneratorConfig extends WadlGeneratorConfig {
+
+  @Override
+  public List<WadlGeneratorDescription> configure() {
+    return generator( WadlGeneratorApplicationDoc.class )
+      .prop( "applicationDocsStream", "application-agent-doc.xml" )
+      .generator(WadlGeneratorGrammarsSupport.class)
+      .prop("grammarsStream", "application-grammars.xml")
+      .generator(WadlGeneratorResourceDocSupport.class)
+      .prop("resourceDocStream", "resourcedoc-agent.xml")
+      .descriptions();
+    }
+}

Modified: incubator/ambari/trunk/controller/src/main/java/org/apache/ambari/controller/rest/resources/BlueprintResource.java
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/controller/src/main/java/org/apache/ambari/controller/rest/resources/BlueprintResource.java?rev=1177880&r1=1177879&r2=1177880&view=diff
==============================================================================
--- incubator/ambari/trunk/controller/src/main/java/org/apache/ambari/controller/rest/resources/BlueprintResource.java (original)
+++ incubator/ambari/trunk/controller/src/main/java/org/apache/ambari/controller/rest/resources/BlueprintResource.java Sat Oct  1 01:42:25 2011
@@ -44,24 +44,16 @@ import org.apache.ambari.controller.Stac
 @Path(value = "/blueprints/{blueprintName}")
 public class BlueprintResource {
         
-    /** Get a blueprint
+    /** 
+     * Get a blueprint
      * 
-     *  <p>
-     *  REST:<br>
-     *  &nbsp;&nbsp;&nbsp;&nbsp;URL Path                                    : /blueprints/{blueprintName}<br>
-     *  &nbsp;&nbsp;&nbsp;&nbsp;HTTP Method                                 : GET <br>
-     *  &nbsp;&nbsp;&nbsp;&nbsp;HTTP Request Header                         : <br>
-     *  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Content-type        = application/json <br>
-     *  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Accept              = application/json <br>
-     *  &nbsp;&nbsp;&nbsp;&nbsp;HTTP Response Header                        : <br>
-     *  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Content-type        = application/json <br>
-     *  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Accept              = application/json <br>
-     *  <p> 
+     * @response.representation.200.doc       Get a blueprint
+     * @response.representation.200.mediaType application/json
      *  
-     *      @param  blueprintName   Name of the blueprint
-     *      @param  revision        The optional blueprint revision to get
-     *      @return                 blueprint definition
-     *      @throws Exception       throws Exception (TBD)
+     * @param  blueprintName   Name of the blueprint
+     * @param  revision        The optional blueprint revision to get
+     * @return                 blueprint definition
+     * @throws Exception       throws Exception (TBD)
      */
     @GET
     @Produces({"application/json", "application/xml"})
@@ -80,19 +72,11 @@ public class BlueprintResource {
         }      
     }
     
-    /** Delete the blueprint
+    /** 
+     * Delete the blueprint
      * 
-     *  <p>
-     *  REST:<br>
-     *  &nbsp;&nbsp;&nbsp;&nbsp;URL Path                                    : /blueprints/{blueprintName}<br>
-     *  &nbsp;&nbsp;&nbsp;&nbsp;HTTP Method                                 : DELETE <br>
-     *  &nbsp;&nbsp;&nbsp;&nbsp;HTTP Request Header                         : <br>
-     *  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Content-type        = application/json <br>
-     *  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Accept              = application/json <br>
-     *  &nbsp;&nbsp;&nbsp;&nbsp;HTTP Response Header                        : <br>
-     *  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Content-type        = application/json <br>
-     *  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Accept              = application/json <br>
-     *  <p> 
+     * @response.representation.200.doc       Delete a blueprint
+     * @response.representation.200.mediaType application/json
      *  
      * @param  blueprintName    Name of the blueprint
      * @throws Exception        throws Exception (TBD)
@@ -115,25 +99,17 @@ public class BlueprintResource {
         }    
     }
     
-    /** Update a current blueprint.
-     *  <p>
-     *  Updates a current blueprint to update some of its fields.
-     *  <p>
-     *  REST:<br>
-     *  &nbsp;&nbsp;&nbsp;&nbsp;URL Path                                    : /blueprints/{blueprintName}<br>
-     *  &nbsp;&nbsp;&nbsp;&nbsp;HTTP Method                                 : PUT <br>
-     *  &nbsp;&nbsp;&nbsp;&nbsp;HTTP Request Header                         : <br>
-     *  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Content-type        = application/json <br>
-     *  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Accept              = application/json <br>
-     *  &nbsp;&nbsp;&nbsp;&nbsp;HTTP Response Header                        : <br>
-     *  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Content-type        = application/json <br>
-     *  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Accept              = application/json <br>
-     *  <p> 
+    /** 
+     * Update a current blueprint.
+     *
+     * @response.representation.200.doc       Updates a current blueprint to 
+     *                                        update some of its fields.
+     * @response.representation.200.mediaType application/json
      * 
-     * @param blueprintName             Name of the blueprint
-     * @param blueprint                 Input blueprint object specifying the blueprint definition
-     * @return                                  Returns the new revision of the blueprint
-     * @throws Exception                throws Exception
+     * @param blueprintName Name of the blueprint
+     * @param blueprint     Input blueprint object specifying the blueprint definition
+     * @return              Returns the new revision of the blueprint
+     * @throws Exception    throws Exception
      */
     @Path(value = "/blueprints/{blueprintName}")
     @PUT

Modified: incubator/ambari/trunk/controller/src/main/java/org/apache/ambari/controller/rest/resources/BlueprintsResource.java
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/controller/src/main/java/org/apache/ambari/controller/rest/resources/BlueprintsResource.java?rev=1177880&r1=1177879&r2=1177880&view=diff
==============================================================================
--- incubator/ambari/trunk/controller/src/main/java/org/apache/ambari/controller/rest/resources/BlueprintsResource.java (original)
+++ incubator/ambari/trunk/controller/src/main/java/org/apache/ambari/controller/rest/resources/BlueprintsResource.java Sat Oct  1 01:42:25 2011
@@ -37,31 +37,22 @@ import org.apache.ambari.controller.Exce
 import org.apache.ambari.controller.Stacks;
 import org.codehaus.jettison.json.JSONArray;
 
-/** BlueprintResource represents a Hadoop blueprint to be installed on a 
- *  cluster. Blueprints define a collection of Hadoop components that are
- *  installed together on a cluster and their configuration.
+/** 
+ * BlueprintResource represents a Hadoop blueprint to be installed on a 
+ * cluster. Blueprints define a collection of Hadoop components that are
+ * installed together on a cluster and their configuration.
  */
 @Path(value = "/blueprints")
 public class BlueprintsResource {
  
-    /** Creates a new blueprint.
-     *  <p>
+    /** 
+     * Creates a new blueprint.
+     *
      *  If named blueprint does not exists already, then it creates new one i.e. revision zero.
-     *  <p>
-     *  REST:<br>
-     *  &nbsp;&nbsp;&nbsp;&nbsp;URL Path                                    : /blueprints/<br>
-     *  &nbsp;&nbsp;&nbsp;&nbsp;HTTP Method                                 : POST <br>
-     *  &nbsp;&nbsp;&nbsp;&nbsp;HTTP Request Header                         : <br>
-     *  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Content-type        = application/json <br>
-     *  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Accept              = application/json <br>
-     *  &nbsp;&nbsp;&nbsp;&nbsp;HTTP Response Header                        : <br>
-     *  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Content-type        = application/json <br>
-     *  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Accept              = application/json <br>
-     *  <p> 
      * 
-     * @param blueprint                 Input blueprint object specifying the blueprint definition
-     * @return                                  Returns the newly created revision of the blueprint
-     * @throws Exception                throws Exception
+     * @param blueprint  Input blueprint object specifying the blueprint definition
+     * @return Returns the newly created revision of the blueprint
+     * @throws Exception throws Exception
      */
     @POST
     @Consumes ({"application/json"})
@@ -69,21 +60,11 @@ public class BlueprintsResource {
         Blueprints.getInstance().addBlueprint(blueprint);
     }
 
-    /** Get the list of blueprint names
-     *  <p>
-     *  REST:<br>
-     *  &nbsp;&nbsp;&nbsp;&nbsp;URL Path                                    : /blueprints<br>
-     *  &nbsp;&nbsp;&nbsp;&nbsp;HTTP Method                                 : GET <br>
-     *  &nbsp;&nbsp;&nbsp;&nbsp;HTTP Request Header                         : <br>
-     *  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Content-type        = application/json <br>
-     *  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Accept              = application/json <br>
-     *  &nbsp;&nbsp;&nbsp;&nbsp;HTTP Response Header                        : <br>
-     *  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Content-type        = application/json <br>
-     *  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Accept              = application/json <br>
-     *  <p> 
+    /** 
+     * Get the list of blueprint names
      * 
-     * @return                          Returns the list of blueprint names
-     * @throws Exception                throws Exception
+     * @return Returns the list of blueprint names
+     * @throws Exception throws Exception
      */
     @GET
     @Produces({"application/json"})

Modified: incubator/ambari/trunk/controller/src/main/java/org/apache/ambari/controller/rest/resources/ClusterResource.java
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/controller/src/main/java/org/apache/ambari/controller/rest/resources/ClusterResource.java?rev=1177880&r1=1177879&r2=1177880&view=diff
==============================================================================
--- incubator/ambari/trunk/controller/src/main/java/org/apache/ambari/controller/rest/resources/ClusterResource.java (original)
+++ incubator/ambari/trunk/controller/src/main/java/org/apache/ambari/controller/rest/resources/ClusterResource.java Sat Oct  1 01:42:25 2011
@@ -43,25 +43,19 @@ import org.apache.ambari.controller.Clus
 import org.apache.ambari.controller.ExceptionResponse;
 import org.apache.ambari.controller.Nodes;
 
-/** ClusterResource represents a Hadoop Cluster in a data center.
+/** 
+ * ClusterResource represents a Hadoop Cluster in a data center.
  *  
  */
 @Path(value = "/clusters/{clusterName}")
 public class ClusterResource {
         
-    /** Get the definition of specified Hadoop cluster.
+    /** 
+     * Get the definition of specified Hadoop cluster.
      * 
-     *  <p>
-     *  REST:<br>
-     *  &nbsp;&nbsp;&nbsp;&nbsp;URL Path                                    : /clusters/{clusterName}<br>
-     *  &nbsp;&nbsp;&nbsp;&nbsp;HTTP Method                                 : GET <br>
-     *  &nbsp;&nbsp;&nbsp;&nbsp;HTTP Request Header                         : <br>
-     *  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Content-type        = application/json <br>
-     *  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Accept              = application/json <br>
-     *  &nbsp;&nbsp;&nbsp;&nbsp;HTTP Response Header                        : <br>
-     *  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Content-type        = application/json <br>
-     *  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Accept              = application/json <br>
-     *  <p> 
+     *  @response.representation.200.doc       Get the definition of specified
+     *                                         Hadoop cluster
+     *  @response.representation.200.mediaType application/json
      *  
      *  @param      clusterName             Name of the cluster; Each cluster is identified w/ unique name
      *  @return                             Returns the Cluster definition
@@ -79,21 +73,11 @@ public class ClusterResource {
         }       
     }
     
-    /** Update cluster definition.
-     *  <p>
-     *  Update cluster definition allows updating any sub-elements of cluster definition. Only sub-elements to be 
-     *  updated can be specified with new values while others can be "null".
-     *  <p>
-     *  REST:<br>
-     *  &nbsp;&nbsp;&nbsp;&nbsp;URL Path                                    : /clusters/{clusterName}<br>
-     *  &nbsp;&nbsp;&nbsp;&nbsp;HTTP Method                                 : PUT <br>
-     *  &nbsp;&nbsp;&nbsp;&nbsp;HTTP Request Header                         : <br>
-     *  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Content-type        = application/json <br>
-     *  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Accept              = application/json <br>
-     *  &nbsp;&nbsp;&nbsp;&nbsp;HTTP Response Header                        : <br>
-     *  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Content-type        = application/json <br>
-     *  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Accept              = application/json <br>
-     *  <p> 
+    /** 
+     * Update cluster definition.
+     * 
+     * @request.representation.example { 'abc' : 'abc' }
+     * @response.representation.200.doc Returns cluster definition.
      * 
      * @param   clusterName             Name of the cluster; Each cluster is identified w/ unique name
      * @param   cluster                 Cluster definition with specific sub-elements to be updated
@@ -112,22 +96,16 @@ public class ClusterResource {
         }     
     }
      
-    /** Delete the the cluster.
-     *  <p>
-     *  Delete operation will lead the cluster to "ATTIC" state and then the cluster definition is purged from
-     *  the controller repository. In "ATTIC" state all the cluster services would be stopped and nodes are 
-     *  released. All the data on the cluster will be lost.
-     *  <p>
-     *  REST:<br>
-     *  &nbsp;&nbsp;&nbsp;&nbsp;URL Path                                    : /clusters/{clusterName}/action/terminate<br>
-     *  &nbsp;&nbsp;&nbsp;&nbsp;HTTP Method                                 : DELETE <br>
-     *  &nbsp;&nbsp;&nbsp;&nbsp;HTTP Request Header                         : <br>
-     *  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Content-type        = application/json <br>
-     *  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Accept              = application/json <br>
-     *  &nbsp;&nbsp;&nbsp;&nbsp;HTTP Response Header                        : <br>
-     *  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Content-type        = application/json <br>
-     *  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Accept              = application/json <br>
-     *  <p> 
+    /** 
+     * Delete the the cluster.
+     * 
+     * @response.representation.200.doc Delete operation will lead the cluster 
+     *                                  to "ATTIC" state and then the cluster 
+     *                                  definition is purged from the controller 
+     *                                  repository. In "ATTIC" state all the 
+     *                                  cluster services would be stopped and 
+     *                                  nodes are released. All the data on 
+     *                                  the cluster will be lost.
      *  
      *  @param  clusterName             Name of the cluster; Each cluster is identified w/ unique name
      *  @throws Exception               throws Exception (TBD)
@@ -144,28 +122,24 @@ public class ClusterResource {
         }    
     }
     
-    /** Get the cluster state.
-     *  <p>
-     *  This provides the run time state of the cluster. Representative cluster state is based on the state of various services running on the cluster. <br>
-     *  Representative cluster states: <br>
-     *          "ACTIVE"        : Hadoop stack is deployed on cluster nodes and required cluster services are running <br>
-     *          "INACTIVE       : No cluster services are running. Hadoop stack may or may not be deployed on the cluster nodes <br>
-     *          "ATTIC"         : Only cluster definition is available. No nodes are reserved for the cluster in this state.  <br>
-     *  
-     *  <p>
-     *  REST:<br>
-     *  &nbsp;&nbsp;&nbsp;&nbsp;URL Path                                    : /clusters/{clusterName}/clusterstate<br>
-     *  &nbsp;&nbsp;&nbsp;&nbsp;HTTP Method                                 : GET <br>
-     *  &nbsp;&nbsp;&nbsp;&nbsp;HTTP Request Header                         : <br>
-     *  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Content-type        = application/json <br>
-     *  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Accept              = application/json <br>
-     *  &nbsp;&nbsp;&nbsp;&nbsp;HTTP Response Header                        : <br>
-     *  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Content-type        = application/json <br>
-     *  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Accept              = application/json <br>
-     *  <p> 
+    /** 
+     * Get the cluster state.
      *  
-     *  @param  clusterName             Name of the cluster; Each cluster is identified w/ unique name
-     *  @return                                 Returns cluster state object.
+     *  @response.representation.200.doc This provides the run time state of the 
+     *                                   cluster. Representative cluster state 
+     *                                   is based on the state of various 
+     *                                   services running on the cluster.
+     *  Representative cluster states:
+     *    "ACTIVE"  : Hadoop stack is deployed on cluster nodes and 
+     *                required cluster services are running
+     *    "INACTIVE : No cluster services are running. Hadoop stack 
+     *                may or may not be deployed on the cluster nodes
+     *    "ATTIC"   : Only cluster definition is available. No nodes are 
+     *                reserved for the cluster in this state.
+     *  
+     *  @param  clusterName             Name of the cluster; Each cluster is 
+     *                                  identified w/ unique name
+     *  @return                         Returns cluster state object.
      *  @throws Exception               throws Exception (TBD)  
      */
     @Path(value = "/state")
@@ -181,27 +155,23 @@ public class ClusterResource {
         }    
     }
     
-    /** Get list of nodes associated with the cluster.
-     *  <p>
-     *  The "alive" is a boolean variable that specify the type of nodes to return based on their state i.e. live or dead. Live nodes are the ones that are consistently heart beating with the controller. 
-     *  If both live and dead nodes are need to be returned then specify the alive parameter as null.  
-     *  <p>
-     *  REST:<br>
-     *  &nbsp;&nbsp;&nbsp;&nbsp;URL Path                                    : /clusters/{clusterName}/nodes<br>
-     *  &nbsp;&nbsp;&nbsp;&nbsp;HTTP Method                                 : GET <br>
-     *  &nbsp;&nbsp;&nbsp;&nbsp;HTTP Request Header                         : <br>
-     *  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Content-type        = application/json <br>
-     *  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Accept              = application/json <br>
-     *  &nbsp;&nbsp;&nbsp;&nbsp;HTTP Response Header                        : <br>
-     *  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Content-type        = application/json <br>
-     *  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Accept              = application/json <br>
-     *  <p> 
+    /** 
+     * Get list of nodes associated with the cluster.
      *  
-     *  @param  clusterName             Name of the cluster; Each cluster is identified w/ unique name
-     *  @param  role                    Optionally specify the role name to get the nodes associated with the service role
-     *  @param  alive                   Boolean value to specify, if nodes to be returned are alive or dead or both (if alive is set to null) 
-     *  @return                                 List of nodes
-     *  @throws Exception               throws Exception
+     *  @response.representation.200.doc The "alive" is a boolean variable that 
+     *  specify the type of nodes to return based on their state i.e. live or 
+     *  dead. Live nodes are the ones that are consistently heart beating with 
+     *  the controller. If both live and dead nodes are need to be returned 
+     *  then specify the alive parameter as null.  
+     *  
+     *  @param  clusterName Name of the cluster; Each cluster is identified w/ 
+     *                      unique name
+     *  @param  roleName    Optionally specify the role name to get the nodes 
+     *                      associated with the service role
+     *  @param  alive       Boolean value to specify, if nodes to be returned 
+     *                       are alive or dead or both (if alive is set to null) 
+     *  @return             List of nodes
+     *  @throws Exception   throws Exception
      */
     @Path(value = "/nodes")
     @GET

Modified: incubator/ambari/trunk/controller/src/main/java/org/apache/ambari/controller/rest/resources/ClustersResource.java
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/controller/src/main/java/org/apache/ambari/controller/rest/resources/ClustersResource.java?rev=1177880&r1=1177879&r2=1177880&view=diff
==============================================================================
--- incubator/ambari/trunk/controller/src/main/java/org/apache/ambari/controller/rest/resources/ClustersResource.java (original)
+++ incubator/ambari/trunk/controller/src/main/java/org/apache/ambari/controller/rest/resources/ClustersResource.java Sat Oct  1 01:42:25 2011
@@ -46,30 +46,20 @@ public class ClustersResource {
         
     }  
     
-    /** Get the list of clusters.
-     *  <p>
-     *  State: <br>
-     *  &nbsp;&nbsp;&nbsp;&nbsp;"ALL"           : All the clusters (irrespective of their state), 
-     *  &nbsp;&nbsp;&nbsp;&nbsp;"ACTIVE"        : All the active state clusters
-     *  &nbsp;&nbsp;&nbsp;&nbsp;"INACTIVE"      : All the inactive state clusters
-     *  &nbsp;&nbsp;&nbsp;&nbsp;"ATTIC"         : All the retired i.e. ATTIC state clusters
+    /** 
+     * Get the list of clusters.
+     *
+     *  State: "ALL"           : All the clusters (irrespective of their state), 
+     *         "ACTIVE"        : All the active state clusters
+     *         "INACTIVE"      : All the inactive state clusters
+     *         "ATTIC"         : All the retired i.e. ATTIC state clusters
      *  
-     *  <p>
-     *  REST:<br>
-     *  &nbsp;&nbsp;&nbsp;&nbsp;URL Path                                    : /clusters<br>
-     *  &nbsp;&nbsp;&nbsp;&nbsp;HTTP Method                                 : GET <br>
-     *  &nbsp;&nbsp;&nbsp;&nbsp;HTTP Request Header                         : <br>
-     *  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Content-type        = application/json <br>
-     *  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Accept              = application/json <br>
-     *  &nbsp;&nbsp;&nbsp;&nbsp;HTTP Response Header                        : <br>
-     *  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Content-type        = application/json <br>
-     *  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Accept              = application/json <br>
-     *  <p> 
-     *  
-     *  @param  state                   The state of the cluster
-     *  @param  search                  Optional search expression to return list of matching clusters
-     *  @return                         Returns the list of clusters based on specified state and optional search criteria.
-     *  @throws Exception               throws Exception (TBD)
+     *  @param  state      The state of the cluster
+     *  @param  search     Optional search expression to return list of matching 
+     *                     clusters
+     *  @return            Returns the list of clusters based on specified state 
+     *                     and optional search criteria.
+     *  @throws Exception  throws Exception (TBD)
      */
     @GET
     @Produces({"application/json", "application/xml"})
@@ -90,31 +80,22 @@ public class ClustersResource {
         return searchResults;
     }
     
-    /** Add new cluster definition.
-     *  <p>
-     *  Cluster goal state can be either "ACTIVE" or "INACTIVE". In the "INACTIVE" state, nodes specified in the 
-     *  cluster definition will be reserved for the cluster. Although the actual deployment and starting of services 
-     *  would begin when cluster definition is updated to be "ACTIVE"
-     *  <p>   
-     *  For cluster to be in active state cluster definition needs to be complete & valid 
-     *  e.g. number of nodes associated are sufficient for each role, specified blueprint for cluster configuration
-     *  should exist etc. 
+    /** 
+     * Add new cluster definition.
+     *
+     *  Cluster goal state can be either "ACTIVE" or "INACTIVE". In the 
+     *  "INACTIVE" state, nodes specified in the cluster definition will be 
+     *  reserved for the cluster. Although the actual deployment and starting 
+     *  of services would begin when cluster definition is updated to be "ACTIVE"
      *  
-     *  <p>
-     *  REST:<br>
-     *  &nbsp;&nbsp;&nbsp;&nbsp;URL Path                                    : /clusters/<br>
-     *  &nbsp;&nbsp;&nbsp;&nbsp;HTTP Method                                 : POST <br>
-     *  &nbsp;&nbsp;&nbsp;&nbsp;HTTP Request Header                         : <br>
-     *  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Content-type        = application/json <br>
-     *  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Accept              = application/json <br>
-     *  &nbsp;&nbsp;&nbsp;&nbsp;HTTP Response Header                        : <br>
-     *  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Content-type        = application/json <br>
-     *  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Accept              = application/json <br>
-     *  <p> 
+     *  For cluster to be in active state cluster definition needs to be 
+     *  complete & valid e.g. number of nodes associated are sufficient for 
+     *  each role, specified blueprint for cluster configuration should exist 
+     *  etc. 
      *  
-     *   @param         cluster                 Definition of the cluster to be created 
-     *   @return                                Returns the cluster definition 
-     *   @throws        Exception               Throws exception (TBD)
+     *   @param  cluster   Definition of the cluster to be created 
+     *   @return           Returns the cluster definition 
+     *   @throws Exception Throws exception (TBD)
      */
     @POST
     @Consumes({"application/json", "application/xml"})

Modified: incubator/ambari/trunk/controller/src/main/java/org/apache/ambari/controller/rest/resources/NodesResource.java
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/controller/src/main/java/org/apache/ambari/controller/rest/resources/NodesResource.java?rev=1177880&r1=1177879&r2=1177880&view=diff
==============================================================================
--- incubator/ambari/trunk/controller/src/main/java/org/apache/ambari/controller/rest/resources/NodesResource.java (original)
+++ incubator/ambari/trunk/controller/src/main/java/org/apache/ambari/controller/rest/resources/NodesResource.java Sat Oct  1 01:42:25 2011
@@ -35,22 +35,11 @@ import com.sun.jersey.spi.resource.Singl
 @Path(value = "/nodes")
 public class NodesResource {
             
-        /** Get list of nodes
-     *  <p>
+    /** Get list of nodes
+     *
      *  The "allocated and "alive" are the boolean variables that specify the type of nodes to return based on their state i.e. if they are already allocated to any cluster and live or dead. 
      *  Live nodes are the ones that are consistently heart beating with the controller. If both "allocated" and "alive" are set to NULL then all the nodes are returned.  
-     *  <p>
-         *  REST:<br>
-         *  &nbsp;&nbsp;&nbsp;&nbsp;URL Path                                    : /clusters/{clusterName}/nodes<br>
-         *  &nbsp;&nbsp;&nbsp;&nbsp;HTTP Method                                 : GET <br>
-         *  &nbsp;&nbsp;&nbsp;&nbsp;HTTP Request Header                         : <br>
-         *  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Content-type        = application/json <br>
-         *  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Accept              = application/json <br>
-         *  &nbsp;&nbsp;&nbsp;&nbsp;HTTP Response Header                        : <br>
-         *  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Content-type        = application/json <br>
-         *  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Accept              = application/json <br>
-         *  <p> 
-         *  
+     *  
      *  @param  allocated               Boolean value to specify, if nodes to be returned are allocated/reserved for some cluster (specify null to return both allocated and unallocated nodes)
      *  @param  alive                   Boolean value to specify, if nodes to be returned are alive or dead or both (specify null to return both live and dead nodes) 
      *  @return                                 List of nodes
@@ -68,22 +57,11 @@ public class NodesResource {
     /*
      * Get specified Node information
      */
-    /** Get the node information that includes, service states, node attributes etc.
+    /** 
+     * Get the node information that includes, service states, node attributes etc.
      * 
-     *  <p>
-         *  REST:<br>
-         *  &nbsp;&nbsp;&nbsp;&nbsp;URL Path                                    : /nodes/{hostname}<br>
-         *  &nbsp;&nbsp;&nbsp;&nbsp;HTTP Method                                 : GET <br>
-         *  &nbsp;&nbsp;&nbsp;&nbsp;HTTP Request Header                         : <br>
-         *  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Content-type        = application/json <br>
-         *  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Accept              = application/json <br>
-         *  &nbsp;&nbsp;&nbsp;&nbsp;HTTP Response Header                        : <br>
-         *  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Content-type        = application/json <br>
-         *  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Accept              = application/json <br>
-         *  <p> 
-         *  
      * @param hostname          Fully qualified hostname
-     * @return                          Returns the node information
+     * @return                  Returns the node information
      * @throws Exception        throws Exception
      */
     @Path(value = "/{hostname}")

Modified: incubator/ambari/trunk/controller/src/main/java/org/apache/ambari/controller/rest/resources/StacksResource.java
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/controller/src/main/java/org/apache/ambari/controller/rest/resources/StacksResource.java?rev=1177880&r1=1177879&r2=1177880&view=diff
==============================================================================
--- incubator/ambari/trunk/controller/src/main/java/org/apache/ambari/controller/rest/resources/StacksResource.java (original)
+++ incubator/ambari/trunk/controller/src/main/java/org/apache/ambari/controller/rest/resources/StacksResource.java Sat Oct  1 01:42:25 2011
@@ -50,21 +50,12 @@ import com.sun.jersey.spi.resource.Singl
 @Path(value = "/stacks")
 public class StacksResource {       
     
-    /** Import a new Hadoop Stack description
-     *  <p>
-     *  Specific revision of stack is imported/created into Ambari, if not already present. It returns the 
-     *  description of the stack if imported successfully. If 
-     *  <p>
-     *  REST:<br>
-     *  &nbsp;&nbsp;&nbsp;&nbsp;URL Path                                    : /stacks/<br>
-     *  &nbsp;&nbsp;&nbsp;&nbsp;HTTP Method                                 : POST <br>
-     *  &nbsp;&nbsp;&nbsp;&nbsp;HTTP Request Header                         : <br>
-     *  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Content-type        = application/json <br>
-     *  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Accept              = application/json <br>
-     *  &nbsp;&nbsp;&nbsp;&nbsp;HTTP Response Header                        : <br>
-     *  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Content-type        = application/json <br>
-     *  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Accept              = application/json <br>
-     *  <p> 
+    /** 
+     * Import a new Hadoop Stack description
+     *
+     * @response.representation.200.doc Specific revision of stack is 
+     * imported/created into Ambari, if not already present. It returns the 
+     * description of the stack if imported successfully. 
      * 
      * @param   url Location of the new stack definition
      * @throws  Exception               throws Exception
@@ -81,19 +72,8 @@ public class StacksResource {       
         } 
     }
     
-    /** Get the list of stacks installed with Ambari controller.
-     * 
-     *  <p>
-     *  REST:<br>
-     *  &nbsp;&nbsp;&nbsp;&nbsp;URL Path                                    : /stacks/{stackName}<br>
-     *  &nbsp;&nbsp;&nbsp;&nbsp;HTTP Method                                 : POST <br>
-     *  &nbsp;&nbsp;&nbsp;&nbsp;HTTP Request Header                         : <br>
-     *  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Content-type        = application/json <br>
-     *  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Accept              = application/json <br>
-     *  &nbsp;&nbsp;&nbsp;&nbsp;HTTP Response Header                        : <br>
-     *  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Content-type        = application/json <br>
-     *  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Accept              = application/json <br>
-     *  <p> 
+    /** 
+     * Get the list of stacks installed with Ambari controller.
      * 
      * @param searchToken       Optionally specify the search token to return the stacks where stack name includes the search token 
      * @return                  Returns list of stack definitions
@@ -117,19 +97,8 @@ public class StacksResource {       
         return list;
     }
 
-    /** Get the stack definition
-     * 
-     *  <p>
-     *  REST:<br>
-     *  &nbsp;&nbsp;&nbsp;&nbsp;URL Path                                    : /stacks/{stackName}<br>
-     *  &nbsp;&nbsp;&nbsp;&nbsp;HTTP Method                                 : GET <br>
-     *  &nbsp;&nbsp;&nbsp;&nbsp;HTTP Request Header                         : <br>
-     *  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Content-type        = application/json <br>
-     *  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Accept              = application/json <br>
-     *  &nbsp;&nbsp;&nbsp;&nbsp;HTTP Response Header                        : <br>
-     *  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Content-type        = application/json <br>
-     *  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Accept              = application/json <br>
-     *  <p> 
+    /** 
+     * Get the stack definition
      * 
      * @param stackName         The name of the stack to get the default blueprint
      * @return                  The default blueprint for that stack
@@ -153,19 +122,8 @@ public class StacksResource {       
         }      
     }
     
-    /** Get the default blueprint for a particular stack
-     * 
-     *  <p>
-     *  REST:<br>
-     *  &nbsp;&nbsp;&nbsp;&nbsp;URL Path                                    : /stacks/{stackName}/default-blueprint<br>
-     *  &nbsp;&nbsp;&nbsp;&nbsp;HTTP Method                                 : GET <br>
-     *  &nbsp;&nbsp;&nbsp;&nbsp;HTTP Request Header                         : <br>
-     *  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Content-type        = application/json <br>
-     *  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Accept              = application/json <br>
-     *  &nbsp;&nbsp;&nbsp;&nbsp;HTTP Response Header                        : <br>
-     *  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Content-type        = application/json <br>
-     *  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Accept              = application/json <br>
-     *  <p> 
+    /** 
+     * Get the default blueprint for a particular stack
      * 
      * @param stackName         The name of the stack to get the default blueprint
      * @return                  The default blueprint for that stack

Added: incubator/ambari/trunk/controller/src/main/resources/application-agent-doc.xml
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/controller/src/main/resources/application-agent-doc.xml?rev=1177880&view=auto
==============================================================================
--- incubator/ambari/trunk/controller/src/main/resources/application-agent-doc.xml (added)
+++ incubator/ambari/trunk/controller/src/main/resources/application-agent-doc.xml Sat Oct  1 01:42:25 2011
@@ -0,0 +1,27 @@
+<!--
+
+ 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.
+
+-->
+
+<applicationDocs targetNamespace="http://research.sun.com/wadl/2006/10">
+
+    <doc xml:lang="en" title="Ambari Agent REST API">
+        Ambari Agent REST API.
+    </doc>
+
+</applicationDocs>



Mime
View raw message