Author: [email protected]
Date: Mon Apr  2 12:28:33 2012
New Revision: 2175

Log:
[AMDATUOPENSOCIAL-204] Initial layout of REST API, defining the API but not 
containing the implementation yet

Added:
   
trunk/amdatu-opensocial/opensocial-gadgetmanagement/src/main/java/org/amdatu/opensocial/gadgetmanagement/bean/gadget/Categories.java
   
trunk/amdatu-opensocial/opensocial-gadgetmanagement/src/main/java/org/amdatu/opensocial/gadgetmanagement/bean/gadget/Gadgets.java
   
trunk/amdatu-opensocial/opensocial-gadgetmanagement/src/main/java/org/amdatu/opensocial/gadgetmanagement/rest/CategoriesRESTServiceImpl.java
   
trunk/amdatu-opensocial/opensocial-gadgetmanagement/src/main/java/org/amdatu/opensocial/gadgetmanagement/rest/GadgetRESTServiceImpl.java

Added: 
trunk/amdatu-opensocial/opensocial-gadgetmanagement/src/main/java/org/amdatu/opensocial/gadgetmanagement/bean/gadget/Categories.java
==============================================================================
--- (empty file)
+++ 
trunk/amdatu-opensocial/opensocial-gadgetmanagement/src/main/java/org/amdatu/opensocial/gadgetmanagement/bean/gadget/Categories.java
        Mon Apr  2 12:28:33 2012
@@ -0,0 +1,76 @@
+/*
+ * Copyright (c) 2010, 2011 The Amdatu Foundation
+ * 
+ * Licensed 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.amdatu.opensocial.gadgetmanagement.bean.gadget;
+
+import org.amdatu.opensocial.gadgetmanagement.bean.dashboard.RestBean;
+import org.amdatu.opensocial.rest.tools.LinkResource;
+import org.amdatu.opensocial.rest.tools.RESTInvocationContext;
+import org.amdatu.opensocial.rest.tools.ReferenceableResource;
+import org.amdatu.opensocial.rest.tools.ResourceLinkBuilder;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlRootElement;
+
+import com.google.gson.annotations.SerializedName;
+
+/**
+ * TODO: This class for now only defines the properties of this new JAXB 
annotated bean, but it is 
+ * not use at runtime yet.
+ * 
+ * @author <a href="mailto:[email protected]";>Amdatu Project 
Team</a>
+ */
+@SuppressWarnings("restriction")
+@XmlRootElement(name = "gadgetcategories")
+public class Categories extends RestBean implements ReferenceableResource {
+    @SerializedName("category")
+    private List<Category> m_categories;
+
+    @XmlElement(name = "category")
+    @LinkResource(value = Category.class)
+    public List<Category> getCategories() {
+        return m_categories;
+    }
+
+    public void setCategories(List<Category> categories) {
+        m_categories = categories;
+    }
+
+    public void addCategory(Category category) {
+        if (m_categories == null) {
+            m_categories = new ArrayList<Category>();
+        }
+        m_categories.add(category);
+    }
+    
+    public String getResourceId() {
+        return "";
+    }
+    
+    public static Categories getExample(RESTInvocationContext context) {
+        Categories categories = new Categories();
+        
+        Category category = Category.getExample(context, true);
+        categories.addCategory(category);
+        
+        String url = "http://localhost/rest";;
+        new ResourceLinkBuilder(url, context.getMimeType(), 
context.getHttpMethod(), context.isInput()).process(categories);
+        
+        return categories;
+    }
+}

Added: 
trunk/amdatu-opensocial/opensocial-gadgetmanagement/src/main/java/org/amdatu/opensocial/gadgetmanagement/bean/gadget/Gadgets.java
==============================================================================
--- (empty file)
+++ 
trunk/amdatu-opensocial/opensocial-gadgetmanagement/src/main/java/org/amdatu/opensocial/gadgetmanagement/bean/gadget/Gadgets.java
   Mon Apr  2 12:28:33 2012
@@ -0,0 +1,122 @@
+/*
+ * Copyright (c) 2010, 2011 The Amdatu Foundation
+ * 
+ * Licensed 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.amdatu.opensocial.gadgetmanagement.bean.gadget;
+
+import org.amdatu.opensocial.gadgetmanagement.bean.dashboard.Definition;
+import org.amdatu.opensocial.gadgetmanagement.bean.dashboard.RestBean;
+import org.amdatu.opensocial.rest.tools.LinkResource;
+import org.amdatu.opensocial.rest.tools.RESTInvocationContext;
+import org.amdatu.opensocial.rest.tools.ReferenceableResource;
+import org.amdatu.opensocial.rest.tools.ResourceLinkBuilder;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlRootElement;
+
+import com.google.gson.annotations.SerializedName;
+
+/**
+ * TODO: This class for now only defines the properties of this new JAXB 
annotated bean, but it is 
+ * not use at runtime yet.
+ * 
+ * @author <a href="mailto:[email protected]";>Amdatu Project 
Team</a>
+ */
+@SuppressWarnings("restriction")
+@XmlRootElement(name = "gadgets")
+public class Gadgets extends RestBean implements ReferenceableResource {
+    // Members
+    @SerializedName("gadget")
+    private List<Definition> m_gadgets;
+    
+    // Search properties
+    int m_startIndex;
+    int m_itemsPerPage;
+    int m_totalResults;
+    int m_totalPages;
+    
+    @XmlElement(name = "gadget")
+    @LinkResource(value = Definition.class)
+    public List<Definition> getGadgets() {
+        return m_gadgets;
+    }
+
+    public void setGadgets(List<Definition> gadgets) {
+        m_gadgets = gadgets;
+    }
+
+    public void addGadget(Definition gadget) {
+        if (m_gadgets == null) {
+            m_gadgets = new ArrayList<Definition>();
+        }
+        m_gadgets.add(gadget);
+    }
+    
+    public int getStartIndex() {
+        return m_startIndex;
+    }
+
+    public void setStartIndex(int startIndex) {
+        m_startIndex = startIndex;
+    }
+
+    public int getItemsPerPage() {
+        return m_itemsPerPage;
+    }
+
+    public void setItemsPerPage(int itemsPerPage) {
+        m_itemsPerPage = itemsPerPage;
+    }
+
+    public int getTotalResults() {
+        return m_totalResults;
+    }
+
+    public void setTotalResults(int totalResults) {
+        m_totalResults = totalResults;
+    }
+
+    public int getTotalPages() {
+        return m_totalPages;
+    }
+
+    public void setTotalPages(int totalPages) {
+        m_totalPages = totalPages;
+    }
+
+    public static Gadgets getExample(RESTInvocationContext context) {
+        Gadgets gadgets = new Gadgets();
+        
+        Definition gadget = Definition.getExample(context, true, true);
+        gadgets.addGadget(gadget);
+        
+        gadgets.setStartIndex(0);
+        gadgets.setItemsPerPage(1);
+        gadgets.setTotalPages(3);
+        gadgets.setTotalResults(3);
+        
+        String url = "http://localhost/rest";;
+        new ResourceLinkBuilder(url, context).process(gadgets);
+        
+        // Append paging links
+        gadgets.addLink(url + "/gadgets?startIndex=0&count=1", "first", 
context.getMimeType());
+        gadgets.addLink(url + "/gadgets?startIndex=1&count=1", "next", 
context.getMimeType());
+        gadgets.addLink(url + "/gadgets?startIndex=2&count=1", "last", 
context.getMimeType());
+        
+        return gadgets;
+    }
+}

Added: 
trunk/amdatu-opensocial/opensocial-gadgetmanagement/src/main/java/org/amdatu/opensocial/gadgetmanagement/rest/CategoriesRESTServiceImpl.java
==============================================================================
--- (empty file)
+++ 
trunk/amdatu-opensocial/opensocial-gadgetmanagement/src/main/java/org/amdatu/opensocial/gadgetmanagement/rest/CategoriesRESTServiceImpl.java
        Mon Apr  2 12:28:33 2012
@@ -0,0 +1,147 @@
+/*
+ * Copyright (c) 2010, 2011 The Amdatu Foundation
+ *
+ * Licensed 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.amdatu.opensocial.gadgetmanagement.rest;
+
+import org.amdatu.opensocial.gadgetmanagement.bean.gadget.Categories;
+import org.amdatu.opensocial.gadgetmanagement.bean.gadget.Category;
+import org.amdatu.opensocial.rest.tools.annotation.OutputTypeHint;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.ws.rs.Consumes;
+import javax.ws.rs.DELETE;
+import javax.ws.rs.FormParam;
+import javax.ws.rs.GET;
+import javax.ws.rs.POST;
+import javax.ws.rs.PUT;
+import javax.ws.rs.Path;
+import javax.ws.rs.PathParam;
+import javax.ws.rs.Produces;
+import javax.ws.rs.core.Context;
+import javax.ws.rs.core.HttpHeaders;
+import javax.ws.rs.core.MediaType;
+import javax.ws.rs.core.Response;
+
+/**
+ * TODO: This class for now only defines the properties of the new REST API, 
but it is not implemented yet.
+ * 
+ * @author <a href="mailto:[email protected]";>Amdatu Project 
Team</a>
+ */
+@Path("gadgetcategories")
+public class CategoriesRESTServiceImpl {
+    /**
+     * Returns the gadget categories.
+     * <br/><i>FIXME: The label element value is written to a 'content' 
element in JSON by Jackson, and
+     * this cannot be changed since the Jackson package is not exported by the 
Wink bundle</i>
+     * 
+     * @param request The HTTP servlet request
+     * @param headers The HTTP servlet request headers
+     * @return <ul>
+     *         <li>200 (OK) : The gadget categories were returned 
successfully.</li>
+     *         <li>401 (UNAUTHORIZED) : The user is not authenticated or not 
authorized to retrieve gadget categories.</li>
+     *         </ul>
+     */
+    @GET
+    @Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON})
+    @OutputTypeHint(value = Categories.class, method = "getExample")
+    public Response getCategories(@Context final HttpServletRequest request, 
@Context final HttpHeaders headers) {
+       return null;
+    }
+    
+    /**
+     * Creates a new gadget category with the specified name (in the specified 
locale). If a category already
+     * exists with the same name in the same locale, it is still created
+     * @param name Name of the category to create
+     * @param locale Locale of the provided name
+     * @param headers
+     * @return <ul>
+     *         <li>200 (OK) : The gadget category was created and returned 
successfully.</li>
+     *         <li>400 (BAD REQUEST) : Invalid input, for example a 
non-existing locale.</li>
+     *         <li>401 (UNAUTHORIZED) : The user is not authenticated or not 
authorized to create gadget categories.</li>
+     *         </ul>
+     */
+    @POST
+    @Consumes({MediaType.APPLICATION_FORM_URLENCODED})
+    @Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON})
+    @OutputTypeHint(value = Category.class, method = "getExample")
+    public Response createCategory(@FormParam("name") final String name, 
@FormParam("locale") final String locale,
+        @Context final HttpServletRequest request, @Context final HttpHeaders 
headers) {
+       return null;
+    }
+    
+    /**
+     * Returns the specified gadget category.
+     * 
+     * @param categoryid The id of the category to retrieve.
+     * @param request The HTTP servlet request
+     * @param headers The HTTP servlet request headers
+     * @return <ul>
+     *         <li>200 (OK) : The gadget category was returned 
successfully.</li>
+     *         <li>400 (BAD REQUEST) : Invalid input, for example a 
non-existing locale.</li>
+     *         <li>401 (UNAUTHORIZED) : The user is not authenticated or not 
authorized to retrieve gadget categories.</li>
+     *         <li>404 (NOT FOUND) : The specified gadget category does not 
exist.</li>
+     *         </ul>
+     */
+    @GET
+    @Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON})
+    @OutputTypeHint(value = Category.class, method = "getExample")
+    @Path("/{categoryid}")
+    public Response getCategory(@PathParam("categoryid") final String 
categoryid, 
+        @Context final HttpServletRequest request, @Context final HttpHeaders 
headers) {
+       return null;
+    }
+    
+    /**
+     * Create or updates a category.
+     * <br/><i>FIXME: What to do when you want to post multiple names?</i>
+     *      
+     * @param categoryid The id of the category to create or update.
+     * @param name The name of the category
+     * @param locale The locale the of the posted name
+     * @param request
+     * @param headers
+     * @return <ul>
+     *         <li>200 (OK) : The gadget category was created or updated 
successfully.</li>
+     *         <li>401 (UNAUTHORIZED) : The user is not authenticated or not 
authorized to create or update gadget categories.</li>
+     *         </ul>
+     */
+    @PUT
+    @Consumes({MediaType.APPLICATION_FORM_URLENCODED})
+    @Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON})
+    @OutputTypeHint(value = Category.class, method = "getExample")
+    @Path("/{categoryid}")
+    public Response setCategory(@PathParam("categoryid") final String 
categoryid, @FormParam("name") final String name, 
+        @FormParam("locale") final String locale, @Context final 
HttpServletRequest request, @Context final HttpHeaders headers) {
+       return null;
+    }
+    
+    /**
+     * Deletes the specified category
+     * @param categoryid The id of the category to delete.
+     * @param request
+     * @param headers
+     * @return <ul>
+     *         <li>200 (OK) : The gadget category was created or updated 
successfully.</li>
+     *         <li>401 (UNAUTHORIZED) : The user is not authenticated or not 
authorized to delete gadget categories.</li>
+     *         <li>404 (NOT FOUND) : The specified gadget category does not 
exist.</li>
+     *         </ul>
+     */
+    @DELETE
+    @Path("/{categoryid}")
+    public Response deleteCategory(@PathParam("categoryid") final String 
categoryid, 
+        @Context final HttpServletRequest request, @Context final HttpHeaders 
headers) {
+       return null;
+    }
+}

Added: 
trunk/amdatu-opensocial/opensocial-gadgetmanagement/src/main/java/org/amdatu/opensocial/gadgetmanagement/rest/GadgetRESTServiceImpl.java
==============================================================================
--- (empty file)
+++ 
trunk/amdatu-opensocial/opensocial-gadgetmanagement/src/main/java/org/amdatu/opensocial/gadgetmanagement/rest/GadgetRESTServiceImpl.java
    Mon Apr  2 12:28:33 2012
@@ -0,0 +1,207 @@
+/*
+ * Copyright (c) 2010, 2011 The Amdatu Foundation
+ *
+ * Licensed 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.amdatu.opensocial.gadgetmanagement.rest;
+
+import org.amdatu.opensocial.gadgetmanagement.GadgetDefinition;
+import org.amdatu.opensocial.gadgetmanagement.bean.dashboard.Definition;
+import org.amdatu.opensocial.gadgetmanagement.bean.gadget.Gadgets;
+import org.amdatu.opensocial.rest.tools.annotation.InputTypeHint;
+import org.amdatu.opensocial.rest.tools.annotation.OutputTypeHint;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.ws.rs.Consumes;
+import javax.ws.rs.DELETE;
+import javax.ws.rs.FormParam;
+import javax.ws.rs.GET;
+import javax.ws.rs.POST;
+import javax.ws.rs.PUT;
+import javax.ws.rs.Path;
+import javax.ws.rs.PathParam;
+import javax.ws.rs.Produces;
+import javax.ws.rs.QueryParam;
+import javax.ws.rs.core.Context;
+import javax.ws.rs.core.HttpHeaders;
+import javax.ws.rs.core.MediaType;
+import javax.ws.rs.core.Response;
+
+/**
+ * TODO: This class for now only defines the properties of the new REST API, 
but it is not implemented yet.
+ * 
+ * @author <a href="mailto:[email protected]";>Amdatu Project 
Team</a>
+ */
+@Path("gadgets")
+public class GadgetRESTServiceImpl extends BaseRESTServiceImpl {
+
+    /**
+     * Returns a (paged) collection of gadgets. Several filter options are 
available, see query parameters.
+     * 
+     * @optparam category Retrieves only the gadgets in the specified category 
(value is the id of the category).
+     *           Multiple categories can be provided in which case gadgets are 
returned in any of these categories.
+     * @optparam count Determines the amount of results returned on a single 
page. If no parameter is specified all
+     *           gadgets are returned on one page.
+     * @optparam startIndex The first index
+     *           <br><i>FIXME: Is this the index of the page or item???</i>
+     * @optparam sortBy Sorts the returned gadgets on the specified field value
+     * @optparam sortOrder Can either be "ascending" or "descending", defaults 
to ascending. Used to sort objects in a
+     *           collection. Only valid when a sortBy parameter is provided.
+     * @param request
+     * @param headers
+     * @return <ul>
+     *         <li>200 (OK) : The gadgets were returned successfully.</li>
+     *         <li>400 (BAD REQUEST) : Invalid query parameters, for example a 
non-existing sortBy field.</li>
+     *         <li>401 (UNAUTHORIZED) : The user is not authenticated or not 
authorized to retrieve gadgets.</li>
+     *         </ul>
+     */
+    @GET
+    @Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON})
+    @OutputTypeHint(value = Gadgets.class, method = "getExample")
+    public Response getGadgets(
+        @QueryParam("category") final String[] category,
+        @QueryParam("count") final int count,
+        @QueryParam("startIndex") final int startIndex,
+        @QueryParam("sortBy") final int sortBy,
+        @QueryParam("sortOrder") final int sortOrder,
+        @Context final HttpServletRequest request,
+        @Context final HttpHeaders headers) {
+        return null;
+    }
+
+    /**
+     * Adds a gadget.
+     * 
+     * @param url The url of the gadget specification XML
+     * @optparam category The id of the category to append the gadget to. 
Multiple categories may be provided.
+     * @optparam expand If no expand parameter is provided, the gadget is 
returned
+     *           without retrieving the metadata from the gadget 
specification. The expand query parameter is a
+     *           multi-value querystring parameter, representing the elements 
that should be expanded. Available
+     *           expressions:
+     *           <ul>
+     *           <li>gadget.metadata - The metadata defined in the gadget 
specification (i.e. title, author and
+     *           screenshot)</li>
+     *           <li>gadget.userPreferences - The UserPreferences defined for 
the gadget specification</li>
+     *           </ul>
+     *           Example: ?expand=gadget.metadata&expand=gadget.userPreferences
+     * @return <ul>
+     *         <li>200 (OK) : The gadget was created successfully.</li>
+     *         <li>400 (BAD REQUEST) : Invalid form parameters, for example a 
non-existing category.</li>
+     *         <li>401 (UNAUTHORIZED) : The user is not authenticated or not 
authorized to create gadgets.</li>
+     *         </ul>
+     */
+    @POST
+    @Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON})
+    @OutputTypeHint(value = Definition.class, method = "getExample")
+    public Response createGadget(
+        @FormParam("url") final String url,
+        @FormParam("category") final String category,
+        @QueryParam("expand") final String[] expand,
+        @Context final HttpServletRequest request,
+        @Context final HttpHeaders headers) {
+        return null;
+    }
+
+    /**
+     * Returns a single gadget.
+     * 
+     * @param gadgetid The id of the gadget to retrieve.
+     * @optparam expand If no expand parameter is provided, the gadget is 
returned
+     *           without retrieving the metadata from the gadget 
specification. The expand query parameter is a
+     *           multi-value querystring parameter, representing the elements 
that should be expanded. Available
+     *           expressions:
+     *           <ul>
+     *           <li>gadget.metadata - The metadata defined in the gadget 
specification (i.e. title, author and
+     *           screenshot)</li>
+     *           <li>gadget.userPreferences - The UserPreferences defined for 
the gadget specification</li>
+     *           </ul>
+     *           Example: ?expand=gadget.metadata&expand=gadget.userPreferences
+     * @return <ul>
+     *         <li>200 (OK) : The gadget was returned successfully.</li>
+     *         <li>401 (UNAUTHORIZED) : The user is not authenticated or not 
authorized to retrieve gadgets.</li>
+     *         <li>404 (NOT FOUND) : The gadget with the specified id does not 
exist.</li>
+     *         </ul>
+     */
+    @GET
+    @Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON})
+    @OutputTypeHint(value = Definition.class, method = 
"getExampleWithMetadata")
+    @Path("/{gadgetid}")
+    public Response getGadget(
+        @PathParam("gadgetid") final String gadgetid,
+        @QueryParam("expand") final String[] expand,
+        @Context final HttpServletRequest request,
+        @Context final HttpHeaders headers) {
+        return null;
+    }
+
+    /**
+     * Create or updates a gadget.
+     * 
+     * @param gadgetid The id of the gadget to create or update.
+     * @param url The url of the gadget specification XML
+     * @optparam category The id of the category to append the gadget to. 
Multiple categories may be provided.
+     * @optparam expand If no expand parameter is provided, the gadget is 
returned
+     *           without retrieving the metadata from the gadget 
specification. The expand query parameter is a
+     *           multi-value querystring parameter, representing the elements 
that should be expanded. Available
+     *           expressions:
+     *           <ul>
+     *           <li>gadget.metadata - The metadata defined in the gadget 
specification (i.e. title, author and
+     *           screenshot)</li>
+     *           <li>gadget.userPreferences - The UserPreferences defined for 
the gadget specification</li>
+     *           </ul>
+     *           Example: ?expand=gadget.metadata&expand=gadget.userPreferences
+     * @return <ul>
+     *         <li>200 (OK) : The gadget was created or updated 
successfully.</li>
+     *         <li>400 (BAD REQUEST) : Invalid form parameters, for example a 
non-existing category.</li>
+     *         <li>401 (UNAUTHORIZED) : The user is not authenticated or not 
authorized to create or update
+     *         gadgets.</li>
+     *         <li>404 (NOT FOUND) : The gadget with the specified id does not 
exist.</li>
+     *         </ul>
+     */
+    @PUT
+    @Consumes({MediaType.APPLICATION_FORM_URLENCODED})
+    @InputTypeHint(value = GadgetDefinition.class, method = "getExample")
+    @Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON})
+    @OutputTypeHint(value = Definition.class, method = 
"getExampleWithMetadata")
+    @Path("/{gadgetid}")
+    public Response setGadget(
+        @PathParam("gadgetid") final String gadgetid,
+        @FormParam("url") final String url,
+        @FormParam("category") final String category,
+        @QueryParam("expand") final String[] expand,
+        @Context final HttpServletRequest request,
+        @Context final HttpHeaders headers) {
+        return null;
+    }
+
+    /**
+     * Deletes the specified gadget.
+     * 
+     * @param gadgetid The id of the gadget to remove.
+     * @param request
+     * @param headers
+     * @return <ul>
+     *         <li>200 (OK) : The gadget was deleted successfully.</li>
+     *         <li>401 (UNAUTHORIZED) : The user is not authenticated or not 
authorized to delete gadgets.</li>
+     *         <li>404 (NOT FOUND) : The gadget with the specified id does not 
exist.</li>
+     *         </ul>
+     */
+    @DELETE
+    @Path("/{gadgetid}")
+    public Response deleteGadget(
+        @PathParam("gadgetid") final String gadgetid,
+        @Context final HttpServletRequest request,
+        @Context final HttpHeaders headers) {
+        return null;
+    }
+}
_______________________________________________
Amdatu-commits mailing list
[email protected]
http://lists.amdatu.org/mailman/listinfo/amdatu-commits

Reply via email to