001    package org.hackystat.sensorbase.resource.registration;
002    
003    import org.hackystat.sensorbase.resource.sensorbase.SensorBaseResource;
004    import org.restlet.Context;
005    import org.restlet.data.MediaType;
006    import org.restlet.data.Request;
007    import org.restlet.data.Response;
008    import org.restlet.resource.Representation;
009    import org.restlet.resource.StringRepresentation;
010    import org.restlet.resource.Variant;
011    
012    /**
013     * Provides a home page for this SensorBase.
014     * Implements a simple web page for display when traversing to the sensorbase URL in a browser.
015     * @author Philip Johnson
016     *
017     */
018    public class HomePageResource extends SensorBaseResource {
019      
020      /**
021       * The standard constructor.
022       * @param context The context.
023       * @param request The request object.
024       * @param response The response object.
025       */
026      public HomePageResource(Context context, Request request, Response response) {
027        super(context, request, response);
028      }
029      
030      /**
031       * Returns a page providing home page info.
032       * This requires no authorization.
033       * @param variant The representational variant requested.
034       * @return The representation. 
035       */
036      @Override
037      public Representation represent(Variant variant) {
038        String pageHtml = 
039          "<html>" +
040          "  <body>" +
041          "Welcome to the Hackystat SensorBase!" +
042          "<p>Note that this service does not provide any user interface facilities.  " +
043          "<p>You will want to use a service such as ProjectViewer, SensorDataBrowser, " +
044          "TelemetryViewer, or something similar to view and manipulate your data. " +
045          "<p>Contact your Hackystat administrator or the Hackystat user group for details " +
046          "on how to do this." +
047          "</body> </html>";
048        Representation representation = new StringRepresentation(pageHtml);
049        representation.setMediaType(MediaType.TEXT_HTML);
050        return representation;
051      }
052    }