Class AdminImpl

java.lang.Object
uk.ac.manchester.spinnaker.alloc.admin.AdminImpl
All Implemented Interfaces:
AdminAPI

@Service("admin")
@Path("spalloc/admin")
@ManagedResource("Spalloc:type=Admin,name=admin")
public class AdminImpl
extends Object
implements AdminAPI
Implements the service administration interface.
Author:
Donal Fellows
  • Constructor Details

  • Method Details

    • importMachinesByContent

      public void importMachinesByContent​(MachineDefinitionLoader.Configuration definitions)
      Description copied from interface: AdminAPI
      Import a machine definition by posting it.
      Specified by:
      importMachinesByContent in interface AdminAPI
      Parameters:
      definitions - The definitions.
    • getBoardStateXYZ

      public boolean getBoardStateXYZ​(String name, int x, int y, int z)
      Description copied from interface: AdminAPI
      Find board by logical triad coordinates and return its state.
      Specified by:
      getBoardStateXYZ in interface AdminAPI
      Parameters:
      name - The name of the machine
      x - The X coordinate
      y - The Y coordinate
      z - The Z coordinate
      Returns:
      Whether the board is enabled
    • setBoardStateXYZ

      @ManagedOperation public boolean setBoardStateXYZ​(String name, int x, int y, int z, boolean enabled)
      Description copied from interface: AdminAPI
      Enable or disable a board. Find by logical triad coordinates.
      Specified by:
      setBoardStateXYZ in interface AdminAPI
      Parameters:
      name - The name of the machine
      x - The X coordinate
      y - The Y coordinate
      z - The Z coordinate
      enabled - Whether the board should be set to the enabled state
      Returns:
      Whether the board is enabled
    • getBoardStateCFB

      public boolean getBoardStateCFB​(String name, int c, int f, int b)
      Description copied from interface: AdminAPI
      Find board by physical coordinates and return its state.
      Specified by:
      getBoardStateCFB in interface AdminAPI
      Parameters:
      name - The name of the machine
      c - The cabinet number
      f - The frame number
      b - The board number
      Returns:
      Whether the board is enabled
    • setBoardStateCFB

      @ManagedOperation public boolean setBoardStateCFB​(String name, int c, int f, int b, boolean enabled)
      Description copied from interface: AdminAPI
      Enable or disable a board. Find by physical coordinates.
      Specified by:
      setBoardStateCFB in interface AdminAPI
      Parameters:
      name - The name of the machine
      c - The cabinet number
      f - The frame number
      b - The board number
      enabled - Whether the board should be set to the enabled state
      Returns:
      Whether the board is enabled
    • getBoardStateAddress

      public boolean getBoardStateAddress​(String name, String address)
      Description copied from interface: AdminAPI
      Find board by IP address and return its state.
      Specified by:
      getBoardStateAddress in interface AdminAPI
      Parameters:
      name - The name of the machine
      address - The IP address of the board (dotted quad)
      Returns:
      Whether the board is enabled
    • setBoardStateAddress

      @ManagedOperation public boolean setBoardStateAddress​(String name, String address, boolean enabled)
      Description copied from interface: AdminAPI
      Enable or disable a board. Find by IP address.
      Specified by:
      setBoardStateAddress in interface AdminAPI
      Parameters:
      name - The name of the machine
      address - The IP address of the board (dotted quad)
      enabled - Whether the board should be set to the enabled state
      Returns:
      Whether the board is enabled
    • listUsers

      public Map<String,​URI> listUsers​(UriInfo ui)
      Description copied from interface: AdminAPI
      List the usernames and the URIs used to describe and manipulate them.
      Specified by:
      listUsers in interface AdminAPI
      Parameters:
      ui - For building URIs.
      Returns:
      A sorted map from username to details-handling URI
    • createUser

      public Response createUser​(UserRecord providedUser, UriInfo ui)
      Description copied from interface: AdminAPI
      Create a new user.
      Specified by:
      createUser in interface AdminAPI
      Parameters:
      providedUser - Description of user to create. Username must be unique.
      ui - For building URIs.
      Returns:
      REST response (CREATED on success)
    • describeUser

      public UserRecord describeUser​(int id, UriInfo ui)
      Description copied from interface: AdminAPI
      Read a particular user's details.
      Specified by:
      describeUser in interface AdminAPI
      Parameters:
      id - The ID of the user
      ui - For building URIs.
      Returns:
      Description of the user.
    • updateUser

      public UserRecord updateUser​(int id, UserRecord providedUser, UriInfo ui, SecurityContext security)
      Description copied from interface: AdminAPI
      Update a particular user's details.
      Specified by:
      updateUser in interface AdminAPI
      Parameters:
      id - The ID of the user
      providedUser - What to set the details to. null fields are ignored.
      ui - For building URIs.
      security - Used to check who the current user actually is.
      Returns:
      The updated user details.
    • deleteUser

      public String deleteUser​(int id, SecurityContext security)
      Description copied from interface: AdminAPI
      Delete a user.
      Specified by:
      deleteUser in interface AdminAPI
      Parameters:
      id - The ID of the user
      security - Used to check who the current user actually is.
      Returns:
      Description of what user was deleted.
    • listGroups

      public Map<String,​URI> listGroups​(UriInfo ui)
      Description copied from interface: AdminAPI
      List the groups and the URIs used to describe and manipulate them.
      Specified by:
      listGroups in interface AdminAPI
      Parameters:
      ui - For building URIs.
      Returns:
      A sorted map from group name to details-handling URI
    • createGroup

      public Response createGroup​(GroupRecord group, UriInfo ui)
      Description copied from interface: AdminAPI
      Create a new group.
      Specified by:
      createGroup in interface AdminAPI
      Parameters:
      group - Description of group to create. Group name must be unique.
      ui - For building URIs.
      Returns:
      REST response (CREATED on success)
    • describeGroup

      public GroupRecord describeGroup​(int groupId, UriInfo ui)
      Description copied from interface: AdminAPI
      Read a particular group's details.
      Specified by:
      describeGroup in interface AdminAPI
      Parameters:
      groupId - The ID of the group
      ui - For building URIs.
      Returns:
      Description of the group.
    • updateGroup

      public GroupRecord updateGroup​(int groupId, GroupRecord group, UriInfo ui)
      Description copied from interface: AdminAPI
      Update a particular group's details. This particularly includes the name and the quota, but excludes the memberships; those are separate resources.
      Specified by:
      updateGroup in interface AdminAPI
      Parameters:
      groupId - The ID of the group
      group - The description of the group to update to be like.
      ui - For building URIs.
      Returns:
      Description of the group.
    • deleteGroup

      public String deleteGroup​(int groupId)
      Description copied from interface: AdminAPI
      Delete a group.
      Specified by:
      deleteGroup in interface AdminAPI
      Parameters:
      groupId - The ID of the group
      Returns:
      Description of what group was deleted
    • addMember

      public Response addMember​(int groupId, MemberRecord request, UriInfo ui)
      Description copied from interface: AdminAPI
      Add a user to a group.
      Specified by:
      addMember in interface AdminAPI
      Parameters:
      groupId - Which group to add to.
      request - Description of user to add. User name must be present.
      ui - For building URIs.
      Returns:
      REST response (CREATED on success)
    • describeMember

      public MemberRecord describeMember​(int groupId, int memberId, UriInfo ui)
      Description copied from interface: AdminAPI
      Read a particular group's details.
      Specified by:
      describeMember in interface AdminAPI
      Parameters:
      groupId - The ID of the group
      memberId - The ID of the membership.
      ui - For building URIs.
      Returns:
      Description of the membership.
    • removeMember

      public Response removeMember​(int groupId, int memberId)
      Description copied from interface: AdminAPI
      Delete a membership of a group.
      Specified by:
      removeMember in interface AdminAPI
      Parameters:
      groupId - The ID of the group
      memberId - The ID of the membership
      Returns:
      REST response