Package org.apache.sling.distribution.queue.impl.resource

## Class ResourceQueue

- java.lang.Object
- - org.apache.sling.distribution.queue.impl.resource.ResourceQueue

All Implemented Interfaces:
  `DistributionQueue`

Direct Known Subclasses:
  `ActiveResourceQueue`

    public class ResourceQueue
    extends Object
    implements DistributionQueue

### Field Summary

Fields
`protected String` `queueName`
`protected String` `queueRootPath`
`protected org.apache.sling.api.resource.ResourceResolverFactory` `resolverFactory`
`protected String` `serviceName`

### Constructor Summary

Constructors
`ResourceQueue​(org.apache.sling.api.resource.ResourceResolverFactory resolverFactory, String serviceName, String queueName, String rootPath)`

### Method Summary

All Methods Instance Methods Concrete Methods
`@Nullable DistributionQueueEntry` `add​(@NotNull DistributionQueueItem item)` add a distribution item to this queue
`@NotNull Iterable<DistributionQueueEntry>` `clear​(int limit)` Clear a range of entries from the queue.
`@NotNull Iterable<DistributionQueueEntry>` `getEntries​(int skip, int limit)` get all the entries in the queue
`@Nullable DistributionQueueEntry` `getEntry​(@NotNull String itemId)` gets an entry from the queue by specifying its id
`DistributionQueueEntry` `getHead()` get the first entry (in a FIFO strategy, the next to be processed) from the queue
`@NotNull String` `getName()` get this queue name
`@NotNull DistributionQueueStatus` `getStatus()` get the status of the queue
`@NotNull DistributionQueueType` `getType()` get the type of this queue
`boolean` `hasCapability​(@NotNull String capability)`
`@Nullable DistributionQueueEntry` `remove​(@NotNull String itemId)` remove an entry from the queue by specifying its id
`@NotNull Iterable<DistributionQueueEntry>` `remove​(@NotNull Set<String> entryIds)` Remove a set entries from the queue by specifying their identifiers.

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### Field Detail

#### resolverFactory

    protected final org.apache.sling.api.resource.ResourceResolverFactory resolverFactory

#### queueRootPath

    protected final String queueRootPath

#### serviceName

    protected String serviceName

#### queueName

    protected String queueName

### Constructor Detail

#### ResourceQueue

    public ResourceQueue​(org.apache.sling.api.resource.ResourceResolverFactory resolverFactory,
                         String serviceName,
                         String queueName,
                         String rootPath)

### Method Detail

#### getName

    @NotNull
    public @NotNull String getName()

Description copied from interface: `DistributionQueue`
get this queue name

Specified by:
  `getName` in interface `DistributionQueue`
Returns:
  the queue name

#### add

    @Nullable
    public @Nullable DistributionQueueEntry add​(@NotNull
                                                @NotNull DistributionQueueItem item)

Description copied from interface: `DistributionQueue`
add a distribution item to this queue

Specified by:
  `add` in interface `DistributionQueue`
Parameters:
  `item` - a distribution item, typically representing a `DistributionPackage` to distribute
Returns:
  the queue entry created for this item or `noll` if none is created

#### getHead

    public DistributionQueueEntry getHead()

Description copied from interface: `DistributionQueue`
get the first entry (in a FIFO strategy, the next to be processed) from the queue

Specified by:
  `getHead` in interface `DistributionQueue`
Returns:
  the first entry into the queue or `null` if the queue is empty

#### getEntries

    @NotNull
    public @NotNull Iterable<DistributionQueueEntry> getEntries​(int skip,
                                                                int limit)

Description copied from interface: `DistributionQueue`
get all the entries in the queue

Specified by:
  `getEntries` in interface `DistributionQueue`
Parameters:
  `skip` - the number of entries to skip
  `limit` - the maximum number of entries to return. use -1 to return all entries.
Returns:
  a `Iterable` of `DistributionQueueEntry` entries

#### getEntry

    @Nullable
    public @Nullable DistributionQueueEntry getEntry​(@NotNull
                                                     @NotNull String itemId)

Description copied from interface: `DistributionQueue`
gets an entry from the queue by specifying its id

Specified by:
  `getEntry` in interface `DistributionQueue`
Parameters:
  `itemId` - the entry identifier
Returns:
  the entry, or `null` if the entry with the given id doesn't exist

#### remove

    @NotNull
    public @NotNull Iterable<DistributionQueueEntry> remove​(@NotNull
                                                            @NotNull Set<String> entryIds)

Description copied from interface: `DistributionQueue`
Remove a set entries from the queue by specifying their identifiers.

Specified by:
  `remove` in interface `DistributionQueue`
Parameters:
  `entryIds` - The identifiers of the entries to be removed
Returns:
  an iterable over the removed entries

#### remove

    @Nullable
    public @Nullable DistributionQueueEntry remove​(@NotNull
                                                   @NotNull String itemId)

Description copied from interface: `DistributionQueue`
remove an entry from the queue by specifying its id

Specified by:
  `remove` in interface `DistributionQueue`
Parameters:
  `itemId` - the entry identifier
Returns:
  the removed entry, or `null` if the entry with the given id doesn't exist

#### getStatus

    @NotNull
    public @NotNull DistributionQueueStatus getStatus()

Description copied from interface: `DistributionQueue`
get the status of the queue

Specified by:
  `getStatus` in interface `DistributionQueue`
Returns:
  the queue status

#### getType

    @NotNull
    public @NotNull DistributionQueueType getType()

Description copied from interface: `DistributionQueue`
get the type of this queue

Specified by:
  `getType` in interface `DistributionQueue`
Returns:
  the type

#### clear

    @NotNull
    public @NotNull Iterable<DistributionQueueEntry> clear​(int limit)

Description copied from interface: `DistributionQueue`
Clear a range of entries from the queue. The range starts from the head entry, includes the specified #limit number of entries.

Specified by:
  `clear` in interface `DistributionQueue`
Parameters:
  `limit` - The maximum number of entries to remove. All entries are removed when the limit is `-1`.
Returns:
  an iterable over the removed entries

#### hasCapability

    public boolean hasCapability​(@NotNull
                                 @NotNull String capability)

Specified by:
  `hasCapability` in interface `DistributionQueue`
Returns:
  `true` if the queue supports the capability ; `false` otherwise