package eu.stratuslab.storage.disk.main;

import java.io.File;
import java.util.logging.Logger;

import org.restlet.Application;
import org.restlet.Restlet;
import org.restlet.resource.Directory;
import org.restlet.routing.Router;

import eu.stratuslab.storage.disk.resources.DiskResource;
import eu.stratuslab.storage.disk.resources.DisksResource;
import eu.stratuslab.storage.disk.resources.ForceTrailingSlashResource;
import eu.stratuslab.storage.disk.resources.UploadResource;

public class PersistentDiskApplication extends Application {

    protected Logger logger = getLogger();

    public static final File diskStore = new File("/tmp/diskstore");

    public PersistentDiskApplication() {

        setName("StratusLab Persistent Disk Server");
        setDescription("StratusLab server for persistent disk storage.");
        setOwner("StratusLab");
        setAuthor("Charles Loomis");

        getTunnelService().setUserAgentTunnel(true);

    }

    @Override
    public Restlet createInboundRoot() {

        // Create a router Restlet that defines routes.
        Router router = new Router(getContext());

        Directory indexDir = new Directory(getContext(), "war:///");
        indexDir.setNegotiatingContent(false);
        indexDir.setIndexName("index.html");

        router.attach("/disks/{uuid}", ForceTrailingSlashResource.class);
        router.attach("/disks/{uuid}/", DiskResource.class);

        router.attach("/disks", ForceTrailingSlashResource.class);
        router.attach("/disks/", DisksResource.class);

        // Defines a route for the upload form
        router.attach("/upload", ForceTrailingSlashResource.class);
        router.attach("/upload/", UploadResource.class);

        router.attach("/", indexDir);

        return router;
    }

}

@@ -1012,64 +1012,8 @@
  %7B%0A%0A
-        // Create a router Restlet that defines routes.%0A
     
@@ -1257,37 +1257,24 @@
 s/%7Buuid%7D
+/
 %22, 
-ForceTrailingSlash
+Disk
 Resource
@@ -1314,32 +1314,45 @@
 disks/%7Buuid%7D
-/
 %22, 
-Disk
+ForceTrailingSlash
 Resource.cla
@@ -1386,37 +1386,25 @@
 (%22/disks
+/
 %22, 
-ForceTrailingSlash
+Disks
 Resource
@@ -1437,33 +1437,45 @@
 tach(%22/disks
-/
 %22, 
-Disks
+ForceTrailingSlash
 Resource.cla
@@ -1557,37 +1557,26 @@
 %22/upload
+/
 %22, 
-ForceTrailingSlash
+Upload
 Resource
@@ -1610,34 +1610,45 @@
 ach(%22/upload
-/
 %22, 
-Upload
+ForceTrailingSlash
 Resource.cla

change ordering of template matching