You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by ey...@apache.org on 2011/09/24 04:26:58 UTC

svn commit: r1175095 - in /incubator/ambari/trunk/controller: ./ src/main/java/org/apache/ambari/controller/ src/main/java/org/apache/ambari/controller/rest/config/ src/main/java/org/apache/ambari/controller/rest/resources/ src/main/resources/ src/main...

Author: eyang
Date: Sat Sep 24 02:26:57 2011
New Revision: 1175095

URL: http://svn.apache.org/viewvc?rev=1175095&view=rev
Log:
AMBARI-7. Updated wadl to html conversion.  (Eric Yang)

Added:
    incubator/ambari/trunk/controller/src/main/java/org/apache/ambari/controller/rest/resources/WadlResource.java
    incubator/ambari/trunk/controller/src/main/resources/application-doc.xml
    incubator/ambari/trunk/controller/src/main/resources/application-grammars.xml
    incubator/ambari/trunk/controller/src/main/webapps/wadl.xsl
Removed:
    incubator/ambari/trunk/controller/src/main/resources/WEB-INF/application-grammars.xml
Modified:
    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/config/ExtendedWadlGeneratorConfig.java
    incubator/ambari/trunk/controller/src/main/java/org/apache/ambari/controller/rest/resources/ControllerResource.java

Modified: incubator/ambari/trunk/controller/pom.xml
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/controller/pom.xml?rev=1175095&r1=1175094&r2=1175095&view=diff
==============================================================================
--- incubator/ambari/trunk/controller/pom.xml (original)
+++ incubator/ambari/trunk/controller/pom.xml Sat Sep 24 02:26:57 2011
@@ -34,92 +34,47 @@
     <build>
       <resources>
         <resource>
-         <directory>${project.build.directory}/generated-resources/schemas</directory>
-        </resource>
-        <resource>
-         <directory>src/main/resources/WEB-INF</directory>
+         <directory>src/main/resources</directory>
         </resource>
       </resources>
-
+      <pluginManagement>
+        <plugins>
+          <plugin>
+            <groupId>org.apache.maven.plugins</groupId>
+            <artifactId>maven-javadoc-plugin</artifactId>
+            <version>2.4</version>
+          </plugin>
+        </plugins>
+      </pluginManagement>
       <plugins>
         <plugin>
-          <groupId>com.sun.tools.jxc.maven2</groupId>
-          <artifactId>maven-jaxb-schemagen-plugin</artifactId>
-          <version>1.2</version>
-          <executions>
-            <execution>
-              <phase>generate-resources</phase>
-              <goals>
-                <goal>generate</goal>
-              </goals>
-              <configuration>
-                <destdir>${project.build.directory}/generated-resources/schemas</destdir>
-                <srcdir>${project.build.sourceDirectory}/org/apache/ambari/controller/rest/resources</srcdir>
-                <schemas>
-                  <schema>
-                    <namespace>http://incubator.apache.org/ambari/2011/09/22/ambari</namespace>
-                    <file>schema.xsd</file>
-                  </schema>
-                </schemas>
-              </configuration>
-            </execution>
-          </executions>
-
-          <dependencies>
-            <dependency>
-              <groupId>javax.xml.bind</groupId>
-              <artifactId>jaxb-api</artifactId>
-              <version>2.2</version>
-            </dependency>
-            <dependency>
-              <groupId>com.sun.xml.bind</groupId>
-              <artifactId>jaxb-xjc</artifactId>
-              <version>2.2</version>
-            </dependency>
-            <dependency>
-              <groupId>com.sun.xml.bind</groupId>
-              <artifactId>jaxb-impl</artifactId>
-              <version>2.2</version>
-            </dependency>
-            <dependency>
-              <groupId>com.sun.xml.bind</groupId>
-              <artifactId>jaxb-xjc</artifactId>
-              <version>2.2</version>
-            </dependency>
-          </dependencies>
-        </plugin>
-<!--        <plugin>
           <groupId>org.apache.maven.plugins</groupId>
-          <artifactId>maven-javadoc-plugin</artifactId>
-          <executions>
-            <execution>
-              <goals>
-                <goal>javadoc</goal>
-              </goals>
-              <phase>compile</phase>
-            </execution>
-          </executions>
-
-          <configuration>
-            <encoding>UTF-8</encoding>
-            <verbose>false</verbose>
-            <show>public</show>
-            <subpackages>com.sun.jersey.samples.generatewadl.resources</subpackages>
-            <doclet>com.sun.jersey.wadl.resourcedoc.ResourceDoclet</doclet>
+            <artifactId>maven-javadoc-plugin</artifactId>
+            <executions>
+              <execution>
+                <goals>
+                  <goal>javadoc</goal>
+                </goals>
+                <phase>compile</phase>
+              </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.6</version>
-                </docletArtifact> -->
-                <!--
-                  Also specify jersey and xerces as doclet artifacts as the ResourceDoclet
-                  uses classes provided by them to generate the resourcedoc.
-                -->
-                <!--<docletArtifact>
+                  <version>1.8</version>
+                </docletArtifact>
+                <docletArtifact>
                   <groupId>com.sun.jersey</groupId>
                   <artifactId>jersey-server</artifactId>
-                  <version>1.6</version>
+                  <version>1.8</version>
                 </docletArtifact>
                 <docletArtifact>
                   <groupId>xerces</groupId>
@@ -127,11 +82,25 @@
                   <version>2.6.1</version>
                 </docletArtifact>
               </docletArtifacts>
+              <useStandardDocletOptions>false</useStandardDocletOptions>
               <additionalparam>-output ${project.build.outputDirectory}/resourcedoc.xml</additionalparam>
-          </configuration>
-        </plugin> -->
+            </configuration>
+          </plugin>
       </plugins>
     </build>
+    <pluginRepositories>
+        <pluginRepository>
+            <id>maven2-repository.dev.java.net</id>
+            <name>Java.net Repository for Maven</name>
+            <url>http://download.java.net/maven/2/</url>
+            <layout>default</layout>
+        </pluginRepository>
+        <pluginRepository>
+            <id>maven2-glassfish-repository.dev.java.net</id>
+            <name>Java.net Repository for Maven</name>
+            <url>http://download.java.net/maven/glassfish/</url>
+        </pluginRepository>
+    </pluginRepositories>
 
     <dependencies>
       <dependency>
@@ -185,17 +154,35 @@
       <dependency>
         <groupId>com.sun.jersey</groupId>
         <artifactId>jersey-json</artifactId>
-        <version>1.9</version>
+        <version>1.8</version>
       </dependency>
       <dependency>
         <groupId>com.sun.jersey</groupId>
         <artifactId>jersey-server</artifactId>
-        <version>1.9</version>
+        <version>1.8</version>
       </dependency>
       <dependency>
         <groupId>com.sun.jersey</groupId>
         <artifactId>jersey-client</artifactId>
-        <version>1.9</version>
+        <version>1.8</version>
+      </dependency>
+      <dependency>
+        <groupId>com.sun.jersey.contribs</groupId>
+        <artifactId>jersey-multipart</artifactId>
+        <version>1.8</version>
+      </dependency>
+      <dependency>
+        <groupId>com.sun.jersey.jersey-test-framework</groupId>
+        <artifactId>jersey-test-framework-grizzly2</artifactId>
+        <version>1.8</version>
+        <scope>test</scope>
+      </dependency>
+      <!-- for external testing -->
+      <dependency>
+        <groupId>com.sun.jersey.jersey-test-framework</groupId>
+        <artifactId>jersey-test-framework-external</artifactId>
+        <version>1.8</version>
+        <scope>test</scope>
       </dependency>
     </dependencies>
 </project>

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=1175095&r1=1175094&r2=1175095&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 Sep 24 02:26:57 2011
@@ -28,6 +28,8 @@ import org.mortbay.jetty.Server;
 import org.mortbay.jetty.servlet.Context;
 import org.mortbay.jetty.servlet.DefaultServlet;
 import org.mortbay.jetty.servlet.ServletHolder;
+import org.mortbay.resource.Resource;
+import org.mortbay.resource.ResourceCollection;
 
 import com.sun.jersey.spi.container.servlet.ServletContainer;
 
@@ -48,21 +50,22 @@ public class Controller {
 
     try {
       Context root = new Context(server, "/", Context.SESSIONS);
-      /*
-        String AMBARI_HOME = System.getenv("AMBARI_HOME");
-        root.setBaseResource(new ResourceCollection(new Resource[]
+      String AMBARI_HOME = System.getenv("AMBARI_HOME");
+      root.setBaseResource(new ResourceCollection(new Resource[]
         {
           Resource.newResource(AMBARI_HOME+"/webapps/")
         }));
-      */
       ServletHolder rootServlet = root.addServlet(DefaultServlet.class, "/");
       rootServlet.setInitOrder(1);
       
       ServletHolder sh = new ServletHolder(ServletContainer.class);
-      sh.setInitParameter("com.sun.jersey.config.property.resourceConfigClass", "com.sun.jersey.api.core.PackagesResourceConfig");
-      sh.setInitParameter("com.sun.jersey.config.property.packages", "org.apache.ambari.controller.rest.resources");
-      //sh.setInitParameter("com.sun.jersey.config.property.WadlGeneratorConfig", "org.apache.ambari.controller.rest.resources.config.ExtendedWadlGeneratorConfig");
-      root.addServlet(sh, "/*");
+      sh.setInitParameter("com.sun.jersey.config.property.resourceConfigClass", 
+        "com.sun.jersey.api.core.PackagesResourceConfig");
+      sh.setInitParameter("com.sun.jersey.config.property.packages", 
+        "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/*");
       sh.setInitOrder(2);
       server.setStopAtShutdown(true);
       server.start();

Modified: incubator/ambari/trunk/controller/src/main/java/org/apache/ambari/controller/rest/config/ExtendedWadlGeneratorConfig.java
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/controller/src/main/java/org/apache/ambari/controller/rest/config/ExtendedWadlGeneratorConfig.java?rev=1175095&r1=1175094&r2=1175095&view=diff
==============================================================================
--- incubator/ambari/trunk/controller/src/main/java/org/apache/ambari/controller/rest/config/ExtendedWadlGeneratorConfig.java (original)
+++ incubator/ambari/trunk/controller/src/main/java/org/apache/ambari/controller/rest/config/ExtendedWadlGeneratorConfig.java Sat Sep 24 02:26:57 2011
@@ -1,37 +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.
-*/
+/*
+ * 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 ExtendedWadlGeneratorConfig extends WadlGeneratorConfig {
 
   @Override
   public List<WadlGeneratorDescription> configure() {
-    return generator(WadlGeneratorGrammarsSupport.class)
-        .prop("grammarsStream", "application-grammars.xml")
-        //.generator(WadlGeneratorResourceDocSupport.class)
-        //.prop("resourceDocStream", "resourcedoc.xml")
-        .descriptions();
+    return generator( WadlGeneratorApplicationDoc.class )
+      .prop( "applicationDocsStream", "application-doc.xml" )
+      .generator(WadlGeneratorGrammarsSupport.class)
+      .prop("grammarsStream", "application-grammars.xml")
+      .generator(WadlGeneratorResourceDocSupport.class)
+      .prop("resourceDocStream", "resourcedoc.xml")
+      .descriptions();
     }
 }

Modified: incubator/ambari/trunk/controller/src/main/java/org/apache/ambari/controller/rest/resources/ControllerResource.java
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/controller/src/main/java/org/apache/ambari/controller/rest/resources/ControllerResource.java?rev=1175095&r1=1175094&r2=1175095&view=diff
==============================================================================
--- incubator/ambari/trunk/controller/src/main/java/org/apache/ambari/controller/rest/resources/ControllerResource.java (original)
+++ incubator/ambari/trunk/controller/src/main/java/org/apache/ambari/controller/rest/resources/ControllerResource.java Sat Sep 24 02:26:57 2011
@@ -44,38 +44,24 @@ import org.apache.ambari.common.rest.ent
 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
+/** 
+ * 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).
-         *  <p>
-         *      This API is invoked by Ambari agent running on a cluster to update the 
-         *      the state of various services running on the nodes. This API also registers 
-         *      the node w/ controller (if not already done).
-         *  <p>
-         *  REST:<br>
-         *  &nbsp;&nbsp;&nbsp;&nbsp;URL Path                                    : /controller/agent/{hostname}<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> 
-         * 
-         * @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
-         * @throws Exception    throws Exception
-         */
+	
+  /** 
+   * 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)
@@ -85,15 +71,18 @@ public class ControllerResource {
         }
 
   /**
-   * @response.representation.200.doc Print an example of the Ambari heartbeat message
+   * Sample Ambari heartbeat message
+   * 
+   * @response.representation.200.doc Print example of Ambari heartbeat message
    * @response.representation.200.mediaType application/json
-   * @param stackId
+   * @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) {
+  public HeartBeat getHeartBeat(@DefaultValue("stack-123") 
+                                @QueryParam("stackId") String stackId) {
     try {
       InetAddress addr = InetAddress.getLocalHost();
       List<ActionResult> actionResults = new ArrayList<ActionResult>();      
@@ -134,8 +123,10 @@ public class ControllerResource {
       hb.setActionResults(actionResults);
       hb.setHardwareProfile(hp);
       List<ServerStatus> serversStatus = new ArrayList<ServerStatus>();
-      serversStatus.add(new ServerStatus("hadoop.datanode", ServerStatus.State.STARTED));
-      serversStatus.add(new ServerStatus("hadoop.tasktracker", ServerStatus.State.STARTED));
+      serversStatus.add(new ServerStatus("hadoop.datanode", 
+          ServerStatus.State.STARTED));
+      serversStatus.add(new ServerStatus("hadoop.tasktracker", 
+          ServerStatus.State.STARTED));
       hb.setServersStatus(serversStatus);
       return hb;
     } catch (UnknownHostException e) {
@@ -144,9 +135,11 @@ public class ControllerResource {
   }
   
   /**
+   * 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
+   * @return ControllerResponse A list of command to execute on agent
    */
   @Path("response/sample")
   @GET

Added: incubator/ambari/trunk/controller/src/main/java/org/apache/ambari/controller/rest/resources/WadlResource.java
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/controller/src/main/java/org/apache/ambari/controller/rest/resources/WadlResource.java?rev=1175095&view=auto
==============================================================================
--- incubator/ambari/trunk/controller/src/main/java/org/apache/ambari/controller/rest/resources/WadlResource.java (added)
+++ incubator/ambari/trunk/controller/src/main/java/org/apache/ambari/controller/rest/resources/WadlResource.java Sat Sep 24 02:26:57 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.resources;
+
+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/resources/application-doc.xml
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/controller/src/main/resources/application-doc.xml?rev=1175095&view=auto
==============================================================================
--- incubator/ambari/trunk/controller/src/main/resources/application-doc.xml (added)
+++ incubator/ambari/trunk/controller/src/main/resources/application-doc.xml Sat Sep 24 02:26:57 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 REST API">
+        Ambari public REST API.
+    </doc>
+
+</applicationDocs>

Added: incubator/ambari/trunk/controller/src/main/resources/application-grammars.xml
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/controller/src/main/resources/application-grammars.xml?rev=1175095&view=auto
==============================================================================
--- incubator/ambari/trunk/controller/src/main/resources/application-grammars.xml (added)
+++ incubator/ambari/trunk/controller/src/main/resources/application-grammars.xml Sat Sep 24 02:26:57 2011
@@ -0,0 +1,49 @@
+<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
+<!--
+
+    DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
+
+    Copyright (c) 2010-2011 Oracle and/or its affiliates. All rights reserved.
+
+    The contents of this file are subject to the terms of either the GNU
+    General Public License Version 2 only ("GPL") or the Common Development
+    and Distribution License("CDDL") (collectively, the "License").  You
+    may not use this file except in compliance with the License.  You can
+    obtain a copy of the License at
+    http://glassfish.java.net/public/CDDL+GPL_1_1.html
+    or packager/legal/LICENSE.txt.  See the License for the specific
+    language governing permissions and limitations under the License.
+
+    When distributing the software, include this License Header Notice in each
+    file and include the License file at packager/legal/LICENSE.txt.
+
+    GPL Classpath Exception:
+    Oracle designates this particular file as subject to the "Classpath"
+    exception as provided by Oracle in the GPL Version 2 section of the License
+    file that accompanied this code.
+
+    Modifications:
+    If applicable, add the following below the License Header, with the fields
+    enclosed by brackets [] replaced by your own identifying information:
+    "Portions Copyright [year] [name of copyright owner]"
+
+    Contributor(s):
+    If you wish your version of this file to be governed by only the CDDL or
+    only the GPL Version 2, indicate your decision by adding "[Contributor]
+    elects to include this software in this distribution under the [CDDL or GPL
+    Version 2] license."  If you don't indicate a single choice of license, a
+    recipient has the option to distribute your version of this file under
+    either the CDDL, the GPL Version 2 or to extend the choice of license to
+    its licensees as provided above.  However, if you add GPL Version 2 code
+    and therefore, elected the GPL Version 2 license, then the option applies
+    only if the new code is made subject to such option by the copyright
+    holder.
+
+-->
+
+<grammars xmlns="http://research.sun.com/wadl/2006/10"
+    xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+    xmlns:xi="http://www.w3.org/1999/XML/xinclude">
+    <include href="schema.xsd" />
+</grammars>
+

Added: incubator/ambari/trunk/controller/src/main/webapps/wadl.xsl
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/controller/src/main/webapps/wadl.xsl?rev=1175095&view=auto
==============================================================================
--- incubator/ambari/trunk/controller/src/main/webapps/wadl.xsl (added)
+++ incubator/ambari/trunk/controller/src/main/webapps/wadl.xsl Sat Sep 24 02:26:57 2011
@@ -0,0 +1,633 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- 
+    wadl.xsl (06-May-2011)
+    
+    Transforms Web Application Description Language (WADL) XML documents into HTML.
+
+    Mark Sawers <ma...@ipc.com>
+    
+    Limitations:
+        * Ignores globally defined methods, referred to from a resource using a method reference element.
+          Methods must be embedded in a resource element.
+        * Ditto for globally defined representations. Representations must be embedded within request
+          and response elements.
+        * Ignores type and queryType attributes of resource element.
+        * Ignores resource_type element.
+        * Ignores profile attribute of representation element.
+        * Ignores path attribute and child link elements of param element.
+
+    Copyright (c) 2011 IPC Systems, Inc.
+
+    Parts of this work are adapted from Mark Notingham's wadl_documentation.xsl, at
+        https://github.com/mnot/wadl_stylesheets.
+    
+    This work is licensed under the Creative Commons Attribution-ShareAlike 3.0 License.
+    To view a copy of this license, visit 
+        http://creativecommons.org/licenses/by-sa/3.0/
+    or send a letter to 
+        Creative Commons
+        543 Howard Street, 5th Floor
+        San Francisco, California, 94105, USA
+ -->
+<xsl:stylesheet 
+ xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="2.0"
+ xmlns:wadl="http://research.sun.com/wadl/2006/10"
+ xmlns:xs="http://www.w3.org/2001/XMLSchema"
+ xmlns:html="http://www.w3.org/1999/xhtml"
+ xmlns="http://www.w3.org/1999/xhtml"
+>
+
+<!-- Global variables -->
+<xsl:variable name="g_resourcesBase" select="wadl:application/wadl:resources/@base"/>
+
+<!-- Template for top-level doc element -->
+<xsl:template match="wadl:application">
+    <html>
+    <head>
+        <xsl:call-template name="getStyle"/>
+        <title><xsl:call-template name="getTitle"/></title>
+    </head>
+    <body>
+    <h1><xsl:call-template name="getTitle"/></h1>
+    <xsl:call-template name="getDoc">
+        <xsl:with-param name="base" select="$g_resourcesBase"/>
+    </xsl:call-template>
+    
+    <!-- Summary -->
+    <h2>Summary</h2>
+    <table>
+        <tr>
+            <th>Resource</th>
+            <th>Method</th>
+            <th>Description</th>
+        </tr>
+        <xsl:for-each select="wadl:resources/wadl:resource">
+            <xsl:call-template name="processResourceSummary">
+                <xsl:with-param name="resourceBase" select="$g_resourcesBase"/>
+                <xsl:with-param name="resourcePath" select="@path"/>
+                <xsl:with-param name="lastResource" select="position() = last()"/>
+            </xsl:call-template>
+        </xsl:for-each>
+    </table>
+    <p></p>
+    
+    <!-- Grammars -->
+    <xsl:if test="wadl:grammars/wadl:include">
+        <h2>Grammars</h2>
+        <p>
+            <xsl:for-each select="wadl:grammars/wadl:include">
+                <xsl:variable name="href" select="@href"/>
+                <a href="{$href}"><xsl:value-of select="$href"/></a>
+                <xsl:if test="position() != last()"><br/></xsl:if>  <!-- Add a spacer -->
+            </xsl:for-each>
+        </p>
+    </xsl:if>
+
+    <!-- Detail -->
+    <h2>Resources</h2>
+    <xsl:for-each select="wadl:resources">
+        <xsl:call-template name="getDoc">
+            <xsl:with-param name="base" select="$g_resourcesBase"/>
+        </xsl:call-template>
+        <br/>
+    </xsl:for-each>
+    
+    <xsl:for-each select="wadl:resources/wadl:resource">
+        <xsl:call-template name="processResourceDetail">
+            <xsl:with-param name="resourceBase" select="$g_resourcesBase"/>
+            <xsl:with-param name="resourcePath" select="@path"/>
+        </xsl:call-template>
+    </xsl:for-each>
+
+    </body>
+    </html>
+</xsl:template>
+
+<!-- Supporting templates (functions) -->
+
+<xsl:template name="processResourceSummary">
+    <xsl:param name="resourceBase"/>
+    <xsl:param name="resourcePath"/>
+    <xsl:param name="lastResource"/>
+
+    <xsl:if test="wadl:method">
+        <tr>
+            <!-- Resource -->
+            <td class="summary">
+                <xsl:variable name="id"><xsl:call-template name="getId"/></xsl:variable>
+                <a href="#{$id}">
+                    <xsl:call-template name="getFullResourcePath">
+                        <xsl:with-param name="base" select="$resourceBase"/>                
+                        <xsl:with-param name="path" select="$resourcePath"/>                
+                    </xsl:call-template>
+                </a>
+            </td>
+            <!-- Method -->
+            <td class="summary">
+                <xsl:for-each select="wadl:method">
+                    <xsl:variable name="name" select="@name"/>
+                    <xsl:variable name="id2"><xsl:call-template name="getId"/></xsl:variable>
+                    <a href="#{$id2}"><xsl:value-of select="$name"/></a>
+                    <xsl:for-each select="wadl:doc"><br/></xsl:for-each>
+                    <xsl:if test="position() != last()"><br/></xsl:if>  <!-- Add a spacer -->
+                </xsl:for-each>
+                <br/>
+            </td>
+            <!-- Description -->
+            <td class="summary">
+                <xsl:for-each select="wadl:method">
+                    <xsl:call-template name="getDoc">
+                        <xsl:with-param name="base" select="$resourceBase"/>
+                    </xsl:call-template>
+                    <br/>
+                    <xsl:if test="position() != last()"><br/></xsl:if>  <!-- Add a spacer -->
+                </xsl:for-each>
+            </td>
+        </tr>
+        <!-- Add separator if not the last resource -->
+        <xsl:if test="wadl:method and not($lastResource)">
+            <tr><td class="summarySeparator"></td><td class="summarySeparator"/><td class="summarySeparator"/></tr>
+        </xsl:if>
+    </xsl:if>   <!-- wadl:method -->
+
+    <!-- Call recursively for child resources -->
+    <xsl:for-each select="wadl:resource">
+        <xsl:variable name="base">
+            <xsl:call-template name="getFullResourcePath">
+                <xsl:with-param name="base" select="$resourceBase"/>                
+                <xsl:with-param name="path" select="$resourcePath"/>           
+            </xsl:call-template>
+        </xsl:variable>
+        <xsl:call-template name="processResourceSummary">
+            <xsl:with-param name="resourceBase" select="$base"/>
+            <xsl:with-param name="resourcePath" select="@path"/>
+            <xsl:with-param name="lastResource" select="$lastResource and position() = last()"/>
+        </xsl:call-template>
+    </xsl:for-each>
+
+</xsl:template>
+
+<xsl:template name="processResourceDetail">
+    <xsl:param name="resourceBase"/>
+    <xsl:param name="resourcePath"/>
+
+    <xsl:if test="wadl:method">
+        <h3>
+            <xsl:variable name="id"><xsl:call-template name="getId"/></xsl:variable>
+            <a name="{$id}">
+                <xsl:call-template name="getFullResourcePath">
+                    <xsl:with-param name="base" select="$resourceBase"/>                
+                    <xsl:with-param name="path" select="$resourcePath"/>                
+                </xsl:call-template>
+            </a>
+        </h3>
+        <p>
+            <xsl:call-template name="getDoc">
+                <xsl:with-param name="base" select="$resourceBase"/>
+            </xsl:call-template>
+        </p>
+
+        <h5>Methods</h5>
+
+        <div class="methods">
+            <xsl:for-each select="wadl:method">
+            <div class="method">
+                <table class="methodNameTable">
+                    <tr>
+                        <td class="methodNameTd" style="font-weight: bold">
+                            <xsl:variable name="name" select="@name"/>
+                            <xsl:variable name="id2"><xsl:call-template name="getId"/></xsl:variable>
+                            <a name="{$id2}"><xsl:value-of select="$name"/></a>
+                        </td>
+                        <td class="methodNameTd" style="text-align: right">
+                            <xsl:if test="@id">
+                                <xsl:value-of select="@id"/>() 
+                            </xsl:if>
+                        </td>
+                    </tr>
+                </table>
+                <p>
+                    <xsl:call-template name="getDoc">
+                        <xsl:with-param name="base" select="$resourceBase"/>
+                    </xsl:call-template>
+                </p>
+
+                <!-- Request -->
+                <h6>request</h6>
+                <div style="margin-left: 2em">  <!-- left indent -->
+                <xsl:choose>
+                    <xsl:when test="wadl:request">
+                        <xsl:for-each select="wadl:request">
+                            <xsl:call-template name="getParamBlock">
+                                <xsl:with-param name="style" select="'template'"/>
+                            </xsl:call-template>
+                    
+                            <xsl:call-template name="getParamBlock">
+                                <xsl:with-param name="style" select="'matrix'"/>
+                            </xsl:call-template>
+                    
+                            <xsl:call-template name="getParamBlock">
+                                <xsl:with-param name="style" select="'header'"/>
+                            </xsl:call-template>
+                    
+                            <xsl:call-template name="getParamBlock">
+                                <xsl:with-param name="style" select="'query'"/>
+                            </xsl:call-template>
+                    
+                            <xsl:call-template name="getRepresentations"/>
+                        </xsl:for-each> <!-- wadl:request -->
+                    </xsl:when>
+    
+                    <xsl:when test="not(wadl:request) and (ancestor::wadl:*/wadl:param)">
+                        <xsl:call-template name="getParamBlock">
+                            <xsl:with-param name="style" select="'template'"/>
+                        </xsl:call-template>
+                
+                        <xsl:call-template name="getParamBlock">
+                            <xsl:with-param name="style" select="'matrix'"/>
+                        </xsl:call-template>
+                
+                        <xsl:call-template name="getParamBlock">
+                            <xsl:with-param name="style" select="'header'"/>
+                        </xsl:call-template>
+                
+                        <xsl:call-template name="getParamBlock">
+                            <xsl:with-param name="style" select="'query'"/>
+                        </xsl:call-template>
+                
+                        <xsl:call-template name="getRepresentations"/>
+                    </xsl:when>
+            
+                    <xsl:otherwise>
+                        unspecified
+                    </xsl:otherwise>
+                </xsl:choose>
+                </div>  <!-- left indent for request -->
+                                
+                <!-- Response -->
+                <h6>responses</h6>
+                <div style="margin-left: 2em">  <!-- left indent -->
+                <xsl:choose>
+                    <xsl:when test="wadl:response">
+                        <xsl:for-each select="wadl:response">
+                            <div class="h8">status: </div>
+                            <xsl:choose>
+                                <xsl:when test="@status">
+                                    <xsl:value-of select="@status"/>
+                                </xsl:when>
+                                <xsl:otherwise>
+                                    200 - OK
+                                </xsl:otherwise>
+                            </xsl:choose>
+                            <xsl:for-each select="wadl:doc">
+                                <xsl:if test="@title">
+                                    - <xsl:value-of select="@title"/>
+                                </xsl:if>
+                                <xsl:if test="text()">
+                                    - <xsl:value-of select="text()"/>
+                                </xsl:if>
+                            </xsl:for-each>
+                            
+                            <!-- Get response headers/representations -->
+                            <xsl:if test="wadl:param or wadl:representation">
+                                <div style="margin-left: 2em"> <!-- left indent -->
+                                <xsl:if test="wadl:param">
+                                    <div class="h7">headers</div>
+                                    <table>
+                                        <xsl:for-each select="wadl:param[@style='header']">
+                                            <xsl:call-template name="getParams"/>
+                                        </xsl:for-each>
+                                    </table>
+                                </xsl:if>
+    
+                                <xsl:call-template name="getRepresentations"/>
+                                </div>  <!-- left indent for response headers/representations -->
+                            </xsl:if>
+                        </xsl:for-each> <!-- wadl:response -->
+                    </xsl:when>
+                    <xsl:otherwise>
+                        unspecified
+                    </xsl:otherwise>
+                </xsl:choose>                
+                </div>  <!-- left indent for responses -->
+
+            </div>  <!-- class=method -->
+            </xsl:for-each> <!-- wadl:method  -->
+        </div> <!-- class=methods -->
+
+    </xsl:if>   <!-- wadl:method -->
+
+    <!-- Call recursively for child resources -->
+    <xsl:for-each select="wadl:resource">
+        <xsl:variable name="base">
+            <xsl:call-template name="getFullResourcePath">
+                <xsl:with-param name="base" select="$resourceBase"/>                
+                <xsl:with-param name="path" select="$resourcePath"/>           
+            </xsl:call-template>
+        </xsl:variable>
+        <xsl:call-template name="processResourceDetail">
+            <xsl:with-param name="resourceBase" select="$base"/>
+            <xsl:with-param name="resourcePath" select="@path"/>
+        </xsl:call-template>
+    </xsl:for-each> <!-- wadl:resource -->
+</xsl:template>
+
+<xsl:template name="getFullResourcePath">
+    <xsl:param name="base"/>
+    <xsl:param name="path"/>
+    <xsl:choose>
+        <xsl:when test="substring($base, string-length($base)) = '/'">
+            <xsl:value-of select="$base"/>
+        </xsl:when>
+        <xsl:otherwise>
+            <xsl:value-of select="concat($base, '/')"/>
+        </xsl:otherwise>
+    </xsl:choose>
+    <xsl:choose>
+        <xsl:when test="starts-with($path, '/')">
+            <xsl:value-of select="substring($path, 2)"/>
+        </xsl:when>
+        <xsl:otherwise>
+            <xsl:value-of select="$path"/>
+        </xsl:otherwise>
+    </xsl:choose>
+</xsl:template>
+
+<xsl:template name="getDoc">
+    <xsl:param name="base"/>
+    <xsl:for-each select="wadl:doc">
+        <xsl:if test="position() > 1"><br/></xsl:if>
+        <xsl:if test="@title and local-name(..) != 'application'">
+            <xsl:value-of select="@title"/>:
+        </xsl:if>
+        <xsl:choose>
+            <xsl:when test="@title = 'Example'">
+                <xsl:variable name="url">
+                    <xsl:choose>
+                        <xsl:when test="string-length($base) > 0">
+                            <xsl:call-template name="getFullResourcePath">
+                                <xsl:with-param name="base" select="$base"/>                
+                                <xsl:with-param name="path" select="text()"/>
+                            </xsl:call-template>
+                        </xsl:when>
+                        <xsl:otherwise><xsl:value-of select="text()"/></xsl:otherwise>
+                    </xsl:choose>
+                </xsl:variable>
+                <a href="{$url}"><xsl:value-of select="$url"/></a>
+            </xsl:when>
+            <xsl:otherwise>
+                <xsl:value-of select="text()"/>
+            </xsl:otherwise>
+        </xsl:choose>
+    </xsl:for-each>
+</xsl:template>
+
+<xsl:template name="getId">
+    <xsl:choose>
+        <xsl:when test="@id"><xsl:value-of select="@id"/></xsl:when>
+        <xsl:otherwise><xsl:value-of select="generate-id()"/></xsl:otherwise>
+    </xsl:choose>
+</xsl:template>
+
+<xsl:template name="getParamBlock">
+    <xsl:param name="style"/>
+    <xsl:if test="ancestor-or-self::wadl:*/wadl:param[@style=$style]">
+        <div class="h7"><xsl:value-of select="$style"/> params</div>
+        <table>
+            <xsl:for-each select="ancestor-or-self::wadl:*/wadl:param[@style=$style]">
+                <xsl:call-template name="getParams"/>
+            </xsl:for-each>
+        </table>
+        <p/>
+    </xsl:if>
+</xsl:template>
+
+<xsl:template name="getParams">
+    <tr>
+        <td><strong><xsl:value-of select="@name"/></strong></td>
+            <td>
+                <xsl:if test="not(@type)">
+                    unspecified type
+                </xsl:if>
+                <xsl:call-template name="getParamType">
+                    <xsl:with-param name="qname" select="@type"/>
+                </xsl:call-template>
+                <xsl:if test="@required = 'true'"><br/>(required)</xsl:if>
+                <xsl:if test="@repeating = 'true'"><br/>(repeating)</xsl:if>
+                <xsl:if test="@default"><br/>default: <tt><xsl:value-of select="@default"/></tt></xsl:if>
+                <xsl:if test="@fixed"><br/>fixed: <tt><xsl:value-of select="@fixed"/></tt></xsl:if>
+                <xsl:if test="wadl:option">
+                    <br/>options:
+                    <xsl:for-each select="wadl:option">
+                        <xsl:choose>
+                            <xsl:when test="@mediaType">
+                                <br/><tt><xsl:value-of select="@value"/> (<xsl:value-of select="@mediaType"/>)</tt>
+                            </xsl:when>
+                            <xsl:otherwise>
+                                <tt><xsl:value-of select="@value"/></tt>
+                                <xsl:if test="position() != last()">, </xsl:if>
+                            </xsl:otherwise>
+                        </xsl:choose>
+                    </xsl:for-each>
+                </xsl:if>
+            </td>
+        <xsl:if test="wadl:doc">
+            <td><xsl:value-of select="wadl:doc"/></td>
+        </xsl:if>
+    </tr>
+</xsl:template>
+
+<xsl:template name="getParamType">
+    <xsl:param name="qname"/>
+    <xsl:variable name="prefix" select="substring-before($qname,':')"/>
+    <xsl:variable name="ns-uri" select="./namespace::*[name()=$prefix]"/>
+    <xsl:variable name="localname" select="substring-after($qname, ':')"/>
+    <xsl:choose>
+        <xsl:when test="$ns-uri='http://www.w3.org/2001/XMLSchema' or $ns-uri='http://www.w3.org/2001/XMLSchema-instance'">
+            <a href="http://www.w3.org/TR/xmlschema-2/#{$localname}"><xsl:value-of select="$localname"/></a>
+        </xsl:when>
+        <xsl:otherwise>
+            <xsl:value-of select="$qname"/>
+        </xsl:otherwise>
+    </xsl:choose>
+</xsl:template>
+
+<xsl:template name="getRepresentations">
+    <xsl:if test="wadl:representation">
+        <div class="h7">representations</div>
+        <table>
+            <xsl:for-each select="wadl:representation">
+                <tr>
+                    <td><xsl:value-of select="@mediaType"/></td>
+                    <xsl:if test="wadl:doc">
+                        <td>
+                            <xsl:call-template name="getDoc">
+                                <xsl:with-param name="base" select="''"/>
+                            </xsl:call-template>
+                        </td>
+                    </xsl:if>
+                    <xsl:if test="@href or @element">
+                        <td>
+                            <xsl:variable name="href" select="@href"/>
+                            <xsl:choose>
+                                <xsl:when test="@href">
+                                    <a href="{$href}"><xsl:value-of select="@element"/></a>
+                                </xsl:when>
+                                <xsl:otherwise>
+                                    <xsl:value-of select="@element"/>
+                                </xsl:otherwise>
+                            </xsl:choose>
+                        </td>
+                    </xsl:if>
+                </tr>
+                <xsl:call-template name="getRepresentationParamBlock">
+                    <xsl:with-param name="style" select="'template'"/>
+                </xsl:call-template>
+        
+                <xsl:call-template name="getRepresentationParamBlock">
+                    <xsl:with-param name="style" select="'matrix'"/>
+                </xsl:call-template>
+        
+                <xsl:call-template name="getRepresentationParamBlock">
+                    <xsl:with-param name="style" select="'header'"/>
+                </xsl:call-template>
+        
+                <xsl:call-template name="getRepresentationParamBlock">
+                    <xsl:with-param name="style" select="'query'"/>
+                </xsl:call-template>
+            </xsl:for-each>
+        </table>
+    </xsl:if> 
+</xsl:template>
+
+<xsl:template name="getRepresentationParamBlock">
+    <xsl:param name="style"/>
+    <xsl:if test="wadl:param[@style=$style]">
+        <tr>
+            <td style="padding: 0em, 0em, 0em, 2em">
+                <div class="h7"><xsl:value-of select="$style"/> params</div>
+                <table>
+                    <xsl:for-each select="wadl:param[@style=$style]">
+                        <xsl:call-template name="getParams"/>
+                    </xsl:for-each>
+                </table>
+                <p/>
+            </td>
+        </tr>
+    </xsl:if>
+</xsl:template>
+
+<xsl:template name="getStyle">
+     <style type="text/css">
+        body {
+            font-family: sans-serif;
+            font-size: 0.85em;
+            margin: 2em 2em;
+        }
+        .methods {
+            margin-left: 2em; 
+            margin-bottom: 2em;
+        }
+        .method {
+            background-color: #eef;
+            border: 1px solid #DDDDE6;
+            padding: .5em;
+            margin-bottom: 1em;
+            width: 50em
+        }
+        .methodNameTable {
+            width: 100%;
+            border: 0px;
+            border-bottom: 2px solid white;
+            font-size: 1.4em;
+        }
+        .methodNameTd {
+            background-color: #eef;
+        }
+        h1 {
+            font-size: 2m;
+            margin-bottom: 0em;
+        }
+        h2 {
+            border-bottom: 1px solid black;
+            margin-top: 1.5em;
+            margin-bottom: 0.5em;
+            font-size: 1.5em;
+           }
+        h3 {
+            color: #FF6633;
+            font-size: 1.35em;
+            margin-top: .5em;
+            margin-bottom: 0em;
+        }
+        h5 {
+            font-size: 1.2em;
+            color: #99a;
+            margin: 0.5em 0em 0.25em 0em;
+        }
+        h6 {
+            color: #700000;
+            font-size: 1em;
+            margin: 1em 0em 0em 0em;
+        }
+        .h7 {
+            margin-top: .75em;
+            font-size: 1em;
+            font-weight: bold;
+            font-style: italic;
+            color: blue;
+        }
+        .h8 {
+            margin-top: .75em;
+            font-size: 1em;
+            font-weight: bold;
+            font-style: italic;
+            color: black;
+        }
+        tt {
+            font-size: 1em;
+        }
+        table {
+            margin-bottom: 0.5em;
+            border: 1px solid #E0E0E0;
+        }
+        th {
+            text-align: left;
+            font-weight: normal;
+            font-size: 1em;
+            color: black;
+            background-color: #DDDDE6;
+            padding: 3px 6px;
+            border: 1px solid #B1B1B8;
+        }
+        td {
+            padding: 3px 6px;
+            vertical-align: top;
+            background-color: #F6F6FF;
+            font-size: 0.85em;
+        }
+        p {
+            margin-top: 0em;
+            margin-bottom: 0em;
+        }
+        td.summary {
+            background-color: white;
+        }
+        td.summarySeparator {
+            padding: 1px;
+        }
+    </style>
+</xsl:template>
+
+<xsl:template name="getTitle">
+    <xsl:choose>
+        <xsl:when test="wadl:doc/@title">
+            <xsl:value-of select="wadl:doc/@title"/>
+        </xsl:when>
+        <xsl:otherwise>
+            Web Application
+        </xsl:otherwise>
+    </xsl:choose>
+</xsl:template>
+
+</xsl:stylesheet>