def get(self):
     '''
     @summary: deals with GET request (getting a JSON HAL of resources)
     '''
     resources = Resource(self.reverse_url("resources"))
     resources_names = LOCK_MANAGER_INSTANCE.get_resources_names()
     for resource_name in resources_names:
         tmp = LOCK_MANAGER_INSTANCE.get_resource_as_dict(resource_name)
         resource = Resource(self.reverse_url("resource", tmp['name']), {"name": tmp['name']})
         resources.add_embedded_resource("resources", resource)
     self.set_header("Content-Type", "application/hal+json")
     self.finish(resources.to_json())
 def get(self, name):
     '''
     @summary: deals with GET request (getting a JSON HAL of the resource)
     @param name: name of the resource
     '''
     tmp = LOCK_MANAGER_INSTANCE.get_resource_as_dict(name)
     resource = Resource(self.reverse_url("resource", name), {"name": name})
     if tmp:
         for lock_dict in tmp['locks']:
             lock = Resource(self.reverse_url("lock", name, lock_dict['uid']), lock_dict)
             resource.add_embedded_resource("locks", lock)
     self.set_header("Content-Type", "application/hal+json")
     self.finish(resource.to_json())
 def get(self, name):
     '''
     @summary: deals with GET request (getting a JSON HAL of the resource)
     @param name: name of the resource
     '''
     tmp = LOCK_MANAGER_INSTANCE.get_resource_as_dict(name)
     resource = Resource(self.reverse_url("resource", name), {"name": name})
     if tmp:
         for lock_dict in tmp['locks']:
             lock = Resource(
                 self.reverse_url("lock", name, lock_dict['uid']),
                 lock_dict)
             resource.add_embedded_resource("locks", lock)
     self.set_header("Content-Type", "application/hal+json")
     self.finish(resource.to_json())
 def get(self, name, uid):
     '''
     @summary: deals with GET request
     @param name: name of the resource
     @param uid: uid of the lock
     '''
     lock = LOCK_MANAGER_INSTANCE.get_lock(name, uid)
     if lock:
         self.set_header('Content-Type', 'application/hal+json')
         hal_lock = Resource(href=self.reverse_url("lock", name, lock.uid),
                             properties=lock.to_dict())
         hal_resource_link = Link(href=self.reverse_url("resource", name))
         hal_lock.add_link(rel="resource", link=hal_resource_link, multiple=False)
         self.write(hal_lock.to_json())
     else:
         self.send_error(status_code=404, message="lock not found")
         return
 def get(self, name, uid):
     '''
     @summary: deals with GET request
     @param name: name of the resource
     @param uid: uid of the lock
     '''
     lock = LOCK_MANAGER_INSTANCE.get_lock(name, uid)
     if lock:
         self.set_header('Content-Type', 'application/hal+json')
         hal_lock = Resource(href=self.reverse_url("lock", name, lock.uid),
                             properties=lock.to_dict())
         hal_resource_link = Link(href=self.reverse_url("resource", name))
         hal_lock.add_link(rel="resource",
                           link=hal_resource_link,
                           multiple=False)
         self.write(hal_lock.to_json())
     else:
         self.send_error(status_code=404, message="lock not found")
         return