Class LockableResourcesRootAction

java.lang.Object
org.jenkins.plugins.lockableresources.actions.LockableResourcesRootAction
All Implemented Interfaces:
ExtensionPoint, Action, ModelObject, RootAction

@Extension @ExportedBean public class LockableResourcesRootAction extends Object implements RootAction
  • Field Details

    • PERMISSIONS_GROUP

      public static final PermissionGroup PERMISSIONS_GROUP
    • UNLOCK

      public static final Permission UNLOCK
    • RESERVE

      public static final Permission RESERVE
    • STEAL

      public static final Permission STEAL
    • VIEW

      public static final Permission VIEW
    • QUEUE

      public static final Permission QUEUE
    • CONFIGURE

      public static final Permission CONFIGURE
    • REMOTE

      public static final Permission REMOTE
      Gates the remote lock REST API (/lockable-resources/remote/v1/). Grant this to the machine users whose API tokens remote client controllers use as credentialsId; this makes remote clients auditable in the authorization matrix instead of being implied by plain READ.
    • ICON

      public static final String ICON
      See Also:
  • Constructor Details

    • LockableResourcesRootAction

      public LockableResourcesRootAction()
  • Method Details

    • getIconFileName

      @CheckForNull public String getIconFileName()
      Specified by:
      getIconFileName in interface Action
    • getManagementLink

      @Restricted(org.kohsuke.accmod.restrictions.NoExternalUse.class) public LockableResourcesManagementLink getManagementLink()
      Returns the ManagementLink instance for use by the Jelly view when rendering within the Manage Jenkins layout. Used by index.jelly.
    • getApi

      public Api getApi()
    • getUserName

      @CheckForNull public String getUserName()
    • getDisplayName

      @CheckForNull public String getDisplayName()
      Specified by:
      getDisplayName in interface Action
      Specified by:
      getDisplayName in interface ModelObject
    • getUrlName

      public String getUrlName()
      Specified by:
      getUrlName in interface Action
    • getSummary

      @Restricted(org.kohsuke.accmod.restrictions.NoExternalUse.class) public LockableResourcesRootAction.Summary getSummary()
      Returns a summary of resource states for the overview tab.
    • getResources

      @Exported @Restricted(org.kohsuke.accmod.restrictions.NoExternalUse.class) public List<LockableResource> getResources()
      Get a list of resources
      Returns:
      All resources.
    • getLabelsList

      @Restricted(org.kohsuke.accmod.restrictions.NoExternalUse.class) public LinkedHashMap<String,LockableResourcesRootAction.LockableResourcesLabel> getLabelsList()
      Get a list of all labels
      Returns:
      All possible labels.
    • getResource

      @Restricted(org.kohsuke.accmod.restrictions.NoExternalUse.class) public LockableResource getResource(String resourceName)
    • getFreeResourceAmount

      @Restricted(org.kohsuke.accmod.restrictions.NoExternalUse.class) @Deprecated public int getFreeResourceAmount(String labelString)
      Deprecated.
      Get amount of free resources assigned to given *labelString*
      Parameters:
      labelString - Label to search.
      Returns:
      Amount of free labels.
    • getFreeResourcePercentage

      @Restricted(org.kohsuke.accmod.restrictions.NoExternalUse.class) @Deprecated public int getFreeResourcePercentage(String labelString)
      Deprecated.
      Get percentage (0-100) usage of resources assigned to given *labelString*

      Used by actions/LockableResourcesRootAction/index.jelly

      Parameters:
      labelString - Label to search.
      Returns:
      Percentage usages of *labelString* around all resources
      Since:
      2.19
    • getAllLabels

      @Restricted(org.kohsuke.accmod.restrictions.NoExternalUse.class) @Deprecated public Set<String> getAllLabels()
      Deprecated.
      Get all existing labels as list.
      Returns:
      All possible labels.
    • getNumberOfAllLabels

      @Restricted(org.kohsuke.accmod.restrictions.NoExternalUse.class) @Deprecated public int getNumberOfAllLabels()
      Deprecated.
      Get amount of all labels.
      Returns:
      Amount of all labels.
    • getAssignedResourceAmount

      @Restricted(org.kohsuke.accmod.restrictions.NoExternalUse.class) @Deprecated public int getAssignedResourceAmount(String labelString)
      Deprecated.
      Get amount of resources assigned to given *labelString*

      Used by actions/LockableResourcesRootAction/index.jelly

      Parameters:
      labelString - Label to search.
      Returns:
      Amount of assigned resources.
    • getRemoteLocks

      @Restricted(org.kohsuke.accmod.restrictions.NoExternalUse.class) public List<RemoteClientRegistry.Entry> getRemoteLocks()
      Remote locks this controller currently holds or waits for on other controllers.

      This is the client side of the picture: the resources listed elsewhere on this page belong to this controller, while these belong to someone else. The state shown here is what this controller last observed, not the remote's own record - the view says so.

    • isRemoteAcquiresPaused

      @Restricted(org.kohsuke.accmod.restrictions.NoExternalUse.class) public boolean isRemoteAcquiresPaused()
      True when this controller serves resources remotely but has stopped handing out new locks.

      Only interesting while the remote API is on: with it off, nothing is being served either way, and a banner about paused acquires would be noise.

    • isDelegatedMode

      @Restricted(org.kohsuke.accmod.restrictions.NoExternalUse.class) public boolean isDelegatedMode()
      True when this controller delegates every lock() to one remote server.
    • getDelegatedCatalog

      @CheckForNull @Restricted(org.kohsuke.accmod.restrictions.NoExternalUse.class) public RemoteCatalog getDelegatedCatalog()
      What the delegated target publishes, as last observed, or null when nothing has been fetched yet. Never blocks: a stale snapshot is refreshed in the background.
    • isServerDisabled

      @Restricted(org.kohsuke.accmod.restrictions.NoExternalUse.class) public boolean isServerDisabled(String serverId)
      True when a connection exists for this serverId but has been switched off.
    • getElapsedSince

      @Restricted(org.kohsuke.accmod.restrictions.NoExternalUse.class) public String getElapsedSince(long timestampMillis)
      Human-readable age of a timestamp, for the remote view.
    • isRemoteConfigured

      @Restricted(org.kohsuke.accmod.restrictions.NoExternalUse.class) public boolean isRemoteConfigured()
      True when this controller has any remote relation at all - server side or client side.
    • getForcedServerId

      @Restricted(org.kohsuke.accmod.restrictions.NoExternalUse.class) public String getForcedServerId()
      The serverId every lock() on this controller is routed to, or empty when not delegating.
    • getForcedServerUrl

      @Restricted(org.kohsuke.accmod.restrictions.NoExternalUse.class) public String getForcedServerUrl()
      Base URL of the delegated target, for the badge; empty when not delegating or unknown.
    • getQueue

      @Restricted(org.kohsuke.accmod.restrictions.NoExternalUse.class) public LockableResourcesRootAction.Queue getQueue() throws Descriptor.FormException
      Throws:
      Descriptor.FormException
    • getCurrentQueuedContext

      @Restricted(org.kohsuke.accmod.restrictions.NoExternalUse.class) @Deprecated public List<QueuedContextStruct> getCurrentQueuedContext()
      Deprecated.
      Returns current queue
    • getOldestQueue

      @Restricted(org.kohsuke.accmod.restrictions.NoExternalUse.class) @CheckForNull @Deprecated public LockableResourcesStruct getOldestQueue()
      Deprecated.
      Returns current queue
    • doUnlock

      public void doUnlock(org.kohsuke.stapler.StaplerRequest2 req, org.kohsuke.stapler.StaplerResponse2 rsp) throws IOException, jakarta.servlet.ServletException
      Throws:
      IOException
      jakarta.servlet.ServletException
    • doReleaseRemoteLock

      public void doReleaseRemoteLock(org.kohsuke.stapler.StaplerRequest2 req, org.kohsuke.stapler.StaplerResponse2 rsp) throws IOException, jakarta.servlet.ServletException
      Force-releases a resource that is held by a remote lock (e.g. STALE lock with no active client). Called by the "Force Release Remote Lock" button in the resource table.
      Throws:
      IOException
      jakarta.servlet.ServletException
    • doReserve

      public void doReserve(org.kohsuke.stapler.StaplerRequest2 req, org.kohsuke.stapler.StaplerResponse2 rsp) throws IOException, jakarta.servlet.ServletException
      Throws:
      IOException
      jakarta.servlet.ServletException
    • doSteal

      public void doSteal(org.kohsuke.stapler.StaplerRequest2 req, org.kohsuke.stapler.StaplerResponse2 rsp) throws IOException, jakarta.servlet.ServletException
      Throws:
      IOException
      jakarta.servlet.ServletException
    • doReassign

      public void doReassign(org.kohsuke.stapler.StaplerRequest2 req, org.kohsuke.stapler.StaplerResponse2 rsp) throws IOException, jakarta.servlet.ServletException
      Throws:
      IOException
      jakarta.servlet.ServletException
    • doUnreserve

      public void doUnreserve(org.kohsuke.stapler.StaplerRequest2 req, org.kohsuke.stapler.StaplerResponse2 rsp) throws IOException, jakarta.servlet.ServletException
      Throws:
      IOException
      jakarta.servlet.ServletException
    • doReset

      public void doReset(org.kohsuke.stapler.StaplerRequest2 req, org.kohsuke.stapler.StaplerResponse2 rsp) throws IOException, jakarta.servlet.ServletException
      Throws:
      IOException
      jakarta.servlet.ServletException
    • doRecycleDeadLocks

      public void doRecycleDeadLocks(org.kohsuke.stapler.StaplerRequest2 req, org.kohsuke.stapler.StaplerResponse2 rsp) throws IOException, jakarta.servlet.ServletException
      Throws:
      IOException
      jakarta.servlet.ServletException
    • doSaveNote

      public void doSaveNote(org.kohsuke.stapler.StaplerRequest2 req, org.kohsuke.stapler.StaplerResponse2 rsp) throws IOException, jakarta.servlet.ServletException
      Throws:
      IOException
      jakarta.servlet.ServletException
    • doGetResourcesByLabelExpression

      @Restricted(org.kohsuke.accmod.restrictions.NoExternalUse.class) @GET public void doGetResourcesByLabelExpression(org.kohsuke.stapler.StaplerRequest2 req, org.kohsuke.stapler.StaplerResponse2 rsp) throws IOException
      Returns resource names matching a Jenkins label expression as JSON.
      Throws:
      IOException
    • doChangeQueueOrder

      @Restricted(org.kohsuke.accmod.restrictions.NoExternalUse.class) public void doChangeQueueOrder(org.kohsuke.stapler.StaplerRequest2 req, org.kohsuke.stapler.StaplerResponse2 rsp) throws IOException, jakarta.servlet.ServletException
      Change queue order (item position)
      Throws:
      IOException
      jakarta.servlet.ServletException
    • doGetQueuePage

      @Restricted(org.kohsuke.accmod.restrictions.NoExternalUse.class) public void doGetQueuePage(org.kohsuke.stapler.StaplerRequest2 req, org.kohsuke.stapler.StaplerResponse2 rsp) throws IOException, jakarta.servlet.ServletException
      Returns a page of queue items as JSON for server-side pagination.
      Throws:
      IOException
      jakarta.servlet.ServletException
    • doCreateResource

      @Restricted(org.kohsuke.accmod.restrictions.NoExternalUse.class) public void doCreateResource(org.kohsuke.stapler.StaplerRequest2 req, org.kohsuke.stapler.StaplerResponse2 rsp) throws IOException, jakarta.servlet.ServletException
      Create a new lockable resource from the management page.
      Throws:
      IOException
      jakarta.servlet.ServletException
    • doEditResource

      @Restricted(org.kohsuke.accmod.restrictions.NoExternalUse.class) public void doEditResource(org.kohsuke.stapler.StaplerRequest2 req, org.kohsuke.stapler.StaplerResponse2 rsp) throws IOException, jakarta.servlet.ServletException
      Edit an existing lockable resource from the management page.
      Throws:
      IOException
      jakarta.servlet.ServletException
    • doDeleteResource

      @Restricted(org.kohsuke.accmod.restrictions.NoExternalUse.class) public void doDeleteResource(org.kohsuke.stapler.StaplerRequest2 req, org.kohsuke.stapler.StaplerResponse2 rsp) throws IOException, jakarta.servlet.ServletException
      Delete a lockable resource from the management page.
      Throws:
      IOException
      jakarta.servlet.ServletException
    • getDynamic

      public Object getDynamic(String token)
      Routes /lockable-resources/remote/* to the remote lock API.